diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 62ff3680b..9fb3b7bf2 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,83 +1,83 @@ -name: Tests - -on: [push, pull_request] - -jobs: - lexer: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: Setup Python - uses: actions/setup-python@v2 - - - name: Install requirements - run: pip install -r requirements.txt - - - name: Run tests - run: | - cd src - make clean - make - make test TAG=lexer - - parser: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: Setup Python - uses: actions/setup-python@v2 - - - name: Install requirements - run: pip install -r requirements.txt - - - name: Run tests - run: | - cd src - make clean - make - make test TAG=parser - - semantic: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: Setup Python - uses: actions/setup-python@v2 - - - name: Install requirements - run: pip install -r requirements.txt - - - name: Run tests - run: | - cd src - make clean - make - make test TAG=semantic - - codegen: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: Setup Python - uses: actions/setup-python@v2 - - - name: Install requirements - run: pip install -r requirements.txt - - - name: Install spim - run: sudo apt-get install spim - - - name: Run tests - run: | - cd src - make clean - make - make test TAG=codegen +name: Tests + +on: [push, pull_request] + +jobs: + lexer: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Setup Python + uses: actions/setup-python@v2 + + - name: Install requirements + run: pip install -r requirements.txt + + - name: Run tests + run: | + cd src + make clean + make + make test TAG=lexer + + parser: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Setup Python + uses: actions/setup-python@v2 + + - name: Install requirements + run: pip install -r requirements.txt + + - name: Run tests + run: | + cd src + make clean + make + make test TAG=parser + + semantic: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Setup Python + uses: actions/setup-python@v2 + + - name: Install requirements + run: pip install -r requirements.txt + + - name: Run tests + run: | + cd src + make clean + make + make test TAG=semantic + + codegen: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Setup Python + uses: actions/setup-python@v2 + + - name: Install requirements + run: pip install -r requirements.txt + + - name: Install spim + run: sudo apt-get install spim + + - name: Run tests + run: | + cd src + make clean + make + make test TAG=codegen diff --git a/.gitignore b/.gitignore index 4acafde18..30c7fba32 100644 --- a/.gitignore +++ b/.gitignore @@ -1,410 +1,405 @@ -# File created using '.gitignore Generator' for Visual Studio Code: https://bit.ly/vscode-gig - -# Created by https://www.gitignore.io/api/visualstudiocode,linux,latex,python -# Edit at https://www.gitignore.io/?templates=visualstudiocode,linux,latex,python - -### LaTeX ### -## Core latex/pdflatex auxiliary files: -*.aux -*.lof -*.log -*.lot -*.fls -*.out -*.toc -*.fmt -*.fot -*.cb -*.cb2 -.*.lb - -## Intermediate documents: -*.dvi -*.xdv -*-converted-to.* -# these rules might exclude image files for figures etc. -# *.ps -# *.eps -# *.pdf - -## Generated if empty string is given at "Please type another file name for output:" -.pdf - -## Bibliography auxiliary files (bibtex/biblatex/biber): -*.bbl -*.bcf -*.blg -*-blx.aux -*-blx.bib -*.run.xml - -## Build tool auxiliary files: -*.fdb_latexmk -*.synctex -*.synctex(busy) -*.synctex.gz -*.synctex.gz(busy) -*.pdfsync - -## Build tool directories for auxiliary files -# latexrun -latex.out/ - -## Auxiliary and intermediate files from other packages: -# algorithms -*.alg -*.loa - -# achemso -acs-*.bib - -# amsthm -*.thm - -# beamer -*.nav -*.pre -*.snm -*.vrb - -# changes -*.soc - -# comment -*.cut - -# cprotect -*.cpt - -# elsarticle (documentclass of Elsevier journals) -*.spl - -# endnotes -*.ent - -# fixme -*.lox - -# feynmf/feynmp -*.mf -*.mp -*.t[1-9] -*.t[1-9][0-9] -*.tfm - -#(r)(e)ledmac/(r)(e)ledpar -*.end -*.?end -*.[1-9] -*.[1-9][0-9] -*.[1-9][0-9][0-9] -*.[1-9]R -*.[1-9][0-9]R -*.[1-9][0-9][0-9]R -*.eledsec[1-9] -*.eledsec[1-9]R -*.eledsec[1-9][0-9] -*.eledsec[1-9][0-9]R -*.eledsec[1-9][0-9][0-9] -*.eledsec[1-9][0-9][0-9]R - -# glossaries -*.acn -*.acr -*.glg -*.glo -*.gls -*.glsdefs - -# uncomment this for glossaries-extra (will ignore makeindex's style files!) -# *.ist - -# gnuplottex -*-gnuplottex-* - -# gregoriotex -*.gaux -*.gtex - -# htlatex -*.4ct -*.4tc -*.idv -*.lg -*.trc -*.xref - -# hyperref -*.brf - -# knitr -*-concordance.tex -# TODO Comment the next line if you want to keep your tikz graphics files -*.tikz -*-tikzDictionary - -# listings -*.lol - -# luatexja-ruby -*.ltjruby - -# makeidx -*.idx -*.ilg -*.ind - -# minitoc -*.maf -*.mlf -*.mlt -*.mtc[0-9]* -*.slf[0-9]* -*.slt[0-9]* -*.stc[0-9]* - -# minted -_minted* -*.pyg - -# morewrites -*.mw - -# nomencl -*.nlg -*.nlo -*.nls - -# pax -*.pax - -# pdfpcnotes -*.pdfpc - -# sagetex -*.sagetex.sage -*.sagetex.py -*.sagetex.scmd - -# scrwfile -*.wrt - -# sympy -*.sout -*.sympy -sympy-plots-for-*.tex/ - -# pdfcomment -*.upa -*.upb - -# pythontex -*.pytxcode -pythontex-files-*/ - -# tcolorbox -*.listing - -# thmtools -*.loe - -# TikZ & PGF -*.dpth -*.md5 -*.auxlock - -# todonotes -*.tdo - -# vhistory -*.hst -*.ver - -# easy-todo -*.lod - -# xcolor -*.xcp - -# xmpincl -*.xmpi - -# xindy -*.xdy - -# xypic precompiled matrices -*.xyc - -# endfloat -*.ttt -*.fff - -# Latexian -TSWLatexianTemp* - -## Editors: -# WinEdt -*.bak -*.sav - -# Texpad -.texpadtmp - -# LyX -*.lyx~ - -# Kile -*.backup - -# KBibTeX -*~[0-9]* - -# auto folder when using emacs and auctex -./auto/* -*.el - -# expex forward references with \gathertags -*-tags.tex - -# standalone packages -*.sta - -### LaTeX Patch ### -# glossaries -*.glstex - -### Linux ### -*~ - -# temporary files which can be created if a process still has a handle open of a deleted file -.fuse_hidden* - -# KDE directory preferences -.directory - -# Linux trash folder which might appear on any partition or disk -.Trash-* - -# .nfs files are created when an open file is removed but is still being accessed -.nfs* - -### Python ### -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] -*$py.class - -# C extensions -*.so - -# Distribution / packaging -.Python -build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -.eggs/ -lib/ -lib64/ -parts/ -sdist/ -var/ -wheels/ -pip-wheel-metadata/ -share/python-wheels/ -*.egg-info/ -.installed.cfg -*.egg -MANIFEST - -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -*.spec - -# Installer logs -pip-log.txt -pip-delete-this-directory.txt - -# Unit test / coverage reports -htmlcov/ -.tox/ -.nox/ -.coverage -.coverage.* -.cache -nosetests.xml -coverage.xml -*.cover -.hypothesis/ -.pytest_cache/ - -# Translations -*.mo -*.pot - -# Scrapy stuff: -.scrapy - -# Sphinx documentation -docs/_build/ - -# PyBuilder -target/ - -# pyenv -.python-version - -# pipenv -# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. -# However, in case of collaboration, if having platform-specific dependencies or dependencies -# having no cross-platform support, pipenv may install dependencies that don't work, or not -# install all needed dependencies. -#Pipfile.lock - -# celery beat schedule file -celerybeat-schedule - -# SageMath parsed files -*.sage.py - -# Spyder project settings -.spyderproject -.spyproject - -# Rope project settings -.ropeproject - -# Mr Developer -.mr.developer.cfg -.project -.pydevproject - -# mkdocs documentation -/site - -# mypy -.mypy_cache/ -.dmypy.json -dmypy.json - -# Pyre type checker -.pyre/ - -### VisualStudioCode ### -.vscode/* -!.vscode/settings.json -!.vscode/tasks.json -!.vscode/launch.json -!.vscode/extensions.json - -### VisualStudioCode Patch ### -# Ignore all local history of files -.history - -# End of https://www.gitignore.io/api/visualstudiocode,linux,latex,python - -# Custom rules (everything added below won't be overriden by 'Generate .gitignore File' if you use 'Update' option) - +# File created using '.gitignore Generator' for Visual Studio Code: https://bit.ly/vscode-gig + +# Created by https://www.gitignore.io/api/visualstudiocode,linux,latex,python +# Edit at https://www.gitignore.io/?templates=visualstudiocode,linux,latex,python + +### LaTeX ### +## Core latex/pdflatex auxiliary files: +*.aux +*.lof +*.log +*.lot +*.fls +*.out +*.toc +*.fmt +*.fot +*.cb +*.cb2 +.*.lb + +## Intermediate documents: +*.dvi +*.xdv +*-converted-to.* +# these rules might exclude image files for figures etc. +# *.ps +# *.eps +# *.pdf + +## Generated if empty string is given at "Please type another file name for output:" +.pdf + +## Bibliography auxiliary files (bibtex/biblatex/biber): +*.bbl +*.bcf +*.blg +*-blx.aux +*-blx.bib +*.run.xml + +## Build tool auxiliary files: +*.fdb_latexmk +*.synctex +*.synctex(busy) +*.synctex.gz +*.synctex.gz(busy) +*.pdfsync + +## Build tool directories for auxiliary files +# latexrun +latex.out/ + +## Auxiliary and intermediate files from other packages: +# algorithms +*.alg +*.loa + +# achemso +acs-*.bib + +# amsthm +*.thm + +# beamer +*.nav +*.pre +*.snm +*.vrb + +# changes +*.soc + +# comment +*.cut + +# cprotect +*.cpt + +# elsarticle (documentclass of Elsevier journals) +*.spl + +# endnotes +*.ent + +# fixme +*.lox + +# feynmf/feynmp +*.mf +*.mp +*.t[1-9] +*.t[1-9][0-9] +*.tfm + +#(r)(e)ledmac/(r)(e)ledpar +*.end +*.?end +*.[1-9] +*.[1-9][0-9] +*.[1-9][0-9][0-9] +*.[1-9]R +*.[1-9][0-9]R +*.[1-9][0-9][0-9]R +*.eledsec[1-9] +*.eledsec[1-9]R +*.eledsec[1-9][0-9] +*.eledsec[1-9][0-9]R +*.eledsec[1-9][0-9][0-9] +*.eledsec[1-9][0-9][0-9]R + +# glossaries +*.acn +*.acr +*.glg +*.glo +*.gls +*.glsdefs + +# uncomment this for glossaries-extra (will ignore makeindex's style files!) +# *.ist + +# gnuplottex +*-gnuplottex-* + +# gregoriotex +*.gaux +*.gtex + +# htlatex +*.4ct +*.4tc +*.idv +*.lg +*.trc +*.xref + +# hyperref +*.brf + +# knitr +*-concordance.tex +# TODO Comment the next line if you want to keep your tikz graphics files +*.tikz +*-tikzDictionary + +# listings +*.lol + +# luatexja-ruby +*.ltjruby + +# makeidx +*.idx +*.ilg +*.ind + +# minitoc +*.maf +*.mlf +*.mlt +*.mtc[0-9]* +*.slf[0-9]* +*.slt[0-9]* +*.stc[0-9]* + +# minted +_minted* +*.pyg + +# morewrites +*.mw + +# nomencl +*.nlg +*.nlo +*.nls + +# pax +*.pax + +# pdfpcnotes +*.pdfpc + +# sagetex +*.sagetex.sage +*.sagetex.py +*.sagetex.scmd + +# scrwfile +*.wrt + +# sympy +*.sout +*.sympy +sympy-plots-for-*.tex/ + +# pdfcomment +*.upa +*.upb + +# pythontex +*.pytxcode +pythontex-files-*/ + +# tcolorbox +*.listing + +# thmtools +*.loe + +# TikZ & PGF +*.dpth +*.md5 +*.auxlock + +# todonotes +*.tdo + +# vhistory +*.hst +*.ver + +# easy-todo +*.lod + +# xcolor +*.xcp + +# xmpincl +*.xmpi + +# xindy +*.xdy + +# xypic precompiled matrices +*.xyc + +# endfloat +*.ttt +*.fff + +# Latexian +TSWLatexianTemp* + +## Editors: +# WinEdt +*.bak +*.sav + +# Texpad +.texpadtmp + +# LyX +*.lyx~ + +# Kile +*.backup + +# KBibTeX +*~[0-9]* + +# auto folder when using emacs and auctex +./auto/* +*.el + +# expex forward references with \gathertags +*-tags.tex + +# standalone packages +*.sta + +### LaTeX Patch ### +# glossaries +*.glstex + +### Linux ### +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +### Python ### +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +# Created by .ignore support plugin (hsz.mobi) +### Python template +# Byte-compiled / optimized / DLL files +__pycache__/ +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +pip-wheel-metadata/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +.hypothesis/ +.pytest_cache/ + +# Translations +*.mo +*.pot + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# pyenv +.python-version + +# SageMath parsed files +*.sage.py + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# Mr Developer +.mr.developer.cfg +.project +.pydevproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +### VisualStudioCode ### +.vscode +.vscode/* +# !.vscode/settings.json +# !.vscode/tasks.json +# !.vscode/launch.json +# !.vscode/extensions.json + +### VisualStudioCode Patch ### +# Ignore all local history of files +.history +.idea +# End of https://www.gitignore.io/api/visualstudiocode,linux,latex,python + +# Custom rules (everything added below won't be overriden by 'Generate .gitignore File' if you use 'Update' option) + diff --git a/LICENSE b/LICENSE index 718bd210a..7f19c2d8c 100644 --- a/LICENSE +++ b/LICENSE @@ -1,21 +1,21 @@ -MIT License - -Copyright (c) 2021 School of Math and Computer Science, University of Havana - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +MIT License + +Copyright (c) 2021 School of Math and Computer Science, University of Havana + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Readme.md b/Readme.md index a47d48b9e..b22a31063 100644 --- a/Readme.md +++ b/Readme.md @@ -1,172 +1,9 @@ -# COOL: Proyecto de Compilación - -> Proyecto base para el compilador de 4to año en Ciencia de la Computación. - -## Generalidades - -La evaluación de la asignatura Complementos de Compilación, inscrita en el programa del 4to año de la Licenciatura en Ciencia de la Computación de la Facultad de Matemática y Computación de la -Universidad de La Habana, consiste este curso en la implementación de un compilador completamente -funcional para el lenguaje _COOL_. - -_COOL (Classroom Object-Oriented Language)_ es un pequeño lenguaje que puede ser implementado con un esfuerzo razonable en un semestre del curso. Aun así, _COOL_ mantiene muchas de las características de los lenguajes de programación modernos, incluyendo orientación a objetos, tipado estático y manejo automático de memoria. - -## Cómo comenzar (o terminar) - -El proyecto de Compilación será recogido y evaluado **únicamente** a través de Github. Es imprescindible tener una cuenta de Github para cada participante, y que su proyecto esté correctamente hosteado en esta plataforma. A continuación le damos las instrucciones mínimas necesarias para ello: - -### 1. Si no lo han hecho ya, regístrense en [Github](https://github.com) todos los miembros del equipo (es gratis). - -![](img/img1.png) - -### 2. Haga click en el botón **Fork** para hacer una copia del proyecto en el perfil de Github de uno de los miembros. - -Opcionalmente pueden [crear una organización](https://github.com/organizations/new) y copiar el proyecto en el perfil de la misma. - -![](img/img2.png) - -### 3. Una vez hecho esto, tendrá un nuevo repositorio en `github/`. - -Revise que el repositorio de su equipo está en su perfil. -En este ejemplo se ha copiado a la cuenta de `github.com/apiad`. - -Debe indicar bajo el nombre del repositorio: `"forked from matcom/cool-compiler-2021"`. - -![](img/img3.png) - -### 4. Clone este proyecto en un repositorio local. - -Busque la URL de su proyecto en la interfaz web de Github. - -Asegúrese de clonar **su copia** y no el proyecto original en `matcom/cool-compiler-2021`. - -![](img/img4.png) - -```bash -$ git clone git@github.com:/cool-compiler-2021.git -``` - -> Donde `` es posiblemente el nombre de su equipo o del miembro donde se hizo el _fork_. - -A partir de este punto debe tener un proyecto `cool-compiler-2021` local. -El siguiente paso depende de si usted ya tiene su código versionado con `git` o no. - -### 5.A. Si tiene su proyecto en git (y no quiere perder la historia): - -#### 5.1. Mezcle hacia el nuevo respositorio su repositorio anterior: - -```bash -$ cd cool-compiler-2021 -$ git pull --allow-unrelated-histories master -``` - -#### 5.2. Organice su proyecto, código fuente y documentación, de acuerdo a las instrucciones de este documento, y vuelva a hacer `commit`. - -```bash -$ mv src/ -$ git add . -$ git commit -a -m "Mezclado con el proyecto base" -``` - -#### 5.3. A partir de este punto puede hacer `push` cada vez que tenga cambios que subir. - -```bash -$ git push origin master -``` - -### 5.B Si aún no tiene su proyecto en git (o no le importa la historia): - -#### 5.1. Simplemente copie el código de su proyecto en la carpeta correspondiente `src` y haga su primer commit. - -```bash -$ mv src/ -$ git commit -a -m "Hello Git!" -``` - -#### 5.2. A partir de este punto asegúrese de hacer `commit` de forma regular para mantener su repositorio actualizado. - -Si necesita saber más sobre `git`, todo lo imprescindible está en [esta guía](doc/github-git-cheat-sheet.pdf). - -#### 5.3. A partir de este punto puede hacer `push` cada vez que tenga cambios que subir. - -```bash -$ git push origin master -``` - -## Entregas - -En este proyecto se realizarán entregas parciales a lo largo del curso. Para realizar una entrega, siga los siguientes pasos. - -### 1. Cree un pull request al proyecto original desde su copia. - -![](img/img5.png) - -### 2. Asegúrese de tener la siguiente configuración antes de hacer click en **Create pull request**. - -- **base repository**: `matcom/cool-compiler-2021` (repositorio original) - - **branch**: `master` -- **head repository**: `/cool-compiler-2021` (repositorio propio) - - **branch**: `master` (o la que corresponda) - -> Asegúrese que se indica **Able to merge**. De lo contrario, existen cambios en el repositorio original que usted no tiene, y debe actualizarlos. - -> **NOTA**: Asegúrese que el _pull request_ se hace a la rama `master`. - -![](img/img6.png) - -### 3. Introduzca un título y descripción adecuados, y haga click en **Create pull request**. - -![](img/img7.png) - -### 4. Espere mientras se ejecutan las pruebas. - -Verá la indicación **Some checks haven't completed yet**. - -![](img/img8.png) - -Es posible que tenga que actualizar los cambios que se hayan hecho en el repositorio original, por ejemplo, si se han agregado nuevos tests. En este caso obtendrá el siguiente mensaje: - -> **This branch is out-of-date with base branch** - -Haga click en **Update branch** y siga las instrucciones. -### 5. Verifique que no hubo errores en las pruebas. - -Si ve el mensaje **(All | Some) checks have failed**, significa que su código no pasó las pruebas. - -![](img/img9.png) - -Para ver los resultados de las pruebas haga click en el link **Details**. - -![](img/img10.png) - - -### 6. Arregle los errores y repita el paso 5 hasta que todas las pruebas pasen. - -Para cualquier modificación que haga a su proyecto, haga _commit_ y _push_ para **su repositorio personal** y automáticamente se actualizará el estado del _pull request_ y se volverán a ejecutar las pruebas. **No es necesario** abrir un _pull request_ nuevo por cada entrega, sino actualizar el anterior. - -> **Por favor asegúrese de mantener un solo _pull request_ activo por equipo**. En caso de abrir uno nuevo, cerrar el anterior. - -## Sobre la implementación - -Ponga todo su código e instrucciones necesarias en la carpeta `src`. Más información en [`src/Readme.md`](src/Readme.md). - -## Sobre la documentación - -Usted debe presentar un reporte escrito documentando el proceso de construcción de su compilador y los detalles más importantes de su funcionamiento. Más información en [`doc/Readme.md`](doc/Readme.md). - -## Sobre los equipos de desarrollo - -Para desarrollar el compilador del lenguaje COOL se trabajará en equipos de 2 o 3 integrantes. - -## Sobre los casos de prueba - -La carpeta `tests` contiene todos los casos de prueba que son obligatorios de pasar para que su proyecto tenga derecho a ser evaluado. - -Estos tests se ejecutan automáticamente cada vez que hace un _pull request_ al repositorio `matcom/cool-compiler-2021`. Solo aquellos proyectos que pasen todas las pruebas con éxito serán evaluados. - -Para ejecutar las pruebas localmente, debe tener instalado `Python 3.7`, `pip` y `make` (normalmente viene con Linux). Ejecute: - -```bash -$ pip install -r requirements.txt -$ cd src -$ make test -``` +# Cool Compiler for for compiling course + +## University of Havana, Matcom Faculty, Computer Science, 4th year + +### Students + + - Alejandro Klever Clemente C-411 + - Laura Tamayo Blanco C-411 + - Miguel Angel Gonzalez Calles C-411 diff --git a/doc/14-code-gen.pdf b/doc/14-code-gen.pdf new file mode 100644 index 000000000..2be5bfe01 Binary files /dev/null and b/doc/14-code-gen.pdf differ diff --git a/doc/Readme.md b/doc/Readme.md index 3b2569f5c..41c5e7772 100644 --- a/doc/Readme.md +++ b/doc/Readme.md @@ -1,33 +1,15 @@ -# Documentación - -## Readme - -Modifique el contenido de este documento para documentar de forma clara y concisa los siguientes aspectos: - -- Cómo ejecutar (y compilar si es necesario) su compilador. -- Requisitos adicionales, dependencias, configuración, etc. -- Opciones adicionales que tenga su compilador. - -## Sobre los Equipos de Desarrollo - -Para desarrollar el compilador del lenguaje COOL se trabajará en equipos de 2 o 3 integrantes. El proyecto de Compilación será recogido y evaluado únicamente a través de Github. Es imprescindible tener una cuenta de Github para cada participante, y que su proyecto esté correctamente hosteado en esta plataforma. - -**⚠️ NOTA**: Debe completar el archivo `team.yml` con los datos correctos de cada miembro de su equipo. - -## Sobre los Materiales a Entregar - -Para la evaluación del proyecto Ud. debe entregar un informe en formato PDF (`report.pdf`) en esta carpeta, que resuma de manera organizada y comprensible la arquitectura e implementación de su compilador. -El documento no tiene límite de extensión. -En él explicará en más detalle su solución a los problemas que, durante la implementación de cada una de las fases del proceso de compilación, hayan requerido de Ud. especial atención. - -## Estructura del reporte - -Usted es libre de estructurar su reporte escrito como más conveniente le parezca. A continuación le sugerimos algunas secciones que no deberían faltar, aunque puede mezclar, renombrar y organizarlas de la manera que mejor le parezca: - -- **Uso del compilador**: detalles sobre las opciones de líneas de comando, si tiene opciones adicionales (e.j., `--ast` genera un AST en JSON, etc.). Básicamente lo mismo que pondrá en este Readme. -- **Arquitectura del compilador**: una explicación general de la arquitectura, en cuántos módulos se divide el proyecto, cuantas fases tiene, qué tipo de gramática se utiliza, y en general, como se organiza el proyecto. Una buena imagen siempre ayuda. -- **Problemas técnicos**: detalles sobre cualquier problema teórico o técnico interesante que haya necesitado resolver de forma particular. - -## Sobre la Fecha de Entrega - -Se realizarán recogidas parciales del proyecto a lo largo del curso. En el Canal de Telegram se anunciará la fecha y requisitos de cada entrega. +# Documentación + +## Readme + + +El compilador ha sido realizado en el lenguaje de programación Python y posee las siguientes dependencias: + +- pytest +- pytest-ordering +- pyjapt +- typer + +Detalles sobre las versiones necesarias por cada biblioteca en el requirements.txt del proyecto. + +Para ejecutar el compilador es necesario ir al directorio src y una vez ahí ejecutar el comando \python coolc.py $ < $fichero de cool$ > $ para ejecutar el compilador. \ No newline at end of file diff --git a/doc/SPIM_Manual.pdf b/doc/SPIM_Manual.pdf new file mode 100644 index 000000000..b785613c8 Binary files /dev/null and b/doc/SPIM_Manual.pdf differ diff --git a/doc/report.pdf b/doc/report.pdf new file mode 100644 index 000000000..3dfd3e99f Binary files /dev/null and b/doc/report.pdf differ diff --git a/doc/team.yml b/doc/team.yml index c16162532..168b4bf1e 100644 --- a/doc/team.yml +++ b/doc/team.yml @@ -1,10 +1,10 @@ -members: - - name: Nombre Apellido1 Apellido2 - github: github_id - group: CXXX - - name: Nombre Apellido1 Apellido2 - github: github_id - group: CXXX - - name: Nombre Apellido1 Apellido2 - github: github_id - group: CXXX +members: + - name: Alejandro Klever Clemente + github: alejandroklever + group: C411 + - name: Miguel Angel Gonzales Calles + github: LauTB + group: C411 + - name: laura Tamayo Blanco + github: Migueacalle98 + group: C411 diff --git a/requirements.txt b/requirements.txt index 9eb0cad1a..624a299da 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,4 @@ -pytest -pytest-ordering +pytest +pytest-ordering +pyjapt~=0.3.1 +typer~=0.3.2 diff --git a/src/Readme.md b/src/Readme.md index 1200371b5..cdca282ec 100644 --- a/src/Readme.md +++ b/src/Readme.md @@ -1,78 +1,78 @@ -# COOL: Proyecto de Compilación - -La evaluación de la asignatura Complementos de Compilación, inscrita en el programa del 4to año de la Licenciatura en Ciencia de la Computación de la Facultad de Matemática y Computación de la -Universidad de La Habana, consiste este curso en la implementación de un compilador completamente -funcional para el lenguaje _COOL_. - -_COOL (Classroom Object-Oriented Language)_ es un pequeño lenguaje que puede ser implementado con un esfuerzo razonable en un semestre del curso. Aun así, _COOL_ mantiene muchas de las características de los lenguajes de programación modernos, incluyendo orientación a objetos, tipado estático y manejo automático de memoria. - -### Sobre el Lenguaje COOL - -Ud. podrá encontrar la especificación formal del lenguaje COOL en el documento _"COOL Language Reference Manual"_, que se distribuye junto con el presente texto. - -## Código Fuente - -### Compilando su proyecto - -Si es necesario compilar su proyecto, incluya todas las instrucciones necesarias en un archivo [`/src/makefile`](/src/makefile). -Durante la evaluación su proyecto se compilará ejecutando la siguiente secuencia: - -```bash -$ cd source -$ make clean -$ make -``` - -### Ejecutando su proyecto - -Incluya en un archivo [`/src/coolc.sh`](/src/coolc.sh) todas las instrucciones que hacen falta para lanzar su compilador. Recibirá como entrada un archivo con extensión `.cl` y debe generar como salida un archivo `.mips` cuyo nombre será el mismo que la entrada. - -Para lanzar el compilador, se ejecutará la siguiente instrucción: - -```bash -$ cd source -$ ./coolc.sh -``` - -### Sobre el Compilador de COOL - -El compilador de COOL se ejecutará como se ha definido anteriormente. -En caso de que no ocurran errores durante la operación del compilador, **coolc.sh** deberá terminar con código de salida 0, generar (o sobrescribir si ya existe) en la misma carpeta del archivo **.cl** procesado, y con el mismo nombre que éste, un archivo con extension **.mips** que pueda ser ejecutado con **spim**. Además, reportar a la salida estándar solamente lo siguiente: - - - - -En caso de que ocurran errores durante la operación del compilador, **coolc.sh** deberá terminar con código -de salida (exit code) 1 y reportar a la salida estándar (standard output stream) lo que sigue... - - - - _1 - ... - _n - -... donde `_i` tiene el siguiente formato: - - (,) - : - -Los campos `` y `` indican la ubicación del error en el fichero **.cl** procesado. En caso -de que la naturaleza del error sea tal que no pueda asociárselo a una línea y columna en el archivo de -código fuente, el valor de dichos campos debe ser 0. - -El campo `` será alguno entre: - -- `CompilerError`: se reporta al detectar alguna anomalía con la entrada del compilador. Por ejemplo, si el fichero a compilar no existe. -- `LexicographicError`: errores detectados por el lexer. -- `SyntacticError`: errores detectados por el parser. -- `NameError`: se reporta al referenciar un `identificador` en un ámbito en el que no es visible. -- `TypeError`: se reporta al detectar un problema de tipos. Incluye: - - incompatibilidad de tipos entre `rvalue` y `lvalue`, - - operación no definida entre objetos de ciertos tipos, y - - tipo referenciado pero no definido. -- `AttributeError`: se reporta cuando un atributo o método se referencia pero no está definido. -- `SemanticError`: cualquier otro error semántico. - -### Sobre la Implementación del Compilador de COOL - -El compilador debe estar implementado en `python`. Usted debe utilizar una herramienta generadora de analizadores -lexicográficos y sintácticos. Puede utilizar la que sea de su preferencia. +# COOL: Proyecto de Compilación + +La evaluación de la asignatura Complementos de Compilación, inscrita en el programa del 4to año de la Licenciatura en Ciencia de la Computación de la Facultad de Matemática y Computación de la +Universidad de La Habana, consiste este curso en la implementación de un compilador completamente +funcional para el lenguaje _COOL_. + +_COOL (Classroom Object-Oriented Language)_ es un pequeño lenguaje que puede ser implementado con un esfuerzo razonable en un semestre del curso. Aun así, _COOL_ mantiene muchas de las características de los lenguajes de programación modernos, incluyendo orientación a objetos, tipado estático y manejo automático de memoria. + +### Sobre el Lenguaje COOL + +Ud. podrá encontrar la especificación formal del lenguaje COOL en el documento _"COOL Language Reference Manual"_, que se distribuye junto con el presente texto. + +## Código Fuente + +### Compilando su proyecto + +Si es necesario compilar su proyecto, incluya todas las instrucciones necesarias en un archivo [`/src/makefile`](/src/makefile). +Durante la evaluación su proyecto se compilará ejecutando la siguiente secuencia: + +```bash +$ cd source +$ make clean +$ make +``` + +### Ejecutando su proyecto + +Incluya en un archivo [`/src/coolc.sh`](/src/coolc.sh) todas las instrucciones que hacen falta para lanzar su compilador. Recibirá como entrada un archivo con extensión `.cl` y debe generar como salida un archivo `.mips` cuyo nombre será el mismo que la entrada. + +Para lanzar el compilador, se ejecutará la siguiente instrucción: + +```bash +$ cd source +$ ./coolc.sh +``` + +### Sobre el Compilador de COOL + +El compilador de COOL se ejecutará como se ha definido anteriormente. +En caso de que no ocurran errores durante la operación del compilador, **coolc.sh** deberá terminar con código de salida 0, generar (o sobrescribir si ya existe) en la misma carpeta del archivo **.cl** procesado, y con el mismo nombre que éste, un archivo con extension **.mips** que pueda ser ejecutado con **spim**. Además, reportar a la salida estándar solamente lo siguiente: + + + + +En caso de que ocurran errores durante la operación del compilador, **coolc.sh** deberá terminar con código +de salida (exit code) 1 y reportar a la salida estándar (standard output stream) lo que sigue... + + + + _1 + ... + _n + +... donde `_i` tiene el siguiente formato: + + (,) - : + +Los campos `` y `` indican la ubicación del error en el fichero **.cl** procesado. En caso +de que la naturaleza del error sea tal que no pueda asociárselo a una línea y columna en el archivo de +código fuente, el valor de dichos campos debe ser 0. + +El campo `` será alguno entre: + +- `CompilerError`: se reporta al detectar alguna anomalía con la entrada del compilador. Por ejemplo, si el fichero a compilar no existe. +- `LexicographicError`: errores detectados por el lexer. +- `SyntacticError`: errores detectados por el parser. +- `NameError`: se reporta al referenciar un `identificador` en un ámbito en el que no es visible. +- `TypeError`: se reporta al detectar un problema de tipos. Incluye: + - incompatibilidad de tipos entre `rvalue` y `lvalue`, + - operación no definida entre objetos de ciertos tipos, y + - tipo referenciado pero no definido. +- `AttributeError`: se reporta cuando un atributo o método se referencia pero no está definido. +- `SemanticError`: cualquier otro error semántico. + +### Sobre la Implementación del Compilador de COOL + +El compilador debe estar implementado en `python`. Usted debe utilizar una herramienta generadora de analizadores +lexicográficos y sintácticos. Puede utilizar la que sea de su preferencia. diff --git a/src/cool/__init__.py b/src/cool/__init__.py new file mode 100644 index 000000000..cdbd923c5 --- /dev/null +++ b/src/cool/__init__.py @@ -0,0 +1 @@ +from .__main__ import check_semantics, CoolLexer, CoolParser diff --git a/src/cool/__main__.py b/src/cool/__main__.py new file mode 100644 index 000000000..0fbf27543 --- /dev/null +++ b/src/cool/__main__.py @@ -0,0 +1,200 @@ +import os +import sys +from pathlib import Path +from typing import List + +import typer + +sys.path.append(os.getcwd()) + +from cool.code_generation import ( + CilFormatter, + MipsFormatter, + ExtendedCoolTranslator, + ExtendedCoolTypeChecker, + CoolToCilTranslator, + CilToMipsTranslator +) +from cool.grammar import Token, serialize_parser_and_lexer +from cool.lexertab import CoolLexer +from cool.parsertab import CoolParser +from cool.semantics import ( + CodeBuilder, + InferenceChecker, + OverriddenMethodChecker, + PositionAssigner, + TypeBuilderForFeatures, + TypeBuilderForInheritance, + TypeChecker, + TypeCollector, + topological_sorting, +) +from cool.semantics.utils.scope import Context, Scope + +app = typer.Typer() + + +def log_success(s: str): + styled_e = typer.style(s, fg=typer.colors.GREEN, bold=True) + typer.echo(styled_e) + + +def log_error(s: str): + styled_e = typer.style(s, fg=typer.colors.RED, bold=True) + typer.echo(styled_e) + + +def format_tokens(tokens: List[Token]) -> str: + s = "" + last_line = 1 + for t in tokens: + if t.line != last_line: + last_line = t.line + s += "\n" + " " * t.column + else: + s += " " + s += t.token_type.name + return s + + +def tokenize(program: str, verbose: bool = False): + lexer = CoolLexer() + tokens = lexer(program) + + if lexer.contain_errors: + for e in lexer.errors: + log_error(e) + + if verbose: + log_success("Tokens:") + log_success("-" * 80) + log_success(format_tokens(tokens) + "\n") + log_success("-" * 80) + print() + + return tokens, lexer + + +def parse(tokens: List[Token], verbose: bool = False): + parser = CoolParser(verbose) + ast = parser(tokens) + + if parser.contains_errors: + for e in parser.errors: + log_error(e) + + return ast, parser + + +def check_semantics(ast, scope: Scope, context: Context, errors: List[str]): + TypeCollector(context, errors).visit(ast) + TypeBuilderForInheritance(context, errors).visit(ast) + topological_sorting(ast, context, errors) + if not errors: + TypeBuilderForFeatures(context, errors).visit(ast) + OverriddenMethodChecker(context, errors).visit(ast) + InferenceChecker(context, errors).visit(ast, Scope()) + TypeChecker(context, errors).visit(ast, scope) + return ast, scope, context, errors + + +def cool_to_cil(): + pass + + +@app.command() +def compile( + input_file: typer.FileText = typer.Argument(..., help="Cool file"), + output_file: typer.FileTextWrite = typer.Argument("a.mips", help="Mips file"), + verbose: bool = typer.Option(False, help="Run in verbose mode."), + cil: bool = typer.Option(False, help="Output CIL code instead of MIPS code."), +): + # In case of encoding conflict + if input_file.encoding.lower != "utf-8": + input_file = open(input_file.name, encoding="utf-8") + + cil_program = input_file.read() + tokens, lexer = tokenize(cil_program, verbose) + + if lexer is None or lexer.contain_errors: + exit(1) + + if not tokens[:-1]: # there is always at least the EOF token + log_error("(0, 0) - SyntacticError: ERROR at or near EOF") + exit(1) + + ast, parser = parse(tokens, verbose) + + # parsing process failed + if ast is None: + exit(1) + + PositionAssigner(tokens).visit(ast) + ast, scope, context, errors = check_semantics(ast, Scope(), Context(), []) + + if errors or parser.contains_errors: + for e in errors: + log_error(e) + exit(1) + + ################### + # Code Generation # + ################### + icool_ast = ExtendedCoolTranslator(context).visit(ast) + + scope = Scope() + ExtendedCoolTypeChecker(context, errors).visit(icool_ast, scope) + + # if verbose or True: + # log_success(CodeBuilder().visit(icool_ast)) + + cil_ast = CoolToCilTranslator(context).visit(icool_ast, scope) + mips_ast = CilToMipsTranslator(context).visit(cil_ast) + + if verbose or True: + if cil: + with open(f"{input_file.name[:-2]}cil", "w+") as cil_file: + cil_program = CilFormatter().visit(cil_ast) + cil_file.write(cil_program) + + mips_program = MipsFormatter().visit(mips_ast) + output_file.write(mips_program) + output_file.close() + + ####### + # End # + ####### + + exit(0) + + +@app.command() +def serialize(): + serialize_parser_and_lexer() + + cwd = os.getcwd() + + lexertab = os.path.join(cwd, "lexertab.py") + parsertab = os.path.join(cwd, "parsertab.py") + + cool_lexertab = Path(os.path.join(cwd, "cool", "lexertab.py")) + cool_parsertab = Path(os.path.join(cwd, "cool", "parsertab.py")) + + mode = "w" if cool_lexertab.exists() else "x" + fr = open(lexertab, "r") + with cool_lexertab.open(mode) as fw: + fw.write(fr.read().replace("from grammar", "from cool.grammar")) + fr.close() + + mode = "w" if cool_parsertab.exists() else "x" + fr = open(parsertab, "r") + with cool_parsertab.open(mode) as fw: + fw.write(fr.read().replace("from grammar", "from cool.grammar")) + fr.close() + + os.remove(lexertab) + os.remove(parsertab) + + +if __name__ == "__main__": + app() diff --git a/src/cool/code_generation/__init__.py b/src/cool/code_generation/__init__.py new file mode 100644 index 000000000..b60429f9a --- /dev/null +++ b/src/cool/code_generation/__init__.py @@ -0,0 +1,3 @@ +from .translator_cool_to_cil import ExtendedCoolTranslator, ExtendedCoolTypeChecker, CoolToCilTranslator +from .translator_cil_to_mips import CilToMipsTranslator +from .formatters import CilFormatter, MipsFormatter diff --git a/src/cool/code_generation/ast_cil.py b/src/cool/code_generation/ast_cil.py new file mode 100644 index 000000000..858c135d4 --- /dev/null +++ b/src/cool/code_generation/ast_cil.py @@ -0,0 +1,386 @@ +from operator import le +from typing import Any, List, Optional, Tuple + + +class Node: + comment: str = "" + + def set_comment(self, comment: str) -> "Node": + self.comment = comment + return self + + +class ProgramNode(Node): + def __init__( + self, + dottypes: List["TypeNode"], + dotdata: List["DataNode"], + dotcode: List["FunctionNode"], + ): + self.dottypes: List[TypeNode] = dottypes + self.dotdata: List[DataNode] = dotdata + self.dotcode: List[FunctionNode] = dotcode + + +class TypeNode(Node): + def __init__(self, name: str, parent: Optional[str] = None): + self.name: str = name + self.parent: str = parent or "null" + self.attributes: List[str] = [] + self.methods: List[Tuple[str, str]] = [] + + +class DataNode(Node): + def __init__(self, name: str, value: Any): + self.name: str = name + self.value: Any = value + + +class FunctionNode(Node): + def __init__( + self, + name: str, + params: List["ParamNode"], + local_vars: List["LoadNode"], + instructions: List["InstructionNode"], + ): + self.name: str = name + self.params: List[ParamNode] = params + self.local_vars: List[LocalNode] = local_vars + self.instructions: List[InstructionNode] = instructions + + +class ParamNode(Node): + def __init__(self, name: str): + self.name: str = name + + +class LocalNode(Node): + def __init__(self, name: str, type: str = "Object"): + self.name: str = name + self.type: str = type + + +class InstructionNode(Node): + pass + + +class AssignNode(InstructionNode): + def __init__(self, dest: str, source: str): + self.dest: str = dest + self.source: str = source + + +class AssignIntNode(InstructionNode): + def __init__(self, dest: str, source: str): + self.dest: str = dest + self.source: str = source + + +class ArithmeticNode(InstructionNode): + def __init__(self, dest: str, left: str, right: str): + self.dest: str = dest + self.left: str = left + self.right: str = right + + +class PlusNode(ArithmeticNode): + pass + + +class MinusNode(ArithmeticNode): + pass + + +class StarNode(ArithmeticNode): + pass + + +class DivNode(ArithmeticNode): + pass + + +class LessEqualNode(ArithmeticNode): + pass + + +class LessThanNode(ArithmeticNode): + pass + + +class EqualNode(ArithmeticNode): + pass + + +class XorNode(ArithmeticNode): + pass + + +class GetMethodNode(InstructionNode): + def __init__(self, dest: str, instance: str, method_index: str, method_name: str, type: str) -> None: + self.dest: str = dest + self.instance: str = instance + self.method_index: str = method_index + self.method_name: str = method_name + self.type: str = type + +class GetAttributeNode(InstructionNode): + def __init__(self, dest: str, instance: str, attr: str, attr_index: int) -> None: + self.dest: str = dest + self.instance: str = instance + self.attr: str = attr + self.attr_index: int = attr_index + + + +class SetAttributeNode(InstructionNode): + def __init__(self, instance: str, attr: str, source: str, attr_index: int) -> None: + self.instance: str = instance + self.attr: str = attr + self.source: str = source + self.attr_index: int = attr_index + +class GetIndexNode(InstructionNode): + def __init__(self, dest: str, instance: str, index: str) -> None: + self.dest: str = dest + self.instance: str = instance + self.index: str = index + + +class SetIndexNode(InstructionNode): + def __init__(self, instance: str, index: int, source: str) -> None: + self.instance: str = instance + self.index: int = index + self.source: str = source + + +class GetValueInIndexNode(InstructionNode): + def __init__(self, dest: str, instance: str, index: str) -> None: + self.dest: str = dest + self.instance: str = instance + self.index: str = index + + +class SetValueInIndexNode(InstructionNode): + def __init__(self, instance: str, index: int, source: str) -> None: + self.instance: str = instance + self.index: int = index + self.source: str = source + + + +class AllocateNode(InstructionNode): + def __init__(self, itype: str, dest: str): + self.type: str = itype + self.dest: str = dest + + +class AllocateIntNode(InstructionNode): + def __init__(self, dest: str, value: str): + self.dest: str = dest + self.value: str = value + + +class AllocateBoolNode(InstructionNode): + def __init__(self, dest: str, value: str): + self.dest: str = dest + self.value: str = value + + +class AllocateNullPtrNode(InstructionNode): + def __init__(self, dest: str): + self.dest: str = dest + + +class ArrayNode(InstructionNode): + def __init__(self, dest: str, size: int) -> None: + self.dest: str = dest + self.size: int = size + + +class TypeOfNode(InstructionNode): + def __init__( + self, + dest: str, + obj: str, + ): + self.source: str = obj + self.dest: str = dest + + +class AncestorNode(InstructionNode): + def __init__(self, dest: str, source: str): + self.source: str = source + self.dest: str = dest + + +class TypeAddressNode(InstructionNode): + def __init__(self, dest: str, name: str): + self.name: str = name + self.dest: str = dest + + +class EqualAddressNode(InstructionNode): + def __init__(self, dest: str, left: str, right: str): + self.left: str = left + self.right: str = right + self.dest: str = dest + + +class EqualIntNode(InstructionNode): + def __init__(self, dest: str, left: str, right: str): + self.left: str = left + self.right: str = right + self.dest: str = dest + + +class EqualStrNode(InstructionNode): + def __init__(self, dest: str, left: str, right: str): + self.left: str = left + self.right: str = right + self.dest: str = dest + +class LabelNode(InstructionNode): + def __init__(self, label: str): + self.label: str = label + + +class GotoNode(InstructionNode): + def __init__(self, address: str): + self.address: str = address + + +class GotoIfNode(InstructionNode): + def __init__(self, condition: str, address: str): + self.condition: str = condition + self.address: str = address + + +class StaticCallNode(InstructionNode): + def __init__(self, function: str, dest: str, total_args: int): + self.function: str = function + self.dest: str = dest + self.total_args: str = total_args + + +class DynamicCallNode(InstructionNode): + def __init__(self, xtype: str, method_address: str, dest: str, total_args: int): + self.type = xtype + self.method_address = method_address + self.dest = dest + self.total_args = total_args + + +class ArgNode(InstructionNode): + def __init__(self, name: str, arg_index: int, total_args: int): + self.name: str = name + self.arg_index: int = arg_index + self.total_args: int = total_args + + +class ReturnNode(InstructionNode): + def __init__(self, value: str = None): + self.value: str = value + + +class LoadNode(InstructionNode): + def __init__(self, dest, msg): + self.dest = dest + self.msg = msg + + +class LengthNode(InstructionNode): + def __init__(self, dest: str, str_address: str) -> None: + self.dest: str = dest + self.str_address: str = str_address + + +class ConcatNode(InstructionNode): + def __init__(self, dest: str, str1: str, str2: str): + self.dest: str = dest + self.str1: str = str1 + self.str2: str = str2 + + +class PrefixNode(InstructionNode): + pass + + +class SubstringNode(InstructionNode): + def __init__(self, dest: str, str_address: str, start: int, length: int): + self.dest: str = dest + self.str_address: str = str_address + self.start: int = start + self.length: int = length + +class AllocateStrNode(InstructionNode): + def __init__(self, dest: str, value: str): + self.dest: str = dest + self.value: str = value + + @property + def string(self): + s = self.value.replace('\\n', '\n') + s = s.replace('\\t', '\t') + s = s.replace('\\b', '\b') + s = s.replace('\\f', '\f') + return s[1:-1] + + @property + def length(self): + x = self.value.count('\\n') + x += self.value.count('\\t') + x += self.value.count('\\b') + x += self.value.count('\\f') + return len(self.value) - x - 2 + +class ReadStringNode(InstructionNode): + def __init__(self, dest): + self.dest = dest + + +class ReadIntNode(InstructionNode): + def __init__(self, dest): + self.dest = dest + + +class PrintStringNode(InstructionNode): + def __init__(self, str_addr): + self.str_addr = str_addr + + +class PrintIntNode(InstructionNode): + def __init__(self, value): + self.source = value + + +class CopyNode(InstructionNode): + def __init__(self, dest: str, source: str) -> None: + self.dest: str = dest + self.source: str = source + + +class CommentNode(InstructionNode): + def __init__(self, comment): + self.comment = comment + + +class EmptyInstruction(InstructionNode): + def __init__(self): + pass + + +class TypeNameNode(InstructionNode): + def __init__(self, dest, source): + self.dest = dest + self.source = source + + +class HaltNode(InstructionNode): + def __init__(self): + pass + + +class PrintTypeNameNode(InstructionNode): + def __init__(self, address: str): + self.address: str = address \ No newline at end of file diff --git a/src/cool/code_generation/ast_ecool.py b/src/cool/code_generation/ast_ecool.py new file mode 100644 index 000000000..7ac09a799 --- /dev/null +++ b/src/cool/code_generation/ast_ecool.py @@ -0,0 +1,27 @@ +""" +ExtendedCool is a language similar to Cool, but with some additional +features like the new keyword null in the asignments and the creation of +a default constructor for every class defined in the program. +""" + +import cool.semantics.utils.astnodes as cool +from cool.semantics.utils.scope import Type + + +class NullType(Type): + def __init__(self): + super().__init__("null") + + def conforms_to(self, other: "Type") -> bool: + return True + + def bypass(self) -> bool: + return True + + def __str__(self): + return self.name + + +class NullNode(cool.AtomicNode): + def __init__(self): + super().__init__("NULL") diff --git a/src/cool/code_generation/ast_mips.py b/src/cool/code_generation/ast_mips.py new file mode 100644 index 000000000..9c0aa79df --- /dev/null +++ b/src/cool/code_generation/ast_mips.py @@ -0,0 +1,318 @@ +from typing import List + + +class Node: + comment: str = "" + + def set_comment(self, comment: str) -> "Node": + self.comment = comment + return self + + +class ProgramNode(Node): + def __init__(self, dotdata: List["DataNode"], dottext: List["InstructionNode"]): + self.dotdata: List[DataNode] = dotdata + self.dottext: List[InstructionNode] = dottext + + +class DataNode(Node): + data_type: str = "" + + def __init__(self, name: str, value: str): + self.name = name + self.value = value + + +class EmptyDataNode(Node): + pass + + +class WordDataNode(DataNode): + data_type = ".word" + + +class SpaceDataNode(DataNode): + data_type = ".space" + + +class AsciizDataNode(DataNode): + data_type = ".asciiz" + + +class InstructionNode(Node): + code: str = "" + + def __init__(self): + pass + + +class OneAddressInstructionNode(InstructionNode): + def __init__(self, dest: str): + self.dest: str = dest + + +class TwoAddressIntructionNode(InstructionNode): + def __init__(self, dest: str, source: str): + self.dest: str = dest + self.source: str = source + + +class ThreeAddressIntructionNode(InstructionNode): + def __init__(self, dest: str, source1: str, source2: str): + self.dest: str = dest + self.source1: str = source1 + self.source2: str = source2 + + +##################################### +# Arithmetic and Logic Instructions # +##################################### +class AddNode(ThreeAddressIntructionNode): + code = "add" + + +class AddiNode(ThreeAddressIntructionNode): + code = "addi" + + +class AdduNode(ThreeAddressIntructionNode): + code = "addu" + + +class AddiuNode(ThreeAddressIntructionNode): + code = "addiu" + + +class AndNode(ThreeAddressIntructionNode): + code = "and" + + +class AndiNode(ThreeAddressIntructionNode): + code = "andi" + + +class DivNode(TwoAddressIntructionNode): + code = "div" + + +class DivuNode(TwoAddressIntructionNode): + code = "divu" + + +class MultNode(TwoAddressIntructionNode): + code = "mult" + + +class MultuNode(TwoAddressIntructionNode): + code = "multu" + + +class NorNode(ThreeAddressIntructionNode): + code = "nor" + + +class OrNode(ThreeAddressIntructionNode): + code = "or" + + +class OriNode(ThreeAddressIntructionNode): + code = "ori" + + +class SllNode(ThreeAddressIntructionNode): + code = "sll" + + +class SllvNode(ThreeAddressIntructionNode): + code = "sllv" + + +class SraNode(ThreeAddressIntructionNode): + code = "sra" + + +class SravNode(ThreeAddressIntructionNode): + code = "srav" + + +class SrlNode(ThreeAddressIntructionNode): + code = "srl" + + +class SrlvNode(ThreeAddressIntructionNode): + code = "srlv" + + +class SubNode(ThreeAddressIntructionNode): + code = "sub" + + +class SubuNode(ThreeAddressIntructionNode): + code = "subu" + + +class XorNode(ThreeAddressIntructionNode): + code = "xor" + + +class XoriNode(ThreeAddressIntructionNode): + code = "xori" + + +class LuiNode(TwoAddressIntructionNode): + code = "lui" + + +class SltNode(ThreeAddressIntructionNode): + code = "slt" + + +class SltiNode(ThreeAddressIntructionNode): + code = "slti" + + +class SltuNode(ThreeAddressIntructionNode): + code = "sltu" + + +class SltiuNode(ThreeAddressIntructionNode): + code = "sltiu" + + +class SleNode(ThreeAddressIntructionNode): + code = "sle" + + +class SeqNode(ThreeAddressIntructionNode): + code = "seq" + +######################################### +# End Arithmetic and Logic Instructions # +######################################### + +################################ +# Branch and Jump Instructions # +################################ + + +class BeqNode(ThreeAddressIntructionNode): + code = "beq" + + +class BgtNode(ThreeAddressIntructionNode): + code = "bgt" + + +class BgeNode(ThreeAddressIntructionNode): + code = "bge" + + +class BgezNode(TwoAddressIntructionNode): + code = "bgez" + + +class BgezalNode(TwoAddressIntructionNode): + code = "bgezal" + + +class BgtzNode(TwoAddressIntructionNode): + code = "bgtz" + + +class BlezNode(TwoAddressIntructionNode): + code = "blez" + + +class BltzalNode(TwoAddressIntructionNode): + code = "bltzal" + + +class BltzNode(TwoAddressIntructionNode): + code = "bltz" + + +class BneNode(ThreeAddressIntructionNode): + code = "bne" + + +class JumpNode(OneAddressInstructionNode): + code = "j" + + +class JumpAndLinkNode(OneAddressInstructionNode): + code = "jal" + + +class JumpAndLinkRegisterNode(OneAddressInstructionNode): + code = "jalr" + + +class JumpRegisterNode(OneAddressInstructionNode): + code = "jr" + + +#################################### +# End Branch and Jump Instructions # +#################################### + + +####################################### +# Memory Access and Load Instructions # +####################################### + + +class LoadInmediateNode(TwoAddressIntructionNode): + code = "li" + + +class LoadAddressNode(TwoAddressIntructionNode): + code = "la" + + +class LoadByteNode(TwoAddressIntructionNode): + code = "lb" + + +class LoadWordNode(TwoAddressIntructionNode): + code = "lw" + + +class StoreWordNode(TwoAddressIntructionNode): + code = "sw" + + +class StoreByteNode(TwoAddressIntructionNode): + code = "sb" + + +class MoveNode(TwoAddressIntructionNode): + code = "move" + + +class MoveFromLowNode(OneAddressInstructionNode): + code = "mflo" + + +class MoveFromHighNode(OneAddressInstructionNode): + code = "mfhi" + + +########################################### +# End Memory Access and Load Instructions # +########################################### + +class SystemCallNode(InstructionNode): + code = "syscall" + + +class LabelNode(InstructionNode): + def __init__(self, name: str): + self.name: str = name + + +class CommentNode(InstructionNode): + def __init__(self, comment: str): + self.comment: str = comment + +class EmptyInstructionNode(InstructionNode): + pass diff --git a/src/cool/code_generation/formatters.py b/src/cool/code_generation/formatters.py new file mode 100644 index 000000000..e70c3be73 --- /dev/null +++ b/src/cool/code_generation/formatters.py @@ -0,0 +1,505 @@ +import cool.code_generation.ast_cil as cil +import cool.code_generation.ast_mips as mips +import cool.visitor as visitor + + +class CilFormatter: + @visitor.on("node") + def visit(self, node): + pass + + @visitor.when(cil.ProgramNode) + def visit(self, node: cil.ProgramNode): + dottypes = "\n".join(self.visit(t) for t in node.dottypes) + dotdata = "\n".join(self.visit(t) for t in node.dotdata) + dotcode = "\n".join(self.visit(t) for t in node.dotcode) + + return f".TYPES\n{dottypes}\n\n.DATA\n{dotdata}\n\n.CODE\n{dotcode}" + + @visitor.when(cil.TypeNode) + def visit(self, node: cil.TypeNode): + parent = f"inherits from {node.parent}" + attributes = "\n\t".join(f"attribute {x}" for x in node.attributes) + methods = "\n\t".join(f"method {x}: {y}" for x, y in node.methods) + + r = f"type {node.name} {{\n\t{parent}" + if attributes: + r += f"\n\n\t{attributes}" + if methods: + r += f"\n\n\t{methods}" + r += "\n}" + return r + + @visitor.when(cil.FunctionNode) + def visit(self, node: cil.FunctionNode): + params = "\n\t".join(self.visit(x) for x in node.params) + local_vars = "\n\t".join(self.visit(x) for x in node.local_vars) + instructions = "\n\t".join(self.visit(x) for x in node.instructions) + + s = f"function {node.name}{{\n\t{params}" + if local_vars: + s += f"\n\n\t{local_vars}" + if instructions: + if len(node.instructions) >= 2: + s += f"\n\n\t{instructions}" + else: + s += f"\n\t{instructions}" + s += "\n}" + + return s + + @visitor.when(cil.ParamNode) + def visit(self, node: cil.ParamNode): + return ( + f"PARAM {node.name}" + if node.comment == "" + else f"PARAM {node.name} # {node.comment}" + ) + + @visitor.when(cil.LocalNode) + def visit(self, node: cil.LocalNode): + return ( + f"LOCAL {node.name}" + if node.comment == "" + else f"LOCAL {node.name} # {node.comment}" + ) + + @visitor.when(cil.AssignNode) + def visit(self, node: cil.AssignNode): + return ( + f"{node.dest} = {node.source}" + if node.comment == "" + else f"{node.dest} = {node.source} # {node.comment}" + ) + + @visitor.when(cil.AssignIntNode) + def visit(self, node: cil.AssignIntNode): + return ( + f"{node.dest} = INT {node.source}" + if node.comment == "" + else f"{node.dest} = INT {node.source} # {node.comment}" + ) + + @visitor.when(cil.PlusNode) + def visit(self, node: cil.PlusNode): + return ( + f"{node.dest} = {node.left} + {node.right}" + if node.comment == "" + else f"{node.dest} = {node.left} + {node.right} # {node.comment}" + ) + + @visitor.when(cil.MinusNode) + def visit(self, node: cil.MinusNode): + return ( + f"{node.dest} = {node.left} - {node.right}" + if node.comment == "" + else f"{node.dest} = {node.left} - {node.right} # {node.comment}" + ) + + @visitor.when(cil.StarNode) + def visit(self, node: cil.StarNode): + return ( + f"{node.dest} = {node.left} * {node.right}" + if node.comment == "" + else f"{node.dest} = {node.left} * {node.right} # {node.comment}" + ) + + @visitor.when(cil.DivNode) + def visit(self, node: cil.DivNode): + return ( + f"{node.dest} = {node.left} / {node.right}" + if node.comment == "" + else f"{node.dest} = {node.left} / {node.right} # {node.comment}" + ) + + @visitor.when(cil.EqualNode) + def visit(self, node: cil.EqualNode): + return ( + f"{node.dest} = {node.left} == {node.right}" + if node.comment == "" + else f"{node.dest} = {node.left} == {node.right} # {node.comment}" + ) + + @visitor.when(cil.LessThanNode) + def visit(self, node: cil.LessThanNode): + return ( + f"{node.dest} = {node.left} < {node.right}" + if node.comment == "" + else f"{node.dest} = {node.left} < {node.right} # {node.comment}" + ) + + @visitor.when(cil.LessEqualNode) + def visit(self, node: cil.LessEqualNode): + return ( + f"{node.dest} = {node.left} <= {node.right}" + if node.comment == "" + else f"{node.dest} = {node.left} <= {node.right} # {node.comment}" + ) + + @visitor.when(cil.XorNode) + def visit(self, node: cil.XorNode): + return ( + f"{node.dest} = XOR {node.left} {node.right}" + if node.comment == "" + else f"{node.dest} = XOR {node.left} {node.right} # {node.comment}" + ) + + @visitor.when(cil.AllocateNode) + def visit(self, node: cil.AllocateNode): + return ( + f"{node.dest} = ALLOCATE {node.type}" + if node.comment == "" + else f"{node.dest} = ALLOCATE {node.type} # {node.comment}" + ) + + @visitor.when(cil.TypeOfNode) + def visit(self, node: cil.TypeOfNode): + return ( + f"{node.dest} = TYPEOF {node.source}" + if node.comment == "" + else f"{node.dest} = TYPEOF {node.source} # {node.comment}" + ) + + @visitor.when(cil.TypeAddressNode) + def visit(self, node: cil.TypeAddressNode): + return ( + f"{node.dest} = TYPEADDR {node.name}" + if node.comment == "" + else f"{node.dest} = TYPEADDR {node.name} # {node.comment}" + ) + + @visitor.when(cil.AncestorNode) + def visit(self, node: cil.AncestorNode): + return ( + f"{node.dest} = ANCESTOR {node.source}" + if node.comment == "" + else f"{node.dest} = ANCESTOR {node.source} # {node.comment}" + ) + + @visitor.when(cil.EqualAddressNode) + def visit(self, node: cil.EqualAddressNode): + return ( + f"{node.dest} = EQUALADDR {node.left} {node.right}" + if node.comment == "" + else f"{node.dest} = EQUALADDR {node.left} {node.right} # {node.comment}" + ) + + @visitor.when(cil.EqualIntNode) + def visit(self, node: cil.EqualIntNode): + return ( + f"{node.dest} = EQUALINT {node.left} {node.right}" + if node.comment == "" + else f"{node.dest} = EQUALINT {node.left} {node.right} # {node.comment}" + ) + + @visitor.when(cil.EqualStrNode) + def visit(self, node: cil.EqualStrNode): + return ( + f"{node.dest} = EQUALSTR {node.left} {node.right}" + if node.comment == "" + else f"{node.dest} = EQUALSTR {node.left} {node.right} # {node.comment}" + ) + + @visitor.when(cil.StaticCallNode) + def visit(self, node: cil.StaticCallNode): + return ( + f"{node.dest} = CALL {node.function}" + if node.comment == "" + else f"{node.dest} = CALL {node.function} # {node.comment}" + ) + + @visitor.when(cil.DynamicCallNode) + def visit(self, node: cil.DynamicCallNode): + return ( + f"{node.dest} = VCALL {node.type} {node.method_address}" + if node.comment == "" + else f"{node.dest} = VCALL {node.type} {node.method_address} # {node.comment}" + ) + + @visitor.when(cil.GetMethodNode) + def visit(self, node: cil.GetMethodNode): + return f"{node.dest} = GETMETHOD {node.instance} {node.method_index} # {node.method_name}" + + @visitor.when(cil.GetAttributeNode) + def visit(self, node: cil.GetAttributeNode): + return ( + f"{node.dest} = GETATTR {node.instance} {node.attr}" + if node.comment == "" + else f"{node.dest} = GETATTR {node.instance} {node.attr} # {node.comment}" + ) + + @visitor.when(cil.SetAttributeNode) + def visit(self, node: cil.SetAttributeNode): + return ( + f"SETATTR {node.instance} {node.attr} {node.source}" + if node.comment == "" + else f"SETATTR {node.instance} {node.attr} {node.source} # {node.comment}" + ) + + @visitor.when(cil.ArgNode) + def visit(self, node: cil.ArgNode): + return ( + f"ARG {node.name}" + if node.comment == "" + else f"ARG {node.name} # {node.comment}" + ) + + @visitor.when(cil.ReturnNode) + def visit(self, node: cil.ReturnNode): + return ( + f"\n\tRETURN {node.value if node.value is not None else 0}" + if node.comment == "" + else f"\n\tRETURN {node.value if node.value is not None else 0} # {node.comment}" + ) + + @visitor.when(cil.GotoNode) + def visit(self, node: cil.GotoNode): + return ( + f"GOTO {node.address}" + if node.comment == "" + else f"GOTO {node.address} # {node.comment}" + ) + + @visitor.when(cil.GotoIfNode) + def visit(self, node: cil.GotoNode): + return ( + f"IF {node.condition} GOTO {node.address}" + if node.comment == "" + else f"IF {node.condition} GOTO {node.address} # {node.comment}" + ) + + @visitor.when(cil.LabelNode) + def visit(self, node: cil.LabelNode): + return ( + f"{node.label}:" + if node.comment == "" + else f"{node.label}: # {node.comment}" + ) + + @visitor.when(cil.ArrayNode) + def visit(self, node: cil.ArrayNode): + return ( + f"{node.dest} = ARRAY {node.size}" + if node.comment == "" + else f"{node.dest} = ARRAY {node.size} # {node.comment}" + ) + + @visitor.when(cil.GetIndexNode) + def visit(self, node: cil.GetIndexNode): + return ( + f"{node.dest} = GETINDEX {node.instance} {node.index}" + if node.comment == "" + else f"{node.dest} = GETINDEX {node.instance} {node.index} # {node.comment}" + ) + + @visitor.when(cil.SetIndexNode) + def visit(self, node: cil.SetIndexNode): + return ( + f"SETINDEX {node.instance} {node.index} {node.source}" + if node.comment == "" + else f"SETINDEX {node.instance} {node.index} {node.source} # {node.comment}" + ) + + @visitor.when(cil.GetValueInIndexNode) + def visit(self, node: cil.GetIndexNode): + return ( + f"{node.dest} = GETVALUEINDEX {node.instance} {node.index}" + if node.comment == "" + else f"{node.dest} = GETVALUEINDEX {node.instance} {node.index} # {node.comment}" + ) + + @visitor.when(cil.SetValueInIndexNode) + def visit(self, node: cil.SetIndexNode): + return ( + f"SETVALUEINDEX {node.instance} {node.index} {node.source}" + if node.comment == "" + else f"SETVALUEINDEX {node.instance} {node.index} {node.source} # {node.comment}" + ) + + @visitor.when(cil.HaltNode) + def visit(self, node: cil.HaltNode): + return "HALT" if node.comment == "" else f"HALT # {node.comment}" + + @visitor.when(cil.TypeNameNode) + def visit(self, node: cil.TypeNameNode): + return ( + f"{node.dest} = TYPENAME {node.source}" + if node.comment == "" + else f"{node.dest} = TYPENAME {node.source} # {node.comment}" + ) + + @visitor.when(cil.CopyNode) + def visit(self, node: cil.CopyNode): + return ( + f"{node.dest} = COPY {node.source}" + if node.comment == "" + else f"{node.dest} = COPY {node.source} # {node.comment}" + ) + + @visitor.when(cil.PrintStringNode) + def visit(self, node: cil.PrintStringNode): + return ( + f"PRINTSTR {node.str_addr}" + if node.comment == "" + else f"PRINTSTR {node.str_addr} # {node.comment}" + ) + + @visitor.when(cil.PrintIntNode) + def visit(self, node: cil.PrintIntNode): + return ( + f"PRINTINT {node.source}" + if node.comment == "" + else f"PRININT {node.source} # {node.comment}" + ) + + @visitor.when(cil.ReadStringNode) + def visit(self, node: cil.ReadStringNode): + return ( + f"READSTR {node.dest}" + if node.comment == "" + else f"PRININT {node.dest} # {node.comment}" + ) + + @visitor.when(cil.ReadIntNode) + def visit(self, node: cil.ReadIntNode): + return ( + f"READINT {node.dest}" + if node.comment == "" + else f"READINT {node.dest} # {node.comment}" + ) + + @visitor.when(cil.LengthNode) + def visit(self, node: cil.LengthNode): + return ( + f"{node.dest} = LENGTH {node.str_address}" + if node.comment == "" + else f"{node.dest} = LENGTH {node.str_address} # {node.comment}" + ) + + @visitor.when(cil.ConcatNode) + def visit(self, node: cil.ConcatNode): + return ( + f"{node.dest} = CONCAT {node.str1} {node.str2}" + if node.comment == "" + else f"{node.dest} = CONCAT {node.str1} {node.str2} # {node.comment}" + ) + + @visitor.when(cil.SubstringNode) + def visit(self, node: cil.SubstringNode): + return ( + f"{node.dest} = SUBSTRING {node.str_address} {node.start} {node.length}" + if node.comment == "" + else f"{node.dest} = SUBSTRING {node.str_address} {node.start} {node.length} # {node.comment}" + ) + + @visitor.when(cil.AllocateStrNode) + def visit(self, node: cil.AllocateStrNode): + return (f"{node.dest} = ALLOCSTR {node.value}") if node.comment == "" else f"{node.dest} = ALLOCSTR {node.value} # {node.comment}" + + @visitor.when(cil.AllocateIntNode) + def visit(self, node: cil.AllocateIntNode): + return (f"{node.dest} = ALLOCINT {node.value}") if node.comment == "" else f"{node.dest} = ALLOCINT {node.value} # {node.comment}" + + @visitor.when(cil.AllocateBoolNode) + def visit(self, node: cil.AllocateBoolNode): + return (f"{node.dest} = ALLOCBOOL {node.value}") if node.comment == "" else f"{node.dest} = ALLOCBOOL {node.value} # {node.comment}" + + @visitor.when(cil.AllocateNullPtrNode) + def visit(self, node: cil.AllocateNullPtrNode): + return (f"{node.dest} = ALLOCNULL") if node.comment == "" else f"{node.dest} = ALLOCNULL # {node.comment}" + + + @visitor.when(cil.PrintTypeNameNode) + def visit(self, node: cil.PrintTypeNameNode): + return f"ASSERT {node.address}" + + + @visitor.when(cil.CommentNode) + def visit(self, node: cil.CommentNode): + return f"# {node.comment}" + + @visitor.when(cil.EmptyInstruction) + def visit(self, node: cil.EmptyInstruction): + return "" if node.comment == "" else f"# {node.comment}" + + +class MipsFormatter: + @visitor.on("node") + def visit(self, node): + pass + + @visitor.when(mips.ProgramNode) + def visit(self, node: mips.ProgramNode): + def is_function_label(node: mips.InstructionNode): + return isinstance(node, mips.LabelNode) and ( + node.name.startswith("function_") or node.name == "main" + ) + + dotdata = "\n\t".join([self.visit(data) for data in node.dotdata]) + + instructions = [ + ( + f"{self.visit(inst)}" + if is_function_label(inst) + else f"\t{self.visit(inst)}" + ) + for inst in node.dottext + ] + + dottext = "\n\t".join(instructions) + + return f".data\n\t{dotdata}\n\n.text\n\t{dottext}" + + @visitor.when(mips.DataNode) + def visit(self, node: mips.DataNode): + return ( + f"{node.name}: {node.data_type} {node.value}" + if node.comment == "" + else f"{node.name}: {node.data_type} {node.value} # {node.comment}" + ) + + @visitor.when(mips.OneAddressInstructionNode) + def visit(self, node: mips.OneAddressInstructionNode): + return ( + f"{node.code} {node.dest}" + if node.comment == "" + else f"{node.code} {node.dest} # {node.comment}" + ) + + @visitor.when(mips.TwoAddressIntructionNode) + def visit(self, node: mips.TwoAddressIntructionNode): + return ( + f"{node.code} {node.dest}, {node.source}" + if node.comment == "" + else f"{node.code} {node.dest}, {node.source} # {node.comment}" + ) + + @visitor.when(mips.ThreeAddressIntructionNode) + def visit(self, node: mips.ThreeAddressIntructionNode): + return ( + f"{node.code} {node.dest}, {node.source1}, {node.source2}" + if node.comment == "" + else f"{node.code} {node.dest}, {node.source1}, {node.source2} # {node.comment}" + ) + + @visitor.when(mips.SystemCallNode) + def visit(self, node: mips.SystemCallNode): + return node.code + + @visitor.when(mips.LabelNode) + def visit(self, node: mips.LabelNode): + return ( + f"{node.name}:" if node.comment == "" else f"{node.name}: # {node.comment}" + ) + + @visitor.when(mips.CommentNode) + def visit(self, node: mips.CommentNode): + return f"# {node.comment}" + + @visitor.when(mips.EmptyInstructionNode) + def visit(self, node: mips.EmptyInstructionNode): + return "" + + @visitor.when(mips.EmptyDataNode) + def visit(self, node: mips.EmptyDataNode): + return "" diff --git a/src/cool/code_generation/translator_cil_to_mips.py b/src/cool/code_generation/translator_cil_to_mips.py new file mode 100644 index 000000000..44aa98ae4 --- /dev/null +++ b/src/cool/code_generation/translator_cil_to_mips.py @@ -0,0 +1,927 @@ +from operator import index +from threading import stack_size +from typing import List, Optional, Union + +import cool.code_generation.ast_cil as cil +import cool.code_generation.ast_mips as mips +import cool.visitor.visitor as visitor +from cool.semantics.utils.scope import Context + + +class BaseCilToMipsVisitor: + def __init__(self, context: Context) -> None: + self.dotdata: List[mips.DataNode] = [] + self.dottext: List[mips.InstructionNode] = [] + + self.current_function: Optional[cil.FunctionNode] = None + self.current_function_stack: List[str] = [] + + self.context = context + + def register_word(self, name: str, value: str) -> mips.WordDataNode: + data = mips.WordDataNode(name, value) + self.dotdata.append(data) + return data + + def register_asciiz(self, name: str, value: str) -> mips.AsciizDataNode: + data = mips.AsciizDataNode(name, value) + self.dotdata.append(data) + return data + + def register_space(self, name: str, value: str) -> mips.AsciizDataNode: + data = mips.SpaceDataNode(name, value) + self.dotdata.append(data) + return data + + def register_instruction(self, instruction: mips.InstructionNode) -> mips.InstructionNode: + self.dottext.append(instruction) + return instruction + + def register_empty_instruction(self) -> mips.EmptyInstructionNode: + self.dottext.append(mips.EmptyInstructionNode()) + return self.dottext[-1] + + def register_instantiation(self, size: Union[int, str]) -> mips.InstructionNode: + self.register_instruction(mips.LoadInmediateNode("$v0", "9")) + if isinstance(size, int): + self.register_instruction(mips.AddiNode("$a0", "$zero", f"{size}")) + if isinstance(size, str): + self.register_instruction(mips.MoveNode("$a0", size)) + self.register_instruction(mips.SystemCallNode()) + + def register_empty_data(self): + self.dotdata.append(mips.EmptyDataNode()) + + def register_comment(self, comment: str) -> mips.CommentNode: + self.dottext.append(mips.CommentNode(comment)) + return self.dottext[-1] + + def to_data_type(self, data_name: str, type_name: str) -> str: + return f"type_{type_name}_{data_name}" + + def offset_of(self, local_name: str) -> int: + stack_size = 4 * len(self.current_function_stack) + index = 4 * self.current_function_stack.index(local_name) + return stack_size - index - 4 + + +class CilToMipsTranslator(BaseCilToMipsVisitor): + @visitor.on("node") + def visit(self, node): + pass + + @visitor.when(cil.ProgramNode) + def visit(self, node: cil.ProgramNode): + + for type_node in node.dottypes: + self.visit(type_node) + + for type_node in node.dottypes: + self.register_word(self.to_data_type("name_size", type_node.name), str(len(type_node.name))) + self.register_asciiz(self.to_data_type("name", type_node.name), f'"{type_node.name}"') + self.register_empty_data() + + self.register_space("buffer_input", 1024) + self.register_asciiz("debug_log", '"debug_log\\n"') + + for function_node in node.dotcode: + self.visit(function_node) + + return mips.ProgramNode(self.dotdata, self.dottext) + + @visitor.when(cil.TypeNode) + def visit(self, node: cil.TypeNode): + size = 4 * (2 + len(node.attributes) + len(node.methods)) + + self.register_word(f"type_{node.name}", str(size)) + self.register_word(self.to_data_type("inherits_from", node.name), f"type_{node.parent}" if node.parent != "null" else "0") + self.register_word(self.to_data_type("name_address", node.name), f"type_{node.name}_name_size") + for method, function in node.methods: + self.register_word(self.to_data_type(method, node.name), function) + self.register_empty_data() + + @visitor.when(cil.FunctionNode) + def visit(self, node: cil.FunctionNode): + self.current_function = node + self.register_instruction(mips.LabelNode(node.name)) + + param_names = [x.name for x in self.current_function.params] + local_names = [x.name for x in self.current_function.local_vars] + self.current_function_stack = ["$ra"] + param_names + local_names + + locals_size = 4 * len(self.current_function.local_vars) + stack_size = 4 * len(self.current_function_stack) + + if node.name != "main": + self.register_comment("Function parameters") + self.register_comment(f" $ra = {stack_size - 4}($sp)") + for i, param_name in enumerate(param_names, start=2): + self.register_comment(f" {param_name} = {stack_size - (4 * i)}($sp)") + self.register_empty_instruction() + + if self.current_function.local_vars: + self.register_comment("Reserving space for local variables") + self.register_instruction(mips.AddiNode("$sp", "$sp", f"{-locals_size}")) + self.register_empty_instruction() + + for instruction in node.instructions: + # TODO: Remove the try/except block when the visitor is fixed + try: + if isinstance(instruction, (cil.EmptyInstruction, cil.CommentNode)): + continue + self.visit(instruction) + self.register_empty_instruction() + except Exception as e: + print(f"error {e} in {node.name} {type(instruction)}") + + if node.name != "main" and self.current_function.local_vars: + self.register_comment("Freeing space for local variables") + self.register_instruction(mips.AddiNode("$sp", "$sp", f"{locals_size}")) + self.register_empty_instruction() + + if node.name != "main": + self.register_instruction(mips.JumpRegisterNode("$ra")) + self.register_empty_instruction() + + @visitor.when(cil.AssignNode) + def visit(self, node: cil.AssignNode): + self.register_comment(f"{node.dest} = {node.source}") + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.source)}($sp)")) + self.register_instruction(mips.StoreWordNode("$t0", f"{self.offset_of(node.dest)}($sp)")) + + @visitor.when(cil.AssignIntNode) + def visit(self, node: cil.AssignIntNode): + self.register_comment(f"{node.dest} = {node.source} where {node.source} is an integer") + self.register_instantiation(12) + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.source)}($sp)").set_comment(f"Pointer to {node.source}")) + self.register_instruction(mips.LoadWordNode("$t1", "0($t0)").set_comment(f"$t1 = type of {node.source}")) + self.register_instruction(mips.LoadWordNode("$t2", "8($t0)").set_comment(f"$t2 = value of {node.source}")) + + self.register_instruction(mips.StoreWordNode("$t1", "0($v0)").set_comment(f"Save type of {node.dest}")) + self.register_instruction(mips.StoreWordNode("$a0", "4($v0)").set_comment(f"Save size of {node.dest}")) + self.register_instruction(mips.StoreWordNode("$t2", "8($v0)").set_comment(f"Save value of {node.dest}")) + + self.register_instruction(mips.StoreWordNode("$v0", f"{self.offset_of(node.dest)}($sp)")) + + @visitor.when(cil.ArgNode) + def visit(self, node: cil.ArgNode): + if node.arg_index == 0: + self.register_comment("Passing function arguments") + self.register_instruction(mips.AddiNode("$sp", "$sp", f"-{4 * node.total_args + 4}").set_comment("Reserving space for arguments")) + self.register_instruction(mips.StoreWordNode("$ra", f"{4 * (node.total_args)}($sp)").set_comment("Storing return address")) + self.register_empty_instruction() + self.register_comment(f"Argument {node.name}") + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.name) + 4 * node.total_args + 4}($sp)")) + self.register_instruction(mips.StoreWordNode("$t0", f"{4 * (node.total_args - node.arg_index - 1)}($sp)").set_comment(f"Storing {node.name}")) + + @visitor.when(cil.DynamicCallNode) + def visit(self, node: cil.DynamicCallNode): + self.register_comment(f"Calling function {node.method_address}") + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.method_address) + 4 * node.total_args + 4}($sp)")) + self.register_instruction(mips.JumpAndLinkRegisterNode("$t0")) + self.register_instruction(mips.LoadWordNode("$ra", f"{4 * node.total_args}($sp)")) + self.register_instruction(mips.StoreWordNode("$v1", f"{self.offset_of(node.dest) + 4 * node.total_args + 4}($sp)").set_comment(f"{node.dest} = result of {node.method_address}")) + self.register_instruction(mips.AddiNode("$sp", "$sp", f"{4 * node.total_args + 4}").set_comment("Freeing space for arguments")) + + @visitor.when(cil.StaticCallNode) + def visit(self, node: cil.StaticCallNode): + self.register_comment(f"Calling function {node.function}") + self.register_instruction(mips.JumpAndLinkNode(node.function)) + self.register_instruction(mips.LoadWordNode("$ra", f"{4 * node.total_args}($sp)")) + self.register_instruction(mips.StoreWordNode("$v1", f"{self.offset_of(node.dest) + 4 * node.total_args + 4}($sp)").set_comment(f"{node.dest} = result of {node.function}")) + self.register_instruction(mips.AddiNode("$sp", "$sp", f"{4 * node.total_args + 4}").set_comment("Freeing space for arguments")) + + @visitor.when(cil.AllocateNode) + def visit(self, node: cil.AllocateNode): + self.register_comment(f"Allocating {node.type}") + self.register_instruction(mips.LoadInmediateNode("$v0", "9")) + self.register_instruction(mips.LoadWordNode("$a0", f"type_{node.type}")) + self.register_instruction(mips.SystemCallNode()) + self.register_instruction(mips.LoadAddressNode("$t0", f"type_{node.type}").set_comment("$t0 = address of the type")) + self.register_instruction(mips.StoreWordNode("$t0", "0($v0)").set_comment("Setting type in the first word of th object")) + self.register_instruction(mips.StoreWordNode("$a0", "4($v0)").set_comment("Setting size in the second word of th object")) + self.register_instruction(mips.StoreWordNode("$v0", f"{self.offset_of(node.dest)}($sp)").set_comment(f"{node.dest} = address of allocated object {node.type}")) + + @visitor.when(cil.AllocateIntNode) + def visit(self, node: cil.AllocateIntNode): + self.register_comment(f"Allocating Int {node.value}") + self.register_instruction(mips.LoadInmediateNode("$v0", "9")) + self.register_instruction(mips.AddiNode("$a0", "$zero", "12")) + self.register_instruction(mips.SystemCallNode()) + self.register_empty_instruction() + + self.register_instruction(mips.LoadAddressNode("$t0", "type_Int").set_comment("$t0 = address of the type")) + self.register_instruction(mips.StoreWordNode("$t0", "0($v0)").set_comment("Setting type in the first word of the object")) + self.register_instruction(mips.StoreWordNode("$a0", "4($v0)").set_comment("Setting size in the second word of the object")) + self.register_instruction(mips.AddiNode("$t0", "$zero", node.value)) + self.register_instruction(mips.StoreWordNode("$t0", "8($v0)").set_comment("Setting value in the third word of the object")) + + self.register_instruction(mips.StoreWordNode("$v0", f"{self.offset_of(node.dest)}($sp)").set_comment(f"{node.dest} = address of allocated object Int")) + + @visitor.when(cil.AllocateBoolNode) + def visit(self, node: cil.AllocateBoolNode): + self.register_comment(f"Allocating Bool {node.value}") + + self.register_instruction(mips.LoadInmediateNode("$v0", "9")) + self.register_instruction(mips.AddiNode("$a0", "$zero", "12")) + self.register_instruction(mips.SystemCallNode()) + self.register_empty_instruction() + + self.register_instruction(mips.LoadAddressNode("$t0", "type_Bool").set_comment("$t0 = address of the type")) + self.register_instruction(mips.StoreWordNode("$t0", "0($v0)").set_comment("Setting type in the first word of the object")) + self.register_instruction(mips.StoreWordNode("$a0", "4($v0)").set_comment("Setting size in the second word of the object")) + self.register_instruction(mips.AddiNode("$t0", "$zero", node.value)) + self.register_instruction(mips.StoreWordNode("$t0", "8($v0)").set_comment("Setting value in the third word of the object")) + + self.register_instruction(mips.StoreWordNode("$v0", f"{self.offset_of(node.dest)}($sp)").set_comment(f"{node.dest} = address of allocated object Int")) + + @visitor.when(cil.AllocateStrNode) + def visit(self, node: cil.AllocateStrNode): + self.register_comment(f"Allocating String") + self.register_instruction(mips.LoadInmediateNode("$v0", "9")) + self.register_instruction(mips.AddiNode("$a0", "$zero", f"{9 + node.length}").set_comment("$a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator")) + self.register_instruction(mips.SystemCallNode()) + self.register_empty_instruction() + + self.register_instruction(mips.LoadAddressNode("$t0", "type_String")) + self.register_instruction(mips.StoreWordNode("$t0", f"0($v0)").set_comment("Setting type in the first word of the object")) + self.register_empty_instruction() + + self.register_instruction(mips.AddiNode("$t0", "$zero", f"{9 + node.length}")) + self.register_instruction(mips.StoreWordNode("$t0", f"4($v0)").set_comment("Setting length of the string in the second word of the object")) + self.register_empty_instruction() + + for i, c in enumerate(node.string): + ec = c.replace('\n', '\\n') + ec = ec.replace('\t', '\\t') + ec = ec.replace('\b', '\\b') + ec = ec.replace('\f', '\\f') + self.register_instruction(mips.AddiNode("$t0", "$zero", f"{ord(c)}")) + self.register_instruction(mips.StoreByteNode("$t0", f"{i + 8}($v0)").set_comment(f"{node.dest}[{i}] = '{ec}'")) + self.register_empty_instruction() + + self.register_instruction(mips.StoreByteNode("$zero", f"{node.length + 8}($v0)").set_comment(f"Null-terminator at the end of the string")) + self.register_empty_instruction() + self.register_instruction(mips.StoreWordNode("$v0", f"{self.offset_of(node.dest)}($sp)").set_comment(f"{node.dest} = {node.value}")) + + @visitor.when(cil.AllocateNullPtrNode) + def visit(self, node: cil.AllocateNullPtrNode): + self.register_comment(f"Allocating NUll to {node.dest}") + self.register_instruction(mips.StoreWordNode("$zero", f"{self.offset_of(node.dest)}($sp)").set_comment(f"{node.dest} = 0")) + + @visitor.when(cil.LengthNode) + def visit(self, node: cil.LengthNode): + self.register_comment(f"{node.dest} = length of {node.str_address}") + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.str_address)}($sp)")) + self.register_instruction(mips.LoadWordNode("$t1", "4($t0)")) + self.register_instruction(mips.AddiNode("$t1", "$t1", "-9").set_comment("Subtracting 9 for the type, length, and null-terminator")) + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.dest)}($sp)")) + self.register_instruction(mips.StoreWordNode("$t1", "8($t0)")) + + @visitor.when(cil.ConcatNode) + def visit(self, node: cil.ConcatNode): + self.register_comment(f"{node.dest} = {node.str1} + {node.str2}") + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.str1)}($sp)")) + self.register_instruction(mips.LoadWordNode("$t1", f"{self.offset_of(node.str2)}($sp)")) + self.register_instruction(mips.LoadWordNode("$t2", "4($t0)").set_comment("$t2 = length of str1")) + self.register_instruction(mips.LoadWordNode("$t3", "4($t1)").set_comment("$t3 = length of str2")) + self.register_instruction(mips.AddiNode("$t2", "$t2", "-9")) + self.register_instruction(mips.AddiNode("$t3", "$t3", "-9")) + + self.register_instruction(mips.AddNode("$t4", "$t2", "$t3").set_comment("$t4 = length of str1 + str2")) + self.register_instruction(mips.AddiNode("$t4", "$t4", "9").set_comment("Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte)")) + self.register_empty_instruction() + + self.register_instruction(mips.LoadInmediateNode("$v0", "9")) + self.register_instruction(mips.MoveNode("$a0", "$t4")) + self.register_instruction(mips.SystemCallNode()) + self.register_instruction(mips.AddiNode("$t4", "$t4", "-9").set_comment("Restoring $t4 = length of str1 + str2")) + self.register_instruction(mips.AddNode("$t5", "$zero", "$v0").set_comment("$t5 = address of the new string object")) + self.register_instruction(mips.AddiNode("$t5", "$t5", "8").set_comment("$t5 = address of the first byte of the new string")) + self.register_empty_instruction() + + self.register_instruction(mips.LoadAddressNode("$t8", "type_String")) + self.register_instruction(mips.StoreWordNode("$t8", f"0($v0)").set_comment("Setting type in the first word of th object")) + self.register_empty_instruction() + + self.register_instruction(mips.StoreWordNode("$a0", f"4($v0)").set_comment("Setting length of the string in the second word of the object")) + self.register_empty_instruction() + + self.register_comment(f"Copying str1 to the new string") + self.register_instruction(mips.XorNode("$t6", "$t6", "$t6").set_comment("$t6 = 0 Initializing counter")) + self.register_instruction(mips.LabelNode("while_copy_str1_start")) + self.register_instruction(mips.BeqNode("$t6", "$t2", "while_copy_str1_end")) + self.register_instruction(mips.LoadByteNode("$t7", f"8($t0)")) + self.register_instruction(mips.StoreByteNode("$t7", f"0($t5)")) + self.register_instruction(mips.AddNode("$t0", "$t0", "1").set_comment("$t0 = $t0 + 1 Incrementing the address of str1")) + self.register_instruction(mips.AddNode("$t5", "$t5", "1").set_comment("$t5 = $t5 + 1 Incrementing the address of the new string")) + self.register_instruction(mips.AddiNode("$t6", "$t6", "1").set_comment("$t6 = $t6 + 1 Incrementing counter")) + self.register_instruction(mips.JumpNode("while_copy_str1_start")) + self.register_instruction(mips.LabelNode("while_copy_str1_end")) + self.register_empty_instruction() + + self.register_comment(f"Copying str2 to the new string") + self.register_instruction(mips.LabelNode("while_copy_str2_start")) + self.register_instruction(mips.BeqNode("$t6", "$t4", "while_copy_str2_end")) + self.register_instruction(mips.LoadByteNode("$t7", f"8($t1)")) + self.register_instruction(mips.StoreByteNode("$t7", f"0($t5)")) + self.register_instruction(mips.AddNode("$t1", "$t1", "1").set_comment("$t0 = $t0 + 1 Incrementing the address of str1")) + self.register_instruction(mips.AddNode("$t5", "$t5", "1").set_comment("$t5 = $t5 + 1 Incrementing the address of the new string")) + self.register_instruction(mips.AddiNode("$t6", "$t6", "1").set_comment("$t6 = $t6 + 1 Incrementing counter")) + self.register_instruction(mips.JumpNode("while_copy_str2_start")) + self.register_instruction(mips.LabelNode("while_copy_str2_end")) + self.register_empty_instruction() + + self.register_instruction(mips.StoreByteNode("$zero", f"0($t5)").set_comment("Setting the null-terminator")) + self.register_empty_instruction() + + self.register_instruction(mips.StoreWordNode("$v0", f"{self.offset_of(node.dest)}($sp)").set_comment(f"{node.dest} = {node.str1} + {node.str2}")) + + @visitor.when(cil.SubstringNode) + def visit(self, node: cil.SubstringNode): + self.register_comment(f"{node.dest} = {node.str_address}[{node.start}:{node.start} + {node.length}]") + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.str_address)}($sp)").set_comment("$t0 = address of the string")) + self.register_instruction(mips.LoadWordNode("$t1", f"4($t0)").set_comment("$t1 = length of the string")) + self.register_instruction(mips.AddiNode("$t1", "$t1", "-9").set_comment("$t1 = length of the string + 9")) + self.register_instruction(mips.LoadWordNode("$t2", f"{self.offset_of(node.start)}($sp)").set_comment("$t2 = start of the substring")) + self.register_instruction(mips.LoadWordNode("$t2", "8($t2)")) + self.register_instruction(mips.LoadWordNode("$t3", f"{self.offset_of(node.length)}($sp)").set_comment("$t3 = length of the substring")) + self.register_instruction(mips.LoadWordNode("$t3", "8($t3)")) + self.register_instruction(mips.AddNode("$t4", "$t2", "$t3").set_comment("$t4 = start of the substring + length of the substring")) + + self.register_empty_instruction() + self.register_instruction(mips.BgtNode("$t4", "$t1", "substring_out_of_bounds")) + + self.register_empty_instruction() + self.register_instruction(mips.AddiNode("$t3", "$t3", "9")) + self.register_instantiation("$t3") + self.register_instruction(mips.AddiNode("$t3", "$t3", "-9")) + + self.register_empty_instruction() + self.register_instruction(mips.LoadAddressNode("$t5", "type_String")) + self.register_instruction(mips.StoreWordNode("$t5", f"0($v0)").set_comment("Setting type in the first word of the object")) + + self.register_empty_instruction() + self.register_instruction(mips.StoreWordNode("$a0", f"4($v0)").set_comment("Setting length in the second word of the object")) + + self.register_empty_instruction() + self.register_instruction(mips.AddiNode("$t0", "$t0", "8").set_comment("pointing to the first byte of the string")) + self.register_instruction(mips.AddNode("$t0", "$t0", "$t2").set_comment("pointing to the first byte of the substring")) + self.register_instruction(mips.MoveNode("$t5", "$v0").set_comment("$t5 = address of the new string")) + self.register_instruction(mips.AddNode("$t5", "$t5", "8").set_comment("pointing to the first byte of the string")) + self.register_instruction(mips.XorNode("$t6", "$t6", "$t6").set_comment("$t6 = 0 Initializing counter")) + self.register_instruction(mips.LabelNode("while_copy_substr_start")) + self.register_instruction(mips.BeqNode("$t6", "$t3", "while_copy_substr_end")) + self.register_instruction(mips.LoadByteNode("$t7", f"0($t0)")) + self.register_instruction(mips.StoreByteNode("$t7", f"0($t5)")) + self.register_instruction(mips.AddiNode("$t0", "$t0", "1").set_comment("$t0 = $t0 + 1 Incrementing the address of the string")) + self.register_instruction(mips.AddNode("$t5", "$t5", "1").set_comment("$t5 = $t5 + 1 Incrementing the address of the new string")) + self.register_instruction(mips.AddiNode("$t6", "$t6", "1").set_comment("$t6 = $t6 + 1 Incrementing counter")) + self.register_instruction(mips.JumpNode("while_copy_substr_start")) + self.register_instruction(mips.LabelNode("while_copy_substr_end")) + + self.register_empty_instruction() + self.register_instruction(mips.StoreByteNode("$zero", f"0($t5)").set_comment("Setting the null-terminator")) + + self.register_empty_instruction() + self.register_instruction(mips.StoreWordNode("$v0", f"{self.offset_of(node.dest)}($sp)").set_comment(f"{node.dest} = {node.str_address}[{node.start}:{node.start} + {node.length}]")) + + self.register_instruction(mips.JumpNode("substring_not_out_of_bounds")) + + self.register_empty_instruction() + self.register_instruction(mips.LabelNode("substring_out_of_bounds")) + # TODO: Throw an exception + self.register_instruction(mips.LoadInmediateNode("$v0", "17")) + self.register_instruction(mips.AddiNode("$a0", "$zero", "1")) + self.register_instruction(mips.SystemCallNode()) + + self.register_empty_instruction() + self.register_instruction(mips.LabelNode("substring_not_out_of_bounds")) + + @visitor.when(cil.GetAttributeNode) + def visit(self, node: cil.GetAttributeNode): + node_id = hash(node) + self.register_comment(f"Get attribute {node.attr} of {node.instance}") + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.instance)}($sp)").set_comment(f"Get the address of {node.instance}")) + self.register_instruction(mips.LoadWordNode("$t1", f"{4 * (node.attr_index + 2)}($t0)").set_comment(f"Get the attribute '{node.attr}' from the {node.instance}")) + + self.register_instruction(mips.LoadWordNode("$t2", "0($t1)")) + self.register_instruction(mips.LoadAddressNode("$t3", "type_Int")) + self.register_instruction(mips.LoadAddressNode("$t4", "type_Bool")) + self.register_instruction(mips.AddiNode("$t5", "$zero", "1")) + self.register_instruction(mips.SeqNode("$t6", "$t2", "$t3")) + self.register_instruction(mips.BeqNode("$t6", "$t5", f"int_get_attribute_{node_id}")) + self.register_instruction(mips.SeqNode("$t6", "$t2", "$t4")) + self.register_instruction(mips.BeqNode("$t6", "$t5", f"bool_get_attribute_{node_id}")) + self.register_instruction(mips.JumpNode(f"object_get_attribute_{node_id}")) + + self.register_instruction(mips.LabelNode(f"int_get_attribute_{node_id}")) + + self.register_instruction(mips.LoadInmediateNode("$v0", "9")) + self.register_instruction(mips.AddiNode("$a0", "$zero", "12")) + self.register_instruction(mips.SystemCallNode()) + + self.register_instruction(mips.StoreWordNode("$t3", "0($v0)")) + self.register_instruction(mips.StoreWordNode("$a0", "4($v0)")) + self.register_instruction(mips.LoadWordNode("$t5", "8($t1)")) + self.register_instruction(mips.StoreWordNode("$t5", "8($v0)")) + self.register_instruction(mips.StoreWordNode("$v0", f"{self.offset_of(node.dest)}($sp)").set_comment(f"{node.dest} = {node.instance}.{node.attr}")) + self.register_instruction(mips.JumpNode(f"end_get_attribute_{node_id}")) + + self.register_instruction(mips.LabelNode(f"bool_get_attribute_{node_id}")) + + self.register_instruction(mips.LoadInmediateNode("$v0", "9")) + self.register_instruction(mips.AddiNode("$a0", "$zero", "12")) + self.register_instruction(mips.SystemCallNode()) + + self.register_instruction(mips.StoreWordNode("$t4", "0($v0)")) + self.register_instruction(mips.StoreWordNode("$a0", "4($v0)")) + self.register_instruction(mips.LoadWordNode("$t5", "8($t1)")) + self.register_instruction(mips.StoreWordNode("$t5", "8($v0)")) + self.register_instruction(mips.StoreWordNode("$v0", f"{self.offset_of(node.dest)}($sp)").set_comment(f"{node.dest} = {node.instance}.{node.attr}")) + self.register_instruction(mips.JumpNode(f"end_get_attribute_{node_id}")) + + self.register_instruction(mips.LabelNode(f"object_get_attribute_{node_id}")) + self.register_instruction(mips.StoreWordNode("$t1",f"{self.offset_of(node.dest)}($sp)").set_comment(f"{node.dest} = {node.instance}.{node.attr}")) + self.register_instruction(mips.LabelNode(f"end_get_attribute_{node_id}")) + + @visitor.when(cil.SetAttributeNode) + def visit(self, node: cil.SetAttributeNode): + node_id = hash(node) + self.register_comment(f"Set attribute {node.attr} of {node.instance}") + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.instance)}($sp)").set_comment(f"$t0 = {node.instance}")) + self.register_instruction(mips.LoadWordNode("$t1", f"{self.offset_of(node.source)}($sp)").set_comment(f"$t1 = {node.source}")) + + self.register_instruction(mips.BeqNode("$t1", "$zero", f"object_set_attribute_{node_id}")) + + self.register_instruction(mips.LoadWordNode("$t2", "0($t1)")) + self.register_instruction(mips.LoadAddressNode("$t3", "type_Int")) + self.register_instruction(mips.LoadAddressNode("$t4", "type_Bool")) + self.register_instruction(mips.AddiNode("$t5", "$zero", "1")) + self.register_instruction(mips.SeqNode("$t6", "$t2", "$t3")) + self.register_instruction(mips.BeqNode("$t6", "$t5", f"int_set_attribute_{node_id}")) + self.register_instruction(mips.SeqNode("$t6", "$t2", "$t4")) + self.register_instruction(mips.BeqNode("$t6", "$t5", f"bool_set_attribute_{node_id}")) + self.register_instruction(mips.JumpNode(f"object_set_attribute_{node_id}")) + + self.register_instruction(mips.LabelNode(f"int_set_attribute_{node_id}")) + + self.register_instruction(mips.LoadInmediateNode("$v0", "9")) + self.register_instruction(mips.AddiNode("$a0", "$zero", "12")) + self.register_instruction(mips.SystemCallNode()) + + self.register_instruction(mips.StoreWordNode("$t3", "0($v0)")) + self.register_instruction(mips.StoreWordNode("$a0", "4($v0)")) + self.register_instruction(mips.LoadWordNode("$t5", "8($t1)")) + self.register_instruction(mips.StoreWordNode("$t5", "8($v0)")) + self.register_instruction(mips.StoreWordNode("$v0", f"{4 * (node.attr_index + 2)}($t0)").set_comment(f"{node.instance}.{node.attr} = {node.source}")) + self.register_instruction(mips.JumpNode(f"end_set_attribute_{node_id}")) + + self.register_instruction(mips.LabelNode(f"bool_set_attribute_{node_id}")) + + self.register_instruction(mips.LoadInmediateNode("$v0", "9")) + self.register_instruction(mips.AddiNode("$a0", "$zero", "12")) + self.register_instruction(mips.SystemCallNode()) + + self.register_instruction(mips.StoreWordNode("$t4", "0($v0)")) + self.register_instruction(mips.StoreWordNode("$a0", "4($v0)")) + self.register_instruction(mips.LoadWordNode("$t5", "8($t1)")) + self.register_instruction(mips.StoreWordNode("$t5", "8($v0)")) + self.register_instruction(mips.StoreWordNode("$v0", f"{4 * (node.attr_index + 2)}($t0)").set_comment(f"{node.instance}.{node.attr} = {node.source}")) + self.register_instruction(mips.JumpNode(f"end_set_attribute_{node_id}")) + + self.register_instruction(mips.LabelNode(f"object_set_attribute_{node_id}")) + self.register_instruction(mips.StoreWordNode("$t1", f"{4 * (node.attr_index + 2)}($t0)").set_comment(f"{node.instance}.{node.attr} = {node.source}")) + self.register_instruction(mips.LabelNode(f"end_set_attribute_{node_id}")) + + @visitor.when(cil.GetMethodNode) + def visit(self, node: cil.GetMethodNode): + self.register_comment(f"Get method {node.method_name} of {node.type}") + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.instance)}($sp)")) + self.register_instruction(mips.LoadWordNode("$t0", "0($t0)")) + self.register_instruction(mips.AddiNode("$t0", "$t0", "12")) + self.register_instruction(mips.LoadWordNode("$t1", f"{self.offset_of(node.method_index)}($sp)")) + self.register_instruction(mips.LoadWordNode("$t1", f"8($t1)")) + self.register_instruction(mips.SllNode("$t1", "$t1", "2")) + self.register_instruction(mips.AddNode("$t0", "$t0", "$t1")) + self.register_instruction(mips.LoadWordNode("$t0", "0($t0)")) + self.register_instruction(mips.StoreWordNode("$t0", f"{self.offset_of(node.dest)}($sp)")) + + @visitor.when(cil.ArrayNode) + def visit(self, node: cil.ArrayNode): + self.register_comment(f"initialize Array [{node.size}]") + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.size)}($sp)").set_comment(f"$t0 = {node.size}")) + self.register_instruction(mips.LoadWordNode("$t0", "8($t0)").set_comment("$t0 = value of the size")) + self.register_instruction(mips.AddiNode("$t1", "$zero", "4").set_comment("$t1 = 4")) + self.register_instruction(mips.MultNode("$t0", "$t1").set_comment("$t0 = $t0 * 4")) + self.register_instruction(mips.MoveFromLowNode("$t0")) + self.register_instantiation("$t0") + self.register_instruction(mips.StoreWordNode("$v0", f"{self.offset_of(node.dest)}($sp)").set_comment(f"{node.dest} = new Array[{node.size}]")) + + @visitor.when(cil.GetIndexNode) + def visit(self, node: cil.GetIndexNode): + self.register_comment(f"{node.dest} = array {node.instance}[4 * {node.index}]") + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.index)}($sp)").set_comment(f"$t0 = {node.index}")) + self.register_instruction(mips.LoadWordNode("$t0", "8($t0)").set_comment("$t0 = value of the index")) + self.register_instruction(mips.AddiNode("$t1", "$zero", "4").set_comment("$t1 = 4")) + self.register_instruction(mips.MultNode("$t0", "$t1").set_comment("$t0 = $t0 * 4")) + self.register_instruction(mips.MoveFromLowNode("$t0")) + + self.register_instruction(mips.LoadWordNode("$t1", f"{self.offset_of(node.instance)}($sp)").set_comment(f"$t1 = {node.instance}")) + self.register_instruction(mips.AddNode("$t1", "$t1", "$t0").set_comment("Move the pointer to the index")) + self.register_instruction(mips.LoadWordNode("$t0", "0($t1)").set_comment("$t1 = value in the position")) + self.register_instruction(mips.StoreWordNode("$t0", f"{self.offset_of(node.dest)}($sp)").set_comment(f"{node.dest} = array {node.instance}[4 * {node.index}]")) + + @visitor.when(cil.SetIndexNode) + def visit(self, node: cil.SetIndexNode): + self.register_comment(f"array {node.instance}[4 * {node.index}] = {node.source}") + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.index)}($sp)").set_comment(f"$t0 = {node.index}")) + self.register_instruction(mips.LoadWordNode("$t0", "8($t0)").set_comment("$t0 = value of the index")) + self.register_instruction(mips.AddiNode("$t1", "$zero", "4").set_comment("$t1 = 4")) + self.register_instruction(mips.MultNode("$t0", "$t1").set_comment("$t0 = $t0 * 4")) + self.register_instruction(mips.MoveFromLowNode("$t0")) + + self.register_instruction(mips.LoadWordNode("$t1", f"{self.offset_of(node.instance)}($sp)").set_comment(f"$t1 = {node.instance}")) + self.register_instruction(mips.AddNode("$t1", "$t1", "$t0").set_comment("Move the pointer to the index")) + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.source)}($sp)")) + self.register_instruction(mips.StoreWordNode("$t0", "0($t1)")) + + @visitor.when(cil.GetValueInIndexNode) + def visit(self, node: cil.GetValueInIndexNode): + self.register_comment(f"{node.dest} = array {node.instance}[4 * {node.index}]") + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.index)}($sp)").set_comment(f"$t0 = {node.index}")) + self.register_instruction(mips.LoadWordNode("$t0", "8($t0)").set_comment("$t0 = value of the index")) + self.register_instruction(mips.AddiNode("$t1", "$zero", "4").set_comment("$t1 = 4")) + self.register_instruction(mips.MultNode("$t0", "$t1").set_comment("$t0 = $t0 * 4")) + self.register_instruction(mips.MoveFromLowNode("$t0")) + + self.register_instruction(mips.LoadWordNode("$t1", f"{self.offset_of(node.instance)}($sp)").set_comment(f"$t1 = {node.instance}")) + self.register_instruction(mips.AddNode("$t1", "$t1", "$t0").set_comment("Move the pointer to the index")) + self.register_instruction(mips.LoadWordNode("$t0", "0($t1)").set_comment("$t1 = value in the position")) + self.register_instruction(mips.LoadWordNode("$t2", f"{self.offset_of(node.dest)}($sp)").set_comment(f"{node.dest} = array {node.instance}[4 * {node.index}]")) + self.register_instruction(mips.StoreWordNode("$t0", "8($t2)")) + + @visitor.when(cil.SetValueInIndexNode) + def visit(self, node: cil.SetValueInIndexNode): + self.register_comment(f"array {node.instance}[4 * {node.index}] = {node.source}") + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.index)}($sp)").set_comment(f"$t0 = {node.index}")) + self.register_instruction(mips.LoadWordNode("$t0", "8($t0)").set_comment("$t0 = value of the index")) + self.register_instruction(mips.AddiNode("$t1", "$zero", "4").set_comment("$t1 = 4")) + self.register_instruction(mips.MultNode("$t0", "$t1").set_comment("$t0 = $t0 * 4")) + self.register_instruction(mips.MoveFromLowNode("$t0")) + + self.register_instruction(mips.LoadWordNode("$t1", f"{self.offset_of(node.instance)}($sp)").set_comment(f"$t1 = {node.instance}")) + self.register_instruction(mips.AddNode("$t1", "$t1", "$t0").set_comment("Move the pointer to the index")) + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.source)}($sp)")) + self.register_instruction(mips.LoadWordNode("$t0", "8($t0)")) + self.register_instruction(mips.StoreWordNode("$t0", "0($t1)")) + + @visitor.when(cil.TypeOfNode) + def visit(self, node: cil.TypeOfNode): + self.register_comment(f"{node.dest} = typeof {node.source} that is the first word of the object") + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.source)}($sp)")) + self.register_instruction(mips.LoadWordNode("$t0", "0($t0)")) + self.register_instruction(mips.StoreWordNode("$t0", f"{self.offset_of(node.dest)}($sp)")) + + @visitor.when(cil.AncestorNode) + def visit(self, node: cil.AncestorNode): + self.register_comment(f"{node.dest} = ancestor of {node.source}") + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.source)}($sp)")) + self.register_instruction(mips.LoadWordNode("$t0", "4($t0)")) + self.register_instruction(mips.StoreWordNode("$t0", f"{self.offset_of(node.dest)}($sp)")) + + @visitor.when(cil.TypeAddressNode) + def visit(self, node: cil.TypeAddressNode): + self.register_comment(f"{node.dest} = direction of {node.name}") + self.register_instruction(mips.LoadAddressNode("$t0", f"type_{node.name}")) + self.register_instruction(mips.StoreWordNode("$t0", f"{self.offset_of(node.dest)}($sp)")) + + @visitor.when(cil.TypeNameNode) + def visit(self, node: cil.TypeNameNode): + self.register_comment(f"{node.dest} = name of {node.source}") + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.source)}($sp)").set_comment(f"$t0 = {node.source}")) + self.register_instruction(mips.LoadWordNode("$t1", "0($t0)").set_comment(f"$t1 = type of {node.source}")) + self.register_instruction(mips.LoadWordNode("$t2", "8($t1)").set_comment(f"$t2 = direction of the type name")) + self.register_instruction(mips.LoadAddressNode("$t3", "4($t2)").set_comment(f"$t3 = address of the name")) + self.register_instruction(mips.LoadWordNode("$t2", "0($t2)").set_comment(f"$t2 = length of the name")) + self.register_empty_instruction() + + self.register_instruction(mips.AddiNode("$t2", "$t2", "9").set_comment(f"Setting space for the type, the size and the null byte")) + self.register_instantiation("$t2") + self.register_instruction(mips.AddiNode("$t2", "$t2", "-9").set_comment(f"Restoring space for the type, the size and the null byte")) + self.register_empty_instruction() + + self.register_instruction(mips.LoadAddressNode("$t4", "type_String")) + self.register_instruction(mips.StoreWordNode("$t4", f"0($v0)").set_comment("Setting type in the first word of the object")) + self.register_instruction(mips.StoreWordNode("$a0", f"4($v0)").set_comment("Setting length in the second word of the object")) + self.register_empty_instruction() + + self.register_instruction(mips.AddiNode("$t4", "$v0", 0).set_comment("$t4 = direction of the new string")) + self.register_instruction(mips.AddiNode("$t4", "$t4", "8").set_comment("Pointer to the first character of the string")) + self.register_instruction(mips.XorNode("$t5", "$t5", "$t5").set_comment("Initializing counter")) + self.register_instruction(mips.LabelNode("while_copy_name_start")) + self.register_instruction(mips.BeqNode("$t5", "$t2", "while_copy_name_end")) + self.register_instruction(mips.LoadByteNode("$t6", "0($t3)").set_comment("Loading the character")) + self.register_instruction(mips.StoreByteNode("$t6", "0($t4)")) + self.register_instruction(mips.AddiNode("$t4", "$t4", "1").set_comment("Incrementing the pointer to the new string")) + self.register_instruction(mips.AddiNode("$t3", "$t3", "1").set_comment(f"Incrementing the pointer to the string in {node.source}")) + self.register_instruction(mips.AddiNode("$t5", "$t5", "1").set_comment("Incrementing counter")) + self.register_instruction(mips.JumpNode("while_copy_name_start")) + self.register_instruction(mips.LabelNode("while_copy_name_end")) + self.register_empty_instruction() + + self.register_instruction(mips.StoreByteNode("$zero", "0($t4)").set_comment("Setting the null byte")) + self.register_empty_instruction() + + self.register_instruction(mips.StoreWordNode("$v0", f"{self.offset_of(node.dest)}($sp)").set_comment(f"Storing the new string in {node.dest}")) + + @visitor.when(cil.CopyNode) + def visit(self, node: cil.CopyNode): + self.register_comment(f"{node.dest} = copy of {node.source}") + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.source)}($sp)").set_comment(f"$t0 = {node.source}")) + self.register_instruction(mips.LoadWordNode("$t1", "0($t0)").set_comment(f"$t1 = type of {node.source}")) + self.register_instruction(mips.LoadWordNode("$t2", "4($t0)").set_comment(f"$t2 = length of {node.source} in bytes")) + self.register_empty_instruction() + + self.register_comment("Allocating space for the new object") + self.register_instantiation("$t2") + self.register_instruction(mips.MoveNode("$t3", "$v0").set_comment("$t3 = direction of the new object")) + self.register_instruction(mips.StoreWordNode("$t1", "0($v0)").set_comment("Setting type in the first word of the object")) + self.register_instruction(mips.StoreWordNode("$a0", "4($v0)").set_comment("Setting length in the second word of the object")) + self.register_empty_instruction() + + self.register_comment("Initializing the variable of the loop") + self.register_instruction(mips.AddiNode("$t0", "$t0", "8").set_comment("Pointer to the first character of the object")) + self.register_instruction(mips.AddiNode("$t3", "$t3", "8").set_comment("Pointer to the first character of the object")) + self.register_instruction(mips.AddiNode("$t2", "$2", "-8").set_comment("Decrementing in 8 the length of the object")) + self.register_instruction(mips.XorNode("$t4", "$t4", "$t4").set_comment("Initializing counter")) + self.register_empty_instruction() + + self.register_comment("Loop copying the object") + self.register_instruction(mips.LabelNode("while_copy_start")) + self.register_instruction(mips.BeqNode("$t4", "$t2", "while_copy_end")) + self.register_instruction(mips.LoadByteNode("$t5", "0($t0)").set_comment("Loading the byte")) + self.register_instruction(mips.StoreByteNode("$t5", "0($t3)").set_comment("Storing the byte")) + self.register_instruction(mips.AddiNode("$t0", "$t0", "1").set_comment("Incrementing the pointer to the object")) + self.register_instruction(mips.AddiNode("$t3", "$t3", "1").set_comment("Incrementing the pointer to the new object")) + self.register_instruction(mips.AddiNode("$t4", "$t4", "1").set_comment("Incrementing counter")) + self.register_instruction(mips.JumpNode("while_copy_start")) + self.register_instruction(mips.LabelNode("while_copy_end")) + + self.register_instruction(mips.StoreWordNode("$v0", f"{self.offset_of(node.dest)}($sp)").set_comment(f"Storing the new object in {node.dest}")) + + @visitor.when(cil.PrintStringNode) + def visit(self, node: cil.PrintStringNode): + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.str_addr)}($sp)").set_comment(f"$t0 = {node.str_addr}")) + self.register_instruction(mips.AddiNode("$t0", "$t0", "8").set_comment("Pointer to the first character of the string")) + self.register_empty_instruction() + + self.register_comment(f"Printing the String {node.str_addr}") + self.register_instruction(mips.LoadInmediateNode("$v0", "4")) + self.register_instruction(mips.MoveNode("$a0", "$t0")) + self.register_instruction(mips.SystemCallNode()) + + @visitor.when(cil.PrintIntNode) + def visit(self, node: cil.PrintIntNode): + self.register_comment(f"Printing the Int {node.source}") + self.register_instruction(mips.LoadInmediateNode("$v0", "1")) + self.register_instruction(mips.LoadWordNode("$a0", f"{self.offset_of(node.source)}($sp)")) + self.register_instruction(mips.LoadWordNode("$a0", "8($a0)")) + self.register_instruction(mips.SystemCallNode()) + + @visitor.when(cil.PrintTypeNameNode) + def visit(self, node: cil.PrintTypeNameNode): + self.register_comment("Printing the type name") + self.register_empty_instruction() + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.address)}($sp)")) + self.register_instruction(mips.AddiNode("$t0", "$t0", "12")) + self.register_instruction(mips.LoadWordNode("$t0", "0($t0)")) + self.register_instruction(mips.AddiNode("$t0", "$t0", "4")) + self.register_instruction(mips.LoadInmediateNode("$v0", "4")) + self.register_instruction(mips.MoveNode("$a0", "$t0")) + self.register_instruction(mips.SystemCallNode()) + + @visitor.when(cil.ReadStringNode) + def visit(self, node: cil.ReadStringNode): + self.register_instruction(mips.LoadInmediateNode("$v0", "8")) + self.register_instruction(mips.LoadAddressNode("$a0", "buffer_input")) + self.register_instruction(mips.LoadInmediateNode("$a1", "1024")) + self.register_instruction(mips.SystemCallNode()) + + + self.register_empty_instruction() + self.register_instruction(mips.XorNode("$t0", "$t0", "$t0").set_comment("Initializing counter")) + self.register_instruction(mips.LabelNode("while_read_start")) + self.register_instruction(mips.LoadByteNode("$t1", "buffer_input($t0)").set_comment("Loading the byte")) + + # self.register_instruction(mips.LoadInmediateNode("$v0", "1")) + # self.register_instruction(mips.MoveNode("$a0", "$t1")) + # self.register_instruction(mips.SystemCallNode()) + + # self.register_instruction(mips.LoadInmediateNode("$v0", "1")) + # self.register_instruction(mips.LoadInmediateNode("$a0", "0")) + # self.register_instruction(mips.SystemCallNode()) + + self.register_instruction(mips.AddiNode("$t2", "$zero", "10")) + self.register_instruction(mips.BeqNode("$t1", "$t2", "while_read_end")) + self.register_instruction(mips.AddiNode("$t2", "$zero", "13")) + self.register_instruction(mips.BeqNode("$t1", "$t2", "while_read_end")) + self.register_instruction(mips.AddiNode("$t0", "$t0", "1").set_comment("Incrementing counter")) + self.register_instruction(mips.JumpNode("while_read_start")) + self.register_instruction(mips.LabelNode("while_read_end")) + + # self.register_instruction(mips.LoadInmediateNode("$v0", "1")) + # self.register_instruction(mips.MoveNode("$a0", "$t0")) + # self.register_instruction(mips.SystemCallNode()) + self.register_empty_instruction() + self.register_instruction(mips.AddiNode("$t0", "$t0", "9").set_comment("Adding space for the type, the size and the null byte")) + self.register_instantiation("$t0") + self.register_instruction(mips.AddiNode("$t0", "$t0", "-9").set_comment("Adding space for the type, the size and the null byte")) + self.register_instruction(mips.LoadAddressNode("$t2", "type_String")) + self.register_instruction(mips.StoreWordNode("$t2", "0($v0)").set_comment("Setting type in the first word of the object")) + self.register_instruction(mips.StoreWordNode("$a0", "4($v0)").set_comment("Setting length in the second word of the object")) + + self.register_empty_instruction() + self.register_instruction(mips.AddiNode("$t3", "$v0", "8").set_comment("Pointer to the first character of the string")) + self.register_instruction(mips.XorNode("$t4", "$t4", "$t4").set_comment("Initializing counter")) + self.register_empty_instruction() + self.register_instruction(mips.LabelNode("while_copy_from_buffer_start")) + self.register_instruction(mips.BeqNode("$t4", "$t0", "while_copy_from_buffer_end")) + self.register_instruction(mips.LoadByteNode("$t5", "buffer_input($t4)").set_comment("Loading the byte")) + self.register_instruction(mips.StoreByteNode("$t5", "0($t3)").set_comment("Storing the byte")) + self.register_instruction(mips.AddiNode("$t3", "$t3", "1").set_comment("Imcremeenting pointer")) + self.register_instruction(mips.AddiNode("$t4", "$t4", "1").set_comment("Incrementing counter")) + self.register_instruction(mips.JumpNode("while_copy_from_buffer_start")) + self.register_instruction(mips.LabelNode("while_copy_from_buffer_end")) + self.register_empty_instruction() + self.register_instruction(mips.StoreByteNode("$zero", "0($t3)").set_comment("Storing the null byte")) + self.register_empty_instruction() + self.register_instruction(mips.StoreWordNode("$v0", f"{self.offset_of(node.dest)}($sp)").set_comment(f"Storing the new object in {node.dest}")) + + @visitor.when(cil.ReadIntNode) + def visit(self, node: cil.ReadIntNode): + self.register_instruction(mips.LoadInmediateNode("$v0", "5")) + self.register_instruction(mips.SystemCallNode()) + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.dest)}($sp)")) + self.register_instruction(mips.StoreWordNode("$v0", "8($t0)")) + + @visitor.when(cil.LabelNode) + def visit(self, node: cil.LabelNode): + self.register_instruction(mips.LabelNode(node.label)) + + @visitor.when(cil.GotoNode) + def visit(self, node: cil.GotoNode): + self.register_comment(f"Jumping to {node.address}") + self.register_instruction(mips.JumpNode(node.address)) + + @visitor.when(cil.GotoIfNode) + def visit(self, node: cil.GotoIfNode): + self.register_comment(f"If {node.condition} then goto {node.address}") + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.condition)}($sp)").set_comment("Loading the address of the condition")) + self.register_instruction(mips.LoadWordNode("$t0", f"8($t0)").set_comment("Loading the value of the condition")) + self.register_instruction(mips.AddiNode("$t1", "$zero", "1").set_comment("Setting the value to 1 for comparison")) + self.register_instruction(mips.BeqNode("$t0", "$t1", node.address)) + + @visitor.when(cil.PlusNode) + def visit(self, node: cil.PlusNode): + self.register_comment("Addition operation") + self.preprocess_binary_operation(node) + self.register_instruction(mips.AddNode("$t2", "$t0", "$t1").set_comment("$t2 = $t0 + $t1")) + self.postprocess_binary_int_operation(node, "Int") + + @visitor.when(cil.MinusNode) + def visit(self, node: cil.MinusNode): + self.register_comment("Subtraction operation") + self.preprocess_binary_operation(node) + self.register_instruction(mips.SubNode("$t2", "$t0", "$t1").set_comment("$t2 = $t0 - $t1")) + self.postprocess_binary_int_operation(node, "Int") + + @visitor.when(cil.StarNode) + def visit(self, node: cil.StarNode): + self.register_comment("Multiplication operation") + self.preprocess_binary_operation(node) + self.register_instruction(mips.MultNode("$t0", "$t1").set_comment("$t2 = $t0 * $t1")) + self.register_instruction(mips.MoveFromLowNode("$t2")) + self.postprocess_binary_int_operation(node, "Int") + + @visitor.when(cil.DivNode) + def visit(self, node: cil.DivNode): + self.register_comment("Division operation") + self.preprocess_binary_operation(node) + self.register_instruction(mips.DivNode("$t0", "$t1").set_comment("$t2 = $t0 / $t1")) + self.register_instruction(mips.MoveFromLowNode("$t2")) + self.postprocess_binary_int_operation(node, "Int") + + @visitor.when(cil.XorNode) + def visit(self, node: cil.XorNode): + self.register_comment("Xor operation") + self.preprocess_binary_operation(node) + self.register_instruction(mips.XorNode("$t2", "$t0", "$t1").set_comment("$t0 = $t0 ^ $t1")) + self.postprocess_binary_int_operation(node, "Int") + + @visitor.when(cil.LessThanNode) + def visit(self, node: cil.LessThanNode): + self.register_comment("Less than operation") + self.preprocess_binary_operation(node) + self.register_instruction(mips.SltNode("$t2", "$t0", "$t1").set_comment("$t2 = $t0 < $t1")) + self.postprocess_binary_int_operation(node, "Bool") + + @visitor.when(cil.LessEqualNode) + def visit(self, node: cil.LessEqualNode): + self.register_comment("Less than operation") + self.preprocess_binary_operation(node) + self.register_instruction(mips.SleNode("$t2", "$t0", "$t1").set_comment("$t2 = $t0 <= $t1")) + self.postprocess_binary_int_operation(node, "Bool") + + @visitor.when(cil.EqualNode) + def visit(self, node: cil.EqualNode): + self.register_comment("Equal operation") + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.left)}($sp)").set_comment("Save in $t0 the left operand address")) + self.register_instruction(mips.LoadWordNode("$t1", f"{self.offset_of(node.right)}($sp)").set_comment("Save in $t1 the right operand address")) + self.register_instruction(mips.SeqNode("$t2", "$t0", "$t1").set_comment("$t2 = $t0 == $t1")) + self.postprocess_binary_int_operation(node, "Bool") + + @visitor.when(cil.EqualAddressNode) + def visit(self, node: cil.EqualAddressNode): + self.register_comment(f"{node.dest} = EqualAddress({node.left}, {node.right})") + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.left)}($sp)")) + self.register_instruction(mips.LoadWordNode("$t1", f"{self.offset_of(node.right)}($sp)")) + self.register_instruction(mips.SeqNode("$t2", "$t0", "$t1")) + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.dest)}($sp)")) + self.register_instruction(mips.StoreWordNode("$t2", f"8($t0)")) + + @visitor.when(cil.EqualIntNode) + def visit(self, node: cil.EqualIntNode): + self.register_comment(f"{node.dest} = EqualInt({node.left}, {node.right})") + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.left)}($sp)")) + self.register_instruction(mips.LoadWordNode("$t0", f"8($t0)")) + self.register_instruction(mips.LoadWordNode("$t1", f"{self.offset_of(node.right)}($sp)")) + self.register_instruction(mips.LoadWordNode("$t1", f"8($t1)")) + self.register_instruction(mips.SeqNode("$t2", "$t0", "$t1")) + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.dest)}($sp)")) + self.register_instruction(mips.StoreWordNode("$t2", f"8($t0)")) + + @visitor.when(cil.EqualStrNode) + def visit(self, node: cil.EqualStrNode): + self.register_comment(f"{node.dest} = EqualStr({node.left}, {node.right})") + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.left)}($sp)")) + self.register_instruction(mips.LoadWordNode("$t1", f"{self.offset_of(node.right)}($sp)")) + self.register_instruction(mips.AddiNode("$t0", "$t0", "8")) + self.register_instruction(mips.AddiNode("$t1", "$t1", "8")) + + self.register_empty_instruction() + self.register_comment(f"By default we assume the strings are equals") + self.register_instruction(mips.AddiNode("$t4", "$zero", "1")) + self.register_instruction(mips.LoadWordNode("$t5", f"{self.offset_of(node.dest)}($sp)")) + self.register_instruction(mips.StoreWordNode("$t4", f"8($t5)")) + + self.register_empty_instruction() + self.register_instruction(mips.LabelNode("while_compare_strings_start")) + self.register_instruction(mips.LoadByteNode("$t2", "0($t0)")) + self.register_instruction(mips.LoadByteNode("$t3", "0($t1)")) + + self.register_instruction(mips.BeqNode("$t2", "$t3", "while_compare_strings_update")) + + self.register_empty_instruction() + self.register_comment(f"The strings are no equals") + self.register_instruction(mips.LoadWordNode("$t5", f"{self.offset_of(node.dest)}($sp)")) + self.register_instruction(mips.StoreWordNode("$zero", f"8($t5)")) + self.register_instruction(mips.JumpNode("while_compare_strings_end")) + + self.register_empty_instruction() + self.register_instruction(mips.LabelNode("while_compare_strings_update")) + self.register_instruction(mips.AddiNode("$t0", "$t0", "1")) + self.register_instruction(mips.AddiNode("$t1", "$t1", "1")) + self.register_instruction(mips.BeqNode("$t2", "$zero", "while_compare_strings_end")) + self.register_instruction(mips.BeqNode("$t3", "$zero", "while_compare_strings_end")) + self.register_instruction(mips.JumpNode("while_compare_strings_start")) + self.register_instruction(mips.LabelNode("while_compare_strings_end")) + + @visitor.when(cil.HaltNode) + def visit(self, node: cil.HaltNode): + self.register_comment("Exit program") + self.register_instruction(mips.LoadInmediateNode("$v0", "10")) + self.register_instruction(mips.SystemCallNode()) + + @visitor.when(cil.ReturnNode) + def visit(self, node: cil.ReturnNode): + if node.value.isdigit(): + self.register_comment("Loading return value in $v1") + self.register_instruction(mips.AddiNode("$v1", "$zero", f"{node.value}")) + return + offset = self.offset_of(node.value) + self.register_comment("Loading return value in $v1") + self.register_instruction(mips.LoadWordNode("$v1", f"{offset}($sp)")) + + + def preprocess_binary_operation(self, node: cil.ArithmeticNode): + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.left)}($sp)").set_comment("Save in $t0 the left operand address")) + self.register_instruction(mips.LoadWordNode("$t0", "8($t0)").set_comment("Save in $t0 the left operand value")) + self.register_instruction(mips.LoadWordNode("$t1", f"{self.offset_of(node.right)}($sp)").set_comment("Save in $t1 the right operand address")) + self.register_instruction(mips.LoadWordNode("$t1", "8($t1)").set_comment("Save in $t1 the rigth operand value")) + + def postprocess_binary_int_operation(self, node: cil.ArithmeticNode, t: str): + # self.register_instantiation(12) + self.register_empty_instruction() + self.register_instruction(mips.LoadWordNode("$t0", f"{self.offset_of(node.dest)}($sp)").set_comment(f"$t0 = {node.dest}")) + self.register_instruction(mips.StoreWordNode("$t2", "8($t0)").set_comment(f"Setting value in the third word of the {t} object")) diff --git a/src/cool/code_generation/translator_cool_to_cil.py b/src/cool/code_generation/translator_cool_to_cil.py new file mode 100644 index 000000000..cf53477b6 --- /dev/null +++ b/src/cool/code_generation/translator_cool_to_cil.py @@ -0,0 +1,1711 @@ +from atexit import register +from copy import deepcopy +from typing import Any, Dict, List, Optional, Tuple + +import cool.code_generation.ast_cil as cil +import cool.code_generation.ast_ecool as ecool +import cool.semantics.utils.astnodes as cool +import cool.semantics.utils.errors as err +import cool.visitor.visitor as visitor +from cool.semantics.utils.scope import ( + Attribute, + Context, + ErrorType, + Method, + Scope, + SemanticError, + Type, +) + + +class ExtendedCoolTranslator: + """ + This class translate the Cool AST to a ExtendedCool AST, adding the new + features like the new keyword null in the asignments and the creation of + a default constructor for every class defined in the program. + """ + def __init__(self, context: Context): + self.current_type: Optional[Type] = None + self.current_method: Optional[Method] = None + self.context: Context = context + self.class_declarations = {} # type: Dict[str, cool.ClassDeclarationNode] + + @visitor.on("node") + def visit(self, node): + pass + + @visitor.when(cool.ProgramNode) + def visit(self, node: cool.ProgramNode): + declarations: List[cool.ClassDeclarationNode] = [] + + default_class_names = ["Object", "IO", "String", "Int", "Bool"] + for name in default_class_names: + t = self.context.get_type(name) + t.define_method("__init__", [], [], t) + t.methods_dict.move_to_end("__init__", last=False) + + for declaration in node.declarations: + self.class_declarations[declaration.id] = declaration + + for declaration in node.declarations: + declarations.append(self.visit(declaration)) + + return cool.ProgramNode(declarations) + + @visitor.when(cool.ClassDeclarationNode) + def visit(self, node: cool.ClassDeclarationNode): + self.current_type = self.context.get_type(node.id) + + ancestors = [ + self.class_declarations[owner.name] + for _, owner in self.current_type.all_attributes() + ] + + attrs = [] + visited = set() + for ancestor in ancestors: + if ancestor.id in visited: + continue + + visited.add(ancestor.id) + attrs += [ + feature + for feature in ancestor.features + if isinstance(feature, cool.AttrDeclarationNode) + ] + + expressions: List[cool.ExprNode] = [] + for attr in attrs: + expressions.append(self.visit(attr)) + expressions.append(cool.VariableNode("self")) + + body = cool.BlockNode(expressions) + constructor = cool.MethodDeclarationNode( + "__init__", [], self.current_type.name, body + ) + + self.current_type.define_method("__init__", [], [], self.current_type) + self.current_type.methods_dict.move_to_end("__init__", last=False) + + attrs = [ + feature + for feature in node.features + if isinstance(feature, cool.AttrDeclarationNode) + ] + methods = [ + feature + for feature in node.features + if isinstance(feature, cool.MethodDeclarationNode) + ] + + features = attrs + [constructor] + methods + + return cool.ClassDeclarationNode(node.id, features, node.parent) + + @visitor.when(cool.AttrDeclarationNode) + def visit(self, node: cool.AttrDeclarationNode): + if node.expr is None: + expr = None + if node.type == "Int": + expr = cool.IntegerNode("0") + elif node.type == "Bool": + expr = cool.BooleanNode("false") + elif node.type == "String": + expr = cool.StringNode('""') + else: + expr = ecool.NullNode() + return cool.AssignNode(node.id, expr) + return cool.AssignNode(node.id, deepcopy(node.expr)) + + +class ExtendedCoolTypeChecker: + def __init__(self, context: Context, errors: List[str]): + self.context: Context = context + self.errors: List[str] = errors + self.current_type: Optional[Type] = None + self.current_method: Optional[Method] = None + self.current_attribute: Optional[Attribute] = None + + @visitor.on("node") + def visit(self, node, scope): + pass + + @visitor.when(cool.ProgramNode) + def visit(self, node: cool.ProgramNode, scope: Scope = None): + if scope is None: + scope = Scope() + + node.scope = scope + + for elem in node.declarations: + self.visit(elem, scope.create_child()) + + return scope + + @visitor.when(cool.ClassDeclarationNode) + def visit(self, node: cool.ClassDeclarationNode, scope: Scope): + node.scope = scope + self.current_type = self.context.get_type(node.id) + + attrs = [ + feature + for feature in node.features + if isinstance(feature, cool.AttrDeclarationNode) + ] + methods = [ + feature + for feature in node.features + if isinstance(feature, cool.MethodDeclarationNode) + ] + + for attr, attr_owner in self.current_type.all_attributes(): + if attr_owner != self.current_type: + scope.define_variable(attr.name, attr.type) + + for attr in attrs: + self.visit(attr, scope) + + for method in methods: + self.visit(method, scope.create_child()) + + @visitor.when(cool.AttrDeclarationNode) + def visit(self, node: cool.AttrDeclarationNode, scope: Scope): + node.scope = scope + if node.id == "self": + self.errors.append(err.SELF_INVALID_ATTRIBUTE_ID % (node.line, node.column)) + + try: + attr_type = ( + self.context.get_type(node.type) + if node.type != "SELF_TYPE" + else self.current_type + ) + except SemanticError: + attr_type = ErrorType() + + scope.define_variable("self", self.current_type) + + # set the current attribute for analyze the body + # and set the self.current_method variable to None + self.current_attribute = self.current_type.get_attribute(node.id) + self.current_method = None + + if node.expr is not None: + expr_type = self.visit(node.expr, scope.create_child()) + if not expr_type.conforms_to(attr_type): + line, column = node.expr_position + self.errors.append( + err.INCOMPATIBLE_TYPES + % (line, column, expr_type.name, attr_type.name) + ) + scope.define_variable(node.id, attr_type) + + @visitor.when(cool.MethodDeclarationNode) + def visit(self, node: cool.MethodDeclarationNode, scope: Scope): + node.scope = scope + self.current_method = self.current_type.get_method(node.id) + self.current_attribute = None + + # Parameters can hide the attribute declaration, that's why we are not checking if there is defined, + # instead we are checking for local declaration. Also it is checked that the static type of a parameter is + # different of SELF_TYPE. + + scope.define_variable("self", self.current_type) + + for param_name, param_type in zip( + self.current_method.param_names, self.current_method.param_types + ): + if not scope.is_local(param_name): + if param_type.name == "SELF_TYPE": + self.errors.append(err.INVALID_PARAM_TYPE % "SELF_TYPE") + scope.define_variable(param_name, ErrorType()) + else: + try: + scope.define_variable( + param_name, self.context.get_type(param_type.name) + ) + except SemanticError: + scope.define_variable(param_name, ErrorType()) + else: + self.errors.append( + err.LOCAL_ALREADY_DEFINED + % (node.line, node.column, param_name, self.current_method.name) + ) + + try: + return_type = ( + self.context.get_type(node.return_type) + if node.return_type != "SELF_TYPE" + else self.current_type + ) + except SemanticError: + return_type = ErrorType() + + expr_type = self.visit(node.body, scope) + + if not expr_type.conforms_to(return_type): + self.errors.append( + err.INCOMPATIBLE_TYPES + % (node.line, node.column, expr_type.name, return_type.name) + ) + + @visitor.when(cool.LetNode) + def visit(self, node: cool.LetNode, scope: Scope): + node.scope = scope + for i, (_id, _type, _expr) in enumerate(node.declarations): + if _id == "self": + line, column = node.declaration_names_positions[i] + self.errors.append(err.SELF_USED_IN_LET % (line, column)) + continue + + try: + var_static_type = ( + self.context.get_type(_type) + if _type != "SELF_TYPE" + else self.current_type + ) + except SemanticError: + line, column = node.declaration_types_positions[i] + self.errors.append(err.UNDEFINED_TYPE % (line, column, _type)) + var_static_type = ErrorType() + + scope.define_variable(_id, var_static_type) + + expr_type = ( + self.visit(_expr, scope.create_child()) if _expr is not None else None + ) + if expr_type is not None and not expr_type.conforms_to(var_static_type): + self.errors.append( + err.INCOMPATIBLE_TYPES + % (node.line, node.column, expr_type.name, var_static_type.name) + ) + + return self.visit(node.expr, scope.create_child()) + + @visitor.when(cool.AssignNode) + def visit(self, node: cool.AssignNode, scope: Scope): + node.scope = scope + var_info = scope.find_variable(node.id) + + if var_info.name == "self": + self.errors.append(err.SELF_IS_READONLY % (node.line, node.column)) + + expr_type = self.visit(node.expr, scope) + + if var_info is None: + self.errors.append( + err.UNDEFINED_VARIABLE + % (node.line, node.column, node.id, self.current_method.name) + ) + else: + if not expr_type.conforms_to(var_info.type): + self.errors.append( + err.INCOMPATIBLE_TYPES + % (node.line, node.column, expr_type.name, var_info.type.name) + ) + + return expr_type + + @visitor.when(cool.BlockNode) + def visit(self, node: cool.BlockNode, scope: Scope): + node.scope = scope + return_type = ErrorType() + for expr in node.expressions: + return_type = self.visit(expr, scope) + return return_type + + @visitor.when(cool.ConditionalNode) + def visit(self, node: cool.ConditionalNode, scope: Scope): + node.scope = scope + if_type = self.visit(node.if_expr, scope) + then_type = self.visit(node.then_expr, scope) + else_type = self.visit(node.else_expr, scope) + if if_type != self.context.get_type("Bool"): + self.errors.append( + err.INCOMPATIBLE_TYPES % (node.line, node.column, if_type.name, "Bool") + ) + return then_type.join(else_type) + + @visitor.when(cool.WhileNode) + def visit(self, node: cool.WhileNode, scope: Scope): + node.scope = scope + condition = self.visit(node.condition, scope) + if condition != self.context.get_type("Bool"): + self.errors.append( + err.INCOMPATIBLE_TYPES + % (node.line, node.column, condition.name, "Bool") + ) + + self.visit(node.body, scope) + return self.context.get_type("Object") + + @visitor.when(cool.SwitchCaseNode) + def visit(self, node: cool.SwitchCaseNode, scope: Scope): + node.scope = scope + self.visit(node.expr, scope) + types = [] + visited = set() + for i, (identifier, type_name, expr) in enumerate(node.cases): + new_scope = scope.create_child() + try: + if type_name != "SELF_TYPE": + new_scope.define_variable( + identifier, self.context.get_type(type_name) + ) + else: + self.errors.append(err.INVALID_CASE_TYPE % type_name) + except SemanticError: + new_scope.define_variable(identifier, ErrorType()) + line, column = node.cases_positions[i] + self.errors.append( + err.UNDEFINED_TYPE_IN_BRANCH % (line, column, type_name) + ) + + # Cannot be dublicate Branches types + if type_name in visited: + line, column = node.cases_positions[i] + self.errors.append( + err.DUPLICATE_BARNCH_IN_CASE % (line, column, type_name) + ) + + visited.add(type_name) + types.append(self.visit(expr, new_scope)) + + return Type.multi_join(types) + + @visitor.when(cool.MethodCallNode) + def visit(self, node: cool.MethodCallNode, scope: Scope): + node.scope = scope + if node.obj is None: + node.obj = cool.VariableNode("self") + obj_type = self.visit(node.obj, scope) + + if node.type is not None: + try: + ancestor_type = self.context.get_type(node.type) + except SemanticError: + ancestor_type = ErrorType() + line, column = node.type_position + self.errors.append(err.UNDEFINED_TYPE % (line, column, node.type)) + + if not obj_type.conforms_to(ancestor_type): + line, column = node.type_position + self.errors.append( + err.INVALID_ANCESTOR + % (line, column, obj_type.name, ancestor_type.name) + ) + else: + ancestor_type = obj_type + + try: + method = ancestor_type.get_method(node.id) + except SemanticError: + line, column = node.id_position + self.errors.append( + err.DISPATCH_UNDEFINED_METHOD % (line, column, node.id, obj_type.name) + ) + + for arg in node.args: + self.visit(arg, scope) + return ErrorType() + + args_count = len(node.args) + params_count = len(method.param_names) + if args_count != params_count: + line, column = node.id_position + self.errors.append( + err.DISPATCH_WITH_WRONG_NUMBER_OF_ARGS + % (line, column, method.name, obj_type.name, params_count, args_count) + ) + + number_of_args = min(args_count, params_count) + for i, arg in enumerate(node.args[:number_of_args]): + arg_type = self.visit(arg, scope) + if not arg_type.conforms_to(method.param_types[i]): + line, column = node.args_positions[i] + self.errors.append( + err.INCOMPATIBLE_TYPES + % ( + line, + column, + arg_type.name, + method.param_types[i].name, + ) + ) + + return ( + method.return_type + if method.return_type.name != "SELF_TYPE" + else ancestor_type + ) + + @visitor.when(cool.IntegerNode) + def visit(self, node: cool.IntegerNode, scope: Scope): + node.scope = scope + return self.context.get_type("Int") + + @visitor.when(cool.StringNode) + def visit(self, node: cool.StringNode, scope: Scope): + node.scope = scope + return self.context.get_type("String") + + @visitor.when(cool.BooleanNode) + def visit(self, node: cool.BooleanNode, scope: Scope): + node.scope = scope + return self.context.get_type("Bool") + + @visitor.when(ecool.NullNode) + def visit(self, node: ecool.NullNode, scope: Scope): + node.scope = scope + return ecool.NullType() + + @visitor.when(cool.VariableNode) + def visit(self, node: cool.VariableNode, scope: Scope): + node.scope = scope + variable = scope.find_variable(node.lex) + if variable is None: + if self.current_attribute is not None: + name = self.current_attribute.name + else: + name = self.current_method.name + + self.errors.append( + err.UNDEFINED_VARIABLE % (node.line, node.column, node.lex, name) + ) + return ErrorType() + return variable.type + + @visitor.when(cool.InstantiateNode) + def visit(self, node: cool.InstantiateNode, scope: Scope): + node.scope = scope + try: + return ( + self.context.get_type(node.lex) + if node.lex != "SELF_TYPE" + else self.current_type + ) + except SemanticError as e: + line, column = node.type_position + self.errors.append(err.UNDEFINED_NEW_TYPE % (line, column, node.lex)) + return ErrorType() + + @visitor.when(cool.NegationNode) + def visit(self, node: cool.NegationNode, scope: Scope): + node.scope = scope + return self._check_unary_operation( + node, scope, "not", self.context.get_type("Bool") + ) + + @visitor.when(cool.ComplementNode) + def visit(self, node: cool.ComplementNode, scope: Scope): + node.scope = scope + return self._check_unary_operation( + node, scope, "~", self.context.get_type("Int") + ) + + @visitor.when(cool.IsVoidNode) + def visit(self, node: cool.IsVoidNode, scope: Scope): + node.scope = scope + self.visit(node.expr, scope) + return self.context.get_type("Bool") + + @visitor.when(cool.PlusNode) + def visit(self, node: cool.PlusNode, scope: Scope): + node.scope = scope + return self._check_int_binary_operation( + node, scope, "+", self.context.get_type("Int") + ) + + @visitor.when(cool.MinusNode) + def visit(self, node: cool.MinusNode, scope: Scope): + node.scope = scope + return self._check_int_binary_operation( + node, scope, "-", self.context.get_type("Int") + ) + + @visitor.when(cool.StarNode) + def visit(self, node: cool.StarNode, scope: Scope): + node.scope = scope + return self._check_int_binary_operation( + node, scope, "*", self.context.get_type("Int") + ) + + @visitor.when(cool.DivNode) + def visit(self, node: cool.DivNode, scope: Scope): + node.scope = scope + return self._check_int_binary_operation( + node, scope, "/", self.context.get_type("Int") + ) + + @visitor.when(cool.LessEqualNode) + def visit(self, node: cool.LessEqualNode, scope: Scope): + node.scope = scope + return self._check_int_binary_operation( + node, scope, "<=", self.context.get_type("Bool") + ) + + @visitor.when(cool.LessThanNode) + def visit(self, node: cool.LessThanNode, scope: Scope): + node.scope = scope + return self._check_int_binary_operation( + node, scope, "<", self.context.get_type("Bool") + ) + + @visitor.when(cool.EqualNode) + def visit(self, node: cool.EqualNode, scope: Scope): + node.scope = scope + left_type = self.visit(node.left, scope) + right_type = self.visit(node.right, scope) + + basic_types = ("Int", "String", "Bool") + if ( + left_type.name in basic_types or left_type.name in basic_types + ) and left_type.name != right_type.name: + self.errors.append( + err.INVALID_EQ_COMPARISON_OPERATION % (node.line, node.column) + ) + return self.context.get_type("Bool") + + def _check_int_binary_operation( + self, node: cool.BinaryNode, scope: Scope, operation: str, return_type: Type + ): + left_type = self.visit(node.left, scope) + right_type = self.visit(node.right, scope) + + if left_type == right_type == self.context.get_type("Int"): + return return_type + self.errors.append( + err.INVALID_BINARY_OPERATION + % (node.line, node.column, operation, left_type.name, right_type.name) + ) + return ErrorType() + + def _check_unary_operation( + self, node: cool.UnaryNode, scope: Scope, operation: str, expected_type: Type + ): + typex = self.visit(node.expr, scope) + if typex == expected_type: + return typex + self.errors.append( + err.INVALID_UNARY_OPERATION + % (node.line, node.column, operation, typex.name) + ) + return ErrorType() + + +class BaseCoolToCilVisitor: + def __init__(self, context: Context): + self.dottypes: List[cil.TypeNode] = [] + self.dotdata: List[cil.DataNode] = [] + self.dotcode: List[cil.FunctionNode] = [] + + self.current_type: Optional[Type] = None + self.current_method: Optional[Method] = None + self.current_function: Optional[cil.FunctionNode] = None + + self.context: Context = context + + self.locals_dict = {} + self.param_set = set() + self.attr_set = set() + + @property + def params(self) -> List[cil.ParamNode]: + return self.current_function.params + + @property + def localvars(self) -> List[cil.LocalNode]: + return self.current_function.local_vars + + @property + def instructions(self) -> List[cil.InstructionNode]: + return self.current_function.instructions + + def register_local(self, var_name: str, comment: str = "") -> str: + local_name = ( + f"local_{self.current_function.name[9:]}_{var_name}_{len(self.localvars)}" + ) + local_name = var_name + local_node = cil.LocalNode(local_name).set_comment(comment) + self.localvars.append(local_node) + return local_name + + def define_internal_local(self, comment: str = "") -> str: + return self.register_local(f"internal_{len(self.localvars)}", comment) + + def register_instruction( + self, instruction: cil.InstructionNode + ) -> cil.InstructionNode: + self.instructions.append(instruction) + return instruction + + def to_function_name(self, method_name: str, type_name: str) -> str: + return f"function_{method_name}_at_{type_name}" + + def register_function(self, function_name: str) -> cil.FunctionNode: + function_node = cil.FunctionNode(function_name, [], [], []) + self.dotcode.append(function_node) + return function_node + + def register_type(self, name: str, parent_name: Optional[str] = None) -> cil.TypeNode: + type_node = cil.TypeNode(name, parent_name) + self.dottypes.append(type_node) + return type_node + + def register_data(self, value: Any) -> cil.DataNode: + data_name = f"data_{len(self.dotdata)}" + data_node = cil.DataNode(data_name, value) + self.dotdata.append(data_node) + return data_node + + def register_comment(self, comment: str) -> cil.CommentNode: + self.register_instruction(cil.CommentNode(comment)) + + def register_empty_instruction(self): + self.register_instruction(cil.EmptyInstruction()) + + def add_function_main(self): + self.current_function = self.register_function("main") + local_main = self.define_internal_local() + local_result = self.define_internal_local() + method_index = self.define_internal_local() + method_address = self.define_internal_local() + + self.register_instruction(cil.AllocateNode("Main", local_main)) + self.register_instruction(cil.ArgNode(local_main, 0, 1)) + self.register_instruction(cil.StaticCallNode(self.to_function_name("__init__", "Main"), local_main, 1)) + self.register_empty_instruction() + + + all_methods = methods_declaration_order(self.context.get_type("Main")) + i = [m.name for m, _ in all_methods].index("main") + self.register_instruction(cil.AllocateIntNode(method_index, f"{i}")) + self.register_instruction(cil.GetMethodNode(method_address, local_main, method_index, "main", "Main")) + + self.register_instruction(cil.ArgNode(local_main, 0, 1)) + self.register_instruction(cil.DynamicCallNode("Main", method_address, local_result, 1)) + + self.register_empty_instruction() + self.register_instruction(cil.HaltNode()) + + def add_function_add(self): + self.current_function = self.register_function("function_add") + self.current_function.params.append(cil.ParamNode("a")) + self.current_function.params.append(cil.ParamNode("b")) + result = self.define_internal_local("Adding result") + self.register_instruction(cil.AllocateIntNode(result, "0")) + self.register_instruction(cil.PlusNode(result, "a", "b")) + self.register_instruction(cil.ReturnNode(result)) + + def add_function_sub(self): + self.current_function = self.register_function("function_sub") + self.current_function.params.append(cil.ParamNode("a")) + self.current_function.params.append(cil.ParamNode("b")) + result = self.define_internal_local("Substracting result") + self.register_instruction(cil.AllocateIntNode(result, "0")) + self.register_instruction(cil.MinusNode(result, "a", "b")) + self.register_instruction(cil.ReturnNode(result)) + + def add_function_mul(self): + self.current_function = self.register_function("function_mult") + self.current_function.params.append(cil.ParamNode("a")) + self.current_function.params.append(cil.ParamNode("b")) + result = self.define_internal_local("Multiting result") + self.register_instruction(cil.AllocateIntNode(result, "0")) + self.register_instruction(cil.StarNode(result, "a", "b")) + self.register_instruction(cil.ReturnNode(result)) + + def add_function_div(self): + self.current_function = self.register_function("function_div") + self.current_function.params.append(cil.ParamNode("a")) + self.current_function.params.append(cil.ParamNode("b")) + result = self.define_internal_local("Dividing result") + self.register_instruction(cil.AllocateIntNode(result, "0")) + self.register_instruction(cil.DivNode(result, "a", "b")) + self.register_instruction(cil.ReturnNode(result)) + + def add_function_xor(self): + self.current_function = self.register_function("function_xor") + self.current_function.params.append(cil.ParamNode("a")) + self.current_function.params.append(cil.ParamNode("b")) + result = self.define_internal_local("Xor result") + self.register_instruction(cil.AllocateIntNode(result, "0")) + self.register_instruction(cil.XorNode(result, "a", "b")) + self.register_instruction(cil.ReturnNode(result)) + + def add_function_less_than(self): + self.current_function = self.register_function("function_less_than") + self.current_function.params.append(cil.ParamNode("a")) + self.current_function.params.append(cil.ParamNode("b")) + result = self.define_internal_local("Less than result") + self.register_instruction(cil.AllocateBoolNode(result, "0")) + self.register_instruction(cil.LessThanNode(result, "a", "b")) + self.register_instruction(cil.ReturnNode(result)) + + def add_function_less_than_or_equal(self): + self.current_function = self.register_function("function_less_than_or_equal") + self.current_function.params.append(cil.ParamNode("a")) + self.current_function.params.append(cil.ParamNode("b")) + result = self.define_internal_local("Less than or equal result") + self.register_instruction(cil.AllocateBoolNode(result, "0")) + self.register_instruction(cil.LessEqualNode(result, "a", "b")) + self.register_instruction(cil.ReturnNode(result)) + + def add_function_equal(self): + self.current_function = self.register_function("function_equal") + self.current_function.params.append(cil.ParamNode("a")) + self.current_function.params.append(cil.ParamNode("b")) + result = self.define_internal_local("Equal result") + constant_null = self.define_internal_local("Null Pointer") + is_null = self.define_internal_local("One of params is null") + type_of_a = self.define_internal_local("Type of a") + type_int = self.define_internal_local("Type Int") + type_bool = self.define_internal_local("Type Bool") + type_string = self.define_internal_local("Type String") + type_a_equals_int = self.define_internal_local("Type of a equals int") + type_a_equals_bool = self.define_internal_local("Type of a equals bool") + type_a_equals_string = self.define_internal_local("Type of a equals string") + + self.register_instruction(cil.AllocateBoolNode(result, "0")) + self.register_instruction(cil.AllocateNullPtrNode(constant_null)) + self.register_instruction(cil.AllocateBoolNode(is_null, "0")) + + self.register_instruction(cil.EqualAddressNode(is_null, "a", constant_null)) + self.register_instruction(cil.EqualAddressNode(is_null, "b", constant_null)) + self.register_instruction(cil.GotoIfNode(is_null, "a_is_type_object")) + + self.register_instruction(cil.TypeOfNode(type_of_a, "a")) + self.register_instruction(cil.TypeAddressNode(type_int, "Int")) + self.register_instruction(cil.TypeAddressNode(type_bool, "Bool")) + self.register_instruction(cil.TypeAddressNode(type_string, "String")) + self.register_instruction(cil.AllocateBoolNode(type_a_equals_int, "0")) + self.register_instruction(cil.AllocateBoolNode(type_a_equals_bool, "0")) + self.register_instruction(cil.AllocateBoolNode(type_a_equals_string, "0")) + + self.register_instruction(cil.EqualAddressNode(type_a_equals_int, type_of_a, type_int)) + self.register_instruction(cil.EqualAddressNode(type_a_equals_bool, type_of_a, type_bool)) + self.register_instruction(cil.EqualAddressNode(type_a_equals_string, type_of_a, type_string)) + self.register_empty_instruction() + self.register_instruction(cil.GotoIfNode(type_a_equals_int, "a_is_type_int_or_bool")) + self.register_instruction(cil.GotoIfNode(type_a_equals_bool, "a_is_type_int_or_bool")) + self.register_instruction(cil.GotoIfNode(type_a_equals_string, "a_is_type_string")) + self.register_instruction(cil.GotoNode("a_is_type_object")) + + self.register_empty_instruction() + self.register_instruction(cil.LabelNode("a_is_type_int_or_bool")) + self.register_instruction(cil.EqualIntNode(result, "a", "b")) + self.register_instruction(cil.GotoNode("end_of_equal")) + + self.register_empty_instruction() + self.register_instruction(cil.LabelNode("a_is_type_string")) + self.register_instruction(cil.EqualStrNode(result, "a", "b")) + self.register_instruction(cil.GotoNode("end_of_equal")) + + self.register_empty_instruction() + self.register_instruction(cil.LabelNode("a_is_type_object")) + self.register_instruction(cil.EqualNode(result, "a", "b")) + self.register_instruction(cil.GotoNode("end_of_equal")) + + self.register_empty_instruction() + self.register_instruction(cil.LabelNode("end_of_equal")) + + self.register_instruction(cil.ReturnNode(result)) + + def add_function_assign(self): + self.current_function = self.register_function("function_assign") + self.current_function.params.append(cil.ParamNode("dest")) + self.current_function.params.append(cil.ParamNode("source")) + constant_null = self.define_internal_local("Null Pointer") + is_null = self.define_internal_local("One of params is null") + type_of_source = self.define_internal_local("Type of source") + type_int = self.define_internal_local("Type Int") + type_bool = self.define_internal_local("Type Bool") + type_source_equals_int = self.define_internal_local("Type of source equals int") + type_source_equals_bool = self.define_internal_local("Type of source equals bool") + + self.register_instruction(cil.AllocateNullPtrNode(constant_null)) + self.register_instruction(cil.AllocateBoolNode(is_null, "0")) + self.register_instruction(cil.EqualAddressNode(is_null, "source", constant_null)) + self.register_instruction(cil.EqualAddressNode(is_null, "dest", constant_null)) + self.register_instruction(cil.GotoIfNode(is_null, "source_is_type_object")) + + self.register_instruction(cil.TypeOfNode(type_of_source, "source")) + self.register_instruction(cil.TypeAddressNode(type_int, "Int")) + self.register_instruction(cil.TypeAddressNode(type_bool, "Bool")) + self.register_instruction(cil.AllocateBoolNode(type_source_equals_int, "0")) + self.register_instruction(cil.AllocateBoolNode(type_source_equals_bool, "0")) + self.register_instruction(cil.EqualAddressNode(type_source_equals_int, type_of_source, type_int)) + self.register_instruction(cil.EqualAddressNode(type_source_equals_bool, type_of_source, type_bool)) + self.register_empty_instruction() + self.register_instruction(cil.GotoIfNode(type_source_equals_int, "source_is_type_int_or_bool")) + self.register_instruction(cil.GotoIfNode(type_source_equals_bool, "source_is_type_int_or_bool")) + self.register_instruction(cil.GotoNode("source_is_type_object")) + + self.register_empty_instruction() + self.register_instruction(cil.LabelNode("source_is_type_int_or_bool")) + + self.register_instruction(cil.AssignIntNode("dest", "source")) + self.register_instruction(cil.GotoNode("source_end_of_equal")) + + self.register_empty_instruction() + self.register_instruction(cil.LabelNode("source_is_type_object")) + self.register_instruction(cil.AssignNode("dest", "source")) + self.register_instruction(cil.GotoNode("source_end_of_equal")) + + self.register_empty_instruction() + self.register_instruction(cil.LabelNode("source_end_of_equal")) + + self.register_instruction(cil.ReturnNode("dest")) + + def add_function_init(self, type_name: str): + self.current_function = self.register_function(self.to_function_name("__init__", type_name)) + self.current_function.params.append(cil.ParamNode("self")) + self.register_instruction(cil.ReturnNode("self")) + + def add_function_abort(self): + self.current_function = self.register_function(self.to_function_name("abort", "Object")) + self.current_function.params.append(cil.ParamNode("self")) + msg1 = self.define_internal_local() + msg2 = self.define_internal_local() + msg = self.define_internal_local() + endl = self.define_internal_local() + method_index = self.define_internal_local() + method_address = self.define_internal_local() + + self.register_instruction(cil.AllocateStrNode(msg1, "\"Abort called from class \"")) + self.register_instruction(cil.AllocateStrNode(endl, "\"\\n\"")) + + all_methods = methods_declaration_order(self.context.get_type("String")) + i = [m.name for m, _ in all_methods].index("type_name") + self.register_instruction(cil.AllocateIntNode(method_index, f"{i}")) + self.register_instruction(cil.GetMethodNode(method_address, "self", method_index, "type_name", "String")) + + self.register_instruction(cil.ArgNode("self", 0, 1)) + self.register_instruction(cil.DynamicCallNode("String", method_address, msg2, 1)) + + + all_methods = methods_declaration_order(self.context.get_type("String")) + i = [m.name for m, _ in all_methods].index("concat") + self.register_instruction(cil.AllocateIntNode(method_index, f"{i}")) + self.register_instruction(cil.GetMethodNode(method_address, "self", method_index, "concat", "String")) + + self.register_instruction(cil.ArgNode(msg1, 0, 2)) + self.register_instruction(cil.ArgNode(msg2, 1, 2)) + self.register_instruction(cil.DynamicCallNode("String", method_address, msg, 2)) + + all_methods = methods_declaration_order(self.context.get_type("String")) + i = [m.name for m, _ in all_methods].index("concat") + self.register_instruction(cil.AllocateIntNode(method_index, f"{i}")) + self.register_instruction(cil.GetMethodNode(method_address, "self", method_index, "concat", "String")) + + self.register_instruction(cil.ArgNode(msg, 0, 2)) + self.register_instruction(cil.ArgNode(endl, 1, 2)) + self.register_instruction(cil.DynamicCallNode("String", method_address, msg, 2)) + + self.register_instruction(cil.PrintStringNode(msg)) + self.register_instruction(cil.HaltNode()) + self.register_instruction(cil.ReturnNode("self")) + + def add_function_type_name(self): + self.current_function = self.register_function(self.to_function_name("type_name", "Object")) + self.current_function.params.append(cil.ParamNode("self")) + type_name = self.define_internal_local("type_name") + self.register_instruction(cil.TypeNameNode(type_name, "self")) + self.register_instruction(cil.ReturnNode(type_name)) + + def add_function_copy(self): + self.current_function = self.register_function(self.to_function_name("copy", "Object")) + self.current_function.params.append(cil.ParamNode("self")) + local_copy = self.define_internal_local() + self.register_instruction(cil.CopyNode(local_copy, "self")) + self.register_instruction(cil.ReturnNode(local_copy)) + + def add_function_out_string(self): + self.current_function = self.register_function(self.to_function_name("out_string", "IO")) + self.current_function.params.append(cil.ParamNode("self")) + self.current_function.params.append(cil.ParamNode("x")) + self.register_instruction(cil.PrintStringNode("x")) + self.register_instruction(cil.ReturnNode("self")) + + def add_function_out_int(self): + self.current_function = self.register_function(self.to_function_name("out_int", "IO")) + self.current_function.params.append(cil.ParamNode("self")) + self.current_function.params.append(cil.ParamNode("x")) + self.register_instruction(cil.PrintIntNode("x")) + self.register_instruction(cil.ReturnNode("self")) + + def add_function_in_string(self): + self.current_function = self.register_function(self.to_function_name("in_string", "IO")) + self.current_function.params.append(cil.ParamNode("self")) + local_str = self.define_internal_local() + self.register_instruction(cil.ReadStringNode(local_str)) + self.register_instruction(cil.ReturnNode(local_str)) + + def add_function_in_int(self): + self.current_function = self.register_function(self.to_function_name("in_int", "IO")) + self.current_function.params.append(cil.ParamNode("self")) + local_str = self.define_internal_local() + self.register_instruction(cil.AllocateIntNode(local_str, "0")) + self.register_instruction(cil.ReadIntNode(local_str)) + self.register_instruction(cil.ReturnNode(local_str)) + + def add_function_length(self): + self.current_function = self.register_function(self.to_function_name("length", "String")) + self.current_function.params.append(cil.ParamNode("self")) + len_local = self.define_internal_local() + self.register_instruction(cil.AllocateIntNode(len_local, "0")) + self.register_instruction(cil.LengthNode(len_local, "self")) + self.register_instruction(cil.ReturnNode(len_local)) + + def add_function_concat(self): + self.current_function = self.register_function(self.to_function_name("concat", "String")) + self.current_function.params.append(cil.ParamNode("self")) + self.current_function.params.append(cil.ParamNode("s")) + new_str = self.define_internal_local() + self.register_instruction(cil.ConcatNode(new_str, "self", "s")) + self.register_instruction(cil.ReturnNode(new_str)) + + def add_function_substr(self): + self.current_function = self.register_function(self.to_function_name("substr", "String")) + self.current_function.params.append(cil.ParamNode("self")) + self.current_function.params.append(cil.ParamNode("i")) + self.current_function.params.append(cil.ParamNode("l")) + substr = self.define_internal_local() + self.register_instruction(cil.SubstringNode(substr, "self", "i", "l")) + self.register_instruction(cil.ReturnNode(substr)) + + def debug_print_type(self, source: str): + endl = self.define_internal_local() + dest = self.define_internal_local() + self.register_instruction(cil.AllocateStrNode(endl, '"\\n"')) + self.register_instruction(cil.ArgNode(source, 0, 1)) + self.register_instruction(cil.StaticCallNode("function_type_name_at_Object", dest, 1)) + self.register_instruction(cil.PrintStringNode(dest)) + self.register_instruction(cil.PrintStringNode(endl)) + + +def methods_declaration_order(t: Type) -> List[Tuple[Method, Type]]: + method_decl = [] + all_methods = t.all_methods() + visited = set() + for method, _ in all_methods: + if method.name in visited: + continue + + method_decl.append([(x, y) for x, y in all_methods[::-1] if x.name == method.name][0]) + visited.add(method.name) + return method_decl + +class CoolToCilTranslator(BaseCoolToCilVisitor): + # Notes: + # 1 - All the expression nodes are going to return a tuple [str, Type] + + @visitor.on("node") + def visit(self, node, scope): + pass + + @visitor.when(cool.ProgramNode) + def visit(self, node: cool.ProgramNode, scope: Scope): + scope = node.scope + default_class_names = ["Object", "IO", "String", "Int", "Bool"] + for name in default_class_names: + current_type = self.context.get_type(name) + self.current_type = current_type + cil_type_node = self.register_type(current_type.name, current_type.parent.name if current_type.parent is not None else None) + + for method, ancestor in methods_declaration_order(current_type): + cil_type_node.methods.append((method.name, self.to_function_name(method.name, ancestor.name))) + + self.add_function_add() + self.add_function_sub() + self.add_function_mul() + self.add_function_div() + self.add_function_xor() + self.add_function_less_than() + self.add_function_less_than_or_equal() + self.add_function_equal() + self.add_function_assign() + + self.add_function_init("Object") + self.add_function_abort() + self.add_function_type_name() + self.add_function_copy() + + self.add_function_init("IO") + self.add_function_out_string() + self.add_function_out_int() + self.add_function_in_string() + self.add_function_in_int() + + self.add_function_init("String") + self.add_function_length() + self.add_function_concat() + self.add_function_substr() + + self.add_function_init("Int") + self.add_function_init("Bool") + + for i, declaration in enumerate(node.declarations): + self.visit(declaration, scope.children[i]) + + self.add_function_main() + + return cil.ProgramNode(self.dottypes, self.dotdata, self.dotcode) + + @visitor.when(cool.ClassDeclarationNode) + def visit(self, node: cool.ClassDeclarationNode, scope: Scope): + scope = node.scope + self.current_type = self.context.get_type(node.id) + + type_node = self.register_type(self.current_type.name, self.current_type.parent.name) + + attrs = [ + feature + for feature in node.features + if isinstance(feature, cool.AttrDeclarationNode) + ] + + methods = [ + feature + for feature in node.features + if isinstance(feature, cool.MethodDeclarationNode) + ] + + for attr, _ in self.current_type.all_attributes(): + self.visit(attr, scope) + type_node.attributes.append(attr.name) + + for method, t in methods_declaration_order(self.current_type): + type_node.methods.append((method.name, self.to_function_name(method.name, t.name))) + + i = len([attr for attr in attrs if attr.expr is not None]) + for i, method in enumerate(methods, start=i): + self.visit(method, scope.children[i]) + + @visitor.when(cool.AttrDeclarationNode) + def visit(self, node: cool.AttrDeclarationNode, scope: Scope): + scope = node.scope + pass + + @visitor.when(cool.MethodDeclarationNode) + def visit(self, node: cool.MethodDeclarationNode, scope: Scope): + scope = node.scope + self.current_method, owner_type = self.current_type.get_method( + node.id, get_owner=True + ) + function_name = self.to_function_name(self.current_method.name, owner_type.name) + self.current_function = self.register_function(function_name) + + self.current_function.params = [cil.ParamNode("self")] + [ + cil.ParamNode(param_name) for param_name, _ in node.params + ] + + source, _ = self.visit(node.body, scope) + + self.register_instruction(cil.ReturnNode(source)) + + @visitor.when(cool.LetNode) + def visit(self, node: cool.LetNode, scope: Scope): + scope = node.scope + x = " ".join([f"{name}: {type_name}" for name, type_name, _ in node.declarations]) + self.register_comment(f"Let {x}") + + i = 0 + for name, type_name, expr in node.declarations: + self.register_local(name) + + if expr: + self.register_empty_instruction() + source, _ = self.visit(expr, scope.children[i]) + self.register_instruction(cil.ArgNode(name, 0, 2)) + self.register_instruction(cil.ArgNode(source, 1, 2)) + self.register_instruction(cil.StaticCallNode("function_assign", name, 2)) + i += 1 + else: + if type_name == "Int": + self.register_instruction(cil.AllocateIntNode(name, "0")) + elif type_name == "Bool": + self.register_instruction(cil.AllocateBoolNode(name, "0")) + elif type_name == "String": + self.register_instruction(cil.AllocateStrNode(name, "\"\"")) + else: + self.register_instruction(cil.AllocateNullPtrNode(name)) + source, t = self.visit(node.expr, scope.children[i]) + + return source, t + + @visitor.when(cool.AssignNode) + def visit(self, node: cool.AssignNode, scope: Scope): + scope = node.scope + variable = scope.find_variable(node.id) + variables = scope.find_all_variables_with_name(node.id) + source, _ = self.visit(node.expr, scope) + + self.register_empty_instruction() + is_attribute = ( + self.current_type.contains_attribute(node.id) and len(variables) == 1 + ) + + if is_attribute: + attr_names = [attr.name for attr, _ in self.current_type.all_attributes()] + self.register_instruction(cil.SetAttributeNode("self", variable.name, source, attr_names.index(variable.name))) + return source, variable.type + else: + self.register_instruction(cil.ArgNode(variable.name, 0, 2)) + self.register_instruction(cil.ArgNode(source, 1, 2)) + self.register_instruction(cil.StaticCallNode("function_assign", variable.name, 2)) + # self.register_instruction(cil.AssignNode(variable.name, source)) + return variable.name, variable.type + + @visitor.when(cool.BlockNode) + def visit(self, node: cool.BlockNode, scope: Scope): + scope = node.scope + source, inst_type = None, None + for expr in node.expressions: + source, inst_type = self.visit(expr, scope) + return source, inst_type + + @visitor.when(cool.ConditionalNode) + def visit(self, node: cool.ConditionalNode, scope: Scope): + scope = node.scope + self.register_instruction(cil.CommentNode("Conditional")) + + node_id = hash(node) + result_address = self.define_internal_local() + conditional_address = self.define_internal_local() + + self.register_instruction(cil.AllocateBoolNode(conditional_address, "0")) + + source, _ = self.visit(node.if_expr, scope) + + self.register_instruction(cil.AssignNode(conditional_address, source)) + self.register_instruction(cil.GotoIfNode(conditional_address, f"then_{node_id}")) + self.register_instruction(cil.GotoNode(f"else_{node_id}")) + + self.register_instruction(cil.EmptyInstruction()) + self.register_instruction(cil.LabelNode(f"then_{node_id}")) + then_source, then_type = self.visit(node.then_expr, scope) + self.register_instruction(cil.AssignNode(result_address, then_source)) + self.register_instruction(cil.GotoNode(f"endif_{node_id}")) + + self.register_instruction(cil.EmptyInstruction()) + self.register_instruction(cil.LabelNode(f"else_{node_id}")) + else_source, else_type = self.visit(node.else_expr, scope) + self.register_instruction(cil.AssignNode(result_address, else_source)) + self.register_instruction(cil.GotoNode(f"endif_{node_id}")) + + self.register_instruction(cil.EmptyInstruction()) + self.register_instruction(cil.LabelNode(f"endif_{node_id}")) + + return result_address, then_type.join(else_type) + + @visitor.when(cool.WhileNode) + def visit(self, node: cool.WhileNode, scope: Scope): + scope = node.scope + node_id = hash(node) + result_addres = self.define_internal_local() + self.register_empty_instruction() + self.register_comment(f"While loop") + + self.register_instruction(cil.AllocateNullPtrNode(result_addres)) + self.register_instruction(cil.LabelNode(f"while_start_{node_id}")) + + conditional_source, _ = self.visit(node.condition, scope) + self.register_instruction(cil.GotoIfNode(conditional_source, f"while_body_{node_id}")) + self.register_instruction(cil.GotoNode(f"while_end_{node_id}")) + + self.register_instruction(cil.EmptyInstruction()) + self.register_instruction(cil.LabelNode(f"while_body_{node_id}")) + self.visit(node.body, scope) + self.register_instruction(cil.GotoNode(f"while_start_{node_id}")) + + self.register_instruction(cil.EmptyInstruction()) + self.register_instruction(cil.LabelNode(f"while_end_{node_id}")) + + return result_addres, self.context.get_type("Object") + + @visitor.when(cool.SwitchCaseNode) + def visit(self, node: cool.SwitchCaseNode, scope: Scope): + scope = node.scope + node_id = hash(node) + swicth_expression, _ = self.visit(node.expr, scope) + + constant_zero_int = self.define_internal_local("Constant Integer 0 ") + constant_one_int = self.define_internal_local("Constant Integer 1") + constant_len_types_int = self.define_internal_local(f"Constant Integer {len(node.cases)}") + constant_null_ptr = self.define_internal_local("Null pointer") + count_of_ancestors_int = self.define_internal_local("Count of ancestors of the switch expression") + switch_expr_type_address = self.define_internal_local("Switch expression type") + ancestor_type_address = self.define_internal_local("Ancestor type") + step1_comparison_result_bool = self.define_internal_local("Step 1 comparison result") + ancestors_array = self.define_internal_local("Step 1 Array of ancestors") + + self.register_instruction(cil.AllocateIntNode(constant_zero_int, "0")) + self.register_instruction(cil.AllocateIntNode(constant_one_int, "1")) + self.register_instruction(cil.AllocateIntNode(constant_len_types_int, str(len(node.cases)))) + self.register_instruction(cil.AllocateNullPtrNode(constant_null_ptr)) + self.register_instruction(cil.AllocateIntNode(count_of_ancestors_int, "0")) + self.register_instruction(cil.AllocateBoolNode(step1_comparison_result_bool, "0")) + self.register_empty_instruction() + + self.register_comment("Switch Case Algorithm Steps:") + self.register_comment(" 1 - Count how many ancestors has the dynamic type of the expression") + self.register_comment(" 2 - Create an array of the same size where to store the ancestors") + self.register_comment(" 3 - For each branch type, store the ancestor index that match with it, if no one match, store `count of ancestors`") + self.register_comment(" 4 - Find the minimum of the ancestors indexes") + self.register_comment(" 5 - With the minimum index, get the correct branch type") + + ############################################ + # While loop to get the count of ancestors # + ############################################ + + self.register_empty_instruction() + self.register_comment("######################################################################## #") + self.register_comment("Step 1 - Count how many ancestors has the dynamic type of the expression #") + self.register_comment("######################################################################## #") + self.register_instruction(cil.TypeOfNode(switch_expr_type_address, swicth_expression).set_comment("Get the switch expression type")) + self.register_instruction(cil.AssignNode(ancestor_type_address, switch_expr_type_address).set_comment("The first ancestor will be the type itself")) + + self.register_instruction(cil.LabelNode(f"while_start_{node_id}")) + self.register_instruction(cil.EqualAddressNode(step1_comparison_result_bool, ancestor_type_address, constant_null_ptr)) + self.register_instruction(cil.GotoIfNode(step1_comparison_result_bool, f"while_end_{node_id}")) + + self.register_comment("Increment the count of ancestors") + self.register_instruction(cil.ArgNode(count_of_ancestors_int, 0, 2)) + self.register_instruction(cil.ArgNode(constant_one_int, 1, 2)) + self.register_instruction(cil.StaticCallNode("function_add", count_of_ancestors_int, 2)) + + self.register_instruction(cil.AncestorNode(ancestor_type_address, ancestor_type_address)) + self.register_instruction(cil.GotoNode(f"while_start_{node_id}")) + self.register_instruction(cil.LabelNode(f"while_end_{node_id}")) + # ################################################# + # # End While loop to get the count of ancestors # + # ################################################# + + + # ####################################################################### + # # Foreach to create the array of ancestors and fill it with the types # + # ####################################################################### + self.register_empty_instruction() + self.register_comment("###################################################################### #") + self.register_comment("Step 2 - Create an array of the same size where to store the ancestors #") + self.register_comment("###################################################################### #") + self.register_instruction(cil.AssignNode(ancestor_type_address, switch_expr_type_address).set_comment("The first ancestor will be the type itself")) + self.register_instruction(cil.ArrayNode(ancestors_array, count_of_ancestors_int).set_comment("Create an array of ancestors")) + + step2_iter_index_int = self.define_internal_local("Step 2 iteration index") + step2_comparison_result_bool = self.define_internal_local("Step 2 comparison result") + + self.register_instruction(cil.AllocateIntNode(step2_iter_index_int, "0")) + self.register_instruction(cil.AllocateBoolNode(step2_comparison_result_bool, "0")) + self.register_instruction(cil.LabelNode(f"foreach_start_{node_id}")) + + self.register_instruction(cil.ArgNode(step2_iter_index_int, 0, 2)) + self.register_instruction(cil.ArgNode(count_of_ancestors_int, 1, 2)) + self.register_instruction(cil.StaticCallNode("function_less_than", step2_comparison_result_bool, 2)) + + self.register_instruction(cil.GotoIfNode(step2_comparison_result_bool, f"foreach_body_{node_id}")) + self.register_instruction(cil.GotoNode(f"foreach_end_{node_id}")) + self.register_instruction(cil.LabelNode(f"foreach_body_{node_id}")) + self.register_instruction(cil.SetIndexNode(ancestors_array, step2_iter_index_int, ancestor_type_address).set_comment("Set the index of the array with the ancestor type")) + self.register_instruction(cil.AncestorNode(ancestor_type_address, ancestor_type_address).set_comment("Get the next ancestor")) + + + self.register_instruction(cil.ArgNode(step2_iter_index_int, 0, 2)) + self.register_instruction(cil.ArgNode(constant_one_int, 1, 2)) + self.register_instruction(cil.StaticCallNode("function_add", step2_iter_index_int, 2)) + + self.register_instruction(cil.GotoNode(f"foreach_start_{node_id}")) + self.register_instruction(cil.LabelNode(f"foreach_end_{node_id}")) + self.register_empty_instruction() + # ########################################################################### + # # End Foreach to create the array of ancestors and fill it with the types # + # ########################################################################### + + + self.register_comment("#################################################################################################### #") + self.register_comment("Step 3 - For each branch type, store the ancestor index that match with it (Simulating a double for) #") + self.register_comment("#################################################################################################### #") + + types = [self.context.get_type(type_name) for _, type_name, _ in node.cases] + type_branch_array = self.define_internal_local("Array to store the branch types") + nearest_ancestor_array = self.define_internal_local("Array to store the nearest ancestor index of the expression type of the i-th branch type ") + self.register_instruction(cil.ArrayNode(type_branch_array, constant_len_types_int)) + self.register_instruction(cil.ArrayNode(nearest_ancestor_array, constant_len_types_int)) + for i_int, t in enumerate(types): + x = self.define_internal_local(f"Address of the type {t.name}") + i = self.define_internal_local(f"Index of the type {t.name}") + self.register_instruction(cil.AllocateIntNode(i, i_int)) + self.register_instruction(cil.TypeAddressNode(x, t.name)) + self.register_instruction(cil.SetIndexNode(type_branch_array, i, x)) + self.register_instruction(cil.SetValueInIndexNode(nearest_ancestor_array, i, count_of_ancestors_int)) + + self.register_empty_instruction() + + i_int = self.define_internal_local("Step 3 - Iteration index of the branch types array") + comp_i_bool = self.define_internal_local("Step 3 - Comparison for the index of the branch types array") + type_i = self.define_internal_local("Step 3 - Type of the i-th branch") + j_int = self.define_internal_local("Step 3 - Index of the ancestor") + comp_j_bool = self.define_internal_local("Step 3 - Comparison for the index of the ancestor") + type_j = self.define_internal_local("Step 3 - Type of the j-th ancestor") + types_comparison_bool = self.define_internal_local("Step 3 - Comparison for the branch type nad the ancestor type") + + self.register_instruction(cil.AllocateIntNode(i_int, "0")) + self.register_instruction(cil.AllocateBoolNode(comp_i_bool, "0")) + self.register_instruction(cil.AllocateIntNode(j_int, "0")) + self.register_instruction(cil.AllocateBoolNode(comp_j_bool, "0")) + self.register_instruction(cil.AllocateBoolNode(types_comparison_bool, "0")) + + self.register_comment("############# #") + self.register_comment("Outer Foreach #") + self.register_comment("############# #") + self.register_instruction(cil.LabelNode(f"foreach_type_start_{node_id}")) + + self.register_instruction(cil.ArgNode(i_int, 0, 2)) + self.register_instruction(cil.ArgNode(constant_len_types_int, 1, 2)) + self.register_instruction(cil.StaticCallNode("function_less_than", comp_i_bool, 2)) + + self.register_instruction(cil.GotoIfNode(comp_i_bool, f"foreach_type_body_{node_id}")) + self.register_instruction(cil.GotoNode(f"foreach_type_end_{node_id}")) + self.register_instruction(cil.LabelNode(f"foreach_type_body_{node_id}")) + self.register_instruction(cil.GetIndexNode(type_i, type_branch_array, i_int).set_comment("Get the type of the i-th branch")) + + ################# + # Inner Foreach # + ################# + self.register_empty_instruction() + self.register_comment("############# #") + self.register_comment("Inner Foreach #") + self.register_comment("############# #") + + self.register_instruction(cil.ArgNode(j_int, 0, 2)) + self.register_instruction(cil.ArgNode(constant_zero_int, 1, 2)) + self.register_instruction(cil.StaticCallNode("function_assign", j_int, 2)) + + self.register_instruction(cil.LabelNode(f"foreach_ancestor_start_{node_id}")) + + self.register_instruction(cil.ArgNode(j_int, 0, 2)) + self.register_instruction(cil.ArgNode(count_of_ancestors_int, 1, 2)) + self.register_instruction(cil.StaticCallNode("function_less_than", comp_j_bool, 2)) + + self.register_instruction(cil.GotoIfNode(comp_j_bool, f"foreach_ancestor_body_{node_id}")) + self.register_instruction(cil.GotoNode(f"foreach_ancestor_end_{node_id}")) + self.register_instruction(cil.LabelNode(f"foreach_ancestor_body_{node_id}")) + self.register_instruction(cil.GetIndexNode(type_j, ancestors_array, j_int).set_comment("Get the j-th ancestor type")) + + self.register_instruction(cil.EqualAddressNode(types_comparison_bool, type_i, type_j).set_comment("Compare if the type of the i-th branch is equal to the j-th ancestor")) + self.register_instruction(cil.GotoIfNode(types_comparison_bool, f"foreach_ancestor_end_{node_id}").set_comment("If the types are equal, we have a match, then we can exit")) + + self.register_instruction(cil.ArgNode(j_int, 0, 2)) + self.register_instruction(cil.ArgNode(constant_one_int, 1, 2)) + self.register_instruction(cil.StaticCallNode("function_add", j_int, 2)) + self.register_instruction(cil.GotoNode(f"foreach_ancestor_start_{node_id}")) + self.register_instruction(cil.LabelNode(f"foreach_ancestor_end_{node_id}")) + self.register_instruction(cil.SetValueInIndexNode(nearest_ancestor_array, i_int, j_int).set_comment("Set the counter of the i-th branch equals to j")) + self.register_comment("#################### #") + self.register_comment("End of Inner Foreach #") + self.register_comment("#################### #") + self.register_empty_instruction() + # ####################### + # # End Inner Foreach 1 # + # ####################### + + self.register_instruction(cil.ArgNode(i_int, 0, 2)) + self.register_instruction(cil.ArgNode(constant_one_int, 1, 2)) + self.register_instruction(cil.StaticCallNode("function_add", i_int, 2)) + self.register_instruction(cil.GotoNode(f"foreach_type_start_{node_id}")) + self.register_instruction(cil.LabelNode(f"foreach_type_end_{node_id}")) + self.register_comment("################# #") + self.register_comment("End Outer Foreach #") + self.register_comment("################# #") + + self.register_empty_instruction() + self.register_comment("######################################## #") + self.register_comment("Step 4 - Find the minimum ancestor index #") + self.register_comment("######################################## #") + step4_index_int = self.define_internal_local("Step 4 - Iteration index") + step4_current_min_index_int = self.define_internal_local("Step 4 - Index of the minimum counter in the counter array") + step4_temp_int = self.define_internal_local("Step 4 - Temporary variable") + step4_current_min_int = self.define_internal_local("Step 4 - Current minimum of the counter array") + step4_comparison_bool = self.define_internal_local("Step 4 - Comparison for the minimum of the counter array") + + self.register_instruction(cil.AllocateIntNode(step4_index_int, "0")) + self.register_instruction(cil.AllocateIntNode(step4_current_min_index_int, "0")) + self.register_instruction(cil.AllocateIntNode(step4_temp_int, "0")) + self.register_instruction(cil.AllocateIntNode(step4_current_min_int, "0")) + self.register_instruction(cil.AllocateBoolNode(step4_comparison_bool, "0")) + + self.register_instruction(cil.ArgNode(step4_current_min_int, 0, 2)) + self.register_instruction(cil.ArgNode(count_of_ancestors_int, 1, 2)) + self.register_instruction(cil.StaticCallNode("function_assign", step4_current_min_int, 2)) + + self.register_instruction(cil.LabelNode(f"foreach_min_start_{node_id}")) + + self.register_instruction(cil.ArgNode(step4_index_int, 0, 2)) + self.register_instruction(cil.ArgNode(constant_len_types_int, 1, 2)) + self.register_instruction(cil.StaticCallNode("function_less_than", step4_comparison_bool, 2)) + + self.register_instruction(cil.GotoIfNode(step4_comparison_bool, f"foreach_min_body_{node_id}")) + self.register_instruction(cil.GotoNode(f"foreach_min_end_{node_id}")) + self.register_instruction(cil.LabelNode(f"foreach_min_body_{node_id}")) + self.register_instruction(cil.GetValueInIndexNode(step4_temp_int, nearest_ancestor_array, step4_index_int).set_comment("Get the nearest ancestor index of the i-th branch type")) + + self.register_instruction(cil.ArgNode(step4_temp_int, 0, 2)) + self.register_instruction(cil.ArgNode(step4_current_min_int, 1, 2)) + self.register_instruction(cil.StaticCallNode("function_less_than", step4_comparison_bool, 2)) + + self.register_instruction(cil.GotoIfNode(step4_comparison_bool, f"update_min_{node_id}")) + self.register_instruction(cil.GotoNode(f"update_min_end_{node_id}")) + self.register_instruction(cil.LabelNode(f"update_min_{node_id}")) + + self.register_instruction(cil.ArgNode(step4_current_min_int, 0, 2)) + self.register_instruction(cil.ArgNode(step4_temp_int, 1, 2)) + self.register_instruction(cil.StaticCallNode("function_assign", step4_current_min_int, 2)) + + self.register_instruction(cil.ArgNode(step4_current_min_index_int, 0, 2)) + self.register_instruction(cil.ArgNode(step4_index_int, 1, 2)) + self.register_instruction(cil.StaticCallNode("function_assign", step4_current_min_index_int, 2)) + + self.register_instruction(cil.LabelNode(f"update_min_end_{node_id}")) + self.register_instruction(cil.ArgNode(step4_index_int, 0, 2)) + self.register_instruction(cil.ArgNode(constant_one_int, 1, 2)) + self.register_instruction(cil.StaticCallNode("function_add", step4_index_int, 2)) + self.register_instruction(cil.GotoNode(f"foreach_min_start_{node_id}")) + self.register_instruction(cil.LabelNode(f"foreach_min_end_{node_id}")) + + self.register_empty_instruction() + self.register_comment("################################################################# #") + self.register_comment("Step 5 - Using the minimun ancestor index find the correct branch #") + self.register_comment("################################################################# #") + bool_array = self.define_internal_local("Step 5 - Bool array") + self.register_instruction(cil.ArrayNode(bool_array, constant_len_types_int).set_comment("Create the bool array")) + for i, _ in enumerate(types): + x = self.define_internal_local(f"Step 5 - Branch {i}") + self.register_instruction(cil.AllocateIntNode(x, f"{i}")) + self.register_instruction(cil.SetValueInIndexNode(bool_array, x, constant_zero_int).set_comment("Initialize the bool array")) + + self.register_empty_instruction() + exists_error_bool = self.define_internal_local("Step 5 - Exists an error") + self.register_instruction(cil.AllocateBoolNode(exists_error_bool, "0")) + + self.register_instruction(cil.ArgNode(step4_current_min_int, 0, 2)) + self.register_instruction(cil.ArgNode(count_of_ancestors_int, 1, 2)) + self.register_instruction(cil.StaticCallNode("function_equal", exists_error_bool, 2)) + + self.register_instruction(cil.GotoIfNode(exists_error_bool, f"error_branch_{node_id}")) + self.register_instruction(cil.SetValueInIndexNode(bool_array, step4_current_min_index_int, constant_one_int).set_comment("Set the bool array in the correct index to 1")) + + + step5_comparison = self.define_internal_local("Step 5 - Comparison for the correct branch result") + self.register_instruction(cil.AllocateBoolNode(step5_comparison, "0")) + self.register_empty_instruction() + for i_int, t in enumerate(types): + x = self.define_internal_local(f"Index {i_int}") + self.register_instruction(cil.AllocateIntNode(x, f"{i_int}")) + self.register_instruction(cil.GetValueInIndexNode(step5_comparison, bool_array, x).set_comment(f"Get the bool value of the branch {t.name}")) + self.register_instruction(cil.GotoIfNode(step5_comparison, f"branch_{t.name}_{node_id}").set_comment("If the bool value is 1, then we have a match")) + self.register_empty_instruction() + + resutl_address = self.define_internal_local("Result of the switch expression address") + for i_int, (var_name, type_name, expr) in enumerate(node.cases): + self.register_instruction(cil.LabelNode(f"branch_{type_name}_{node_id}")) + var = self.register_local(var_name, f"Specialiced variable for the branch {type_name}") + self.register_instruction(cil.ArgNode(var, 0, 2)) + self.register_instruction(cil.ArgNode(swicth_expression, 1, 2)) + self.register_instruction(cil.StaticCallNode("function_assign", var, 2)) + + expr_source, _ = self.visit(expr, scope.children[i_int]) + self.register_instruction(cil.ArgNode(resutl_address, 0, 2)) + self.register_instruction(cil.ArgNode(expr_source, 1, 2)) + self.register_instruction(cil.StaticCallNode("function_assign", resutl_address, 2)) + self.register_instruction(cil.AssignNode(resutl_address, expr_source).set_comment("Assign the result")) + self.register_instruction(cil.GotoNode(f"branch_end_{node_id}")) + self.register_empty_instruction() + self.register_instruction(cil.LabelNode(f"error_branch_{node_id}")) + self.register_comment("Insert an error call") + self.register_instruction(cil.LabelNode(f"branch_end_{node_id}")) + + return resutl_address, Type.multi_join(types) + + @visitor.when(cool.MethodCallNode) + def visit(self, node: cool.MethodCallNode, scope: Scope): + scope = node.scope + obj_source, obj_type = self.visit(node.obj, scope) + if obj_type.name == "SELF_TYPE": + obj_type = self.current_type + + ancestor_call = False + if node.type is not None: + ancestor_call = True + obj_type = self.context.get_type(node.type) + + args_sources = [] + for arg in node.args: + arg_source, _ = self.visit(arg, scope) + args_sources.append(arg_source) + + all_methods = methods_declaration_order(obj_type) + i = [m.name for m, _ in all_methods].index(node.id) + method = obj_type.get_method(node.id) + + call_dest = self.define_internal_local("Function call destination") + method_index = self.define_internal_local(f"Index of {method.name}") + method_address = self.define_internal_local(f"Address of {method.name}") + self.register_instruction(cil.AllocateIntNode(method_index, f"{i}")) + self.register_instruction(cil.GetMethodNode(method_address, obj_source, method_index, method.name, obj_type.name)) + + self.register_instruction(cil.ArgNode(obj_source, 0, len(args_sources) + 1)) + for index, arg_source in enumerate(args_sources, start=1): + self.register_instruction(cil.ArgNode(arg_source, index, len(args_sources) + 1)) + + if ancestor_call: + self.register_instruction(cil.StaticCallNode(self.to_function_name(method.name, obj_type.name), call_dest, len(args_sources) + 1)) + else: + self.register_instruction(cil.DynamicCallNode(obj_type.name, method_address, call_dest, len(args_sources) + 1)) + return call_dest, method.return_type + + @visitor.when(cool.IntegerNode) + def visit(self, node: cool.IntegerNode, scope: Scope): + scope = node.scope + local_int = self.define_internal_local(f"Integer {node.lex}") + self.register_instruction(cil.AllocateIntNode(local_int, node.lex)) + return local_int, self.context.get_type("Int") + + @visitor.when(cool.StringNode) + def visit(self, node: cool.StringNode, scope: Scope): + scope = node.scope + local_str_var = self.define_internal_local(f"String {node.lex}") + self.register_instruction(cil.AllocateStrNode(local_str_var, node.lex)) + return local_str_var, self.context.get_type("String") + + @visitor.when(cool.BooleanNode) + def visit(self, node: cool.BooleanNode, scope: Scope): + scope = node.scope + local_bool_var = self.define_internal_local(f"Boolean {node.lex}") + self.register_instruction(cil.AllocateBoolNode(local_bool_var, ("1" if node.lex == "true" else "0"))) + return local_bool_var, self.context.get_type("Bool") + + @visitor.when(ecool.NullNode) + def visit(self, node: ecool.NullNode, scope: Scope): + scope = node.scope + local_null_var = self.define_internal_local(f"Null") + self.register_instruction(cil.AllocateNullPtrNode(local_null_var)) + return local_null_var, ecool.NullType + + @visitor.when(cool.VariableNode) + def visit(self, node: cool.VariableNode, scope: Scope): + scope = node.scope + variable = scope.find_variable(node.lex) + variables = scope.find_all_variables_with_name(node.lex) + + is_attribute = (self.current_type.contains_attribute(node.lex) and len(variables) == 1) + + if is_attribute: + dest = self.define_internal_local() + attr_names = [a.name for a, _ in self.current_type.all_attributes()] + self.register_instruction(cil.GetAttributeNode(dest, "self", variable.name, attr_names.index(variable.name))) + return dest, variable.type + return variable.name, variable.type + + @visitor.when(cool.InstantiateNode) + def visit(self, node: cool.InstantiateNode, scope: Scope): + scope = node.scope + local = self.define_internal_local(f"Store an instance of the class {node.lex}") + self.register_instruction(cil.AllocateNode(node.lex, local).set_comment(f"Allocate the object {node.lex}")) + self.register_instruction(cil.ArgNode(local, 0, 1).set_comment("Pass the instance to the constructor")) + self.register_instruction(cil.StaticCallNode(self.to_function_name("__init__", node.lex), local, 1).set_comment("Call the constructor")) + return local, self.context.get_type(node.lex) + + @visitor.when(cool.NegationNode) + def visit(self, node: cool.NegationNode, scope: Scope): + scope = node.scope + source, _ = self.visit(node.expr, scope) + local_int = self.define_internal_local("Integer 1") + result = self.define_internal_local(f"Store the negation of {source}") + self.register_instruction(cil.AllocateIntNode(local_int, "1")) + self.register_instruction(cil.AllocateBoolNode(result, "0")) + + self.register_instruction(cil.ArgNode(source, 0, 2)) + self.register_instruction(cil.ArgNode(local_int, 1, 2)) + self.register_instruction(cil.StaticCallNode("function_xor", result, 2)) + + return result, self.context.get_type("Bool") + + @visitor.when(cool.ComplementNode) + def visit(self, node: cool.ComplementNode, scope: Scope): + scope = node.scope + source, _ = self.visit(node.expr, scope) + local_int_0 = self.define_internal_local("Integer 1") + local_int_1 = self.define_internal_local(f"Integer {2**32 - 1}") + result = self.define_internal_local(f"Store the complement a2 of {source}") + self.register_instruction(cil.AllocateIntNode(local_int_0, "1")) + self.register_instruction(cil.AllocateIntNode(local_int_1, str(2**32 - 1))) + self.register_instruction(cil.AllocateIntNode(result, "0")) + + self.register_instruction(cil.ArgNode(source, 0, 2)) + self.register_instruction(cil.ArgNode(local_int_1, 1, 2)) + self.register_instruction(cil.StaticCallNode("function_xor", result, 2)) + + self.register_instruction(cil.ArgNode(result, 0, 2)) + self.register_instruction(cil.ArgNode(local_int_0, 1, 2)) + self.register_instruction(cil.StaticCallNode("function_add", result, 2)) + return result, self.context.get_type("Int") + + @visitor.when(cool.IsVoidNode) + def visit(self, node: cool.IsVoidNode, scope: Scope): + scope = node.scope + source, _ = self.visit(node.expr, scope) + null_ptr = self.define_internal_local("Null pointer") + result = self.define_internal_local(f"Store if {source} is NULL") + self.register_instruction(cil.AllocateBoolNode(result, "0")) + self.register_instruction(cil.AllocateNullPtrNode(null_ptr)) + + self.register_instruction(cil.ArgNode(source, 0, 2)) + self.register_instruction(cil.ArgNode(null_ptr, 1, 2)) + self.register_instruction(cil.StaticCallNode("function_equal", result, 2)) + return result, self.context.get_type("Bool") + + @visitor.when(cool.PlusNode) + def visit(self, node: cool.PlusNode, scope: Scope): + scope = node.scope + return self.visit_arith_node(node, scope, "function_add", "Int") + + @visitor.when(cool.MinusNode) + def visit(self, node: cool.MinusNode, scope: Scope): + scope = node.scope + return self.visit_arith_node(node, scope, "function_sub", "Int") + + @visitor.when(cool.StarNode) + def visit(self, node: cool.StarNode, scope: Scope): + scope = node.scope + return self.visit_arith_node(node, scope, "function_mult", "Int") + + @visitor.when(cool.DivNode) + def visit(self, node: cool.DivNode, scope: Scope): + scope = node.scope + return self.visit_arith_node(node, scope, "function_div", "Int") + + @visitor.when(cool.LessEqualNode) + def visit(self, node: cool.LessEqualNode, scope: Scope): + scope = node.scope + return self.visit_arith_node(node, scope, "function_less_than_or_equal", "Bool") + + @visitor.when(cool.LessThanNode) + def visit(self, node: cool.LessThanNode, scope: Scope): + scope = node.scope + return self.visit_arith_node(node, scope, "function_less_than", "Bool") + + @visitor.when(cool.EqualNode) + def visit(self, node: cool.EqualNode, scope: Scope): + scope = node.scope + return self.visit_arith_node(node, scope, "function_equal", "Bool") + + def visit_arith_node(self, node: cool.BinaryNode, scope: Scope, operation_function: str, return_type_name: str = "Int") -> Tuple[str, Type]: + left, _ = self.visit(node.left, scope) + right, _ = self.visit(node.right, scope) + dest = self.define_internal_local(f"Store the result of the operation {operation_function}") + self.register_empty_instruction() + self.register_instruction(cil.ArgNode(left, 0, 2)) + self.register_instruction(cil.ArgNode(right, 1, 2)) + self.register_instruction(cil.StaticCallNode(operation_function, dest, 2)) + return dest, self.context.get_type(return_type_name) diff --git a/src/cool/grammar.py b/src/cool/grammar.py new file mode 100644 index 000000000..a42d0ec6d --- /dev/null +++ b/src/cool/grammar.py @@ -0,0 +1,435 @@ +import inspect +import time + +from pyjapt import Grammar, Lexer, ShiftReduceParser, Token + +import cool.semantics.utils.astnodes as cool + +G = Grammar() + +################# +# Non-Terminals # +################# +program = G.add_non_terminal("program", start_symbol=True) +class_list = G.add_non_terminal("class-list") +class_def = G.add_non_terminal("class-def") +feature_list = G.add_non_terminal("feature-list") +attribute = G.add_non_terminal("attribute") +method = G.add_non_terminal("method") +param_list = G.add_non_terminal("param-list") +block = G.add_non_terminal("block") +declaration_list = G.add_non_terminal("declaration-list") +case_list = G.add_non_terminal("case-list") +function_call = G.add_non_terminal("function-call") +expr_list = G.add_non_terminal("expr-list") +not_empty_expr_list = G.add_non_terminal("not-empty-expr-list") +expr = G.add_non_terminal("expr") +negable_comp = G.add_non_terminal("negable-comp") +comp = G.add_non_terminal("comp") +negable_arith = G.add_non_terminal("negable-arith") +arith = G.add_non_terminal("arith") +term = G.add_non_terminal("term") +factor = G.add_non_terminal("factor") +atom = G.add_non_terminal("atom") + +########### +# Symbols # +########### +G.add_terminals("{ } ( ) . , : ; @ <- =>") + +############ +# Keywords # +############ +keywords = G.add_terminals( + "class inherits if then else fi while loop pool let in case of esac new isvoid true false not" +) +keywords_names = {x.name for x in keywords} + +############# +# Symbols # +############# +G.add_terminals("+ - * / < <= = ~") + + +############### +# Identifiers # +############### +@G.terminal("id", r"[a-z][a-zA-Z0-9_]*") +def id_terminal(lexer: Lexer): + lex = lexer.token.lex + lexer.column += len(lex) + lexer.position += len(lex) + lexer.token.token_type = ( + lex.lower() if lex.lower() in keywords_names else lexer.token.token_type + ) + return lexer.token + + +@G.terminal("type", regex=r"[A-Z][a-zA-Z0-9_]*") +def type_terminal(lexer: Lexer): + lex = lexer.token.lex + lexer.column += len(lex) + lexer.position += len(lex) + lexer.token.token_type = ( + lex.lower() + if lex.lower() in keywords_names - {"true", "false"} + else lexer.token.token_type + ) + return lexer.token + + +############### +# Basic Types # +############### +G.add_terminal("int", regex=r"\d+") + + +@G.terminal("string", regex=r"\"") +def string(lexer: Lexer): + text = lexer.text + pos = lexer.position + 1 + lexer.column += 1 + lex = '"' + + contains_null_character = False + while True: + if pos >= len(text): + lexer.contain_errors = True + lexer.position = pos + lexer.add_error( + lexer.lineno, + lexer.column, + f"({lexer.lineno}, {lexer.column}) - LexicographicError: EOF in string constant", + ) + return + + s = text[pos] + + if s == "\\": + if text[pos + 1] == "\n": + lex += "\n" + pos += 2 + lexer.lineno += 1 + lexer.column = 1 + elif text[pos + 1] in ("b", "f", "t", "n"): + if text[pos + 1] == "b": + lex += "\\b" + elif text[pos + 1] == "f": + lex += "\\f" + elif text[pos + 1] == "t": + lex += "\\t" + else: + lex += "\\n" + + pos += 2 + lexer.column += 2 + else: + lex += text[pos + 1] + pos += 2 + lexer.column += 2 + elif s == "\n": + # Unterminated String + lexer.contain_errors = True + lexer.position = pos + lexer.add_error( + lexer.lineno, + lexer.column, + f"({lexer.lineno}, {lexer.column}) - LexicographicError: Unterminated string constant", + ) + return + elif s == "\0": + contains_null_character = True + lexer.contain_errors = True + lexer.add_error( + lexer.lineno, + lexer.column, + f"({lexer.lineno}, {lexer.column}) - LexicographicError: String contains null character", + ) + pos += 1 + lexer.column += 1 + else: + lex += s + pos += 1 + lexer.column += 1 + + if s == '"': + break + + lexer.position = pos + lexer.token.lex = lex + if not contains_null_character: + return lexer.token + + +############ +# Comments # +############ +@G.terminal("single_line_comment", r"--.*") +def single_line_comment(lexer): + lex = lexer.token.lex + for s in lex: + if s == "\n": + lexer.lineno += 1 + lexer.column = 0 + lexer.column += 1 + lexer.position += len(lex) + + +@G.terminal("multi_line_comment", r"\(\*") +def multi_line_comment(lexer: Lexer): + counter = 1 + text = lexer.text + pos = lexer.position + 2 + lexer.column += 2 + lex = "(*" + + while counter > 0: + if pos >= len(text): + lexer.contain_errors = True + lexer.position = pos + lexer.add_error( + lexer.lineno, + lexer.column, + f"({lexer.lineno}, {lexer.column}) - LexicographicError: EOF in comment", + ) + return None + + if text.startswith("(*", pos): + counter += 1 + pos += 2 + lex += "(*" + lexer.column += 2 + elif text.startswith("*)", pos): + counter -= 1 + pos += 2 + lex += "*)" + lexer.column += 2 + else: + if text[pos] == "\n": + lexer.lineno += 1 + lexer.column = 0 + elif text[pos] == "\t": + lexer.column += 3 + lex += text[pos] + pos += 1 + lexer.column += 1 + lexer.position = pos + lexer.token.lex = lex + + +################## +# Ignored Tokens # +################## +@G.terminal("newline", r"\n+") +def newline(lexer: Lexer): + lexer.lineno += len(lexer.token.lex) + lexer.position += len(lexer.token.lex) + lexer.column = 1 + + +@G.terminal("whitespace", r" +") +def whitespace(lexer): + lexer.column += len(lexer.token.lex) + lexer.position += len(lexer.token.lex) + + +@G.terminal("tabulation", r"\t+") +def tab(lexer): + lexer.column += 4 * len(lexer.token.lex) + lexer.position += len(lexer.token.lex) + + +@G.lexical_error +def lexical_error(lexer): + lexer.add_error( + lexer.lineno, + lexer.column, + f'({lexer.lineno}, {lexer.column}) - LexicographicError: ERROR "{lexer.token.lex}"', + ) + lexer.column += len(lexer.token.lex) + lexer.position += len(lexer.token.lex) + + +############### +# Productions # +############### +program %= "class-list", lambda s: cool.ProgramNode(s[1]) + +class_list %= "class-def ;", lambda s: [s[1]] +class_list %= "class-def ; class-list", lambda s: [s[1]] + s[3] + +class_def %= "class type { feature-list }", lambda s: cool.ClassDeclarationNode( + s[2], s[4] +) +class_def %= ( + "class type inherits type { feature-list }", + lambda s: cool.ClassDeclarationNode(s[2], s[6], s[4]), +) + +feature_list %= "", lambda s: [] +feature_list %= "attribute ; feature-list", lambda s: [s[1]] + s[3] +feature_list %= "method ; feature-list", lambda s: [s[1]] + s[3] + +attribute %= "id : type", lambda s: cool.AttrDeclarationNode(s[1], s[3]) +attribute %= "id : type <- expr", lambda s: cool.AttrDeclarationNode(s[1], s[3], s[5]) + +method %= "id ( ) : type { expr }", lambda s: cool.MethodDeclarationNode( + s[1], [], s[5], s[7] +) +method %= "id ( param-list ) : type { expr }", lambda s: cool.MethodDeclarationNode( + s[1], s[3], s[6], s[8] +) + +param_list %= "id : type", lambda s: [(s[1], s[3])] +param_list %= "id : type , param-list", lambda s: [(s[1], s[3])] + s[5] + +expr %= "id <- expr", lambda s: cool.AssignNode(s[1], s[3]) +expr %= "{ block }", lambda s: cool.BlockNode(s[2]) +expr %= "while expr loop expr pool", lambda s: cool.WhileNode(s[2], s[4]) +expr %= "let declaration-list in expr", lambda s: cool.LetNode(s[2], s[4]) +expr %= "case expr of case-list esac", lambda s: cool.SwitchCaseNode(s[2], s[4]) +expr %= "negable-comp", lambda s: s[1] + +negable_comp %= "not comp", lambda s: cool.NegationNode(s[2]) +negable_comp %= "comp", lambda s: s[1] + +comp %= "comp < negable-arith", lambda s: cool.LessThanNode(s[1], s[2], s[3]) +comp %= "comp <= negable-arith", lambda s: cool.LessEqualNode(s[1], s[2], s[3]) +comp %= "comp = negable-arith", lambda s: cool.EqualNode(s[1], s[2], s[3]) +comp %= "arith", lambda s: s[1] + +negable_arith %= "not arith", lambda s: cool.NegationNode(s[2]) +negable_arith %= "arith", lambda s: s[1] + +arith %= "arith + term", lambda s: cool.PlusNode(s[1], s[2], s[3]) +arith %= "arith - term", lambda s: cool.MinusNode(s[1], s[2], s[3]) +arith %= "term", lambda s: s[1] + +term %= "term * factor", lambda s: cool.StarNode(s[1], s[2], s[3]) +term %= "term / factor", lambda s: cool.DivNode(s[1], s[2], s[3]) +term %= "factor", lambda s: s[1] + +factor %= "isvoid factor", lambda s: cool.IsVoidNode(s[2]) +factor %= "~ factor", lambda s: cool.ComplementNode(s[2]) +factor %= "atom", lambda s: s[1] + +atom %= "id", lambda s: cool.VariableNode(s[1]) +atom %= "true", lambda s: cool.BooleanNode(s[1]) +atom %= "false", lambda s: cool.BooleanNode(s[1]) +atom %= "int", lambda s: cool.IntegerNode(s[1]) +atom %= "string", lambda s: cool.StringNode(s[1]) +atom %= "if expr then expr else expr fi", lambda s: cool.ConditionalNode(s[2], s[4], s[6]) +atom %= "function-call", lambda s: s[1] +atom %= "new type", lambda s: cool.InstantiateNode(s[2]) +atom %= "( expr )", lambda s: s[2] + +block %= "expr ;", lambda s: [s[1]] +block %= "expr ; block", lambda s: [s[1]] + s[3] + +declaration_list %= "id : type", lambda s: [(s[1], s[3], None)] +declaration_list %= "id : type <- expr", lambda s: [(s[1], s[3], s[5])] +declaration_list %= "id : type , declaration-list",lambda s: [(s[1], s[3], None)] + s[5] +declaration_list %= "id : type <- expr , declaration-list",lambda s: [(s[1], s[3], s[5])] + s[7] + +case_list %= "id : type => expr ;", lambda s: [(s[1], s[3], s[5])] +case_list %= "id : type => expr ; case-list", lambda s: [(s[1], s[3], s[5])] + s[7] + +function_call %= "id ( expr-list )", lambda s: cool.MethodCallNode(s[1], s[3]) +function_call %= "atom . id ( expr-list )", lambda s: cool.MethodCallNode(s[3], s[5], s[1]) +function_call %= "atom @ type . id ( expr-list )", lambda s: cool.MethodCallNode(s[5], s[7], s[1], s[3]) + +expr_list %= "", lambda s: [] +expr_list %= "not-empty-expr-list", lambda s: s[1] +not_empty_expr_list %= "expr", lambda s: [s[1]] +not_empty_expr_list %= "expr , not-empty-expr-list", lambda s: [s[1]] + s[3] + +##################### +# Error Productions # +##################### +G.add_terminal_error() + + +@G.parsing_error +def parsing_error(parser: ShiftReduceParser): + t = parser.current_token + parser.add_error( + t.line, + t.column, + f'({t.line}, {t.column}) - SyntacticError: ERROR at or near "{t.lex}"', + ) + + +@G.production("feature-list -> attribute error feature-list") +def feature_attribute_error(s): + s.add_error( + 2, + f'({s[2].line}, {s[2].column}) - SyntacticError: ERROR at or near "{s[2].lex}"', + ) + return [s[1]] + s[3] + + +@G.production("feature-list -> method error feature-list") +def feature_method_error(s): + s.add_error( + 2, + f'({s[2].line}, {s[2].column}) - SyntacticError: ERROR at or near "{s[2].lex}"', + ) + return [s[1]] + s[3] + + +@G.production("case-list -> id : type => expr error") +def case_list_error(s): + s.add_error( + 6, + f'({s[6].line}, {s[6].column}) - SyntacticError: ERROR at or near "{s[6].lex}"', + ) + return [(s[1], s[3], s[5])] + + +@G.production("case-list -> id : type => expr error case-list") +def case_list_error(s): + s.add_error( + 6, + f'({s[6].line}, {s[6].column}) - SyntacticError:ERROR at or near "{s[6].lex}"', + ) + return [(s[1], s[3], s[5])] + s[7] + + +@G.production("block -> expr error") +def block_single_error(s): + s.add_error( + 2, + f'({s[2].line}, {s[2].column}) - SyntacticError: ERROR at or near "{s[2].lex}"', + ) + return [s[1]] + + +@G.production("block -> expr error block") +def block_single_error(s): + s.add_error( + 2, + f'({s[2].line}, {s[2].column}) - SyntacticError: ERROR at or near "{s[2].lex}"', + ) + return [s[1]] + s[3] + + +################# +# Serialize API # +################# +def serialize_parser_and_lexer(): + import typer + + t = time.time() + G.serialize_lexer("CoolLexer", inspect.getmodulename(__file__)) + G.serialize_parser("lalr1", "CoolParser", inspect.getmodulename(__file__)) + + styled_e = typer.style( + f"Serialization Time : {time.time() - t} seconds", + fg=typer.colors.GREEN, + bold=True, + ) + typer.echo(styled_e) + + +if __name__ == "__main__": + serialize_parser_and_lexer() diff --git a/src/cool/lexertab.py b/src/cool/lexertab.py new file mode 100644 index 000000000..8cccfd0ba --- /dev/null +++ b/src/cool/lexertab.py @@ -0,0 +1,33 @@ +import re + +from pyjapt import Token, Lexer +from cool.grammar import G + + +class CoolLexer(Lexer): + def __init__(self): + self.lineno = 1 + self.column = 1 + self.position = 0 + self.token = Token("", "", 0, 0) + self.pattern = re.compile( + r"(?P[a-z][a-zA-Z0-9_]*)|(?P[A-Z][a-zA-Z0-9_]*)|(?P\")|(?P--.*)|(?P\(\*)|(?P\n+)|(?P +)|(?P\t+)|(?P\d+)|(inherits)|(isvoid)|(class)|(while)|(false)|(then)|(else)|(loop)|(pool)|(case)|(esac)|(true)|(<\-)|(let)|(new)|(not)|(\{)|(\})|(\()|(\))|(\.)|(=>)|(if)|(fi)|(in)|(of)|(\+)|(\-)|(\*)|(<=)|(\~)|(,)|(:)|(;)|(@)|(/)|(<)|(=)" + ) + self.token_rules = { + key: rule + for key, (_, _, rule) in G.terminal_rules.items() + if rule is not None + } + self.error_handler = ( + G.lexical_error_handler + if G.lexical_error_handler is not None + else self.error + ) + self._errors = [] + self.contain_errors = False + self.eof = "$" + + def __call__(self, text): + return [ + Token(t.lex, G[t.token_type], t.line, t.column) for t in self.tokenize(text) + ] diff --git a/src/cool/parsertab.py b/src/cool/parsertab.py new file mode 100644 index 000000000..2888ce2f3 --- /dev/null +++ b/src/cool/parsertab.py @@ -0,0 +1,1569 @@ +from abc import ABC +from pyjapt import ShiftReduceParser +from cool.grammar import G + + +class CoolParser(ShiftReduceParser, ABC): + def __init__(self, verbose=False): + self.grammar = G + self.verbose = verbose + self.action = self.__action_table() + self.goto = self.__goto_table() + self._errors = [] + self.error_handler = ( + G.parsing_error_handler + if G.parsing_error_handler is not None + else self.error + ) + + @staticmethod + def __action_table(): + return { + (0, G["class"]): ("SHIFT", 1), + (1, G["type"]): ("SHIFT", 2), + (2, G["inherits"]): ("SHIFT", 149), + (2, G["{"]): ("SHIFT", 3), + (3, G["id"]): ("SHIFT", 4), + (3, G["}"]): ("REDUCE", G["feature-list -> e"]), + (4, G[":"]): ("SHIFT", 133), + (4, G["("]): ("SHIFT", 5), + (5, G[")"]): ("SHIFT", 6), + (5, G["id"]): ("SHIFT", 121), + (6, G[":"]): ("SHIFT", 7), + (7, G["type"]): ("SHIFT", 8), + (8, G["{"]): ("SHIFT", 9), + (9, G["while"]): ("SHIFT", 13), + (9, G["false"]): ("SHIFT", 26), + (9, G["id"]): ("SHIFT", 46), + (9, G["case"]): ("SHIFT", 21), + (9, G["not"]): ("SHIFT", 30), + (9, G["string"]): ("SHIFT", 32), + (9, G["{"]): ("SHIFT", 10), + (9, G["isvoid"]): ("SHIFT", 24), + (9, G["if"]): ("SHIFT", 12), + (9, G["new"]): ("SHIFT", 22), + (9, G["("]): ("SHIFT", 11), + (9, G["~"]): ("SHIFT", 27), + (9, G["let"]): ("SHIFT", 14), + (9, G["int"]): ("SHIFT", 31), + (9, G["true"]): ("SHIFT", 25), + (10, G["false"]): ("SHIFT", 26), + (10, G["id"]): ("SHIFT", 46), + (10, G["while"]): ("SHIFT", 13), + (10, G["isvoid"]): ("SHIFT", 24), + (10, G["string"]): ("SHIFT", 32), + (10, G["~"]): ("SHIFT", 27), + (10, G["not"]): ("SHIFT", 30), + (10, G["case"]): ("SHIFT", 21), + (10, G["new"]): ("SHIFT", 22), + (10, G["if"]): ("SHIFT", 12), + (10, G["{"]): ("SHIFT", 10), + (10, G["("]): ("SHIFT", 11), + (10, G["let"]): ("SHIFT", 14), + (10, G["true"]): ("SHIFT", 25), + (10, G["int"]): ("SHIFT", 31), + (11, G["{"]): ("SHIFT", 10), + (11, G["string"]): ("SHIFT", 32), + (11, G["id"]): ("SHIFT", 46), + (11, G["if"]): ("SHIFT", 12), + (11, G["new"]): ("SHIFT", 22), + (11, G["("]): ("SHIFT", 11), + (11, G["isvoid"]): ("SHIFT", 24), + (11, G["let"]): ("SHIFT", 14), + (11, G["~"]): ("SHIFT", 27), + (11, G["int"]): ("SHIFT", 31), + (11, G["true"]): ("SHIFT", 25), + (11, G["while"]): ("SHIFT", 13), + (11, G["false"]): ("SHIFT", 26), + (11, G["case"]): ("SHIFT", 21), + (11, G["not"]): ("SHIFT", 30), + (12, G["case"]): ("SHIFT", 21), + (12, G["not"]): ("SHIFT", 30), + (12, G["if"]): ("SHIFT", 12), + (12, G["{"]): ("SHIFT", 10), + (12, G["new"]): ("SHIFT", 22), + (12, G["("]): ("SHIFT", 11), + (12, G["id"]): ("SHIFT", 46), + (12, G["let"]): ("SHIFT", 14), + (12, G["int"]): ("SHIFT", 31), + (12, G["true"]): ("SHIFT", 25), + (12, G["isvoid"]): ("SHIFT", 24), + (12, G["false"]): ("SHIFT", 26), + (12, G["~"]): ("SHIFT", 27), + (12, G["while"]): ("SHIFT", 13), + (12, G["string"]): ("SHIFT", 32), + (13, G["int"]): ("SHIFT", 31), + (13, G["{"]): ("SHIFT", 10), + (13, G["true"]): ("SHIFT", 25), + (13, G["false"]): ("SHIFT", 26), + (13, G["id"]): ("SHIFT", 46), + (13, G["let"]): ("SHIFT", 14), + (13, G["string"]): ("SHIFT", 32), + (13, G["isvoid"]): ("SHIFT", 24), + (13, G["if"]): ("SHIFT", 12), + (13, G["~"]): ("SHIFT", 27), + (13, G["new"]): ("SHIFT", 22), + (13, G["("]): ("SHIFT", 11), + (13, G["while"]): ("SHIFT", 13), + (13, G["case"]): ("SHIFT", 21), + (13, G["not"]): ("SHIFT", 30), + (14, G["id"]): ("SHIFT", 15), + (15, G[":"]): ("SHIFT", 16), + (16, G["type"]): ("SHIFT", 17), + (17, G["<-"]): ("SHIFT", 20), + (17, G[","]): ("SHIFT", 18), + (17, G["in"]): ("REDUCE", G["declaration-list -> id : type"]), + (18, G["id"]): ("SHIFT", 15), + (19, G["in"]): ( + "REDUCE", + G["declaration-list -> id : type , declaration-list"], + ), + (20, G["int"]): ("SHIFT", 31), + (20, G["true"]): ("SHIFT", 25), + (20, G["id"]): ("SHIFT", 46), + (20, G["false"]): ("SHIFT", 26), + (20, G["let"]): ("SHIFT", 14), + (20, G["isvoid"]): ("SHIFT", 24), + (20, G["string"]): ("SHIFT", 32), + (20, G["~"]): ("SHIFT", 27), + (20, G["while"]): ("SHIFT", 13), + (20, G["if"]): ("SHIFT", 12), + (20, G["new"]): ("SHIFT", 22), + (20, G["("]): ("SHIFT", 11), + (20, G["case"]): ("SHIFT", 21), + (20, G["not"]): ("SHIFT", 30), + (20, G["{"]): ("SHIFT", 10), + (21, G["isvoid"]): ("SHIFT", 24), + (21, G["~"]): ("SHIFT", 27), + (21, G["id"]): ("SHIFT", 46), + (21, G["while"]): ("SHIFT", 13), + (21, G["true"]): ("SHIFT", 25), + (21, G["int"]): ("SHIFT", 31), + (21, G["false"]): ("SHIFT", 26), + (21, G["not"]): ("SHIFT", 30), + (21, G["case"]): ("SHIFT", 21), + (21, G["{"]): ("SHIFT", 10), + (21, G["string"]): ("SHIFT", 32), + (21, G["if"]): ("SHIFT", 12), + (21, G["new"]): ("SHIFT", 22), + (21, G["("]): ("SHIFT", 11), + (21, G["let"]): ("SHIFT", 14), + (22, G["type"]): ("SHIFT", 23), + (23, G["."]): ("REDUCE", G["atom -> new type"]), + (23, G["else"]): ("REDUCE", G["atom -> new type"]), + (23, G["="]): ("REDUCE", G["atom -> new type"]), + (23, G[","]): ("REDUCE", G["atom -> new type"]), + (23, G["fi"]): ("REDUCE", G["atom -> new type"]), + (23, G[";"]): ("REDUCE", G["atom -> new type"]), + (23, G["error"]): ("REDUCE", G["atom -> new type"]), + (23, G["loop"]): ("REDUCE", G["atom -> new type"]), + (23, G["@"]): ("REDUCE", G["atom -> new type"]), + (23, G["pool"]): ("REDUCE", G["atom -> new type"]), + (23, G["+"]): ("REDUCE", G["atom -> new type"]), + (23, G["-"]): ("REDUCE", G["atom -> new type"]), + (23, G["in"]): ("REDUCE", G["atom -> new type"]), + (23, G["*"]): ("REDUCE", G["atom -> new type"]), + (23, G["}"]): ("REDUCE", G["atom -> new type"]), + (23, G["/"]): ("REDUCE", G["atom -> new type"]), + (23, G["of"]): ("REDUCE", G["atom -> new type"]), + (23, G["<="]): ("REDUCE", G["atom -> new type"]), + (23, G["<"]): ("REDUCE", G["atom -> new type"]), + (23, G[")"]): ("REDUCE", G["atom -> new type"]), + (23, G["then"]): ("REDUCE", G["atom -> new type"]), + (24, G["id"]): ("SHIFT", 28), + (24, G["int"]): ("SHIFT", 31), + (24, G["true"]): ("SHIFT", 25), + (24, G["if"]): ("SHIFT", 12), + (24, G["new"]): ("SHIFT", 22), + (24, G["("]): ("SHIFT", 11), + (24, G["false"]): ("SHIFT", 26), + (24, G["isvoid"]): ("SHIFT", 24), + (24, G["~"]): ("SHIFT", 27), + (24, G["string"]): ("SHIFT", 32), + (25, G["."]): ("REDUCE", G["atom -> true"]), + (25, G["else"]): ("REDUCE", G["atom -> true"]), + (25, G["="]): ("REDUCE", G["atom -> true"]), + (25, G[","]): ("REDUCE", G["atom -> true"]), + (25, G["fi"]): ("REDUCE", G["atom -> true"]), + (25, G[";"]): ("REDUCE", G["atom -> true"]), + (25, G["error"]): ("REDUCE", G["atom -> true"]), + (25, G["loop"]): ("REDUCE", G["atom -> true"]), + (25, G["@"]): ("REDUCE", G["atom -> true"]), + (25, G["pool"]): ("REDUCE", G["atom -> true"]), + (25, G["+"]): ("REDUCE", G["atom -> true"]), + (25, G["-"]): ("REDUCE", G["atom -> true"]), + (25, G["in"]): ("REDUCE", G["atom -> true"]), + (25, G["*"]): ("REDUCE", G["atom -> true"]), + (25, G["}"]): ("REDUCE", G["atom -> true"]), + (25, G["/"]): ("REDUCE", G["atom -> true"]), + (25, G["of"]): ("REDUCE", G["atom -> true"]), + (25, G["<="]): ("REDUCE", G["atom -> true"]), + (25, G["<"]): ("REDUCE", G["atom -> true"]), + (25, G[")"]): ("REDUCE", G["atom -> true"]), + (25, G["then"]): ("REDUCE", G["atom -> true"]), + (26, G["."]): ("REDUCE", G["atom -> false"]), + (26, G["else"]): ("REDUCE", G["atom -> false"]), + (26, G["="]): ("REDUCE", G["atom -> false"]), + (26, G[","]): ("REDUCE", G["atom -> false"]), + (26, G["fi"]): ("REDUCE", G["atom -> false"]), + (26, G[";"]): ("REDUCE", G["atom -> false"]), + (26, G["error"]): ("REDUCE", G["atom -> false"]), + (26, G["loop"]): ("REDUCE", G["atom -> false"]), + (26, G["@"]): ("REDUCE", G["atom -> false"]), + (26, G["pool"]): ("REDUCE", G["atom -> false"]), + (26, G["+"]): ("REDUCE", G["atom -> false"]), + (26, G["-"]): ("REDUCE", G["atom -> false"]), + (26, G["in"]): ("REDUCE", G["atom -> false"]), + (26, G["*"]): ("REDUCE", G["atom -> false"]), + (26, G["}"]): ("REDUCE", G["atom -> false"]), + (26, G["/"]): ("REDUCE", G["atom -> false"]), + (26, G["of"]): ("REDUCE", G["atom -> false"]), + (26, G["<="]): ("REDUCE", G["atom -> false"]), + (26, G["<"]): ("REDUCE", G["atom -> false"]), + (26, G[")"]): ("REDUCE", G["atom -> false"]), + (26, G["then"]): ("REDUCE", G["atom -> false"]), + (27, G["id"]): ("SHIFT", 28), + (27, G["int"]): ("SHIFT", 31), + (27, G["true"]): ("SHIFT", 25), + (27, G["if"]): ("SHIFT", 12), + (27, G["new"]): ("SHIFT", 22), + (27, G["("]): ("SHIFT", 11), + (27, G["false"]): ("SHIFT", 26), + (27, G["isvoid"]): ("SHIFT", 24), + (27, G["~"]): ("SHIFT", 27), + (27, G["string"]): ("SHIFT", 32), + (28, G["."]): ("REDUCE", G["atom -> id"]), + (28, G["else"]): ("REDUCE", G["atom -> id"]), + (28, G["="]): ("REDUCE", G["atom -> id"]), + (28, G[","]): ("REDUCE", G["atom -> id"]), + (28, G["fi"]): ("REDUCE", G["atom -> id"]), + (28, G[";"]): ("REDUCE", G["atom -> id"]), + (28, G["error"]): ("REDUCE", G["atom -> id"]), + (28, G["loop"]): ("REDUCE", G["atom -> id"]), + (28, G["@"]): ("REDUCE", G["atom -> id"]), + (28, G["pool"]): ("REDUCE", G["atom -> id"]), + (28, G["+"]): ("REDUCE", G["atom -> id"]), + (28, G["-"]): ("REDUCE", G["atom -> id"]), + (28, G["in"]): ("REDUCE", G["atom -> id"]), + (28, G["*"]): ("REDUCE", G["atom -> id"]), + (28, G["}"]): ("REDUCE", G["atom -> id"]), + (28, G["/"]): ("REDUCE", G["atom -> id"]), + (28, G["of"]): ("REDUCE", G["atom -> id"]), + (28, G["<="]): ("REDUCE", G["atom -> id"]), + (28, G["<"]): ("REDUCE", G["atom -> id"]), + (28, G[")"]): ("REDUCE", G["atom -> id"]), + (28, G["then"]): ("REDUCE", G["atom -> id"]), + (28, G["("]): ("SHIFT", 29), + (29, G["false"]): ("SHIFT", 26), + (29, G["let"]): ("SHIFT", 14), + (29, G["id"]): ("SHIFT", 46), + (29, G["string"]): ("SHIFT", 32), + (29, G[")"]): ("REDUCE", G["expr-list -> e"]), + (29, G["isvoid"]): ("SHIFT", 24), + (29, G["while"]): ("SHIFT", 13), + (29, G["if"]): ("SHIFT", 12), + (29, G["new"]): ("SHIFT", 22), + (29, G["~"]): ("SHIFT", 27), + (29, G["("]): ("SHIFT", 11), + (29, G["case"]): ("SHIFT", 21), + (29, G["not"]): ("SHIFT", 30), + (29, G["{"]): ("SHIFT", 10), + (29, G["int"]): ("SHIFT", 31), + (29, G["true"]): ("SHIFT", 25), + (30, G["id"]): ("SHIFT", 28), + (30, G["int"]): ("SHIFT", 31), + (30, G["true"]): ("SHIFT", 25), + (30, G["if"]): ("SHIFT", 12), + (30, G["new"]): ("SHIFT", 22), + (30, G["("]): ("SHIFT", 11), + (30, G["isvoid"]): ("SHIFT", 24), + (30, G["false"]): ("SHIFT", 26), + (30, G["~"]): ("SHIFT", 27), + (30, G["string"]): ("SHIFT", 32), + (31, G["."]): ("REDUCE", G["atom -> int"]), + (31, G["else"]): ("REDUCE", G["atom -> int"]), + (31, G["="]): ("REDUCE", G["atom -> int"]), + (31, G[","]): ("REDUCE", G["atom -> int"]), + (31, G["fi"]): ("REDUCE", G["atom -> int"]), + (31, G[";"]): ("REDUCE", G["atom -> int"]), + (31, G["error"]): ("REDUCE", G["atom -> int"]), + (31, G["loop"]): ("REDUCE", G["atom -> int"]), + (31, G["@"]): ("REDUCE", G["atom -> int"]), + (31, G["pool"]): ("REDUCE", G["atom -> int"]), + (31, G["+"]): ("REDUCE", G["atom -> int"]), + (31, G["-"]): ("REDUCE", G["atom -> int"]), + (31, G["in"]): ("REDUCE", G["atom -> int"]), + (31, G["*"]): ("REDUCE", G["atom -> int"]), + (31, G["}"]): ("REDUCE", G["atom -> int"]), + (31, G["/"]): ("REDUCE", G["atom -> int"]), + (31, G["of"]): ("REDUCE", G["atom -> int"]), + (31, G["<="]): ("REDUCE", G["atom -> int"]), + (31, G["<"]): ("REDUCE", G["atom -> int"]), + (31, G[")"]): ("REDUCE", G["atom -> int"]), + (31, G["then"]): ("REDUCE", G["atom -> int"]), + (32, G["."]): ("REDUCE", G["atom -> string"]), + (32, G["else"]): ("REDUCE", G["atom -> string"]), + (32, G["="]): ("REDUCE", G["atom -> string"]), + (32, G[","]): ("REDUCE", G["atom -> string"]), + (32, G["fi"]): ("REDUCE", G["atom -> string"]), + (32, G[";"]): ("REDUCE", G["atom -> string"]), + (32, G["error"]): ("REDUCE", G["atom -> string"]), + (32, G["loop"]): ("REDUCE", G["atom -> string"]), + (32, G["@"]): ("REDUCE", G["atom -> string"]), + (32, G["pool"]): ("REDUCE", G["atom -> string"]), + (32, G["+"]): ("REDUCE", G["atom -> string"]), + (32, G["-"]): ("REDUCE", G["atom -> string"]), + (32, G["in"]): ("REDUCE", G["atom -> string"]), + (32, G["*"]): ("REDUCE", G["atom -> string"]), + (32, G["}"]): ("REDUCE", G["atom -> string"]), + (32, G["/"]): ("REDUCE", G["atom -> string"]), + (32, G["of"]): ("REDUCE", G["atom -> string"]), + (32, G["<="]): ("REDUCE", G["atom -> string"]), + (32, G["<"]): ("REDUCE", G["atom -> string"]), + (32, G[")"]): ("REDUCE", G["atom -> string"]), + (32, G["then"]): ("REDUCE", G["atom -> string"]), + (33, G["."]): ("REDUCE", G["atom -> function-call"]), + (33, G["else"]): ("REDUCE", G["atom -> function-call"]), + (33, G["="]): ("REDUCE", G["atom -> function-call"]), + (33, G[","]): ("REDUCE", G["atom -> function-call"]), + (33, G["fi"]): ("REDUCE", G["atom -> function-call"]), + (33, G[";"]): ("REDUCE", G["atom -> function-call"]), + (33, G["error"]): ("REDUCE", G["atom -> function-call"]), + (33, G["loop"]): ("REDUCE", G["atom -> function-call"]), + (33, G["@"]): ("REDUCE", G["atom -> function-call"]), + (33, G["pool"]): ("REDUCE", G["atom -> function-call"]), + (33, G["+"]): ("REDUCE", G["atom -> function-call"]), + (33, G["-"]): ("REDUCE", G["atom -> function-call"]), + (33, G["in"]): ("REDUCE", G["atom -> function-call"]), + (33, G["*"]): ("REDUCE", G["atom -> function-call"]), + (33, G["}"]): ("REDUCE", G["atom -> function-call"]), + (33, G["/"]): ("REDUCE", G["atom -> function-call"]), + (33, G["of"]): ("REDUCE", G["atom -> function-call"]), + (33, G["<="]): ("REDUCE", G["atom -> function-call"]), + (33, G["<"]): ("REDUCE", G["atom -> function-call"]), + (33, G[")"]): ("REDUCE", G["atom -> function-call"]), + (33, G["then"]): ("REDUCE", G["atom -> function-call"]), + (34, G["<"]): ("SHIFT", 35), + (34, G["<="]): ("SHIFT", 51), + (34, G["else"]): ("REDUCE", G["negable-comp -> not comp"]), + (34, G[","]): ("REDUCE", G["negable-comp -> not comp"]), + (34, G["in"]): ("REDUCE", G["negable-comp -> not comp"]), + (34, G["fi"]): ("REDUCE", G["negable-comp -> not comp"]), + (34, G["}"]): ("REDUCE", G["negable-comp -> not comp"]), + (34, G["pool"]): ("REDUCE", G["negable-comp -> not comp"]), + (34, G[";"]): ("REDUCE", G["negable-comp -> not comp"]), + (34, G["error"]): ("REDUCE", G["negable-comp -> not comp"]), + (34, G["loop"]): ("REDUCE", G["negable-comp -> not comp"]), + (34, G["of"]): ("REDUCE", G["negable-comp -> not comp"]), + (34, G[")"]): ("REDUCE", G["negable-comp -> not comp"]), + (34, G["then"]): ("REDUCE", G["negable-comp -> not comp"]), + (34, G["="]): ("SHIFT", 60), + (35, G["id"]): ("SHIFT", 28), + (35, G["int"]): ("SHIFT", 31), + (35, G["true"]): ("SHIFT", 25), + (35, G["if"]): ("SHIFT", 12), + (35, G["new"]): ("SHIFT", 22), + (35, G["("]): ("SHIFT", 11), + (35, G["isvoid"]): ("SHIFT", 24), + (35, G["false"]): ("SHIFT", 26), + (35, G["~"]): ("SHIFT", 27), + (35, G["not"]): ("SHIFT", 36), + (35, G["string"]): ("SHIFT", 32), + (36, G["id"]): ("SHIFT", 28), + (36, G["int"]): ("SHIFT", 31), + (36, G["true"]): ("SHIFT", 25), + (36, G["if"]): ("SHIFT", 12), + (36, G["new"]): ("SHIFT", 22), + (36, G["("]): ("SHIFT", 11), + (36, G["isvoid"]): ("SHIFT", 24), + (36, G["false"]): ("SHIFT", 26), + (36, G["~"]): ("SHIFT", 27), + (36, G["string"]): ("SHIFT", 32), + (37, G["-"]): ("SHIFT", 54), + (37, G["else"]): ("REDUCE", G["negable-arith -> not arith"]), + (37, G["="]): ("REDUCE", G["negable-arith -> not arith"]), + (37, G[","]): ("REDUCE", G["negable-arith -> not arith"]), + (37, G["in"]): ("REDUCE", G["negable-arith -> not arith"]), + (37, G["fi"]): ("REDUCE", G["negable-arith -> not arith"]), + (37, G[")"]): ("REDUCE", G["negable-arith -> not arith"]), + (37, G["}"]): ("REDUCE", G["negable-arith -> not arith"]), + (37, G[";"]): ("REDUCE", G["negable-arith -> not arith"]), + (37, G["error"]): ("REDUCE", G["negable-arith -> not arith"]), + (37, G["<"]): ("REDUCE", G["negable-arith -> not arith"]), + (37, G["loop"]): ("REDUCE", G["negable-arith -> not arith"]), + (37, G["of"]): ("REDUCE", G["negable-arith -> not arith"]), + (37, G["<="]): ("REDUCE", G["negable-arith -> not arith"]), + (37, G["pool"]): ("REDUCE", G["negable-arith -> not arith"]), + (37, G["then"]): ("REDUCE", G["negable-arith -> not arith"]), + (37, G["+"]): ("SHIFT", 38), + (38, G["id"]): ("SHIFT", 28), + (38, G["int"]): ("SHIFT", 31), + (38, G["true"]): ("SHIFT", 25), + (38, G["if"]): ("SHIFT", 12), + (38, G["new"]): ("SHIFT", 22), + (38, G["("]): ("SHIFT", 11), + (38, G["isvoid"]): ("SHIFT", 24), + (38, G["false"]): ("SHIFT", 26), + (38, G["~"]): ("SHIFT", 27), + (38, G["string"]): ("SHIFT", 32), + (39, G["/"]): ("SHIFT", 56), + (39, G["else"]): ("REDUCE", G["arith -> arith + term"]), + (39, G["="]): ("REDUCE", G["arith -> arith + term"]), + (39, G[","]): ("REDUCE", G["arith -> arith + term"]), + (39, G["fi"]): ("REDUCE", G["arith -> arith + term"]), + (39, G[";"]): ("REDUCE", G["arith -> arith + term"]), + (39, G["error"]): ("REDUCE", G["arith -> arith + term"]), + (39, G["loop"]): ("REDUCE", G["arith -> arith + term"]), + (39, G["pool"]): ("REDUCE", G["arith -> arith + term"]), + (39, G["+"]): ("REDUCE", G["arith -> arith + term"]), + (39, G["-"]): ("REDUCE", G["arith -> arith + term"]), + (39, G["in"]): ("REDUCE", G["arith -> arith + term"]), + (39, G["}"]): ("REDUCE", G["arith -> arith + term"]), + (39, G["of"]): ("REDUCE", G["arith -> arith + term"]), + (39, G["<="]): ("REDUCE", G["arith -> arith + term"]), + (39, G["<"]): ("REDUCE", G["arith -> arith + term"]), + (39, G[")"]): ("REDUCE", G["arith -> arith + term"]), + (39, G["then"]): ("REDUCE", G["arith -> arith + term"]), + (39, G["*"]): ("SHIFT", 40), + (40, G["id"]): ("SHIFT", 28), + (40, G["int"]): ("SHIFT", 31), + (40, G["true"]): ("SHIFT", 25), + (40, G["if"]): ("SHIFT", 12), + (40, G["new"]): ("SHIFT", 22), + (40, G["("]): ("SHIFT", 11), + (40, G["false"]): ("SHIFT", 26), + (40, G["isvoid"]): ("SHIFT", 24), + (40, G["~"]): ("SHIFT", 27), + (40, G["string"]): ("SHIFT", 32), + (41, G["else"]): ("REDUCE", G["term -> term * factor"]), + (41, G["="]): ("REDUCE", G["term -> term * factor"]), + (41, G[","]): ("REDUCE", G["term -> term * factor"]), + (41, G["fi"]): ("REDUCE", G["term -> term * factor"]), + (41, G[";"]): ("REDUCE", G["term -> term * factor"]), + (41, G["error"]): ("REDUCE", G["term -> term * factor"]), + (41, G["loop"]): ("REDUCE", G["term -> term * factor"]), + (41, G["pool"]): ("REDUCE", G["term -> term * factor"]), + (41, G["+"]): ("REDUCE", G["term -> term * factor"]), + (41, G["-"]): ("REDUCE", G["term -> term * factor"]), + (41, G["in"]): ("REDUCE", G["term -> term * factor"]), + (41, G["*"]): ("REDUCE", G["term -> term * factor"]), + (41, G["}"]): ("REDUCE", G["term -> term * factor"]), + (41, G["/"]): ("REDUCE", G["term -> term * factor"]), + (41, G["of"]): ("REDUCE", G["term -> term * factor"]), + (41, G["<="]): ("REDUCE", G["term -> term * factor"]), + (41, G["<"]): ("REDUCE", G["term -> term * factor"]), + (41, G[")"]): ("REDUCE", G["term -> term * factor"]), + (41, G["then"]): ("REDUCE", G["term -> term * factor"]), + (42, G["else"]): ("REDUCE", G["factor -> atom"]), + (42, G["="]): ("REDUCE", G["factor -> atom"]), + (42, G[","]): ("REDUCE", G["factor -> atom"]), + (42, G["fi"]): ("REDUCE", G["factor -> atom"]), + (42, G[";"]): ("REDUCE", G["factor -> atom"]), + (42, G["error"]): ("REDUCE", G["factor -> atom"]), + (42, G["loop"]): ("REDUCE", G["factor -> atom"]), + (42, G["pool"]): ("REDUCE", G["factor -> atom"]), + (42, G["+"]): ("REDUCE", G["factor -> atom"]), + (42, G["-"]): ("REDUCE", G["factor -> atom"]), + (42, G["in"]): ("REDUCE", G["factor -> atom"]), + (42, G["*"]): ("REDUCE", G["factor -> atom"]), + (42, G["}"]): ("REDUCE", G["factor -> atom"]), + (42, G["/"]): ("REDUCE", G["factor -> atom"]), + (42, G["of"]): ("REDUCE", G["factor -> atom"]), + (42, G["<="]): ("REDUCE", G["factor -> atom"]), + (42, G["<"]): ("REDUCE", G["factor -> atom"]), + (42, G[")"]): ("REDUCE", G["factor -> atom"]), + (42, G["then"]): ("REDUCE", G["factor -> atom"]), + (42, G["@"]): ("SHIFT", 69), + (42, G["."]): ("SHIFT", 43), + (43, G["id"]): ("SHIFT", 44), + (44, G["("]): ("SHIFT", 45), + (45, G["false"]): ("SHIFT", 26), + (45, G["let"]): ("SHIFT", 14), + (45, G["id"]): ("SHIFT", 46), + (45, G["string"]): ("SHIFT", 32), + (45, G[")"]): ("REDUCE", G["expr-list -> e"]), + (45, G["isvoid"]): ("SHIFT", 24), + (45, G["while"]): ("SHIFT", 13), + (45, G["if"]): ("SHIFT", 12), + (45, G["new"]): ("SHIFT", 22), + (45, G["~"]): ("SHIFT", 27), + (45, G["("]): ("SHIFT", 11), + (45, G["case"]): ("SHIFT", 21), + (45, G["not"]): ("SHIFT", 30), + (45, G["{"]): ("SHIFT", 10), + (45, G["int"]): ("SHIFT", 31), + (45, G["true"]): ("SHIFT", 25), + (46, G["."]): ("REDUCE", G["atom -> id"]), + (46, G["else"]): ("REDUCE", G["atom -> id"]), + (46, G["="]): ("REDUCE", G["atom -> id"]), + (46, G[","]): ("REDUCE", G["atom -> id"]), + (46, G["fi"]): ("REDUCE", G["atom -> id"]), + (46, G[";"]): ("REDUCE", G["atom -> id"]), + (46, G["error"]): ("REDUCE", G["atom -> id"]), + (46, G["loop"]): ("REDUCE", G["atom -> id"]), + (46, G["@"]): ("REDUCE", G["atom -> id"]), + (46, G["pool"]): ("REDUCE", G["atom -> id"]), + (46, G["+"]): ("REDUCE", G["atom -> id"]), + (46, G["-"]): ("REDUCE", G["atom -> id"]), + (46, G["in"]): ("REDUCE", G["atom -> id"]), + (46, G["*"]): ("REDUCE", G["atom -> id"]), + (46, G["}"]): ("REDUCE", G["atom -> id"]), + (46, G["/"]): ("REDUCE", G["atom -> id"]), + (46, G["of"]): ("REDUCE", G["atom -> id"]), + (46, G["<="]): ("REDUCE", G["atom -> id"]), + (46, G["<"]): ("REDUCE", G["atom -> id"]), + (46, G[")"]): ("REDUCE", G["atom -> id"]), + (46, G["then"]): ("REDUCE", G["atom -> id"]), + (46, G["("]): ("SHIFT", 29), + (46, G["<-"]): ("SHIFT", 47), + (47, G["id"]): ("SHIFT", 46), + (47, G["if"]): ("SHIFT", 12), + (47, G["let"]): ("SHIFT", 14), + (47, G["new"]): ("SHIFT", 22), + (47, G["("]): ("SHIFT", 11), + (47, G["isvoid"]): ("SHIFT", 24), + (47, G["~"]): ("SHIFT", 27), + (47, G["while"]): ("SHIFT", 13), + (47, G["int"]): ("SHIFT", 31), + (47, G["true"]): ("SHIFT", 25), + (47, G["not"]): ("SHIFT", 30), + (47, G["case"]): ("SHIFT", 21), + (47, G["false"]): ("SHIFT", 26), + (47, G["{"]): ("SHIFT", 10), + (47, G["string"]): ("SHIFT", 32), + (48, G["else"]): ("REDUCE", G["expr -> id <- expr"]), + (48, G["in"]): ("REDUCE", G["expr -> id <- expr"]), + (48, G[","]): ("REDUCE", G["expr -> id <- expr"]), + (48, G["fi"]): ("REDUCE", G["expr -> id <- expr"]), + (48, G[")"]): ("REDUCE", G["expr -> id <- expr"]), + (48, G["}"]): ("REDUCE", G["expr -> id <- expr"]), + (48, G[";"]): ("REDUCE", G["expr -> id <- expr"]), + (48, G["error"]): ("REDUCE", G["expr -> id <- expr"]), + (48, G["loop"]): ("REDUCE", G["expr -> id <- expr"]), + (48, G["of"]): ("REDUCE", G["expr -> id <- expr"]), + (48, G["pool"]): ("REDUCE", G["expr -> id <- expr"]), + (48, G["then"]): ("REDUCE", G["expr -> id <- expr"]), + (49, G["else"]): ("REDUCE", G["expr -> negable-comp"]), + (49, G["in"]): ("REDUCE", G["expr -> negable-comp"]), + (49, G[","]): ("REDUCE", G["expr -> negable-comp"]), + (49, G["fi"]): ("REDUCE", G["expr -> negable-comp"]), + (49, G[")"]): ("REDUCE", G["expr -> negable-comp"]), + (49, G["}"]): ("REDUCE", G["expr -> negable-comp"]), + (49, G[";"]): ("REDUCE", G["expr -> negable-comp"]), + (49, G["error"]): ("REDUCE", G["expr -> negable-comp"]), + (49, G["loop"]): ("REDUCE", G["expr -> negable-comp"]), + (49, G["of"]): ("REDUCE", G["expr -> negable-comp"]), + (49, G["pool"]): ("REDUCE", G["expr -> negable-comp"]), + (49, G["then"]): ("REDUCE", G["expr -> negable-comp"]), + (50, G["="]): ("SHIFT", 60), + (50, G["<="]): ("SHIFT", 51), + (50, G["<"]): ("SHIFT", 35), + (50, G["else"]): ("REDUCE", G["negable-comp -> comp"]), + (50, G["in"]): ("REDUCE", G["negable-comp -> comp"]), + (50, G[","]): ("REDUCE", G["negable-comp -> comp"]), + (50, G["fi"]): ("REDUCE", G["negable-comp -> comp"]), + (50, G[")"]): ("REDUCE", G["negable-comp -> comp"]), + (50, G["}"]): ("REDUCE", G["negable-comp -> comp"]), + (50, G[";"]): ("REDUCE", G["negable-comp -> comp"]), + (50, G["error"]): ("REDUCE", G["negable-comp -> comp"]), + (50, G["loop"]): ("REDUCE", G["negable-comp -> comp"]), + (50, G["of"]): ("REDUCE", G["negable-comp -> comp"]), + (50, G["pool"]): ("REDUCE", G["negable-comp -> comp"]), + (50, G["then"]): ("REDUCE", G["negable-comp -> comp"]), + (51, G["id"]): ("SHIFT", 28), + (51, G["int"]): ("SHIFT", 31), + (51, G["true"]): ("SHIFT", 25), + (51, G["if"]): ("SHIFT", 12), + (51, G["new"]): ("SHIFT", 22), + (51, G["("]): ("SHIFT", 11), + (51, G["isvoid"]): ("SHIFT", 24), + (51, G["false"]): ("SHIFT", 26), + (51, G["~"]): ("SHIFT", 27), + (51, G["not"]): ("SHIFT", 36), + (51, G["string"]): ("SHIFT", 32), + (52, G["else"]): ("REDUCE", G["comp -> comp <= negable-arith"]), + (52, G["="]): ("REDUCE", G["comp -> comp <= negable-arith"]), + (52, G["in"]): ("REDUCE", G["comp -> comp <= negable-arith"]), + (52, G[","]): ("REDUCE", G["comp -> comp <= negable-arith"]), + (52, G["fi"]): ("REDUCE", G["comp -> comp <= negable-arith"]), + (52, G["}"]): ("REDUCE", G["comp -> comp <= negable-arith"]), + (52, G["pool"]): ("REDUCE", G["comp -> comp <= negable-arith"]), + (52, G[";"]): ("REDUCE", G["comp -> comp <= negable-arith"]), + (52, G["error"]): ("REDUCE", G["comp -> comp <= negable-arith"]), + (52, G["<"]): ("REDUCE", G["comp -> comp <= negable-arith"]), + (52, G["loop"]): ("REDUCE", G["comp -> comp <= negable-arith"]), + (52, G["of"]): ("REDUCE", G["comp -> comp <= negable-arith"]), + (52, G["<="]): ("REDUCE", G["comp -> comp <= negable-arith"]), + (52, G[")"]): ("REDUCE", G["comp -> comp <= negable-arith"]), + (52, G["then"]): ("REDUCE", G["comp -> comp <= negable-arith"]), + (53, G["-"]): ("SHIFT", 54), + (53, G["+"]): ("SHIFT", 38), + (53, G["else"]): ("REDUCE", G["negable-arith -> arith"]), + (53, G["="]): ("REDUCE", G["negable-arith -> arith"]), + (53, G["in"]): ("REDUCE", G["negable-arith -> arith"]), + (53, G[","]): ("REDUCE", G["negable-arith -> arith"]), + (53, G["fi"]): ("REDUCE", G["negable-arith -> arith"]), + (53, G["}"]): ("REDUCE", G["negable-arith -> arith"]), + (53, G["pool"]): ("REDUCE", G["negable-arith -> arith"]), + (53, G[";"]): ("REDUCE", G["negable-arith -> arith"]), + (53, G["error"]): ("REDUCE", G["negable-arith -> arith"]), + (53, G["<"]): ("REDUCE", G["negable-arith -> arith"]), + (53, G["loop"]): ("REDUCE", G["negable-arith -> arith"]), + (53, G["of"]): ("REDUCE", G["negable-arith -> arith"]), + (53, G["<="]): ("REDUCE", G["negable-arith -> arith"]), + (53, G[")"]): ("REDUCE", G["negable-arith -> arith"]), + (53, G["then"]): ("REDUCE", G["negable-arith -> arith"]), + (54, G["id"]): ("SHIFT", 28), + (54, G["int"]): ("SHIFT", 31), + (54, G["true"]): ("SHIFT", 25), + (54, G["if"]): ("SHIFT", 12), + (54, G["new"]): ("SHIFT", 22), + (54, G["("]): ("SHIFT", 11), + (54, G["isvoid"]): ("SHIFT", 24), + (54, G["false"]): ("SHIFT", 26), + (54, G["~"]): ("SHIFT", 27), + (54, G["string"]): ("SHIFT", 32), + (55, G["/"]): ("SHIFT", 56), + (55, G["*"]): ("SHIFT", 40), + (55, G["else"]): ("REDUCE", G["arith -> arith - term"]), + (55, G["="]): ("REDUCE", G["arith -> arith - term"]), + (55, G[","]): ("REDUCE", G["arith -> arith - term"]), + (55, G["fi"]): ("REDUCE", G["arith -> arith - term"]), + (55, G[";"]): ("REDUCE", G["arith -> arith - term"]), + (55, G["error"]): ("REDUCE", G["arith -> arith - term"]), + (55, G["loop"]): ("REDUCE", G["arith -> arith - term"]), + (55, G["pool"]): ("REDUCE", G["arith -> arith - term"]), + (55, G["+"]): ("REDUCE", G["arith -> arith - term"]), + (55, G["-"]): ("REDUCE", G["arith -> arith - term"]), + (55, G["in"]): ("REDUCE", G["arith -> arith - term"]), + (55, G["}"]): ("REDUCE", G["arith -> arith - term"]), + (55, G["of"]): ("REDUCE", G["arith -> arith - term"]), + (55, G["<="]): ("REDUCE", G["arith -> arith - term"]), + (55, G["<"]): ("REDUCE", G["arith -> arith - term"]), + (55, G[")"]): ("REDUCE", G["arith -> arith - term"]), + (55, G["then"]): ("REDUCE", G["arith -> arith - term"]), + (56, G["id"]): ("SHIFT", 28), + (56, G["int"]): ("SHIFT", 31), + (56, G["true"]): ("SHIFT", 25), + (56, G["if"]): ("SHIFT", 12), + (56, G["new"]): ("SHIFT", 22), + (56, G["("]): ("SHIFT", 11), + (56, G["false"]): ("SHIFT", 26), + (56, G["isvoid"]): ("SHIFT", 24), + (56, G["~"]): ("SHIFT", 27), + (56, G["string"]): ("SHIFT", 32), + (57, G["else"]): ("REDUCE", G["term -> term / factor"]), + (57, G["="]): ("REDUCE", G["term -> term / factor"]), + (57, G[","]): ("REDUCE", G["term -> term / factor"]), + (57, G["fi"]): ("REDUCE", G["term -> term / factor"]), + (57, G[";"]): ("REDUCE", G["term -> term / factor"]), + (57, G["error"]): ("REDUCE", G["term -> term / factor"]), + (57, G["loop"]): ("REDUCE", G["term -> term / factor"]), + (57, G["pool"]): ("REDUCE", G["term -> term / factor"]), + (57, G["+"]): ("REDUCE", G["term -> term / factor"]), + (57, G["-"]): ("REDUCE", G["term -> term / factor"]), + (57, G["in"]): ("REDUCE", G["term -> term / factor"]), + (57, G["*"]): ("REDUCE", G["term -> term / factor"]), + (57, G["}"]): ("REDUCE", G["term -> term / factor"]), + (57, G["/"]): ("REDUCE", G["term -> term / factor"]), + (57, G["of"]): ("REDUCE", G["term -> term / factor"]), + (57, G["<="]): ("REDUCE", G["term -> term / factor"]), + (57, G["<"]): ("REDUCE", G["term -> term / factor"]), + (57, G[")"]): ("REDUCE", G["term -> term / factor"]), + (57, G["then"]): ("REDUCE", G["term -> term / factor"]), + (58, G["else"]): ("REDUCE", G["term -> factor"]), + (58, G["="]): ("REDUCE", G["term -> factor"]), + (58, G[","]): ("REDUCE", G["term -> factor"]), + (58, G["fi"]): ("REDUCE", G["term -> factor"]), + (58, G[";"]): ("REDUCE", G["term -> factor"]), + (58, G["error"]): ("REDUCE", G["term -> factor"]), + (58, G["loop"]): ("REDUCE", G["term -> factor"]), + (58, G["pool"]): ("REDUCE", G["term -> factor"]), + (58, G["+"]): ("REDUCE", G["term -> factor"]), + (58, G["-"]): ("REDUCE", G["term -> factor"]), + (58, G["in"]): ("REDUCE", G["term -> factor"]), + (58, G["*"]): ("REDUCE", G["term -> factor"]), + (58, G["}"]): ("REDUCE", G["term -> factor"]), + (58, G["/"]): ("REDUCE", G["term -> factor"]), + (58, G["of"]): ("REDUCE", G["term -> factor"]), + (58, G["<="]): ("REDUCE", G["term -> factor"]), + (58, G["<"]): ("REDUCE", G["term -> factor"]), + (58, G[")"]): ("REDUCE", G["term -> factor"]), + (58, G["then"]): ("REDUCE", G["term -> factor"]), + (59, G["/"]): ("SHIFT", 56), + (59, G["*"]): ("SHIFT", 40), + (59, G["else"]): ("REDUCE", G["arith -> term"]), + (59, G["="]): ("REDUCE", G["arith -> term"]), + (59, G[","]): ("REDUCE", G["arith -> term"]), + (59, G["fi"]): ("REDUCE", G["arith -> term"]), + (59, G[";"]): ("REDUCE", G["arith -> term"]), + (59, G["error"]): ("REDUCE", G["arith -> term"]), + (59, G["loop"]): ("REDUCE", G["arith -> term"]), + (59, G["pool"]): ("REDUCE", G["arith -> term"]), + (59, G["+"]): ("REDUCE", G["arith -> term"]), + (59, G["-"]): ("REDUCE", G["arith -> term"]), + (59, G["in"]): ("REDUCE", G["arith -> term"]), + (59, G["}"]): ("REDUCE", G["arith -> term"]), + (59, G["of"]): ("REDUCE", G["arith -> term"]), + (59, G["<="]): ("REDUCE", G["arith -> term"]), + (59, G["<"]): ("REDUCE", G["arith -> term"]), + (59, G[")"]): ("REDUCE", G["arith -> term"]), + (59, G["then"]): ("REDUCE", G["arith -> term"]), + (60, G["id"]): ("SHIFT", 28), + (60, G["int"]): ("SHIFT", 31), + (60, G["true"]): ("SHIFT", 25), + (60, G["if"]): ("SHIFT", 12), + (60, G["new"]): ("SHIFT", 22), + (60, G["("]): ("SHIFT", 11), + (60, G["isvoid"]): ("SHIFT", 24), + (60, G["false"]): ("SHIFT", 26), + (60, G["~"]): ("SHIFT", 27), + (60, G["not"]): ("SHIFT", 36), + (60, G["string"]): ("SHIFT", 32), + (61, G["else"]): ("REDUCE", G["comp -> comp = negable-arith"]), + (61, G["="]): ("REDUCE", G["comp -> comp = negable-arith"]), + (61, G["in"]): ("REDUCE", G["comp -> comp = negable-arith"]), + (61, G[","]): ("REDUCE", G["comp -> comp = negable-arith"]), + (61, G["fi"]): ("REDUCE", G["comp -> comp = negable-arith"]), + (61, G["}"]): ("REDUCE", G["comp -> comp = negable-arith"]), + (61, G["pool"]): ("REDUCE", G["comp -> comp = negable-arith"]), + (61, G[";"]): ("REDUCE", G["comp -> comp = negable-arith"]), + (61, G["error"]): ("REDUCE", G["comp -> comp = negable-arith"]), + (61, G["<"]): ("REDUCE", G["comp -> comp = negable-arith"]), + (61, G["loop"]): ("REDUCE", G["comp -> comp = negable-arith"]), + (61, G["of"]): ("REDUCE", G["comp -> comp = negable-arith"]), + (61, G["<="]): ("REDUCE", G["comp -> comp = negable-arith"]), + (61, G[")"]): ("REDUCE", G["comp -> comp = negable-arith"]), + (61, G["then"]): ("REDUCE", G["comp -> comp = negable-arith"]), + (62, G["-"]): ("SHIFT", 54), + (62, G["+"]): ("SHIFT", 38), + (62, G["else"]): ("REDUCE", G["comp -> arith"]), + (62, G["="]): ("REDUCE", G["comp -> arith"]), + (62, G[","]): ("REDUCE", G["comp -> arith"]), + (62, G["in"]): ("REDUCE", G["comp -> arith"]), + (62, G["fi"]): ("REDUCE", G["comp -> arith"]), + (62, G[")"]): ("REDUCE", G["comp -> arith"]), + (62, G["}"]): ("REDUCE", G["comp -> arith"]), + (62, G[";"]): ("REDUCE", G["comp -> arith"]), + (62, G["error"]): ("REDUCE", G["comp -> arith"]), + (62, G["loop"]): ("REDUCE", G["comp -> arith"]), + (62, G["of"]): ("REDUCE", G["comp -> arith"]), + (62, G["<="]): ("REDUCE", G["comp -> arith"]), + (62, G["<"]): ("REDUCE", G["comp -> arith"]), + (62, G["pool"]): ("REDUCE", G["comp -> arith"]), + (62, G["then"]): ("REDUCE", G["comp -> arith"]), + (63, G[")"]): ("SHIFT", 64), + (64, G["."]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (64, G["else"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (64, G["="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (64, G[","]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (64, G["fi"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (64, G[";"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (64, G["error"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (64, G["loop"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (64, G["@"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (64, G["pool"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (64, G["+"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (64, G["-"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (64, G["in"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (64, G["*"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (64, G["}"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (64, G["/"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (64, G["of"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (64, G["<="]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (64, G["<"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (64, G[")"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (64, G["then"]): ("REDUCE", G["function-call -> atom . id ( expr-list )"]), + (65, G[")"]): ("REDUCE", G["expr-list -> not-empty-expr-list"]), + (66, G[")"]): ("REDUCE", G["not-empty-expr-list -> expr"]), + (66, G[","]): ("SHIFT", 67), + (67, G["false"]): ("SHIFT", 26), + (67, G["let"]): ("SHIFT", 14), + (67, G["id"]): ("SHIFT", 46), + (67, G["string"]): ("SHIFT", 32), + (67, G["isvoid"]): ("SHIFT", 24), + (67, G["while"]): ("SHIFT", 13), + (67, G["if"]): ("SHIFT", 12), + (67, G["new"]): ("SHIFT", 22), + (67, G["~"]): ("SHIFT", 27), + (67, G["("]): ("SHIFT", 11), + (67, G["case"]): ("SHIFT", 21), + (67, G["not"]): ("SHIFT", 30), + (67, G["{"]): ("SHIFT", 10), + (67, G["int"]): ("SHIFT", 31), + (67, G["true"]): ("SHIFT", 25), + (68, G[")"]): ( + "REDUCE", + G["not-empty-expr-list -> expr , not-empty-expr-list"], + ), + (69, G["type"]): ("SHIFT", 70), + (70, G["."]): ("SHIFT", 71), + (71, G["id"]): ("SHIFT", 72), + (72, G["("]): ("SHIFT", 73), + (73, G["false"]): ("SHIFT", 26), + (73, G["let"]): ("SHIFT", 14), + (73, G["id"]): ("SHIFT", 46), + (73, G["string"]): ("SHIFT", 32), + (73, G[")"]): ("REDUCE", G["expr-list -> e"]), + (73, G["isvoid"]): ("SHIFT", 24), + (73, G["while"]): ("SHIFT", 13), + (73, G["if"]): ("SHIFT", 12), + (73, G["new"]): ("SHIFT", 22), + (73, G["~"]): ("SHIFT", 27), + (73, G["("]): ("SHIFT", 11), + (73, G["case"]): ("SHIFT", 21), + (73, G["not"]): ("SHIFT", 30), + (73, G["{"]): ("SHIFT", 10), + (73, G["int"]): ("SHIFT", 31), + (73, G["true"]): ("SHIFT", 25), + (74, G[")"]): ("SHIFT", 75), + (75, G["."]): ( + "REDUCE", + G["function-call -> atom @ type . id ( expr-list )"], + ), + (75, G["else"]): ( + "REDUCE", + G["function-call -> atom @ type . id ( expr-list )"], + ), + (75, G["="]): ( + "REDUCE", + G["function-call -> atom @ type . id ( expr-list )"], + ), + (75, G[","]): ( + "REDUCE", + G["function-call -> atom @ type . id ( expr-list )"], + ), + (75, G["fi"]): ( + "REDUCE", + G["function-call -> atom @ type . id ( expr-list )"], + ), + (75, G[";"]): ( + "REDUCE", + G["function-call -> atom @ type . id ( expr-list )"], + ), + (75, G["error"]): ( + "REDUCE", + G["function-call -> atom @ type . id ( expr-list )"], + ), + (75, G["loop"]): ( + "REDUCE", + G["function-call -> atom @ type . id ( expr-list )"], + ), + (75, G["@"]): ( + "REDUCE", + G["function-call -> atom @ type . id ( expr-list )"], + ), + (75, G["pool"]): ( + "REDUCE", + G["function-call -> atom @ type . id ( expr-list )"], + ), + (75, G["+"]): ( + "REDUCE", + G["function-call -> atom @ type . id ( expr-list )"], + ), + (75, G["-"]): ( + "REDUCE", + G["function-call -> atom @ type . id ( expr-list )"], + ), + (75, G["in"]): ( + "REDUCE", + G["function-call -> atom @ type . id ( expr-list )"], + ), + (75, G["*"]): ( + "REDUCE", + G["function-call -> atom @ type . id ( expr-list )"], + ), + (75, G["}"]): ( + "REDUCE", + G["function-call -> atom @ type . id ( expr-list )"], + ), + (75, G["/"]): ( + "REDUCE", + G["function-call -> atom @ type . id ( expr-list )"], + ), + (75, G["of"]): ( + "REDUCE", + G["function-call -> atom @ type . id ( expr-list )"], + ), + (75, G["<="]): ( + "REDUCE", + G["function-call -> atom @ type . id ( expr-list )"], + ), + (75, G["<"]): ( + "REDUCE", + G["function-call -> atom @ type . id ( expr-list )"], + ), + (75, G[")"]): ( + "REDUCE", + G["function-call -> atom @ type . id ( expr-list )"], + ), + (75, G["then"]): ( + "REDUCE", + G["function-call -> atom @ type . id ( expr-list )"], + ), + (76, G["else"]): ("REDUCE", G["comp -> comp < negable-arith"]), + (76, G["="]): ("REDUCE", G["comp -> comp < negable-arith"]), + (76, G["in"]): ("REDUCE", G["comp -> comp < negable-arith"]), + (76, G[","]): ("REDUCE", G["comp -> comp < negable-arith"]), + (76, G["fi"]): ("REDUCE", G["comp -> comp < negable-arith"]), + (76, G["}"]): ("REDUCE", G["comp -> comp < negable-arith"]), + (76, G["pool"]): ("REDUCE", G["comp -> comp < negable-arith"]), + (76, G[";"]): ("REDUCE", G["comp -> comp < negable-arith"]), + (76, G["error"]): ("REDUCE", G["comp -> comp < negable-arith"]), + (76, G["<"]): ("REDUCE", G["comp -> comp < negable-arith"]), + (76, G["loop"]): ("REDUCE", G["comp -> comp < negable-arith"]), + (76, G["of"]): ("REDUCE", G["comp -> comp < negable-arith"]), + (76, G["<="]): ("REDUCE", G["comp -> comp < negable-arith"]), + (76, G[")"]): ("REDUCE", G["comp -> comp < negable-arith"]), + (76, G["then"]): ("REDUCE", G["comp -> comp < negable-arith"]), + (77, G[")"]): ("SHIFT", 78), + (78, G["."]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (78, G["else"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (78, G["="]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (78, G[","]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (78, G["fi"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (78, G[";"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (78, G["error"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (78, G["loop"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (78, G["@"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (78, G["pool"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (78, G["+"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (78, G["-"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (78, G["in"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (78, G["*"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (78, G["}"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (78, G["/"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (78, G["of"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (78, G["<="]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (78, G["<"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (78, G[")"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (78, G["then"]): ("REDUCE", G["function-call -> id ( expr-list )"]), + (79, G["else"]): ("REDUCE", G["factor -> ~ factor"]), + (79, G["="]): ("REDUCE", G["factor -> ~ factor"]), + (79, G[","]): ("REDUCE", G["factor -> ~ factor"]), + (79, G["fi"]): ("REDUCE", G["factor -> ~ factor"]), + (79, G[";"]): ("REDUCE", G["factor -> ~ factor"]), + (79, G["error"]): ("REDUCE", G["factor -> ~ factor"]), + (79, G["loop"]): ("REDUCE", G["factor -> ~ factor"]), + (79, G["pool"]): ("REDUCE", G["factor -> ~ factor"]), + (79, G["+"]): ("REDUCE", G["factor -> ~ factor"]), + (79, G["-"]): ("REDUCE", G["factor -> ~ factor"]), + (79, G["in"]): ("REDUCE", G["factor -> ~ factor"]), + (79, G["*"]): ("REDUCE", G["factor -> ~ factor"]), + (79, G["}"]): ("REDUCE", G["factor -> ~ factor"]), + (79, G["/"]): ("REDUCE", G["factor -> ~ factor"]), + (79, G["of"]): ("REDUCE", G["factor -> ~ factor"]), + (79, G["<="]): ("REDUCE", G["factor -> ~ factor"]), + (79, G["<"]): ("REDUCE", G["factor -> ~ factor"]), + (79, G[")"]): ("REDUCE", G["factor -> ~ factor"]), + (79, G["then"]): ("REDUCE", G["factor -> ~ factor"]), + (80, G["else"]): ("REDUCE", G["factor -> isvoid factor"]), + (80, G["="]): ("REDUCE", G["factor -> isvoid factor"]), + (80, G[","]): ("REDUCE", G["factor -> isvoid factor"]), + (80, G["fi"]): ("REDUCE", G["factor -> isvoid factor"]), + (80, G[";"]): ("REDUCE", G["factor -> isvoid factor"]), + (80, G["error"]): ("REDUCE", G["factor -> isvoid factor"]), + (80, G["loop"]): ("REDUCE", G["factor -> isvoid factor"]), + (80, G["pool"]): ("REDUCE", G["factor -> isvoid factor"]), + (80, G["+"]): ("REDUCE", G["factor -> isvoid factor"]), + (80, G["-"]): ("REDUCE", G["factor -> isvoid factor"]), + (80, G["in"]): ("REDUCE", G["factor -> isvoid factor"]), + (80, G["*"]): ("REDUCE", G["factor -> isvoid factor"]), + (80, G["}"]): ("REDUCE", G["factor -> isvoid factor"]), + (80, G["/"]): ("REDUCE", G["factor -> isvoid factor"]), + (80, G["of"]): ("REDUCE", G["factor -> isvoid factor"]), + (80, G["<="]): ("REDUCE", G["factor -> isvoid factor"]), + (80, G["<"]): ("REDUCE", G["factor -> isvoid factor"]), + (80, G[")"]): ("REDUCE", G["factor -> isvoid factor"]), + (80, G["then"]): ("REDUCE", G["factor -> isvoid factor"]), + (81, G["of"]): ("SHIFT", 82), + (82, G["id"]): ("SHIFT", 83), + (83, G[":"]): ("SHIFT", 84), + (84, G["type"]): ("SHIFT", 85), + (85, G["=>"]): ("SHIFT", 86), + (86, G["false"]): ("SHIFT", 26), + (86, G["id"]): ("SHIFT", 46), + (86, G["while"]): ("SHIFT", 13), + (86, G["isvoid"]): ("SHIFT", 24), + (86, G["string"]): ("SHIFT", 32), + (86, G["~"]): ("SHIFT", 27), + (86, G["not"]): ("SHIFT", 30), + (86, G["case"]): ("SHIFT", 21), + (86, G["new"]): ("SHIFT", 22), + (86, G["if"]): ("SHIFT", 12), + (86, G["{"]): ("SHIFT", 10), + (86, G["("]): ("SHIFT", 11), + (86, G["let"]): ("SHIFT", 14), + (86, G["true"]): ("SHIFT", 25), + (86, G["int"]): ("SHIFT", 31), + (87, G[";"]): ("SHIFT", 88), + (87, G["error"]): ("SHIFT", 90), + (88, G["id"]): ("SHIFT", 83), + (88, G["esac"]): ("REDUCE", G["case-list -> id : type => expr ;"]), + (89, G["esac"]): ( + "REDUCE", + G["case-list -> id : type => expr ; case-list"], + ), + (90, G["id"]): ("SHIFT", 83), + (90, G["esac"]): ("REDUCE", G["case-list -> id : type => expr error"]), + (91, G["esac"]): ( + "REDUCE", + G["case-list -> id : type => expr error case-list"], + ), + (92, G["esac"]): ("SHIFT", 93), + (93, G["else"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (93, G["in"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (93, G[","]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (93, G["fi"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (93, G[")"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (93, G["}"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (93, G[";"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (93, G["error"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (93, G["loop"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (93, G["of"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (93, G["pool"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (93, G["then"]): ("REDUCE", G["expr -> case expr of case-list esac"]), + (94, G["in"]): ("REDUCE", G["declaration-list -> id : type <- expr"]), + (94, G[","]): ("SHIFT", 95), + (95, G["id"]): ("SHIFT", 15), + (96, G["in"]): ( + "REDUCE", + G["declaration-list -> id : type <- expr , declaration-list"], + ), + (97, G["in"]): ("SHIFT", 98), + (98, G["id"]): ("SHIFT", 46), + (98, G["if"]): ("SHIFT", 12), + (98, G["let"]): ("SHIFT", 14), + (98, G["new"]): ("SHIFT", 22), + (98, G["("]): ("SHIFT", 11), + (98, G["isvoid"]): ("SHIFT", 24), + (98, G["~"]): ("SHIFT", 27), + (98, G["while"]): ("SHIFT", 13), + (98, G["int"]): ("SHIFT", 31), + (98, G["true"]): ("SHIFT", 25), + (98, G["not"]): ("SHIFT", 30), + (98, G["case"]): ("SHIFT", 21), + (98, G["false"]): ("SHIFT", 26), + (98, G["{"]): ("SHIFT", 10), + (98, G["string"]): ("SHIFT", 32), + (99, G["else"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (99, G["in"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (99, G[","]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (99, G["fi"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (99, G["}"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (99, G["pool"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (99, G[";"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (99, G["error"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (99, G["loop"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (99, G["of"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (99, G[")"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (99, G["then"]): ("REDUCE", G["expr -> let declaration-list in expr"]), + (100, G["loop"]): ("SHIFT", 101), + (101, G["id"]): ("SHIFT", 46), + (101, G["let"]): ("SHIFT", 14), + (101, G["isvoid"]): ("SHIFT", 24), + (101, G["string"]): ("SHIFT", 32), + (101, G["~"]): ("SHIFT", 27), + (101, G["while"]): ("SHIFT", 13), + (101, G["new"]): ("SHIFT", 22), + (101, G["if"]): ("SHIFT", 12), + (101, G["("]): ("SHIFT", 11), + (101, G["case"]): ("SHIFT", 21), + (101, G["not"]): ("SHIFT", 30), + (101, G["{"]): ("SHIFT", 10), + (101, G["true"]): ("SHIFT", 25), + (101, G["int"]): ("SHIFT", 31), + (101, G["false"]): ("SHIFT", 26), + (102, G["pool"]): ("SHIFT", 103), + (103, G["else"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (103, G["in"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (103, G[","]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (103, G["fi"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (103, G[")"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (103, G["}"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (103, G[";"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (103, G["error"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (103, G["loop"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (103, G["of"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (103, G["pool"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (103, G["then"]): ("REDUCE", G["expr -> while expr loop expr pool"]), + (104, G["then"]): ("SHIFT", 105), + (105, G["id"]): ("SHIFT", 46), + (105, G["true"]): ("SHIFT", 25), + (105, G["false"]): ("SHIFT", 26), + (105, G["isvoid"]): ("SHIFT", 24), + (105, G["let"]): ("SHIFT", 14), + (105, G["~"]): ("SHIFT", 27), + (105, G["string"]): ("SHIFT", 32), + (105, G["if"]): ("SHIFT", 12), + (105, G["new"]): ("SHIFT", 22), + (105, G["while"]): ("SHIFT", 13), + (105, G["("]): ("SHIFT", 11), + (105, G["case"]): ("SHIFT", 21), + (105, G["not"]): ("SHIFT", 30), + (105, G["{"]): ("SHIFT", 10), + (105, G["int"]): ("SHIFT", 31), + (106, G["else"]): ("SHIFT", 107), + (107, G["false"]): ("SHIFT", 26), + (107, G["~"]): ("SHIFT", 27), + (107, G["id"]): ("SHIFT", 46), + (107, G["string"]): ("SHIFT", 32), + (107, G["{"]): ("SHIFT", 10), + (107, G["let"]): ("SHIFT", 14), + (107, G["if"]): ("SHIFT", 12), + (107, G["new"]): ("SHIFT", 22), + (107, G["("]): ("SHIFT", 11), + (107, G["while"]): ("SHIFT", 13), + (107, G["not"]): ("SHIFT", 30), + (107, G["case"]): ("SHIFT", 21), + (107, G["int"]): ("SHIFT", 31), + (107, G["true"]): ("SHIFT", 25), + (107, G["isvoid"]): ("SHIFT", 24), + (108, G["fi"]): ("SHIFT", 109), + (109, G["."]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (109, G["else"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (109, G["="]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (109, G[","]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (109, G["fi"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (109, G[";"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (109, G["error"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (109, G["loop"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (109, G["@"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (109, G["pool"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (109, G["+"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (109, G["-"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (109, G["in"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (109, G["*"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (109, G["}"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (109, G["/"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (109, G["of"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (109, G["<="]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (109, G["<"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (109, G[")"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (109, G["then"]): ("REDUCE", G["atom -> if expr then expr else expr fi"]), + (110, G[")"]): ("SHIFT", 111), + (111, G["."]): ("REDUCE", G["atom -> ( expr )"]), + (111, G["else"]): ("REDUCE", G["atom -> ( expr )"]), + (111, G["="]): ("REDUCE", G["atom -> ( expr )"]), + (111, G[","]): ("REDUCE", G["atom -> ( expr )"]), + (111, G["fi"]): ("REDUCE", G["atom -> ( expr )"]), + (111, G[";"]): ("REDUCE", G["atom -> ( expr )"]), + (111, G["error"]): ("REDUCE", G["atom -> ( expr )"]), + (111, G["loop"]): ("REDUCE", G["atom -> ( expr )"]), + (111, G["@"]): ("REDUCE", G["atom -> ( expr )"]), + (111, G["pool"]): ("REDUCE", G["atom -> ( expr )"]), + (111, G["+"]): ("REDUCE", G["atom -> ( expr )"]), + (111, G["-"]): ("REDUCE", G["atom -> ( expr )"]), + (111, G["in"]): ("REDUCE", G["atom -> ( expr )"]), + (111, G["*"]): ("REDUCE", G["atom -> ( expr )"]), + (111, G["}"]): ("REDUCE", G["atom -> ( expr )"]), + (111, G["/"]): ("REDUCE", G["atom -> ( expr )"]), + (111, G["of"]): ("REDUCE", G["atom -> ( expr )"]), + (111, G["<="]): ("REDUCE", G["atom -> ( expr )"]), + (111, G["<"]): ("REDUCE", G["atom -> ( expr )"]), + (111, G[")"]): ("REDUCE", G["atom -> ( expr )"]), + (111, G["then"]): ("REDUCE", G["atom -> ( expr )"]), + (112, G["}"]): ("SHIFT", 113), + (113, G["else"]): ("REDUCE", G["expr -> { block }"]), + (113, G["in"]): ("REDUCE", G["expr -> { block }"]), + (113, G[","]): ("REDUCE", G["expr -> { block }"]), + (113, G["fi"]): ("REDUCE", G["expr -> { block }"]), + (113, G[")"]): ("REDUCE", G["expr -> { block }"]), + (113, G["}"]): ("REDUCE", G["expr -> { block }"]), + (113, G[";"]): ("REDUCE", G["expr -> { block }"]), + (113, G["error"]): ("REDUCE", G["expr -> { block }"]), + (113, G["loop"]): ("REDUCE", G["expr -> { block }"]), + (113, G["of"]): ("REDUCE", G["expr -> { block }"]), + (113, G["pool"]): ("REDUCE", G["expr -> { block }"]), + (113, G["then"]): ("REDUCE", G["expr -> { block }"]), + (114, G[";"]): ("SHIFT", 115), + (114, G["error"]): ("SHIFT", 117), + (115, G["false"]): ("SHIFT", 26), + (115, G["id"]): ("SHIFT", 46), + (115, G["while"]): ("SHIFT", 13), + (115, G["isvoid"]): ("SHIFT", 24), + (115, G["string"]): ("SHIFT", 32), + (115, G["~"]): ("SHIFT", 27), + (115, G["not"]): ("SHIFT", 30), + (115, G["case"]): ("SHIFT", 21), + (115, G["new"]): ("SHIFT", 22), + (115, G["if"]): ("SHIFT", 12), + (115, G["{"]): ("SHIFT", 10), + (115, G["("]): ("SHIFT", 11), + (115, G["}"]): ("REDUCE", G["block -> expr ;"]), + (115, G["let"]): ("SHIFT", 14), + (115, G["true"]): ("SHIFT", 25), + (115, G["int"]): ("SHIFT", 31), + (116, G["}"]): ("REDUCE", G["block -> expr ; block"]), + (117, G["}"]): ("REDUCE", G["block -> expr error"]), + (117, G["false"]): ("SHIFT", 26), + (117, G["id"]): ("SHIFT", 46), + (117, G["while"]): ("SHIFT", 13), + (117, G["isvoid"]): ("SHIFT", 24), + (117, G["string"]): ("SHIFT", 32), + (117, G["~"]): ("SHIFT", 27), + (117, G["not"]): ("SHIFT", 30), + (117, G["case"]): ("SHIFT", 21), + (117, G["new"]): ("SHIFT", 22), + (117, G["if"]): ("SHIFT", 12), + (117, G["{"]): ("SHIFT", 10), + (117, G["("]): ("SHIFT", 11), + (117, G["let"]): ("SHIFT", 14), + (117, G["true"]): ("SHIFT", 25), + (117, G["int"]): ("SHIFT", 31), + (118, G["}"]): ("REDUCE", G["block -> expr error block"]), + (119, G["}"]): ("SHIFT", 120), + (120, G[";"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), + (120, G["error"]): ("REDUCE", G["method -> id ( ) : type { expr }"]), + (121, G[":"]): ("SHIFT", 122), + (122, G["type"]): ("SHIFT", 123), + (123, G[","]): ("SHIFT", 124), + (123, G[")"]): ("REDUCE", G["param-list -> id : type"]), + (124, G["id"]): ("SHIFT", 121), + (125, G[")"]): ("REDUCE", G["param-list -> id : type , param-list"]), + (126, G[")"]): ("SHIFT", 127), + (127, G[":"]): ("SHIFT", 128), + (128, G["type"]): ("SHIFT", 129), + (129, G["{"]): ("SHIFT", 130), + (130, G["while"]): ("SHIFT", 13), + (130, G["false"]): ("SHIFT", 26), + (130, G["id"]): ("SHIFT", 46), + (130, G["case"]): ("SHIFT", 21), + (130, G["not"]): ("SHIFT", 30), + (130, G["string"]): ("SHIFT", 32), + (130, G["{"]): ("SHIFT", 10), + (130, G["isvoid"]): ("SHIFT", 24), + (130, G["if"]): ("SHIFT", 12), + (130, G["new"]): ("SHIFT", 22), + (130, G["("]): ("SHIFT", 11), + (130, G["~"]): ("SHIFT", 27), + (130, G["let"]): ("SHIFT", 14), + (130, G["int"]): ("SHIFT", 31), + (130, G["true"]): ("SHIFT", 25), + (131, G["}"]): ("SHIFT", 132), + (132, G[";"]): ("REDUCE", G["method -> id ( param-list ) : type { expr }"]), + (132, G["error"]): ( + "REDUCE", + G["method -> id ( param-list ) : type { expr }"], + ), + (133, G["type"]): ("SHIFT", 134), + (134, G[";"]): ("REDUCE", G["attribute -> id : type"]), + (134, G["error"]): ("REDUCE", G["attribute -> id : type"]), + (134, G["<-"]): ("SHIFT", 135), + (135, G["false"]): ("SHIFT", 26), + (135, G["id"]): ("SHIFT", 46), + (135, G["while"]): ("SHIFT", 13), + (135, G["isvoid"]): ("SHIFT", 24), + (135, G["string"]): ("SHIFT", 32), + (135, G["~"]): ("SHIFT", 27), + (135, G["not"]): ("SHIFT", 30), + (135, G["case"]): ("SHIFT", 21), + (135, G["new"]): ("SHIFT", 22), + (135, G["if"]): ("SHIFT", 12), + (135, G["{"]): ("SHIFT", 10), + (135, G["("]): ("SHIFT", 11), + (135, G["let"]): ("SHIFT", 14), + (135, G["true"]): ("SHIFT", 25), + (135, G["int"]): ("SHIFT", 31), + (136, G[";"]): ("REDUCE", G["attribute -> id : type <- expr"]), + (136, G["error"]): ("REDUCE", G["attribute -> id : type <- expr"]), + (137, G["}"]): ("SHIFT", 138), + (138, G[";"]): ("REDUCE", G["class-def -> class type { feature-list }"]), + (139, G["error"]): ("SHIFT", 147), + (139, G[";"]): ("SHIFT", 140), + (140, G["id"]): ("SHIFT", 4), + (140, G["}"]): ("REDUCE", G["feature-list -> e"]), + (141, G["}"]): ("REDUCE", G["feature-list -> attribute ; feature-list"]), + (142, G[";"]): ("SHIFT", 143), + (142, G["error"]): ("SHIFT", 145), + (143, G["id"]): ("SHIFT", 4), + (143, G["}"]): ("REDUCE", G["feature-list -> e"]), + (144, G["}"]): ("REDUCE", G["feature-list -> method ; feature-list"]), + (145, G["id"]): ("SHIFT", 4), + (145, G["}"]): ("REDUCE", G["feature-list -> e"]), + (146, G["}"]): ("REDUCE", G["feature-list -> method error feature-list"]), + (147, G["id"]): ("SHIFT", 4), + (147, G["}"]): ("REDUCE", G["feature-list -> e"]), + (148, G["}"]): ( + "REDUCE", + G["feature-list -> attribute error feature-list"], + ), + (149, G["type"]): ("SHIFT", 150), + (150, G["{"]): ("SHIFT", 151), + (151, G["id"]): ("SHIFT", 4), + (151, G["}"]): ("REDUCE", G["feature-list -> e"]), + (152, G["}"]): ("SHIFT", 153), + (153, G[";"]): ( + "REDUCE", + G["class-def -> class type inherits type { feature-list }"], + ), + (154, G["$"]): ("OK", None), + (155, G["$"]): ("REDUCE", G["program -> class-list"]), + (156, G[";"]): ("SHIFT", 157), + (157, G["class"]): ("SHIFT", 1), + (157, G["$"]): ("REDUCE", G["class-list -> class-def ;"]), + (158, G["$"]): ("REDUCE", G["class-list -> class-def ; class-list"]), + } + + @staticmethod + def __goto_table(): + return { + (0, G["program"]): 154, + (0, G["class-list"]): 155, + (0, G["class-def"]): 156, + (3, G["attribute"]): 139, + (3, G["method"]): 142, + (3, G["feature-list"]): 137, + (5, G["param-list"]): 126, + (9, G["comp"]): 50, + (9, G["function-call"]): 33, + (9, G["term"]): 59, + (9, G["arith"]): 62, + (9, G["negable-comp"]): 49, + (9, G["atom"]): 42, + (9, G["factor"]): 58, + (9, G["expr"]): 119, + (10, G["term"]): 59, + (10, G["atom"]): 42, + (10, G["expr"]): 114, + (10, G["arith"]): 62, + (10, G["comp"]): 50, + (10, G["function-call"]): 33, + (10, G["block"]): 112, + (10, G["factor"]): 58, + (10, G["negable-comp"]): 49, + (11, G["comp"]): 50, + (11, G["negable-comp"]): 49, + (11, G["function-call"]): 33, + (11, G["atom"]): 42, + (11, G["term"]): 59, + (11, G["arith"]): 62, + (11, G["factor"]): 58, + (11, G["expr"]): 110, + (12, G["comp"]): 50, + (12, G["function-call"]): 33, + (12, G["term"]): 59, + (12, G["arith"]): 62, + (12, G["negable-comp"]): 49, + (12, G["atom"]): 42, + (12, G["expr"]): 104, + (12, G["factor"]): 58, + (13, G["comp"]): 50, + (13, G["atom"]): 42, + (13, G["negable-comp"]): 49, + (13, G["expr"]): 100, + (13, G["term"]): 59, + (13, G["arith"]): 62, + (13, G["function-call"]): 33, + (13, G["factor"]): 58, + (14, G["declaration-list"]): 97, + (18, G["declaration-list"]): 19, + (20, G["atom"]): 42, + (20, G["term"]): 59, + (20, G["comp"]): 50, + (20, G["arith"]): 62, + (20, G["function-call"]): 33, + (20, G["expr"]): 94, + (20, G["factor"]): 58, + (20, G["negable-comp"]): 49, + (21, G["arith"]): 62, + (21, G["comp"]): 50, + (21, G["atom"]): 42, + (21, G["expr"]): 81, + (21, G["term"]): 59, + (21, G["factor"]): 58, + (21, G["negable-comp"]): 49, + (21, G["function-call"]): 33, + (24, G["function-call"]): 33, + (24, G["factor"]): 80, + (24, G["atom"]): 42, + (27, G["function-call"]): 33, + (27, G["factor"]): 79, + (27, G["atom"]): 42, + (29, G["not-empty-expr-list"]): 65, + (29, G["comp"]): 50, + (29, G["expr"]): 66, + (29, G["function-call"]): 33, + (29, G["atom"]): 42, + (29, G["term"]): 59, + (29, G["factor"]): 58, + (29, G["arith"]): 62, + (29, G["negable-comp"]): 49, + (29, G["expr-list"]): 77, + (30, G["function-call"]): 33, + (30, G["factor"]): 58, + (30, G["comp"]): 34, + (30, G["term"]): 59, + (30, G["arith"]): 62, + (30, G["atom"]): 42, + (35, G["function-call"]): 33, + (35, G["factor"]): 58, + (35, G["term"]): 59, + (35, G["arith"]): 53, + (35, G["negable-arith"]): 76, + (35, G["atom"]): 42, + (36, G["function-call"]): 33, + (36, G["factor"]): 58, + (36, G["term"]): 59, + (36, G["arith"]): 37, + (36, G["atom"]): 42, + (38, G["function-call"]): 33, + (38, G["factor"]): 58, + (38, G["term"]): 39, + (38, G["atom"]): 42, + (40, G["function-call"]): 33, + (40, G["atom"]): 42, + (40, G["factor"]): 41, + (45, G["not-empty-expr-list"]): 65, + (45, G["comp"]): 50, + (45, G["expr"]): 66, + (45, G["function-call"]): 33, + (45, G["atom"]): 42, + (45, G["expr-list"]): 63, + (45, G["term"]): 59, + (45, G["factor"]): 58, + (45, G["arith"]): 62, + (45, G["negable-comp"]): 49, + (47, G["function-call"]): 33, + (47, G["comp"]): 50, + (47, G["arith"]): 62, + (47, G["expr"]): 48, + (47, G["atom"]): 42, + (47, G["term"]): 59, + (47, G["factor"]): 58, + (47, G["negable-comp"]): 49, + (51, G["function-call"]): 33, + (51, G["factor"]): 58, + (51, G["term"]): 59, + (51, G["arith"]): 53, + (51, G["atom"]): 42, + (51, G["negable-arith"]): 52, + (54, G["function-call"]): 33, + (54, G["factor"]): 58, + (54, G["term"]): 55, + (54, G["atom"]): 42, + (56, G["function-call"]): 33, + (56, G["factor"]): 57, + (56, G["atom"]): 42, + (60, G["negable-arith"]): 61, + (60, G["function-call"]): 33, + (60, G["factor"]): 58, + (60, G["term"]): 59, + (60, G["arith"]): 53, + (60, G["atom"]): 42, + (67, G["comp"]): 50, + (67, G["expr"]): 66, + (67, G["function-call"]): 33, + (67, G["atom"]): 42, + (67, G["term"]): 59, + (67, G["factor"]): 58, + (67, G["arith"]): 62, + (67, G["negable-comp"]): 49, + (67, G["not-empty-expr-list"]): 68, + (73, G["not-empty-expr-list"]): 65, + (73, G["comp"]): 50, + (73, G["expr-list"]): 74, + (73, G["expr"]): 66, + (73, G["function-call"]): 33, + (73, G["atom"]): 42, + (73, G["term"]): 59, + (73, G["factor"]): 58, + (73, G["arith"]): 62, + (73, G["negable-comp"]): 49, + (82, G["case-list"]): 92, + (86, G["term"]): 59, + (86, G["atom"]): 42, + (86, G["arith"]): 62, + (86, G["comp"]): 50, + (86, G["function-call"]): 33, + (86, G["expr"]): 87, + (86, G["factor"]): 58, + (86, G["negable-comp"]): 49, + (88, G["case-list"]): 89, + (90, G["case-list"]): 91, + (95, G["declaration-list"]): 96, + (98, G["function-call"]): 33, + (98, G["comp"]): 50, + (98, G["arith"]): 62, + (98, G["atom"]): 42, + (98, G["term"]): 59, + (98, G["factor"]): 58, + (98, G["negable-comp"]): 49, + (98, G["expr"]): 99, + (101, G["arith"]): 62, + (101, G["comp"]): 50, + (101, G["atom"]): 42, + (101, G["term"]): 59, + (101, G["function-call"]): 33, + (101, G["expr"]): 102, + (101, G["factor"]): 58, + (101, G["negable-comp"]): 49, + (105, G["expr"]): 106, + (105, G["atom"]): 42, + (105, G["arith"]): 62, + (105, G["comp"]): 50, + (105, G["term"]): 59, + (105, G["factor"]): 58, + (105, G["function-call"]): 33, + (105, G["negable-comp"]): 49, + (107, G["arith"]): 62, + (107, G["comp"]): 50, + (107, G["atom"]): 42, + (107, G["term"]): 59, + (107, G["factor"]): 58, + (107, G["function-call"]): 33, + (107, G["expr"]): 108, + (107, G["negable-comp"]): 49, + (115, G["term"]): 59, + (115, G["atom"]): 42, + (115, G["expr"]): 114, + (115, G["arith"]): 62, + (115, G["comp"]): 50, + (115, G["block"]): 116, + (115, G["function-call"]): 33, + (115, G["factor"]): 58, + (115, G["negable-comp"]): 49, + (117, G["term"]): 59, + (117, G["atom"]): 42, + (117, G["expr"]): 114, + (117, G["arith"]): 62, + (117, G["comp"]): 50, + (117, G["function-call"]): 33, + (117, G["factor"]): 58, + (117, G["negable-comp"]): 49, + (117, G["block"]): 118, + (124, G["param-list"]): 125, + (130, G["comp"]): 50, + (130, G["function-call"]): 33, + (130, G["term"]): 59, + (130, G["arith"]): 62, + (130, G["negable-comp"]): 49, + (130, G["atom"]): 42, + (130, G["factor"]): 58, + (130, G["expr"]): 131, + (135, G["term"]): 59, + (135, G["atom"]): 42, + (135, G["arith"]): 62, + (135, G["comp"]): 50, + (135, G["expr"]): 136, + (135, G["function-call"]): 33, + (135, G["factor"]): 58, + (135, G["negable-comp"]): 49, + (140, G["feature-list"]): 141, + (140, G["attribute"]): 139, + (140, G["method"]): 142, + (143, G["attribute"]): 139, + (143, G["method"]): 142, + (143, G["feature-list"]): 144, + (145, G["attribute"]): 139, + (145, G["method"]): 142, + (145, G["feature-list"]): 146, + (147, G["feature-list"]): 148, + (147, G["attribute"]): 139, + (147, G["method"]): 142, + (151, G["feature-list"]): 152, + (151, G["attribute"]): 139, + (151, G["method"]): 142, + (157, G["class-def"]): 156, + (157, G["class-list"]): 158, + } diff --git a/src/cool/semantics/__init__.py b/src/cool/semantics/__init__.py new file mode 100644 index 000000000..699114073 --- /dev/null +++ b/src/cool/semantics/__init__.py @@ -0,0 +1,12 @@ +"""This module contains definitions of classes for make different travels through the AST of a cool program. All +classes defined here follows the visitor pattern using the module visitor, with this we can get a more decoupled +inspection. """ + +from .formatter import CodeBuilder, Formatter +from .overridden import OverriddenMethodChecker, topological_sorting +from .position_assigner import PositionAssigner +from .type_builder_for_features import TypeBuilderForFeatures +from .type_builder_for_inheritance import TypeBuilderForInheritance +from .type_inference import InferenceChecker +from .type_checker import TypeChecker +from .type_collector import TypeCollector diff --git a/src/cool/semantics/formatter.py b/src/cool/semantics/formatter.py new file mode 100644 index 000000000..f4c23e4d1 --- /dev/null +++ b/src/cool/semantics/formatter.py @@ -0,0 +1,267 @@ +import cool.semantics.utils.astnodes as cool +import cool.visitor as visitor + + +class CodeBuilder: + @visitor.on("node") + def visit(self, node, tabs): + pass + + @visitor.when(cool.ProgramNode) + def visit(self, node: cool.ProgramNode, tabs: int = 0): + return "\n\n".join(self.visit(child, tabs) for child in node.declarations) + + @visitor.when(cool.ClassDeclarationNode) + def visit(self, node: cool.ClassDeclarationNode, tabs: int = 0): + parent = "" if node.parent is None else f"inherits {node.parent} " + return ( + f"class {node.id} {parent}{{\n" + + "\n\n".join(self.visit(child, tabs + 1) for child in node.features) + + "\n}" + ) + + @visitor.when(cool.AttrDeclarationNode) + def visit(self, node: cool.AttrDeclarationNode, tabs: int = 0): + expr = f" <- {self.visit(node.expr, 0)}" if node.expr is not None else "" + return " " * tabs + f"{node.id}: {node.type}{expr};" + + @visitor.when(cool.MethodDeclarationNode) + def visit(self, node: cool.MethodDeclarationNode, tabs: int = 0): + params = ", ".join(": ".join(param) for param in node.params) + ans = " " * tabs + f"{node.id} ({params}): {node.return_type}" + body = self.visit(node.body, tabs + 1) + return f"{ans} {{\n{body}\n }};" + + @visitor.when(cool.LetNode) + def visit(self, node: cool.LetNode, tabs: int = 0): + declarations = [] + for _id, _type, _expr in node.declarations: + if _expr is not None: + declarations.append(f"{_id}: {_type} <- {self.visit(_expr)}") + else: + declarations.append(f"{_id} : {_type}") + declarations = (",\n" + " " * (tabs + 1)).join(declarations) + return ( + " " * tabs + f"let {declarations} in\n{self.visit(node.expr, tabs + 1)}" + ) + + @visitor.when(cool.AssignNode) + def visit(self, node: cool.AssignNode, tabs: int = 0): + expr = self.visit(node.expr).replace("\n", "\n" + " " * tabs) + return " " * tabs + f"{node.id} <- {expr}" + + @visitor.when(cool.BlockNode) + def visit(self, node: cool.BlockNode, tabs: int = 0): + body = ";\n".join(self.visit(child, tabs + 1) for child in node.expressions) + if body: + body += ";" + return " " * tabs + f"{{\n{body}\n" + " " * tabs + "}" + + @visitor.when(cool.ConditionalNode) + def visit(self, node: cool.ConditionalNode, tabs: int = 0): + ifx = self.visit(node.if_expr) + then = self.visit(node.then_expr, tabs + 1) + elsex = self.visit(node.else_expr, tabs + 1) + + return ( + " " * tabs + + f"if {ifx}\n" + + " " * tabs + + f"then\n{then}\n" + + " " * tabs + + f"else\n{elsex}\n" + + " " * tabs + + "fi" + ) + + @visitor.when(cool.WhileNode) + def visit(self, node: cool.WhileNode, tabs: int = 0): + condition = self.visit(node.condition, 0) + body = self.visit(node.body, tabs + 1) + + return ( + " " * tabs + + f"while {condition} loop\n {body}\n" + + " " * tabs + + "pool" + ) + + @visitor.when(cool.SwitchCaseNode) + def visit(self, node: cool.SwitchCaseNode, tabs: int = 0): + cases = [] + for _id, _type, _expr in node.cases: + expr = self.visit(_expr, tabs + 2) + cases.append(" " * (tabs + 1) + f"{_id} : {_type} =>\n{expr};") + expr = self.visit(node.expr) + cases = "\n".join(cases) + + return " " * tabs + f"case {expr} of\n{cases}\n" + " " * tabs + "esac" + + @visitor.when(cool.MethodCallNode) + def visit(self, node: cool.MethodCallNode, tabs: int = 0): + obj = f"{self.visit(node.obj, 0)}." if node.obj is not None else "" + return ( + " " * tabs + + f'{obj}{node.id}({", ".join(self.visit(arg, 0) for arg in node.args)})' + ) + + @visitor.when(cool.BinaryNode) + def visit(self, node: cool.BinaryNode, tabs: int = 0): + left = ( + self.visit(node.left) + if isinstance(node.left, cool.BinaryNode) + else self.visit(node.left, tabs) + ) + right = self.visit(node.right) + return f"{left} {node.operation} {right}" + + @visitor.when(cool.AtomicNode) + def visit(self, node: cool.AtomicNode, tabs: int = 0): + lex = node.lex + return " " * tabs + f"{lex}" + + @visitor.when(cool.InstantiateNode) + def visit(self, node: cool.InstantiateNode, tabs: int = 0): + return " " * tabs + f"(new {node.lex})" + + +class Formatter: + @visitor.on("node") + def visit(self, node, tabs): + pass + + @visitor.when(cool.ProgramNode) + def visit(self, node: cool.ProgramNode, tabs: int = 0): + ans = " " * tabs + f"\\__ProgramNode [ ... ]" + statements = "\n".join( + self.visit(child, tabs + 1) for child in node.declarations + ) + return f"{ans}\n{statements}" + + @visitor.when(cool.ClassDeclarationNode) + def visit(self, node: cool.ClassDeclarationNode, tabs: int = 0): + parent = "" if node.parent is None else f": {node.parent}" + ans = ( + " " * tabs + + f"\\__ClassDeclarationNode: class {node.id} {parent} {{ ... }}" + ) + features = "\n".join(self.visit(child, tabs + 1) for child in node.features) + return f"{ans}\n{features}" + + @visitor.when(cool.AttrDeclarationNode) + def visit(self, node: cool.AttrDeclarationNode, tabs: int = 0): + ans = " " * tabs + f"\\__AttrDeclarationNode: {node.id} : {node.type}" + return f"{ans}" + + @visitor.when(cool.MethodDeclarationNode) + def visit(self, node: cool.MethodDeclarationNode, tabs: int = 0): + params = ", ".join(":".join(param) for param in node.params) + ans = ( + " " * tabs + + f"\\__FuncDeclarationNode: {node.id}({params}) : {node.return_type} -> " + ) + body = self.visit(node.body, tabs + 1) + return f"{ans}\n{body}" + + @visitor.when(cool.LetNode) + def visit(self, node: cool.LetNode, tabs: int = 0): + declarations = [] + for _id, _type, _expr in node.declarations: + if _expr is not None: + declarations.append( + " " * tabs + + f"\\__VarDeclarationNode: {_id}: {_type} <-\n{self.visit(_expr, tabs + 1)}" + ) + else: + declarations.append( + " " * tabs + f"\\__VarDeclarationNode: {_id} : {_type}" + ) + + declarations = "\n".join(declarations) + ans = " " * tabs + f"\\__LetNode: let" + expr = self.visit(node.expr, tabs + 2) + return f"{ans}\n {declarations}\n" + " " * (tabs + 1) + "in\n" + f"{expr}" + + @visitor.when(cool.AssignNode) + def visit(self, node: cool.AssignNode, tabs: int = 0): + ans = " " * tabs + f"\\__AssignNode: {node.id} <- " + expr = self.visit(node.expr, tabs + 1) + return f"{ans}\n{expr}" + + @visitor.when(cool.BlockNode) + def visit(self, node: cool.BlockNode, tabs: int = 0): + ans = " " * tabs + f"\\__BlockNode:" + body = "\n".join(self.visit(child, tabs + 1) for child in node.expressions) + return f"{ans}\n{body}" + + @visitor.when(cool.ConditionalNode) + def visit(self, node: cool.ConditionalNode, tabs: int = 0): + ifx = self.visit(node.if_expr, tabs + 2) + then = self.visit(node.then_expr, tabs + 2) + elsex = self.visit(node.else_expr, tabs + 2) + + return "\n".join( + [ + " " * tabs + + f"\\__IfThenElseNode: if then else fi", + " " * (tabs + 1) + f"\\__if \n{ifx}", + " " * (tabs + 1) + f"\\__then \n{then}", + " " * (tabs + 1) + f"\\__else \n{elsex}", + ] + ) + + @visitor.when(cool.WhileNode) + def visit(self, node: cool.WhileNode, tabs: int = 0): + condition = self.visit(node.condition, tabs + 2) + body = self.visit(node.body, tabs + 2) + + return "\n".join( + [ + " " * tabs + f"\\__WhileNode: while loop pool", + " " * (tabs + 1) + f"\\__while \n{condition}", + " " * (tabs + 1) + f"\\__loop \n{body}", + ] + ) + + @visitor.when(cool.SwitchCaseNode) + def visit(self, node: cool.SwitchCaseNode, tabs: int = 0): + cases = [] + for _id, _type, _expr in node.cases: + expr = self.visit(_expr, tabs + 3) + cases.append(" " * tabs + f"\\__CaseNode: {_id} : {_type} =>\n{expr}") + expr = self.visit(node.expr, tabs + 2) + cases = "\n".join(cases) + + return ( + "\n".join( + [ + " " * tabs + + f"\\__SwitchCaseNode: case of [ ... ] esac", + " " * (tabs + 1) + f"\\__case \n{expr} of", + ] + ) + + "\n" + + cases + ) + + @visitor.when(cool.MethodCallNode) + def visit(self, node: cool.MethodCallNode, tabs: int = 0): + obj = self.visit(node.obj, tabs + 1) + ans = " " * tabs + f"\\__CallNode: .{node.id}(, ..., )" + args = "\n".join(self.visit(arg, tabs + 1) for arg in node.args) + return f"{ans}\n{obj}\n{args}" + + @visitor.when(cool.BinaryNode) + def visit(self, node: cool.BinaryNode, tabs: int = 0): + ans = " " * tabs + f"\\__ {node.__class__.__name__} " + left = self.visit(node.left, tabs + 1) + right = self.visit(node.right, tabs + 1) + return f"{ans}\n{left}\n{right}" + + @visitor.when(cool.AtomicNode) + def visit(self, node: cool.AtomicNode, tabs: int = 0): + return " " * tabs + f"\\__ {node.__class__.__name__}: {node.lex}" + + @visitor.when(cool.InstantiateNode) + def visit(self, node: cool.InstantiateNode, tabs: int = 0): + return " " * tabs + f"\\__ InstantiateNode: new {node.lex}()" diff --git a/src/cool/semantics/overridden.py b/src/cool/semantics/overridden.py new file mode 100644 index 000000000..6fae12c83 --- /dev/null +++ b/src/cool/semantics/overridden.py @@ -0,0 +1,149 @@ +from typing import List, Dict, Optional, OrderedDict + +import cool.semantics.utils.astnodes as cool +import cool.semantics.utils.errors as err +import cool.visitor as visitor +from cool.semantics.utils.scope import Context, ErrorType, Type, SemanticError + + +def topological_sorting( + program_node: cool.ProgramNode, context: Context, errors: List[str] +) -> bool: + """Set an order in the program node of de ast such that for all class A with parent B, class B is before A in the + list, if in the process is detected a cycle an error is added to the `error` parameter + + :param program_node: Root of the first AST of the program + + :param context: Context With all collected and building types + + :param errors: The error list + + :return: a new AST where all declared class are in topological order""" + + types = context.types + + contains_dependency_errors = False + graph: Dict[str, List[str]] = { + name: [] for name in types if name not in ("SELF_TYPE", "AUTO_TYPE") + } + declarations = {d.id: d for d in program_node.declarations} + + for name, typex in types.items(): + if name in ("Object", "SELF_TYPE", "AUTO_TYPE") or typex.parent is None: + continue + graph[typex.parent.name].append(name) + + visited = set() + stack = ["Object"] + + while stack: + current_name = stack.pop() + + if current_name in visited: + line, column = declarations[current_name].parent_position + errors.append( + err.CYCLIC_DEPENDENCY % (line, column, current_name, current_name) + ) + contains_dependency_errors = True + + visited.add(current_name) + stack += graph[current_name] + + if len(visited) != len(graph): + types_names = set( + x for x in context.types if x not in ("SELF_TYPE", "AUTO_TYPE") + ) + exclude_type_names = types_names - visited + + # Select the last declared class that belongs to the cycle + reference_class = max(exclude_type_names, key=lambda x: declarations[x].line) + line, column = declarations[reference_class].parent_position + errors.append( + err.CYCLIC_DEPENDENCY % (line, column, reference_class, reference_class) + ) + + contains_dependency_errors = True + + return contains_dependency_errors + + +class OverriddenMethodChecker: + """This visitor for validate the signature of the overridden methods + + Params + ------ + - syntactic_and_semantic_errors: List[str] is a list of syntactic_and_semantic_errors detected in the ast travel + - context: Context the context for keeping the classes + - current_type: Optional[Type] is the current type in the building process""" + + def __init__(self, context: Context, errors: List[str]): + self.context: Context = context + self.current_type: Optional[Type] = None + self.errors: List[str] = errors + + @visitor.on("node") + def visit(self, node): + pass + + @visitor.when(cool.ProgramNode) + def visit(self, node: cool.ProgramNode): + for declaration in node.declarations: + self.visit(declaration) + + @visitor.when(cool.ClassDeclarationNode) + def visit(self, node: cool.ClassDeclarationNode): + self.current_type = self.context.get_type(node.id) + + for feature in node.features: + if isinstance(feature, cool.MethodDeclarationNode): + self.visit(feature) + + @visitor.when(cool.AttrDeclarationNode) + def visit(self, node: cool.AttrDeclarationNode): + try: + attribute, owner = self.current_type.parent.get_attribute(node.id) + self.errors.append( + err.ATTRIBUTE_OVERRIDE_ERROR % (attribute.name, owner.name) + ) + except SemanticError: + pass + + @visitor.when(cool.MethodDeclarationNode) + def visit(self, node: cool.MethodDeclarationNode): + # TODO: Change the comparison overriding + current_method = self.current_type.get_method(node.id) + try: + original_method, _ = self.current_type.parent.get_method( + node.id, get_owner=True + ) + + current_count = len(current_method.param_types) + original_count = len(original_method.param_types) + if current_count != original_count: + line, column = node.line, node.column + self.errors.append( + err.METHOD_OVERRIDE_PARAM_ERROR + % (line, column, node.id, original_count, current_count) + ) + + count = min(original_count, current_count) + for i in range(count): + current_type = current_method.param_types[i].name + original_type = original_method.param_types[i].name + if current_type != original_type: + line, column = node.param_types_positions[i] + self.errors.append( + err.METHOD_OVERRIDE_PARAM_ERROR + % (line, column, node.id, current_type, original_method) + ) + + current_return_type = current_method.return_type.name + original_return_type = original_method.return_type.name + if current_return_type != original_return_type: + line, column = node.return_type_position + self.errors.append( + err.METHOD_OVERRIDE_RETURN_ERROR + % (line, column, node.id, current_return_type, original_return_type) + ) + except SemanticError: + pass diff --git a/src/cool/semantics/position_assigner.py b/src/cool/semantics/position_assigner.py new file mode 100644 index 000000000..a4fe8d71f --- /dev/null +++ b/src/cool/semantics/position_assigner.py @@ -0,0 +1,481 @@ +from typing import List + +import cool.semantics.utils.astnodes as ast +import cool.visitor as visitor +from pyjapt import Token + + +class PositionAssigner: + def __init__(self, tokens: List[Token]): + self.position = 0 + self.tokens = tokens + + self.opar = 0 + + def inc_position(self, count: int = 1): + self.position += count + + @visitor.on("node") + def visit(self, node): + pass + + @visitor.when(ast.ProgramNode) + def visit(self, node: ast.ProgramNode): + + for declaration in node.declarations: + self.visit(declaration) + self.inc_position() + + first_declaration = node.declarations[ + 0 + ] # There is always one or more declarations + node.set_main_position(first_declaration.line, first_declaration.column) + + @visitor.when(ast.ClassDeclarationNode) + def visit(self, node: ast.ClassDeclarationNode): + """ + * + class type [inherits type] { feature-list } + """ + token = self.tokens[self.position] + assert ( + token.lex.lower() == "class" + ), f'{token.line, token.column} Expected "class" instead of "{token.lex}" in {node.id}' + + token = self.tokens[self.position + 1] + node.set_main_position(token.line, token.column) + + if node.parent is not None: + token = self.tokens[self.position + 3] + node.parent_position = token.line, token.column + + count = 3 if node.parent is None else 5 + self.inc_position(count) + + for feature in node.features: + self.visit(feature) + + token = self.tokens[self.position] + assert ( + token.lex == ";" + ), f'Expected ";" instead of "{token.lex}" in {feature.id} of class {node.id}' + + self.inc_position() # ends after `;` + + self.inc_position() # ends after `}` + + @visitor.when(ast.AttrDeclarationNode) + def visit(self, node: ast.AttrDeclarationNode): + """ + * + id : type [<- expr] + """ + token = self.tokens[self.position] + node.set_main_position(token.line, token.column) + + token = self.tokens[self.position + 2] + node.type_position = token.line, token.column + + if node.expr is not None: + self.inc_position(4) # ends after `<-` + + token = self.tokens[self.position] + node.expr_position = token.line, token.column + + self.visit(node.expr) + + token = self.tokens[self.position] + return + + self.inc_position(3) + + @visitor.when(ast.MethodDeclarationNode) + def visit(self, node: ast.MethodDeclarationNode): + """ + * + id ( [params] ) : type { expr } + """ + token = self.tokens[self.position] + node.set_main_position(token.line, token.column) + + self.inc_position(2) # ends after `(` + + for i, _ in enumerate(node.params): + # * + # id : type , + self.inc_position(2) # ends in `type` + + token = self.tokens[self.position] + node.param_types_positions.append((token.line, token.column)) + + self.inc_position() # ends in `,` + + if i < len(node.params) - 1: + self.inc_position() # ends in `,` + # ends in `)` + + self.inc_position(2) # ends in `type` + token = self.tokens[self.position] + node.return_type_position = token.line, token.column + self.inc_position(2) # ends after `{` + + self.visit(node.body) + self.inc_position() # ends after `}` + + @visitor.when(ast.LetNode) + def visit(self, node: ast.LetNode): + """ + * + let declaration-list in expr + """ + token = self.tokens[self.position] + + counter, token = self._skip_open_parentheses() + + node.set_main_position(token.line, token.column) + + self.inc_position() + + for _, _, expr in node.declarations: + # * + # id : type [<- expr] , + + token = self.tokens[self.position] + node.declaration_names_positions.append((token.line, token.column)) + + token = self.tokens[self.position + 2] + node.declaration_types_positions.append((token.line, token.column)) + + if expr is not None: + self.inc_position(4) # ends after `<-` + + token = self.tokens[self.position] + self.visit(expr) + self.inc_position() # ends after `,` + else: + self.inc_position(4) # ends after `,` or `in` if last + # ends after `in` + + self.visit(node.expr) + + self._skip_closed_parentheses() + + @visitor.when(ast.AssignNode) + def visit(self, node: ast.AssignNode): + """ + * + id <- expr + """ + + token = self.tokens[self.position] + node.set_main_position(token.line, token.column) + + token = self.tokens[self.position + 1] + assert token.lex == "<-", f'Expected "<-" instead of "{token.lex}" in assign' + + self.inc_position(2) # ends after `<-` + self.visit(node.expr) + + @visitor.when(ast.BlockNode) + def visit(self, node: ast.BlockNode): + """ + * + { block } + """ + self._skip_open_parentheses() + + token = self.tokens[self.position] + assert token.lex == "{", f'{token.line, token.column} Expected "{{" instead of "{token.lex}" in block' + + node.set_main_position(token.line, token.column) + self.inc_position() # edns after `{` + + for i, expr in enumerate(node.expressions, start=1): + # * + # expr ; + self.visit(expr) + + token = self.tokens[self.position] + assert ( + token.lex == ";" + ), f'Expected ";" instead of "{token.lex}" in instruction {i} of a block' + + self.inc_position() # ends after `;` + + token = self.tokens[self.position] + assert ( + token.lex == "}" + ), f'Expected "}}" instead of "{token.lex}" at the end of a block' + + self.inc_position() # ends after `}` + self._skip_closed_parentheses() + + @visitor.when(ast.ConditionalNode) + def visit(self, node: ast.ConditionalNode): + """ + * + if expr then expr else expr fi + """ + + token = self.tokens[self.position] + assert ( + token.lex == "if" + ), f'Expected "if" instead of "{token.lex}" in conditional' + node.set_main_position(token.line, token.column) + self.inc_position() # ends after `if` + self.visit(node.if_expr) + + token = self.tokens[self.position] + assert ( + token.lex == "then" + ), f'Expected "then" instead of "{token.lex}" in conditional' + self.inc_position() # ends after `then` + self.visit(node.then_expr) + + token = self.tokens[self.position] + assert ( + token.lex == "else" + ), f'Expected "else" instead of "{token.lex}" in conditional' + self.inc_position() # ends after `else` + self.visit(node.else_expr) + + token = self.tokens[self.position] + assert ( + token.lex == "fi" + ), f'Expected "fi" instead of "{token.lex}" in conditional' + self.inc_position() # ends after `fi` + + @visitor.when(ast.WhileNode) + def visit(self, node: ast.WhileNode): + """ + * + while expr loop expr pool + """ + + token = self.tokens[self.position] + node.set_main_position(token.line, token.column) + + self.inc_position() # ends after `while` + self.visit(node.condition) + + self.inc_position() # ends after `loop` + self.visit(node.body) + + self.inc_position() # ends after `pool` + + @visitor.when(ast.SwitchCaseNode) + def visit(self, node: ast.SwitchCaseNode): + """ + * + case expr of case-list esac + """ + + token = self.tokens[self.position] + node.set_main_position(token.line, token.column) + + self.inc_position() # ends afte `case` + self.visit(node.expr) + + self.inc_position() # ends after `of` + for _, _, expr in node.cases: + # * + # id : type => expr ; + self.inc_position(2) # ends in `type` + + token = self.tokens[self.position] + node.cases_positions.append((token.line, token.column)) + + self.inc_position(2) # ends after `=>` + self.visit(expr) + self.inc_position() # ends after `;` + + self.inc_position() # ends afte `esac` + + @visitor.when(ast.MethodCallNode) + def visit(self, node: ast.MethodCallNode): + """ + * + id ( expr-list ) + atom . id ( expr-list ) + atom @ type . id ( expr-list ) + """ + + token = self.tokens[self.position] + + counter, token = self._skip_open_parentheses() + + node.set_main_position(token.line, token.column) + node.id_position = token.line, token.column + + obj_not_none = node.obj is not None + type_not_none = node.type is not None + + if obj_not_none: + self.visit(node.obj) + + token = self.tokens[self.position] + assert token.lex in ( + ".", + "@", + ), f"{token.line, token.column, counter} Expected '.' or '@' instead of {token.lex}" + + self.inc_position() # ends after `.` or `@` + token = self.tokens[self.position] + node.id_position = token.line, token.column + + if type_not_none: + token = self.tokens[self.position] + node.type_position = token.line, token.column + + self.inc_position(2) # ends after `.` + token = self.tokens[self.position] + node.id_position = token.line, token.column + + self.inc_position(2) # ends after `(` + + token = self.tokens[self.position] + if node.args: + for arg in node.args: + # * + # expr , expr-list + token = self.tokens[self.position] + node.args_positions.append((token.line, token.column)) + + self.visit(arg) + + token = self.tokens[self.position] + # assert token.lex in ( + # "," ")" + # ), f"{token.line, token.column} Expected ',' or ')' instead of {token.lex}" + if token.lex == ",": + self.inc_position() # ends after `,` or `)` + # ends after `)` + else: + self.inc_position() + + self._skip_closed_parentheses() # ends after `)` + + @visitor.when(ast.IntegerNode) + def visit(self, node: ast.IntegerNode): + self._atom_node(node) + + @visitor.when(ast.StringNode) + def visit(self, node: ast.StringNode): + self._atom_node(node) + + @visitor.when(ast.BooleanNode) + def visit(self, node: ast.BooleanNode): + self._atom_node(node) + + @visitor.when(ast.VariableNode) + def visit(self, node: ast.VariableNode): + self._atom_node(node) + + @visitor.when(ast.InstantiateNode) + def visit(self, node: ast.InstantiateNode): + """ + * + new type + """ + token = self.tokens[self.position] + _, token = self._skip_open_parentheses() + node.set_main_position(token.line, token.column) + + token = self.tokens[self.position + 1] + node.type_position = token.line, token.column + self.inc_position(2) # ends after `type` + + _, token = self._skip_closed_parentheses() + + @visitor.when(ast.NegationNode) + def visit(self, node: ast.NegationNode): + self._check_unary_operation(node) + + @visitor.when(ast.ComplementNode) + def visit(self, node: ast.ComplementNode): + self._check_unary_operation(node) + + @visitor.when(ast.IsVoidNode) + def visit(self, node: ast.IsVoidNode): + self._check_unary_operation(node) + + @visitor.when(ast.PlusNode) + def visit(self, node: ast.PlusNode): + self._check_binary_operation(node) + + @visitor.when(ast.MinusNode) + def visit(self, node: ast.MinusNode): + self._check_binary_operation(node) + + @visitor.when(ast.StarNode) + def visit(self, node: ast.StarNode): + self._check_binary_operation(node) + + @visitor.when(ast.DivNode) + def visit(self, node: ast.DivNode): + self._check_binary_operation(node) + + @visitor.when(ast.LessEqualNode) + def visit(self, node: ast.LessEqualNode): + self._check_binary_operation(node) + + @visitor.when(ast.LessThanNode) + def visit(self, node: ast.LessThanNode): + self._check_binary_operation(node) + + @visitor.when(ast.EqualNode) + def visit(self, node: ast.EqualNode): + self._check_binary_operation(node) + + def _check_binary_operation(self, node: ast.BinaryNode): + """ + expr operation expr + """ + self._skip_open_parentheses() + + self.visit(node.left) + + token = self.tokens[self.position] + node.set_main_position(token.line, token.column) + self.inc_position() # ends after `operation` + + self.visit(node.right) + self._skip_closed_parentheses() + + def _check_unary_operation(self, node: ast.UnaryNode): + """ + operation expr + """ + self._skip_open_parentheses() + token = self.tokens[self.position] + node.operation_position = token.line, token.column + + token = self.tokens[self.position + 1] + node.set_main_position(token.line, token.column) + + self.inc_position() # ends after `operation` + self.visit(node.expr) + self._skip_closed_parentheses() + + def _atom_node(self, node: ast.Node): + token = self.tokens[self.position] + node.set_main_position(token.line, token.column) + self.inc_position() # ends after `atom` + + def _skip_open_parentheses(self): + token = self.tokens[self.position] + while token.lex == "(": + self.opar += 1 + self.inc_position() + token = self.tokens[self.position] + + return self.opar, token + + def _skip_closed_parentheses(self): + token = self.tokens[self.position] + while token.lex == ")": + self.opar -= 1 + self.inc_position() + token = self.tokens[self.position] + + return self.opar, token \ No newline at end of file diff --git a/src/cool/semantics/type_builder_for_features.py b/src/cool/semantics/type_builder_for_features.py new file mode 100644 index 000000000..3487e82b9 --- /dev/null +++ b/src/cool/semantics/type_builder_for_features.py @@ -0,0 +1,94 @@ +from typing import List, Optional + +import cool.semantics.utils.astnodes as cool +import cool.semantics.utils.errors as err +import cool.visitor as visitor +from cool.semantics.utils.scope import Context, SemanticError, Type, ErrorType + + +class TypeBuilderForFeatures: + """This visitor collect all the attributes and methods in classes and set the parent to the current class + + Params + ------ + - syntactic_and_semantic_errors: List[str] is a list of syntactic_and_semantic_errors detected in the ast travel + - context: Context the context for keeping the classes + - current_type: Optional[Type] is the current type in the building process""" + + def __init__(self, context: Context, errors: List[str]): + self.context: Context = context + self.current_type: Optional[Type] = None + self.errors: List[str] = errors + + @visitor.on("node") + def visit(self, node): + pass + + @visitor.when(cool.ProgramNode) + def visit(self, node: cool.ProgramNode): + for declaration in node.declarations: + self.visit(declaration) + + @visitor.when(cool.ClassDeclarationNode) + def visit(self, node: cool.ClassDeclarationNode): + self.current_type = self.context.get_type(node.id) + + for feature in node.features: + self.visit(feature) + + @visitor.when(cool.AttrDeclarationNode) + def visit(self, node: cool.AttrDeclarationNode): + try: + attr_type = self.context.get_type(node.type) + except SemanticError: + attr_type = ErrorType() + line, column = node.type_position + self.errors.append( + err.UNDEFINED_ATTRIBUTE_TYPE + % (line, column, node.type, node.id, self.current_type.name) + ) + + try: + self.current_type.define_attribute(node.id, attr_type) + except SemanticError: + self.errors.append( + err.ATTRIBUTE_ALREADY_DEFINED + % (node.line, node.column, node.id, self.current_type.name) + ) + + @visitor.when(cool.MethodDeclarationNode) + def visit(self, node: cool.MethodDeclarationNode): + param_names = [] + param_types = [] + + for i, (name, typex) in enumerate(node.params): + param_names.append(name) + try: + param_types.append(self.context.get_type(typex)) + except SemanticError: + param_types.append(ErrorType()) + line, column = node.param_types_positions[i] + self.errors.append( + err.UNDEFINED_PARAM_TYPE + % (line, column, typex, node.id, self.current_type.name) + ) + + try: + return_type = self.context.get_type(node.return_type) + except SemanticError: + return_type = ErrorType() + line, column = node.return_type_position + self.errors.append( + err.UNDEFINED_RETURN_TYPE + % (line, column, node.return_type, node.id, self.current_type.name) + ) + + try: + self.current_type.define_method( + node.id, param_names, param_types, return_type + ) + except SemanticError: + self.errors.append( + err.METHOD_ALREADY_DEFINED + % (node.line, node.column, node.id, self.current_type.name) + ) diff --git a/src/cool/semantics/type_builder_for_inheritance.py b/src/cool/semantics/type_builder_for_inheritance.py new file mode 100644 index 000000000..6fb7b47dc --- /dev/null +++ b/src/cool/semantics/type_builder_for_inheritance.py @@ -0,0 +1,73 @@ +from typing import List, Optional + +import cool.semantics.utils.astnodes as cool +import cool.semantics.utils.errors as err +import cool.visitor as visitor +from cool.semantics.utils.scope import Context, SemanticError, Type, ErrorType + + +class TypeBuilderForInheritance: + """This visitor collect all the attributes and methods in classes and set the parent to the current class + + Params + ------ + - syntactic_and_semantic_errors: List[str] is a list of syntactic_and_semantic_errors detected in the ast travel + - context: Context the context for keeping the classes + - current_type: Optional[Type] is the current type in the building process""" + + def __init__(self, context: Context, errors: List[str]): + self.context: Context = context + self.current_type: Optional[Type] = None + self.errors: List[str] = errors + + @visitor.on("node") + def visit(self, node): + pass + + @visitor.when(cool.ProgramNode) + def visit(self, node: cool.ProgramNode): + for declaration in node.declarations: + self.visit(declaration) + + @visitor.when(cool.ClassDeclarationNode) + def visit(self, node: cool.ClassDeclarationNode): + self.current_type = self.context.get_type(node.id) + + if node.parent is not None: + if node.parent in ("Int", "String", "Bool", "SELF_TYPE"): + line, column = node.parent_position + self.errors.append( + err.INVALID_PARENT_TYPE % (line, column, node.id, node.parent) + ) + + try: + parent_type = self.context.get_type(node.parent) + except SemanticError: + parent_type = self.context.get_type("Object") + line, column = node.parent_position + self.errors.append( + err.PARENT_UNDEFINED % (line, column, node.id, node.parent) + ) + + try: + self.current_type.set_parent(parent_type) + except SemanticError: + self.errors.append( + err.PARENT_ALREADY_SET % (node.line, node.column, node.id) + ) + + else: + try: + self.current_type.set_parent(self.context.get_type("Object")) + except SemanticError: + if node.id not in ( + "Int", + "String", + "Bool", + "IO", + "Object", + "SELF_TYPE", + ): + self.errors.append( + err.PARENT_ALREADY_SET % (node.line, node.column, node.id) + ) diff --git a/src/cool/semantics/type_checker.py b/src/cool/semantics/type_checker.py new file mode 100644 index 000000000..ee5429694 --- /dev/null +++ b/src/cool/semantics/type_checker.py @@ -0,0 +1,484 @@ +from inspect import Attribute +from typing import List, Optional + +import cool.semantics.utils.astnodes as cool +import cool.semantics.utils.errors as err +import cool.visitor as visitor +from cool.semantics.utils.scope import ( + Context, + ErrorType, + Method, + Scope, + SemanticError, + Type, +) + + +class TypeChecker: + def __init__(self, context: Context, errors: List[str]): + self.context: Context = context + self.errors: List[str] = errors + self.current_type: Optional[Type] = None + self.current_method: Optional[Method] = None + self.current_attribute: Optional[Attribute] = None + + @visitor.on("node") + def visit(self, node, scope): + pass + + @visitor.when(cool.ProgramNode) + def visit(self, node: cool.ProgramNode, scope: Scope = None): + if scope is None: + scope = Scope() + + node.scope = scope + + for elem in node.declarations: + self.visit(elem, scope.create_child()) + + return scope + + @visitor.when(cool.ClassDeclarationNode) + def visit(self, node: cool.ClassDeclarationNode, scope: Scope): + node.scope = scope + self.current_type = self.context.get_type(node.id) + + attrs = [ + feature + for feature in node.features + if isinstance(feature, cool.AttrDeclarationNode) + ] + methods = [ + feature + for feature in node.features + if isinstance(feature, cool.MethodDeclarationNode) + ] + + for attr, attr_owner in self.current_type.all_attributes(): + if attr_owner != self.current_type: + scope.define_variable(attr.name, attr.type) + + for attr in attrs: + self.visit(attr, scope) + + for method in methods: + self.visit(method, scope.create_child()) + + @visitor.when(cool.AttrDeclarationNode) + def visit(self, node: cool.AttrDeclarationNode, scope: Scope): + node.scope = scope + if node.id == "self": + self.errors.append(err.SELF_INVALID_ATTRIBUTE_ID % (node.line, node.column)) + + try: + attr_type = ( + self.context.get_type(node.type) + if node.type != "SELF_TYPE" + else self.current_type + ) + except SemanticError: + attr_type = ErrorType() + + scope.define_variable("self", self.current_type) + + # set the current attribute for analyze the body + # and set the self.current_method variable to None + self.current_attribute = self.current_type.get_attribute(node.id) + self.current_method = None + + if node.expr is not None: + expr_type = self.visit(node.expr, scope.create_child()) + if not expr_type.conforms_to(attr_type): + line, column = node.expr_position + self.errors.append( + err.INCOMPATIBLE_TYPES + % (line, column, expr_type.name, attr_type.name) + ) + scope.define_variable(node.id, attr_type) + + @visitor.when(cool.MethodDeclarationNode) + def visit(self, node: cool.MethodDeclarationNode, scope: Scope): + node.scope = scope + self.current_method = self.current_type.get_method(node.id) + self.current_attribute = None + + # Parameters can hide the attribute declaration, that's why we are not checking if there is defined, + # instead we are checking for local declaration. Also it is checked that the static type of a parameter is + # different of SELF_TYPE. + + scope.define_variable("self", self.current_type) + + for param_name, param_type in zip( + self.current_method.param_names, self.current_method.param_types + ): + if not scope.is_local(param_name): + if param_type.name == "SELF_TYPE": + self.errors.append(err.INVALID_PARAM_TYPE % "SELF_TYPE") + scope.define_variable(param_name, ErrorType()) + else: + try: + scope.define_variable( + param_name, self.context.get_type(param_type.name) + ) + except SemanticError: + scope.define_variable(param_name, ErrorType()) + else: + self.errors.append( + err.LOCAL_ALREADY_DEFINED + % (node.line, node.column, param_name, self.current_method.name) + ) + + try: + return_type = ( + self.context.get_type(node.return_type) + if node.return_type != "SELF_TYPE" + else self.current_type + ) + except SemanticError: + return_type = ErrorType() + + expr_type = self.visit(node.body, scope) + + if not expr_type.conforms_to(return_type): + self.errors.append( + err.INCOMPATIBLE_TYPES + % (node.line, node.column, expr_type.name, return_type.name) + ) + + @visitor.when(cool.LetNode) + def visit(self, node: cool.LetNode, scope: Scope): + node.scope = scope + for i, (_id, _type, _expr) in enumerate(node.declarations): + if _id == "self": + line, column = node.declaration_names_positions[i] + self.errors.append(err.SELF_USED_IN_LET % (line, column)) + continue + + try: + var_static_type = ( + self.context.get_type(_type) + if _type != "SELF_TYPE" + else self.current_type + ) + except SemanticError: + line, column = node.declaration_types_positions[i] + self.errors.append(err.UNDEFINED_TYPE % (line, column, _type)) + var_static_type = ErrorType() + + scope.define_variable(_id, var_static_type) + + expr_type = ( + self.visit(_expr, scope.create_child()) if _expr is not None else None + ) + if expr_type is not None and not expr_type.conforms_to(var_static_type): + self.errors.append( + err.INCOMPATIBLE_TYPES + % (node.line, node.column, expr_type.name, var_static_type.name) + ) + + return self.visit(node.expr, scope.create_child()) + + @visitor.when(cool.AssignNode) + def visit(self, node: cool.AssignNode, scope: Scope): + node.scope = scope + var_info = scope.find_variable(node.id) + + if var_info.name == "self": + self.errors.append(err.SELF_IS_READONLY % (node.line, node.column)) + + expr_type = self.visit(node.expr, scope) + + if var_info is None: + self.errors.append( + err.UNDEFINED_VARIABLE + % (node.line, node.column, node.id, self.current_method.name) + ) + else: + if not expr_type.conforms_to(var_info.type): + self.errors.append( + err.INCOMPATIBLE_TYPES + % (node.line, node.column, expr_type.name, var_info.type.name) + ) + + return expr_type + + @visitor.when(cool.BlockNode) + def visit(self, node: cool.BlockNode, scope: Scope): + node.scope = scope + return_type = ErrorType() + for expr in node.expressions: + return_type = self.visit(expr, scope) + return return_type + + @visitor.when(cool.ConditionalNode) + def visit(self, node: cool.ConditionalNode, scope: Scope): + node.scope = scope + if_type = self.visit(node.if_expr, scope) + then_type = self.visit(node.then_expr, scope) + else_type = self.visit(node.else_expr, scope) + if if_type != self.context.get_type("Bool"): + self.errors.append( + err.INCOMPATIBLE_TYPES % (node.line, node.column, if_type.name, "Bool") + ) + return then_type.join(else_type) + + @visitor.when(cool.WhileNode) + def visit(self, node: cool.WhileNode, scope: Scope): + node.scope = scope + condition = self.visit(node.condition, scope) + if condition != self.context.get_type("Bool"): + self.errors.append( + err.INCOMPATIBLE_TYPES + % (node.line, node.column, condition.name, "Bool") + ) + + self.visit(node.body, scope) + return self.context.get_type("Object") + + @visitor.when(cool.SwitchCaseNode) + def visit(self, node: cool.SwitchCaseNode, scope: Scope): + node.scope = scope + self.visit(node.expr, scope) + types = [] + visited = set() + for i, (identifier, type_name, expr) in enumerate(node.cases): + new_scope = scope.create_child() + try: + if type_name != "SELF_TYPE": + new_scope.define_variable( + identifier, self.context.get_type(type_name) + ) + else: + self.errors.append(err.INVALID_CASE_TYPE % type_name) + except SemanticError: + new_scope.define_variable(identifier, ErrorType()) + line, column = node.cases_positions[i] + self.errors.append( + err.UNDEFINED_TYPE_IN_BRANCH % (line, column, type_name) + ) + + # Cannot be duplicated Branches types + if type_name in visited: + line, column = node.cases_positions[i] + self.errors.append( + err.DUPLICATE_BARNCH_IN_CASE % (line, column, type_name) + ) + + visited.add(type_name) + types.append(self.visit(expr, new_scope)) + + return Type.multi_join(types) + + @visitor.when(cool.MethodCallNode) + def visit(self, node: cool.MethodCallNode, scope: Scope): + node.scope = scope + if node.obj is None: + node.obj = cool.VariableNode("self") + obj_type = self.visit(node.obj, scope) + + if node.type is not None: + try: + ancestor_type = self.context.get_type(node.type) + except SemanticError: + ancestor_type = ErrorType() + line, column = node.type_position + self.errors.append(err.UNDEFINED_TYPE % (line, column, node.type)) + + if not obj_type.conforms_to(ancestor_type): + line, column = node.type_position + self.errors.append( + err.INVALID_ANCESTOR + % (line, column, obj_type.name, ancestor_type.name) + ) + else: + ancestor_type = obj_type + + try: + method = ancestor_type.get_method(node.id) + except SemanticError: + line, column = node.id_position + self.errors.append( + err.DISPATCH_UNDEFINED_METHOD % (line, column, node.id, obj_type.name) + ) + + for arg in node.args: + self.visit(arg, scope) + return ErrorType() + + args_count = len(node.args) + params_count = len(method.param_names) + if args_count != params_count: + line, column = node.id_position + self.errors.append( + err.DISPATCH_WITH_WRONG_NUMBER_OF_ARGS + % (line, column, method.name, obj_type.name, params_count, args_count) + ) + + number_of_args = min(args_count, params_count) + for i, arg in enumerate(node.args[:number_of_args]): + arg_type = self.visit(arg, scope) + if not arg_type.conforms_to(method.param_types[i]): + line, column = node.args_positions[i] + self.errors.append( + err.INCOMPATIBLE_TYPES + % ( + line, + column, + arg_type.name, + method.param_types[i].name, + ) + ) + + return ( + method.return_type + if method.return_type.name != "SELF_TYPE" + else ancestor_type + ) + + @visitor.when(cool.IntegerNode) + def visit(self, node: cool.IntegerNode, scope: Scope): + node.scope = scope + return self.context.get_type("Int") + + @visitor.when(cool.StringNode) + def visit(self, node: cool.StringNode, scope: Scope): + node.scope = scope + return self.context.get_type("String") + + @visitor.when(cool.BooleanNode) + def visit(self, node: cool.BooleanNode, scope: Scope): + node.scope = scope + return self.context.get_type("Bool") + + @visitor.when(cool.VariableNode) + def visit(self, node: cool.VariableNode, scope: Scope): + node.scope = scope + variable = scope.find_variable(node.lex) + if variable is None: + if self.current_attribute is not None: + name = self.current_attribute.name + else: + name = self.current_method.name + + self.errors.append( + err.UNDEFINED_VARIABLE % (node.line, node.column, node.lex, name) + ) + return ErrorType() + return variable.type + + @visitor.when(cool.InstantiateNode) + def visit(self, node: cool.InstantiateNode, scope: Scope): + node.scope = scope + try: + return ( + self.context.get_type(node.lex) + if node.lex != "SELF_TYPE" + else self.current_type + ) + except SemanticError as e: + line, column = node.type_position + self.errors.append(err.UNDEFINED_NEW_TYPE % (line, column, node.lex)) + return ErrorType() + + @visitor.when(cool.NegationNode) + def visit(self, node: cool.NegationNode, scope: Scope): + node.scope = scope + return self._check_unary_operation( + node, scope, "not", self.context.get_type("Bool") + ) + + @visitor.when(cool.ComplementNode) + def visit(self, node: cool.ComplementNode, scope: Scope): + node.scope = scope + return self._check_unary_operation( + node, scope, "~", self.context.get_type("Int") + ) + + @visitor.when(cool.IsVoidNode) + def visit(self, node: cool.IsVoidNode, scope: Scope): + node.scope = scope + self.visit(node.expr, scope) + return self.context.get_type("Bool") + + @visitor.when(cool.PlusNode) + def visit(self, node: cool.PlusNode, scope: Scope): + node.scope = scope + return self._check_int_binary_operation( + node, scope, "+", self.context.get_type("Int") + ) + + @visitor.when(cool.MinusNode) + def visit(self, node: cool.MinusNode, scope: Scope): + node.scope = scope + return self._check_int_binary_operation( + node, scope, "-", self.context.get_type("Int") + ) + + @visitor.when(cool.StarNode) + def visit(self, node: cool.StarNode, scope: Scope): + node.scope = scope + return self._check_int_binary_operation( + node, scope, "*", self.context.get_type("Int") + ) + + @visitor.when(cool.DivNode) + def visit(self, node: cool.DivNode, scope: Scope): + node.scope = scope + return self._check_int_binary_operation( + node, scope, "/", self.context.get_type("Int") + ) + + @visitor.when(cool.LessEqualNode) + def visit(self, node: cool.LessEqualNode, scope: Scope): + node.scope = scope + return self._check_int_binary_operation( + node, scope, "<=", self.context.get_type("Bool") + ) + + @visitor.when(cool.LessThanNode) + def visit(self, node: cool.LessThanNode, scope: Scope): + node.scope = scope + return self._check_int_binary_operation( + node, scope, "<", self.context.get_type("Bool") + ) + + @visitor.when(cool.EqualNode) + def visit(self, node: cool.EqualNode, scope: Scope): + node.scope = scope + left_type = self.visit(node.left, scope) + right_type = self.visit(node.right, scope) + + basic_types = ("Int", "String", "Bool") + if ( + left_type.name in basic_types or left_type.name in basic_types + ) and left_type.name != right_type.name: + self.errors.append( + err.INVALID_EQ_COMPARISON_OPERATION % (node.line, node.column) + ) + return self.context.get_type("Bool") + + def _check_int_binary_operation( + self, node: cool.BinaryNode, scope: Scope, operation: str, return_type: Type + ): + left_type = self.visit(node.left, scope) + right_type = self.visit(node.right, scope) + + if left_type == right_type == self.context.get_type("Int"): + return return_type + self.errors.append( + err.INVALID_BINARY_OPERATION + % (node.line, node.column, operation, left_type.name, right_type.name) + ) + return ErrorType() + + def _check_unary_operation( + self, node: cool.UnaryNode, scope: Scope, operation: str, expected_type: Type + ): + typex = self.visit(node.expr, scope) + if typex == expected_type: + return typex + self.errors.append( + err.INVALID_UNARY_OPERATION + % (node.line, node.column, operation, typex.name) + ) + return ErrorType() diff --git a/src/cool/semantics/type_collector.py b/src/cool/semantics/type_collector.py new file mode 100644 index 000000000..a1125d3aa --- /dev/null +++ b/src/cool/semantics/type_collector.py @@ -0,0 +1,65 @@ +from typing import List + +import cool.semantics.utils.errors as err +import cool.semantics.utils.astnodes as cool +import cool.visitor as visitor +from cool.semantics.utils.scope import Context, SemanticError + + +class TypeCollector: + """Visitor to collect the class in the program, and the basic classes as Object, Int, String, IO and Bool + + Params + ---------- + - syntactic_and_semantic_errors: List[str] is a list of syntactic_and_semantic_errors detected in the ast travel + - context: Context the context for keeping the classes""" + + def __init__(self, context: Context = Context(), errors: List[str] = []): + self.errors: List[str] = errors + self.context: Context = context + + @visitor.on("node") + def visit(self, node): + pass + + @visitor.when(cool.ProgramNode) + def visit(self, node): + self.context.create_type("AUTO_TYPE") + self_type = self.context.create_type("SELF_TYPE") + object_type = self.context.create_type("Object") + io_type = self.context.create_type("IO") + string_type = self.context.create_type("String") + int_type = self.context.create_type("Int") + bool_type = self.context.create_type("Bool") + + io_type.set_parent(object_type) + string_type.set_parent(object_type) + int_type.set_parent(object_type) + bool_type.set_parent(object_type) + + object_type.define_method("abort", [], [], object_type) + object_type.define_method("type_name", [], [], string_type) + object_type.define_method("copy", [], [], self_type) + + io_type.define_method("out_string", ["x"], [string_type], self_type) + io_type.define_method("out_int", ["x"], [int_type], self_type) + io_type.define_method("in_string", [], [], string_type) + io_type.define_method("in_int", [], [], int_type) + + string_type.define_method("length", [], [], int_type) + string_type.define_method("concat", ["s"], [string_type], string_type) + string_type.define_method( + "substr", ["i", "l"], [int_type, int_type], string_type + ) + + for declaration in node.declarations: + self.visit(declaration) + + @visitor.when(cool.ClassDeclarationNode) + def visit(self, node: cool.ClassDeclarationNode): + try: + self.context.create_type(node.id) + except SemanticError: + self.errors.append( + err.INVALID_REDEFINITION_CLASS % (node.line, node.column, node.id) + ) diff --git a/src/cool/semantics/type_inference.py b/src/cool/semantics/type_inference.py new file mode 100644 index 000000000..eda62cd87 --- /dev/null +++ b/src/cool/semantics/type_inference.py @@ -0,0 +1,863 @@ +"""The type inference algorithm consist in a dependency di-graph with special nodes to handle the behavior of the +updates of components in the code and solve it in the `context`. For that we crate an structure called +DependencyGraph where we can create nodes as an structure called DependencyNode and arcs between them, an arc e = + where x and y are dependency nodes means that the type of node y is inferred by the type of node x, +so for solve the type of y we need first to infer the type of x. For this operation we need some basic nodes that +only contains the type of the node called AtomNode and in the digraph formation an AtomNode is never inferred from +another node. The DependencyGraph consist in a dictionary[node, adjacency list] this adjacency has a declaration +order and this is fundamental for the inference solution algorithm. If we have a case {x : [y, z]} where x, y, +z are nodes then the algorithm will determinate the type of y and all it dependencies before to start with z (a +simple DFS). The order in the adjacency list is the same appearance order in the program. At the end of the algorithm +all nodes that cannot solve it type will be tagged as `Object`. + +DependencyNode hierarchy + AtomNode + - type : Node type + + VariableInfoNode + - type: Node type + - variable_type : Reference to the variable info of the scope + + AttributeNode + - type : Node type + - attribute : Reference to the attribute of the class + + ParameterNode + - type : Node type + - method : Reference to the method of the class + - index : Index of the parameter of the method + + ReturnTypeNode + - type : Node type + - method : Reference to the method of the class + +All nodes has an implementation of the method update that handle how to update the type by it's dependencies +""" +from abc import ABC +from collections import OrderedDict, deque +from typing import Dict, List, Optional, Set, Tuple, Deque + +import cool.semantics.utils.astnodes as cool +import cool.semantics.utils.errors as err +import cool.visitor as visitor +from cool.semantics.utils.scope import ( + Attribute, + Context, + ErrorType, + Method, + Scope, + SemanticError, + Type, + VariableInfo, +) + + +class DependencyNode: + type: Type + + def update(self, _type: Type) -> None: + raise NotImplementedError() + + def __repr__(self): + return str(self) + + @property + def is_ready(self): + return True + + +class AtomNode(DependencyNode): + def __init__(self, atom_type: Type): + self.type: Type = atom_type + + def update(self, _type: Type) -> None: + pass + + def __str__(self): + return f"Atom({self.type.name})" + + +class VariableInfoNode(DependencyNode): + def __init__(self, var_type: Type, variable_info: VariableInfo): + self.type: Type = var_type + self.variable_info: VariableInfo = variable_info + + def update(self, _type): + self.type = self.variable_info.type = _type + + def __str__(self): + return f"VarInfo({self.variable_info.name}, {self.type.name})" + + +class AttributeNode(DependencyNode): + def __init__(self, attr_type: Type, attribute: Attribute): + self.type: Type = attr_type + self.attribute: Attribute = attribute + + def update(self, _type: Type) -> None: + self.type = self.attribute.type = _type + + def __str__(self): + return f"Attr({self.attribute.name}, {self.type.name})" + + +class ParameterNode(DependencyNode): + def __init__(self, param_type: Type, method: Method, index: int): + self.type: Type = param_type + self.method: Method = method + self.index: int = index + + def update(self, _type): + self.type = self.method.param_types[self.index] = _type + + def __str__(self): + return f"Param({self.method.name}, {self.index}, {self.type.name})" + + +class ReturnTypeNode(DependencyNode): + def __init__(self, ret_type: Type, method: Method): + self.type: Type = ret_type + self.method: Method = method + + def update(self, _type): + self.type = self.method.return_type = _type + + def __str__(self): + return f"Return({self.method.name}, {self.type.name})" + + +class BranchedNode(DependencyNode, ABC): + branches: List[DependencyNode] = [] + + @property + def is_ready(self) -> bool: + return all(x.type.name != "AUTO_TYPE" for x in self.branches) + + +class ConditionalNode(BranchedNode): + def __init__(self, conditional_type, then_branch, else_branch): + self.type = conditional_type + self.branches = [then_branch, else_branch] + + def update(self, _type: Type) -> None: + self.type = _type + + def __str__(self): + return f"ConditionalNode({self.type.name})" + + +class CaseOfNode(BranchedNode): + def __init__(self, _type, branches): + self.type = _type + self.branches = branches + + def update(self, _type: Type) -> None: + self.type = _type + + def __str__(self): + return f"CaseOfNode({self.type.name})" + + +class DependencyGraph: + def __init__(self): + self.dependencies: Dict[DependencyNode, List[DependencyNode]] = OrderedDict() + + def add_node(self, node: DependencyNode): + if node not in self.dependencies: + self.dependencies[node] = [] + + def add_edge(self, node: DependencyNode, other: DependencyNode): + try: + self.dependencies[node].append(other) + except KeyError: + self.dependencies[node] = [other] + self.add_node(other) + + def update_dependencies(self, default_type: Type = None): + queue: Deque[DependencyNode] = deque( + node for node in self.dependencies if isinstance(node, AtomNode) + ) + visited: Set[DependencyNode] = set(queue) + + while queue: + node = queue.popleft() + + if not node.is_ready: + continue + + for adj in self.dependencies[node]: + if adj not in visited: + adj.update(node.type) + visited.add(adj) + if not isinstance(adj, BranchedNode): + queue.append(adj) + + for node in self.dependencies: + if isinstance(node, BranchedNode) and node.is_ready: + node.update(Type.multi_join([x.type for x in node.branches])) + + queue = deque( + node + for node in self.dependencies + if isinstance(node, BranchedNode) and node.type.name != "AUTO_TYPE" + ) + visited.update(queue) + while queue: + node = queue.popleft() + for adj in self.dependencies[node]: + if adj not in visited: + adj.update(node.type) + visited.add(adj) + queue.append(adj) + + if default_type is not None: + for node in self.dependencies: + if node not in visited: + node.update(default_type) + + def __str__(self): + return ( + "{\n\t" + + "\n\t".join(f"{key}: {value}" for key, value in self.dependencies.items()) + + "\n}" + ) + + +class InferenceChecker: + def __init__(self, context, errors): + self.context: Context = context + self.errors: List[str] = errors + self.current_type: Optional[Type] = None + self.current_method: Optional[Method] = None + + self.variables: Dict[VariableInfo, VariableInfoNode] = {} + self.attributes = self.build_attributes_reference(context) + self.methods = self.build_methods_reference(context) + self.graph = DependencyGraph() + + @staticmethod + def build_attributes_reference( + context: Context, + ) -> Dict[Tuple[str, str], AttributeNode]: + attributes = {} + + for typex in context: + for attr in typex.attributes: + attributes[typex.name, attr.name] = AttributeNode(attr.type, attr) + + return attributes + + @staticmethod + def build_methods_reference( + context: Context, + ) -> Dict[Tuple[str, str], Tuple[List[ParameterNode], ReturnTypeNode]]: + methods = {} + + for typex in context: + for method in typex.methods: + methods[typex.name, method.name] = ( + [ + ParameterNode(t, method, i) + for i, t in enumerate(method.param_types) + ], + ReturnTypeNode(method.return_type, method), + ) + + return methods + + @visitor.on("node") + def visit(self, node, scope): + pass + + @visitor.when(cool.ProgramNode) + def visit(self, node: cool.ProgramNode, scope: Scope = None): + if scope is None: + scope = Scope() + + node.scope = scope + + for item in node.declarations: + self.visit(item, scope.create_child()) + + # print(self.graph, '\n') + self.graph.update_dependencies(default_type=self.context.get_type("Object")) + # print(self.graph, '\n') + InferenceTypeSubstitute(self.context, self.errors).visit(node, scope) + + @visitor.when(cool.ClassDeclarationNode) + def visit(self, node: cool.ClassDeclarationNode, scope: Scope): + node.scope = scope + self.current_type = self.context.get_type(node.id) + + attrs = [ + feature + for feature in node.features + if isinstance(feature, cool.AttrDeclarationNode) + ] + methods = [ + feature + for feature in node.features + if isinstance(feature, cool.MethodDeclarationNode) + ] + + for attr, attr_owner in self.current_type.all_attributes(): + if attr_owner != self.current_type: + scope.define_variable(attr.name, attr.type) + + for attr in attrs: + self.visit(attr, scope) + + for method in methods: + self.visit(method, scope.create_child()) + + @visitor.when(cool.AttrDeclarationNode) + def visit(self, node: cool.AttrDeclarationNode, scope: Scope): + node.scope = scope + if node.id == "self": + if node.expr is not None: + scope.create_child() + return + + scope.define_variable("self", self.current_type) + + # Solve the expression of the attribute + expr_node = ( + self.visit(node.expr, scope.create_child()) + if node.expr is not None + else None + ) + + try: + # Define attribute in the scope + var_info = scope.define_variable(node.id, self.context.get_type(node.type)) + + # Set and get the reference to the variable info node + var_info_node = self.variables[var_info] = VariableInfoNode( + self.context.get_type(node.type), var_info + ) + + if node.type == "AUTO_TYPE": + # Get the reference to the attribute node + attr_node = self.attributes[self.current_type.name, node.id] + + # If the expression node is not None then two edges are creates in the graph + if expr_node is not None: + self.graph.add_edge(expr_node, var_info_node) + self.graph.add_edge(expr_node, attr_node) + + # Finally a cycle of two nodes is created between var_info_node and attr_node + self.graph.add_edge(var_info_node, attr_node) + self.graph.add_edge(attr_node, var_info_node) + except SemanticError: + pass + + @visitor.when(cool.MethodDeclarationNode) + def visit(self, node: cool.MethodDeclarationNode, scope: Scope): + node.scope = scope + self.current_method = self.current_type.get_method(node.id) + + # Define 'self' as a variable in the scope + self_var = scope.define_variable("self", self.current_type) + + # Set the reference of 'self' variable info node + self.variables[self_var] = VariableInfoNode(self.current_type, self_var) + + param_names = self.current_method.param_names + param_types = self.current_method.param_types + + for i, (param_name, param_type) in enumerate(zip(param_names, param_types)): + # Define parameter as local variable in current scope + param_var_info = scope.define_variable(param_name, param_type) + + # Set the reference to the variable info node + param_var_info_node = self.variables[param_var_info] = VariableInfoNode( + param_type, param_var_info + ) + + if param_type.name == "AUTO_TYPE": + # Get the parameter node + parameter_node = self.methods[ + self.current_type.name, self.current_method.name + ][0][i] + + # Create the cycle of two nodes between param_var_info_node and parameter_node + self.graph.add_edge(param_var_info_node, parameter_node) + self.graph.add_edge(parameter_node, param_var_info_node) + + # Solve the body of the method + body_node = self.visit(node.body, scope) + + if self.current_method.return_type.name == "AUTO_TYPE": + # Get the return type node and add an edge body_node -> return_type_node + return_type_node = self.methods[ + self.current_type.name, self.current_method.name + ][1] + self.graph.add_edge(body_node, return_type_node) + + @visitor.when(cool.LetNode) + def visit(self, node: cool.LetNode, scope: Scope): + node.scope = scope + for _id, _type, _expr in node.declarations: + try: + # Define and get the var_info + var_info = scope.define_variable(_id, self.context.get_type(_type)) + except SemanticError: + var_info = scope.define_variable(_id, ErrorType()) + var_info_node = self.variables[var_info] = VariableInfoNode( + var_info.type, var_info + ) + + expr_node = ( + self.visit(_expr, scope.create_child()) if _expr is not None else None + ) + + if var_info.type.name == "AUTO_TYPE": + # Create an edge or add an new node only if it is AutoType + if expr_node is not None: + self.graph.add_edge(expr_node, var_info_node) + if expr_node.type.name == "AUTO_TYPE": + self.graph.add_edge(var_info_node, expr_node) + else: + self.graph.add_node(var_info_node) + elif expr_node is not None and expr_node.type.name == "AUTO_TYPE": + self.graph.add_edge(var_info_node, expr_node) + + return self.visit(node.expr, scope.create_child()) + + @visitor.when(cool.AssignNode) + def visit(self, node: cool.AssignNode, scope: Scope): + node.scope = scope + var_info = scope.find_variable(node.id) + + expr_node = self.visit(node.expr, scope) + + if var_info is not None: + if expr_node.type.name != "AUTO_TYPE" and var_info.type.name == "AUTO_TYPE": + self.graph.add_edge(expr_node, self.variables[var_info]) + elif ( + var_info.type.name != "AUTO_TYPE" and expr_node.type.name == "AUTO_TYPE" + ): + self.graph.add_edge( + AtomNode(self.context.get_type(var_info.type.name)), expr_node + ) + elif ( + var_info.type.name == "AUTO_TYPE" and expr_node.type.name == "AUTO_TYPE" + ): + # Create a cycle + self.graph.add_edge(expr_node, self.variables[var_info]) + self.graph.add_edge(self.variables[var_info], expr_node) + else: + pass + + return expr_node + + @visitor.when(cool.BlockNode) + def visit(self, node: cool.BlockNode, scope: Scope): + node.scope = scope + result_node = None + for expr in node.expressions: + result_node = self.visit(expr, scope) + return result_node + + @visitor.when(cool.ConditionalNode) + def visit(self, node: cool.ConditionalNode, scope: Scope): + node.scope = scope + if_node = self.visit(node.if_expr, scope) + + if if_node is not None and not isinstance(if_node, AtomNode): + self.graph.add_edge(AtomNode(self.context.get_type("Bool")), if_node) + + then_node = self.visit(node.then_expr, scope) + else_node = self.visit(node.else_expr, scope) + + if isinstance(then_node, AtomNode) and isinstance(else_node, AtomNode): + return AtomNode(then_node.type.join(else_node.type)) + + conditional_node = ConditionalNode( + self.context.get_type("AUTO_TYPE"), then_node, else_node + ) + + if then_node is None or else_node is None: + return conditional_node + + if isinstance(then_node, AtomNode) and not isinstance(else_node, AtomNode): + self.graph.add_edge(then_node, else_node) + elif not isinstance(then_node, AtomNode) and isinstance(else_node, AtomNode): + self.graph.add_edge(else_node, then_node) + else: + self.graph.add_edge(then_node, else_node) + self.graph.add_edge(else_node, then_node) + self.graph.add_edge(conditional_node, then_node) + self.graph.add_edge(conditional_node, else_node) + + return conditional_node + + @visitor.when(cool.WhileNode) + def visit(self, node: cool.WhileNode, scope: Scope): + node.scope = scope + self.visit(node.condition, scope) + self.visit(node.body, scope) + return AtomNode(self.context.get_type("Object")) + + @visitor.when(cool.SwitchCaseNode) + def visit(self, node: cool.SwitchCaseNode, scope: Scope): + node.scope = scope + self.visit(node.expr, scope) + + defined_nodes = [] + not_defined_nodes = [] + case_nodes = [] + for _id, _type, _expr in node.cases: + new_scope = scope.create_child() + + try: + case_type = self.context.get_type(_type) + var_info = new_scope.define_variable(_id, case_type) + self.variables[var_info] = VariableInfoNode(var_info.type, var_info) + except SemanticError: + pass + + case_node = self.visit(_expr, new_scope) + if isinstance(case_node, AtomNode): + defined_nodes.append(case_node) + else: + not_defined_nodes.append(case_node) + case_nodes.append(case_node) + + if any(e is not None and e.type.name == "AUTO_TYPE" for e in case_nodes): + if defined_nodes: + t = Type.multi_join([x.type for x in defined_nodes]) + for x in not_defined_nodes: + self.graph.add_edge(AtomNode(t), x) + case_of_node = CaseOfNode(self.context.get_type("AUTO_TYPE"), case_nodes) + self.graph.add_node(case_of_node) + return case_of_node + return AtomNode(Type.multi_join([e.type for e in case_nodes if e is not None])) + + @visitor.when(cool.MethodCallNode) + def visit(self, node: cool.MethodCallNode, scope: Scope): + node.scope = scope + if node.obj is None: + node.obj = cool.VariableNode("self") + obj_node = self.visit(node.obj, scope) + + if isinstance(obj_node, AtomNode) and obj_node.type.contains_method(node.id): + method, owner = obj_node.type.get_method(node.id, get_owner=True) + param_nodes, return_node = self.methods[owner.name, method.name] + + count_of_args = min(len(node.args), len(param_nodes)) + for i in range(count_of_args): + arg = node.args[i] + arg_node = self.visit(arg, scope) + + if arg_node is None: + # Possible error + continue + + if isinstance(arg_node, AtomNode): + if param_nodes[i].type.name == "AUTO_TYPE": + self.graph.add_edge(arg_node, param_nodes[i]) + else: + continue + else: + if param_nodes[i].type.name != "AUTO_TYPE": + self.graph.add_edge(param_nodes[i], arg_node) + else: + self.graph.add_edge(param_nodes[i], arg_node) + self.graph.add_edge(arg_node, param_nodes[i]) + + if return_node.type.name == "AUTO_TYPE": + return return_node + return AtomNode( + return_node.type + if return_node.type.name != "SELF_TYPE" + else obj_node.type + ) + + for arg in node.args: + self.visit(arg, scope) + return AtomNode(self.context.get_type("Object")) + + @visitor.when(cool.IntegerNode) + def visit(self, node: cool.IntegerNode, scope: Scope): + node.scope = scope + return AtomNode(self.context.get_type("Int")) + + @visitor.when(cool.StringNode) + def visit(self, node: cool.StringNode, scope: Scope): + node.scope = scope + return AtomNode(self.context.get_type("String")) + + @visitor.when(cool.BooleanNode) + def visit(self, node: cool.BooleanNode, scope: Scope): + node.scope = scope + return AtomNode(self.context.get_type("Bool")) + + @visitor.when(cool.VariableNode) + def visit(self, node: cool.VariableNode, scope: Scope): + node.scope = scope + variable = scope.find_variable(node.lex) + + if variable is not None: + if variable.type.name == "AUTO_TYPE": + return self.variables[variable] + else: + return AtomNode(variable.type) + else: + return None + + @visitor.when(cool.InstantiateNode) + def visit(self, node: cool.InstantiateNode, scope: Scope): + node.scope = scope + if node.lex in self.context.types: + return AtomNode(self.context.get_type(node.lex)) + return AtomNode(self.context.get_type("Object")) + + @visitor.when(cool.NegationNode) + def visit(self, node: cool.NegationNode, scope: Scope): + node.scope = scope + self.visit(node.expr, scope) + return AtomNode(self.context.get_type("Bool")) + + @visitor.when(cool.ComplementNode) + def visit(self, node: cool.ComplementNode, scope: Scope): + node.scope = scope + self.visit(node.expr, scope) + return AtomNode(self.context.get_type("Int")) + + @visitor.when(cool.IsVoidNode) + def visit(self, node: cool.IsVoidNode, scope: Scope): + node.scope = scope + self.visit(node.expr, scope) + return AtomNode(self.context.get_type("Bool")) + + @visitor.when(cool.PlusNode) + def visit(self, node: cool.PlusNode, scope: Scope): + node.scope = scope + return self._visit_arithmetic_node( + node, scope, self.context.get_type("Int"), self.context.get_type("Int") + ) + + @visitor.when(cool.MinusNode) + def visit(self, node: cool.MinusNode, scope: Scope): + node.scope = scope + return self._visit_arithmetic_node( + node, scope, self.context.get_type("Int"), self.context.get_type("Int") + ) + + @visitor.when(cool.StarNode) + def visit(self, node: cool.StarNode, scope: Scope): + node.scope = scope + return self._visit_arithmetic_node( + node, scope, self.context.get_type("Int"), self.context.get_type("Int") + ) + + @visitor.when(cool.DivNode) + def visit(self, node: cool.DivNode, scope: Scope): + node.scope = scope + return self._visit_arithmetic_node( + node, scope, self.context.get_type("Int"), self.context.get_type("Int") + ) + + @visitor.when(cool.LessEqualNode) + def visit(self, node: cool.LessEqualNode, scope: Scope): + node.scope = scope + return self._visit_arithmetic_node( + node, scope, self.context.get_type("Int"), self.context.get_type("Bool") + ) + + @visitor.when(cool.LessThanNode) + def visit(self, node: cool.LessThanNode, scope: Scope): + node.scope = scope + return self._visit_arithmetic_node( + node, scope, self.context.get_type("Int"), self.context.get_type("Bool") + ) + + @visitor.when(cool.EqualNode) + def visit(self, node: cool.EqualNode, scope: Scope): + node.scope = scope + self.visit(node.left, scope) + self.visit(node.right, scope) + return AtomNode(self.context.get_type("Bool")) + + def _visit_arithmetic_node( + self, node: cool.BinaryNode, scope: Scope, member_types: Type, return_type: Type + ): + left = self.visit(node.left, scope) + right = self.visit(node.right, scope) + + if left is not None and not isinstance(left, AtomNode): + self.graph.add_edge(AtomNode(member_types), left) + + if right is not None and not isinstance(right, AtomNode): + self.graph.add_edge(AtomNode(member_types), right) + + return AtomNode(return_type) + + +class InferenceTypeSubstitute: + def __init__(self, context: Context, errors: List[str]): + self.context: Context = context + self.errors: List[str] = errors + self.current_type: Optional[Type] = None + self.current_method: Optional[Method] = None + + @visitor.on("node") + def visit(self, node, tabs): + pass + + @visitor.when(cool.ProgramNode) + def visit(self, node: cool.ProgramNode, scope: Scope): + scope = node.scope + for i, elem in enumerate(node.declarations): + self.visit(elem, scope.children[i]) + return scope + + @visitor.when(cool.ClassDeclarationNode) + def visit(self, node: cool.ClassDeclarationNode, scope: Scope): + scope = node.scope + self.current_type = self.context.get_type(node.id) + + attrs = [ + feature + for feature in node.features + if isinstance(feature, cool.AttrDeclarationNode) + ] + methods = [ + feature + for feature in node.features + if isinstance(feature, cool.MethodDeclarationNode) + ] + + i = 0 + for attr in attrs: + if attr.expr is not None: + attr.index = i + i += 1 + + self.visit(attr, scope) + + # print(scope.children, len(methods), i) + for i, method in enumerate(methods, start=i): + self.visit(method, scope.children[i]) + + @visitor.when(cool.AttrDeclarationNode) + def visit(self, node: cool.AttrDeclarationNode, scope: Scope): + scope = node.scope + try: + attr_type = self.context.get_type(node.type) + var_info = scope.find_variable(node.id) + + if node.expr is not None: + self.visit(node.expr, scope.children[node.index]) + + if attr_type == self.context.get_type("AUTO_TYPE"): + if var_info.type == self.context.get_type("AUTO_TYPE"): + self.errors.append(err.INFERENCE_ERROR_ATTRIBUTE % node.id) + node.type = var_info.type.name + except SemanticError: + pass + + @visitor.when(cool.MethodDeclarationNode) + def visit(self, node: cool.MethodDeclarationNode, scope: Scope): + scope = node.scope + self.current_method = self.current_type.get_method(node.id) + + try: + return_type = self.context.get_type(node.return_type) + except SemanticError: + return_type = None + + for i, (name, _) in enumerate(node.params): + variable_info = scope.find_variable(name) + if variable_info.type == self.context.get_type("AUTO_TYPE"): + self.errors.append( + err.INFERENCE_ERROR_ATTRIBUTE + % ( + node.param_types_positions[i][0], + node.param_types_positions[i][1], + name, + ) + ) + node.params[i] = (name, variable_info.type.name) + + self.visit(node.body, scope) + + if return_type is not None and return_type == self.context.get_type( + "AUTO_TYPE" + ): + if self.current_method.return_type == self.context.get_type("AUTO_TYPE"): + self.errors.append(err.INFERENCE_ERROR_ATTRIBUTE % node.id) + node.return_type = self.current_method.return_type.name + + @visitor.when(cool.LetNode) + def visit(self, node: cool.LetNode, scope: Scope): + scope = node.scope + child_index = 0 + for i, (_id, _type, _expr) in enumerate(node.declarations): + variable_info = scope.find_variable(_id) + + if _expr is not None: + self.visit(_expr, scope.children[child_index]) + child_index += 1 + + if _type == "AUTO_TYPE": + if variable_info.type == self.context.get_type("AUTO_TYPE"): + self.errors.append(err.INFERENCE_ERROR_ATTRIBUTE % _id) + node.declarations[i] = (_id, variable_info.type.name, _expr) + + self.visit(node.expr, scope.children[child_index]) + + @visitor.when(cool.AssignNode) + def visit(self, node: cool.AssignNode, scope: Scope): + scope = node.scope + self.visit(node.expr, scope) + + @visitor.when(cool.BlockNode) + def visit(self, node: cool.BlockNode, scope: Scope): + scope = node.scope + for _, expr in enumerate(node.expressions): + self.visit(expr, scope) + + @visitor.when(cool.ConditionalNode) + def visit(self, node: cool.ConditionalNode, scope: Scope): + scope = node.scope + self.visit(node.if_expr, scope) + self.visit(node.then_expr, scope) + self.visit(node.else_expr, scope) + + @visitor.when(cool.WhileNode) + def visit(self, node: cool.WhileNode, scope: Scope): + scope = node.scope + self.visit(node.condition, scope) + self.visit(node.body, scope) + + @visitor.when(cool.SwitchCaseNode) + def visit(self, node: cool.SwitchCaseNode, scope: Scope): + scope = node.scope + self.visit(node.expr, scope) + for i, (_, _, _expr) in enumerate(node.cases): + self.visit(_expr, scope.children[i]) + + @visitor.when(cool.MethodCallNode) + def visit(self, node: cool.MethodCallNode, scope: Scope): + scope = node.scope + self.visit(node.obj, scope) + + for arg in node.args: + self.visit(arg, scope) + + @visitor.when(cool.AtomicNode) + def visit(self, node: cool.AtomicNode, scope: Scope): + scope = node.scope + + @visitor.when(cool.UnaryNode) + def visit(self, node: cool.UnaryNode, scope: Scope): + scope = node.scope + self.visit(node.expr, scope) + + @visitor.when(cool.BinaryNode) + def visit(self, node: cool.BinaryNode, scope: Scope): + scope = node.scope + self.visit(node.left, scope) + self.visit(node.right, scope) diff --git a/src/cool/semantics/utils/__init__.py b/src/cool/semantics/utils/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/src/cool/semantics/utils/astnodes.py b/src/cool/semantics/utils/astnodes.py new file mode 100644 index 000000000..9bf305b9f --- /dev/null +++ b/src/cool/semantics/utils/astnodes.py @@ -0,0 +1,208 @@ +from typing import List, Union, Tuple, Optional + +from cool.semantics.utils.scope import Scope + +Feature = Union["MethodDeclarationNode", "AttrDeclarationNode"] + + +class Node: + line: int + column: int + scope: Scope + + def set_main_position(self, line: int, col: int) -> "Node": + self.line = line + self.column = col + return self + + +class ProgramNode(Node): + def __init__(self, declarations: List["ClassDeclarationNode"]): + self.declarations: List[ClassDeclarationNode] = declarations + + +class DeclarationNode(Node): + pass + + +class ClassDeclarationNode(DeclarationNode): + def __init__(self, idx: str, features: List[Feature], parent: Optional[str] = None): + self.id: str = idx + self.parent: str = parent + self.features: List[Feature] = features + + self.parent_position: Tuple[int, int] = -1, -1 + + +class MethodDeclarationNode(DeclarationNode): + def __init__( + self, + idx: str, + params: List[Tuple[str, str]], + return_type: str, + body: "ExprNode", + ): + self.id: str = idx + self.params: List[Tuple[str, str]] = params + self.return_type: str = return_type + self.body: ExprNode = body + + self.param_types_positions: List[Tuple[int, int]] = [] + self.return_type_position: Tuple[int, int] = -1, -1 + + +class AttrDeclarationNode(DeclarationNode): + def __init__(self, idx: str, typex: str, expr: "ExprNode" = None): + self.id: str = idx + self.type: str = typex + self.expr: ExprNode = expr + + self.type_position: Tuple[int, int] = -1, -1 + self.expr_position: Tuple[int, int] = -1, -1 + + +class ExprNode(Node): + pass + + +class ParenthesisExpr(ExprNode): + def __init__(self, expr: "ExprNode"): + self.expr: "ExprNode" = expr + + +class BlockNode(ExprNode): + def __init__(self, expressions: List[ExprNode]): + self.expressions: List[ExprNode] = expressions + + +class LetNode(ExprNode): + def __init__( + self, declarations: List[Tuple[str, str, Optional[ExprNode]]], expr: ExprNode + ): + self.declarations: List[Tuple[str, str, Optional[ExprNode]]] = declarations + self.expr: ExprNode = expr + + self.declaration_names_positions: List[Tuple[int, int]] = [] + self.declaration_types_positions: List[Tuple[int, int]] = [] + + +class SwitchCaseNode(ExprNode): + def __init__(self, expr, cases): + self.expr: ExprNode = expr + self.cases: List[Tuple[str, str, ExprNode]] = cases + + self.cases_positions: List[Tuple[int, int]] = [] + + +class AssignNode(ExprNode): + def __init__(self, idx: str, expr: ExprNode): + self.id: str = idx + self.expr: ExprNode = expr + + +class ConditionalNode(ExprNode): + def __init__(self, ifx: ExprNode, then: ExprNode, elsex: ExprNode): + self.if_expr: ExprNode = ifx + self.then_expr: ExprNode = then + self.else_expr: ExprNode = elsex + + +class WhileNode(ExprNode): + def __init__(self, condition: ExprNode, body: ExprNode): + self.condition: ExprNode = condition + self.body: ExprNode = body + + +class MethodCallNode(ExprNode): + def __init__(self, idx, args, obj=None, typex=None): + self.obj: ExprNode = obj + self.id: str = idx + self.args: List[ExprNode] = args + self.type: str = typex + + self.id_position: Tuple[int, int] = -1, -1 + self.type_position: Tuple[int, int] = -1, -1 + self.args_positions: List[Tuple[int, int]] = [] + + +class AtomicNode(ExprNode): + def __init__(self, lex: str): + self.lex: str = lex + self.scope = None + + +class UnaryNode(ExprNode): + def __init__(self, expr: ExprNode): + self.expr: ExprNode = expr + + self.operation_position: Tuple[int, int] = -1, -1 + + +class BinaryNode(ExprNode): + def __init__(self, left, operation, right): + self.left: ExprNode = left + self.operation: str = operation + self.right: ExprNode = right + + +class VariableNode(AtomicNode): + pass + + +class InstantiateNode(AtomicNode): + def __init__(self, lex): + super().__init__(lex) + + self.type_position: Tuple[int, int] = -1, -1 + + +class IntegerNode(AtomicNode): + pass + + +class StringNode(AtomicNode): + pass + + +class BooleanNode(AtomicNode): + pass + + +class NegationNode(UnaryNode): + pass + + +class ComplementNode(UnaryNode): + pass + + +class IsVoidNode(UnaryNode): + pass + + +class PlusNode(BinaryNode): + pass + + +class MinusNode(BinaryNode): + pass + + +class StarNode(BinaryNode): + pass + + +class DivNode(BinaryNode): + pass + + +class LessThanNode(BinaryNode): + pass + + +class LessEqualNode(BinaryNode): + pass + + +class EqualNode(BinaryNode): + pass diff --git a/src/cool/semantics/utils/errors.py b/src/cool/semantics/utils/errors.py new file mode 100644 index 000000000..e71fc3d87 --- /dev/null +++ b/src/cool/semantics/utils/errors.py @@ -0,0 +1,98 @@ +ATTRIBUTE_OVERRIDE_ERROR = '(%d, %d) - SemanticError: Attribute "%s" already defined in "%s", attributes cannot be overridden' +METHOD_OVERRIDE_PARAM_ERROR = '(%d, %d) - SemanticError: In redefinded method "%s", the number of parameters different from the original definition. Expected %d, instead of %d' +METHOD_OVERRIDE_PARAM_ERROR = '(%d, %d) - SemanticError: In redefinded method "%s", param type "%s" is different from original param type "%s"' +METHOD_OVERRIDE_RETURN_ERROR = '(%d, %d) - SemanticError: In redefinded method "%s", return type "%s" is different from original return type "%s"' + +INCOMPATIBLE_TYPES = '(%d, %d) - TypeError: Cannot convert "%s" into "%s".' +INVALID_PARAM_TYPE = ( + '(%d, %d) - TypeError: "%s" cannot be a static type of a parameter.' +) +INVALID_CASE_TYPE = ( + '(%d, %d) - TypeError: "%s" cannot be a static type of a case branch.' +) +INVALID_PARENT_TYPE = '(%d, %d) - SemanticError: Class "%s" cannot inherits from "%s"' +INVALID_ANCESTOR = '(%d, %d) - TypeError: Class "%s" has no an ancestor class "%s".' + +INVALID_EQ_COMPARISON_OPERATION = '(%d, %d) - TypeError: For operation "=" if one of the expression has static type Int, Bool or String, then the other must have the same static type' +INVALID_BINARY_OPERATION = ( + '(%d, %d) - TypeError: Operation "%s" is not defined between "%s" and "%s".' +) +INVALID_UNARY_OPERATION = ( + '(%d, %d) - TypeError: Operation "%s" is not defined for "%s".' +) + +DISPATCH_UNDEFINED_METHOD = ( + '(%d, %d) - AttributeError: Dispatch undefined method "%s" from type %s' +) +DISPATCH_WITH_WRONG_NUMBER_OF_ARGS = '(%d, %d) - SemanticError: Method "%s" of type "%s" called with wrong number of arguments. Expected %d instead of %d' + + +SELF_IS_READONLY = '(%d, %d) - SemanticError: Variable "self" is read-only.' +SELF_INVALID_ATTRIBUTE_ID = ( + '(%d, %d) - SemanticError: Cannot set "self" as attribute of a class.' +) +SELF_INVALID_PARAM_ID = ( + '(%d, %d) - SemanticError: Cannot set "self" as parameter of a method.' +) +SELF_USED_IN_LET = ( + '(%d, %d) - SemanticError: "self" cannot be bound in a "let" expression' +) +LOCAL_ALREADY_DEFINED = ( + '(%d, %d) - SemanticError: Variable "%s" is already defined in method "%s".' +) +UNDEFINED_VARIABLE = '(%d, %d) - NameError: Variable "%s" is not defined in "%s".' +INVALID_REDEFINITION_CLASS = ( + '(%d, %d) - SemanticError: Invalid redefinition of class "%s"' +) +PARENT_ALREADY_SET = '(%d, %d) - SemanticError: Parent type is already set for "%s"' +PARENT_UNDEFINED = ( + '(%d, %d) - TypeError: Parent type for class "%s" is an undefined type "%s"' +) +ATTRIBUTE_ALREADY_DEFINED = ( + '(%d, %d) - SemanticError: Attribute "%s" is already defined in "%s".' +) +METHOD_ALREADY_DEFINED = '(%d, %d) - SemanticError: Method "%s" already defined in %s' +DUPLICATE_BARNCH_IN_CASE = ( + '(%d, %d) - SemanticError: Duplicate branch "%s" in case statement' +) + +CYCLIC_DEPENDENCY = '(%d, %d) - SemanticError: Class "%s", or an ancestor of "%s", is involved in an inheritance cycle' + +UNDEFINDED_ATTRIBUTE = '(%d, %d) - SemanticError: Attribute "%s" is not defined in %s' +UNDEFINDED_METHOD = '(%d, %d) - SemanticError: Method "%s" is not defined in %s' +UNDEFINED_TYPE = '(%d, %d) - TypeError: Type "%s" is not defined' +UNDEFINED_NEW_TYPE = ( + '(%d, %d) - TypeError: Using "new" expresion with undefined type "%s"' +) +UNDEFINED_TYPE_IN_BRANCH = ( + '(%d, %d) - TypeError: Class "%s" of case branch is undefined' +) +UNDEFINED_RETURN_TYPE = ( + '(%d, %d) - TypeError: Undefined return type "%s" in method "%s", in class "%s"' +) +UNDEFINED_PARAM_TYPE = ( + '(%d, %d) - TypeError: Undefined param type "%s" in method "%s", in class "%s"' +) +UNDEFINED_ATTRIBUTE_TYPE = ( + '(%d, %d) - TypeError: Undefined type "%s" for attribute "%s" in class "%s"' +) + +INFERENCE_ERROR_ATTRIBUTE = ( + '(%d, %d) - InferenceError: Cannot infer type for attribute "%s".' +) +INFERENCE_ERROR_PARAMETER = ( + '(%d, %d) - InferenceError: Cannot infer type for parameter "%s".' +) +INFERENCE_ERROR_VARIABLE = ( + '(%d, %d) - InferenceError: Cannot infer type for variable "%s".' +) +INFERENCE_ERROR_METHOD = ( + '(%d, %d) - InferenceError: Cannot infer return type for method "%s".' +) + +DIVIDE_BY_ZERO = "(%d, %d) - ZeroDivisionError: Division by zero." +INPUT_INT_ERROR = "(%d, %d) - InputError: Expected a number." +MAIN_CLASS_NOT_FOUND = "(%d, %d) - MainClassNotFound: no Main class in program." +MAIN_METHOD_NOT_FOUND = "(%d, %d) - MainMethodNotFound: no main method in class Main." +VOID_EXPRESSION = "(%d, %d) - VoidReferenceError: Object reference not set to an instance of an object." +CASE_OF_ERROR = "(%d, %d) - CaseOfError: No branch matches wit de dynamic type of the case expression." diff --git a/src/cool/semantics/utils/scope.py b/src/cool/semantics/utils/scope.py new file mode 100644 index 000000000..3e184ff0f --- /dev/null +++ b/src/cool/semantics/utils/scope.py @@ -0,0 +1,348 @@ +from collections import OrderedDict +from typing import List, Optional, Dict, Tuple, Union + + +class SemanticError(Exception): + @property + def text(self): + return self.args[0] + + +class Attribute: + def __init__(self, name, typex): + self.name: str = name + self.type: "Type" = typex + + def __str__(self): + return f"[attrib] {self.name} : {self.type.name};" + + def __repr__(self): + return str(self) + + +class Method: + def __init__(self, name, param_names, params_types, return_type): + self.name: str = name + self.param_names: List[str] = param_names + self.param_types: List["Type"] = params_types + self.return_type: "Type" = return_type + + def __str__(self): + params = ", ".join( + f"{n}: {t.name}" for n, t in zip(self.param_names, self.param_types) + ) + return f"[method] {self.name}({params}): {self.return_type.name};" + + def __eq__(self, other): + return ( + other.name == self.name + and other.return_type == self.return_type + and tuple(other.param_types) == tuple(self.param_types) + ) + + +class Type: + def __init__(self, name: str): + self.name: str = name + self.attributes_dict: OrderedDict[str, Attribute] = OrderedDict() + self.methods_dict: OrderedDict[str, Method] = OrderedDict() + self.parent: Optional["Type"] = None + + @property + def attributes(self): + return [x for _, x in self.attributes_dict.items()] + + @property + def methods(self): + return [x for _, x in self.methods_dict.items()] + + def set_parent(self, parent: "Type") -> None: + if self.parent is not None: + raise SemanticError(f"Parent type is already set for {self.name}.") + self.parent = parent + + def get_attribute( + self, name: str, get_owner: bool = False + ) -> Union[Attribute, Tuple[Attribute, "Type"]]: + """ + Search the innermost declaration of the attribute with the given name and return it, if "get_owner" has + value "True" the returned object is a tuple (attribute, type) where type is the innermost `Type` in th Type + Hierarchy where the attribute is defined. If the method does not exist in the hierarchy then a SemanticError is + raised. + + :param name: str, name of the attribute + + :param get_owner: bool, if has value "True" then a tuple (attribute, type) is returned else only the method is + returned + + :return: the desired attribute and it's optional type owner. + """ + try: + return ( + self.attributes_dict[name] + if not get_owner + else (self.attributes_dict[name], self) + ) + except KeyError: + if self.parent is None: + raise SemanticError( + f'Attribute "{name}" is not defined in {self.name}.' + ) + try: + return self.parent.get_attribute(name, get_owner) + except SemanticError: + raise SemanticError( + f'Attribute "{name}" is not defined in {self.name}.' + ) + + def define_attribute(self, name: str, typex: "Type") -> Attribute: + try: + self.get_attribute(name) + except SemanticError: + attribute = Attribute(name, typex) + self.attributes_dict[name] = attribute + return attribute + else: + raise SemanticError( + f'Attribute "{name}" is already defined in {self.name}.' + ) + + def contains_attribute(self, name: str) -> bool: + return ( + name in self.attributes_dict + or self.parent is not None + and self.parent.contains_attribute(name) + ) + + def get_method( + self, name: str, get_owner: bool = False + ) -> Union[Method, Tuple[Method, "Type"]]: + """ + Search the innermost declaration of the method with the given name and return it, if "get_owner" has + value "True" the returned object is a tuple (method, type) where type is the innermost `Type` in th Type + Hierarchy where the methods is defined. If the method does not exist in the hierarchy then a SemanticError is + raised + + :param name: str, name of the method + + :param get_owner: bool, if has value "True" then a tuple (method, type) is returned else only the method is + returned + + :return: the desired method and it's optional type owner. + """ + try: + return ( + self.methods_dict[name] + if not get_owner + else (self.methods_dict[name], self) + ) + except KeyError: + if self.parent is None: + raise SemanticError(f'Method "{name}" is not defined in {self.name}.') + try: + return self.parent.get_method(name, get_owner) + except SemanticError: + raise SemanticError(f'Method "{name}" is not defined in {self.name}.') + + def define_method( + self, + name: str, + param_names: List[str], + param_types: List["Type"], + return_type: "Type", + ) -> Method: + if name in self.methods_dict: + raise SemanticError(f'Method "{name}" already defined in {self.name}') + + method = Method(name, param_names, param_types, return_type) + self.methods_dict[name] = method + return method + + def contains_method(self, name) -> bool: + return name in self.methods_dict or ( + self.parent is not None and self.parent.contains_method(name) + ) + + def all_attributes(self) -> List[Tuple[Attribute, "Type"]]: + attributes = [] if self.parent is None else self.parent.all_attributes() + attributes += [(x, self) for x in self.attributes] + return attributes + + def all_methods(self) -> List[Tuple[Method, "Type"]]: + methods = [] if self.parent is None else self.parent.all_methods() + methods += [(x, self) for x in self.methods] + return methods + + def conforms_to(self, other: "Type") -> bool: + return ( + other.bypass() + or self == other + or self.parent is not None + and self.parent.conforms_to(other) + ) + + def join(self, other: "Type") -> "Type": + if isinstance(self, ErrorType): + return other + + if isinstance(other, ErrorType): + return self + + self_ancestors = set(self.get_ancestors()) + + current_type = other + while current_type is not None: + if current_type in self_ancestors: + break + current_type = current_type.parent + return current_type + + @staticmethod + def multi_join(types: List["Type"]) -> "Type": + static_type = types[0] + for t in types[1:]: + static_type = static_type.join(t) + return static_type + + def bypass(self) -> bool: + return False + + def get_ancestors(self) -> List["Type"]: + if self.parent is None: + return [self] + return [self] + self.parent.get_ancestors() + + def __str__(self): + output = f"type {self.name}" + parent = "" if self.parent is None else f" : {self.parent.name}" + output += parent + output += " {" + output += "\n\t" if self.attributes or self.methods else "" + output += "\n\t".join(str(x) for x in self.attributes) + output += "\n\t" if self.attributes_dict else "" + output += "\n\t".join(str(x) for x in self.methods) + output += "\n" if self.methods_dict else "" + output += "}\n" + return output + + def __repr__(self): + return str(self) + + +class ErrorType(Type): + def __init__(self): + super().__init__("Error") + + def conforms_to(self, other): + return True + + def bypass(self): + return True + + def __eq__(self, other): + return isinstance(other, Type) + + +class Context: + def __init__(self): + self.types: Dict[str, Type] = {} + + def create_type(self, name: str) -> Type: + if name in self.types: + raise SemanticError(f"Type with the same name ({name}) already in context.") + typex = self.types[name] = Type(name) + return typex + + def get_type(self, name: str) -> Type: + try: + return self.types[name] + except KeyError: + raise SemanticError(f'Type "{name}" is not defined.') + + def __str__(self): + return ( + "{\n\t" + + "\n\t".join(y for x in self.types.values() for y in str(x).split("\n")) + + "\n}" + ) + + def __repr__(self): + return str(self) + + def __iter__(self): + return iter(self.types.values()) + + +class VariableInfo: + def __init__(self, name, var_type): + self.name: str = name + self.type: Type = var_type + + def __str__(self): + return self.name + ": " + self.type.name + + +class Scope: + def __init__(self, parent: Optional["Scope"] = None): + self.locals: Dict[str, VariableInfo] = {} + self.parent: Optional["Scope"] = parent + self.children: List[Scope] = [] + + def create_child(self) -> "Scope": + child = Scope(self) + self.children.append(child) + return child + + def define_variable(self, var_name: str, var_type: Type) -> VariableInfo: + info = VariableInfo(var_name, var_type) + self.locals[var_name] = info + return info + + def find_variable(self, var_name: str) -> Optional[VariableInfo]: + try: + return self.locals[var_name] + except KeyError: + return ( + self.parent.find_variable(var_name) if self.parent is not None else None + ) + + def find_all_variables_with_name(self, var_name: str) -> List[VariableInfo]: + vars = [] + scope = self + while scope is not None: + if var_name in scope.locals: + vars.append(scope.locals[var_name]) + + scope = scope.parent + + return vars + + def is_defined(self, var_name) -> bool: + return self.find_variable(var_name) is not None + + def is_local(self, var_name: str) -> bool: + return var_name in self.locals + + def clear(self): + self.children = [] + + def scope_to_string(self, tab: int = 0) -> str: + s = " " * tab + "{" + for local in self.locals.values(): + s += "\n" + " " * (tab + 1) + f"{local.name}: {local.type.name}" + + s += "\n" + " " * (tab + 1) + f"children ({len(self.children)}): [\n" + + for child in self.children: + s += child.scope_to_string(tab + 2) + ",\n" + + s += "\n" + " " * (tab + 1) + f"]" + + s += "\n" + " " * tab + "}" + return s + + def __len__(self): + return len(self.locals) + + def __str__(self) -> str: + return self.scope_to_string() diff --git a/src/cool/visitor/__init__.py b/src/cool/visitor/__init__.py new file mode 100644 index 000000000..2c288e23c --- /dev/null +++ b/src/cool/visitor/__init__.py @@ -0,0 +1 @@ +from cool.visitor.visitor import on, when diff --git a/src/cool/visitor/visitor.py b/src/cool/visitor/visitor.py new file mode 100644 index 000000000..3d605865f --- /dev/null +++ b/src/cool/visitor/visitor.py @@ -0,0 +1,84 @@ +# The MIT License (MIT) +# +# Copyright © 2013 Curtis Schlak +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software") to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + +import inspect + +__all__ = ["on", "when"] + + +def on(param_name): + def f(fn): + dispatcher = Dispatcher(param_name, fn) + return dispatcher + + return f + + +def when(param_type): + def f(fn): + frame = inspect.currentframe().f_back + func_name = fn.func_name if "func_name" in dir(fn) else fn.__name__ + dispatcher = frame.f_locals[func_name] + if not isinstance(dispatcher, Dispatcher): + dispatcher = dispatcher.dispatcher + dispatcher.add_target(param_type, fn) + + def ff(*args, **kw): + return dispatcher(*args, **kw) + + ff.dispatcher = dispatcher + return ff + + return f + + +class Dispatcher(object): + def __init__(self, param_name, fn): + frame = inspect.currentframe().f_back.f_back + self.top_level = frame.f_locals == frame.f_globals + self.param_index = self.__argspec(fn).args.index(param_name) + self.param_name = param_name + self.targets = {} + + def __call__(self, *args, **kw): + typ = args[self.param_index].__class__ + d = self.targets.get(typ) + if d is not None: + return d(*args, **kw) + else: + t = self.targets + ks = t.keys() + ans = [t[k](*args, **kw) for k in ks if issubclass(typ, k)] + if len(ans) == 1: + return ans.pop() + return ans + + def add_target(self, typ, target): + self.targets[typ] = target + + @staticmethod + def __argspec(fn): + # Support for Python 3 type hints requires inspect.getfullargspec + if hasattr(inspect, "getfullargspec"): + return inspect.getfullargspec(fn) + else: + return inspect.getargspec(fn) diff --git a/src/coolc.py b/src/coolc.py new file mode 100644 index 000000000..21ac15b23 --- /dev/null +++ b/src/coolc.py @@ -0,0 +1,28 @@ +import os +import sys +import subprocess + +input_file = sys.argv[1].replace("\\", "\\\\") +output_file = input_file[:-2] + "mips" + +print("Stranger Bugs Cool Compiler v0.1") +print( + "Copyright (c) 2019: Alejandro Klever Clemente, Laura Tamayo Blanco, Miguel Angel Gonzalez Calles" +) + + +def run(): + sp = subprocess.run( + ["python", "cool", "compile", input_file, output_file], + capture_output=True, + timeout=100, + ) + print(sp.stdout.decode()) + exit(sp.returncode) + + +if os.getcwd().endswith("src"): + run() +else: + os.chdir("src") + run() diff --git a/src/coolc.sh b/src/coolc.sh index 3088de4f9..916038c20 100755 --- a/src/coolc.sh +++ b/src/coolc.sh @@ -3,9 +3,15 @@ INPUT_FILE=$1 OUTPUT_FILE=${INPUT_FILE:0: -2}mips -# Si su compilador no lo hace ya, aquí puede imprimir la información de contacto -echo "LINEA_CON_NOMBRE_Y_VERSION_DEL_COMPILADOR" # TODO: Recuerde cambiar estas -echo "Copyright (c) 2019: Nombre1, Nombre2, Nombre3" # TODO: líneas a los valores correctos +echo "Stranger Bugs Cool Compiler v0.1" +echo "Copyright (c) 2019: Alejandro Klever Clemente, Laura Tamayo Blanco, Miguel Angel Gonzalez Calles" # Llamar al compilador -echo "Compiling $INPUT_FILE into $OUTPUT_FILE" + +if [[ $(pwd) == *src ]] +then + python cool compile "${INPUT_FILE}" "${OUTPUT_FILE}" +else + cd src + python cool compile "${INPUT_FILE}" "${OUTPUT_FILE}" +fi diff --git a/src/makefile b/src/makefile index 30df993f5..cd83fb352 100644 --- a/src/makefile +++ b/src/makefile @@ -1,12 +1,12 @@ -.PHONY: clean - -main: - # Compiling the compiler :) - -clean: - rm -rf build/* - rm -rf ../tests/*/*.mips - -test: - pytest ../tests -v --tb=short -m=${TAG} - +.PHONY: clean + +main: + # Compiling the compiler :) + +clean: + rm -rf build/* + rm -rf ../tests/*/*.mips + +test: + pytest ../tests -v --tb=short -m=${TAG} + diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/codegen/arith.cl b/tests/codegen/arith.cl index af5951cf7..0d9f5dd33 100755 --- a/tests/codegen/arith.cl +++ b/tests/codegen/arith.cl @@ -1,430 +1,430 @@ -(* - * A contribution from Anne Sheets (sheets@cory) - * - * Tests the arithmetic operations and various other things - *) - -class A { - - var : Int <- 0; - - value() : Int { var }; - - set_var(num : Int) : A{ - { - var <- num; - self; - } - }; - - method1(num : Int) : A { -- same - self - }; - - method2(num1 : Int, num2 : Int) : A { -- plus - (let x : Int in - { - x <- num1 + num2; - (new B).set_var(x); - } - ) - }; - - method3(num : Int) : A { -- negate - (let x : Int in - { - x <- ~num; - (new C).set_var(x); - } - ) - }; - - method4(num1 : Int, num2 : Int) : A { -- diff - if num2 < num1 then - (let x : Int in - { - x <- num1 - num2; - (new D).set_var(x); - } - ) - else - (let x : Int in - { - x <- num2 - num1; - (new D).set_var(x); - } - ) - fi - }; - - method5(num : Int) : A { -- factorial - (let x : Int <- 1 in - { - (let y : Int <- 1 in - while y <= num loop - { - x <- x * y; - y <- y + 1; - } - pool - ); - (new E).set_var(x); - } - ) - }; - -}; - -class B inherits A { -- B is a number squared - - method5(num : Int) : A { -- square - (let x : Int in - { - x <- num * num; - (new E).set_var(x); - } - ) - }; - -}; - -class C inherits B { - - method6(num : Int) : A { -- negate - (let x : Int in - { - x <- ~num; - (new A).set_var(x); - } - ) - }; - - method5(num : Int) : A { -- cube - (let x : Int in - { - x <- num * num * num; - (new E).set_var(x); - } - ) - }; - -}; - -class D inherits B { - - method7(num : Int) : Bool { -- divisible by 3 - (let x : Int <- num in - if x < 0 then method7(~x) else - if 0 = x then true else - if 1 = x then false else - if 2 = x then false else - method7(x - 3) - fi fi fi fi - ) - }; - -}; - -class E inherits D { - - method6(num : Int) : A { -- division - (let x : Int in - { - x <- num / 8; - (new A).set_var(x); - } - ) - }; - -}; - -(* The following code is from atoi.cl in ~cs164/examples *) - -(* - The class A2I provides integer-to-string and string-to-integer -conversion routines. To use these routines, either inherit them -in the class where needed, have a dummy variable bound to -something of type A2I, or simpl write (new A2I).method(argument). -*) - - -(* - c2i Converts a 1-character string to an integer. Aborts - if the string is not "0" through "9" -*) -class A2I { - - c2i(char : String) : Int { - if char = "0" then 0 else - if char = "1" then 1 else - if char = "2" then 2 else - if char = "3" then 3 else - if char = "4" then 4 else - if char = "5" then 5 else - if char = "6" then 6 else - if char = "7" then 7 else - if char = "8" then 8 else - if char = "9" then 9 else - { abort(); 0; } (* the 0 is needed to satisfy the - typchecker *) - fi fi fi fi fi fi fi fi fi fi - }; - -(* - i2c is the inverse of c2i. -*) - i2c(i : Int) : String { - if i = 0 then "0" else - if i = 1 then "1" else - if i = 2 then "2" else - if i = 3 then "3" else - if i = 4 then "4" else - if i = 5 then "5" else - if i = 6 then "6" else - if i = 7 then "7" else - if i = 8 then "8" else - if i = 9 then "9" else - { abort(); ""; } -- the "" is needed to satisfy the typchecker - fi fi fi fi fi fi fi fi fi fi - }; - -(* - a2i converts an ASCII string into an integer. The empty string -is converted to 0. Signed and unsigned strings are handled. The -method aborts if the string does not represent an integer. Very -long strings of digits produce strange answers because of arithmetic -overflow. - -*) - a2i(s : String) : Int { - if s.length() = 0 then 0 else - if s.substr(0,1) = "-" then ~a2i_aux(s.substr(1,s.length()-1)) else - if s.substr(0,1) = "+" then a2i_aux(s.substr(1,s.length()-1)) else - a2i_aux(s) - fi fi fi - }; - -(* a2i_aux converts the usigned portion of the string. As a - programming example, this method is written iteratively. *) - - - a2i_aux(s : String) : Int { - (let int : Int <- 0 in - { - (let j : Int <- s.length() in - (let i : Int <- 0 in - while i < j loop - { - int <- int * 10 + c2i(s.substr(i,1)); - i <- i + 1; - } - pool - ) - ); - int; - } - ) - }; - -(* i2a converts an integer to a string. Positive and negative - numbers are handled correctly. *) - - i2a(i : Int) : String { - if i = 0 then "0" else - if 0 < i then i2a_aux(i) else - "-".concat(i2a_aux(i * ~1)) - fi fi - }; - -(* i2a_aux is an example using recursion. *) - - i2a_aux(i : Int) : String { - if i = 0 then "" else - (let next : Int <- i / 10 in - i2a_aux(next).concat(i2c(i - next * 10)) - ) - fi - }; - -}; - -class Main inherits IO { - - char : String; - avar : A; - a_var : A; - flag : Bool <- true; - - - menu() : String { - { - out_string("\n\tTo add a number to "); - print(avar); - out_string("...enter a:\n"); - out_string("\tTo negate "); - print(avar); - out_string("...enter b:\n"); - out_string("\tTo find the difference between "); - print(avar); - out_string("and another number...enter c:\n"); - out_string("\tTo find the factorial of "); - print(avar); - out_string("...enter d:\n"); - out_string("\tTo square "); - print(avar); - out_string("...enter e:\n"); - out_string("\tTo cube "); - print(avar); - out_string("...enter f:\n"); - out_string("\tTo find out if "); - print(avar); - out_string("is a multiple of 3...enter g:\n"); - out_string("\tTo divide "); - print(avar); - out_string("by 8...enter h:\n"); - out_string("\tTo get a new number...enter j:\n"); - out_string("\tTo quit...enter q:\n\n"); - in_string(); - } - }; - - prompt() : String { - { - out_string("\n"); - out_string("Please enter a number... "); - in_string(); - } - }; - - get_int() : Int { - { - (let z : A2I <- new A2I in - (let s : String <- prompt() in - z.a2i(s) - ) - ); - } - }; - - is_even(num : Int) : Bool { - (let x : Int <- num in - if x < 0 then is_even(~x) else - if 0 = x then true else - if 1 = x then false else - is_even(x - 2) - fi fi fi - ) - }; - - class_type(var : A) : IO { - case var of - a : A => out_string("Class type is now A\n"); - b : B => out_string("Class type is now B\n"); - c : C => out_string("Class type is now C\n"); - d : D => out_string("Class type is now D\n"); - e : E => out_string("Class type is now E\n"); - o : Object => out_string("Oooops\n"); - esac - }; - - print(var : A) : IO { - (let z : A2I <- new A2I in - { - out_string(z.i2a(var.value())); - out_string(" "); - } - ) - }; - - main() : Object { - { - avar <- (new A); - while flag loop - { - -- avar <- (new A).set_var(get_int()); - out_string("number "); - print(avar); - if is_even(avar.value()) then - out_string("is even!\n") - else - out_string("is odd!\n") - fi; - -- print(avar); -- prints out answer - class_type(avar); - char <- menu(); - if char = "a" then -- add - { - a_var <- (new A).set_var(get_int()); - avar <- (new B).method2(avar.value(), a_var.value()); - } else - if char = "b" then -- negate - case avar of - c : C => avar <- c.method6(c.value()); - a : A => avar <- a.method3(a.value()); - o : Object => { - out_string("Oooops\n"); - abort(); 0; - }; - esac else - if char = "c" then -- diff - { - a_var <- (new A).set_var(get_int()); - avar <- (new D).method4(avar.value(), a_var.value()); - } else - if char = "d" then avar <- (new C)@A.method5(avar.value()) else - -- factorial - if char = "e" then avar <- (new C)@B.method5(avar.value()) else - -- square - if char = "f" then avar <- (new C)@C.method5(avar.value()) else - -- cube - if char = "g" then -- multiple of 3? - if ((new D).method7(avar.value())) - then -- avar <- (new A).method1(avar.value()) - { - out_string("number "); - print(avar); - out_string("is divisible by 3.\n"); - } - else -- avar <- (new A).set_var(0) - { - out_string("number "); - print(avar); - out_string("is not divisible by 3.\n"); - } - fi else - if char = "h" then - (let x : A in - { - x <- (new E).method6(avar.value()); - (let r : Int <- (avar.value() - (x.value() * 8)) in - { - out_string("number "); - print(avar); - out_string("is equal to "); - print(x); - out_string("times 8 with a remainder of "); - (let a : A2I <- new A2I in - { - out_string(a.i2a(r)); - out_string("\n"); - } - ); -- end let a: - } - ); -- end let r: - avar <- x; - } - ) -- end let x: - else - if char = "j" then avar <- (new A) - else - if char = "q" then flag <- false - else - avar <- (new A).method1(avar.value()) -- divide/8 - fi fi fi fi fi fi fi fi fi fi; - } - pool; - } - }; - -}; - +(* + * A contribution from Anne Sheets (sheets@cory) + * + * Tests the arithmetic operations and various other things + *) + +class A { + + var : Int <- 0; + + value() : Int { var }; + + set_var(num : Int) : A{ + { + var <- num; + self; + } + }; + + method1(num : Int) : A { -- same + self + }; + + method2(num1 : Int, num2 : Int) : A { -- plus + (let x : Int in + { + x <- num1 + num2; + (new B).set_var(x); + } + ) + }; + + method3(num : Int) : A { -- negate + (let x : Int in + { + x <- ~num; + (new C).set_var(x); + } + ) + }; + + method4(num1 : Int, num2 : Int) : A { -- diff + if num2 < num1 then + (let x : Int in + { + x <- num1 - num2; + (new D).set_var(x); + } + ) + else + (let x : Int in + { + x <- num2 - num1; + (new D).set_var(x); + } + ) + fi + }; + + method5(num : Int) : A { -- factorial + (let x : Int <- 1 in + { + (let y : Int <- 1 in + while y <= num loop + { + x <- x * y; + y <- y + 1; + } + pool + ); + (new E).set_var(x); + } + ) + }; + +}; + +class B inherits A { -- B is a number squared + + method5(num : Int) : A { -- square + (let x : Int in + { + x <- num * num; + (new E).set_var(x); + } + ) + }; + +}; + +class C inherits B { + + method6(num : Int) : A { -- negate + (let x : Int in + { + x <- ~num; + (new A).set_var(x); + } + ) + }; + + method5(num : Int) : A { -- cube + (let x : Int in + { + x <- num * num * num; + (new E).set_var(x); + } + ) + }; + +}; + +class D inherits B { + + method7(num : Int) : Bool { -- divisible by 3 + (let x : Int <- num in + if x < 0 then method7(~x) else + if 0 = x then true else + if 1 = x then false else + if 2 = x then false else + method7(x - 3) + fi fi fi fi + ) + }; + +}; + +class E inherits D { + + method6(num : Int) : A { -- division + (let x : Int in + { + x <- num / 8; + (new A).set_var(x); + } + ) + }; + +}; + +(* The following code is from atoi.cl in ~cs164/examples *) + +(* + The class A2I provides integer-to-string and string-to-integer +conversion routines. To use these routines, either inherit them +in the class where needed, have a dummy variable bound to +something of type A2I, or simpl write (new A2I).method(argument). +*) + + +(* + c2i Converts a 1-character string to an integer. Aborts + if the string is not "0" through "9" +*) +class A2I { + + c2i(char : String) : Int { + if char = "0" then 0 else + if char = "1" then 1 else + if char = "2" then 2 else + if char = "3" then 3 else + if char = "4" then 4 else + if char = "5" then 5 else + if char = "6" then 6 else + if char = "7" then 7 else + if char = "8" then 8 else + if char = "9" then 9 else + { abort(); 0; } (* the 0 is needed to satisfy the + typchecker *) + fi fi fi fi fi fi fi fi fi fi + }; + +(* + i2c is the inverse of c2i. +*) + i2c(i : Int) : String { + if i = 0 then "0" else + if i = 1 then "1" else + if i = 2 then "2" else + if i = 3 then "3" else + if i = 4 then "4" else + if i = 5 then "5" else + if i = 6 then "6" else + if i = 7 then "7" else + if i = 8 then "8" else + if i = 9 then "9" else + { abort(); ""; } -- the "" is needed to satisfy the typchecker + fi fi fi fi fi fi fi fi fi fi + }; + +(* + a2i converts an ASCII string into an integer. The empty string +is converted to 0. Signed and unsigned strings are handled. The +method aborts if the string does not represent an integer. Very +long strings of digits produce strange answers because of arithmetic +overflow. + +*) + a2i(s : String) : Int { + if s.length() = 0 then 0 else + if s.substr(0,1) = "-" then ~a2i_aux(s.substr(1,s.length()-1)) else + if s.substr(0,1) = "+" then a2i_aux(s.substr(1,s.length()-1)) else + a2i_aux(s) + fi fi fi + }; + +(* a2i_aux converts the usigned portion of the string. As a + programming example, this method is written iteratively. *) + + + a2i_aux(s : String) : Int { + (let int : Int <- 0 in + { + (let j : Int <- s.length() in + (let i : Int <- 0 in + while i < j loop + { + int <- int * 10 + c2i(s.substr(i,1)); + i <- i + 1; + } + pool + ) + ); + int; + } + ) + }; + +(* i2a converts an integer to a string. Positive and negative + numbers are handled correctly. *) + + i2a(i : Int) : String { + if i = 0 then "0" else + if 0 < i then i2a_aux(i) else + "-".concat(i2a_aux(i * ~1)) + fi fi + }; + +(* i2a_aux is an example using recursion. *) + + i2a_aux(i : Int) : String { + if i = 0 then "" else + (let next : Int <- i / 10 in + i2a_aux(next).concat(i2c(i - next * 10)) + ) + fi + }; + +}; + +class Main inherits IO { + + char : String; + avar : A; + a_var : A; + flag : Bool <- true; + + + menu() : String { + { + out_string("\n\tTo add a number to "); + print(avar); + out_string("...enter a:\n"); + out_string("\tTo negate "); + print(avar); + out_string("...enter b:\n"); + out_string("\tTo find the difference between "); + print(avar); + out_string("and another number...enter c:\n"); + out_string("\tTo find the factorial of "); + print(avar); + out_string("...enter d:\n"); + out_string("\tTo square "); + print(avar); + out_string("...enter e:\n"); + out_string("\tTo cube "); + print(avar); + out_string("...enter f:\n"); + out_string("\tTo find out if "); + print(avar); + out_string("is a multiple of 3...enter g:\n"); + out_string("\tTo divide "); + print(avar); + out_string("by 8...enter h:\n"); + out_string("\tTo get a new number...enter j:\n"); + out_string("\tTo quit...enter q:\n\n"); + in_string(); + } + }; + + prompt() : String { + { + out_string("\n"); + out_string("Please enter a number... "); + in_string(); + } + }; + + get_int() : Int { + { + (let z : A2I <- new A2I in + (let s : String <- prompt() in + z.a2i(s) + ) + ); + } + }; + + is_even(num : Int) : Bool { + (let x : Int <- num in + if x < 0 then is_even(~x) else + if 0 = x then true else + if 1 = x then false else + is_even(x - 2) + fi fi fi + ) + }; + + class_type(var : A) : IO { + case var of + a : A => out_string("Class type is now A\n"); + b : B => out_string("Class type is now B\n"); + c : C => out_string("Class type is now C\n"); + d : D => out_string("Class type is now D\n"); + e : E => out_string("Class type is now E\n"); + o : Object => out_string("Oooops\n"); + esac + }; + + print(var : A) : IO { + (let z : A2I <- new A2I in + { + out_string(z.i2a(var.value())); + out_string(" "); + } + ) + }; + + main() : Object { + { + avar <- (new A); + while flag loop + { + -- avar <- (new A).set_var(get_int()); + out_string("number "); + print(avar); + if is_even(avar.value()) then + out_string("is even!\n") + else + out_string("is odd!\n") + fi; + -- print(avar); -- prints out answer + class_type(avar); + char <- menu(); + if char = "a" then -- add + { + a_var <- (new A).set_var(get_int()); + avar <- (new B).method2(avar.value(), a_var.value()); + } else + if char = "b" then -- negate + case avar of + c : C => avar <- c.method6(c.value()); + a : A => avar <- a.method3(a.value()); + o : Object => { + out_string("Oooops\n"); + abort(); 0; + }; + esac else + if char = "c" then -- diff + { + a_var <- (new A).set_var(get_int()); + avar <- (new D).method4(avar.value(), a_var.value()); + } else + if char = "d" then avar <- (new C)@A.method5(avar.value()) else + -- factorial + if char = "e" then avar <- (new C)@B.method5(avar.value()) else + -- square + if char = "f" then avar <- (new C)@C.method5(avar.value()) else + -- cube + if char = "g" then -- multiple of 3? + if ((new D).method7(avar.value())) + then -- avar <- (new A).method1(avar.value()) + { + out_string("number "); + print(avar); + out_string("is divisible by 3.\n"); + } + else -- avar <- (new A).set_var(0) + { + out_string("number "); + print(avar); + out_string("is not divisible by 3.\n"); + } + fi else + if char = "h" then + (let x : A in + { + x <- (new E).method6(avar.value()); + (let r : Int <- (avar.value() - (x.value() * 8)) in + { + out_string("number "); + print(avar); + out_string("is equal to "); + print(x); + out_string("times 8 with a remainder of "); + (let a : A2I <- new A2I in + { + out_string(a.i2a(r)); + out_string("\n"); + } + ); -- end let a: + } + ); -- end let r: + avar <- x; + } + ) -- end let x: + else + if char = "j" then avar <- (new A) + else + if char = "q" then flag <- false + else + avar <- (new A).method1(avar.value()) -- divide/8 + fi fi fi fi fi fi fi fi fi fi; + } + pool; + } + }; + +}; + diff --git a/tests/codegen/arith.mips b/tests/codegen/arith.mips new file mode 100644 index 000000000..bbb741182 --- /dev/null +++ b/tests/codegen/arith.mips @@ -0,0 +1,21248 @@ +.data + type_Object: .word 24 + type_Object_inherits_from: .word 0 + type_Object_name_address: .word type_Object_name_size + type_Object___init__: .word function___init___at_Object + type_Object_abort: .word function_abort_at_Object + type_Object_type_name: .word function_type_name_at_Object + type_Object_copy: .word function_copy_at_Object + + type_IO: .word 40 + type_IO_inherits_from: .word type_Object + type_IO_name_address: .word type_IO_name_size + type_IO___init__: .word function___init___at_IO + type_IO_abort: .word function_abort_at_Object + type_IO_type_name: .word function_type_name_at_Object + type_IO_copy: .word function_copy_at_Object + type_IO_out_string: .word function_out_string_at_IO + type_IO_out_int: .word function_out_int_at_IO + type_IO_in_string: .word function_in_string_at_IO + type_IO_in_int: .word function_in_int_at_IO + + type_String: .word 36 + type_String_inherits_from: .word type_Object + type_String_name_address: .word type_String_name_size + type_String___init__: .word function___init___at_String + type_String_abort: .word function_abort_at_Object + type_String_type_name: .word function_type_name_at_Object + type_String_copy: .word function_copy_at_Object + type_String_length: .word function_length_at_String + type_String_concat: .word function_concat_at_String + type_String_substr: .word function_substr_at_String + + type_Int: .word 24 + type_Int_inherits_from: .word type_Object + type_Int_name_address: .word type_Int_name_size + type_Int___init__: .word function___init___at_Int + type_Int_abort: .word function_abort_at_Object + type_Int_type_name: .word function_type_name_at_Object + type_Int_copy: .word function_copy_at_Object + + type_Bool: .word 24 + type_Bool_inherits_from: .word type_Object + type_Bool_name_address: .word type_Bool_name_size + type_Bool___init__: .word function___init___at_Bool + type_Bool_abort: .word function_abort_at_Object + type_Bool_type_name: .word function_type_name_at_Object + type_Bool_copy: .word function_copy_at_Object + + type_A: .word 56 + type_A_inherits_from: .word type_Object + type_A_name_address: .word type_A_name_size + type_A___init__: .word function___init___at_A + type_A_abort: .word function_abort_at_Object + type_A_type_name: .word function_type_name_at_Object + type_A_copy: .word function_copy_at_Object + type_A_value: .word function_value_at_A + type_A_set_var: .word function_set_var_at_A + type_A_method1: .word function_method1_at_A + type_A_method2: .word function_method2_at_A + type_A_method3: .word function_method3_at_A + type_A_method4: .word function_method4_at_A + type_A_method5: .word function_method5_at_A + + type_B: .word 56 + type_B_inherits_from: .word type_A + type_B_name_address: .word type_B_name_size + type_B___init__: .word function___init___at_B + type_B_abort: .word function_abort_at_Object + type_B_type_name: .word function_type_name_at_Object + type_B_copy: .word function_copy_at_Object + type_B_value: .word function_value_at_A + type_B_set_var: .word function_set_var_at_A + type_B_method1: .word function_method1_at_A + type_B_method2: .word function_method2_at_A + type_B_method3: .word function_method3_at_A + type_B_method4: .word function_method4_at_A + type_B_method5: .word function_method5_at_B + + type_C: .word 60 + type_C_inherits_from: .word type_B + type_C_name_address: .word type_C_name_size + type_C___init__: .word function___init___at_C + type_C_abort: .word function_abort_at_Object + type_C_type_name: .word function_type_name_at_Object + type_C_copy: .word function_copy_at_Object + type_C_value: .word function_value_at_A + type_C_set_var: .word function_set_var_at_A + type_C_method1: .word function_method1_at_A + type_C_method2: .word function_method2_at_A + type_C_method3: .word function_method3_at_A + type_C_method4: .word function_method4_at_A + type_C_method5: .word function_method5_at_C + type_C_method6: .word function_method6_at_C + + type_D: .word 60 + type_D_inherits_from: .word type_B + type_D_name_address: .word type_D_name_size + type_D___init__: .word function___init___at_D + type_D_abort: .word function_abort_at_Object + type_D_type_name: .word function_type_name_at_Object + type_D_copy: .word function_copy_at_Object + type_D_value: .word function_value_at_A + type_D_set_var: .word function_set_var_at_A + type_D_method1: .word function_method1_at_A + type_D_method2: .word function_method2_at_A + type_D_method3: .word function_method3_at_A + type_D_method4: .word function_method4_at_A + type_D_method5: .word function_method5_at_B + type_D_method7: .word function_method7_at_D + + type_E: .word 64 + type_E_inherits_from: .word type_D + type_E_name_address: .word type_E_name_size + type_E___init__: .word function___init___at_E + type_E_abort: .word function_abort_at_Object + type_E_type_name: .word function_type_name_at_Object + type_E_copy: .word function_copy_at_Object + type_E_value: .word function_value_at_A + type_E_set_var: .word function_set_var_at_A + type_E_method1: .word function_method1_at_A + type_E_method2: .word function_method2_at_A + type_E_method3: .word function_method3_at_A + type_E_method4: .word function_method4_at_A + type_E_method5: .word function_method5_at_B + type_E_method7: .word function_method7_at_D + type_E_method6: .word function_method6_at_E + + type_A2I: .word 48 + type_A2I_inherits_from: .word type_Object + type_A2I_name_address: .word type_A2I_name_size + type_A2I___init__: .word function___init___at_A2I + type_A2I_abort: .word function_abort_at_Object + type_A2I_type_name: .word function_type_name_at_Object + type_A2I_copy: .word function_copy_at_Object + type_A2I_c2i: .word function_c2i_at_A2I + type_A2I_i2c: .word function_i2c_at_A2I + type_A2I_a2i: .word function_a2i_at_A2I + type_A2I_a2i_aux: .word function_a2i_aux_at_A2I + type_A2I_i2a: .word function_i2a_at_A2I + type_A2I_i2a_aux: .word function_i2a_aux_at_A2I + + type_Main: .word 84 + type_Main_inherits_from: .word type_IO + type_Main_name_address: .word type_Main_name_size + type_Main___init__: .word function___init___at_Main + type_Main_abort: .word function_abort_at_Object + type_Main_type_name: .word function_type_name_at_Object + type_Main_copy: .word function_copy_at_Object + type_Main_out_string: .word function_out_string_at_IO + type_Main_out_int: .word function_out_int_at_IO + type_Main_in_string: .word function_in_string_at_IO + type_Main_in_int: .word function_in_int_at_IO + type_Main_menu: .word function_menu_at_Main + type_Main_prompt: .word function_prompt_at_Main + type_Main_get_int: .word function_get_int_at_Main + type_Main_is_even: .word function_is_even_at_Main + type_Main_class_type: .word function_class_type_at_Main + type_Main_print: .word function_print_at_Main + type_Main_main: .word function_main_at_Main + + type_Object_name_size: .word 6 + type_Object_name: .asciiz "Object" + + type_IO_name_size: .word 2 + type_IO_name: .asciiz "IO" + + type_String_name_size: .word 6 + type_String_name: .asciiz "String" + + type_Int_name_size: .word 3 + type_Int_name: .asciiz "Int" + + type_Bool_name_size: .word 4 + type_Bool_name: .asciiz "Bool" + + type_A_name_size: .word 1 + type_A_name: .asciiz "A" + + type_B_name_size: .word 1 + type_B_name: .asciiz "B" + + type_C_name_size: .word 1 + type_C_name: .asciiz "C" + + type_D_name_size: .word 1 + type_D_name: .asciiz "D" + + type_E_name_size: .word 1 + type_E_name: .asciiz "E" + + type_A2I_name_size: .word 3 + type_A2I_name: .asciiz "A2I" + + type_Main_name_size: .word 4 + type_Main_name: .asciiz "Main" + + buffer_input: .space 1024 + debug_log: .asciiz "debug_log\n" + +.text + function_add: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Addition operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + add $t2, $t0, $t1 # $t2 = $t0 + $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_sub: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Subtraction operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sub $t2, $t0, $t1 # $t2 = $t0 - $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_mult: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Multiplication operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + mult $t0, $t1 # $t2 = $t0 * $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_div: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Division operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + div $t0, $t1 # $t2 = $t0 / $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_xor: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Xor operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than_or_equal: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sle $t2, $t0, $t1 # $t2 = $t0 <= $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_equal: + # Function parameters + # $ra = 48($sp) + # a = 44($sp) + # b = 40($sp) + + # Reserving space for local variables + addi $sp, $sp, -40 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_0 = address of allocated object Int + + # Allocating NUll to internal_1 + sw $zero, 32($sp) # internal_1 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_2 = address of allocated object Int + + # internal_2 = EqualAddress(a, internal_1) + lw $t0, 44($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # internal_2 = EqualAddress(b, internal_1) + lw $t0, 40($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # If internal_2 then goto a_is_type_object + lw $t0, 28($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_object + + # internal_3 = typeof a that is the first word of the object + lw $t0, 44($sp) + lw $t0, 0($t0) + sw $t0, 24($sp) + + # internal_4 = direction of Int + la $t0, type_Int + sw $t0, 20($sp) + + # internal_5 = direction of Bool + la $t0, type_Bool + sw $t0, 16($sp) + + # internal_6 = direction of String + la $t0, type_String + sw $t0, 12($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_7 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_8 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_9 = address of allocated object Int + + # internal_7 = EqualAddress(internal_3, internal_4) + lw $t0, 24($sp) + lw $t1, 20($sp) + seq $t2, $t0, $t1 + lw $t0, 8($sp) + sw $t2, 8($t0) + + # internal_8 = EqualAddress(internal_3, internal_5) + lw $t0, 24($sp) + lw $t1, 16($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_9 = EqualAddress(internal_3, internal_6) + lw $t0, 24($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_7 then goto a_is_type_int_or_bool + lw $t0, 8($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_8 then goto a_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_9 then goto a_is_type_string + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_string + + # Jumping to a_is_type_object + j a_is_type_object + + a_is_type_int_or_bool: + + # internal_0 = EqualInt(a, b) + lw $t0, 44($sp) + lw $t0, 8($t0) + lw $t1, 40($sp) + lw $t1, 8($t1) + seq $t2, $t0, $t1 + lw $t0, 36($sp) + sw $t2, 8($t0) + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_string: + + # internal_0 = EqualStr(a, b) + lw $t0, 44($sp) + lw $t1, 40($sp) + addi $t0, $t0, 8 + addi $t1, $t1, 8 + + # By default we assume the strings are equals + addi $t4, $zero, 1 + lw $t5, 36($sp) + sw $t4, 8($t5) + + while_compare_strings_start: + lb $t2, 0($t0) + lb $t3, 0($t1) + beq $t2, $t3, while_compare_strings_update + + # The strings are no equals + lw $t5, 36($sp) + sw $zero, 8($t5) + j while_compare_strings_end + + while_compare_strings_update: + addi $t0, $t0, 1 + addi $t1, $t1, 1 + beq $t2, $zero, while_compare_strings_end + beq $t3, $zero, while_compare_strings_end + j while_compare_strings_start + while_compare_strings_end: + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_object: + + # Equal operation + lw $t0, 44($sp) # Save in $t0 the left operand address + lw $t1, 40($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 36($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Jumping to end_of_equal + j end_of_equal + + end_of_equal: + + # Loading return value in $v1 + lw $v1, 36($sp) + + # Freeing space for local variables + addi $sp, $sp, 40 + + jr $ra + + function_assign: + # Function parameters + # $ra = 36($sp) + # dest = 32($sp) + # source = 28($sp) + + # Reserving space for local variables + addi $sp, $sp, -28 + + # Allocating NUll to internal_0 + sw $zero, 24($sp) # internal_0 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_1 = address of allocated object Int + + # internal_1 = EqualAddress(source, internal_0) + lw $t0, 28($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # internal_1 = EqualAddress(dest, internal_0) + lw $t0, 32($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # If internal_1 then goto source_is_type_object + lw $t0, 20($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_object + + # internal_2 = typeof source that is the first word of the object + lw $t0, 28($sp) + lw $t0, 0($t0) + sw $t0, 16($sp) + + # internal_3 = direction of Int + la $t0, type_Int + sw $t0, 12($sp) + + # internal_4 = direction of Bool + la $t0, type_Bool + sw $t0, 8($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_5 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_6 = address of allocated object Int + + # internal_5 = EqualAddress(internal_2, internal_3) + lw $t0, 16($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_6 = EqualAddress(internal_2, internal_4) + lw $t0, 16($sp) + lw $t1, 8($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_5 then goto source_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # If internal_6 then goto source_is_type_int_or_bool + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # Jumping to source_is_type_object + j source_is_type_object + + source_is_type_int_or_bool: + + # dest = source where source is an integer + li $v0, 9 + addi $a0, $zero, 12 + syscall + lw $t0, 28($sp) # Pointer to source + lw $t1, 0($t0) # $t1 = type of source + lw $t2, 8($t0) # $t2 = value of source + sw $t1, 0($v0) # Save type of dest + sw $a0, 4($v0) # Save size of dest + sw $t2, 8($v0) # Save value of dest + sw $v0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_is_type_object: + + # dest = source + lw $t0, 28($sp) + sw $t0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_end_of_equal: + + # Loading return value in $v1 + lw $v1, 32($sp) + + # Freeing space for local variables + addi $sp, $sp, 28 + + jr $ra + + function___init___at_Object: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_abort_at_Object: + # Function parameters + # $ra = 28($sp) + # self = 24($sp) + + # Reserving space for local variables + addi $sp, $sp, -24 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 33 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 33 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 65 + sb $t0, 8($v0) # internal_0[0] = 'A' + + addi $t0, $zero, 98 + sb $t0, 9($v0) # internal_0[1] = 'b' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_0[2] = 'o' + + addi $t0, $zero, 114 + sb $t0, 11($v0) # internal_0[3] = 'r' + + addi $t0, $zero, 116 + sb $t0, 12($v0) # internal_0[4] = 't' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_0[5] = ' ' + + addi $t0, $zero, 99 + sb $t0, 14($v0) # internal_0[6] = 'c' + + addi $t0, $zero, 97 + sb $t0, 15($v0) # internal_0[7] = 'a' + + addi $t0, $zero, 108 + sb $t0, 16($v0) # internal_0[8] = 'l' + + addi $t0, $zero, 108 + sb $t0, 17($v0) # internal_0[9] = 'l' + + addi $t0, $zero, 101 + sb $t0, 18($v0) # internal_0[10] = 'e' + + addi $t0, $zero, 100 + sb $t0, 19($v0) # internal_0[11] = 'd' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_0[12] = ' ' + + addi $t0, $zero, 102 + sb $t0, 21($v0) # internal_0[13] = 'f' + + addi $t0, $zero, 114 + sb $t0, 22($v0) # internal_0[14] = 'r' + + addi $t0, $zero, 111 + sb $t0, 23($v0) # internal_0[15] = 'o' + + addi $t0, $zero, 109 + sb $t0, 24($v0) # internal_0[16] = 'm' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_0[17] = ' ' + + addi $t0, $zero, 99 + sb $t0, 26($v0) # internal_0[18] = 'c' + + addi $t0, $zero, 108 + sb $t0, 27($v0) # internal_0[19] = 'l' + + addi $t0, $zero, 97 + sb $t0, 28($v0) # internal_0[20] = 'a' + + addi $t0, $zero, 115 + sb $t0, 29($v0) # internal_0[21] = 's' + + addi $t0, $zero, 115 + sb $t0, 30($v0) # internal_0[22] = 's' + + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_0[23] = ' ' + + sb $zero, 32($v0) # Null-terminator at the end of the string + + sw $v0, 20($sp) # internal_0 = "Abort called from class " + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_3[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 8($sp) # internal_3 = "\n" + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method type_name of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_5 + lw $t0, 8($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 24($sp) # internal_1 = result of internal_5 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_1 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_2 = result of internal_5 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_3 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_2 = result of internal_5 + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 12($sp) # $t0 = internal_2 + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the String internal_2 + li $v0, 4 + move $a0, $t0 + syscall + + # Exit program + li $v0, 10 + syscall + + # Loading return value in $v1 + lw $v1, 24($sp) + + # Freeing space for local variables + addi $sp, $sp, 24 + + jr $ra + + function_type_name_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = name of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 8($t1) # $t2 = direction of the type name + la $t3, 4($t2) # $t3 = address of the name + lw $t2, 0($t2) # $t2 = length of the name + + addi $t2, $t2, 9 # Setting space for the type, the size and the null byte + li $v0, 9 + move $a0, $t2 + syscall + addi $t2, $t2, -9 # Restoring space for the type, the size and the null byte + + la $t4, type_String + sw $t4, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t4, $v0, 0 # $t4 = direction of the new string + addi $t4, $t4, 8 # Pointer to the first character of the string + xor $t5, $t5, $t5 # Initializing counter + while_copy_name_start: + beq $t5, $t2, while_copy_name_end + lb $t6, 0($t3) # Loading the character + sb $t6, 0($t4) + addi $t4, $t4, 1 # Incrementing the pointer to the new string + addi $t3, $t3, 1 # Incrementing the pointer to the string in self + addi $t5, $t5, 1 # Incrementing counter + j while_copy_name_start + while_copy_name_end: + + sb $zero, 0($t4) # Setting the null byte + + sw $v0, 0($sp) # Storing the new string in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_copy_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = copy of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 4($t0) # $t2 = length of self in bytes + + # Allocating space for the new object + li $v0, 9 + move $a0, $t2 + syscall + move $t3, $v0 # $t3 = direction of the new object + sw $t1, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + # Initializing the variable of the loop + addi $t0, $t0, 8 # Pointer to the first character of the object + addi $t3, $t3, 8 # Pointer to the first character of the object + addi $t2, $2, -8 # Decrementing in 8 the length of the object + xor $t4, $t4, $t4 # Initializing counter + + # Loop copying the object + while_copy_start: + beq $t4, $t2, while_copy_end + lb $t5, 0($t0) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t0, $t0, 1 # Incrementing the pointer to the object + addi $t3, $t3, 1 # Incrementing the pointer to the new object + addi $t4, $t4, 1 # Incrementing counter + j while_copy_start + while_copy_end: + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_IO: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_out_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + lw $t0, 0($sp) # $t0 = x + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the String x + li $v0, 4 + move $a0, $t0 + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_out_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + # Printing the Int x + li $v0, 1 + lw $a0, 0($sp) + lw $a0, 8($a0) + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_in_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + li $v0, 8 + la $a0, buffer_input + li $a1, 1024 + syscall + + xor $t0, $t0, $t0 # Initializing counter + while_read_start: + lb $t1, buffer_input($t0) # Loading the byte + addi $t2, $zero, 10 + beq $t1, $t2, while_read_end + addi $t2, $zero, 13 + beq $t1, $t2, while_read_end + addi $t0, $t0, 1 # Incrementing counter + j while_read_start + while_read_end: + + addi $t0, $t0, 9 # Adding space for the type, the size and the null byte + li $v0, 9 + move $a0, $t0 + syscall + addi $t0, $t0, -9 # Adding space for the type, the size and the null byte + la $t2, type_String + sw $t2, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t3, $v0, 8 # Pointer to the first character of the string + xor $t4, $t4, $t4 # Initializing counter + + while_copy_from_buffer_start: + beq $t4, $t0, while_copy_from_buffer_end + lb $t5, buffer_input($t4) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t3, $t3, 1 # Imcremeenting pointer + addi $t4, $t4, 1 # Incrementing counter + j while_copy_from_buffer_start + while_copy_from_buffer_end: + + sb $zero, 0($t3) # Storing the null byte + + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_in_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + li $v0, 5 + syscall + lw $t0, 0($sp) + sw $v0, 8($t0) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_String: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_length_at_String: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # internal_0 = length of self + lw $t0, 4($sp) + lw $t1, 4($t0) + addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator + lw $t0, 0($sp) + sw $t1, 8($t0) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_concat_at_String: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + # s = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self + s + lw $t0, 8($sp) + lw $t1, 4($sp) + lw $t2, 4($t0) # $t2 = length of str1 + lw $t3, 4($t1) # $t3 = length of str2 + addi $t2, $t2, -9 + addi $t3, $t3, -9 + add $t4, $t2, $t3 # $t4 = length of str1 + str2 + addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) + + li $v0, 9 + move $a0, $t4 + syscall + addi $t4, $t4, -9 # Restoring $t4 = length of str1 + str2 + add $t5, $zero, $v0 # $t5 = address of the new string object + addi $t5, $t5, 8 # $t5 = address of the first byte of the new string + + la $t8, type_String + sw $t8, 0($v0) # Setting type in the first word of th object + + sw $a0, 4($v0) # Setting length of the string in the second word of the object + + # Copying str1 to the new string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_str1_start: + beq $t6, $t2, while_copy_str1_end + lb $t7, 8($t0) + sb $t7, 0($t5) + add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str1_start + while_copy_str1_end: + + # Copying str2 to the new string + while_copy_str2_start: + beq $t6, $t4, while_copy_str2_end + lb $t7, 8($t1) + sb $t7, 0($t5) + add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str2_start + while_copy_str2_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self + s + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_substr_at_String: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + # i = 8($sp) + # l = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self[i:i + l] + lw $t0, 12($sp) # $t0 = address of the string + lw $t1, 4($t0) # $t1 = length of the string + addi $t1, $t1, -9 # $t1 = length of the string + 9 + lw $t2, 8($sp) # $t2 = start of the substring + lw $t2, 8($t2) + lw $t3, 4($sp) # $t3 = length of the substring + lw $t3, 8($t3) + add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring + + bgt $t4, $t1, substring_out_of_bounds + + addi $t3, $t3, 9 + li $v0, 9 + move $a0, $t3 + syscall + addi $t3, $t3, -9 + + la $t5, type_String + sw $t5, 0($v0) # Setting type in the first word of the object + + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t0, $t0, 8 # pointing to the first byte of the string + add $t0, $t0, $t2 # pointing to the first byte of the substring + move $t5, $v0 # $t5 = address of the new string + add $t5, $t5, 8 # pointing to the first byte of the string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_substr_start: + beq $t6, $t3, while_copy_substr_end + lb $t7, 0($t0) + sb $t7, 0($t5) + addi $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of the string + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_substr_start + while_copy_substr_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self[i:i + l] + j substring_not_out_of_bounds + + substring_out_of_bounds: + li $v0, 17 + addi $a0, $zero, 1 + syscall + + substring_not_out_of_bounds: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_Int: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function___init___at_Bool: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function___init___at_A: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Set attribute var of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8753943000938 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8753943000938 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8753943000938 + j object_set_attribute_8753943000938 + int_set_attribute_8753943000938: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.var = internal_0 + j end_set_attribute_8753943000938 + bool_set_attribute_8753943000938: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.var = internal_0 + j end_set_attribute_8753943000938 + object_set_attribute_8753943000938: + sw $t1, 8($t0) # self.var = internal_0 + end_set_attribute_8753943000938: + + # Loading return value in $v1 + lw $v1, 4($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_value_at_A: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Get attribute var of self + lw $t0, 4($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'var' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8753943000962 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8753943000962 + j object_get_attribute_8753943000962 + int_get_attribute_8753943000962: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_0 = self.var + j end_get_attribute_8753943000962 + bool_get_attribute_8753943000962: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_0 = self.var + j end_get_attribute_8753943000962 + object_get_attribute_8753943000962: + sw $t1, 0($sp) # internal_0 = self.var + end_get_attribute_8753943000962: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_set_var_at_A: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # num = 0($sp) + + # Set attribute var of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = num + beq $t1, $zero, object_set_attribute_8753943001013 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8753943001013 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8753943001013 + j object_set_attribute_8753943001013 + int_set_attribute_8753943001013: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.var = num + j end_set_attribute_8753943001013 + bool_set_attribute_8753943001013: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.var = num + j end_set_attribute_8753943001013 + object_set_attribute_8753943001013: + sw $t1, 8($t0) # self.var = num + end_set_attribute_8753943001013: + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_method1_at_A: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # num = 0($sp) + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_method2_at_A: + # Function parameters + # $ra = 36($sp) + # self = 32($sp) + # num1 = 28($sp) + # num2 = 24($sp) + + # Reserving space for local variables + addi $sp, $sp, -24 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # x = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num1 + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing num1 + + # Argument num2 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing num2 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_1 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument x + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing x + + # Argument internal_1 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 32($sp) # x = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating B + li $v0, 9 + lw $a0, type_B + syscall + la $t0, type_B # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 12($sp) # internal_2 = address of allocated object B + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_2 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function___init___at_B + jal function___init___at_B + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_2 = result of function___init___at_B + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method set_var of B + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument x + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing x + + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_3 = result of internal_5 + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 24 + + jr $ra + + function_method3_at_A: + # Function parameters + # $ra = 40($sp) + # self = 36($sp) + # num = 32($sp) + + # Reserving space for local variables + addi $sp, $sp, -32 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # x = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # internal_1 = address of allocated object Int + + # Allocating Int 4294967295 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4294967295 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_2 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_3 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 44($sp) + sw $t0, 4($sp) # Storing num + + # Argument internal_2 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_xor + jal function_xor + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_3 = result of function_xor + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_3 + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing internal_3 + + # Argument internal_1 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_3 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument x + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing x + + # Argument internal_3 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 40($sp) # x = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating C + li $v0, 9 + lw $a0, type_C + syscall + la $t0, type_C # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 12($sp) # internal_4 = address of allocated object C + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_4 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function___init___at_C + jal function___init___at_C + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_4 = result of function___init___at_C + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_6 = address of allocated object Int + + # Get method set_var of C + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_4 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_4 + + # Argument x + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing x + + # Calling function internal_7 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_5 = result of internal_7 + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 32 + + jr $ra + + function_method4_at_A: + # Function parameters + # $ra = 72($sp) + # self = 68($sp) + # num1 = 64($sp) + # num2 = 60($sp) + + # Reserving space for local variables + addi $sp, $sp, -60 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 52($sp) # internal_1 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num2 + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing num2 + + # Argument num1 + lw $t0, 76($sp) + sw $t0, 0($sp) # Storing num1 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 60($sp) # internal_2 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_1 = internal_2 + lw $t0, 48($sp) + sw $t0, 52($sp) + + # If internal_1 then goto then_8753943062748 + lw $t0, 52($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8753943062748 + + # Jumping to else_8753943062748 + j else_8753943062748 + + then_8753943062748: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # x = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num1 + lw $t0, 76($sp) + sw $t0, 4($sp) # Storing num1 + + # Argument num2 + lw $t0, 72($sp) + sw $t0, 0($sp) # Storing num2 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 52($sp) # internal_4 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument x + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing x + + # Argument internal_4 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 56($sp) # x = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating D + li $v0, 9 + lw $a0, type_D + syscall + la $t0, type_D # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 36($sp) # internal_5 = address of allocated object D + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_5 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function___init___at_D + jal function___init___at_D + lw $ra, 4($sp) + sw $v1, 44($sp) # internal_5 = result of function___init___at_D + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_7 = address of allocated object Int + + # Get method set_var of D + lw $t0, 36($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 28($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 24($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_5 + lw $t0, 48($sp) + sw $t0, 4($sp) # Storing internal_5 + + # Argument x + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing x + + # Calling function internal_8 + lw $t0, 36($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 44($sp) # internal_6 = result of internal_8 + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_0 = internal_6 + lw $t0, 32($sp) + sw $t0, 56($sp) + + # Jumping to endif_8753943062748 + j endif_8753943062748 + + else_8753943062748: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # x = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num2 + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing num2 + + # Argument num1 + lw $t0, 76($sp) + sw $t0, 0($sp) # Storing num1 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_10 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument x + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing x + + # Argument internal_10 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_10 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 56($sp) # x = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating D + li $v0, 9 + lw $a0, type_D + syscall + la $t0, type_D # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 12($sp) # internal_11 = address of allocated object D + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_11 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_11 + + # Calling function function___init___at_D + jal function___init___at_D + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_11 = result of function___init___at_D + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_13 = address of allocated object Int + + # Get method set_var of D + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_11 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_11 + + # Argument x + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing x + + # Calling function internal_14 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_12 = result of internal_14 + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_0 = internal_12 + lw $t0, 8($sp) + sw $t0, 56($sp) + + # Jumping to endif_8753943062748 + j endif_8753943062748 + + endif_8753943062748: + + # Loading return value in $v1 + lw $v1, 56($sp) + + # Freeing space for local variables + addi $sp, $sp, 60 + + jr $ra + + function_method5_at_A: + # Function parameters + # $ra = 60($sp) + # self = 56($sp) + # num = 52($sp) + + # Reserving space for local variables + addi $sp, $sp, -52 + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_1 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument x + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing x + + # Argument internal_1 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 60($sp) # x = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_3 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument y + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing y + + # Argument internal_3 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 52($sp) # y = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating NUll to internal_4 + sw $zero, 32($sp) # internal_4 = 0 + + while_start_8753943063860: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument y + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing y + + # Argument num + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing num + + # Calling function function_less_than_or_equal + jal function_less_than_or_equal + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_5 = result of function_less_than_or_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_5 then goto while_body_8753943063860 + lw $t0, 28($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_body_8753943063860 + + # Jumping to while_end_8753943063860 + j while_end_8753943063860 + + while_body_8753943063860: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument x + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing x + + # Argument y + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing y + + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_6 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument x + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing x + + # Argument internal_6 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_6 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 60($sp) # x = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_7 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument y + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing y + + # Argument internal_7 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_8 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument y + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing y + + # Argument internal_8 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_8 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 52($sp) # y = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to while_start_8753943063860 + j while_start_8753943063860 + + while_end_8753943063860: + + # Allocating E + li $v0, 9 + lw $a0, type_E + syscall + la $t0, type_E # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 12($sp) # internal_9 = address of allocated object E + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_9 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function function___init___at_E + jal function___init___at_E + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_9 = result of function___init___at_E + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_11 = address of allocated object Int + + # Get method set_var of E + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_9 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_9 + + # Argument x + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing x + + # Calling function internal_12 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_10 = result of internal_12 + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 52 + + jr $ra + + function___init___at_B: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Set attribute var of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8753942972323 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8753942972323 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8753942972323 + j object_set_attribute_8753942972323 + int_set_attribute_8753942972323: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.var = internal_0 + j end_set_attribute_8753942972323 + bool_set_attribute_8753942972323: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.var = internal_0 + j end_set_attribute_8753942972323 + object_set_attribute_8753942972323: + sw $t1, 8($t0) # self.var = internal_0 + end_set_attribute_8753942972323: + + # Loading return value in $v1 + lw $v1, 4($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_method5_at_B: + # Function parameters + # $ra = 32($sp) + # self = 28($sp) + # num = 24($sp) + + # Reserving space for local variables + addi $sp, $sp, -24 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # x = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 36($sp) + sw $t0, 4($sp) # Storing num + + # Argument num + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing num + + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_1 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument x + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing x + + # Argument internal_1 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 32($sp) # x = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating E + li $v0, 9 + lw $a0, type_E + syscall + la $t0, type_E # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 12($sp) # internal_2 = address of allocated object E + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_2 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function___init___at_E + jal function___init___at_E + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_2 = result of function___init___at_E + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method set_var of E + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument x + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing x + + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_3 = result of internal_5 + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 24 + + jr $ra + + function___init___at_C: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Set attribute var of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8753942973046 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8753942973046 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8753942973046 + j object_set_attribute_8753942973046 + int_set_attribute_8753942973046: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.var = internal_0 + j end_set_attribute_8753942973046 + bool_set_attribute_8753942973046: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.var = internal_0 + j end_set_attribute_8753942973046 + object_set_attribute_8753942973046: + sw $t1, 8($t0) # self.var = internal_0 + end_set_attribute_8753942973046: + + # Loading return value in $v1 + lw $v1, 4($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_method6_at_C: + # Function parameters + # $ra = 40($sp) + # self = 36($sp) + # num = 32($sp) + + # Reserving space for local variables + addi $sp, $sp, -32 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # x = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # internal_1 = address of allocated object Int + + # Allocating Int 4294967295 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4294967295 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_2 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_3 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 44($sp) + sw $t0, 4($sp) # Storing num + + # Argument internal_2 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_xor + jal function_xor + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_3 = result of function_xor + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_3 + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing internal_3 + + # Argument internal_1 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_3 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument x + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing x + + # Argument internal_3 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 40($sp) # x = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating A + li $v0, 9 + lw $a0, type_A + syscall + la $t0, type_A # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 12($sp) # internal_4 = address of allocated object A + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_4 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function___init___at_A + jal function___init___at_A + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_4 = result of function___init___at_A + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_6 = address of allocated object Int + + # Get method set_var of A + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_4 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_4 + + # Argument x + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing x + + # Calling function internal_7 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_5 = result of internal_7 + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 32 + + jr $ra + + function_method5_at_C: + # Function parameters + # $ra = 36($sp) + # self = 32($sp) + # num = 28($sp) + + # Reserving space for local variables + addi $sp, $sp, -28 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # x = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing num + + # Argument num + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing num + + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 32($sp) # internal_1 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_1 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_1 + + # Argument num + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing num + + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_2 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument x + lw $t0, 36($sp) + sw $t0, 4($sp) # Storing x + + # Argument internal_2 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 36($sp) # x = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating E + li $v0, 9 + lw $a0, type_E + syscall + la $t0, type_E # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 12($sp) # internal_3 = address of allocated object E + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_3 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function___init___at_E + jal function___init___at_E + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_3 = result of function___init___at_E + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_5 = address of allocated object Int + + # Get method set_var of E + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_3 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_3 + + # Argument x + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing x + + # Calling function internal_6 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_4 = result of internal_6 + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 28 + + jr $ra + + function___init___at_D: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Set attribute var of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8753942974519 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8753942974519 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8753942974519 + j object_set_attribute_8753942974519 + int_set_attribute_8753942974519: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.var = internal_0 + j end_set_attribute_8753942974519 + bool_set_attribute_8753942974519: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.var = internal_0 + j end_set_attribute_8753942974519 + object_set_attribute_8753942974519: + sw $t1, 8($t0) # self.var = internal_0 + end_set_attribute_8753942974519: + + # Loading return value in $v1 + lw $v1, 4($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_method7_at_D: + # Function parameters + # $ra = 132($sp) + # self = 128($sp) + # num = 124($sp) + + # Reserving space for local variables + addi $sp, $sp, -124 + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument x + lw $t0, 132($sp) + sw $t0, 4($sp) # Storing x + + # Argument num + lw $t0, 136($sp) + sw $t0, 0($sp) # Storing num + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 132($sp) # x = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 112($sp) # internal_2 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 108($sp) # internal_3 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument x + lw $t0, 132($sp) + sw $t0, 4($sp) # Storing x + + # Argument internal_3 + lw $t0, 120($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 116($sp) # internal_4 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_2 = internal_4 + lw $t0, 104($sp) + sw $t0, 112($sp) + + # If internal_2 then goto then_8753943064498 + lw $t0, 112($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8753943064498 + + # Jumping to else_8753943064498 + j else_8753943064498 + + then_8753943064498: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 100($sp) # internal_5 = address of allocated object Int + + # Allocating Int 4294967295 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4294967295 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 96($sp) # internal_6 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 92($sp) # internal_7 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument x + lw $t0, 132($sp) + sw $t0, 4($sp) # Storing x + + # Argument internal_6 + lw $t0, 108($sp) + sw $t0, 0($sp) # Storing internal_6 + + # Calling function function_xor + jal function_xor + lw $ra, 8($sp) + sw $v1, 104($sp) # internal_7 = result of function_xor + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_7 + lw $t0, 104($sp) + sw $t0, 4($sp) # Storing internal_7 + + # Argument internal_5 + lw $t0, 112($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 104($sp) # internal_7 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 11 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 11 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 84($sp) # internal_9 = address of allocated object Int + + # Get method method7 of D + lw $t0, 128($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 84($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 80($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 140($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_7 + lw $t0, 104($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function internal_10 + lw $t0, 92($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 100($sp) # internal_8 = result of internal_10 + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_1 = internal_8 + lw $t0, 88($sp) + sw $t0, 116($sp) + + # Jumping to endif_8753943064498 + j endif_8753943064498 + + else_8753943064498: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 72($sp) # internal_12 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 68($sp) # internal_13 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_13 + lw $t0, 80($sp) + sw $t0, 4($sp) # Storing internal_13 + + # Argument x + lw $t0, 132($sp) + sw $t0, 0($sp) # Storing x + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 76($sp) # internal_14 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_12 = internal_14 + lw $t0, 64($sp) + sw $t0, 72($sp) + + # If internal_12 then goto then_8753943064477 + lw $t0, 72($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8753943064477 + + # Jumping to else_8753943064477 + j else_8753943064477 + + then_8753943064477: + + # Allocating Bool 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 60($sp) # internal_15 = address of allocated object Int + + # internal_11 = internal_15 + lw $t0, 60($sp) + sw $t0, 76($sp) + + # Jumping to endif_8753943064477 + j endif_8753943064477 + + else_8753943064477: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 52($sp) # internal_17 = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 48($sp) # internal_18 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_18 + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing internal_18 + + # Argument x + lw $t0, 132($sp) + sw $t0, 0($sp) # Storing x + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 56($sp) # internal_19 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_17 = internal_19 + lw $t0, 44($sp) + sw $t0, 52($sp) + + # If internal_17 then goto then_8753943064480 + lw $t0, 52($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8753943064480 + + # Jumping to else_8753943064480 + j else_8753943064480 + + then_8753943064480: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_20 = address of allocated object Int + + # internal_16 = internal_20 + lw $t0, 40($sp) + sw $t0, 56($sp) + + # Jumping to endif_8753943064480 + j endif_8753943064480 + + else_8753943064480: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_22 = address of allocated object Int + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_23 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_23 + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing internal_23 + + # Argument x + lw $t0, 132($sp) + sw $t0, 0($sp) # Storing x + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_24 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_22 = internal_24 + lw $t0, 24($sp) + sw $t0, 32($sp) + + # If internal_22 then goto then_8753943064486 + lw $t0, 32($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8753943064486 + + # Jumping to else_8753943064486 + j else_8753943064486 + + then_8753943064486: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_25 = address of allocated object Int + + # internal_21 = internal_25 + lw $t0, 20($sp) + sw $t0, 36($sp) + + # Jumping to endif_8753943064486 + j endif_8753943064486 + + else_8753943064486: + + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_26 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument x + lw $t0, 132($sp) + sw $t0, 4($sp) # Storing x + + # Argument internal_26 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_26 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_27 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 11 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 11 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_29 = address of allocated object Int + + # Get method method7 of D + lw $t0, 128($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 140($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_27 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_27 + + # Calling function internal_30 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_28 = result of internal_30 + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_21 = internal_28 + lw $t0, 8($sp) + sw $t0, 36($sp) + + # Jumping to endif_8753943064486 + j endif_8753943064486 + + endif_8753943064486: + + # internal_16 = internal_21 + lw $t0, 36($sp) + sw $t0, 56($sp) + + # Jumping to endif_8753943064480 + j endif_8753943064480 + + endif_8753943064480: + + # internal_11 = internal_16 + lw $t0, 56($sp) + sw $t0, 76($sp) + + # Jumping to endif_8753943064477 + j endif_8753943064477 + + endif_8753943064477: + + # internal_1 = internal_11 + lw $t0, 76($sp) + sw $t0, 116($sp) + + # Jumping to endif_8753943064498 + j endif_8753943064498 + + endif_8753943064498: + + # Loading return value in $v1 + lw $v1, 116($sp) + + # Freeing space for local variables + addi $sp, $sp, 124 + + jr $ra + + function___init___at_E: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Set attribute var of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8753942976428 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8753942976428 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8753942976428 + j object_set_attribute_8753942976428 + int_set_attribute_8753942976428: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.var = internal_0 + j end_set_attribute_8753942976428 + bool_set_attribute_8753942976428: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.var = internal_0 + j end_set_attribute_8753942976428 + object_set_attribute_8753942976428: + sw $t1, 8($t0) # self.var = internal_0 + end_set_attribute_8753942976428: + + # Loading return value in $v1 + lw $v1, 4($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_method6_at_E: + # Function parameters + # $ra = 36($sp) + # self = 32($sp) + # num = 28($sp) + + # Reserving space for local variables + addi $sp, $sp, -28 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # x = address of allocated object Int + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_1 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing num + + # Argument internal_1 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_div + jal function_div + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_2 = result of function_div + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument x + lw $t0, 36($sp) + sw $t0, 4($sp) # Storing x + + # Argument internal_2 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 36($sp) # x = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating A + li $v0, 9 + lw $a0, type_A + syscall + la $t0, type_A # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 12($sp) # internal_3 = address of allocated object A + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_3 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function___init___at_A + jal function___init___at_A + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_3 = result of function___init___at_A + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_5 = address of allocated object Int + + # Get method set_var of A + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_3 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_3 + + # Argument x + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing x + + # Calling function internal_6 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_4 = result of internal_6 + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 28 + + jr $ra + + function___init___at_A2I: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_c2i_at_A2I: + # Function parameters + # $ra = 224($sp) + # self = 220($sp) + # char = 216($sp) + + # Reserving space for local variables + addi $sp, $sp, -216 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 208($sp) # internal_1 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 48 + sb $t0, 8($v0) # internal_2[0] = '0' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 204($sp) # internal_2 = "0" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument char + lw $t0, 228($sp) + sw $t0, 4($sp) # Storing char + + # Argument internal_2 + lw $t0, 216($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 212($sp) # internal_3 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_1 = internal_3 + lw $t0, 200($sp) + sw $t0, 208($sp) + + # If internal_1 then goto then_8753943065664 + lw $t0, 208($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8753943065664 + + # Jumping to else_8753943065664 + j else_8753943065664 + + then_8753943065664: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 196($sp) # internal_4 = address of allocated object Int + + # internal_0 = internal_4 + lw $t0, 196($sp) + sw $t0, 212($sp) + + # Jumping to endif_8753943065664 + j endif_8753943065664 + + else_8753943065664: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 188($sp) # internal_6 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 49 + sb $t0, 8($v0) # internal_7[0] = '1' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 184($sp) # internal_7 = "1" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument char + lw $t0, 228($sp) + sw $t0, 4($sp) # Storing char + + # Argument internal_7 + lw $t0, 196($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 192($sp) # internal_8 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_6 = internal_8 + lw $t0, 180($sp) + sw $t0, 188($sp) + + # If internal_6 then goto then_8753943065658 + lw $t0, 188($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8753943065658 + + # Jumping to else_8753943065658 + j else_8753943065658 + + then_8753943065658: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 176($sp) # internal_9 = address of allocated object Int + + # internal_5 = internal_9 + lw $t0, 176($sp) + sw $t0, 192($sp) + + # Jumping to endif_8753943065658 + j endif_8753943065658 + + else_8753943065658: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 168($sp) # internal_11 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 50 + sb $t0, 8($v0) # internal_12[0] = '2' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 164($sp) # internal_12 = "2" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument char + lw $t0, 228($sp) + sw $t0, 4($sp) # Storing char + + # Argument internal_12 + lw $t0, 176($sp) + sw $t0, 0($sp) # Storing internal_12 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 172($sp) # internal_13 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_11 = internal_13 + lw $t0, 160($sp) + sw $t0, 168($sp) + + # If internal_11 then goto then_8753943065652 + lw $t0, 168($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8753943065652 + + # Jumping to else_8753943065652 + j else_8753943065652 + + then_8753943065652: + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 156($sp) # internal_14 = address of allocated object Int + + # internal_10 = internal_14 + lw $t0, 156($sp) + sw $t0, 172($sp) + + # Jumping to endif_8753943065652 + j endif_8753943065652 + + else_8753943065652: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 148($sp) # internal_16 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 51 + sb $t0, 8($v0) # internal_17[0] = '3' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 144($sp) # internal_17 = "3" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument char + lw $t0, 228($sp) + sw $t0, 4($sp) # Storing char + + # Argument internal_17 + lw $t0, 156($sp) + sw $t0, 0($sp) # Storing internal_17 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 152($sp) # internal_18 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_16 = internal_18 + lw $t0, 140($sp) + sw $t0, 148($sp) + + # If internal_16 then goto then_8753943065646 + lw $t0, 148($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8753943065646 + + # Jumping to else_8753943065646 + j else_8753943065646 + + then_8753943065646: + + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 136($sp) # internal_19 = address of allocated object Int + + # internal_15 = internal_19 + lw $t0, 136($sp) + sw $t0, 152($sp) + + # Jumping to endif_8753943065646 + j endif_8753943065646 + + else_8753943065646: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 128($sp) # internal_21 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 52 + sb $t0, 8($v0) # internal_22[0] = '4' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 124($sp) # internal_22 = "4" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument char + lw $t0, 228($sp) + sw $t0, 4($sp) # Storing char + + # Argument internal_22 + lw $t0, 136($sp) + sw $t0, 0($sp) # Storing internal_22 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 132($sp) # internal_23 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_21 = internal_23 + lw $t0, 120($sp) + sw $t0, 128($sp) + + # If internal_21 then goto then_8753943065640 + lw $t0, 128($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8753943065640 + + # Jumping to else_8753943065640 + j else_8753943065640 + + then_8753943065640: + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 116($sp) # internal_24 = address of allocated object Int + + # internal_20 = internal_24 + lw $t0, 116($sp) + sw $t0, 132($sp) + + # Jumping to endif_8753943065640 + j endif_8753943065640 + + else_8753943065640: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 108($sp) # internal_26 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 53 + sb $t0, 8($v0) # internal_27[0] = '5' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 104($sp) # internal_27 = "5" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument char + lw $t0, 228($sp) + sw $t0, 4($sp) # Storing char + + # Argument internal_27 + lw $t0, 116($sp) + sw $t0, 0($sp) # Storing internal_27 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 112($sp) # internal_28 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_26 = internal_28 + lw $t0, 100($sp) + sw $t0, 108($sp) + + # If internal_26 then goto then_8753943065634 + lw $t0, 108($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8753943065634 + + # Jumping to else_8753943065634 + j else_8753943065634 + + then_8753943065634: + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 96($sp) # internal_29 = address of allocated object Int + + # internal_25 = internal_29 + lw $t0, 96($sp) + sw $t0, 112($sp) + + # Jumping to endif_8753943065634 + j endif_8753943065634 + + else_8753943065634: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 88($sp) # internal_31 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 54 + sb $t0, 8($v0) # internal_32[0] = '6' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 84($sp) # internal_32 = "6" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument char + lw $t0, 228($sp) + sw $t0, 4($sp) # Storing char + + # Argument internal_32 + lw $t0, 96($sp) + sw $t0, 0($sp) # Storing internal_32 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 92($sp) # internal_33 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_31 = internal_33 + lw $t0, 80($sp) + sw $t0, 88($sp) + + # If internal_31 then goto then_8753943065628 + lw $t0, 88($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8753943065628 + + # Jumping to else_8753943065628 + j else_8753943065628 + + then_8753943065628: + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 76($sp) # internal_34 = address of allocated object Int + + # internal_30 = internal_34 + lw $t0, 76($sp) + sw $t0, 92($sp) + + # Jumping to endif_8753943065628 + j endif_8753943065628 + + else_8753943065628: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 68($sp) # internal_36 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 55 + sb $t0, 8($v0) # internal_37[0] = '7' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 64($sp) # internal_37 = "7" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument char + lw $t0, 228($sp) + sw $t0, 4($sp) # Storing char + + # Argument internal_37 + lw $t0, 76($sp) + sw $t0, 0($sp) # Storing internal_37 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 72($sp) # internal_38 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_36 = internal_38 + lw $t0, 60($sp) + sw $t0, 68($sp) + + # If internal_36 then goto then_8753943065622 + lw $t0, 68($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8753943065622 + + # Jumping to else_8753943065622 + j else_8753943065622 + + then_8753943065622: + + # Allocating Int 7 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 7 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 56($sp) # internal_39 = address of allocated object Int + + # internal_35 = internal_39 + lw $t0, 56($sp) + sw $t0, 72($sp) + + # Jumping to endif_8753943065622 + j endif_8753943065622 + + else_8753943065622: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 48($sp) # internal_41 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 56 + sb $t0, 8($v0) # internal_42[0] = '8' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 44($sp) # internal_42 = "8" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument char + lw $t0, 228($sp) + sw $t0, 4($sp) # Storing char + + # Argument internal_42 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_42 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 52($sp) # internal_43 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_41 = internal_43 + lw $t0, 40($sp) + sw $t0, 48($sp) + + # If internal_41 then goto then_8753943065616 + lw $t0, 48($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8753943065616 + + # Jumping to else_8753943065616 + j else_8753943065616 + + then_8753943065616: + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_44 = address of allocated object Int + + # internal_40 = internal_44 + lw $t0, 36($sp) + sw $t0, 52($sp) + + # Jumping to endif_8753943065616 + j endif_8753943065616 + + else_8753943065616: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_46 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 57 + sb $t0, 8($v0) # internal_47[0] = '9' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 24($sp) # internal_47 = "9" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument char + lw $t0, 228($sp) + sw $t0, 4($sp) # Storing char + + # Argument internal_47 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_47 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 32($sp) # internal_48 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_46 = internal_48 + lw $t0, 20($sp) + sw $t0, 28($sp) + + # If internal_46 then goto then_8753943065607 + lw $t0, 28($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8753943065607 + + # Jumping to else_8753943065607 + j else_8753943065607 + + then_8753943065607: + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_49 = address of allocated object Int + + # internal_45 = internal_49 + lw $t0, 16($sp) + sw $t0, 32($sp) + + # Jumping to endif_8753943065607 + j endif_8753943065607 + + else_8753943065607: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_51 = address of allocated object Int + + # Get method abort of A2I + lw $t0, 220($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 8($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 4($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 228($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_52 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_50 = result of internal_52 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_53 = address of allocated object Int + + # internal_45 = internal_53 + lw $t0, 0($sp) + sw $t0, 32($sp) + + # Jumping to endif_8753943065607 + j endif_8753943065607 + + endif_8753943065607: + + # internal_40 = internal_45 + lw $t0, 32($sp) + sw $t0, 52($sp) + + # Jumping to endif_8753943065616 + j endif_8753943065616 + + endif_8753943065616: + + # internal_35 = internal_40 + lw $t0, 52($sp) + sw $t0, 72($sp) + + # Jumping to endif_8753943065622 + j endif_8753943065622 + + endif_8753943065622: + + # internal_30 = internal_35 + lw $t0, 72($sp) + sw $t0, 92($sp) + + # Jumping to endif_8753943065628 + j endif_8753943065628 + + endif_8753943065628: + + # internal_25 = internal_30 + lw $t0, 92($sp) + sw $t0, 112($sp) + + # Jumping to endif_8753943065634 + j endif_8753943065634 + + endif_8753943065634: + + # internal_20 = internal_25 + lw $t0, 112($sp) + sw $t0, 132($sp) + + # Jumping to endif_8753943065640 + j endif_8753943065640 + + endif_8753943065640: + + # internal_15 = internal_20 + lw $t0, 132($sp) + sw $t0, 152($sp) + + # Jumping to endif_8753943065646 + j endif_8753943065646 + + endif_8753943065646: + + # internal_10 = internal_15 + lw $t0, 152($sp) + sw $t0, 172($sp) + + # Jumping to endif_8753943065652 + j endif_8753943065652 + + endif_8753943065652: + + # internal_5 = internal_10 + lw $t0, 172($sp) + sw $t0, 192($sp) + + # Jumping to endif_8753943065658 + j endif_8753943065658 + + endif_8753943065658: + + # internal_0 = internal_5 + lw $t0, 192($sp) + sw $t0, 212($sp) + + # Jumping to endif_8753943065664 + j endif_8753943065664 + + endif_8753943065664: + + # Loading return value in $v1 + lw $v1, 212($sp) + + # Freeing space for local variables + addi $sp, $sp, 216 + + jr $ra + + function_i2c_at_A2I: + # Function parameters + # $ra = 224($sp) + # self = 220($sp) + # i = 216($sp) + + # Reserving space for local variables + addi $sp, $sp, -216 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 208($sp) # internal_1 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 204($sp) # internal_2 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 228($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_2 + lw $t0, 216($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 212($sp) # internal_3 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_1 = internal_3 + lw $t0, 200($sp) + sw $t0, 208($sp) + + # If internal_1 then goto then_8753943066242 + lw $t0, 208($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8753943066242 + + # Jumping to else_8753943066242 + j else_8753943066242 + + then_8753943066242: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 48 + sb $t0, 8($v0) # internal_4[0] = '0' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 196($sp) # internal_4 = "0" + + # internal_0 = internal_4 + lw $t0, 196($sp) + sw $t0, 212($sp) + + # Jumping to endif_8753943066242 + j endif_8753943066242 + + else_8753943066242: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 188($sp) # internal_6 = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 184($sp) # internal_7 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 228($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_7 + lw $t0, 196($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 192($sp) # internal_8 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_6 = internal_8 + lw $t0, 180($sp) + sw $t0, 188($sp) + + # If internal_6 then goto then_8753943066236 + lw $t0, 188($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8753943066236 + + # Jumping to else_8753943066236 + j else_8753943066236 + + then_8753943066236: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 49 + sb $t0, 8($v0) # internal_9[0] = '1' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 176($sp) # internal_9 = "1" + + # internal_5 = internal_9 + lw $t0, 176($sp) + sw $t0, 192($sp) + + # Jumping to endif_8753943066236 + j endif_8753943066236 + + else_8753943066236: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 168($sp) # internal_11 = address of allocated object Int + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 164($sp) # internal_12 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 228($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_12 + lw $t0, 176($sp) + sw $t0, 0($sp) # Storing internal_12 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 172($sp) # internal_13 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_11 = internal_13 + lw $t0, 160($sp) + sw $t0, 168($sp) + + # If internal_11 then goto then_8753943066230 + lw $t0, 168($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8753943066230 + + # Jumping to else_8753943066230 + j else_8753943066230 + + then_8753943066230: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 50 + sb $t0, 8($v0) # internal_14[0] = '2' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 156($sp) # internal_14 = "2" + + # internal_10 = internal_14 + lw $t0, 156($sp) + sw $t0, 172($sp) + + # Jumping to endif_8753943066230 + j endif_8753943066230 + + else_8753943066230: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 148($sp) # internal_16 = address of allocated object Int + + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 144($sp) # internal_17 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 228($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_17 + lw $t0, 156($sp) + sw $t0, 0($sp) # Storing internal_17 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 152($sp) # internal_18 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_16 = internal_18 + lw $t0, 140($sp) + sw $t0, 148($sp) + + # If internal_16 then goto then_8753943066224 + lw $t0, 148($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8753943066224 + + # Jumping to else_8753943066224 + j else_8753943066224 + + then_8753943066224: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 51 + sb $t0, 8($v0) # internal_19[0] = '3' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 136($sp) # internal_19 = "3" + + # internal_15 = internal_19 + lw $t0, 136($sp) + sw $t0, 152($sp) + + # Jumping to endif_8753943066224 + j endif_8753943066224 + + else_8753943066224: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 128($sp) # internal_21 = address of allocated object Int + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 124($sp) # internal_22 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 228($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_22 + lw $t0, 136($sp) + sw $t0, 0($sp) # Storing internal_22 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 132($sp) # internal_23 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_21 = internal_23 + lw $t0, 120($sp) + sw $t0, 128($sp) + + # If internal_21 then goto then_8753943066218 + lw $t0, 128($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8753943066218 + + # Jumping to else_8753943066218 + j else_8753943066218 + + then_8753943066218: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 52 + sb $t0, 8($v0) # internal_24[0] = '4' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 116($sp) # internal_24 = "4" + + # internal_20 = internal_24 + lw $t0, 116($sp) + sw $t0, 132($sp) + + # Jumping to endif_8753943066218 + j endif_8753943066218 + + else_8753943066218: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 108($sp) # internal_26 = address of allocated object Int + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 104($sp) # internal_27 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 228($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_27 + lw $t0, 116($sp) + sw $t0, 0($sp) # Storing internal_27 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 112($sp) # internal_28 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_26 = internal_28 + lw $t0, 100($sp) + sw $t0, 108($sp) + + # If internal_26 then goto then_8753943066212 + lw $t0, 108($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8753943066212 + + # Jumping to else_8753943066212 + j else_8753943066212 + + then_8753943066212: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 53 + sb $t0, 8($v0) # internal_29[0] = '5' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 96($sp) # internal_29 = "5" + + # internal_25 = internal_29 + lw $t0, 96($sp) + sw $t0, 112($sp) + + # Jumping to endif_8753943066212 + j endif_8753943066212 + + else_8753943066212: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 88($sp) # internal_31 = address of allocated object Int + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 84($sp) # internal_32 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 228($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_32 + lw $t0, 96($sp) + sw $t0, 0($sp) # Storing internal_32 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 92($sp) # internal_33 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_31 = internal_33 + lw $t0, 80($sp) + sw $t0, 88($sp) + + # If internal_31 then goto then_8753943066206 + lw $t0, 88($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8753943066206 + + # Jumping to else_8753943066206 + j else_8753943066206 + + then_8753943066206: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 54 + sb $t0, 8($v0) # internal_34[0] = '6' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 76($sp) # internal_34 = "6" + + # internal_30 = internal_34 + lw $t0, 76($sp) + sw $t0, 92($sp) + + # Jumping to endif_8753943066206 + j endif_8753943066206 + + else_8753943066206: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 68($sp) # internal_36 = address of allocated object Int + + # Allocating Int 7 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 7 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 64($sp) # internal_37 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 228($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_37 + lw $t0, 76($sp) + sw $t0, 0($sp) # Storing internal_37 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 72($sp) # internal_38 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_36 = internal_38 + lw $t0, 60($sp) + sw $t0, 68($sp) + + # If internal_36 then goto then_8753943066200 + lw $t0, 68($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8753943066200 + + # Jumping to else_8753943066200 + j else_8753943066200 + + then_8753943066200: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 55 + sb $t0, 8($v0) # internal_39[0] = '7' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 56($sp) # internal_39 = "7" + + # internal_35 = internal_39 + lw $t0, 56($sp) + sw $t0, 72($sp) + + # Jumping to endif_8753943066200 + j endif_8753943066200 + + else_8753943066200: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 48($sp) # internal_41 = address of allocated object Int + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_42 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 228($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_42 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_42 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 52($sp) # internal_43 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_41 = internal_43 + lw $t0, 40($sp) + sw $t0, 48($sp) + + # If internal_41 then goto then_8753943066194 + lw $t0, 48($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8753943066194 + + # Jumping to else_8753943066194 + j else_8753943066194 + + then_8753943066194: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 56 + sb $t0, 8($v0) # internal_44[0] = '8' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 36($sp) # internal_44 = "8" + + # internal_40 = internal_44 + lw $t0, 36($sp) + sw $t0, 52($sp) + + # Jumping to endif_8753943066194 + j endif_8753943066194 + + else_8753943066194: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_46 = address of allocated object Int + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # internal_47 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 228($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_47 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_47 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 32($sp) # internal_48 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_46 = internal_48 + lw $t0, 20($sp) + sw $t0, 28($sp) + + # If internal_46 then goto then_8753943066173 + lw $t0, 28($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8753943066173 + + # Jumping to else_8753943066173 + j else_8753943066173 + + then_8753943066173: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 57 + sb $t0, 8($v0) # internal_49[0] = '9' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 16($sp) # internal_49 = "9" + + # internal_45 = internal_49 + lw $t0, 16($sp) + sw $t0, 32($sp) + + # Jumping to endif_8753943066173 + j endif_8753943066173 + + else_8753943066173: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_51 = address of allocated object Int + + # Get method abort of A2I + lw $t0, 220($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 8($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 4($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 228($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_52 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_50 = result of internal_52 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 9 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 9 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + sb $zero, 8($v0) # Null-terminator at the end of the string + + sw $v0, 0($sp) # internal_53 = "" + + # internal_45 = internal_53 + lw $t0, 0($sp) + sw $t0, 32($sp) + + # Jumping to endif_8753943066173 + j endif_8753943066173 + + endif_8753943066173: + + # internal_40 = internal_45 + lw $t0, 32($sp) + sw $t0, 52($sp) + + # Jumping to endif_8753943066194 + j endif_8753943066194 + + endif_8753943066194: + + # internal_35 = internal_40 + lw $t0, 52($sp) + sw $t0, 72($sp) + + # Jumping to endif_8753943066200 + j endif_8753943066200 + + endif_8753943066200: + + # internal_30 = internal_35 + lw $t0, 72($sp) + sw $t0, 92($sp) + + # Jumping to endif_8753943066206 + j endif_8753943066206 + + endif_8753943066206: + + # internal_25 = internal_30 + lw $t0, 92($sp) + sw $t0, 112($sp) + + # Jumping to endif_8753943066212 + j endif_8753943066212 + + endif_8753943066212: + + # internal_20 = internal_25 + lw $t0, 112($sp) + sw $t0, 132($sp) + + # Jumping to endif_8753943066218 + j endif_8753943066218 + + endif_8753943066218: + + # internal_15 = internal_20 + lw $t0, 132($sp) + sw $t0, 152($sp) + + # Jumping to endif_8753943066224 + j endif_8753943066224 + + endif_8753943066224: + + # internal_10 = internal_15 + lw $t0, 152($sp) + sw $t0, 172($sp) + + # Jumping to endif_8753943066230 + j endif_8753943066230 + + endif_8753943066230: + + # internal_5 = internal_10 + lw $t0, 172($sp) + sw $t0, 192($sp) + + # Jumping to endif_8753943066236 + j endif_8753943066236 + + endif_8753943066236: + + # internal_0 = internal_5 + lw $t0, 192($sp) + sw $t0, 212($sp) + + # Jumping to endif_8753943066242 + j endif_8753943066242 + + endif_8753943066242: + + # Loading return value in $v1 + lw $v1, 212($sp) + + # Freeing space for local variables + addi $sp, $sp, 216 + + jr $ra + + function_a2i_at_A2I: + # Function parameters + # $ra = 232($sp) + # self = 228($sp) + # s = 224($sp) + + # Reserving space for local variables + addi $sp, $sp, -224 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 216($sp) # internal_1 = address of allocated object Int + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 208($sp) # internal_3 = address of allocated object Int + + # Get method length of String + lw $t0, 224($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 208($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 204($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument s + lw $t0, 232($sp) + sw $t0, 0($sp) # Storing s + + # Calling function internal_4 + lw $t0, 212($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 220($sp) # internal_2 = result of internal_4 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 200($sp) # internal_5 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_5 + lw $t0, 212($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 208($sp) # internal_6 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_1 = internal_6 + lw $t0, 196($sp) + sw $t0, 216($sp) + + # If internal_1 then goto then_8753943066688 + lw $t0, 216($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8753943066688 + + # Jumping to else_8753943066688 + j else_8753943066688 + + then_8753943066688: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 192($sp) # internal_7 = address of allocated object Int + + # internal_0 = internal_7 + lw $t0, 192($sp) + sw $t0, 220($sp) + + # Jumping to endif_8753943066688 + j endif_8753943066688 + + else_8753943066688: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 184($sp) # internal_9 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 180($sp) # internal_10 = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 176($sp) # internal_11 = address of allocated object Int + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 168($sp) # internal_13 = address of allocated object Int + + # Get method substr of String + lw $t0, 224($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 168($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 164($sp) + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument s + lw $t0, 240($sp) + sw $t0, 8($sp) # Storing s + + # Argument internal_10 + lw $t0, 196($sp) + sw $t0, 4($sp) # Storing internal_10 + + # Argument internal_11 + lw $t0, 192($sp) + sw $t0, 0($sp) # Storing internal_11 + + # Calling function internal_14 + lw $t0, 180($sp) + jalr $t0 + lw $ra, 12($sp) + sw $v1, 188($sp) # internal_12 = result of internal_14 + addi $sp, $sp, 16 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 45 + sb $t0, 8($v0) # internal_15[0] = '-' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 160($sp) # internal_15 = "-" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_12 + lw $t0, 184($sp) + sw $t0, 4($sp) # Storing internal_12 + + # Argument internal_15 + lw $t0, 172($sp) + sw $t0, 0($sp) # Storing internal_15 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 168($sp) # internal_16 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_9 = internal_16 + lw $t0, 156($sp) + sw $t0, 184($sp) + + # If internal_9 then goto then_8753943066703 + lw $t0, 184($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8753943066703 + + # Jumping to else_8753943066703 + j else_8753943066703 + + then_8753943066703: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 152($sp) # internal_17 = address of allocated object Int + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 144($sp) # internal_19 = address of allocated object Int + + # Get method length of String + lw $t0, 224($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 144($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 140($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument s + lw $t0, 232($sp) + sw $t0, 0($sp) # Storing s + + # Calling function internal_20 + lw $t0, 148($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 156($sp) # internal_18 = result of internal_20 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 136($sp) # internal_21 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_18 + lw $t0, 160($sp) + sw $t0, 4($sp) # Storing internal_18 + + # Argument internal_21 + lw $t0, 148($sp) + sw $t0, 0($sp) # Storing internal_21 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 144($sp) # internal_22 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 124($sp) # internal_24 = address of allocated object Int + + # Get method substr of String + lw $t0, 224($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 124($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 120($sp) + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument s + lw $t0, 240($sp) + sw $t0, 8($sp) # Storing s + + # Argument internal_17 + lw $t0, 168($sp) + sw $t0, 4($sp) # Storing internal_17 + + # Argument internal_22 + lw $t0, 148($sp) + sw $t0, 0($sp) # Storing internal_22 + + # Calling function internal_25 + lw $t0, 136($sp) + jalr $t0 + lw $ra, 12($sp) + sw $v1, 144($sp) # internal_23 = result of internal_25 + addi $sp, $sp, 16 # Freeing space for arguments + + # Allocating Int 7 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 7 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 112($sp) # internal_27 = address of allocated object Int + + # Get method a2i_aux of A2I + lw $t0, 228($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 112($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 108($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 240($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_23 + lw $t0, 140($sp) + sw $t0, 0($sp) # Storing internal_23 + + # Calling function internal_28 + lw $t0, 120($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 128($sp) # internal_26 = result of internal_28 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 104($sp) # internal_29 = address of allocated object Int + + # Allocating Int 4294967295 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4294967295 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 100($sp) # internal_30 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 96($sp) # internal_31 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_26 + lw $t0, 128($sp) + sw $t0, 4($sp) # Storing internal_26 + + # Argument internal_30 + lw $t0, 112($sp) + sw $t0, 0($sp) # Storing internal_30 + + # Calling function function_xor + jal function_xor + lw $ra, 8($sp) + sw $v1, 108($sp) # internal_31 = result of function_xor + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_31 + lw $t0, 108($sp) + sw $t0, 4($sp) # Storing internal_31 + + # Argument internal_29 + lw $t0, 116($sp) + sw $t0, 0($sp) # Storing internal_29 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 108($sp) # internal_31 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_8 = internal_31 + lw $t0, 96($sp) + sw $t0, 188($sp) + + # Jumping to endif_8753943066703 + j endif_8753943066703 + + else_8753943066703: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 88($sp) # internal_33 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 84($sp) # internal_34 = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 80($sp) # internal_35 = address of allocated object Int + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 72($sp) # internal_37 = address of allocated object Int + + # Get method substr of String + lw $t0, 224($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 72($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 68($sp) + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument s + lw $t0, 240($sp) + sw $t0, 8($sp) # Storing s + + # Argument internal_34 + lw $t0, 100($sp) + sw $t0, 4($sp) # Storing internal_34 + + # Argument internal_35 + lw $t0, 96($sp) + sw $t0, 0($sp) # Storing internal_35 + + # Calling function internal_38 + lw $t0, 84($sp) + jalr $t0 + lw $ra, 12($sp) + sw $v1, 92($sp) # internal_36 = result of internal_38 + addi $sp, $sp, 16 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 43 + sb $t0, 8($v0) # internal_39[0] = '+' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 64($sp) # internal_39 = "+" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_36 + lw $t0, 88($sp) + sw $t0, 4($sp) # Storing internal_36 + + # Argument internal_39 + lw $t0, 76($sp) + sw $t0, 0($sp) # Storing internal_39 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 72($sp) # internal_40 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_33 = internal_40 + lw $t0, 60($sp) + sw $t0, 88($sp) + + # If internal_33 then goto then_8753943066697 + lw $t0, 88($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8753943066697 + + # Jumping to else_8753943066697 + j else_8753943066697 + + then_8753943066697: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 56($sp) # internal_41 = address of allocated object Int + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 48($sp) # internal_43 = address of allocated object Int + + # Get method length of String + lw $t0, 224($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 48($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 44($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument s + lw $t0, 232($sp) + sw $t0, 0($sp) # Storing s + + # Calling function internal_44 + lw $t0, 52($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 60($sp) # internal_42 = result of internal_44 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_45 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_42 + lw $t0, 64($sp) + sw $t0, 4($sp) # Storing internal_42 + + # Argument internal_45 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_45 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 48($sp) # internal_46 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_48 = address of allocated object Int + + # Get method substr of String + lw $t0, 224($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 28($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 24($sp) + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument s + lw $t0, 240($sp) + sw $t0, 8($sp) # Storing s + + # Argument internal_41 + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing internal_41 + + # Argument internal_46 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_46 + + # Calling function internal_49 + lw $t0, 40($sp) + jalr $t0 + lw $ra, 12($sp) + sw $v1, 48($sp) # internal_47 = result of internal_49 + addi $sp, $sp, 16 # Freeing space for arguments + + # Allocating Int 7 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 7 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_51 = address of allocated object Int + + # Get method a2i_aux of A2I + lw $t0, 228($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 16($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 12($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 240($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_47 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_47 + + # Calling function internal_52 + lw $t0, 24($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 32($sp) # internal_50 = result of internal_52 + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_32 = internal_50 + lw $t0, 20($sp) + sw $t0, 92($sp) + + # Jumping to endif_8753943066697 + j endif_8753943066697 + + else_8753943066697: + + # Allocating Int 7 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 7 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_54 = address of allocated object Int + + # Get method a2i_aux of A2I + lw $t0, 228($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 240($sp) + sw $t0, 4($sp) # Storing self + + # Argument s + lw $t0, 236($sp) + sw $t0, 0($sp) # Storing s + + # Calling function internal_55 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_53 = result of internal_55 + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_32 = internal_53 + lw $t0, 8($sp) + sw $t0, 92($sp) + + # Jumping to endif_8753943066697 + j endif_8753943066697 + + endif_8753943066697: + + # internal_8 = internal_32 + lw $t0, 92($sp) + sw $t0, 188($sp) + + # Jumping to endif_8753943066703 + j endif_8753943066703 + + endif_8753943066703: + + # internal_0 = internal_8 + lw $t0, 188($sp) + sw $t0, 220($sp) + + # Jumping to endif_8753943066688 + j endif_8753943066688 + + endif_8753943066688: + + # Loading return value in $v1 + lw $v1, 220($sp) + + # Freeing space for local variables + addi $sp, $sp, 224 + + jr $ra + + function_a2i_aux_at_A2I: + # Function parameters + # $ra = 96($sp) + # self = 92($sp) + # s = 88($sp) + + # Reserving space for local variables + addi $sp, $sp, -88 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 80($sp) # internal_1 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument int + lw $t0, 96($sp) + sw $t0, 4($sp) # Storing int + + # Argument internal_1 + lw $t0, 92($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 96($sp) # int = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 68($sp) # internal_4 = address of allocated object Int + + # Get method length of String + lw $t0, 88($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 68($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 64($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument s + lw $t0, 96($sp) + sw $t0, 0($sp) # Storing s + + # Calling function internal_5 + lw $t0, 72($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 80($sp) # internal_3 = result of internal_5 + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument j + lw $t0, 88($sp) + sw $t0, 4($sp) # Storing j + + # Argument internal_3 + lw $t0, 84($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 88($sp) # j = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 56($sp) # internal_7 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_7 + lw $t0, 68($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 72($sp) # i = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating NUll to internal_8 + sw $zero, 52($sp) # internal_8 = 0 + + while_start_8753943066841: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing i + + # Argument j + lw $t0, 88($sp) + sw $t0, 0($sp) # Storing j + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 60($sp) # internal_9 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_9 then goto while_body_8753943066841 + lw $t0, 48($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_body_8753943066841 + + # Jumping to while_end_8753943066841 + j while_end_8753943066841 + + while_body_8753943066841: + + # Allocating Int 10 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 10 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_10 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument int + lw $t0, 96($sp) + sw $t0, 4($sp) # Storing int + + # Argument internal_10 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_10 + + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 52($sp) # internal_11 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_12 = address of allocated object Int + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_14 = address of allocated object Int + + # Get method substr of String + lw $t0, 88($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 28($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 24($sp) + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument s + lw $t0, 104($sp) + sw $t0, 8($sp) # Storing s + + # Argument i + lw $t0, 76($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_12 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_12 + + # Calling function internal_15 + lw $t0, 40($sp) + jalr $t0 + lw $ra, 12($sp) + sw $v1, 48($sp) # internal_13 = result of internal_15 + addi $sp, $sp, 16 # Freeing space for arguments + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_17 = address of allocated object Int + + # Get method c2i of A2I + lw $t0, 92($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 16($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 12($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 104($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_13 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_13 + + # Calling function internal_18 + lw $t0, 24($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 32($sp) # internal_16 = result of internal_18 + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_11 + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing internal_11 + + # Argument internal_16 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_16 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_19 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument int + lw $t0, 96($sp) + sw $t0, 4($sp) # Storing int + + # Argument internal_19 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_19 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 96($sp) # int = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_20 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_20 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_20 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_21 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_21 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_21 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 72($sp) # i = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to while_start_8753943066841 + j while_start_8753943066841 + + while_end_8753943066841: + + # Loading return value in $v1 + lw $v1, 84($sp) + + # Freeing space for local variables + addi $sp, $sp, 88 + + jr $ra + + function_i2a_at_A2I: + # Function parameters + # $ra = 104($sp) + # self = 100($sp) + # i = 96($sp) + + # Reserving space for local variables + addi $sp, $sp, -96 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 88($sp) # internal_1 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 84($sp) # internal_2 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 108($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_2 + lw $t0, 96($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 92($sp) # internal_3 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_1 = internal_3 + lw $t0, 80($sp) + sw $t0, 88($sp) + + # If internal_1 then goto then_8753943034462 + lw $t0, 88($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8753943034462 + + # Jumping to else_8753943034462 + j else_8753943034462 + + then_8753943034462: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 48 + sb $t0, 8($v0) # internal_4[0] = '0' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 76($sp) # internal_4 = "0" + + # internal_0 = internal_4 + lw $t0, 76($sp) + sw $t0, 92($sp) + + # Jumping to endif_8753943034462 + j endif_8753943034462 + + else_8753943034462: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 68($sp) # internal_6 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 64($sp) # internal_7 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_7 + lw $t0, 76($sp) + sw $t0, 4($sp) # Storing internal_7 + + # Argument i + lw $t0, 108($sp) + sw $t0, 0($sp) # Storing i + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 72($sp) # internal_8 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_6 = internal_8 + lw $t0, 60($sp) + sw $t0, 68($sp) + + # If internal_6 then goto then_8753943034468 + lw $t0, 68($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8753943034468 + + # Jumping to else_8753943034468 + j else_8753943034468 + + then_8753943034468: + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 52($sp) # internal_10 = address of allocated object Int + + # Get method i2a_aux of A2I + lw $t0, 100($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 52($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 48($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 112($sp) + sw $t0, 4($sp) # Storing self + + # Argument i + lw $t0, 108($sp) + sw $t0, 0($sp) # Storing i + + # Calling function internal_11 + lw $t0, 60($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 68($sp) # internal_9 = result of internal_11 + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_5 = internal_9 + lw $t0, 56($sp) + sw $t0, 72($sp) + + # Jumping to endif_8753943034468 + j endif_8753943034468 + + else_8753943034468: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 45 + sb $t0, 8($v0) # internal_12[0] = '-' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 44($sp) # internal_12 = "-" + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_13 = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_14 = address of allocated object Int + + # Allocating Int 4294967295 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4294967295 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_15 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_16 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_13 + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing internal_13 + + # Argument internal_15 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_15 + + # Calling function function_xor + jal function_xor + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_16 = result of function_xor + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_16 + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing internal_16 + + # Argument internal_14 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_14 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_16 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 108($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_16 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_16 + + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_17 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_19 = address of allocated object Int + + # Get method i2a_aux of A2I + lw $t0, 100($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 16($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 12($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 112($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_17 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_17 + + # Calling function internal_20 + lw $t0, 24($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 32($sp) # internal_18 = result of internal_20 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_22 = address of allocated object Int + + # Get method concat of String + lw $t0, 44($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_12 + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing internal_12 + + # Argument internal_18 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_18 + + # Calling function internal_23 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_21 = result of internal_23 + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_5 = internal_21 + lw $t0, 8($sp) + sw $t0, 72($sp) + + # Jumping to endif_8753943034468 + j endif_8753943034468 + + endif_8753943034468: + + # internal_0 = internal_5 + lw $t0, 72($sp) + sw $t0, 92($sp) + + # Jumping to endif_8753943034462 + j endif_8753943034462 + + endif_8753943034462: + + # Loading return value in $v1 + lw $v1, 92($sp) + + # Freeing space for local variables + addi $sp, $sp, 96 + + jr $ra + + function_i2a_aux_at_A2I: + # Function parameters + # $ra = 88($sp) + # self = 84($sp) + # i = 80($sp) + + # Reserving space for local variables + addi $sp, $sp, -80 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 72($sp) # internal_1 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 68($sp) # internal_2 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 92($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_2 + lw $t0, 80($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 76($sp) # internal_3 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_1 = internal_3 + lw $t0, 64($sp) + sw $t0, 72($sp) + + # If internal_1 then goto then_8753943034576 + lw $t0, 72($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8753943034576 + + # Jumping to else_8753943034576 + j else_8753943034576 + + then_8753943034576: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 9 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 9 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + sb $zero, 8($v0) # Null-terminator at the end of the string + + sw $v0, 60($sp) # internal_4 = "" + + # internal_0 = internal_4 + lw $t0, 60($sp) + sw $t0, 76($sp) + + # Jumping to endif_8753943034576 + j endif_8753943034576 + + else_8753943034576: + + # Allocating Int 10 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 10 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 52($sp) # internal_6 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 92($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_6 + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing internal_6 + + # Calling function function_div + jal function_div + lw $ra, 8($sp) + sw $v1, 60($sp) # internal_7 = result of function_div + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument next + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing next + + # Argument internal_7 + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 68($sp) # next = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_9 = address of allocated object Int + + # Get method i2a_aux of A2I + lw $t0, 84($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 40($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 36($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 96($sp) + sw $t0, 4($sp) # Storing self + + # Argument next + lw $t0, 68($sp) + sw $t0, 0($sp) # Storing next + + # Calling function internal_10 + lw $t0, 48($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 56($sp) # internal_8 = result of internal_10 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 10 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 10 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_11 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument next + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing next + + # Argument internal_11 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_11 + + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_12 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 92($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_12 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_12 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_13 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_15 = address of allocated object Int + + # Get method i2c of A2I + lw $t0, 84($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 16($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 12($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 96($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_13 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_13 + + # Calling function internal_16 + lw $t0, 24($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 32($sp) # internal_14 = result of internal_16 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_18 = address of allocated object Int + + # Get method concat of String + lw $t0, 44($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_8 + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing internal_8 + + # Argument internal_14 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_14 + + # Calling function internal_19 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_17 = result of internal_19 + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_0 = internal_17 + lw $t0, 8($sp) + sw $t0, 76($sp) + + # Jumping to endif_8753943034576 + j endif_8753943034576 + + endif_8753943034576: + + # Loading return value in $v1 + lw $v1, 76($sp) + + # Freeing space for local variables + addi $sp, $sp, 80 + + jr $ra + + function___init___at_Main: + # Function parameters + # $ra = 20($sp) + # self = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 9 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 9 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + sb $zero, 8($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_0 = "" + + # Set attribute char of self + lw $t0, 16($sp) # $t0 = self + lw $t1, 12($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8753942956644 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8753942956644 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8753942956644 + j object_set_attribute_8753942956644 + int_set_attribute_8753942956644: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.char = internal_0 + j end_set_attribute_8753942956644 + bool_set_attribute_8753942956644: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.char = internal_0 + j end_set_attribute_8753942956644 + object_set_attribute_8753942956644: + sw $t1, 8($t0) # self.char = internal_0 + end_set_attribute_8753942956644: + + # Allocating NUll to internal_1 + sw $zero, 8($sp) # internal_1 = 0 + + # Set attribute avar of self + lw $t0, 16($sp) # $t0 = self + lw $t1, 8($sp) # $t1 = internal_1 + beq $t1, $zero, object_set_attribute_8753942956665 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8753942956665 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8753942956665 + j object_set_attribute_8753942956665 + int_set_attribute_8753942956665: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_1 + j end_set_attribute_8753942956665 + bool_set_attribute_8753942956665: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_1 + j end_set_attribute_8753942956665 + object_set_attribute_8753942956665: + sw $t1, 12($t0) # self.avar = internal_1 + end_set_attribute_8753942956665: + + # Allocating NUll to internal_2 + sw $zero, 4($sp) # internal_2 = 0 + + # Set attribute a_var of self + lw $t0, 16($sp) # $t0 = self + lw $t1, 4($sp) # $t1 = internal_2 + beq $t1, $zero, object_set_attribute_8753942956686 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8753942956686 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8753942956686 + j object_set_attribute_8753942956686 + int_set_attribute_8753942956686: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.a_var = internal_2 + j end_set_attribute_8753942956686 + bool_set_attribute_8753942956686: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.a_var = internal_2 + j end_set_attribute_8753942956686 + object_set_attribute_8753942956686: + sw $t1, 16($t0) # self.a_var = internal_2 + end_set_attribute_8753942956686: + + # Allocating Bool 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_3 = address of allocated object Int + + # Set attribute flag of self + lw $t0, 16($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_3 + beq $t1, $zero, object_set_attribute_8753942956707 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8753942956707 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8753942956707 + j object_set_attribute_8753942956707 + int_set_attribute_8753942956707: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($t0) # self.flag = internal_3 + j end_set_attribute_8753942956707 + bool_set_attribute_8753942956707: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($t0) # self.flag = internal_3 + j end_set_attribute_8753942956707 + object_set_attribute_8753942956707: + sw $t1, 20($t0) # self.flag = internal_3 + end_set_attribute_8753942956707: + + # Loading return value in $v1 + lw $v1, 16($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 + + jr $ra + + function_menu_at_Main: + # Function parameters + # $ra = 432($sp) + # self = 428($sp) + + # Reserving space for local variables + addi $sp, $sp, -428 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 30 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 30 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_0[0] = '\n' + + addi $t0, $zero, 9 + sb $t0, 9($v0) # internal_0[1] = '\t' + + addi $t0, $zero, 84 + sb $t0, 10($v0) # internal_0[2] = 'T' + + addi $t0, $zero, 111 + sb $t0, 11($v0) # internal_0[3] = 'o' + + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_0[4] = ' ' + + addi $t0, $zero, 97 + sb $t0, 13($v0) # internal_0[5] = 'a' + + addi $t0, $zero, 100 + sb $t0, 14($v0) # internal_0[6] = 'd' + + addi $t0, $zero, 100 + sb $t0, 15($v0) # internal_0[7] = 'd' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_0[8] = ' ' + + addi $t0, $zero, 97 + sb $t0, 17($v0) # internal_0[9] = 'a' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_0[10] = ' ' + + addi $t0, $zero, 110 + sb $t0, 19($v0) # internal_0[11] = 'n' + + addi $t0, $zero, 117 + sb $t0, 20($v0) # internal_0[12] = 'u' + + addi $t0, $zero, 109 + sb $t0, 21($v0) # internal_0[13] = 'm' + + addi $t0, $zero, 98 + sb $t0, 22($v0) # internal_0[14] = 'b' + + addi $t0, $zero, 101 + sb $t0, 23($v0) # internal_0[15] = 'e' + + addi $t0, $zero, 114 + sb $t0, 24($v0) # internal_0[16] = 'r' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_0[17] = ' ' + + addi $t0, $zero, 116 + sb $t0, 26($v0) # internal_0[18] = 't' + + addi $t0, $zero, 111 + sb $t0, 27($v0) # internal_0[19] = 'o' + + addi $t0, $zero, 32 + sb $t0, 28($v0) # internal_0[20] = ' ' + + sb $zero, 29($v0) # Null-terminator at the end of the string + + sw $v0, 424($sp) # internal_0 = "\n\tTo add a number to " + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 416($sp) # internal_2 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 428($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 416($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 412($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 440($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_0 + lw $t0, 436($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function internal_3 + lw $t0, 424($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 432($sp) # internal_1 = result of internal_3 + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute avar of self + lw $t0, 428($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8753942957337 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8753942957337 + j object_get_attribute_8753942957337 + int_get_attribute_8753942957337: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 408($sp) # internal_4 = self.avar + j end_get_attribute_8753942957337 + bool_get_attribute_8753942957337: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 408($sp) # internal_4 = self.avar + j end_get_attribute_8753942957337 + object_get_attribute_8753942957337: + sw $t1, 408($sp) # internal_4 = self.avar + end_get_attribute_8753942957337: + + # Allocating Int 13 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 13 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 400($sp) # internal_6 = address of allocated object Int + + # Get method print of Main + lw $t0, 428($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 400($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 396($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 440($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_4 + lw $t0, 420($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function internal_7 + lw $t0, 408($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 416($sp) # internal_5 = result of internal_7 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 21 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 21 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 46 + sb $t0, 8($v0) # internal_8[0] = '.' + + addi $t0, $zero, 46 + sb $t0, 9($v0) # internal_8[1] = '.' + + addi $t0, $zero, 46 + sb $t0, 10($v0) # internal_8[2] = '.' + + addi $t0, $zero, 101 + sb $t0, 11($v0) # internal_8[3] = 'e' + + addi $t0, $zero, 110 + sb $t0, 12($v0) # internal_8[4] = 'n' + + addi $t0, $zero, 116 + sb $t0, 13($v0) # internal_8[5] = 't' + + addi $t0, $zero, 101 + sb $t0, 14($v0) # internal_8[6] = 'e' + + addi $t0, $zero, 114 + sb $t0, 15($v0) # internal_8[7] = 'r' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_8[8] = ' ' + + addi $t0, $zero, 97 + sb $t0, 17($v0) # internal_8[9] = 'a' + + addi $t0, $zero, 58 + sb $t0, 18($v0) # internal_8[10] = ':' + + addi $t0, $zero, 10 + sb $t0, 19($v0) # internal_8[11] = '\n' + + sb $zero, 20($v0) # Null-terminator at the end of the string + + sw $v0, 392($sp) # internal_8 = "...enter a:\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 384($sp) # internal_10 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 428($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 384($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 380($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 440($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_8 + lw $t0, 404($sp) + sw $t0, 0($sp) # Storing internal_8 + + # Calling function internal_11 + lw $t0, 392($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 400($sp) # internal_9 = result of internal_11 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 20 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 20 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_12[0] = '\t' + + addi $t0, $zero, 84 + sb $t0, 9($v0) # internal_12[1] = 'T' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_12[2] = 'o' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_12[3] = ' ' + + addi $t0, $zero, 110 + sb $t0, 12($v0) # internal_12[4] = 'n' + + addi $t0, $zero, 101 + sb $t0, 13($v0) # internal_12[5] = 'e' + + addi $t0, $zero, 103 + sb $t0, 14($v0) # internal_12[6] = 'g' + + addi $t0, $zero, 97 + sb $t0, 15($v0) # internal_12[7] = 'a' + + addi $t0, $zero, 116 + sb $t0, 16($v0) # internal_12[8] = 't' + + addi $t0, $zero, 101 + sb $t0, 17($v0) # internal_12[9] = 'e' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_12[10] = ' ' + + sb $zero, 19($v0) # Null-terminator at the end of the string + + sw $v0, 376($sp) # internal_12 = "\tTo negate " + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 368($sp) # internal_14 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 428($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 368($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 364($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 440($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_12 + lw $t0, 388($sp) + sw $t0, 0($sp) # Storing internal_12 + + # Calling function internal_15 + lw $t0, 376($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 384($sp) # internal_13 = result of internal_15 + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute avar of self + lw $t0, 428($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8753942957517 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8753942957517 + j object_get_attribute_8753942957517 + int_get_attribute_8753942957517: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 360($sp) # internal_16 = self.avar + j end_get_attribute_8753942957517 + bool_get_attribute_8753942957517: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 360($sp) # internal_16 = self.avar + j end_get_attribute_8753942957517 + object_get_attribute_8753942957517: + sw $t1, 360($sp) # internal_16 = self.avar + end_get_attribute_8753942957517: + + # Allocating Int 13 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 13 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 352($sp) # internal_18 = address of allocated object Int + + # Get method print of Main + lw $t0, 428($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 352($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 348($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 440($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_16 + lw $t0, 372($sp) + sw $t0, 0($sp) # Storing internal_16 + + # Calling function internal_19 + lw $t0, 360($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 368($sp) # internal_17 = result of internal_19 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 21 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 21 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 46 + sb $t0, 8($v0) # internal_20[0] = '.' + + addi $t0, $zero, 46 + sb $t0, 9($v0) # internal_20[1] = '.' + + addi $t0, $zero, 46 + sb $t0, 10($v0) # internal_20[2] = '.' + + addi $t0, $zero, 101 + sb $t0, 11($v0) # internal_20[3] = 'e' + + addi $t0, $zero, 110 + sb $t0, 12($v0) # internal_20[4] = 'n' + + addi $t0, $zero, 116 + sb $t0, 13($v0) # internal_20[5] = 't' + + addi $t0, $zero, 101 + sb $t0, 14($v0) # internal_20[6] = 'e' + + addi $t0, $zero, 114 + sb $t0, 15($v0) # internal_20[7] = 'r' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_20[8] = ' ' + + addi $t0, $zero, 98 + sb $t0, 17($v0) # internal_20[9] = 'b' + + addi $t0, $zero, 58 + sb $t0, 18($v0) # internal_20[10] = ':' + + addi $t0, $zero, 10 + sb $t0, 19($v0) # internal_20[11] = '\n' + + sb $zero, 20($v0) # Null-terminator at the end of the string + + sw $v0, 344($sp) # internal_20 = "...enter b:\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 336($sp) # internal_22 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 428($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 336($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 332($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 440($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_20 + lw $t0, 356($sp) + sw $t0, 0($sp) # Storing internal_20 + + # Calling function internal_23 + lw $t0, 344($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 352($sp) # internal_21 = result of internal_23 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 41 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 41 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_24[0] = '\t' + + addi $t0, $zero, 84 + sb $t0, 9($v0) # internal_24[1] = 'T' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_24[2] = 'o' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_24[3] = ' ' + + addi $t0, $zero, 102 + sb $t0, 12($v0) # internal_24[4] = 'f' + + addi $t0, $zero, 105 + sb $t0, 13($v0) # internal_24[5] = 'i' + + addi $t0, $zero, 110 + sb $t0, 14($v0) # internal_24[6] = 'n' + + addi $t0, $zero, 100 + sb $t0, 15($v0) # internal_24[7] = 'd' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_24[8] = ' ' + + addi $t0, $zero, 116 + sb $t0, 17($v0) # internal_24[9] = 't' + + addi $t0, $zero, 104 + sb $t0, 18($v0) # internal_24[10] = 'h' + + addi $t0, $zero, 101 + sb $t0, 19($v0) # internal_24[11] = 'e' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_24[12] = ' ' + + addi $t0, $zero, 100 + sb $t0, 21($v0) # internal_24[13] = 'd' + + addi $t0, $zero, 105 + sb $t0, 22($v0) # internal_24[14] = 'i' + + addi $t0, $zero, 102 + sb $t0, 23($v0) # internal_24[15] = 'f' + + addi $t0, $zero, 102 + sb $t0, 24($v0) # internal_24[16] = 'f' + + addi $t0, $zero, 101 + sb $t0, 25($v0) # internal_24[17] = 'e' + + addi $t0, $zero, 114 + sb $t0, 26($v0) # internal_24[18] = 'r' + + addi $t0, $zero, 101 + sb $t0, 27($v0) # internal_24[19] = 'e' + + addi $t0, $zero, 110 + sb $t0, 28($v0) # internal_24[20] = 'n' + + addi $t0, $zero, 99 + sb $t0, 29($v0) # internal_24[21] = 'c' + + addi $t0, $zero, 101 + sb $t0, 30($v0) # internal_24[22] = 'e' + + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_24[23] = ' ' + + addi $t0, $zero, 98 + sb $t0, 32($v0) # internal_24[24] = 'b' + + addi $t0, $zero, 101 + sb $t0, 33($v0) # internal_24[25] = 'e' + + addi $t0, $zero, 116 + sb $t0, 34($v0) # internal_24[26] = 't' + + addi $t0, $zero, 119 + sb $t0, 35($v0) # internal_24[27] = 'w' + + addi $t0, $zero, 101 + sb $t0, 36($v0) # internal_24[28] = 'e' + + addi $t0, $zero, 101 + sb $t0, 37($v0) # internal_24[29] = 'e' + + addi $t0, $zero, 110 + sb $t0, 38($v0) # internal_24[30] = 'n' + + addi $t0, $zero, 32 + sb $t0, 39($v0) # internal_24[31] = ' ' + + sb $zero, 40($v0) # Null-terminator at the end of the string + + sw $v0, 328($sp) # internal_24 = "\tTo find the difference between " + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 320($sp) # internal_26 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 428($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 320($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 316($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 440($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_24 + lw $t0, 340($sp) + sw $t0, 0($sp) # Storing internal_24 + + # Calling function internal_27 + lw $t0, 328($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 336($sp) # internal_25 = result of internal_27 + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute avar of self + lw $t0, 428($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8753942958469 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8753942958469 + j object_get_attribute_8753942958469 + int_get_attribute_8753942958469: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 312($sp) # internal_28 = self.avar + j end_get_attribute_8753942958469 + bool_get_attribute_8753942958469: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 312($sp) # internal_28 = self.avar + j end_get_attribute_8753942958469 + object_get_attribute_8753942958469: + sw $t1, 312($sp) # internal_28 = self.avar + end_get_attribute_8753942958469: + + # Allocating Int 13 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 13 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 304($sp) # internal_30 = address of allocated object Int + + # Get method print of Main + lw $t0, 428($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 304($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 300($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 440($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_28 + lw $t0, 324($sp) + sw $t0, 0($sp) # Storing internal_28 + + # Calling function internal_31 + lw $t0, 312($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 320($sp) # internal_29 = result of internal_31 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 39 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 39 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 97 + sb $t0, 8($v0) # internal_32[0] = 'a' + + addi $t0, $zero, 110 + sb $t0, 9($v0) # internal_32[1] = 'n' + + addi $t0, $zero, 100 + sb $t0, 10($v0) # internal_32[2] = 'd' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_32[3] = ' ' + + addi $t0, $zero, 97 + sb $t0, 12($v0) # internal_32[4] = 'a' + + addi $t0, $zero, 110 + sb $t0, 13($v0) # internal_32[5] = 'n' + + addi $t0, $zero, 111 + sb $t0, 14($v0) # internal_32[6] = 'o' + + addi $t0, $zero, 116 + sb $t0, 15($v0) # internal_32[7] = 't' + + addi $t0, $zero, 104 + sb $t0, 16($v0) # internal_32[8] = 'h' + + addi $t0, $zero, 101 + sb $t0, 17($v0) # internal_32[9] = 'e' + + addi $t0, $zero, 114 + sb $t0, 18($v0) # internal_32[10] = 'r' + + addi $t0, $zero, 32 + sb $t0, 19($v0) # internal_32[11] = ' ' + + addi $t0, $zero, 110 + sb $t0, 20($v0) # internal_32[12] = 'n' + + addi $t0, $zero, 117 + sb $t0, 21($v0) # internal_32[13] = 'u' + + addi $t0, $zero, 109 + sb $t0, 22($v0) # internal_32[14] = 'm' + + addi $t0, $zero, 98 + sb $t0, 23($v0) # internal_32[15] = 'b' + + addi $t0, $zero, 101 + sb $t0, 24($v0) # internal_32[16] = 'e' + + addi $t0, $zero, 114 + sb $t0, 25($v0) # internal_32[17] = 'r' + + addi $t0, $zero, 46 + sb $t0, 26($v0) # internal_32[18] = '.' + + addi $t0, $zero, 46 + sb $t0, 27($v0) # internal_32[19] = '.' + + addi $t0, $zero, 46 + sb $t0, 28($v0) # internal_32[20] = '.' + + addi $t0, $zero, 101 + sb $t0, 29($v0) # internal_32[21] = 'e' + + addi $t0, $zero, 110 + sb $t0, 30($v0) # internal_32[22] = 'n' + + addi $t0, $zero, 116 + sb $t0, 31($v0) # internal_32[23] = 't' + + addi $t0, $zero, 101 + sb $t0, 32($v0) # internal_32[24] = 'e' + + addi $t0, $zero, 114 + sb $t0, 33($v0) # internal_32[25] = 'r' + + addi $t0, $zero, 32 + sb $t0, 34($v0) # internal_32[26] = ' ' + + addi $t0, $zero, 99 + sb $t0, 35($v0) # internal_32[27] = 'c' + + addi $t0, $zero, 58 + sb $t0, 36($v0) # internal_32[28] = ':' + + addi $t0, $zero, 10 + sb $t0, 37($v0) # internal_32[29] = '\n' + + sb $zero, 38($v0) # Null-terminator at the end of the string + + sw $v0, 296($sp) # internal_32 = "and another number...enter c:\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 288($sp) # internal_34 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 428($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 288($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 284($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 440($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_32 + lw $t0, 308($sp) + sw $t0, 0($sp) # Storing internal_32 + + # Calling function internal_35 + lw $t0, 296($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 304($sp) # internal_33 = result of internal_35 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 35 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 35 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_36[0] = '\t' + + addi $t0, $zero, 84 + sb $t0, 9($v0) # internal_36[1] = 'T' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_36[2] = 'o' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_36[3] = ' ' + + addi $t0, $zero, 102 + sb $t0, 12($v0) # internal_36[4] = 'f' + + addi $t0, $zero, 105 + sb $t0, 13($v0) # internal_36[5] = 'i' + + addi $t0, $zero, 110 + sb $t0, 14($v0) # internal_36[6] = 'n' + + addi $t0, $zero, 100 + sb $t0, 15($v0) # internal_36[7] = 'd' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_36[8] = ' ' + + addi $t0, $zero, 116 + sb $t0, 17($v0) # internal_36[9] = 't' + + addi $t0, $zero, 104 + sb $t0, 18($v0) # internal_36[10] = 'h' + + addi $t0, $zero, 101 + sb $t0, 19($v0) # internal_36[11] = 'e' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_36[12] = ' ' + + addi $t0, $zero, 102 + sb $t0, 21($v0) # internal_36[13] = 'f' + + addi $t0, $zero, 97 + sb $t0, 22($v0) # internal_36[14] = 'a' + + addi $t0, $zero, 99 + sb $t0, 23($v0) # internal_36[15] = 'c' + + addi $t0, $zero, 116 + sb $t0, 24($v0) # internal_36[16] = 't' + + addi $t0, $zero, 111 + sb $t0, 25($v0) # internal_36[17] = 'o' + + addi $t0, $zero, 114 + sb $t0, 26($v0) # internal_36[18] = 'r' + + addi $t0, $zero, 105 + sb $t0, 27($v0) # internal_36[19] = 'i' + + addi $t0, $zero, 97 + sb $t0, 28($v0) # internal_36[20] = 'a' + + addi $t0, $zero, 108 + sb $t0, 29($v0) # internal_36[21] = 'l' + + addi $t0, $zero, 32 + sb $t0, 30($v0) # internal_36[22] = ' ' + + addi $t0, $zero, 111 + sb $t0, 31($v0) # internal_36[23] = 'o' + + addi $t0, $zero, 102 + sb $t0, 32($v0) # internal_36[24] = 'f' + + addi $t0, $zero, 32 + sb $t0, 33($v0) # internal_36[25] = ' ' + + sb $zero, 34($v0) # Null-terminator at the end of the string + + sw $v0, 280($sp) # internal_36 = "\tTo find the factorial of " + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 272($sp) # internal_38 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 428($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 272($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 268($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 440($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_36 + lw $t0, 292($sp) + sw $t0, 0($sp) # Storing internal_36 + + # Calling function internal_39 + lw $t0, 280($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 288($sp) # internal_37 = result of internal_39 + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute avar of self + lw $t0, 428($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8753942958909 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8753942958909 + j object_get_attribute_8753942958909 + int_get_attribute_8753942958909: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 264($sp) # internal_40 = self.avar + j end_get_attribute_8753942958909 + bool_get_attribute_8753942958909: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 264($sp) # internal_40 = self.avar + j end_get_attribute_8753942958909 + object_get_attribute_8753942958909: + sw $t1, 264($sp) # internal_40 = self.avar + end_get_attribute_8753942958909: + + # Allocating Int 13 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 13 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 256($sp) # internal_42 = address of allocated object Int + + # Get method print of Main + lw $t0, 428($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 256($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 252($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 440($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_40 + lw $t0, 276($sp) + sw $t0, 0($sp) # Storing internal_40 + + # Calling function internal_43 + lw $t0, 264($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 272($sp) # internal_41 = result of internal_43 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 21 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 21 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 46 + sb $t0, 8($v0) # internal_44[0] = '.' + + addi $t0, $zero, 46 + sb $t0, 9($v0) # internal_44[1] = '.' + + addi $t0, $zero, 46 + sb $t0, 10($v0) # internal_44[2] = '.' + + addi $t0, $zero, 101 + sb $t0, 11($v0) # internal_44[3] = 'e' + + addi $t0, $zero, 110 + sb $t0, 12($v0) # internal_44[4] = 'n' + + addi $t0, $zero, 116 + sb $t0, 13($v0) # internal_44[5] = 't' + + addi $t0, $zero, 101 + sb $t0, 14($v0) # internal_44[6] = 'e' + + addi $t0, $zero, 114 + sb $t0, 15($v0) # internal_44[7] = 'r' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_44[8] = ' ' + + addi $t0, $zero, 100 + sb $t0, 17($v0) # internal_44[9] = 'd' + + addi $t0, $zero, 58 + sb $t0, 18($v0) # internal_44[10] = ':' + + addi $t0, $zero, 10 + sb $t0, 19($v0) # internal_44[11] = '\n' + + sb $zero, 20($v0) # Null-terminator at the end of the string + + sw $v0, 248($sp) # internal_44 = "...enter d:\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 240($sp) # internal_46 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 428($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 240($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 236($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 440($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_44 + lw $t0, 260($sp) + sw $t0, 0($sp) # Storing internal_44 + + # Calling function internal_47 + lw $t0, 248($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 256($sp) # internal_45 = result of internal_47 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 20 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 20 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_48[0] = '\t' + + addi $t0, $zero, 84 + sb $t0, 9($v0) # internal_48[1] = 'T' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_48[2] = 'o' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_48[3] = ' ' + + addi $t0, $zero, 115 + sb $t0, 12($v0) # internal_48[4] = 's' + + addi $t0, $zero, 113 + sb $t0, 13($v0) # internal_48[5] = 'q' + + addi $t0, $zero, 117 + sb $t0, 14($v0) # internal_48[6] = 'u' + + addi $t0, $zero, 97 + sb $t0, 15($v0) # internal_48[7] = 'a' + + addi $t0, $zero, 114 + sb $t0, 16($v0) # internal_48[8] = 'r' + + addi $t0, $zero, 101 + sb $t0, 17($v0) # internal_48[9] = 'e' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_48[10] = ' ' + + sb $zero, 19($v0) # Null-terminator at the end of the string + + sw $v0, 232($sp) # internal_48 = "\tTo square " + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 224($sp) # internal_50 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 428($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 224($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 220($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 440($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_48 + lw $t0, 244($sp) + sw $t0, 0($sp) # Storing internal_48 + + # Calling function internal_51 + lw $t0, 232($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 240($sp) # internal_49 = result of internal_51 + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute avar of self + lw $t0, 428($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8753942959089 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8753942959089 + j object_get_attribute_8753942959089 + int_get_attribute_8753942959089: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 216($sp) # internal_52 = self.avar + j end_get_attribute_8753942959089 + bool_get_attribute_8753942959089: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 216($sp) # internal_52 = self.avar + j end_get_attribute_8753942959089 + object_get_attribute_8753942959089: + sw $t1, 216($sp) # internal_52 = self.avar + end_get_attribute_8753942959089: + + # Allocating Int 13 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 13 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 208($sp) # internal_54 = address of allocated object Int + + # Get method print of Main + lw $t0, 428($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 208($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 204($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 440($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_52 + lw $t0, 228($sp) + sw $t0, 0($sp) # Storing internal_52 + + # Calling function internal_55 + lw $t0, 216($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 224($sp) # internal_53 = result of internal_55 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 21 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 21 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 46 + sb $t0, 8($v0) # internal_56[0] = '.' + + addi $t0, $zero, 46 + sb $t0, 9($v0) # internal_56[1] = '.' + + addi $t0, $zero, 46 + sb $t0, 10($v0) # internal_56[2] = '.' + + addi $t0, $zero, 101 + sb $t0, 11($v0) # internal_56[3] = 'e' + + addi $t0, $zero, 110 + sb $t0, 12($v0) # internal_56[4] = 'n' + + addi $t0, $zero, 116 + sb $t0, 13($v0) # internal_56[5] = 't' + + addi $t0, $zero, 101 + sb $t0, 14($v0) # internal_56[6] = 'e' + + addi $t0, $zero, 114 + sb $t0, 15($v0) # internal_56[7] = 'r' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_56[8] = ' ' + + addi $t0, $zero, 101 + sb $t0, 17($v0) # internal_56[9] = 'e' + + addi $t0, $zero, 58 + sb $t0, 18($v0) # internal_56[10] = ':' + + addi $t0, $zero, 10 + sb $t0, 19($v0) # internal_56[11] = '\n' + + sb $zero, 20($v0) # Null-terminator at the end of the string + + sw $v0, 200($sp) # internal_56 = "...enter e:\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 192($sp) # internal_58 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 428($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 192($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 188($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 440($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_56 + lw $t0, 212($sp) + sw $t0, 0($sp) # Storing internal_56 + + # Calling function internal_59 + lw $t0, 200($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 208($sp) # internal_57 = result of internal_59 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 18 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 18 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_60[0] = '\t' + + addi $t0, $zero, 84 + sb $t0, 9($v0) # internal_60[1] = 'T' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_60[2] = 'o' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_60[3] = ' ' + + addi $t0, $zero, 99 + sb $t0, 12($v0) # internal_60[4] = 'c' + + addi $t0, $zero, 117 + sb $t0, 13($v0) # internal_60[5] = 'u' + + addi $t0, $zero, 98 + sb $t0, 14($v0) # internal_60[6] = 'b' + + addi $t0, $zero, 101 + sb $t0, 15($v0) # internal_60[7] = 'e' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_60[8] = ' ' + + sb $zero, 17($v0) # Null-terminator at the end of the string + + sw $v0, 184($sp) # internal_60 = "\tTo cube " + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 176($sp) # internal_62 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 428($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 176($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 172($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 440($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_60 + lw $t0, 196($sp) + sw $t0, 0($sp) # Storing internal_60 + + # Calling function internal_63 + lw $t0, 184($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 192($sp) # internal_61 = result of internal_63 + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute avar of self + lw $t0, 428($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8753942959529 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8753942959529 + j object_get_attribute_8753942959529 + int_get_attribute_8753942959529: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 168($sp) # internal_64 = self.avar + j end_get_attribute_8753942959529 + bool_get_attribute_8753942959529: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 168($sp) # internal_64 = self.avar + j end_get_attribute_8753942959529 + object_get_attribute_8753942959529: + sw $t1, 168($sp) # internal_64 = self.avar + end_get_attribute_8753942959529: + + # Allocating Int 13 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 13 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 160($sp) # internal_66 = address of allocated object Int + + # Get method print of Main + lw $t0, 428($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 160($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 156($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 440($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_64 + lw $t0, 180($sp) + sw $t0, 0($sp) # Storing internal_64 + + # Calling function internal_67 + lw $t0, 168($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 176($sp) # internal_65 = result of internal_67 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 21 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 21 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 46 + sb $t0, 8($v0) # internal_68[0] = '.' + + addi $t0, $zero, 46 + sb $t0, 9($v0) # internal_68[1] = '.' + + addi $t0, $zero, 46 + sb $t0, 10($v0) # internal_68[2] = '.' + + addi $t0, $zero, 101 + sb $t0, 11($v0) # internal_68[3] = 'e' + + addi $t0, $zero, 110 + sb $t0, 12($v0) # internal_68[4] = 'n' + + addi $t0, $zero, 116 + sb $t0, 13($v0) # internal_68[5] = 't' + + addi $t0, $zero, 101 + sb $t0, 14($v0) # internal_68[6] = 'e' + + addi $t0, $zero, 114 + sb $t0, 15($v0) # internal_68[7] = 'r' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_68[8] = ' ' + + addi $t0, $zero, 102 + sb $t0, 17($v0) # internal_68[9] = 'f' + + addi $t0, $zero, 58 + sb $t0, 18($v0) # internal_68[10] = ':' + + addi $t0, $zero, 10 + sb $t0, 19($v0) # internal_68[11] = '\n' + + sb $zero, 20($v0) # Null-terminator at the end of the string + + sw $v0, 152($sp) # internal_68 = "...enter f:\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 144($sp) # internal_70 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 428($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 144($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 140($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 440($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_68 + lw $t0, 164($sp) + sw $t0, 0($sp) # Storing internal_68 + + # Calling function internal_71 + lw $t0, 152($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 160($sp) # internal_69 = result of internal_71 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 25 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 25 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_72[0] = '\t' + + addi $t0, $zero, 84 + sb $t0, 9($v0) # internal_72[1] = 'T' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_72[2] = 'o' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_72[3] = ' ' + + addi $t0, $zero, 102 + sb $t0, 12($v0) # internal_72[4] = 'f' + + addi $t0, $zero, 105 + sb $t0, 13($v0) # internal_72[5] = 'i' + + addi $t0, $zero, 110 + sb $t0, 14($v0) # internal_72[6] = 'n' + + addi $t0, $zero, 100 + sb $t0, 15($v0) # internal_72[7] = 'd' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_72[8] = ' ' + + addi $t0, $zero, 111 + sb $t0, 17($v0) # internal_72[9] = 'o' + + addi $t0, $zero, 117 + sb $t0, 18($v0) # internal_72[10] = 'u' + + addi $t0, $zero, 116 + sb $t0, 19($v0) # internal_72[11] = 't' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_72[12] = ' ' + + addi $t0, $zero, 105 + sb $t0, 21($v0) # internal_72[13] = 'i' + + addi $t0, $zero, 102 + sb $t0, 22($v0) # internal_72[14] = 'f' + + addi $t0, $zero, 32 + sb $t0, 23($v0) # internal_72[15] = ' ' + + sb $zero, 24($v0) # Null-terminator at the end of the string + + sw $v0, 136($sp) # internal_72 = "\tTo find out if " + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 128($sp) # internal_74 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 428($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 128($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 124($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 440($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_72 + lw $t0, 148($sp) + sw $t0, 0($sp) # Storing internal_72 + + # Calling function internal_75 + lw $t0, 136($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 144($sp) # internal_73 = result of internal_75 + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute avar of self + lw $t0, 428($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8753942959969 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8753942959969 + j object_get_attribute_8753942959969 + int_get_attribute_8753942959969: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 120($sp) # internal_76 = self.avar + j end_get_attribute_8753942959969 + bool_get_attribute_8753942959969: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 120($sp) # internal_76 = self.avar + j end_get_attribute_8753942959969 + object_get_attribute_8753942959969: + sw $t1, 120($sp) # internal_76 = self.avar + end_get_attribute_8753942959969: + + # Allocating Int 13 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 13 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 112($sp) # internal_78 = address of allocated object Int + + # Get method print of Main + lw $t0, 428($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 112($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 108($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 440($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_76 + lw $t0, 132($sp) + sw $t0, 0($sp) # Storing internal_76 + + # Calling function internal_79 + lw $t0, 120($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 128($sp) # internal_77 = result of internal_79 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 39 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 39 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 105 + sb $t0, 8($v0) # internal_80[0] = 'i' + + addi $t0, $zero, 115 + sb $t0, 9($v0) # internal_80[1] = 's' + + addi $t0, $zero, 32 + sb $t0, 10($v0) # internal_80[2] = ' ' + + addi $t0, $zero, 97 + sb $t0, 11($v0) # internal_80[3] = 'a' + + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_80[4] = ' ' + + addi $t0, $zero, 109 + sb $t0, 13($v0) # internal_80[5] = 'm' + + addi $t0, $zero, 117 + sb $t0, 14($v0) # internal_80[6] = 'u' + + addi $t0, $zero, 108 + sb $t0, 15($v0) # internal_80[7] = 'l' + + addi $t0, $zero, 116 + sb $t0, 16($v0) # internal_80[8] = 't' + + addi $t0, $zero, 105 + sb $t0, 17($v0) # internal_80[9] = 'i' + + addi $t0, $zero, 112 + sb $t0, 18($v0) # internal_80[10] = 'p' + + addi $t0, $zero, 108 + sb $t0, 19($v0) # internal_80[11] = 'l' + + addi $t0, $zero, 101 + sb $t0, 20($v0) # internal_80[12] = 'e' + + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_80[13] = ' ' + + addi $t0, $zero, 111 + sb $t0, 22($v0) # internal_80[14] = 'o' + + addi $t0, $zero, 102 + sb $t0, 23($v0) # internal_80[15] = 'f' + + addi $t0, $zero, 32 + sb $t0, 24($v0) # internal_80[16] = ' ' + + addi $t0, $zero, 51 + sb $t0, 25($v0) # internal_80[17] = '3' + + addi $t0, $zero, 46 + sb $t0, 26($v0) # internal_80[18] = '.' + + addi $t0, $zero, 46 + sb $t0, 27($v0) # internal_80[19] = '.' + + addi $t0, $zero, 46 + sb $t0, 28($v0) # internal_80[20] = '.' + + addi $t0, $zero, 101 + sb $t0, 29($v0) # internal_80[21] = 'e' + + addi $t0, $zero, 110 + sb $t0, 30($v0) # internal_80[22] = 'n' + + addi $t0, $zero, 116 + sb $t0, 31($v0) # internal_80[23] = 't' + + addi $t0, $zero, 101 + sb $t0, 32($v0) # internal_80[24] = 'e' + + addi $t0, $zero, 114 + sb $t0, 33($v0) # internal_80[25] = 'r' + + addi $t0, $zero, 32 + sb $t0, 34($v0) # internal_80[26] = ' ' + + addi $t0, $zero, 103 + sb $t0, 35($v0) # internal_80[27] = 'g' + + addi $t0, $zero, 58 + sb $t0, 36($v0) # internal_80[28] = ':' + + addi $t0, $zero, 10 + sb $t0, 37($v0) # internal_80[29] = '\n' + + sb $zero, 38($v0) # Null-terminator at the end of the string + + sw $v0, 104($sp) # internal_80 = "is a multiple of 3...enter g:\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 96($sp) # internal_82 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 428($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 96($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 92($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 440($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_80 + lw $t0, 116($sp) + sw $t0, 0($sp) # Storing internal_80 + + # Calling function internal_83 + lw $t0, 104($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 112($sp) # internal_81 = result of internal_83 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 20 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 20 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_84[0] = '\t' + + addi $t0, $zero, 84 + sb $t0, 9($v0) # internal_84[1] = 'T' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_84[2] = 'o' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_84[3] = ' ' + + addi $t0, $zero, 100 + sb $t0, 12($v0) # internal_84[4] = 'd' + + addi $t0, $zero, 105 + sb $t0, 13($v0) # internal_84[5] = 'i' + + addi $t0, $zero, 118 + sb $t0, 14($v0) # internal_84[6] = 'v' + + addi $t0, $zero, 105 + sb $t0, 15($v0) # internal_84[7] = 'i' + + addi $t0, $zero, 100 + sb $t0, 16($v0) # internal_84[8] = 'd' + + addi $t0, $zero, 101 + sb $t0, 17($v0) # internal_84[9] = 'e' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_84[10] = ' ' + + sb $zero, 19($v0) # Null-terminator at the end of the string + + sw $v0, 88($sp) # internal_84 = "\tTo divide " + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 80($sp) # internal_86 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 428($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 80($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 76($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 440($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_84 + lw $t0, 100($sp) + sw $t0, 0($sp) # Storing internal_84 + + # Calling function internal_87 + lw $t0, 88($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 96($sp) # internal_85 = result of internal_87 + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute avar of self + lw $t0, 428($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8753942960409 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8753942960409 + j object_get_attribute_8753942960409 + int_get_attribute_8753942960409: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 72($sp) # internal_88 = self.avar + j end_get_attribute_8753942960409 + bool_get_attribute_8753942960409: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 72($sp) # internal_88 = self.avar + j end_get_attribute_8753942960409 + object_get_attribute_8753942960409: + sw $t1, 72($sp) # internal_88 = self.avar + end_get_attribute_8753942960409: + + # Allocating Int 13 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 13 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 64($sp) # internal_90 = address of allocated object Int + + # Get method print of Main + lw $t0, 428($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 64($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 60($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 440($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_88 + lw $t0, 84($sp) + sw $t0, 0($sp) # Storing internal_88 + + # Calling function internal_91 + lw $t0, 72($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 80($sp) # internal_89 = result of internal_91 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 25 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 25 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 98 + sb $t0, 8($v0) # internal_92[0] = 'b' + + addi $t0, $zero, 121 + sb $t0, 9($v0) # internal_92[1] = 'y' + + addi $t0, $zero, 32 + sb $t0, 10($v0) # internal_92[2] = ' ' + + addi $t0, $zero, 56 + sb $t0, 11($v0) # internal_92[3] = '8' + + addi $t0, $zero, 46 + sb $t0, 12($v0) # internal_92[4] = '.' + + addi $t0, $zero, 46 + sb $t0, 13($v0) # internal_92[5] = '.' + + addi $t0, $zero, 46 + sb $t0, 14($v0) # internal_92[6] = '.' + + addi $t0, $zero, 101 + sb $t0, 15($v0) # internal_92[7] = 'e' + + addi $t0, $zero, 110 + sb $t0, 16($v0) # internal_92[8] = 'n' + + addi $t0, $zero, 116 + sb $t0, 17($v0) # internal_92[9] = 't' + + addi $t0, $zero, 101 + sb $t0, 18($v0) # internal_92[10] = 'e' + + addi $t0, $zero, 114 + sb $t0, 19($v0) # internal_92[11] = 'r' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_92[12] = ' ' + + addi $t0, $zero, 104 + sb $t0, 21($v0) # internal_92[13] = 'h' + + addi $t0, $zero, 58 + sb $t0, 22($v0) # internal_92[14] = ':' + + addi $t0, $zero, 10 + sb $t0, 23($v0) # internal_92[15] = '\n' + + sb $zero, 24($v0) # Null-terminator at the end of the string + + sw $v0, 56($sp) # internal_92 = "by 8...enter h:\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 48($sp) # internal_94 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 428($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 48($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 44($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 440($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_92 + lw $t0, 68($sp) + sw $t0, 0($sp) # Storing internal_92 + + # Calling function internal_95 + lw $t0, 56($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 64($sp) # internal_93 = result of internal_95 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 41 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 41 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_96[0] = '\t' + + addi $t0, $zero, 84 + sb $t0, 9($v0) # internal_96[1] = 'T' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_96[2] = 'o' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_96[3] = ' ' + + addi $t0, $zero, 103 + sb $t0, 12($v0) # internal_96[4] = 'g' + + addi $t0, $zero, 101 + sb $t0, 13($v0) # internal_96[5] = 'e' + + addi $t0, $zero, 116 + sb $t0, 14($v0) # internal_96[6] = 't' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_96[7] = ' ' + + addi $t0, $zero, 97 + sb $t0, 16($v0) # internal_96[8] = 'a' + + addi $t0, $zero, 32 + sb $t0, 17($v0) # internal_96[9] = ' ' + + addi $t0, $zero, 110 + sb $t0, 18($v0) # internal_96[10] = 'n' + + addi $t0, $zero, 101 + sb $t0, 19($v0) # internal_96[11] = 'e' + + addi $t0, $zero, 119 + sb $t0, 20($v0) # internal_96[12] = 'w' + + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_96[13] = ' ' + + addi $t0, $zero, 110 + sb $t0, 22($v0) # internal_96[14] = 'n' + + addi $t0, $zero, 117 + sb $t0, 23($v0) # internal_96[15] = 'u' + + addi $t0, $zero, 109 + sb $t0, 24($v0) # internal_96[16] = 'm' + + addi $t0, $zero, 98 + sb $t0, 25($v0) # internal_96[17] = 'b' + + addi $t0, $zero, 101 + sb $t0, 26($v0) # internal_96[18] = 'e' + + addi $t0, $zero, 114 + sb $t0, 27($v0) # internal_96[19] = 'r' + + addi $t0, $zero, 46 + sb $t0, 28($v0) # internal_96[20] = '.' + + addi $t0, $zero, 46 + sb $t0, 29($v0) # internal_96[21] = '.' + + addi $t0, $zero, 46 + sb $t0, 30($v0) # internal_96[22] = '.' + + addi $t0, $zero, 101 + sb $t0, 31($v0) # internal_96[23] = 'e' + + addi $t0, $zero, 110 + sb $t0, 32($v0) # internal_96[24] = 'n' + + addi $t0, $zero, 116 + sb $t0, 33($v0) # internal_96[25] = 't' + + addi $t0, $zero, 101 + sb $t0, 34($v0) # internal_96[26] = 'e' + + addi $t0, $zero, 114 + sb $t0, 35($v0) # internal_96[27] = 'r' + + addi $t0, $zero, 32 + sb $t0, 36($v0) # internal_96[28] = ' ' + + addi $t0, $zero, 106 + sb $t0, 37($v0) # internal_96[29] = 'j' + + addi $t0, $zero, 58 + sb $t0, 38($v0) # internal_96[30] = ':' + + addi $t0, $zero, 10 + sb $t0, 39($v0) # internal_96[31] = '\n' + + sb $zero, 40($v0) # Null-terminator at the end of the string + + sw $v0, 40($sp) # internal_96 = "\tTo get a new number...enter j:\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_98 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 428($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 32($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 28($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 440($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_96 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_96 + + # Calling function internal_99 + lw $t0, 40($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 48($sp) # internal_97 = result of internal_99 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 30 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 30 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_100[0] = '\t' + + addi $t0, $zero, 84 + sb $t0, 9($v0) # internal_100[1] = 'T' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_100[2] = 'o' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_100[3] = ' ' + + addi $t0, $zero, 113 + sb $t0, 12($v0) # internal_100[4] = 'q' + + addi $t0, $zero, 117 + sb $t0, 13($v0) # internal_100[5] = 'u' + + addi $t0, $zero, 105 + sb $t0, 14($v0) # internal_100[6] = 'i' + + addi $t0, $zero, 116 + sb $t0, 15($v0) # internal_100[7] = 't' + + addi $t0, $zero, 46 + sb $t0, 16($v0) # internal_100[8] = '.' + + addi $t0, $zero, 46 + sb $t0, 17($v0) # internal_100[9] = '.' + + addi $t0, $zero, 46 + sb $t0, 18($v0) # internal_100[10] = '.' + + addi $t0, $zero, 101 + sb $t0, 19($v0) # internal_100[11] = 'e' + + addi $t0, $zero, 110 + sb $t0, 20($v0) # internal_100[12] = 'n' + + addi $t0, $zero, 116 + sb $t0, 21($v0) # internal_100[13] = 't' + + addi $t0, $zero, 101 + sb $t0, 22($v0) # internal_100[14] = 'e' + + addi $t0, $zero, 114 + sb $t0, 23($v0) # internal_100[15] = 'r' + + addi $t0, $zero, 32 + sb $t0, 24($v0) # internal_100[16] = ' ' + + addi $t0, $zero, 113 + sb $t0, 25($v0) # internal_100[17] = 'q' + + addi $t0, $zero, 58 + sb $t0, 26($v0) # internal_100[18] = ':' + + addi $t0, $zero, 10 + sb $t0, 27($v0) # internal_100[19] = '\n' + + addi $t0, $zero, 10 + sb $t0, 28($v0) # internal_100[20] = '\n' + + sb $zero, 29($v0) # Null-terminator at the end of the string + + sw $v0, 24($sp) # internal_100 = "\tTo quit...enter q:\n\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_102 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 428($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 16($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 12($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 440($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_100 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_100 + + # Calling function internal_103 + lw $t0, 24($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 32($sp) # internal_101 = result of internal_103 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_105 = address of allocated object Int + + # Get method in_string of Main + lw $t0, 428($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 436($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_106 + lw $t0, 8($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_104 = result of internal_106 + addi $sp, $sp, 8 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 428 + + jr $ra + + function_prompt_at_Main: + # Function parameters + # $ra = 48($sp) + # self = 44($sp) + + # Reserving space for local variables + addi $sp, $sp, -44 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_0[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 40($sp) # internal_0 = "\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_2 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 44($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 32($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 28($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_0 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function internal_3 + lw $t0, 40($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 48($sp) # internal_1 = result of internal_3 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 35 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 35 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 80 + sb $t0, 8($v0) # internal_4[0] = 'P' + + addi $t0, $zero, 108 + sb $t0, 9($v0) # internal_4[1] = 'l' + + addi $t0, $zero, 101 + sb $t0, 10($v0) # internal_4[2] = 'e' + + addi $t0, $zero, 97 + sb $t0, 11($v0) # internal_4[3] = 'a' + + addi $t0, $zero, 115 + sb $t0, 12($v0) # internal_4[4] = 's' + + addi $t0, $zero, 101 + sb $t0, 13($v0) # internal_4[5] = 'e' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_4[6] = ' ' + + addi $t0, $zero, 101 + sb $t0, 15($v0) # internal_4[7] = 'e' + + addi $t0, $zero, 110 + sb $t0, 16($v0) # internal_4[8] = 'n' + + addi $t0, $zero, 116 + sb $t0, 17($v0) # internal_4[9] = 't' + + addi $t0, $zero, 101 + sb $t0, 18($v0) # internal_4[10] = 'e' + + addi $t0, $zero, 114 + sb $t0, 19($v0) # internal_4[11] = 'r' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_4[12] = ' ' + + addi $t0, $zero, 97 + sb $t0, 21($v0) # internal_4[13] = 'a' + + addi $t0, $zero, 32 + sb $t0, 22($v0) # internal_4[14] = ' ' + + addi $t0, $zero, 110 + sb $t0, 23($v0) # internal_4[15] = 'n' + + addi $t0, $zero, 117 + sb $t0, 24($v0) # internal_4[16] = 'u' + + addi $t0, $zero, 109 + sb $t0, 25($v0) # internal_4[17] = 'm' + + addi $t0, $zero, 98 + sb $t0, 26($v0) # internal_4[18] = 'b' + + addi $t0, $zero, 101 + sb $t0, 27($v0) # internal_4[19] = 'e' + + addi $t0, $zero, 114 + sb $t0, 28($v0) # internal_4[20] = 'r' + + addi $t0, $zero, 46 + sb $t0, 29($v0) # internal_4[21] = '.' + + addi $t0, $zero, 46 + sb $t0, 30($v0) # internal_4[22] = '.' + + addi $t0, $zero, 46 + sb $t0, 31($v0) # internal_4[23] = '.' + + addi $t0, $zero, 32 + sb $t0, 32($v0) # internal_4[24] = ' ' + + addi $t0, $zero, 32 + sb $t0, 33($v0) # internal_4[25] = ' ' + + sb $zero, 34($v0) # Null-terminator at the end of the string + + sw $v0, 24($sp) # internal_4 = "Please enter a number... " + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_6 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 44($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 16($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 12($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_4 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function internal_7 + lw $t0, 24($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 32($sp) # internal_5 = result of internal_7 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_9 = address of allocated object Int + + # Get method in_string of Main + lw $t0, 44($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_10 + lw $t0, 8($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_8 = result of internal_10 + addi $sp, $sp, 8 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 44 + + jr $ra + + function_get_int_at_Main: + # Function parameters + # $ra = 40($sp) + # self = 36($sp) + + # Reserving space for local variables + addi $sp, $sp, -36 + + # Allocating A2I + li $v0, 9 + lw $a0, type_A2I + syscall + la $t0, type_A2I # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 28($sp) # internal_1 = address of allocated object A2I + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_1 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function___init___at_A2I + jal function___init___at_A2I + lw $ra, 4($sp) + sw $v1, 36($sp) # internal_1 = result of function___init___at_A2I + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument z + lw $t0, 44($sp) + sw $t0, 4($sp) # Storing z + + # Argument internal_1 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 44($sp) # z = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_4 = address of allocated object Int + + # Get method prompt of Main + lw $t0, 36($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 16($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 12($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_5 + lw $t0, 20($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 28($sp) # internal_3 = result of internal_5 + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument s + lw $t0, 36($sp) + sw $t0, 4($sp) # Storing s + + # Argument internal_3 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 36($sp) # s = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_7 = address of allocated object Int + + # Get method a2i of A2I + lw $t0, 32($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument z + lw $t0, 44($sp) + sw $t0, 4($sp) # Storing z + + # Argument s + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing s + + # Calling function internal_8 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_6 = result of internal_8 + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 36 + + jr $ra + + function_is_even_at_Main: + # Function parameters + # $ra = 112($sp) + # self = 108($sp) + # num = 104($sp) + + # Reserving space for local variables + addi $sp, $sp, -104 + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument x + lw $t0, 112($sp) + sw $t0, 4($sp) # Storing x + + # Argument num + lw $t0, 116($sp) + sw $t0, 0($sp) # Storing num + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 112($sp) # x = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 92($sp) # internal_2 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 88($sp) # internal_3 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument x + lw $t0, 112($sp) + sw $t0, 4($sp) # Storing x + + # Argument internal_3 + lw $t0, 100($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 96($sp) # internal_4 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_2 = internal_4 + lw $t0, 84($sp) + sw $t0, 92($sp) + + # If internal_2 then goto then_8753943036073 + lw $t0, 92($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8753943036073 + + # Jumping to else_8753943036073 + j else_8753943036073 + + then_8753943036073: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 80($sp) # internal_5 = address of allocated object Int + + # Allocating Int 4294967295 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4294967295 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 76($sp) # internal_6 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 72($sp) # internal_7 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument x + lw $t0, 112($sp) + sw $t0, 4($sp) # Storing x + + # Argument internal_6 + lw $t0, 88($sp) + sw $t0, 0($sp) # Storing internal_6 + + # Calling function function_xor + jal function_xor + lw $ra, 8($sp) + sw $v1, 84($sp) # internal_7 = result of function_xor + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_7 + lw $t0, 84($sp) + sw $t0, 4($sp) # Storing internal_7 + + # Argument internal_5 + lw $t0, 92($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 84($sp) # internal_7 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 11 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 11 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 64($sp) # internal_9 = address of allocated object Int + + # Get method is_even of Main + lw $t0, 108($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 64($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 60($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 120($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_7 + lw $t0, 84($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function internal_10 + lw $t0, 72($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 80($sp) # internal_8 = result of internal_10 + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_1 = internal_8 + lw $t0, 68($sp) + sw $t0, 96($sp) + + # Jumping to endif_8753943036073 + j endif_8753943036073 + + else_8753943036073: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 52($sp) # internal_12 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 48($sp) # internal_13 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_13 + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing internal_13 + + # Argument x + lw $t0, 112($sp) + sw $t0, 0($sp) # Storing x + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 56($sp) # internal_14 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_12 = internal_14 + lw $t0, 44($sp) + sw $t0, 52($sp) + + # If internal_12 then goto then_8753943036076 + lw $t0, 52($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8753943036076 + + # Jumping to else_8753943036076 + j else_8753943036076 + + then_8753943036076: + + # Allocating Bool 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_15 = address of allocated object Int + + # internal_11 = internal_15 + lw $t0, 40($sp) + sw $t0, 56($sp) + + # Jumping to endif_8753943036076 + j endif_8753943036076 + + else_8753943036076: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_17 = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_18 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_18 + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing internal_18 + + # Argument x + lw $t0, 112($sp) + sw $t0, 0($sp) # Storing x + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_19 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_17 = internal_19 + lw $t0, 24($sp) + sw $t0, 32($sp) + + # If internal_17 then goto then_8753943036082 + lw $t0, 32($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8753943036082 + + # Jumping to else_8753943036082 + j else_8753943036082 + + then_8753943036082: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_20 = address of allocated object Int + + # internal_16 = internal_20 + lw $t0, 20($sp) + sw $t0, 36($sp) + + # Jumping to endif_8753943036082 + j endif_8753943036082 + + else_8753943036082: + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_21 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument x + lw $t0, 112($sp) + sw $t0, 4($sp) # Storing x + + # Argument internal_21 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_21 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_22 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 11 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 11 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_24 = address of allocated object Int + + # Get method is_even of Main + lw $t0, 108($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 120($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_22 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_22 + + # Calling function internal_25 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_23 = result of internal_25 + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_16 = internal_23 + lw $t0, 8($sp) + sw $t0, 36($sp) + + # Jumping to endif_8753943036082 + j endif_8753943036082 + + endif_8753943036082: + + # internal_11 = internal_16 + lw $t0, 36($sp) + sw $t0, 56($sp) + + # Jumping to endif_8753943036076 + j endif_8753943036076 + + endif_8753943036076: + + # internal_1 = internal_11 + lw $t0, 56($sp) + sw $t0, 96($sp) + + # Jumping to endif_8753943036073 + j endif_8753943036073 + + endif_8753943036073: + + # Loading return value in $v1 + lw $v1, 96($sp) + + # Freeing space for local variables + addi $sp, $sp, 104 + + jr $ra + + function_class_type_at_Main: + # Function parameters + # $ra = 340($sp) + # self = 336($sp) + # var = 332($sp) + + # Reserving space for local variables + addi $sp, $sp, -332 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 328($sp) # internal_0 = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 324($sp) # internal_1 = address of allocated object Int + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 320($sp) # internal_2 = address of allocated object Int + + # Allocating NUll to internal_3 + sw $zero, 316($sp) # internal_3 = 0 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 312($sp) # internal_4 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 300($sp) # internal_7 = address of allocated object Int + + # internal_5 = typeof var that is the first word of the object + lw $t0, 332($sp) + lw $t0, 0($t0) + sw $t0, 308($sp) + + # internal_6 = internal_5 + lw $t0, 308($sp) + sw $t0, 304($sp) + + while_start_8753943036435: + + # internal_7 = EqualAddress(internal_6, internal_3) + lw $t0, 304($sp) + lw $t1, 316($sp) + seq $t2, $t0, $t1 + lw $t0, 300($sp) + sw $t2, 8($t0) + + # If internal_7 then goto while_end_8753943036435 + lw $t0, 300($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_end_8753943036435 + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_4 + lw $t0, 324($sp) + sw $t0, 4($sp) # Storing internal_4 + + # Argument internal_1 + lw $t0, 336($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 324($sp) # internal_4 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_6 = ancestor of internal_6 + lw $t0, 304($sp) + lw $t0, 4($t0) + sw $t0, 304($sp) + + # Jumping to while_start_8753943036435 + j while_start_8753943036435 + + while_end_8753943036435: + + # internal_6 = internal_5 + lw $t0, 308($sp) + sw $t0, 304($sp) + + # initialize Array [internal_4] + lw $t0, 312($sp) # $t0 = internal_4 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 296($sp) # internal_8 = new Array[internal_4] + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 292($sp) # internal_9 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 288($sp) # internal_10 = address of allocated object Int + + foreach_start_8753943036435: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_9 + lw $t0, 304($sp) + sw $t0, 4($sp) # Storing internal_9 + + # Argument internal_4 + lw $t0, 324($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 300($sp) # internal_10 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_10 then goto foreach_body_8753943036435 + lw $t0, 288($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_body_8753943036435 + + # Jumping to foreach_end_8753943036435 + j foreach_end_8753943036435 + + foreach_body_8753943036435: + + # array internal_8[4 * internal_9] = internal_6 + lw $t0, 292($sp) # $t0 = internal_9 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 296($sp) # $t1 = internal_8 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 304($sp) + sw $t0, 0($t1) + + # internal_6 = ancestor of internal_6 + lw $t0, 304($sp) + lw $t0, 4($t0) + sw $t0, 304($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_9 + lw $t0, 304($sp) + sw $t0, 4($sp) # Storing internal_9 + + # Argument internal_1 + lw $t0, 336($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 304($sp) # internal_9 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_start_8753943036435 + j foreach_start_8753943036435 + + foreach_end_8753943036435: + + # initialize Array [internal_2] + lw $t0, 320($sp) # $t0 = internal_2 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 284($sp) # internal_11 = new Array[internal_2] + + # initialize Array [internal_2] + lw $t0, 320($sp) # $t0 = internal_2 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 280($sp) # internal_12 = new Array[internal_2] + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 272($sp) # internal_14 = address of allocated object Int + + # internal_13 = direction of A + la $t0, type_A + sw $t0, 276($sp) + + # array internal_11[4 * internal_14] = internal_13 + lw $t0, 272($sp) # $t0 = internal_14 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 284($sp) # $t1 = internal_11 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 276($sp) + sw $t0, 0($t1) + + # array internal_12[4 * internal_14] = internal_4 + lw $t0, 272($sp) # $t0 = internal_14 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 280($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 312($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 264($sp) # internal_16 = address of allocated object Int + + # internal_15 = direction of B + la $t0, type_B + sw $t0, 268($sp) + + # array internal_11[4 * internal_16] = internal_15 + lw $t0, 264($sp) # $t0 = internal_16 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 284($sp) # $t1 = internal_11 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 268($sp) + sw $t0, 0($t1) + + # array internal_12[4 * internal_16] = internal_4 + lw $t0, 264($sp) # $t0 = internal_16 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 280($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 312($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 256($sp) # internal_18 = address of allocated object Int + + # internal_17 = direction of C + la $t0, type_C + sw $t0, 260($sp) + + # array internal_11[4 * internal_18] = internal_17 + lw $t0, 256($sp) # $t0 = internal_18 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 284($sp) # $t1 = internal_11 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 260($sp) + sw $t0, 0($t1) + + # array internal_12[4 * internal_18] = internal_4 + lw $t0, 256($sp) # $t0 = internal_18 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 280($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 312($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 248($sp) # internal_20 = address of allocated object Int + + # internal_19 = direction of D + la $t0, type_D + sw $t0, 252($sp) + + # array internal_11[4 * internal_20] = internal_19 + lw $t0, 248($sp) # $t0 = internal_20 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 284($sp) # $t1 = internal_11 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 252($sp) + sw $t0, 0($t1) + + # array internal_12[4 * internal_20] = internal_4 + lw $t0, 248($sp) # $t0 = internal_20 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 280($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 312($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 240($sp) # internal_22 = address of allocated object Int + + # internal_21 = direction of E + la $t0, type_E + sw $t0, 244($sp) + + # array internal_11[4 * internal_22] = internal_21 + lw $t0, 240($sp) # $t0 = internal_22 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 284($sp) # $t1 = internal_11 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 244($sp) + sw $t0, 0($t1) + + # array internal_12[4 * internal_22] = internal_4 + lw $t0, 240($sp) # $t0 = internal_22 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 280($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 312($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 232($sp) # internal_24 = address of allocated object Int + + # internal_23 = direction of Object + la $t0, type_Object + sw $t0, 236($sp) + + # array internal_11[4 * internal_24] = internal_23 + lw $t0, 232($sp) # $t0 = internal_24 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 284($sp) # $t1 = internal_11 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 236($sp) + sw $t0, 0($t1) + + # array internal_12[4 * internal_24] = internal_4 + lw $t0, 232($sp) # $t0 = internal_24 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 280($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 312($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 228($sp) # internal_25 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 224($sp) # internal_26 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 216($sp) # internal_28 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 212($sp) # internal_29 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 204($sp) # internal_31 = address of allocated object Int + + foreach_type_start_8753943036435: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_25 + lw $t0, 240($sp) + sw $t0, 4($sp) # Storing internal_25 + + # Argument internal_2 + lw $t0, 332($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 236($sp) # internal_26 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_26 then goto foreach_type_body_8753943036435 + lw $t0, 224($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_type_body_8753943036435 + + # Jumping to foreach_type_end_8753943036435 + j foreach_type_end_8753943036435 + + foreach_type_body_8753943036435: + + # internal_27 = array internal_11[4 * internal_25] + lw $t0, 228($sp) # $t0 = internal_25 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 284($sp) # $t1 = internal_11 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + sw $t0, 220($sp) # internal_27 = array internal_11[4 * internal_25] + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_28 + lw $t0, 228($sp) + sw $t0, 4($sp) # Storing internal_28 + + # Argument internal_0 + lw $t0, 340($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 228($sp) # internal_28 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + foreach_ancestor_start_8753943036435: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_28 + lw $t0, 228($sp) + sw $t0, 4($sp) # Storing internal_28 + + # Argument internal_4 + lw $t0, 324($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 224($sp) # internal_29 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_29 then goto foreach_ancestor_body_8753943036435 + lw $t0, 212($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_body_8753943036435 + + # Jumping to foreach_ancestor_end_8753943036435 + j foreach_ancestor_end_8753943036435 + + foreach_ancestor_body_8753943036435: + + # internal_30 = array internal_8[4 * internal_28] + lw $t0, 216($sp) # $t0 = internal_28 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 296($sp) # $t1 = internal_8 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + sw $t0, 208($sp) # internal_30 = array internal_8[4 * internal_28] + + # internal_31 = EqualAddress(internal_27, internal_30) + lw $t0, 220($sp) + lw $t1, 208($sp) + seq $t2, $t0, $t1 + lw $t0, 204($sp) + sw $t2, 8($t0) + + # If internal_31 then goto foreach_ancestor_end_8753943036435 + lw $t0, 204($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_end_8753943036435 + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_28 + lw $t0, 228($sp) + sw $t0, 4($sp) # Storing internal_28 + + # Argument internal_1 + lw $t0, 336($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 228($sp) # internal_28 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_ancestor_start_8753943036435 + j foreach_ancestor_start_8753943036435 + + foreach_ancestor_end_8753943036435: + + # array internal_12[4 * internal_25] = internal_28 + lw $t0, 228($sp) # $t0 = internal_25 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 280($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 216($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_25 + lw $t0, 240($sp) + sw $t0, 4($sp) # Storing internal_25 + + # Argument internal_1 + lw $t0, 336($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 240($sp) # internal_25 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_type_start_8753943036435 + j foreach_type_start_8753943036435 + + foreach_type_end_8753943036435: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 200($sp) # internal_32 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 196($sp) # internal_33 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 192($sp) # internal_34 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 188($sp) # internal_35 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 184($sp) # internal_36 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_35 + lw $t0, 200($sp) + sw $t0, 4($sp) # Storing internal_35 + + # Argument internal_4 + lw $t0, 324($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 200($sp) # internal_35 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + foreach_min_start_8753943036435: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_32 + lw $t0, 212($sp) + sw $t0, 4($sp) # Storing internal_32 + + # Argument internal_2 + lw $t0, 332($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 196($sp) # internal_36 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_36 then goto foreach_min_body_8753943036435 + lw $t0, 184($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_min_body_8753943036435 + + # Jumping to foreach_min_end_8753943036435 + j foreach_min_end_8753943036435 + + foreach_min_body_8753943036435: + + # internal_34 = array internal_12[4 * internal_32] + lw $t0, 200($sp) # $t0 = internal_32 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 280($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 192($sp) # internal_34 = array internal_12[4 * internal_32] + sw $t0, 8($t2) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_34 + lw $t0, 204($sp) + sw $t0, 4($sp) # Storing internal_34 + + # Argument internal_35 + lw $t0, 200($sp) + sw $t0, 0($sp) # Storing internal_35 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 196($sp) # internal_36 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_36 then goto update_min_8753943036435 + lw $t0, 184($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, update_min_8753943036435 + + # Jumping to update_min_end_8753943036435 + j update_min_end_8753943036435 + + update_min_8753943036435: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_35 + lw $t0, 200($sp) + sw $t0, 4($sp) # Storing internal_35 + + # Argument internal_34 + lw $t0, 204($sp) + sw $t0, 0($sp) # Storing internal_34 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 200($sp) # internal_35 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_33 + lw $t0, 208($sp) + sw $t0, 4($sp) # Storing internal_33 + + # Argument internal_32 + lw $t0, 212($sp) + sw $t0, 0($sp) # Storing internal_32 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 208($sp) # internal_33 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + update_min_end_8753943036435: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_32 + lw $t0, 212($sp) + sw $t0, 4($sp) # Storing internal_32 + + # Argument internal_1 + lw $t0, 336($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 212($sp) # internal_32 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_min_start_8753943036435 + j foreach_min_start_8753943036435 + + foreach_min_end_8753943036435: + + # initialize Array [internal_2] + lw $t0, 320($sp) # $t0 = internal_2 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 180($sp) # internal_37 = new Array[internal_2] + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 176($sp) # internal_38 = address of allocated object Int + + # array internal_37[4 * internal_38] = internal_0 + lw $t0, 176($sp) # $t0 = internal_38 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 180($sp) # $t1 = internal_37 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 328($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 172($sp) # internal_39 = address of allocated object Int + + # array internal_37[4 * internal_39] = internal_0 + lw $t0, 172($sp) # $t0 = internal_39 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 180($sp) # $t1 = internal_37 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 328($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 168($sp) # internal_40 = address of allocated object Int + + # array internal_37[4 * internal_40] = internal_0 + lw $t0, 168($sp) # $t0 = internal_40 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 180($sp) # $t1 = internal_37 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 328($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 164($sp) # internal_41 = address of allocated object Int + + # array internal_37[4 * internal_41] = internal_0 + lw $t0, 164($sp) # $t0 = internal_41 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 180($sp) # $t1 = internal_37 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 328($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 160($sp) # internal_42 = address of allocated object Int + + # array internal_37[4 * internal_42] = internal_0 + lw $t0, 160($sp) # $t0 = internal_42 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 180($sp) # $t1 = internal_37 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 328($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 156($sp) # internal_43 = address of allocated object Int + + # array internal_37[4 * internal_43] = internal_0 + lw $t0, 156($sp) # $t0 = internal_43 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 180($sp) # $t1 = internal_37 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 328($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 152($sp) # internal_44 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_35 + lw $t0, 200($sp) + sw $t0, 4($sp) # Storing internal_35 + + # Argument internal_4 + lw $t0, 324($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 164($sp) # internal_44 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_44 then goto error_branch_8753943036435 + lw $t0, 152($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, error_branch_8753943036435 + + # array internal_37[4 * internal_33] = internal_1 + lw $t0, 196($sp) # $t0 = internal_33 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 180($sp) # $t1 = internal_37 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 324($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 148($sp) # internal_45 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 144($sp) # internal_46 = address of allocated object Int + + # internal_45 = array internal_37[4 * internal_46] + lw $t0, 144($sp) # $t0 = internal_46 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 180($sp) # $t1 = internal_37 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 148($sp) # internal_45 = array internal_37[4 * internal_46] + sw $t0, 8($t2) + + # If internal_45 then goto branch_A_8753943036435 + lw $t0, 148($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_A_8753943036435 + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 140($sp) # internal_47 = address of allocated object Int + + # internal_45 = array internal_37[4 * internal_47] + lw $t0, 140($sp) # $t0 = internal_47 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 180($sp) # $t1 = internal_37 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 148($sp) # internal_45 = array internal_37[4 * internal_47] + sw $t0, 8($t2) + + # If internal_45 then goto branch_B_8753943036435 + lw $t0, 148($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_B_8753943036435 + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 136($sp) # internal_48 = address of allocated object Int + + # internal_45 = array internal_37[4 * internal_48] + lw $t0, 136($sp) # $t0 = internal_48 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 180($sp) # $t1 = internal_37 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 148($sp) # internal_45 = array internal_37[4 * internal_48] + sw $t0, 8($t2) + + # If internal_45 then goto branch_C_8753943036435 + lw $t0, 148($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_C_8753943036435 + + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 132($sp) # internal_49 = address of allocated object Int + + # internal_45 = array internal_37[4 * internal_49] + lw $t0, 132($sp) # $t0 = internal_49 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 180($sp) # $t1 = internal_37 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 148($sp) # internal_45 = array internal_37[4 * internal_49] + sw $t0, 8($t2) + + # If internal_45 then goto branch_D_8753943036435 + lw $t0, 148($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_D_8753943036435 + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 128($sp) # internal_50 = address of allocated object Int + + # internal_45 = array internal_37[4 * internal_50] + lw $t0, 128($sp) # $t0 = internal_50 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 180($sp) # $t1 = internal_37 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 148($sp) # internal_45 = array internal_37[4 * internal_50] + sw $t0, 8($t2) + + # If internal_45 then goto branch_E_8753943036435 + lw $t0, 148($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_E_8753943036435 + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 124($sp) # internal_51 = address of allocated object Int + + # internal_45 = array internal_37[4 * internal_51] + lw $t0, 124($sp) # $t0 = internal_51 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 180($sp) # $t1 = internal_37 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 148($sp) # internal_45 = array internal_37[4 * internal_51] + sw $t0, 8($t2) + + # If internal_45 then goto branch_Object_8753943036435 + lw $t0, 148($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Object_8753943036435 + + branch_A_8753943036435: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument a + lw $t0, 128($sp) + sw $t0, 4($sp) # Storing a + + # Argument var + lw $t0, 344($sp) + sw $t0, 0($sp) # Storing var + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 128($sp) # a = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 29 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 29 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 67 + sb $t0, 8($v0) # internal_54[0] = 'C' + + addi $t0, $zero, 108 + sb $t0, 9($v0) # internal_54[1] = 'l' + + addi $t0, $zero, 97 + sb $t0, 10($v0) # internal_54[2] = 'a' + + addi $t0, $zero, 115 + sb $t0, 11($v0) # internal_54[3] = 's' + + addi $t0, $zero, 115 + sb $t0, 12($v0) # internal_54[4] = 's' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_54[5] = ' ' + + addi $t0, $zero, 116 + sb $t0, 14($v0) # internal_54[6] = 't' + + addi $t0, $zero, 121 + sb $t0, 15($v0) # internal_54[7] = 'y' + + addi $t0, $zero, 112 + sb $t0, 16($v0) # internal_54[8] = 'p' + + addi $t0, $zero, 101 + sb $t0, 17($v0) # internal_54[9] = 'e' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_54[10] = ' ' + + addi $t0, $zero, 105 + sb $t0, 19($v0) # internal_54[11] = 'i' + + addi $t0, $zero, 115 + sb $t0, 20($v0) # internal_54[12] = 's' + + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_54[13] = ' ' + + addi $t0, $zero, 110 + sb $t0, 22($v0) # internal_54[14] = 'n' + + addi $t0, $zero, 111 + sb $t0, 23($v0) # internal_54[15] = 'o' + + addi $t0, $zero, 119 + sb $t0, 24($v0) # internal_54[16] = 'w' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_54[17] = ' ' + + addi $t0, $zero, 65 + sb $t0, 26($v0) # internal_54[18] = 'A' + + addi $t0, $zero, 10 + sb $t0, 27($v0) # internal_54[19] = '\n' + + sb $zero, 28($v0) # Null-terminator at the end of the string + + sw $v0, 112($sp) # internal_54 = "Class type is now A\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 104($sp) # internal_56 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 336($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 104($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 100($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 348($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_54 + lw $t0, 124($sp) + sw $t0, 0($sp) # Storing internal_54 + + # Calling function internal_57 + lw $t0, 112($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 120($sp) # internal_55 = result of internal_57 + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_52 + lw $t0, 132($sp) + sw $t0, 4($sp) # Storing internal_52 + + # Argument internal_55 + lw $t0, 120($sp) + sw $t0, 0($sp) # Storing internal_55 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 132($sp) # internal_52 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_52 = internal_55 + lw $t0, 108($sp) + sw $t0, 120($sp) + + # Jumping to branch_end_8753943036435 + j branch_end_8753943036435 + + branch_B_8753943036435: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument b + lw $t0, 108($sp) + sw $t0, 4($sp) # Storing b + + # Argument var + lw $t0, 344($sp) + sw $t0, 0($sp) # Storing var + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 108($sp) # b = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 29 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 29 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 67 + sb $t0, 8($v0) # internal_59[0] = 'C' + + addi $t0, $zero, 108 + sb $t0, 9($v0) # internal_59[1] = 'l' + + addi $t0, $zero, 97 + sb $t0, 10($v0) # internal_59[2] = 'a' + + addi $t0, $zero, 115 + sb $t0, 11($v0) # internal_59[3] = 's' + + addi $t0, $zero, 115 + sb $t0, 12($v0) # internal_59[4] = 's' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_59[5] = ' ' + + addi $t0, $zero, 116 + sb $t0, 14($v0) # internal_59[6] = 't' + + addi $t0, $zero, 121 + sb $t0, 15($v0) # internal_59[7] = 'y' + + addi $t0, $zero, 112 + sb $t0, 16($v0) # internal_59[8] = 'p' + + addi $t0, $zero, 101 + sb $t0, 17($v0) # internal_59[9] = 'e' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_59[10] = ' ' + + addi $t0, $zero, 105 + sb $t0, 19($v0) # internal_59[11] = 'i' + + addi $t0, $zero, 115 + sb $t0, 20($v0) # internal_59[12] = 's' + + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_59[13] = ' ' + + addi $t0, $zero, 110 + sb $t0, 22($v0) # internal_59[14] = 'n' + + addi $t0, $zero, 111 + sb $t0, 23($v0) # internal_59[15] = 'o' + + addi $t0, $zero, 119 + sb $t0, 24($v0) # internal_59[16] = 'w' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_59[17] = ' ' + + addi $t0, $zero, 66 + sb $t0, 26($v0) # internal_59[18] = 'B' + + addi $t0, $zero, 10 + sb $t0, 27($v0) # internal_59[19] = '\n' + + sb $zero, 28($v0) # Null-terminator at the end of the string + + sw $v0, 92($sp) # internal_59 = "Class type is now B\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 84($sp) # internal_61 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 336($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 84($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 80($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 348($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_59 + lw $t0, 104($sp) + sw $t0, 0($sp) # Storing internal_59 + + # Calling function internal_62 + lw $t0, 92($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 100($sp) # internal_60 = result of internal_62 + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_52 + lw $t0, 132($sp) + sw $t0, 4($sp) # Storing internal_52 + + # Argument internal_60 + lw $t0, 100($sp) + sw $t0, 0($sp) # Storing internal_60 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 132($sp) # internal_52 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_52 = internal_60 + lw $t0, 88($sp) + sw $t0, 120($sp) + + # Jumping to branch_end_8753943036435 + j branch_end_8753943036435 + + branch_C_8753943036435: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument c + lw $t0, 88($sp) + sw $t0, 4($sp) # Storing c + + # Argument var + lw $t0, 344($sp) + sw $t0, 0($sp) # Storing var + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 88($sp) # c = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 29 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 29 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 67 + sb $t0, 8($v0) # internal_64[0] = 'C' + + addi $t0, $zero, 108 + sb $t0, 9($v0) # internal_64[1] = 'l' + + addi $t0, $zero, 97 + sb $t0, 10($v0) # internal_64[2] = 'a' + + addi $t0, $zero, 115 + sb $t0, 11($v0) # internal_64[3] = 's' + + addi $t0, $zero, 115 + sb $t0, 12($v0) # internal_64[4] = 's' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_64[5] = ' ' + + addi $t0, $zero, 116 + sb $t0, 14($v0) # internal_64[6] = 't' + + addi $t0, $zero, 121 + sb $t0, 15($v0) # internal_64[7] = 'y' + + addi $t0, $zero, 112 + sb $t0, 16($v0) # internal_64[8] = 'p' + + addi $t0, $zero, 101 + sb $t0, 17($v0) # internal_64[9] = 'e' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_64[10] = ' ' + + addi $t0, $zero, 105 + sb $t0, 19($v0) # internal_64[11] = 'i' + + addi $t0, $zero, 115 + sb $t0, 20($v0) # internal_64[12] = 's' + + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_64[13] = ' ' + + addi $t0, $zero, 110 + sb $t0, 22($v0) # internal_64[14] = 'n' + + addi $t0, $zero, 111 + sb $t0, 23($v0) # internal_64[15] = 'o' + + addi $t0, $zero, 119 + sb $t0, 24($v0) # internal_64[16] = 'w' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_64[17] = ' ' + + addi $t0, $zero, 67 + sb $t0, 26($v0) # internal_64[18] = 'C' + + addi $t0, $zero, 10 + sb $t0, 27($v0) # internal_64[19] = '\n' + + sb $zero, 28($v0) # Null-terminator at the end of the string + + sw $v0, 72($sp) # internal_64 = "Class type is now C\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 64($sp) # internal_66 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 336($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 64($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 60($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 348($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_64 + lw $t0, 84($sp) + sw $t0, 0($sp) # Storing internal_64 + + # Calling function internal_67 + lw $t0, 72($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 80($sp) # internal_65 = result of internal_67 + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_52 + lw $t0, 132($sp) + sw $t0, 4($sp) # Storing internal_52 + + # Argument internal_65 + lw $t0, 80($sp) + sw $t0, 0($sp) # Storing internal_65 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 132($sp) # internal_52 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_52 = internal_65 + lw $t0, 68($sp) + sw $t0, 120($sp) + + # Jumping to branch_end_8753943036435 + j branch_end_8753943036435 + + branch_D_8753943036435: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument d + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing d + + # Argument var + lw $t0, 344($sp) + sw $t0, 0($sp) # Storing var + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 68($sp) # d = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 29 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 29 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 67 + sb $t0, 8($v0) # internal_69[0] = 'C' + + addi $t0, $zero, 108 + sb $t0, 9($v0) # internal_69[1] = 'l' + + addi $t0, $zero, 97 + sb $t0, 10($v0) # internal_69[2] = 'a' + + addi $t0, $zero, 115 + sb $t0, 11($v0) # internal_69[3] = 's' + + addi $t0, $zero, 115 + sb $t0, 12($v0) # internal_69[4] = 's' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_69[5] = ' ' + + addi $t0, $zero, 116 + sb $t0, 14($v0) # internal_69[6] = 't' + + addi $t0, $zero, 121 + sb $t0, 15($v0) # internal_69[7] = 'y' + + addi $t0, $zero, 112 + sb $t0, 16($v0) # internal_69[8] = 'p' + + addi $t0, $zero, 101 + sb $t0, 17($v0) # internal_69[9] = 'e' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_69[10] = ' ' + + addi $t0, $zero, 105 + sb $t0, 19($v0) # internal_69[11] = 'i' + + addi $t0, $zero, 115 + sb $t0, 20($v0) # internal_69[12] = 's' + + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_69[13] = ' ' + + addi $t0, $zero, 110 + sb $t0, 22($v0) # internal_69[14] = 'n' + + addi $t0, $zero, 111 + sb $t0, 23($v0) # internal_69[15] = 'o' + + addi $t0, $zero, 119 + sb $t0, 24($v0) # internal_69[16] = 'w' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_69[17] = ' ' + + addi $t0, $zero, 68 + sb $t0, 26($v0) # internal_69[18] = 'D' + + addi $t0, $zero, 10 + sb $t0, 27($v0) # internal_69[19] = '\n' + + sb $zero, 28($v0) # Null-terminator at the end of the string + + sw $v0, 52($sp) # internal_69 = "Class type is now D\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_71 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 336($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 44($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 40($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 348($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_69 + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing internal_69 + + # Calling function internal_72 + lw $t0, 52($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 60($sp) # internal_70 = result of internal_72 + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_52 + lw $t0, 132($sp) + sw $t0, 4($sp) # Storing internal_52 + + # Argument internal_70 + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing internal_70 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 132($sp) # internal_52 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_52 = internal_70 + lw $t0, 48($sp) + sw $t0, 120($sp) + + # Jumping to branch_end_8753943036435 + j branch_end_8753943036435 + + branch_E_8753943036435: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument e + lw $t0, 48($sp) + sw $t0, 4($sp) # Storing e + + # Argument var + lw $t0, 344($sp) + sw $t0, 0($sp) # Storing var + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 48($sp) # e = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 29 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 29 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 67 + sb $t0, 8($v0) # internal_74[0] = 'C' + + addi $t0, $zero, 108 + sb $t0, 9($v0) # internal_74[1] = 'l' + + addi $t0, $zero, 97 + sb $t0, 10($v0) # internal_74[2] = 'a' + + addi $t0, $zero, 115 + sb $t0, 11($v0) # internal_74[3] = 's' + + addi $t0, $zero, 115 + sb $t0, 12($v0) # internal_74[4] = 's' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_74[5] = ' ' + + addi $t0, $zero, 116 + sb $t0, 14($v0) # internal_74[6] = 't' + + addi $t0, $zero, 121 + sb $t0, 15($v0) # internal_74[7] = 'y' + + addi $t0, $zero, 112 + sb $t0, 16($v0) # internal_74[8] = 'p' + + addi $t0, $zero, 101 + sb $t0, 17($v0) # internal_74[9] = 'e' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_74[10] = ' ' + + addi $t0, $zero, 105 + sb $t0, 19($v0) # internal_74[11] = 'i' + + addi $t0, $zero, 115 + sb $t0, 20($v0) # internal_74[12] = 's' + + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_74[13] = ' ' + + addi $t0, $zero, 110 + sb $t0, 22($v0) # internal_74[14] = 'n' + + addi $t0, $zero, 111 + sb $t0, 23($v0) # internal_74[15] = 'o' + + addi $t0, $zero, 119 + sb $t0, 24($v0) # internal_74[16] = 'w' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_74[17] = ' ' + + addi $t0, $zero, 69 + sb $t0, 26($v0) # internal_74[18] = 'E' + + addi $t0, $zero, 10 + sb $t0, 27($v0) # internal_74[19] = '\n' + + sb $zero, 28($v0) # Null-terminator at the end of the string + + sw $v0, 32($sp) # internal_74 = "Class type is now E\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # internal_76 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 336($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 24($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 20($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 348($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_74 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_74 + + # Calling function internal_77 + lw $t0, 32($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_75 = result of internal_77 + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_52 + lw $t0, 132($sp) + sw $t0, 4($sp) # Storing internal_52 + + # Argument internal_75 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_75 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 132($sp) # internal_52 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_52 = internal_75 + lw $t0, 28($sp) + sw $t0, 120($sp) + + # Jumping to branch_end_8753943036435 + j branch_end_8753943036435 + + branch_Object_8753943036435: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument o + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing o + + # Argument var + lw $t0, 344($sp) + sw $t0, 0($sp) # Storing var + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 28($sp) # o = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 16 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 16 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 79 + sb $t0, 8($v0) # internal_79[0] = 'O' + + addi $t0, $zero, 111 + sb $t0, 9($v0) # internal_79[1] = 'o' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_79[2] = 'o' + + addi $t0, $zero, 111 + sb $t0, 11($v0) # internal_79[3] = 'o' + + addi $t0, $zero, 112 + sb $t0, 12($v0) # internal_79[4] = 'p' + + addi $t0, $zero, 115 + sb $t0, 13($v0) # internal_79[5] = 's' + + addi $t0, $zero, 10 + sb $t0, 14($v0) # internal_79[6] = '\n' + + sb $zero, 15($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_79 = "Oooops\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_81 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 336($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 348($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_79 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_79 + + # Calling function internal_82 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_80 = result of internal_82 + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_52 + lw $t0, 132($sp) + sw $t0, 4($sp) # Storing internal_52 + + # Argument internal_80 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_80 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 132($sp) # internal_52 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_52 = internal_80 + lw $t0, 8($sp) + sw $t0, 120($sp) + + # Jumping to branch_end_8753943036435 + j branch_end_8753943036435 + + error_branch_8753943036435: + + branch_end_8753943036435: + + # Loading return value in $v1 + lw $v1, 120($sp) + + # Freeing space for local variables + addi $sp, $sp, 332 + + jr $ra + + function_print_at_Main: + # Function parameters + # $ra = 68($sp) + # self = 64($sp) + # var = 60($sp) + + # Reserving space for local variables + addi $sp, $sp, -60 + + # Allocating A2I + li $v0, 9 + lw $a0, type_A2I + syscall + la $t0, type_A2I # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 52($sp) # internal_1 = address of allocated object A2I + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_1 + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function___init___at_A2I + jal function___init___at_A2I + lw $ra, 4($sp) + sw $v1, 60($sp) # internal_1 = result of function___init___at_A2I + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument z + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing z + + # Argument internal_1 + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 68($sp) # z = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_3 = address of allocated object Int + + # Get method value of A + lw $t0, 60($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 44($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 40($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument var + lw $t0, 68($sp) + sw $t0, 0($sp) # Storing var + + # Calling function internal_4 + lw $t0, 48($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 56($sp) # internal_2 = result of internal_4 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_6 = address of allocated object Int + + # Get method i2a of A2I + lw $t0, 56($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 32($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 28($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument z + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing z + + # Argument internal_2 + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function internal_7 + lw $t0, 40($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 48($sp) # internal_5 = result of internal_7 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_9 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 64($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 20($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 16($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 76($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_5 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function internal_10 + lw $t0, 28($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_8 = result of internal_10 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_11[0] = ' ' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_11 = " " + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_13 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 64($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 76($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_11 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_11 + + # Calling function internal_14 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_12 = result of internal_14 + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 60 + + jr $ra + + function_main_at_Main: + # Function parameters + # $ra = 1232($sp) + # self = 1228($sp) + + # Reserving space for local variables + addi $sp, $sp, -1228 + + # Allocating A + li $v0, 9 + lw $a0, type_A + syscall + la $t0, type_A # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 1224($sp) # internal_0 = address of allocated object A + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 1232($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_A + jal function___init___at_A + lw $ra, 4($sp) + sw $v1, 1232($sp) # internal_0 = result of function___init___at_A + addi $sp, $sp, 8 # Freeing space for arguments + + # Set attribute avar of self + lw $t0, 1228($sp) # $t0 = self + lw $t1, 1224($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8753942936052 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8753942936052 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8753942936052 + j object_set_attribute_8753942936052 + int_set_attribute_8753942936052: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_0 + j end_set_attribute_8753942936052 + bool_set_attribute_8753942936052: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_0 + j end_set_attribute_8753942936052 + object_set_attribute_8753942936052: + sw $t1, 12($t0) # self.avar = internal_0 + end_set_attribute_8753942936052: + + # Allocating NUll to internal_1 + sw $zero, 1220($sp) # internal_1 = 0 + + while_start_8753943038970: + + # Get attribute flag of self + lw $t0, 1228($sp) # Get the address of self + lw $t1, 20($t0) # Get the attribute 'flag' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8753942936384 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8753942936384 + j object_get_attribute_8753942936384 + int_get_attribute_8753942936384: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 1216($sp) # internal_2 = self.flag + j end_get_attribute_8753942936384 + bool_get_attribute_8753942936384: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 1216($sp) # internal_2 = self.flag + j end_get_attribute_8753942936384 + object_get_attribute_8753942936384: + sw $t1, 1216($sp) # internal_2 = self.flag + end_get_attribute_8753942936384: + + # If internal_2 then goto while_body_8753943038970 + lw $t0, 1216($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_body_8753943038970 + + # Jumping to while_end_8753943038970 + j while_end_8753943038970 + + while_body_8753943038970: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 16 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 16 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 110 + sb $t0, 8($v0) # internal_3[0] = 'n' + + addi $t0, $zero, 117 + sb $t0, 9($v0) # internal_3[1] = 'u' + + addi $t0, $zero, 109 + sb $t0, 10($v0) # internal_3[2] = 'm' + + addi $t0, $zero, 98 + sb $t0, 11($v0) # internal_3[3] = 'b' + + addi $t0, $zero, 101 + sb $t0, 12($v0) # internal_3[4] = 'e' + + addi $t0, $zero, 114 + sb $t0, 13($v0) # internal_3[5] = 'r' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_3[6] = ' ' + + sb $zero, 15($v0) # Null-terminator at the end of the string + + sw $v0, 1212($sp) # internal_3 = "number " + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 1204($sp) # internal_5 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 1228($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 1204($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 1200($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 1240($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_3 + lw $t0, 1224($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function internal_6 + lw $t0, 1212($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 1220($sp) # internal_4 = result of internal_6 + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute avar of self + lw $t0, 1228($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8753942936507 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8753942936507 + j object_get_attribute_8753942936507 + int_get_attribute_8753942936507: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 1196($sp) # internal_7 = self.avar + j end_get_attribute_8753942936507 + bool_get_attribute_8753942936507: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 1196($sp) # internal_7 = self.avar + j end_get_attribute_8753942936507 + object_get_attribute_8753942936507: + sw $t1, 1196($sp) # internal_7 = self.avar + end_get_attribute_8753942936507: + + # Allocating Int 13 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 13 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 1188($sp) # internal_9 = address of allocated object Int + + # Get method print of Main + lw $t0, 1228($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 1188($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 1184($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 1240($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_7 + lw $t0, 1208($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function internal_10 + lw $t0, 1196($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 1204($sp) # internal_8 = result of internal_10 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 1176($sp) # internal_12 = address of allocated object Int + + # Get attribute avar of self + lw $t0, 1228($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8753942937131 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8753942937131 + j object_get_attribute_8753942937131 + int_get_attribute_8753942937131: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 1172($sp) # internal_13 = self.avar + j end_get_attribute_8753942937131 + bool_get_attribute_8753942937131: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 1172($sp) # internal_13 = self.avar + j end_get_attribute_8753942937131 + object_get_attribute_8753942937131: + sw $t1, 1172($sp) # internal_13 = self.avar + end_get_attribute_8753942937131: + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 1164($sp) # internal_15 = address of allocated object Int + + # Get method value of A + lw $t0, 1172($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 1164($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 1160($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_13 + lw $t0, 1180($sp) + sw $t0, 0($sp) # Storing internal_13 + + # Calling function internal_16 + lw $t0, 1168($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 1176($sp) # internal_14 = result of internal_16 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 11 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 11 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 1152($sp) # internal_18 = address of allocated object Int + + # Get method is_even of Main + lw $t0, 1228($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 1152($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 1148($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 1240($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_14 + lw $t0, 1180($sp) + sw $t0, 0($sp) # Storing internal_14 + + # Calling function internal_19 + lw $t0, 1160($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 1168($sp) # internal_17 = result of internal_19 + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_12 = internal_17 + lw $t0, 1156($sp) + sw $t0, 1176($sp) + + # If internal_12 then goto then_8753943036552 + lw $t0, 1176($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8753943036552 + + # Jumping to else_8753943036552 + j else_8753943036552 + + then_8753943036552: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 18 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 18 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 105 + sb $t0, 8($v0) # internal_20[0] = 'i' + + addi $t0, $zero, 115 + sb $t0, 9($v0) # internal_20[1] = 's' + + addi $t0, $zero, 32 + sb $t0, 10($v0) # internal_20[2] = ' ' + + addi $t0, $zero, 101 + sb $t0, 11($v0) # internal_20[3] = 'e' + + addi $t0, $zero, 118 + sb $t0, 12($v0) # internal_20[4] = 'v' + + addi $t0, $zero, 101 + sb $t0, 13($v0) # internal_20[5] = 'e' + + addi $t0, $zero, 110 + sb $t0, 14($v0) # internal_20[6] = 'n' + + addi $t0, $zero, 33 + sb $t0, 15($v0) # internal_20[7] = '!' + + addi $t0, $zero, 10 + sb $t0, 16($v0) # internal_20[8] = '\n' + + sb $zero, 17($v0) # Null-terminator at the end of the string + + sw $v0, 1144($sp) # internal_20 = "is even!\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 1136($sp) # internal_22 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 1228($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 1136($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 1132($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 1240($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_20 + lw $t0, 1156($sp) + sw $t0, 0($sp) # Storing internal_20 + + # Calling function internal_23 + lw $t0, 1144($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 1152($sp) # internal_21 = result of internal_23 + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_11 = internal_21 + lw $t0, 1140($sp) + sw $t0, 1180($sp) + + # Jumping to endif_8753943036552 + j endif_8753943036552 + + else_8753943036552: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 17 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 17 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 105 + sb $t0, 8($v0) # internal_24[0] = 'i' + + addi $t0, $zero, 115 + sb $t0, 9($v0) # internal_24[1] = 's' + + addi $t0, $zero, 32 + sb $t0, 10($v0) # internal_24[2] = ' ' + + addi $t0, $zero, 111 + sb $t0, 11($v0) # internal_24[3] = 'o' + + addi $t0, $zero, 100 + sb $t0, 12($v0) # internal_24[4] = 'd' + + addi $t0, $zero, 100 + sb $t0, 13($v0) # internal_24[5] = 'd' + + addi $t0, $zero, 33 + sb $t0, 14($v0) # internal_24[6] = '!' + + addi $t0, $zero, 10 + sb $t0, 15($v0) # internal_24[7] = '\n' + + sb $zero, 16($v0) # Null-terminator at the end of the string + + sw $v0, 1128($sp) # internal_24 = "is odd!\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 1120($sp) # internal_26 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 1228($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 1120($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 1116($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 1240($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_24 + lw $t0, 1140($sp) + sw $t0, 0($sp) # Storing internal_24 + + # Calling function internal_27 + lw $t0, 1128($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 1136($sp) # internal_25 = result of internal_27 + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_11 = internal_25 + lw $t0, 1124($sp) + sw $t0, 1180($sp) + + # Jumping to endif_8753943036552 + j endif_8753943036552 + + endif_8753943036552: + + # Get attribute avar of self + lw $t0, 1228($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8753942937658 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8753942937658 + j object_get_attribute_8753942937658 + int_get_attribute_8753942937658: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 1112($sp) # internal_28 = self.avar + j end_get_attribute_8753942937658 + bool_get_attribute_8753942937658: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 1112($sp) # internal_28 = self.avar + j end_get_attribute_8753942937658 + object_get_attribute_8753942937658: + sw $t1, 1112($sp) # internal_28 = self.avar + end_get_attribute_8753942937658: + + # Allocating Int 12 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 12 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 1104($sp) # internal_30 = address of allocated object Int + + # Get method class_type of Main + lw $t0, 1228($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 1104($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 1100($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 1240($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_28 + lw $t0, 1124($sp) + sw $t0, 0($sp) # Storing internal_28 + + # Calling function internal_31 + lw $t0, 1112($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 1120($sp) # internal_29 = result of internal_31 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 1092($sp) # internal_33 = address of allocated object Int + + # Get method menu of Main + lw $t0, 1228($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 1092($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 1088($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 1236($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_34 + lw $t0, 1096($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 1104($sp) # internal_32 = result of internal_34 + addi $sp, $sp, 8 # Freeing space for arguments + + # Set attribute char of self + lw $t0, 1228($sp) # $t0 = self + lw $t1, 1096($sp) # $t1 = internal_32 + beq $t1, $zero, object_set_attribute_8753942937703 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8753942937703 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8753942937703 + j object_set_attribute_8753942937703 + int_set_attribute_8753942937703: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.char = internal_32 + j end_set_attribute_8753942937703 + bool_set_attribute_8753942937703: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.char = internal_32 + j end_set_attribute_8753942937703 + object_set_attribute_8753942937703: + sw $t1, 8($t0) # self.char = internal_32 + end_set_attribute_8753942937703: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 1080($sp) # internal_36 = address of allocated object Int + + # Get attribute char of self + lw $t0, 1228($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'char' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8753942937802 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8753942937802 + j object_get_attribute_8753942937802 + int_get_attribute_8753942937802: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 1076($sp) # internal_37 = self.char + j end_get_attribute_8753942937802 + bool_get_attribute_8753942937802: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 1076($sp) # internal_37 = self.char + j end_get_attribute_8753942937802 + object_get_attribute_8753942937802: + sw $t1, 1076($sp) # internal_37 = self.char + end_get_attribute_8753942937802: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 97 + sb $t0, 8($v0) # internal_38[0] = 'a' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 1072($sp) # internal_38 = "a" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_37 + lw $t0, 1088($sp) + sw $t0, 4($sp) # Storing internal_37 + + # Argument internal_38 + lw $t0, 1084($sp) + sw $t0, 0($sp) # Storing internal_38 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 1080($sp) # internal_39 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_36 = internal_39 + lw $t0, 1068($sp) + sw $t0, 1080($sp) + + # If internal_36 then goto then_8753943038955 + lw $t0, 1080($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8753943038955 + + # Jumping to else_8753943038955 + j else_8753943038955 + + then_8753943038955: + + # Allocating A + li $v0, 9 + lw $a0, type_A + syscall + la $t0, type_A # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 1064($sp) # internal_40 = address of allocated object A + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_40 + lw $t0, 1072($sp) + sw $t0, 0($sp) # Storing internal_40 + + # Calling function function___init___at_A + jal function___init___at_A + lw $ra, 4($sp) + sw $v1, 1072($sp) # internal_40 = result of function___init___at_A + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 10 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 10 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 1056($sp) # internal_42 = address of allocated object Int + + # Get method get_int of Main + lw $t0, 1228($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 1056($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 1052($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 1236($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_43 + lw $t0, 1060($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 1068($sp) # internal_41 = result of internal_43 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 1044($sp) # internal_45 = address of allocated object Int + + # Get method set_var of A + lw $t0, 1064($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 1044($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 1040($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_40 + lw $t0, 1076($sp) + sw $t0, 4($sp) # Storing internal_40 + + # Argument internal_41 + lw $t0, 1072($sp) + sw $t0, 0($sp) # Storing internal_41 + + # Calling function internal_46 + lw $t0, 1052($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 1060($sp) # internal_44 = result of internal_46 + addi $sp, $sp, 12 # Freeing space for arguments + + # Set attribute a_var of self + lw $t0, 1228($sp) # $t0 = self + lw $t1, 1048($sp) # $t1 = internal_44 + beq $t1, $zero, object_set_attribute_8753942938143 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8753942938143 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8753942938143 + j object_set_attribute_8753942938143 + int_set_attribute_8753942938143: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.a_var = internal_44 + j end_set_attribute_8753942938143 + bool_set_attribute_8753942938143: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.a_var = internal_44 + j end_set_attribute_8753942938143 + object_set_attribute_8753942938143: + sw $t1, 16($t0) # self.a_var = internal_44 + end_set_attribute_8753942938143: + + # Allocating B + li $v0, 9 + lw $a0, type_B + syscall + la $t0, type_B # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 1036($sp) # internal_47 = address of allocated object B + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_47 + lw $t0, 1044($sp) + sw $t0, 0($sp) # Storing internal_47 + + # Calling function function___init___at_B + jal function___init___at_B + lw $ra, 4($sp) + sw $v1, 1044($sp) # internal_47 = result of function___init___at_B + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute avar of self + lw $t0, 1228($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8753942938329 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8753942938329 + j object_get_attribute_8753942938329 + int_get_attribute_8753942938329: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 1032($sp) # internal_48 = self.avar + j end_get_attribute_8753942938329 + bool_get_attribute_8753942938329: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 1032($sp) # internal_48 = self.avar + j end_get_attribute_8753942938329 + object_get_attribute_8753942938329: + sw $t1, 1032($sp) # internal_48 = self.avar + end_get_attribute_8753942938329: + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 1024($sp) # internal_50 = address of allocated object Int + + # Get method value of A + lw $t0, 1032($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 1024($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 1020($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_48 + lw $t0, 1040($sp) + sw $t0, 0($sp) # Storing internal_48 + + # Calling function internal_51 + lw $t0, 1028($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 1036($sp) # internal_49 = result of internal_51 + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute a_var of self + lw $t0, 1228($sp) # Get the address of self + lw $t1, 16($t0) # Get the attribute 'a_var' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8753942938643 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8753942938643 + j object_get_attribute_8753942938643 + int_get_attribute_8753942938643: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 1016($sp) # internal_52 = self.a_var + j end_get_attribute_8753942938643 + bool_get_attribute_8753942938643: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 1016($sp) # internal_52 = self.a_var + j end_get_attribute_8753942938643 + object_get_attribute_8753942938643: + sw $t1, 1016($sp) # internal_52 = self.a_var + end_get_attribute_8753942938643: + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 1008($sp) # internal_54 = address of allocated object Int + + # Get method value of A + lw $t0, 1016($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 1008($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 1004($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_52 + lw $t0, 1024($sp) + sw $t0, 0($sp) # Storing internal_52 + + # Calling function internal_55 + lw $t0, 1012($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 1020($sp) # internal_53 = result of internal_55 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 7 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 7 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 996($sp) # internal_57 = address of allocated object Int + + # Get method method2 of B + lw $t0, 1036($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 996($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 992($sp) + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument internal_47 + lw $t0, 1052($sp) + sw $t0, 8($sp) # Storing internal_47 + + # Argument internal_49 + lw $t0, 1044($sp) + sw $t0, 4($sp) # Storing internal_49 + + # Argument internal_53 + lw $t0, 1028($sp) + sw $t0, 0($sp) # Storing internal_53 + + # Calling function internal_58 + lw $t0, 1008($sp) + jalr $t0 + lw $ra, 12($sp) + sw $v1, 1016($sp) # internal_56 = result of internal_58 + addi $sp, $sp, 16 # Freeing space for arguments + + # Set attribute avar of self + lw $t0, 1228($sp) # $t0 = self + lw $t1, 1000($sp) # $t1 = internal_56 + beq $t1, $zero, object_set_attribute_8753942938266 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8753942938266 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8753942938266 + j object_set_attribute_8753942938266 + int_set_attribute_8753942938266: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_56 + j end_set_attribute_8753942938266 + bool_set_attribute_8753942938266: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_56 + j end_set_attribute_8753942938266 + object_set_attribute_8753942938266: + sw $t1, 12($t0) # self.avar = internal_56 + end_set_attribute_8753942938266: + + # internal_35 = internal_56 + lw $t0, 1000($sp) + sw $t0, 1084($sp) + + # Jumping to endif_8753943038955 + j endif_8753943038955 + + else_8753943038955: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 984($sp) # internal_60 = address of allocated object Int + + # Get attribute char of self + lw $t0, 1228($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'char' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8753942938775 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8753942938775 + j object_get_attribute_8753942938775 + int_get_attribute_8753942938775: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 980($sp) # internal_61 = self.char + j end_get_attribute_8753942938775 + bool_get_attribute_8753942938775: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 980($sp) # internal_61 = self.char + j end_get_attribute_8753942938775 + object_get_attribute_8753942938775: + sw $t1, 980($sp) # internal_61 = self.char + end_get_attribute_8753942938775: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 98 + sb $t0, 8($v0) # internal_62[0] = 'b' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 976($sp) # internal_62 = "b" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_61 + lw $t0, 992($sp) + sw $t0, 4($sp) # Storing internal_61 + + # Argument internal_62 + lw $t0, 988($sp) + sw $t0, 0($sp) # Storing internal_62 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 984($sp) # internal_63 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_60 = internal_63 + lw $t0, 972($sp) + sw $t0, 984($sp) + + # If internal_60 then goto then_8753943038949 + lw $t0, 984($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8753943038949 + + # Jumping to else_8753943038949 + j else_8753943038949 + + then_8753943038949: + + # Get attribute avar of self + lw $t0, 1228($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8753942938856 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8753942938856 + j object_get_attribute_8753942938856 + int_get_attribute_8753942938856: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 968($sp) # internal_64 = self.avar + j end_get_attribute_8753942938856 + bool_get_attribute_8753942938856: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 968($sp) # internal_64 = self.avar + j end_get_attribute_8753942938856 + object_get_attribute_8753942938856: + sw $t1, 968($sp) # internal_64 = self.avar + end_get_attribute_8753942938856: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 964($sp) # internal_65 = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 960($sp) # internal_66 = address of allocated object Int + + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 956($sp) # internal_67 = address of allocated object Int + + # Allocating NUll to internal_68 + sw $zero, 952($sp) # internal_68 = 0 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 948($sp) # internal_69 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 936($sp) # internal_72 = address of allocated object Int + + # internal_70 = typeof internal_64 that is the first word of the object + lw $t0, 968($sp) + lw $t0, 0($t0) + sw $t0, 944($sp) + + # internal_71 = internal_70 + lw $t0, 944($sp) + sw $t0, 940($sp) + + while_start_8753943037525: + + # internal_72 = EqualAddress(internal_71, internal_68) + lw $t0, 940($sp) + lw $t1, 952($sp) + seq $t2, $t0, $t1 + lw $t0, 936($sp) + sw $t2, 8($t0) + + # If internal_72 then goto while_end_8753943037525 + lw $t0, 936($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_end_8753943037525 + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_69 + lw $t0, 960($sp) + sw $t0, 4($sp) # Storing internal_69 + + # Argument internal_66 + lw $t0, 972($sp) + sw $t0, 0($sp) # Storing internal_66 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 960($sp) # internal_69 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_71 = ancestor of internal_71 + lw $t0, 940($sp) + lw $t0, 4($t0) + sw $t0, 940($sp) + + # Jumping to while_start_8753943037525 + j while_start_8753943037525 + + while_end_8753943037525: + + # internal_71 = internal_70 + lw $t0, 944($sp) + sw $t0, 940($sp) + + # initialize Array [internal_69] + lw $t0, 948($sp) # $t0 = internal_69 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 932($sp) # internal_73 = new Array[internal_69] + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 928($sp) # internal_74 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 924($sp) # internal_75 = address of allocated object Int + + foreach_start_8753943037525: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_74 + lw $t0, 940($sp) + sw $t0, 4($sp) # Storing internal_74 + + # Argument internal_69 + lw $t0, 960($sp) + sw $t0, 0($sp) # Storing internal_69 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 936($sp) # internal_75 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_75 then goto foreach_body_8753943037525 + lw $t0, 924($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_body_8753943037525 + + # Jumping to foreach_end_8753943037525 + j foreach_end_8753943037525 + + foreach_body_8753943037525: + + # array internal_73[4 * internal_74] = internal_71 + lw $t0, 928($sp) # $t0 = internal_74 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 932($sp) # $t1 = internal_73 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 940($sp) + sw $t0, 0($t1) + + # internal_71 = ancestor of internal_71 + lw $t0, 940($sp) + lw $t0, 4($t0) + sw $t0, 940($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_74 + lw $t0, 940($sp) + sw $t0, 4($sp) # Storing internal_74 + + # Argument internal_66 + lw $t0, 972($sp) + sw $t0, 0($sp) # Storing internal_66 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 940($sp) # internal_74 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_start_8753943037525 + j foreach_start_8753943037525 + + foreach_end_8753943037525: + + # initialize Array [internal_67] + lw $t0, 956($sp) # $t0 = internal_67 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 920($sp) # internal_76 = new Array[internal_67] + + # initialize Array [internal_67] + lw $t0, 956($sp) # $t0 = internal_67 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 916($sp) # internal_77 = new Array[internal_67] + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 908($sp) # internal_79 = address of allocated object Int + + # internal_78 = direction of C + la $t0, type_C + sw $t0, 912($sp) + + # array internal_76[4 * internal_79] = internal_78 + lw $t0, 908($sp) # $t0 = internal_79 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 920($sp) # $t1 = internal_76 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 912($sp) + sw $t0, 0($t1) + + # array internal_77[4 * internal_79] = internal_69 + lw $t0, 908($sp) # $t0 = internal_79 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 916($sp) # $t1 = internal_77 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 948($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 900($sp) # internal_81 = address of allocated object Int + + # internal_80 = direction of A + la $t0, type_A + sw $t0, 904($sp) + + # array internal_76[4 * internal_81] = internal_80 + lw $t0, 900($sp) # $t0 = internal_81 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 920($sp) # $t1 = internal_76 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 904($sp) + sw $t0, 0($t1) + + # array internal_77[4 * internal_81] = internal_69 + lw $t0, 900($sp) # $t0 = internal_81 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 916($sp) # $t1 = internal_77 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 948($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 892($sp) # internal_83 = address of allocated object Int + + # internal_82 = direction of Object + la $t0, type_Object + sw $t0, 896($sp) + + # array internal_76[4 * internal_83] = internal_82 + lw $t0, 892($sp) # $t0 = internal_83 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 920($sp) # $t1 = internal_76 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 896($sp) + sw $t0, 0($t1) + + # array internal_77[4 * internal_83] = internal_69 + lw $t0, 892($sp) # $t0 = internal_83 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 916($sp) # $t1 = internal_77 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 948($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 888($sp) # internal_84 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 884($sp) # internal_85 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 876($sp) # internal_87 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 872($sp) # internal_88 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 864($sp) # internal_90 = address of allocated object Int + + foreach_type_start_8753943037525: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_84 + lw $t0, 900($sp) + sw $t0, 4($sp) # Storing internal_84 + + # Argument internal_67 + lw $t0, 968($sp) + sw $t0, 0($sp) # Storing internal_67 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 896($sp) # internal_85 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_85 then goto foreach_type_body_8753943037525 + lw $t0, 884($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_type_body_8753943037525 + + # Jumping to foreach_type_end_8753943037525 + j foreach_type_end_8753943037525 + + foreach_type_body_8753943037525: + + # internal_86 = array internal_76[4 * internal_84] + lw $t0, 888($sp) # $t0 = internal_84 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 920($sp) # $t1 = internal_76 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + sw $t0, 880($sp) # internal_86 = array internal_76[4 * internal_84] + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_87 + lw $t0, 888($sp) + sw $t0, 4($sp) # Storing internal_87 + + # Argument internal_65 + lw $t0, 976($sp) + sw $t0, 0($sp) # Storing internal_65 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 888($sp) # internal_87 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + foreach_ancestor_start_8753943037525: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_87 + lw $t0, 888($sp) + sw $t0, 4($sp) # Storing internal_87 + + # Argument internal_69 + lw $t0, 960($sp) + sw $t0, 0($sp) # Storing internal_69 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 884($sp) # internal_88 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_88 then goto foreach_ancestor_body_8753943037525 + lw $t0, 872($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_body_8753943037525 + + # Jumping to foreach_ancestor_end_8753943037525 + j foreach_ancestor_end_8753943037525 + + foreach_ancestor_body_8753943037525: + + # internal_89 = array internal_73[4 * internal_87] + lw $t0, 876($sp) # $t0 = internal_87 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 932($sp) # $t1 = internal_73 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + sw $t0, 868($sp) # internal_89 = array internal_73[4 * internal_87] + + # internal_90 = EqualAddress(internal_86, internal_89) + lw $t0, 880($sp) + lw $t1, 868($sp) + seq $t2, $t0, $t1 + lw $t0, 864($sp) + sw $t2, 8($t0) + + # If internal_90 then goto foreach_ancestor_end_8753943037525 + lw $t0, 864($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_end_8753943037525 + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_87 + lw $t0, 888($sp) + sw $t0, 4($sp) # Storing internal_87 + + # Argument internal_66 + lw $t0, 972($sp) + sw $t0, 0($sp) # Storing internal_66 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 888($sp) # internal_87 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_ancestor_start_8753943037525 + j foreach_ancestor_start_8753943037525 + + foreach_ancestor_end_8753943037525: + + # array internal_77[4 * internal_84] = internal_87 + lw $t0, 888($sp) # $t0 = internal_84 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 916($sp) # $t1 = internal_77 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 876($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_84 + lw $t0, 900($sp) + sw $t0, 4($sp) # Storing internal_84 + + # Argument internal_66 + lw $t0, 972($sp) + sw $t0, 0($sp) # Storing internal_66 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 900($sp) # internal_84 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_type_start_8753943037525 + j foreach_type_start_8753943037525 + + foreach_type_end_8753943037525: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 860($sp) # internal_91 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 856($sp) # internal_92 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 852($sp) # internal_93 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 848($sp) # internal_94 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 844($sp) # internal_95 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_94 + lw $t0, 860($sp) + sw $t0, 4($sp) # Storing internal_94 + + # Argument internal_69 + lw $t0, 960($sp) + sw $t0, 0($sp) # Storing internal_69 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 860($sp) # internal_94 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + foreach_min_start_8753943037525: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_91 + lw $t0, 872($sp) + sw $t0, 4($sp) # Storing internal_91 + + # Argument internal_67 + lw $t0, 968($sp) + sw $t0, 0($sp) # Storing internal_67 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 856($sp) # internal_95 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_95 then goto foreach_min_body_8753943037525 + lw $t0, 844($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_min_body_8753943037525 + + # Jumping to foreach_min_end_8753943037525 + j foreach_min_end_8753943037525 + + foreach_min_body_8753943037525: + + # internal_93 = array internal_77[4 * internal_91] + lw $t0, 860($sp) # $t0 = internal_91 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 916($sp) # $t1 = internal_77 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 852($sp) # internal_93 = array internal_77[4 * internal_91] + sw $t0, 8($t2) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_93 + lw $t0, 864($sp) + sw $t0, 4($sp) # Storing internal_93 + + # Argument internal_94 + lw $t0, 860($sp) + sw $t0, 0($sp) # Storing internal_94 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 856($sp) # internal_95 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_95 then goto update_min_8753943037525 + lw $t0, 844($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, update_min_8753943037525 + + # Jumping to update_min_end_8753943037525 + j update_min_end_8753943037525 + + update_min_8753943037525: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_94 + lw $t0, 860($sp) + sw $t0, 4($sp) # Storing internal_94 + + # Argument internal_93 + lw $t0, 864($sp) + sw $t0, 0($sp) # Storing internal_93 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 860($sp) # internal_94 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_92 + lw $t0, 868($sp) + sw $t0, 4($sp) # Storing internal_92 + + # Argument internal_91 + lw $t0, 872($sp) + sw $t0, 0($sp) # Storing internal_91 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 868($sp) # internal_92 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + update_min_end_8753943037525: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_91 + lw $t0, 872($sp) + sw $t0, 4($sp) # Storing internal_91 + + # Argument internal_66 + lw $t0, 972($sp) + sw $t0, 0($sp) # Storing internal_66 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 872($sp) # internal_91 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_min_start_8753943037525 + j foreach_min_start_8753943037525 + + foreach_min_end_8753943037525: + + # initialize Array [internal_67] + lw $t0, 956($sp) # $t0 = internal_67 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 840($sp) # internal_96 = new Array[internal_67] + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 836($sp) # internal_97 = address of allocated object Int + + # array internal_96[4 * internal_97] = internal_65 + lw $t0, 836($sp) # $t0 = internal_97 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 840($sp) # $t1 = internal_96 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 964($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 832($sp) # internal_98 = address of allocated object Int + + # array internal_96[4 * internal_98] = internal_65 + lw $t0, 832($sp) # $t0 = internal_98 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 840($sp) # $t1 = internal_96 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 964($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 828($sp) # internal_99 = address of allocated object Int + + # array internal_96[4 * internal_99] = internal_65 + lw $t0, 828($sp) # $t0 = internal_99 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 840($sp) # $t1 = internal_96 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 964($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 824($sp) # internal_100 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_94 + lw $t0, 860($sp) + sw $t0, 4($sp) # Storing internal_94 + + # Argument internal_69 + lw $t0, 960($sp) + sw $t0, 0($sp) # Storing internal_69 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 836($sp) # internal_100 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_100 then goto error_branch_8753943037525 + lw $t0, 824($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, error_branch_8753943037525 + + # array internal_96[4 * internal_92] = internal_66 + lw $t0, 856($sp) # $t0 = internal_92 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 840($sp) # $t1 = internal_96 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 960($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 820($sp) # internal_101 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 816($sp) # internal_102 = address of allocated object Int + + # internal_101 = array internal_96[4 * internal_102] + lw $t0, 816($sp) # $t0 = internal_102 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 840($sp) # $t1 = internal_96 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 820($sp) # internal_101 = array internal_96[4 * internal_102] + sw $t0, 8($t2) + + # If internal_101 then goto branch_C_8753943037525 + lw $t0, 820($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_C_8753943037525 + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 812($sp) # internal_103 = address of allocated object Int + + # internal_101 = array internal_96[4 * internal_103] + lw $t0, 812($sp) # $t0 = internal_103 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 840($sp) # $t1 = internal_96 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 820($sp) # internal_101 = array internal_96[4 * internal_103] + sw $t0, 8($t2) + + # If internal_101 then goto branch_A_8753943037525 + lw $t0, 820($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_A_8753943037525 + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 808($sp) # internal_104 = address of allocated object Int + + # internal_101 = array internal_96[4 * internal_104] + lw $t0, 808($sp) # $t0 = internal_104 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 840($sp) # $t1 = internal_96 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 820($sp) # internal_101 = array internal_96[4 * internal_104] + sw $t0, 8($t2) + + # If internal_101 then goto branch_Object_8753943037525 + lw $t0, 820($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Object_8753943037525 + + branch_C_8753943037525: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument c + lw $t0, 812($sp) + sw $t0, 4($sp) # Storing c + + # Argument internal_64 + lw $t0, 980($sp) + sw $t0, 0($sp) # Storing internal_64 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 812($sp) # c = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 792($sp) # internal_108 = address of allocated object Int + + # Get method value of C + lw $t0, 800($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 792($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 788($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument c + lw $t0, 808($sp) + sw $t0, 0($sp) # Storing c + + # Calling function internal_109 + lw $t0, 796($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 804($sp) # internal_107 = result of internal_109 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 11 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 11 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 780($sp) # internal_111 = address of allocated object Int + + # Get method method6 of C + lw $t0, 800($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 780($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 776($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument c + lw $t0, 812($sp) + sw $t0, 4($sp) # Storing c + + # Argument internal_107 + lw $t0, 808($sp) + sw $t0, 0($sp) # Storing internal_107 + + # Calling function internal_112 + lw $t0, 788($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 796($sp) # internal_110 = result of internal_112 + addi $sp, $sp, 12 # Freeing space for arguments + + # Set attribute avar of self + lw $t0, 1228($sp) # $t0 = self + lw $t1, 784($sp) # $t1 = internal_110 + beq $t1, $zero, object_set_attribute_8753942994969 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8753942994969 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8753942994969 + j object_set_attribute_8753942994969 + int_set_attribute_8753942994969: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_110 + j end_set_attribute_8753942994969 + bool_set_attribute_8753942994969: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_110 + j end_set_attribute_8753942994969 + object_set_attribute_8753942994969: + sw $t1, 12($t0) # self.avar = internal_110 + end_set_attribute_8753942994969: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_105 + lw $t0, 816($sp) + sw $t0, 4($sp) # Storing internal_105 + + # Argument internal_110 + lw $t0, 796($sp) + sw $t0, 0($sp) # Storing internal_110 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 816($sp) # internal_105 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_105 = internal_110 + lw $t0, 784($sp) + sw $t0, 804($sp) + + # Jumping to branch_end_8753943037525 + j branch_end_8753943037525 + + branch_A_8753943037525: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument a + lw $t0, 784($sp) + sw $t0, 4($sp) # Storing a + + # Argument internal_64 + lw $t0, 980($sp) + sw $t0, 0($sp) # Storing internal_64 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 784($sp) # a = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 764($sp) # internal_115 = address of allocated object Int + + # Get method value of A + lw $t0, 772($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 764($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 760($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument a + lw $t0, 780($sp) + sw $t0, 0($sp) # Storing a + + # Calling function internal_116 + lw $t0, 768($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 776($sp) # internal_114 = result of internal_116 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 752($sp) # internal_118 = address of allocated object Int + + # Get method method3 of A + lw $t0, 772($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 752($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 748($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument a + lw $t0, 784($sp) + sw $t0, 4($sp) # Storing a + + # Argument internal_114 + lw $t0, 780($sp) + sw $t0, 0($sp) # Storing internal_114 + + # Calling function internal_119 + lw $t0, 760($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 768($sp) # internal_117 = result of internal_119 + addi $sp, $sp, 12 # Freeing space for arguments + + # Set attribute avar of self + lw $t0, 1228($sp) # $t0 = self + lw $t1, 756($sp) # $t1 = internal_117 + beq $t1, $zero, object_set_attribute_8753942994213 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8753942994213 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8753942994213 + j object_set_attribute_8753942994213 + int_set_attribute_8753942994213: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_117 + j end_set_attribute_8753942994213 + bool_set_attribute_8753942994213: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_117 + j end_set_attribute_8753942994213 + object_set_attribute_8753942994213: + sw $t1, 12($t0) # self.avar = internal_117 + end_set_attribute_8753942994213: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_105 + lw $t0, 816($sp) + sw $t0, 4($sp) # Storing internal_105 + + # Argument internal_117 + lw $t0, 768($sp) + sw $t0, 0($sp) # Storing internal_117 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 816($sp) # internal_105 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_105 = internal_117 + lw $t0, 756($sp) + sw $t0, 804($sp) + + # Jumping to branch_end_8753943037525 + j branch_end_8753943037525 + + branch_Object_8753943037525: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument o + lw $t0, 756($sp) + sw $t0, 4($sp) # Storing o + + # Argument internal_64 + lw $t0, 980($sp) + sw $t0, 0($sp) # Storing internal_64 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 756($sp) # o = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 16 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 16 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 79 + sb $t0, 8($v0) # internal_121[0] = 'O' + + addi $t0, $zero, 111 + sb $t0, 9($v0) # internal_121[1] = 'o' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_121[2] = 'o' + + addi $t0, $zero, 111 + sb $t0, 11($v0) # internal_121[3] = 'o' + + addi $t0, $zero, 112 + sb $t0, 12($v0) # internal_121[4] = 'p' + + addi $t0, $zero, 115 + sb $t0, 13($v0) # internal_121[5] = 's' + + addi $t0, $zero, 10 + sb $t0, 14($v0) # internal_121[6] = '\n' + + sb $zero, 15($v0) # Null-terminator at the end of the string + + sw $v0, 740($sp) # internal_121 = "Oooops\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 732($sp) # internal_123 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 1228($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 732($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 728($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 1240($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_121 + lw $t0, 752($sp) + sw $t0, 0($sp) # Storing internal_121 + + # Calling function internal_124 + lw $t0, 740($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 748($sp) # internal_122 = result of internal_124 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 720($sp) # internal_126 = address of allocated object Int + + # Get method abort of Main + lw $t0, 1228($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 720($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 716($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 1236($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_127 + lw $t0, 724($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 732($sp) # internal_125 = result of internal_127 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 712($sp) # internal_128 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_105 + lw $t0, 816($sp) + sw $t0, 4($sp) # Storing internal_105 + + # Argument internal_128 + lw $t0, 724($sp) + sw $t0, 0($sp) # Storing internal_128 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 816($sp) # internal_105 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_105 = internal_128 + lw $t0, 712($sp) + sw $t0, 804($sp) + + # Jumping to branch_end_8753943037525 + j branch_end_8753943037525 + + error_branch_8753943037525: + + branch_end_8753943037525: + + # internal_59 = internal_105 + lw $t0, 804($sp) + sw $t0, 988($sp) + + # Jumping to endif_8753943038949 + j endif_8753943038949 + + else_8753943038949: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 704($sp) # internal_130 = address of allocated object Int + + # Get attribute char of self + lw $t0, 1228($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'char' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8753942990818 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8753942990818 + j object_get_attribute_8753942990818 + int_get_attribute_8753942990818: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 700($sp) # internal_131 = self.char + j end_get_attribute_8753942990818 + bool_get_attribute_8753942990818: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 700($sp) # internal_131 = self.char + j end_get_attribute_8753942990818 + object_get_attribute_8753942990818: + sw $t1, 700($sp) # internal_131 = self.char + end_get_attribute_8753942990818: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 99 + sb $t0, 8($v0) # internal_132[0] = 'c' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 696($sp) # internal_132 = "c" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_131 + lw $t0, 712($sp) + sw $t0, 4($sp) # Storing internal_131 + + # Argument internal_132 + lw $t0, 708($sp) + sw $t0, 0($sp) # Storing internal_132 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 704($sp) # internal_133 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_130 = internal_133 + lw $t0, 692($sp) + sw $t0, 704($sp) + + # If internal_130 then goto then_8753943038943 + lw $t0, 704($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8753943038943 + + # Jumping to else_8753943038943 + j else_8753943038943 + + then_8753943038943: + + # Allocating A + li $v0, 9 + lw $a0, type_A + syscall + la $t0, type_A # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 688($sp) # internal_134 = address of allocated object A + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_134 + lw $t0, 696($sp) + sw $t0, 0($sp) # Storing internal_134 + + # Calling function function___init___at_A + jal function___init___at_A + lw $ra, 4($sp) + sw $v1, 696($sp) # internal_134 = result of function___init___at_A + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 10 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 10 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 680($sp) # internal_136 = address of allocated object Int + + # Get method get_int of Main + lw $t0, 1228($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 680($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 676($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 1236($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_137 + lw $t0, 684($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 692($sp) # internal_135 = result of internal_137 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 668($sp) # internal_139 = address of allocated object Int + + # Get method set_var of A + lw $t0, 688($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 668($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 664($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_134 + lw $t0, 700($sp) + sw $t0, 4($sp) # Storing internal_134 + + # Argument internal_135 + lw $t0, 696($sp) + sw $t0, 0($sp) # Storing internal_135 + + # Calling function internal_140 + lw $t0, 676($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 684($sp) # internal_138 = result of internal_140 + addi $sp, $sp, 12 # Freeing space for arguments + + # Set attribute a_var of self + lw $t0, 1228($sp) # $t0 = self + lw $t1, 672($sp) # $t1 = internal_138 + beq $t1, $zero, object_set_attribute_8753942990599 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8753942990599 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8753942990599 + j object_set_attribute_8753942990599 + int_set_attribute_8753942990599: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.a_var = internal_138 + j end_set_attribute_8753942990599 + bool_set_attribute_8753942990599: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.a_var = internal_138 + j end_set_attribute_8753942990599 + object_set_attribute_8753942990599: + sw $t1, 16($t0) # self.a_var = internal_138 + end_set_attribute_8753942990599: + + # Allocating D + li $v0, 9 + lw $a0, type_D + syscall + la $t0, type_D # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 660($sp) # internal_141 = address of allocated object D + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_141 + lw $t0, 668($sp) + sw $t0, 0($sp) # Storing internal_141 + + # Calling function function___init___at_D + jal function___init___at_D + lw $ra, 4($sp) + sw $v1, 668($sp) # internal_141 = result of function___init___at_D + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute avar of self + lw $t0, 1228($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8753942992701 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8753942992701 + j object_get_attribute_8753942992701 + int_get_attribute_8753942992701: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 656($sp) # internal_142 = self.avar + j end_get_attribute_8753942992701 + bool_get_attribute_8753942992701: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 656($sp) # internal_142 = self.avar + j end_get_attribute_8753942992701 + object_get_attribute_8753942992701: + sw $t1, 656($sp) # internal_142 = self.avar + end_get_attribute_8753942992701: + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 648($sp) # internal_144 = address of allocated object Int + + # Get method value of A + lw $t0, 656($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 648($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 644($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_142 + lw $t0, 664($sp) + sw $t0, 0($sp) # Storing internal_142 + + # Calling function internal_145 + lw $t0, 652($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 660($sp) # internal_143 = result of internal_145 + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute a_var of self + lw $t0, 1228($sp) # Get the address of self + lw $t1, 16($t0) # Get the attribute 'a_var' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8753942993399 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8753942993399 + j object_get_attribute_8753942993399 + int_get_attribute_8753942993399: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 640($sp) # internal_146 = self.a_var + j end_get_attribute_8753942993399 + bool_get_attribute_8753942993399: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 640($sp) # internal_146 = self.a_var + j end_get_attribute_8753942993399 + object_get_attribute_8753942993399: + sw $t1, 640($sp) # internal_146 = self.a_var + end_get_attribute_8753942993399: + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 632($sp) # internal_148 = address of allocated object Int + + # Get method value of A + lw $t0, 640($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 632($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 628($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_146 + lw $t0, 648($sp) + sw $t0, 0($sp) # Storing internal_146 + + # Calling function internal_149 + lw $t0, 636($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 644($sp) # internal_147 = result of internal_149 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 620($sp) # internal_151 = address of allocated object Int + + # Get method method4 of D + lw $t0, 660($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 620($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 616($sp) + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument internal_141 + lw $t0, 676($sp) + sw $t0, 8($sp) # Storing internal_141 + + # Argument internal_143 + lw $t0, 668($sp) + sw $t0, 4($sp) # Storing internal_143 + + # Argument internal_147 + lw $t0, 652($sp) + sw $t0, 0($sp) # Storing internal_147 + + # Calling function internal_152 + lw $t0, 632($sp) + jalr $t0 + lw $ra, 12($sp) + sw $v1, 640($sp) # internal_150 = result of internal_152 + addi $sp, $sp, 16 # Freeing space for arguments + + # Set attribute avar of self + lw $t0, 1228($sp) # $t0 = self + lw $t1, 624($sp) # $t1 = internal_150 + beq $t1, $zero, object_set_attribute_8753942992740 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8753942992740 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8753942992740 + j object_set_attribute_8753942992740 + int_set_attribute_8753942992740: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_150 + j end_set_attribute_8753942992740 + bool_set_attribute_8753942992740: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_150 + j end_set_attribute_8753942992740 + object_set_attribute_8753942992740: + sw $t1, 12($t0) # self.avar = internal_150 + end_set_attribute_8753942992740: + + # internal_129 = internal_150 + lw $t0, 624($sp) + sw $t0, 708($sp) + + # Jumping to endif_8753943038943 + j endif_8753943038943 + + else_8753943038943: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 608($sp) # internal_154 = address of allocated object Int + + # Get attribute char of self + lw $t0, 1228($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'char' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8753942993252 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8753942993252 + j object_get_attribute_8753942993252 + int_get_attribute_8753942993252: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 604($sp) # internal_155 = self.char + j end_get_attribute_8753942993252 + bool_get_attribute_8753942993252: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 604($sp) # internal_155 = self.char + j end_get_attribute_8753942993252 + object_get_attribute_8753942993252: + sw $t1, 604($sp) # internal_155 = self.char + end_get_attribute_8753942993252: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 100 + sb $t0, 8($v0) # internal_156[0] = 'd' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 600($sp) # internal_156 = "d" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_155 + lw $t0, 616($sp) + sw $t0, 4($sp) # Storing internal_155 + + # Argument internal_156 + lw $t0, 612($sp) + sw $t0, 0($sp) # Storing internal_156 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 608($sp) # internal_157 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_154 = internal_157 + lw $t0, 596($sp) + sw $t0, 608($sp) + + # If internal_154 then goto then_8753943038937 + lw $t0, 608($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8753943038937 + + # Jumping to else_8753943038937 + j else_8753943038937 + + then_8753943038937: + + # Allocating C + li $v0, 9 + lw $a0, type_C + syscall + la $t0, type_C # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 592($sp) # internal_158 = address of allocated object C + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_158 + lw $t0, 600($sp) + sw $t0, 0($sp) # Storing internal_158 + + # Calling function function___init___at_C + jal function___init___at_C + lw $ra, 4($sp) + sw $v1, 600($sp) # internal_158 = result of function___init___at_C + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute avar of self + lw $t0, 1228($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8753942991276 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8753942991276 + j object_get_attribute_8753942991276 + int_get_attribute_8753942991276: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 588($sp) # internal_159 = self.avar + j end_get_attribute_8753942991276 + bool_get_attribute_8753942991276: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 588($sp) # internal_159 = self.avar + j end_get_attribute_8753942991276 + object_get_attribute_8753942991276: + sw $t1, 588($sp) # internal_159 = self.avar + end_get_attribute_8753942991276: + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 580($sp) # internal_161 = address of allocated object Int + + # Get method value of A + lw $t0, 588($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 580($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 576($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_159 + lw $t0, 596($sp) + sw $t0, 0($sp) # Storing internal_159 + + # Calling function internal_162 + lw $t0, 584($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 592($sp) # internal_160 = result of internal_162 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 10 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 10 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 568($sp) # internal_164 = address of allocated object Int + + # Get method method5 of A + lw $t0, 592($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 568($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 564($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_158 + lw $t0, 604($sp) + sw $t0, 4($sp) # Storing internal_158 + + # Argument internal_160 + lw $t0, 596($sp) + sw $t0, 0($sp) # Storing internal_160 + + # Calling function function_method5_at_A + jal function_method5_at_A + lw $ra, 8($sp) + sw $v1, 584($sp) # internal_163 = result of function_method5_at_A + addi $sp, $sp, 12 # Freeing space for arguments + + # Set attribute avar of self + lw $t0, 1228($sp) # $t0 = self + lw $t1, 572($sp) # $t1 = internal_163 + beq $t1, $zero, object_set_attribute_8753942991312 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8753942991312 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8753942991312 + j object_set_attribute_8753942991312 + int_set_attribute_8753942991312: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_163 + j end_set_attribute_8753942991312 + bool_set_attribute_8753942991312: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_163 + j end_set_attribute_8753942991312 + object_set_attribute_8753942991312: + sw $t1, 12($t0) # self.avar = internal_163 + end_set_attribute_8753942991312: + + # internal_153 = internal_163 + lw $t0, 572($sp) + sw $t0, 612($sp) + + # Jumping to endif_8753943038937 + j endif_8753943038937 + + else_8753943038937: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 556($sp) # internal_167 = address of allocated object Int + + # Get attribute char of self + lw $t0, 1228($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'char' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8753942990433 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8753942990433 + j object_get_attribute_8753942990433 + int_get_attribute_8753942990433: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 552($sp) # internal_168 = self.char + j end_get_attribute_8753942990433 + bool_get_attribute_8753942990433: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 552($sp) # internal_168 = self.char + j end_get_attribute_8753942990433 + object_get_attribute_8753942990433: + sw $t1, 552($sp) # internal_168 = self.char + end_get_attribute_8753942990433: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 101 + sb $t0, 8($v0) # internal_169[0] = 'e' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 548($sp) # internal_169 = "e" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_168 + lw $t0, 564($sp) + sw $t0, 4($sp) # Storing internal_168 + + # Argument internal_169 + lw $t0, 560($sp) + sw $t0, 0($sp) # Storing internal_169 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 556($sp) # internal_170 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_167 = internal_170 + lw $t0, 544($sp) + sw $t0, 556($sp) + + # If internal_167 then goto then_8753943038931 + lw $t0, 556($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8753943038931 + + # Jumping to else_8753943038931 + j else_8753943038931 + + then_8753943038931: + + # Allocating C + li $v0, 9 + lw $a0, type_C + syscall + la $t0, type_C # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 540($sp) # internal_171 = address of allocated object C + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_171 + lw $t0, 548($sp) + sw $t0, 0($sp) # Storing internal_171 + + # Calling function function___init___at_C + jal function___init___at_C + lw $ra, 4($sp) + sw $v1, 548($sp) # internal_171 = result of function___init___at_C + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute avar of self + lw $t0, 1228($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8753942942073 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8753942942073 + j object_get_attribute_8753942942073 + int_get_attribute_8753942942073: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 536($sp) # internal_172 = self.avar + j end_get_attribute_8753942942073 + bool_get_attribute_8753942942073: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 536($sp) # internal_172 = self.avar + j end_get_attribute_8753942942073 + object_get_attribute_8753942942073: + sw $t1, 536($sp) # internal_172 = self.avar + end_get_attribute_8753942942073: + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 528($sp) # internal_174 = address of allocated object Int + + # Get method value of A + lw $t0, 536($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 528($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 524($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_172 + lw $t0, 544($sp) + sw $t0, 0($sp) # Storing internal_172 + + # Calling function internal_175 + lw $t0, 532($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 540($sp) # internal_173 = result of internal_175 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 10 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 10 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 516($sp) # internal_177 = address of allocated object Int + + # Get method method5 of B + lw $t0, 540($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 516($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 512($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_171 + lw $t0, 552($sp) + sw $t0, 4($sp) # Storing internal_171 + + # Argument internal_173 + lw $t0, 544($sp) + sw $t0, 0($sp) # Storing internal_173 + + # Calling function function_method5_at_B + jal function_method5_at_B + lw $ra, 8($sp) + sw $v1, 532($sp) # internal_176 = result of function_method5_at_B + addi $sp, $sp, 12 # Freeing space for arguments + + # Set attribute avar of self + lw $t0, 1228($sp) # $t0 = self + lw $t1, 520($sp) # $t1 = internal_176 + beq $t1, $zero, object_set_attribute_8753942942010 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8753942942010 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8753942942010 + j object_set_attribute_8753942942010 + int_set_attribute_8753942942010: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_176 + j end_set_attribute_8753942942010 + bool_set_attribute_8753942942010: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_176 + j end_set_attribute_8753942942010 + object_set_attribute_8753942942010: + sw $t1, 12($t0) # self.avar = internal_176 + end_set_attribute_8753942942010: + + # internal_166 = internal_176 + lw $t0, 520($sp) + sw $t0, 560($sp) + + # Jumping to endif_8753943038931 + j endif_8753943038931 + + else_8753943038931: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 504($sp) # internal_180 = address of allocated object Int + + # Get attribute char of self + lw $t0, 1228($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'char' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8753942942218 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8753942942218 + j object_get_attribute_8753942942218 + int_get_attribute_8753942942218: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 500($sp) # internal_181 = self.char + j end_get_attribute_8753942942218 + bool_get_attribute_8753942942218: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 500($sp) # internal_181 = self.char + j end_get_attribute_8753942942218 + object_get_attribute_8753942942218: + sw $t1, 500($sp) # internal_181 = self.char + end_get_attribute_8753942942218: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 102 + sb $t0, 8($v0) # internal_182[0] = 'f' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 496($sp) # internal_182 = "f" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_181 + lw $t0, 512($sp) + sw $t0, 4($sp) # Storing internal_181 + + # Argument internal_182 + lw $t0, 508($sp) + sw $t0, 0($sp) # Storing internal_182 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 504($sp) # internal_183 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_180 = internal_183 + lw $t0, 492($sp) + sw $t0, 504($sp) + + # If internal_180 then goto then_8753943038925 + lw $t0, 504($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8753943038925 + + # Jumping to else_8753943038925 + j else_8753943038925 + + then_8753943038925: + + # Allocating C + li $v0, 9 + lw $a0, type_C + syscall + la $t0, type_C # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 488($sp) # internal_184 = address of allocated object C + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_184 + lw $t0, 496($sp) + sw $t0, 0($sp) # Storing internal_184 + + # Calling function function___init___at_C + jal function___init___at_C + lw $ra, 4($sp) + sw $v1, 496($sp) # internal_184 = result of function___init___at_C + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute avar of self + lw $t0, 1228($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8753942942347 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8753942942347 + j object_get_attribute_8753942942347 + int_get_attribute_8753942942347: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 484($sp) # internal_185 = self.avar + j end_get_attribute_8753942942347 + bool_get_attribute_8753942942347: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 484($sp) # internal_185 = self.avar + j end_get_attribute_8753942942347 + object_get_attribute_8753942942347: + sw $t1, 484($sp) # internal_185 = self.avar + end_get_attribute_8753942942347: + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 476($sp) # internal_187 = address of allocated object Int + + # Get method value of A + lw $t0, 484($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 476($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 472($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_185 + lw $t0, 492($sp) + sw $t0, 0($sp) # Storing internal_185 + + # Calling function internal_188 + lw $t0, 480($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 488($sp) # internal_186 = result of internal_188 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 10 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 10 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 464($sp) # internal_190 = address of allocated object Int + + # Get method method5 of C + lw $t0, 488($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 464($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 460($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_184 + lw $t0, 500($sp) + sw $t0, 4($sp) # Storing internal_184 + + # Argument internal_186 + lw $t0, 492($sp) + sw $t0, 0($sp) # Storing internal_186 + + # Calling function function_method5_at_C + jal function_method5_at_C + lw $ra, 8($sp) + sw $v1, 480($sp) # internal_189 = result of function_method5_at_C + addi $sp, $sp, 12 # Freeing space for arguments + + # Set attribute avar of self + lw $t0, 1228($sp) # $t0 = self + lw $t1, 468($sp) # $t1 = internal_189 + beq $t1, $zero, object_set_attribute_8753942942284 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8753942942284 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8753942942284 + j object_set_attribute_8753942942284 + int_set_attribute_8753942942284: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_189 + j end_set_attribute_8753942942284 + bool_set_attribute_8753942942284: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_189 + j end_set_attribute_8753942942284 + object_set_attribute_8753942942284: + sw $t1, 12($t0) # self.avar = internal_189 + end_set_attribute_8753942942284: + + # internal_179 = internal_189 + lw $t0, 468($sp) + sw $t0, 508($sp) + + # Jumping to endif_8753943038925 + j endif_8753943038925 + + else_8753943038925: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 452($sp) # internal_193 = address of allocated object Int + + # Get attribute char of self + lw $t0, 1228($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'char' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8753942942492 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8753942942492 + j object_get_attribute_8753942942492 + int_get_attribute_8753942942492: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 448($sp) # internal_194 = self.char + j end_get_attribute_8753942942492 + bool_get_attribute_8753942942492: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 448($sp) # internal_194 = self.char + j end_get_attribute_8753942942492 + object_get_attribute_8753942942492: + sw $t1, 448($sp) # internal_194 = self.char + end_get_attribute_8753942942492: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 103 + sb $t0, 8($v0) # internal_195[0] = 'g' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 444($sp) # internal_195 = "g" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_194 + lw $t0, 460($sp) + sw $t0, 4($sp) # Storing internal_194 + + # Argument internal_195 + lw $t0, 456($sp) + sw $t0, 0($sp) # Storing internal_195 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 452($sp) # internal_196 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_193 = internal_196 + lw $t0, 440($sp) + sw $t0, 452($sp) + + # If internal_193 then goto then_8753943038919 + lw $t0, 452($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8753943038919 + + # Jumping to else_8753943038919 + j else_8753943038919 + + then_8753943038919: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 432($sp) # internal_198 = address of allocated object Int + + # Allocating D + li $v0, 9 + lw $a0, type_D + syscall + la $t0, type_D # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 428($sp) # internal_199 = address of allocated object D + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_199 + lw $t0, 436($sp) + sw $t0, 0($sp) # Storing internal_199 + + # Calling function function___init___at_D + jal function___init___at_D + lw $ra, 4($sp) + sw $v1, 436($sp) # internal_199 = result of function___init___at_D + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute avar of self + lw $t0, 1228($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8753942942645 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8753942942645 + j object_get_attribute_8753942942645 + int_get_attribute_8753942942645: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 424($sp) # internal_200 = self.avar + j end_get_attribute_8753942942645 + bool_get_attribute_8753942942645: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 424($sp) # internal_200 = self.avar + j end_get_attribute_8753942942645 + object_get_attribute_8753942942645: + sw $t1, 424($sp) # internal_200 = self.avar + end_get_attribute_8753942942645: + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 416($sp) # internal_202 = address of allocated object Int + + # Get method value of A + lw $t0, 424($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 416($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 412($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_200 + lw $t0, 432($sp) + sw $t0, 0($sp) # Storing internal_200 + + # Calling function internal_203 + lw $t0, 420($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 428($sp) # internal_201 = result of internal_203 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 11 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 11 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 404($sp) # internal_205 = address of allocated object Int + + # Get method method7 of D + lw $t0, 428($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 404($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 400($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_199 + lw $t0, 440($sp) + sw $t0, 4($sp) # Storing internal_199 + + # Argument internal_201 + lw $t0, 432($sp) + sw $t0, 0($sp) # Storing internal_201 + + # Calling function internal_206 + lw $t0, 412($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 420($sp) # internal_204 = result of internal_206 + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_198 = internal_204 + lw $t0, 408($sp) + sw $t0, 432($sp) + + # If internal_198 then goto then_8753943038082 + lw $t0, 432($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8753943038082 + + # Jumping to else_8753943038082 + j else_8753943038082 + + then_8753943038082: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 16 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 16 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 110 + sb $t0, 8($v0) # internal_207[0] = 'n' + + addi $t0, $zero, 117 + sb $t0, 9($v0) # internal_207[1] = 'u' + + addi $t0, $zero, 109 + sb $t0, 10($v0) # internal_207[2] = 'm' + + addi $t0, $zero, 98 + sb $t0, 11($v0) # internal_207[3] = 'b' + + addi $t0, $zero, 101 + sb $t0, 12($v0) # internal_207[4] = 'e' + + addi $t0, $zero, 114 + sb $t0, 13($v0) # internal_207[5] = 'r' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_207[6] = ' ' + + sb $zero, 15($v0) # Null-terminator at the end of the string + + sw $v0, 396($sp) # internal_207 = "number " + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 388($sp) # internal_209 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 1228($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 388($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 384($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 1240($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_207 + lw $t0, 408($sp) + sw $t0, 0($sp) # Storing internal_207 + + # Calling function internal_210 + lw $t0, 396($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 404($sp) # internal_208 = result of internal_210 + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute avar of self + lw $t0, 1228($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8753942942841 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8753942942841 + j object_get_attribute_8753942942841 + int_get_attribute_8753942942841: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 380($sp) # internal_211 = self.avar + j end_get_attribute_8753942942841 + bool_get_attribute_8753942942841: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 380($sp) # internal_211 = self.avar + j end_get_attribute_8753942942841 + object_get_attribute_8753942942841: + sw $t1, 380($sp) # internal_211 = self.avar + end_get_attribute_8753942942841: + + # Allocating Int 13 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 13 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 372($sp) # internal_213 = address of allocated object Int + + # Get method print of Main + lw $t0, 1228($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 372($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 368($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 1240($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_211 + lw $t0, 392($sp) + sw $t0, 0($sp) # Storing internal_211 + + # Calling function internal_214 + lw $t0, 380($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 388($sp) # internal_212 = result of internal_214 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 28 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 28 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 105 + sb $t0, 8($v0) # internal_215[0] = 'i' + + addi $t0, $zero, 115 + sb $t0, 9($v0) # internal_215[1] = 's' + + addi $t0, $zero, 32 + sb $t0, 10($v0) # internal_215[2] = ' ' + + addi $t0, $zero, 100 + sb $t0, 11($v0) # internal_215[3] = 'd' + + addi $t0, $zero, 105 + sb $t0, 12($v0) # internal_215[4] = 'i' + + addi $t0, $zero, 118 + sb $t0, 13($v0) # internal_215[5] = 'v' + + addi $t0, $zero, 105 + sb $t0, 14($v0) # internal_215[6] = 'i' + + addi $t0, $zero, 115 + sb $t0, 15($v0) # internal_215[7] = 's' + + addi $t0, $zero, 105 + sb $t0, 16($v0) # internal_215[8] = 'i' + + addi $t0, $zero, 98 + sb $t0, 17($v0) # internal_215[9] = 'b' + + addi $t0, $zero, 108 + sb $t0, 18($v0) # internal_215[10] = 'l' + + addi $t0, $zero, 101 + sb $t0, 19($v0) # internal_215[11] = 'e' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_215[12] = ' ' + + addi $t0, $zero, 98 + sb $t0, 21($v0) # internal_215[13] = 'b' + + addi $t0, $zero, 121 + sb $t0, 22($v0) # internal_215[14] = 'y' + + addi $t0, $zero, 32 + sb $t0, 23($v0) # internal_215[15] = ' ' + + addi $t0, $zero, 51 + sb $t0, 24($v0) # internal_215[16] = '3' + + addi $t0, $zero, 46 + sb $t0, 25($v0) # internal_215[17] = '.' + + addi $t0, $zero, 10 + sb $t0, 26($v0) # internal_215[18] = '\n' + + sb $zero, 27($v0) # Null-terminator at the end of the string + + sw $v0, 364($sp) # internal_215 = "is divisible by 3.\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 356($sp) # internal_217 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 1228($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 356($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 352($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 1240($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_215 + lw $t0, 376($sp) + sw $t0, 0($sp) # Storing internal_215 + + # Calling function internal_218 + lw $t0, 364($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 372($sp) # internal_216 = result of internal_218 + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_197 = internal_216 + lw $t0, 360($sp) + sw $t0, 436($sp) + + # Jumping to endif_8753943038082 + j endif_8753943038082 + + else_8753943038082: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 16 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 16 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 110 + sb $t0, 8($v0) # internal_219[0] = 'n' + + addi $t0, $zero, 117 + sb $t0, 9($v0) # internal_219[1] = 'u' + + addi $t0, $zero, 109 + sb $t0, 10($v0) # internal_219[2] = 'm' + + addi $t0, $zero, 98 + sb $t0, 11($v0) # internal_219[3] = 'b' + + addi $t0, $zero, 101 + sb $t0, 12($v0) # internal_219[4] = 'e' + + addi $t0, $zero, 114 + sb $t0, 13($v0) # internal_219[5] = 'r' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_219[6] = ' ' + + sb $zero, 15($v0) # Null-terminator at the end of the string + + sw $v0, 348($sp) # internal_219 = "number " + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 340($sp) # internal_221 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 1228($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 340($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 336($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 1240($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_219 + lw $t0, 360($sp) + sw $t0, 0($sp) # Storing internal_219 + + # Calling function internal_222 + lw $t0, 348($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 356($sp) # internal_220 = result of internal_222 + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute avar of self + lw $t0, 1228($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8753942943558 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8753942943558 + j object_get_attribute_8753942943558 + int_get_attribute_8753942943558: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 332($sp) # internal_223 = self.avar + j end_get_attribute_8753942943558 + bool_get_attribute_8753942943558: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 332($sp) # internal_223 = self.avar + j end_get_attribute_8753942943558 + object_get_attribute_8753942943558: + sw $t1, 332($sp) # internal_223 = self.avar + end_get_attribute_8753942943558: + + # Allocating Int 13 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 13 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 324($sp) # internal_225 = address of allocated object Int + + # Get method print of Main + lw $t0, 1228($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 324($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 320($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 1240($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_223 + lw $t0, 344($sp) + sw $t0, 0($sp) # Storing internal_223 + + # Calling function internal_226 + lw $t0, 332($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 340($sp) # internal_224 = result of internal_226 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 32 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 32 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 105 + sb $t0, 8($v0) # internal_227[0] = 'i' + + addi $t0, $zero, 115 + sb $t0, 9($v0) # internal_227[1] = 's' + + addi $t0, $zero, 32 + sb $t0, 10($v0) # internal_227[2] = ' ' + + addi $t0, $zero, 110 + sb $t0, 11($v0) # internal_227[3] = 'n' + + addi $t0, $zero, 111 + sb $t0, 12($v0) # internal_227[4] = 'o' + + addi $t0, $zero, 116 + sb $t0, 13($v0) # internal_227[5] = 't' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_227[6] = ' ' + + addi $t0, $zero, 100 + sb $t0, 15($v0) # internal_227[7] = 'd' + + addi $t0, $zero, 105 + sb $t0, 16($v0) # internal_227[8] = 'i' + + addi $t0, $zero, 118 + sb $t0, 17($v0) # internal_227[9] = 'v' + + addi $t0, $zero, 105 + sb $t0, 18($v0) # internal_227[10] = 'i' + + addi $t0, $zero, 115 + sb $t0, 19($v0) # internal_227[11] = 's' + + addi $t0, $zero, 105 + sb $t0, 20($v0) # internal_227[12] = 'i' + + addi $t0, $zero, 98 + sb $t0, 21($v0) # internal_227[13] = 'b' + + addi $t0, $zero, 108 + sb $t0, 22($v0) # internal_227[14] = 'l' + + addi $t0, $zero, 101 + sb $t0, 23($v0) # internal_227[15] = 'e' + + addi $t0, $zero, 32 + sb $t0, 24($v0) # internal_227[16] = ' ' + + addi $t0, $zero, 98 + sb $t0, 25($v0) # internal_227[17] = 'b' + + addi $t0, $zero, 121 + sb $t0, 26($v0) # internal_227[18] = 'y' + + addi $t0, $zero, 32 + sb $t0, 27($v0) # internal_227[19] = ' ' + + addi $t0, $zero, 51 + sb $t0, 28($v0) # internal_227[20] = '3' + + addi $t0, $zero, 46 + sb $t0, 29($v0) # internal_227[21] = '.' + + addi $t0, $zero, 10 + sb $t0, 30($v0) # internal_227[22] = '\n' + + sb $zero, 31($v0) # Null-terminator at the end of the string + + sw $v0, 316($sp) # internal_227 = "is not divisible by 3.\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 308($sp) # internal_229 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 1228($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 308($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 304($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 1240($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_227 + lw $t0, 328($sp) + sw $t0, 0($sp) # Storing internal_227 + + # Calling function internal_230 + lw $t0, 316($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 324($sp) # internal_228 = result of internal_230 + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_197 = internal_228 + lw $t0, 312($sp) + sw $t0, 436($sp) + + # Jumping to endif_8753943038082 + j endif_8753943038082 + + endif_8753943038082: + + # internal_192 = internal_197 + lw $t0, 436($sp) + sw $t0, 456($sp) + + # Jumping to endif_8753943038919 + j endif_8753943038919 + + else_8753943038919: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 296($sp) # internal_232 = address of allocated object Int + + # Get attribute char of self + lw $t0, 1228($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'char' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8753942943726 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8753942943726 + j object_get_attribute_8753942943726 + int_get_attribute_8753942943726: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 292($sp) # internal_233 = self.char + j end_get_attribute_8753942943726 + bool_get_attribute_8753942943726: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 292($sp) # internal_233 = self.char + j end_get_attribute_8753942943726 + object_get_attribute_8753942943726: + sw $t1, 292($sp) # internal_233 = self.char + end_get_attribute_8753942943726: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 104 + sb $t0, 8($v0) # internal_234[0] = 'h' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 288($sp) # internal_234 = "h" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_233 + lw $t0, 304($sp) + sw $t0, 4($sp) # Storing internal_233 + + # Argument internal_234 + lw $t0, 300($sp) + sw $t0, 0($sp) # Storing internal_234 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 296($sp) # internal_235 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_232 = internal_235 + lw $t0, 284($sp) + sw $t0, 296($sp) + + # If internal_232 then goto then_8753943038913 + lw $t0, 296($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8753943038913 + + # Jumping to else_8753943038913 + j else_8753943038913 + + then_8753943038913: + + # Allocating NUll to x + sw $zero, 280($sp) # x = 0 + + # Allocating E + li $v0, 9 + lw $a0, type_E + syscall + la $t0, type_E # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 276($sp) # internal_237 = address of allocated object E + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_237 + lw $t0, 284($sp) + sw $t0, 0($sp) # Storing internal_237 + + # Calling function function___init___at_E + jal function___init___at_E + lw $ra, 4($sp) + sw $v1, 284($sp) # internal_237 = result of function___init___at_E + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute avar of self + lw $t0, 1228($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8753942944160 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8753942944160 + j object_get_attribute_8753942944160 + int_get_attribute_8753942944160: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 272($sp) # internal_238 = self.avar + j end_get_attribute_8753942944160 + bool_get_attribute_8753942944160: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 272($sp) # internal_238 = self.avar + j end_get_attribute_8753942944160 + object_get_attribute_8753942944160: + sw $t1, 272($sp) # internal_238 = self.avar + end_get_attribute_8753942944160: + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 264($sp) # internal_240 = address of allocated object Int + + # Get method value of A + lw $t0, 272($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 264($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 260($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_238 + lw $t0, 280($sp) + sw $t0, 0($sp) # Storing internal_238 + + # Calling function internal_241 + lw $t0, 268($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 276($sp) # internal_239 = result of internal_241 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 12 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 12 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 252($sp) # internal_243 = address of allocated object Int + + # Get method method6 of E + lw $t0, 276($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 252($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 248($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_237 + lw $t0, 288($sp) + sw $t0, 4($sp) # Storing internal_237 + + # Argument internal_239 + lw $t0, 280($sp) + sw $t0, 0($sp) # Storing internal_239 + + # Calling function internal_244 + lw $t0, 260($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 268($sp) # internal_242 = result of internal_244 + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument x + lw $t0, 292($sp) + sw $t0, 4($sp) # Storing x + + # Argument internal_242 + lw $t0, 268($sp) + sw $t0, 0($sp) # Storing internal_242 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 292($sp) # x = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute avar of self + lw $t0, 1228($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8753942944558 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8753942944558 + j object_get_attribute_8753942944558 + int_get_attribute_8753942944558: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 240($sp) # internal_246 = self.avar + j end_get_attribute_8753942944558 + bool_get_attribute_8753942944558: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 240($sp) # internal_246 = self.avar + j end_get_attribute_8753942944558 + object_get_attribute_8753942944558: + sw $t1, 240($sp) # internal_246 = self.avar + end_get_attribute_8753942944558: + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 232($sp) # internal_248 = address of allocated object Int + + # Get method value of A + lw $t0, 240($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 232($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 228($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_246 + lw $t0, 248($sp) + sw $t0, 0($sp) # Storing internal_246 + + # Calling function internal_249 + lw $t0, 236($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 244($sp) # internal_247 = result of internal_249 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 220($sp) # internal_251 = address of allocated object Int + + # Get method value of A + lw $t0, 280($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 220($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 216($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument x + lw $t0, 288($sp) + sw $t0, 0($sp) # Storing x + + # Calling function internal_252 + lw $t0, 224($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 232($sp) # internal_250 = result of internal_252 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 212($sp) # internal_253 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_250 + lw $t0, 236($sp) + sw $t0, 4($sp) # Storing internal_250 + + # Argument internal_253 + lw $t0, 224($sp) + sw $t0, 0($sp) # Storing internal_253 + + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 220($sp) # internal_254 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_247 + lw $t0, 248($sp) + sw $t0, 4($sp) # Storing internal_247 + + # Argument internal_254 + lw $t0, 220($sp) + sw $t0, 0($sp) # Storing internal_254 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 216($sp) # internal_255 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument r + lw $t0, 256($sp) + sw $t0, 4($sp) # Storing r + + # Argument internal_255 + lw $t0, 216($sp) + sw $t0, 0($sp) # Storing internal_255 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 256($sp) # r = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 16 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 16 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 110 + sb $t0, 8($v0) # internal_256[0] = 'n' + + addi $t0, $zero, 117 + sb $t0, 9($v0) # internal_256[1] = 'u' + + addi $t0, $zero, 109 + sb $t0, 10($v0) # internal_256[2] = 'm' + + addi $t0, $zero, 98 + sb $t0, 11($v0) # internal_256[3] = 'b' + + addi $t0, $zero, 101 + sb $t0, 12($v0) # internal_256[4] = 'e' + + addi $t0, $zero, 114 + sb $t0, 13($v0) # internal_256[5] = 'r' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_256[6] = ' ' + + sb $zero, 15($v0) # Null-terminator at the end of the string + + sw $v0, 200($sp) # internal_256 = "number " + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 192($sp) # internal_258 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 1228($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 192($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 188($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 1240($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_256 + lw $t0, 212($sp) + sw $t0, 0($sp) # Storing internal_256 + + # Calling function internal_259 + lw $t0, 200($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 208($sp) # internal_257 = result of internal_259 + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute avar of self + lw $t0, 1228($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8753942945317 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8753942945317 + j object_get_attribute_8753942945317 + int_get_attribute_8753942945317: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 184($sp) # internal_260 = self.avar + j end_get_attribute_8753942945317 + bool_get_attribute_8753942945317: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 184($sp) # internal_260 = self.avar + j end_get_attribute_8753942945317 + object_get_attribute_8753942945317: + sw $t1, 184($sp) # internal_260 = self.avar + end_get_attribute_8753942945317: + + # Allocating Int 13 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 13 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 176($sp) # internal_262 = address of allocated object Int + + # Get method print of Main + lw $t0, 1228($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 176($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 172($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 1240($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_260 + lw $t0, 196($sp) + sw $t0, 0($sp) # Storing internal_260 + + # Calling function internal_263 + lw $t0, 184($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 192($sp) # internal_261 = result of internal_263 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 21 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 21 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 105 + sb $t0, 8($v0) # internal_264[0] = 'i' + + addi $t0, $zero, 115 + sb $t0, 9($v0) # internal_264[1] = 's' + + addi $t0, $zero, 32 + sb $t0, 10($v0) # internal_264[2] = ' ' + + addi $t0, $zero, 101 + sb $t0, 11($v0) # internal_264[3] = 'e' + + addi $t0, $zero, 113 + sb $t0, 12($v0) # internal_264[4] = 'q' + + addi $t0, $zero, 117 + sb $t0, 13($v0) # internal_264[5] = 'u' + + addi $t0, $zero, 97 + sb $t0, 14($v0) # internal_264[6] = 'a' + + addi $t0, $zero, 108 + sb $t0, 15($v0) # internal_264[7] = 'l' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_264[8] = ' ' + + addi $t0, $zero, 116 + sb $t0, 17($v0) # internal_264[9] = 't' + + addi $t0, $zero, 111 + sb $t0, 18($v0) # internal_264[10] = 'o' + + addi $t0, $zero, 32 + sb $t0, 19($v0) # internal_264[11] = ' ' + + sb $zero, 20($v0) # Null-terminator at the end of the string + + sw $v0, 168($sp) # internal_264 = "is equal to " + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 160($sp) # internal_266 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 1228($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 160($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 156($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 1240($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_264 + lw $t0, 180($sp) + sw $t0, 0($sp) # Storing internal_264 + + # Calling function internal_267 + lw $t0, 168($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 176($sp) # internal_265 = result of internal_267 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 13 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 13 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 148($sp) # internal_269 = address of allocated object Int + + # Get method print of Main + lw $t0, 1228($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 148($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 144($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 1240($sp) + sw $t0, 4($sp) # Storing self + + # Argument x + lw $t0, 292($sp) + sw $t0, 0($sp) # Storing x + + # Calling function internal_270 + lw $t0, 156($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 164($sp) # internal_268 = result of internal_270 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 37 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 37 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 116 + sb $t0, 8($v0) # internal_271[0] = 't' + + addi $t0, $zero, 105 + sb $t0, 9($v0) # internal_271[1] = 'i' + + addi $t0, $zero, 109 + sb $t0, 10($v0) # internal_271[2] = 'm' + + addi $t0, $zero, 101 + sb $t0, 11($v0) # internal_271[3] = 'e' + + addi $t0, $zero, 115 + sb $t0, 12($v0) # internal_271[4] = 's' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_271[5] = ' ' + + addi $t0, $zero, 56 + sb $t0, 14($v0) # internal_271[6] = '8' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_271[7] = ' ' + + addi $t0, $zero, 119 + sb $t0, 16($v0) # internal_271[8] = 'w' + + addi $t0, $zero, 105 + sb $t0, 17($v0) # internal_271[9] = 'i' + + addi $t0, $zero, 116 + sb $t0, 18($v0) # internal_271[10] = 't' + + addi $t0, $zero, 104 + sb $t0, 19($v0) # internal_271[11] = 'h' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_271[12] = ' ' + + addi $t0, $zero, 97 + sb $t0, 21($v0) # internal_271[13] = 'a' + + addi $t0, $zero, 32 + sb $t0, 22($v0) # internal_271[14] = ' ' + + addi $t0, $zero, 114 + sb $t0, 23($v0) # internal_271[15] = 'r' + + addi $t0, $zero, 101 + sb $t0, 24($v0) # internal_271[16] = 'e' + + addi $t0, $zero, 109 + sb $t0, 25($v0) # internal_271[17] = 'm' + + addi $t0, $zero, 97 + sb $t0, 26($v0) # internal_271[18] = 'a' + + addi $t0, $zero, 105 + sb $t0, 27($v0) # internal_271[19] = 'i' + + addi $t0, $zero, 110 + sb $t0, 28($v0) # internal_271[20] = 'n' + + addi $t0, $zero, 100 + sb $t0, 29($v0) # internal_271[21] = 'd' + + addi $t0, $zero, 101 + sb $t0, 30($v0) # internal_271[22] = 'e' + + addi $t0, $zero, 114 + sb $t0, 31($v0) # internal_271[23] = 'r' + + addi $t0, $zero, 32 + sb $t0, 32($v0) # internal_271[24] = ' ' + + addi $t0, $zero, 111 + sb $t0, 33($v0) # internal_271[25] = 'o' + + addi $t0, $zero, 102 + sb $t0, 34($v0) # internal_271[26] = 'f' + + addi $t0, $zero, 32 + sb $t0, 35($v0) # internal_271[27] = ' ' + + sb $zero, 36($v0) # Null-terminator at the end of the string + + sw $v0, 140($sp) # internal_271 = "times 8 with a remainder of " + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 132($sp) # internal_273 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 1228($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 132($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 128($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 1240($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_271 + lw $t0, 152($sp) + sw $t0, 0($sp) # Storing internal_271 + + # Calling function internal_274 + lw $t0, 140($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 148($sp) # internal_272 = result of internal_274 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating A2I + li $v0, 9 + lw $a0, type_A2I + syscall + la $t0, type_A2I # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 120($sp) # internal_276 = address of allocated object A2I + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_276 + lw $t0, 128($sp) + sw $t0, 0($sp) # Storing internal_276 + + # Calling function function___init___at_A2I + jal function___init___at_A2I + lw $ra, 4($sp) + sw $v1, 128($sp) # internal_276 = result of function___init___at_A2I + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument a + lw $t0, 784($sp) + sw $t0, 4($sp) # Storing a + + # Argument internal_276 + lw $t0, 132($sp) + sw $t0, 0($sp) # Storing internal_276 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 784($sp) # a = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 112($sp) # internal_278 = address of allocated object Int + + # Get method i2a of A2I + lw $t0, 772($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 112($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 108($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument a + lw $t0, 784($sp) + sw $t0, 4($sp) # Storing a + + # Argument r + lw $t0, 256($sp) + sw $t0, 0($sp) # Storing r + + # Calling function internal_279 + lw $t0, 120($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 128($sp) # internal_277 = result of internal_279 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 100($sp) # internal_281 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 1228($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 100($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 96($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 1240($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_277 + lw $t0, 128($sp) + sw $t0, 0($sp) # Storing internal_277 + + # Calling function internal_282 + lw $t0, 108($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 116($sp) # internal_280 = result of internal_282 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_283[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 92($sp) # internal_283 = "\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 84($sp) # internal_285 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 1228($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 84($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 80($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 1240($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_283 + lw $t0, 104($sp) + sw $t0, 0($sp) # Storing internal_283 + + # Calling function internal_286 + lw $t0, 92($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 100($sp) # internal_284 = result of internal_286 + addi $sp, $sp, 12 # Freeing space for arguments + + # Set attribute avar of self + lw $t0, 1228($sp) # $t0 = self + lw $t1, 280($sp) # $t1 = x + beq $t1, $zero, object_set_attribute_8753942944696 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8753942944696 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8753942944696 + j object_set_attribute_8753942944696 + int_set_attribute_8753942944696: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = x + j end_set_attribute_8753942944696 + bool_set_attribute_8753942944696: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = x + j end_set_attribute_8753942944696 + object_set_attribute_8753942944696: + sw $t1, 12($t0) # self.avar = x + end_set_attribute_8753942944696: + + # internal_231 = x + lw $t0, 280($sp) + sw $t0, 300($sp) + + # Jumping to endif_8753943038913 + j endif_8753943038913 + + else_8753943038913: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 72($sp) # internal_288 = address of allocated object Int + + # Get attribute char of self + lw $t0, 1228($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'char' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8753942946027 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8753942946027 + j object_get_attribute_8753942946027 + int_get_attribute_8753942946027: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 68($sp) # internal_289 = self.char + j end_get_attribute_8753942946027 + bool_get_attribute_8753942946027: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 68($sp) # internal_289 = self.char + j end_get_attribute_8753942946027 + object_get_attribute_8753942946027: + sw $t1, 68($sp) # internal_289 = self.char + end_get_attribute_8753942946027: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 106 + sb $t0, 8($v0) # internal_290[0] = 'j' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 64($sp) # internal_290 = "j" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_289 + lw $t0, 80($sp) + sw $t0, 4($sp) # Storing internal_289 + + # Argument internal_290 + lw $t0, 76($sp) + sw $t0, 0($sp) # Storing internal_290 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 72($sp) # internal_291 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_288 = internal_291 + lw $t0, 60($sp) + sw $t0, 72($sp) + + # If internal_288 then goto then_8753943038907 + lw $t0, 72($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8753943038907 + + # Jumping to else_8753943038907 + j else_8753943038907 + + then_8753943038907: + + # Allocating A + li $v0, 9 + lw $a0, type_A + syscall + la $t0, type_A # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 56($sp) # internal_292 = address of allocated object A + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_292 + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing internal_292 + + # Calling function function___init___at_A + jal function___init___at_A + lw $ra, 4($sp) + sw $v1, 64($sp) # internal_292 = result of function___init___at_A + addi $sp, $sp, 8 # Freeing space for arguments + + # Set attribute avar of self + lw $t0, 1228($sp) # $t0 = self + lw $t1, 56($sp) # $t1 = internal_292 + beq $t1, $zero, object_set_attribute_8753942946353 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8753942946353 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8753942946353 + j object_set_attribute_8753942946353 + int_set_attribute_8753942946353: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_292 + j end_set_attribute_8753942946353 + bool_set_attribute_8753942946353: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_292 + j end_set_attribute_8753942946353 + object_set_attribute_8753942946353: + sw $t1, 12($t0) # self.avar = internal_292 + end_set_attribute_8753942946353: + + # internal_287 = internal_292 + lw $t0, 56($sp) + sw $t0, 76($sp) + + # Jumping to endif_8753943038907 + j endif_8753943038907 + + else_8753943038907: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 48($sp) # internal_294 = address of allocated object Int + + # Get attribute char of self + lw $t0, 1228($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'char' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8753942946455 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8753942946455 + j object_get_attribute_8753942946455 + int_get_attribute_8753942946455: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 44($sp) # internal_295 = self.char + j end_get_attribute_8753942946455 + bool_get_attribute_8753942946455: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 44($sp) # internal_295 = self.char + j end_get_attribute_8753942946455 + object_get_attribute_8753942946455: + sw $t1, 44($sp) # internal_295 = self.char + end_get_attribute_8753942946455: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 113 + sb $t0, 8($v0) # internal_296[0] = 'q' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 40($sp) # internal_296 = "q" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_295 + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing internal_295 + + # Argument internal_296 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_296 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 48($sp) # internal_297 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_294 = internal_297 + lw $t0, 36($sp) + sw $t0, 48($sp) + + # If internal_294 then goto then_8753943038883 + lw $t0, 48($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8753943038883 + + # Jumping to else_8753943038883 + j else_8753943038883 + + then_8753943038883: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_298 = address of allocated object Int + + # Set attribute flag of self + lw $t0, 1228($sp) # $t0 = self + lw $t1, 32($sp) # $t1 = internal_298 + beq $t1, $zero, object_set_attribute_8753942946521 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8753942946521 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8753942946521 + j object_set_attribute_8753942946521 + int_set_attribute_8753942946521: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($t0) # self.flag = internal_298 + j end_set_attribute_8753942946521 + bool_set_attribute_8753942946521: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($t0) # self.flag = internal_298 + j end_set_attribute_8753942946521 + object_set_attribute_8753942946521: + sw $t1, 20($t0) # self.flag = internal_298 + end_set_attribute_8753942946521: + + # internal_293 = internal_298 + lw $t0, 32($sp) + sw $t0, 52($sp) + + # Jumping to endif_8753943038883 + j endif_8753943038883 + + else_8753943038883: + + # Allocating A + li $v0, 9 + lw $a0, type_A + syscall + la $t0, type_A # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 28($sp) # internal_299 = address of allocated object A + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_299 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_299 + + # Calling function function___init___at_A + jal function___init___at_A + lw $ra, 4($sp) + sw $v1, 36($sp) # internal_299 = result of function___init___at_A + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute avar of self + lw $t0, 1228($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'avar' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8753942947142 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8753942947142 + j object_get_attribute_8753942947142 + int_get_attribute_8753942947142: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 24($sp) # internal_300 = self.avar + j end_get_attribute_8753942947142 + bool_get_attribute_8753942947142: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 24($sp) # internal_300 = self.avar + j end_get_attribute_8753942947142 + object_get_attribute_8753942947142: + sw $t1, 24($sp) # internal_300 = self.avar + end_get_attribute_8753942947142: + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_302 = address of allocated object Int + + # Get method value of A + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 16($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 12($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_300 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_300 + + # Calling function internal_303 + lw $t0, 20($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 28($sp) # internal_301 = result of internal_303 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_305 = address of allocated object Int + + # Get method method1 of A + lw $t0, 28($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_299 + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing internal_299 + + # Argument internal_301 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_301 + + # Calling function internal_306 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_304 = result of internal_306 + addi $sp, $sp, 12 # Freeing space for arguments + + # Set attribute avar of self + lw $t0, 1228($sp) # $t0 = self + lw $t1, 8($sp) # $t1 = internal_304 + beq $t1, $zero, object_set_attribute_8753942947082 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8753942947082 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8753942947082 + j object_set_attribute_8753942947082 + int_set_attribute_8753942947082: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_304 + j end_set_attribute_8753942947082 + bool_set_attribute_8753942947082: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.avar = internal_304 + j end_set_attribute_8753942947082 + object_set_attribute_8753942947082: + sw $t1, 12($t0) # self.avar = internal_304 + end_set_attribute_8753942947082: + + # internal_293 = internal_304 + lw $t0, 8($sp) + sw $t0, 52($sp) + + # Jumping to endif_8753943038883 + j endif_8753943038883 + + endif_8753943038883: + + # internal_287 = internal_293 + lw $t0, 52($sp) + sw $t0, 76($sp) + + # Jumping to endif_8753943038907 + j endif_8753943038907 + + endif_8753943038907: + + # internal_231 = internal_287 + lw $t0, 76($sp) + sw $t0, 300($sp) + + # Jumping to endif_8753943038913 + j endif_8753943038913 + + endif_8753943038913: + + # internal_192 = internal_231 + lw $t0, 300($sp) + sw $t0, 456($sp) + + # Jumping to endif_8753943038919 + j endif_8753943038919 + + endif_8753943038919: + + # internal_179 = internal_192 + lw $t0, 456($sp) + sw $t0, 508($sp) + + # Jumping to endif_8753943038925 + j endif_8753943038925 + + endif_8753943038925: + + # internal_166 = internal_179 + lw $t0, 508($sp) + sw $t0, 560($sp) + + # Jumping to endif_8753943038931 + j endif_8753943038931 + + endif_8753943038931: + + # internal_153 = internal_166 + lw $t0, 560($sp) + sw $t0, 612($sp) + + # Jumping to endif_8753943038937 + j endif_8753943038937 + + endif_8753943038937: + + # internal_129 = internal_153 + lw $t0, 612($sp) + sw $t0, 708($sp) + + # Jumping to endif_8753943038943 + j endif_8753943038943 + + endif_8753943038943: + + # internal_59 = internal_129 + lw $t0, 708($sp) + sw $t0, 988($sp) + + # Jumping to endif_8753943038949 + j endif_8753943038949 + + endif_8753943038949: + + # internal_35 = internal_59 + lw $t0, 988($sp) + sw $t0, 1084($sp) + + # Jumping to endif_8753943038955 + j endif_8753943038955 + + endif_8753943038955: + + # Jumping to while_start_8753943038970 + j while_start_8753943038970 + + while_end_8753943038970: + + # Loading return value in $v1 + lw $v1, 1220($sp) + + # Freeing space for local variables + addi $sp, $sp, 1228 + + jr $ra + + main: + # Reserving space for local variables + addi $sp, $sp, -16 + + # Allocating Main + li $v0, 9 + lw $a0, type_Main + syscall + la $t0, type_Main # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 12($sp) # internal_0 = address of allocated object Main + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_Main + jal function___init___at_Main + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_0 = result of function___init___at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 14 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 14 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_2 = address of allocated object Int + + # Get method main of Main + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function internal_3 + lw $t0, 8($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_1 = result of internal_3 + addi $sp, $sp, 8 # Freeing space for arguments + + # Exit program + li $v0, 10 + syscall + + \ No newline at end of file diff --git a/tests/codegen/arith_input.txt b/tests/codegen/arith_input.txt index 83e05b1ea..c431a225b 100644 --- a/tests/codegen/arith_input.txt +++ b/tests/codegen/arith_input.txt @@ -1,13 +1,13 @@ -a -1 -b -c -0 -d -e -f -g -h -j -5 -q +a +1 +b +c +0 +d +e +f +g +h +j +5 +q diff --git a/tests/codegen/arith_output.txt b/tests/codegen/arith_output.txt index 44b4ce73e..476cb3bad 100644 --- a/tests/codegen/arith_output.txt +++ b/tests/codegen/arith_output.txt @@ -1,158 +1,158 @@ -number 0 is even! -Class type is now A - - To add a number to 0 ...enter a: - To negate 0 ...enter b: - To find the difference between 0 and another number...enter c: - To find the factorial of 0 ...enter d: - To square 0 ...enter e: - To cube 0 ...enter f: - To find out if 0 is a multiple of 3...enter g: - To divide 0 by 8...enter h: - To get a new number...enter j: - To quit...enter q: - - -Please enter a number... number 1 is odd! -Class type is now B - - To add a number to 1 ...enter a: - To negate 1 ...enter b: - To find the difference between 1 and another number...enter c: - To find the factorial of 1 ...enter d: - To square 1 ...enter e: - To cube 1 ...enter f: - To find out if 1 is a multiple of 3...enter g: - To divide 1 by 8...enter h: - To get a new number...enter j: - To quit...enter q: - -number -1 is odd! -Class type is now C - - To add a number to -1 ...enter a: - To negate -1 ...enter b: - To find the difference between -1 and another number...enter c: - To find the factorial of -1 ...enter d: - To square -1 ...enter e: - To cube -1 ...enter f: - To find out if -1 is a multiple of 3...enter g: - To divide -1 by 8...enter h: - To get a new number...enter j: - To quit...enter q: - - -Please enter a number... number 1 is odd! -Class type is now D - - To add a number to 1 ...enter a: - To negate 1 ...enter b: - To find the difference between 1 and another number...enter c: - To find the factorial of 1 ...enter d: - To square 1 ...enter e: - To cube 1 ...enter f: - To find out if 1 is a multiple of 3...enter g: - To divide 1 by 8...enter h: - To get a new number...enter j: - To quit...enter q: - -number 1 is odd! -Class type is now E - - To add a number to 1 ...enter a: - To negate 1 ...enter b: - To find the difference between 1 and another number...enter c: - To find the factorial of 1 ...enter d: - To square 1 ...enter e: - To cube 1 ...enter f: - To find out if 1 is a multiple of 3...enter g: - To divide 1 by 8...enter h: - To get a new number...enter j: - To quit...enter q: - -number 1 is odd! -Class type is now E - - To add a number to 1 ...enter a: - To negate 1 ...enter b: - To find the difference between 1 and another number...enter c: - To find the factorial of 1 ...enter d: - To square 1 ...enter e: - To cube 1 ...enter f: - To find out if 1 is a multiple of 3...enter g: - To divide 1 by 8...enter h: - To get a new number...enter j: - To quit...enter q: - -number 1 is odd! -Class type is now E - - To add a number to 1 ...enter a: - To negate 1 ...enter b: - To find the difference between 1 and another number...enter c: - To find the factorial of 1 ...enter d: - To square 1 ...enter e: - To cube 1 ...enter f: - To find out if 1 is a multiple of 3...enter g: - To divide 1 by 8...enter h: - To get a new number...enter j: - To quit...enter q: - -number 1 is not divisible by 3. -number 1 is odd! -Class type is now E - - To add a number to 1 ...enter a: - To negate 1 ...enter b: - To find the difference between 1 and another number...enter c: - To find the factorial of 1 ...enter d: - To square 1 ...enter e: - To cube 1 ...enter f: - To find out if 1 is a multiple of 3...enter g: - To divide 1 by 8...enter h: - To get a new number...enter j: - To quit...enter q: - -number 1 is equal to 0 times 8 with a remainder of 1 -number 0 is even! -Class type is now A - - To add a number to 0 ...enter a: - To negate 0 ...enter b: - To find the difference between 0 and another number...enter c: - To find the factorial of 0 ...enter d: - To square 0 ...enter e: - To cube 0 ...enter f: - To find out if 0 is a multiple of 3...enter g: - To divide 0 by 8...enter h: - To get a new number...enter j: - To quit...enter q: - -number 0 is even! -Class type is now A - - To add a number to 0 ...enter a: - To negate 0 ...enter b: - To find the difference between 0 and another number...enter c: - To find the factorial of 0 ...enter d: - To square 0 ...enter e: - To cube 0 ...enter f: - To find out if 0 is a multiple of 3...enter g: - To divide 0 by 8...enter h: - To get a new number...enter j: - To quit...enter q: - -number 0 is even! -Class type is now A - - To add a number to 0 ...enter a: - To negate 0 ...enter b: - To find the difference between 0 and another number...enter c: - To find the factorial of 0 ...enter d: - To square 0 ...enter e: - To cube 0 ...enter f: - To find out if 0 is a multiple of 3...enter g: - To divide 0 by 8...enter h: - To get a new number...enter j: - To quit...enter q: - +number 0 is even! +Class type is now A + + To add a number to 0 ...enter a: + To negate 0 ...enter b: + To find the difference between 0 and another number...enter c: + To find the factorial of 0 ...enter d: + To square 0 ...enter e: + To cube 0 ...enter f: + To find out if 0 is a multiple of 3...enter g: + To divide 0 by 8...enter h: + To get a new number...enter j: + To quit...enter q: + + +Please enter a number... number 1 is odd! +Class type is now B + + To add a number to 1 ...enter a: + To negate 1 ...enter b: + To find the difference between 1 and another number...enter c: + To find the factorial of 1 ...enter d: + To square 1 ...enter e: + To cube 1 ...enter f: + To find out if 1 is a multiple of 3...enter g: + To divide 1 by 8...enter h: + To get a new number...enter j: + To quit...enter q: + +number -1 is odd! +Class type is now C + + To add a number to -1 ...enter a: + To negate -1 ...enter b: + To find the difference between -1 and another number...enter c: + To find the factorial of -1 ...enter d: + To square -1 ...enter e: + To cube -1 ...enter f: + To find out if -1 is a multiple of 3...enter g: + To divide -1 by 8...enter h: + To get a new number...enter j: + To quit...enter q: + + +Please enter a number... number 1 is odd! +Class type is now D + + To add a number to 1 ...enter a: + To negate 1 ...enter b: + To find the difference between 1 and another number...enter c: + To find the factorial of 1 ...enter d: + To square 1 ...enter e: + To cube 1 ...enter f: + To find out if 1 is a multiple of 3...enter g: + To divide 1 by 8...enter h: + To get a new number...enter j: + To quit...enter q: + +number 1 is odd! +Class type is now E + + To add a number to 1 ...enter a: + To negate 1 ...enter b: + To find the difference between 1 and another number...enter c: + To find the factorial of 1 ...enter d: + To square 1 ...enter e: + To cube 1 ...enter f: + To find out if 1 is a multiple of 3...enter g: + To divide 1 by 8...enter h: + To get a new number...enter j: + To quit...enter q: + +number 1 is odd! +Class type is now E + + To add a number to 1 ...enter a: + To negate 1 ...enter b: + To find the difference between 1 and another number...enter c: + To find the factorial of 1 ...enter d: + To square 1 ...enter e: + To cube 1 ...enter f: + To find out if 1 is a multiple of 3...enter g: + To divide 1 by 8...enter h: + To get a new number...enter j: + To quit...enter q: + +number 1 is odd! +Class type is now E + + To add a number to 1 ...enter a: + To negate 1 ...enter b: + To find the difference between 1 and another number...enter c: + To find the factorial of 1 ...enter d: + To square 1 ...enter e: + To cube 1 ...enter f: + To find out if 1 is a multiple of 3...enter g: + To divide 1 by 8...enter h: + To get a new number...enter j: + To quit...enter q: + +number 1 is not divisible by 3. +number 1 is odd! +Class type is now E + + To add a number to 1 ...enter a: + To negate 1 ...enter b: + To find the difference between 1 and another number...enter c: + To find the factorial of 1 ...enter d: + To square 1 ...enter e: + To cube 1 ...enter f: + To find out if 1 is a multiple of 3...enter g: + To divide 1 by 8...enter h: + To get a new number...enter j: + To quit...enter q: + +number 1 is equal to 0 times 8 with a remainder of 1 +number 0 is even! +Class type is now A + + To add a number to 0 ...enter a: + To negate 0 ...enter b: + To find the difference between 0 and another number...enter c: + To find the factorial of 0 ...enter d: + To square 0 ...enter e: + To cube 0 ...enter f: + To find out if 0 is a multiple of 3...enter g: + To divide 0 by 8...enter h: + To get a new number...enter j: + To quit...enter q: + +number 0 is even! +Class type is now A + + To add a number to 0 ...enter a: + To negate 0 ...enter b: + To find the difference between 0 and another number...enter c: + To find the factorial of 0 ...enter d: + To square 0 ...enter e: + To cube 0 ...enter f: + To find out if 0 is a multiple of 3...enter g: + To divide 0 by 8...enter h: + To get a new number...enter j: + To quit...enter q: + +number 0 is even! +Class type is now A + + To add a number to 0 ...enter a: + To negate 0 ...enter b: + To find the difference between 0 and another number...enter c: + To find the factorial of 0 ...enter d: + To square 0 ...enter e: + To cube 0 ...enter f: + To find out if 0 is a multiple of 3...enter g: + To divide 0 by 8...enter h: + To get a new number...enter j: + To quit...enter q: + diff --git a/tests/codegen/atoi.mips b/tests/codegen/atoi.mips new file mode 100644 index 000000000..52fb36721 --- /dev/null +++ b/tests/codegen/atoi.mips @@ -0,0 +1,6007 @@ +.data + type_Object: .word 24 + type_Object_inherits_from: .word 0 + type_Object_name_address: .word type_Object_name_size + type_Object___init__: .word function___init___at_Object + type_Object_abort: .word function_abort_at_Object + type_Object_type_name: .word function_type_name_at_Object + type_Object_copy: .word function_copy_at_Object + + type_IO: .word 40 + type_IO_inherits_from: .word type_Object + type_IO_name_address: .word type_IO_name_size + type_IO___init__: .word function___init___at_IO + type_IO_abort: .word function_abort_at_Object + type_IO_type_name: .word function_type_name_at_Object + type_IO_copy: .word function_copy_at_Object + type_IO_out_string: .word function_out_string_at_IO + type_IO_out_int: .word function_out_int_at_IO + type_IO_in_string: .word function_in_string_at_IO + type_IO_in_int: .word function_in_int_at_IO + + type_String: .word 36 + type_String_inherits_from: .word type_Object + type_String_name_address: .word type_String_name_size + type_String___init__: .word function___init___at_String + type_String_abort: .word function_abort_at_Object + type_String_type_name: .word function_type_name_at_Object + type_String_copy: .word function_copy_at_Object + type_String_length: .word function_length_at_String + type_String_concat: .word function_concat_at_String + type_String_substr: .word function_substr_at_String + + type_Int: .word 24 + type_Int_inherits_from: .word type_Object + type_Int_name_address: .word type_Int_name_size + type_Int___init__: .word function___init___at_Int + type_Int_abort: .word function_abort_at_Object + type_Int_type_name: .word function_type_name_at_Object + type_Int_copy: .word function_copy_at_Object + + type_Bool: .word 24 + type_Bool_inherits_from: .word type_Object + type_Bool_name_address: .word type_Bool_name_size + type_Bool___init__: .word function___init___at_Bool + type_Bool_abort: .word function_abort_at_Object + type_Bool_type_name: .word function_type_name_at_Object + type_Bool_copy: .word function_copy_at_Object + + type_A2I: .word 48 + type_A2I_inherits_from: .word type_Object + type_A2I_name_address: .word type_A2I_name_size + type_A2I___init__: .word function___init___at_A2I + type_A2I_abort: .word function_abort_at_Object + type_A2I_type_name: .word function_type_name_at_Object + type_A2I_copy: .word function_copy_at_Object + type_A2I_c2i: .word function_c2i_at_A2I + type_A2I_i2c: .word function_i2c_at_A2I + type_A2I_a2i: .word function_a2i_at_A2I + type_A2I_a2i_aux: .word function_a2i_aux_at_A2I + type_A2I_i2a: .word function_i2a_at_A2I + type_A2I_i2a_aux: .word function_i2a_aux_at_A2I + + type_Main: .word 44 + type_Main_inherits_from: .word type_IO + type_Main_name_address: .word type_Main_name_size + type_Main___init__: .word function___init___at_Main + type_Main_abort: .word function_abort_at_Object + type_Main_type_name: .word function_type_name_at_Object + type_Main_copy: .word function_copy_at_Object + type_Main_out_string: .word function_out_string_at_IO + type_Main_out_int: .word function_out_int_at_IO + type_Main_in_string: .word function_in_string_at_IO + type_Main_in_int: .word function_in_int_at_IO + type_Main_main: .word function_main_at_Main + + type_Object_name_size: .word 6 + type_Object_name: .asciiz "Object" + + type_IO_name_size: .word 2 + type_IO_name: .asciiz "IO" + + type_String_name_size: .word 6 + type_String_name: .asciiz "String" + + type_Int_name_size: .word 3 + type_Int_name: .asciiz "Int" + + type_Bool_name_size: .word 4 + type_Bool_name: .asciiz "Bool" + + type_A2I_name_size: .word 3 + type_A2I_name: .asciiz "A2I" + + type_Main_name_size: .word 4 + type_Main_name: .asciiz "Main" + + buffer_input: .space 1024 + debug_log: .asciiz "debug_log\n" + +.text + function_add: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Addition operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + add $t2, $t0, $t1 # $t2 = $t0 + $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_sub: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Subtraction operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sub $t2, $t0, $t1 # $t2 = $t0 - $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_mult: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Multiplication operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + mult $t0, $t1 # $t2 = $t0 * $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_div: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Division operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + div $t0, $t1 # $t2 = $t0 / $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_xor: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Xor operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than_or_equal: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sle $t2, $t0, $t1 # $t2 = $t0 <= $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_equal: + # Function parameters + # $ra = 48($sp) + # a = 44($sp) + # b = 40($sp) + + # Reserving space for local variables + addi $sp, $sp, -40 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_0 = address of allocated object Int + + # Allocating NUll to internal_1 + sw $zero, 32($sp) # internal_1 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_2 = address of allocated object Int + + # internal_2 = EqualAddress(a, internal_1) + lw $t0, 44($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # internal_2 = EqualAddress(b, internal_1) + lw $t0, 40($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # If internal_2 then goto a_is_type_object + lw $t0, 28($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_object + + # internal_3 = typeof a that is the first word of the object + lw $t0, 44($sp) + lw $t0, 0($t0) + sw $t0, 24($sp) + + # internal_4 = direction of Int + la $t0, type_Int + sw $t0, 20($sp) + + # internal_5 = direction of Bool + la $t0, type_Bool + sw $t0, 16($sp) + + # internal_6 = direction of String + la $t0, type_String + sw $t0, 12($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_7 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_8 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_9 = address of allocated object Int + + # internal_7 = EqualAddress(internal_3, internal_4) + lw $t0, 24($sp) + lw $t1, 20($sp) + seq $t2, $t0, $t1 + lw $t0, 8($sp) + sw $t2, 8($t0) + + # internal_8 = EqualAddress(internal_3, internal_5) + lw $t0, 24($sp) + lw $t1, 16($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_9 = EqualAddress(internal_3, internal_6) + lw $t0, 24($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_7 then goto a_is_type_int_or_bool + lw $t0, 8($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_8 then goto a_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_9 then goto a_is_type_string + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_string + + # Jumping to a_is_type_object + j a_is_type_object + + a_is_type_int_or_bool: + + # internal_0 = EqualInt(a, b) + lw $t0, 44($sp) + lw $t0, 8($t0) + lw $t1, 40($sp) + lw $t1, 8($t1) + seq $t2, $t0, $t1 + lw $t0, 36($sp) + sw $t2, 8($t0) + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_string: + + # internal_0 = EqualStr(a, b) + lw $t0, 44($sp) + lw $t1, 40($sp) + addi $t0, $t0, 8 + addi $t1, $t1, 8 + + # By default we assume the strings are equals + addi $t4, $zero, 1 + lw $t5, 36($sp) + sw $t4, 8($t5) + + while_compare_strings_start: + lb $t2, 0($t0) + lb $t3, 0($t1) + beq $t2, $t3, while_compare_strings_update + + # The strings are no equals + lw $t5, 36($sp) + sw $zero, 8($t5) + j while_compare_strings_end + + while_compare_strings_update: + addi $t0, $t0, 1 + addi $t1, $t1, 1 + beq $t2, $zero, while_compare_strings_end + beq $t3, $zero, while_compare_strings_end + j while_compare_strings_start + while_compare_strings_end: + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_object: + + # Equal operation + lw $t0, 44($sp) # Save in $t0 the left operand address + lw $t1, 40($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 36($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Jumping to end_of_equal + j end_of_equal + + end_of_equal: + + # Loading return value in $v1 + lw $v1, 36($sp) + + # Freeing space for local variables + addi $sp, $sp, 40 + + jr $ra + + function_assign: + # Function parameters + # $ra = 36($sp) + # dest = 32($sp) + # source = 28($sp) + + # Reserving space for local variables + addi $sp, $sp, -28 + + # Allocating NUll to internal_0 + sw $zero, 24($sp) # internal_0 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_1 = address of allocated object Int + + # internal_1 = EqualAddress(source, internal_0) + lw $t0, 28($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # internal_1 = EqualAddress(dest, internal_0) + lw $t0, 32($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # If internal_1 then goto source_is_type_object + lw $t0, 20($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_object + + # internal_2 = typeof source that is the first word of the object + lw $t0, 28($sp) + lw $t0, 0($t0) + sw $t0, 16($sp) + + # internal_3 = direction of Int + la $t0, type_Int + sw $t0, 12($sp) + + # internal_4 = direction of Bool + la $t0, type_Bool + sw $t0, 8($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_5 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_6 = address of allocated object Int + + # internal_5 = EqualAddress(internal_2, internal_3) + lw $t0, 16($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_6 = EqualAddress(internal_2, internal_4) + lw $t0, 16($sp) + lw $t1, 8($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_5 then goto source_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # If internal_6 then goto source_is_type_int_or_bool + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # Jumping to source_is_type_object + j source_is_type_object + + source_is_type_int_or_bool: + + # dest = source where source is an integer + li $v0, 9 + addi $a0, $zero, 12 + syscall + lw $t0, 28($sp) # Pointer to source + lw $t1, 0($t0) # $t1 = type of source + lw $t2, 8($t0) # $t2 = value of source + sw $t1, 0($v0) # Save type of dest + sw $a0, 4($v0) # Save size of dest + sw $t2, 8($v0) # Save value of dest + sw $v0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_is_type_object: + + # dest = source + lw $t0, 28($sp) + sw $t0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_end_of_equal: + + # Loading return value in $v1 + lw $v1, 32($sp) + + # Freeing space for local variables + addi $sp, $sp, 28 + + jr $ra + + function___init___at_Object: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_abort_at_Object: + # Function parameters + # $ra = 28($sp) + # self = 24($sp) + + # Reserving space for local variables + addi $sp, $sp, -24 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 33 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 33 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 65 + sb $t0, 8($v0) # internal_0[0] = 'A' + + addi $t0, $zero, 98 + sb $t0, 9($v0) # internal_0[1] = 'b' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_0[2] = 'o' + + addi $t0, $zero, 114 + sb $t0, 11($v0) # internal_0[3] = 'r' + + addi $t0, $zero, 116 + sb $t0, 12($v0) # internal_0[4] = 't' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_0[5] = ' ' + + addi $t0, $zero, 99 + sb $t0, 14($v0) # internal_0[6] = 'c' + + addi $t0, $zero, 97 + sb $t0, 15($v0) # internal_0[7] = 'a' + + addi $t0, $zero, 108 + sb $t0, 16($v0) # internal_0[8] = 'l' + + addi $t0, $zero, 108 + sb $t0, 17($v0) # internal_0[9] = 'l' + + addi $t0, $zero, 101 + sb $t0, 18($v0) # internal_0[10] = 'e' + + addi $t0, $zero, 100 + sb $t0, 19($v0) # internal_0[11] = 'd' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_0[12] = ' ' + + addi $t0, $zero, 102 + sb $t0, 21($v0) # internal_0[13] = 'f' + + addi $t0, $zero, 114 + sb $t0, 22($v0) # internal_0[14] = 'r' + + addi $t0, $zero, 111 + sb $t0, 23($v0) # internal_0[15] = 'o' + + addi $t0, $zero, 109 + sb $t0, 24($v0) # internal_0[16] = 'm' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_0[17] = ' ' + + addi $t0, $zero, 99 + sb $t0, 26($v0) # internal_0[18] = 'c' + + addi $t0, $zero, 108 + sb $t0, 27($v0) # internal_0[19] = 'l' + + addi $t0, $zero, 97 + sb $t0, 28($v0) # internal_0[20] = 'a' + + addi $t0, $zero, 115 + sb $t0, 29($v0) # internal_0[21] = 's' + + addi $t0, $zero, 115 + sb $t0, 30($v0) # internal_0[22] = 's' + + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_0[23] = ' ' + + sb $zero, 32($v0) # Null-terminator at the end of the string + + sw $v0, 20($sp) # internal_0 = "Abort called from class " + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_3[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 8($sp) # internal_3 = "\n" + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method type_name of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_5 + lw $t0, 8($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 24($sp) # internal_1 = result of internal_5 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_1 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_2 = result of internal_5 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_3 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_2 = result of internal_5 + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 12($sp) # $t0 = internal_2 + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the String internal_2 + li $v0, 4 + move $a0, $t0 + syscall + + # Exit program + li $v0, 10 + syscall + + # Loading return value in $v1 + lw $v1, 24($sp) + + # Freeing space for local variables + addi $sp, $sp, 24 + + jr $ra + + function_type_name_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = name of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 8($t1) # $t2 = direction of the type name + la $t3, 4($t2) # $t3 = address of the name + lw $t2, 0($t2) # $t2 = length of the name + + addi $t2, $t2, 9 # Setting space for the type, the size and the null byte + li $v0, 9 + move $a0, $t2 + syscall + addi $t2, $t2, -9 # Restoring space for the type, the size and the null byte + + la $t4, type_String + sw $t4, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t4, $v0, 0 # $t4 = direction of the new string + addi $t4, $t4, 8 # Pointer to the first character of the string + xor $t5, $t5, $t5 # Initializing counter + while_copy_name_start: + beq $t5, $t2, while_copy_name_end + lb $t6, 0($t3) # Loading the character + sb $t6, 0($t4) + addi $t4, $t4, 1 # Incrementing the pointer to the new string + addi $t3, $t3, 1 # Incrementing the pointer to the string in self + addi $t5, $t5, 1 # Incrementing counter + j while_copy_name_start + while_copy_name_end: + + sb $zero, 0($t4) # Setting the null byte + + sw $v0, 0($sp) # Storing the new string in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_copy_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = copy of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 4($t0) # $t2 = length of self in bytes + + # Allocating space for the new object + li $v0, 9 + move $a0, $t2 + syscall + move $t3, $v0 # $t3 = direction of the new object + sw $t1, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + # Initializing the variable of the loop + addi $t0, $t0, 8 # Pointer to the first character of the object + addi $t3, $t3, 8 # Pointer to the first character of the object + addi $t2, $2, -8 # Decrementing in 8 the length of the object + xor $t4, $t4, $t4 # Initializing counter + + # Loop copying the object + while_copy_start: + beq $t4, $t2, while_copy_end + lb $t5, 0($t0) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t0, $t0, 1 # Incrementing the pointer to the object + addi $t3, $t3, 1 # Incrementing the pointer to the new object + addi $t4, $t4, 1 # Incrementing counter + j while_copy_start + while_copy_end: + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_IO: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_out_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + lw $t0, 0($sp) # $t0 = x + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the String x + li $v0, 4 + move $a0, $t0 + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_out_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + # Printing the Int x + li $v0, 1 + lw $a0, 0($sp) + lw $a0, 8($a0) + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_in_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + li $v0, 8 + la $a0, buffer_input + li $a1, 1024 + syscall + + xor $t0, $t0, $t0 # Initializing counter + while_read_start: + lb $t1, buffer_input($t0) # Loading the byte + addi $t2, $zero, 10 + beq $t1, $t2, while_read_end + addi $t2, $zero, 13 + beq $t1, $t2, while_read_end + addi $t0, $t0, 1 # Incrementing counter + j while_read_start + while_read_end: + + addi $t0, $t0, 9 # Adding space for the type, the size and the null byte + li $v0, 9 + move $a0, $t0 + syscall + addi $t0, $t0, -9 # Adding space for the type, the size and the null byte + la $t2, type_String + sw $t2, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t3, $v0, 8 # Pointer to the first character of the string + xor $t4, $t4, $t4 # Initializing counter + + while_copy_from_buffer_start: + beq $t4, $t0, while_copy_from_buffer_end + lb $t5, buffer_input($t4) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t3, $t3, 1 # Imcremeenting pointer + addi $t4, $t4, 1 # Incrementing counter + j while_copy_from_buffer_start + while_copy_from_buffer_end: + + sb $zero, 0($t3) # Storing the null byte + + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_in_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + li $v0, 5 + syscall + lw $t0, 0($sp) + sw $v0, 8($t0) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_String: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_length_at_String: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # internal_0 = length of self + lw $t0, 4($sp) + lw $t1, 4($t0) + addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator + lw $t0, 0($sp) + sw $t1, 8($t0) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_concat_at_String: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + # s = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self + s + lw $t0, 8($sp) + lw $t1, 4($sp) + lw $t2, 4($t0) # $t2 = length of str1 + lw $t3, 4($t1) # $t3 = length of str2 + addi $t2, $t2, -9 + addi $t3, $t3, -9 + add $t4, $t2, $t3 # $t4 = length of str1 + str2 + addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) + + li $v0, 9 + move $a0, $t4 + syscall + addi $t4, $t4, -9 # Restoring $t4 = length of str1 + str2 + add $t5, $zero, $v0 # $t5 = address of the new string object + addi $t5, $t5, 8 # $t5 = address of the first byte of the new string + + la $t8, type_String + sw $t8, 0($v0) # Setting type in the first word of th object + + sw $a0, 4($v0) # Setting length of the string in the second word of the object + + # Copying str1 to the new string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_str1_start: + beq $t6, $t2, while_copy_str1_end + lb $t7, 8($t0) + sb $t7, 0($t5) + add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str1_start + while_copy_str1_end: + + # Copying str2 to the new string + while_copy_str2_start: + beq $t6, $t4, while_copy_str2_end + lb $t7, 8($t1) + sb $t7, 0($t5) + add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str2_start + while_copy_str2_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self + s + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_substr_at_String: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + # i = 8($sp) + # l = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self[i:i + l] + lw $t0, 12($sp) # $t0 = address of the string + lw $t1, 4($t0) # $t1 = length of the string + addi $t1, $t1, -9 # $t1 = length of the string + 9 + lw $t2, 8($sp) # $t2 = start of the substring + lw $t2, 8($t2) + lw $t3, 4($sp) # $t3 = length of the substring + lw $t3, 8($t3) + add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring + + bgt $t4, $t1, substring_out_of_bounds + + addi $t3, $t3, 9 + li $v0, 9 + move $a0, $t3 + syscall + addi $t3, $t3, -9 + + la $t5, type_String + sw $t5, 0($v0) # Setting type in the first word of the object + + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t0, $t0, 8 # pointing to the first byte of the string + add $t0, $t0, $t2 # pointing to the first byte of the substring + move $t5, $v0 # $t5 = address of the new string + add $t5, $t5, 8 # pointing to the first byte of the string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_substr_start: + beq $t6, $t3, while_copy_substr_end + lb $t7, 0($t0) + sb $t7, 0($t5) + addi $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of the string + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_substr_start + while_copy_substr_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self[i:i + l] + j substring_not_out_of_bounds + + substring_out_of_bounds: + li $v0, 17 + addi $a0, $zero, 1 + syscall + + substring_not_out_of_bounds: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_Int: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function___init___at_Bool: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function___init___at_A2I: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_c2i_at_A2I: + # Function parameters + # $ra = 224($sp) + # self = 220($sp) + # char = 216($sp) + + # Reserving space for local variables + addi $sp, $sp, -216 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 208($sp) # internal_1 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 48 + sb $t0, 8($v0) # internal_2[0] = '0' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 204($sp) # internal_2 = "0" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument char + lw $t0, 228($sp) + sw $t0, 4($sp) # Storing char + + # Argument internal_2 + lw $t0, 216($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 212($sp) # internal_3 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_1 = internal_3 + lw $t0, 200($sp) + sw $t0, 208($sp) + + # If internal_1 then goto then_8743499620654 + lw $t0, 208($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743499620654 + + # Jumping to else_8743499620654 + j else_8743499620654 + + then_8743499620654: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 196($sp) # internal_4 = address of allocated object Int + + # internal_0 = internal_4 + lw $t0, 196($sp) + sw $t0, 212($sp) + + # Jumping to endif_8743499620654 + j endif_8743499620654 + + else_8743499620654: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 188($sp) # internal_6 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 49 + sb $t0, 8($v0) # internal_7[0] = '1' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 184($sp) # internal_7 = "1" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument char + lw $t0, 228($sp) + sw $t0, 4($sp) # Storing char + + # Argument internal_7 + lw $t0, 196($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 192($sp) # internal_8 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_6 = internal_8 + lw $t0, 180($sp) + sw $t0, 188($sp) + + # If internal_6 then goto then_8743499620648 + lw $t0, 188($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743499620648 + + # Jumping to else_8743499620648 + j else_8743499620648 + + then_8743499620648: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 176($sp) # internal_9 = address of allocated object Int + + # internal_5 = internal_9 + lw $t0, 176($sp) + sw $t0, 192($sp) + + # Jumping to endif_8743499620648 + j endif_8743499620648 + + else_8743499620648: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 168($sp) # internal_11 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 50 + sb $t0, 8($v0) # internal_12[0] = '2' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 164($sp) # internal_12 = "2" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument char + lw $t0, 228($sp) + sw $t0, 4($sp) # Storing char + + # Argument internal_12 + lw $t0, 176($sp) + sw $t0, 0($sp) # Storing internal_12 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 172($sp) # internal_13 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_11 = internal_13 + lw $t0, 160($sp) + sw $t0, 168($sp) + + # If internal_11 then goto then_8743499620642 + lw $t0, 168($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743499620642 + + # Jumping to else_8743499620642 + j else_8743499620642 + + then_8743499620642: + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 156($sp) # internal_14 = address of allocated object Int + + # internal_10 = internal_14 + lw $t0, 156($sp) + sw $t0, 172($sp) + + # Jumping to endif_8743499620642 + j endif_8743499620642 + + else_8743499620642: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 148($sp) # internal_16 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 51 + sb $t0, 8($v0) # internal_17[0] = '3' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 144($sp) # internal_17 = "3" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument char + lw $t0, 228($sp) + sw $t0, 4($sp) # Storing char + + # Argument internal_17 + lw $t0, 156($sp) + sw $t0, 0($sp) # Storing internal_17 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 152($sp) # internal_18 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_16 = internal_18 + lw $t0, 140($sp) + sw $t0, 148($sp) + + # If internal_16 then goto then_8743499620636 + lw $t0, 148($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743499620636 + + # Jumping to else_8743499620636 + j else_8743499620636 + + then_8743499620636: + + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 136($sp) # internal_19 = address of allocated object Int + + # internal_15 = internal_19 + lw $t0, 136($sp) + sw $t0, 152($sp) + + # Jumping to endif_8743499620636 + j endif_8743499620636 + + else_8743499620636: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 128($sp) # internal_21 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 52 + sb $t0, 8($v0) # internal_22[0] = '4' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 124($sp) # internal_22 = "4" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument char + lw $t0, 228($sp) + sw $t0, 4($sp) # Storing char + + # Argument internal_22 + lw $t0, 136($sp) + sw $t0, 0($sp) # Storing internal_22 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 132($sp) # internal_23 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_21 = internal_23 + lw $t0, 120($sp) + sw $t0, 128($sp) + + # If internal_21 then goto then_8743499620630 + lw $t0, 128($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743499620630 + + # Jumping to else_8743499620630 + j else_8743499620630 + + then_8743499620630: + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 116($sp) # internal_24 = address of allocated object Int + + # internal_20 = internal_24 + lw $t0, 116($sp) + sw $t0, 132($sp) + + # Jumping to endif_8743499620630 + j endif_8743499620630 + + else_8743499620630: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 108($sp) # internal_26 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 53 + sb $t0, 8($v0) # internal_27[0] = '5' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 104($sp) # internal_27 = "5" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument char + lw $t0, 228($sp) + sw $t0, 4($sp) # Storing char + + # Argument internal_27 + lw $t0, 116($sp) + sw $t0, 0($sp) # Storing internal_27 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 112($sp) # internal_28 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_26 = internal_28 + lw $t0, 100($sp) + sw $t0, 108($sp) + + # If internal_26 then goto then_8743499620624 + lw $t0, 108($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743499620624 + + # Jumping to else_8743499620624 + j else_8743499620624 + + then_8743499620624: + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 96($sp) # internal_29 = address of allocated object Int + + # internal_25 = internal_29 + lw $t0, 96($sp) + sw $t0, 112($sp) + + # Jumping to endif_8743499620624 + j endif_8743499620624 + + else_8743499620624: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 88($sp) # internal_31 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 54 + sb $t0, 8($v0) # internal_32[0] = '6' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 84($sp) # internal_32 = "6" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument char + lw $t0, 228($sp) + sw $t0, 4($sp) # Storing char + + # Argument internal_32 + lw $t0, 96($sp) + sw $t0, 0($sp) # Storing internal_32 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 92($sp) # internal_33 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_31 = internal_33 + lw $t0, 80($sp) + sw $t0, 88($sp) + + # If internal_31 then goto then_8743499620618 + lw $t0, 88($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743499620618 + + # Jumping to else_8743499620618 + j else_8743499620618 + + then_8743499620618: + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 76($sp) # internal_34 = address of allocated object Int + + # internal_30 = internal_34 + lw $t0, 76($sp) + sw $t0, 92($sp) + + # Jumping to endif_8743499620618 + j endif_8743499620618 + + else_8743499620618: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 68($sp) # internal_36 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 55 + sb $t0, 8($v0) # internal_37[0] = '7' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 64($sp) # internal_37 = "7" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument char + lw $t0, 228($sp) + sw $t0, 4($sp) # Storing char + + # Argument internal_37 + lw $t0, 76($sp) + sw $t0, 0($sp) # Storing internal_37 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 72($sp) # internal_38 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_36 = internal_38 + lw $t0, 60($sp) + sw $t0, 68($sp) + + # If internal_36 then goto then_8743499620612 + lw $t0, 68($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743499620612 + + # Jumping to else_8743499620612 + j else_8743499620612 + + then_8743499620612: + + # Allocating Int 7 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 7 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 56($sp) # internal_39 = address of allocated object Int + + # internal_35 = internal_39 + lw $t0, 56($sp) + sw $t0, 72($sp) + + # Jumping to endif_8743499620612 + j endif_8743499620612 + + else_8743499620612: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 48($sp) # internal_41 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 56 + sb $t0, 8($v0) # internal_42[0] = '8' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 44($sp) # internal_42 = "8" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument char + lw $t0, 228($sp) + sw $t0, 4($sp) # Storing char + + # Argument internal_42 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_42 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 52($sp) # internal_43 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_41 = internal_43 + lw $t0, 40($sp) + sw $t0, 48($sp) + + # If internal_41 then goto then_8743499619578 + lw $t0, 48($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743499619578 + + # Jumping to else_8743499619578 + j else_8743499619578 + + then_8743499619578: + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_44 = address of allocated object Int + + # internal_40 = internal_44 + lw $t0, 36($sp) + sw $t0, 52($sp) + + # Jumping to endif_8743499619578 + j endif_8743499619578 + + else_8743499619578: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_46 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 57 + sb $t0, 8($v0) # internal_47[0] = '9' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 24($sp) # internal_47 = "9" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument char + lw $t0, 228($sp) + sw $t0, 4($sp) # Storing char + + # Argument internal_47 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_47 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 32($sp) # internal_48 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_46 = internal_48 + lw $t0, 20($sp) + sw $t0, 28($sp) + + # If internal_46 then goto then_8743499619557 + lw $t0, 28($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743499619557 + + # Jumping to else_8743499619557 + j else_8743499619557 + + then_8743499619557: + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_49 = address of allocated object Int + + # internal_45 = internal_49 + lw $t0, 16($sp) + sw $t0, 32($sp) + + # Jumping to endif_8743499619557 + j endif_8743499619557 + + else_8743499619557: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_51 = address of allocated object Int + + # Get method abort of A2I + lw $t0, 220($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 8($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 4($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 228($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_52 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_50 = result of internal_52 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_53 = address of allocated object Int + + # internal_45 = internal_53 + lw $t0, 0($sp) + sw $t0, 32($sp) + + # Jumping to endif_8743499619557 + j endif_8743499619557 + + endif_8743499619557: + + # internal_40 = internal_45 + lw $t0, 32($sp) + sw $t0, 52($sp) + + # Jumping to endif_8743499619578 + j endif_8743499619578 + + endif_8743499619578: + + # internal_35 = internal_40 + lw $t0, 52($sp) + sw $t0, 72($sp) + + # Jumping to endif_8743499620612 + j endif_8743499620612 + + endif_8743499620612: + + # internal_30 = internal_35 + lw $t0, 72($sp) + sw $t0, 92($sp) + + # Jumping to endif_8743499620618 + j endif_8743499620618 + + endif_8743499620618: + + # internal_25 = internal_30 + lw $t0, 92($sp) + sw $t0, 112($sp) + + # Jumping to endif_8743499620624 + j endif_8743499620624 + + endif_8743499620624: + + # internal_20 = internal_25 + lw $t0, 112($sp) + sw $t0, 132($sp) + + # Jumping to endif_8743499620630 + j endif_8743499620630 + + endif_8743499620630: + + # internal_15 = internal_20 + lw $t0, 132($sp) + sw $t0, 152($sp) + + # Jumping to endif_8743499620636 + j endif_8743499620636 + + endif_8743499620636: + + # internal_10 = internal_15 + lw $t0, 152($sp) + sw $t0, 172($sp) + + # Jumping to endif_8743499620642 + j endif_8743499620642 + + endif_8743499620642: + + # internal_5 = internal_10 + lw $t0, 172($sp) + sw $t0, 192($sp) + + # Jumping to endif_8743499620648 + j endif_8743499620648 + + endif_8743499620648: + + # internal_0 = internal_5 + lw $t0, 192($sp) + sw $t0, 212($sp) + + # Jumping to endif_8743499620654 + j endif_8743499620654 + + endif_8743499620654: + + # Loading return value in $v1 + lw $v1, 212($sp) + + # Freeing space for local variables + addi $sp, $sp, 216 + + jr $ra + + function_i2c_at_A2I: + # Function parameters + # $ra = 224($sp) + # self = 220($sp) + # i = 216($sp) + + # Reserving space for local variables + addi $sp, $sp, -216 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 208($sp) # internal_1 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 204($sp) # internal_2 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 228($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_2 + lw $t0, 216($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 212($sp) # internal_3 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_1 = internal_3 + lw $t0, 200($sp) + sw $t0, 208($sp) + + # If internal_1 then goto then_8743499621488 + lw $t0, 208($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743499621488 + + # Jumping to else_8743499621488 + j else_8743499621488 + + then_8743499621488: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 48 + sb $t0, 8($v0) # internal_4[0] = '0' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 196($sp) # internal_4 = "0" + + # internal_0 = internal_4 + lw $t0, 196($sp) + sw $t0, 212($sp) + + # Jumping to endif_8743499621488 + j endif_8743499621488 + + else_8743499621488: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 188($sp) # internal_6 = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 184($sp) # internal_7 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 228($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_7 + lw $t0, 196($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 192($sp) # internal_8 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_6 = internal_8 + lw $t0, 180($sp) + sw $t0, 188($sp) + + # If internal_6 then goto then_8743499621482 + lw $t0, 188($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743499621482 + + # Jumping to else_8743499621482 + j else_8743499621482 + + then_8743499621482: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 49 + sb $t0, 8($v0) # internal_9[0] = '1' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 176($sp) # internal_9 = "1" + + # internal_5 = internal_9 + lw $t0, 176($sp) + sw $t0, 192($sp) + + # Jumping to endif_8743499621482 + j endif_8743499621482 + + else_8743499621482: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 168($sp) # internal_11 = address of allocated object Int + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 164($sp) # internal_12 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 228($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_12 + lw $t0, 176($sp) + sw $t0, 0($sp) # Storing internal_12 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 172($sp) # internal_13 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_11 = internal_13 + lw $t0, 160($sp) + sw $t0, 168($sp) + + # If internal_11 then goto then_8743499621476 + lw $t0, 168($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743499621476 + + # Jumping to else_8743499621476 + j else_8743499621476 + + then_8743499621476: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 50 + sb $t0, 8($v0) # internal_14[0] = '2' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 156($sp) # internal_14 = "2" + + # internal_10 = internal_14 + lw $t0, 156($sp) + sw $t0, 172($sp) + + # Jumping to endif_8743499621476 + j endif_8743499621476 + + else_8743499621476: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 148($sp) # internal_16 = address of allocated object Int + + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 144($sp) # internal_17 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 228($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_17 + lw $t0, 156($sp) + sw $t0, 0($sp) # Storing internal_17 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 152($sp) # internal_18 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_16 = internal_18 + lw $t0, 140($sp) + sw $t0, 148($sp) + + # If internal_16 then goto then_8743499621470 + lw $t0, 148($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743499621470 + + # Jumping to else_8743499621470 + j else_8743499621470 + + then_8743499621470: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 51 + sb $t0, 8($v0) # internal_19[0] = '3' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 136($sp) # internal_19 = "3" + + # internal_15 = internal_19 + lw $t0, 136($sp) + sw $t0, 152($sp) + + # Jumping to endif_8743499621470 + j endif_8743499621470 + + else_8743499621470: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 128($sp) # internal_21 = address of allocated object Int + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 124($sp) # internal_22 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 228($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_22 + lw $t0, 136($sp) + sw $t0, 0($sp) # Storing internal_22 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 132($sp) # internal_23 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_21 = internal_23 + lw $t0, 120($sp) + sw $t0, 128($sp) + + # If internal_21 then goto then_8743499621464 + lw $t0, 128($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743499621464 + + # Jumping to else_8743499621464 + j else_8743499621464 + + then_8743499621464: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 52 + sb $t0, 8($v0) # internal_24[0] = '4' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 116($sp) # internal_24 = "4" + + # internal_20 = internal_24 + lw $t0, 116($sp) + sw $t0, 132($sp) + + # Jumping to endif_8743499621464 + j endif_8743499621464 + + else_8743499621464: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 108($sp) # internal_26 = address of allocated object Int + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 104($sp) # internal_27 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 228($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_27 + lw $t0, 116($sp) + sw $t0, 0($sp) # Storing internal_27 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 112($sp) # internal_28 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_26 = internal_28 + lw $t0, 100($sp) + sw $t0, 108($sp) + + # If internal_26 then goto then_8743499621458 + lw $t0, 108($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743499621458 + + # Jumping to else_8743499621458 + j else_8743499621458 + + then_8743499621458: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 53 + sb $t0, 8($v0) # internal_29[0] = '5' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 96($sp) # internal_29 = "5" + + # internal_25 = internal_29 + lw $t0, 96($sp) + sw $t0, 112($sp) + + # Jumping to endif_8743499621458 + j endif_8743499621458 + + else_8743499621458: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 88($sp) # internal_31 = address of allocated object Int + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 84($sp) # internal_32 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 228($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_32 + lw $t0, 96($sp) + sw $t0, 0($sp) # Storing internal_32 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 92($sp) # internal_33 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_31 = internal_33 + lw $t0, 80($sp) + sw $t0, 88($sp) + + # If internal_31 then goto then_8743499621452 + lw $t0, 88($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743499621452 + + # Jumping to else_8743499621452 + j else_8743499621452 + + then_8743499621452: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 54 + sb $t0, 8($v0) # internal_34[0] = '6' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 76($sp) # internal_34 = "6" + + # internal_30 = internal_34 + lw $t0, 76($sp) + sw $t0, 92($sp) + + # Jumping to endif_8743499621452 + j endif_8743499621452 + + else_8743499621452: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 68($sp) # internal_36 = address of allocated object Int + + # Allocating Int 7 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 7 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 64($sp) # internal_37 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 228($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_37 + lw $t0, 76($sp) + sw $t0, 0($sp) # Storing internal_37 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 72($sp) # internal_38 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_36 = internal_38 + lw $t0, 60($sp) + sw $t0, 68($sp) + + # If internal_36 then goto then_8743499621446 + lw $t0, 68($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743499621446 + + # Jumping to else_8743499621446 + j else_8743499621446 + + then_8743499621446: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 55 + sb $t0, 8($v0) # internal_39[0] = '7' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 56($sp) # internal_39 = "7" + + # internal_35 = internal_39 + lw $t0, 56($sp) + sw $t0, 72($sp) + + # Jumping to endif_8743499621446 + j endif_8743499621446 + + else_8743499621446: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 48($sp) # internal_41 = address of allocated object Int + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_42 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 228($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_42 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_42 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 52($sp) # internal_43 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_41 = internal_43 + lw $t0, 40($sp) + sw $t0, 48($sp) + + # If internal_41 then goto then_8743499621440 + lw $t0, 48($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743499621440 + + # Jumping to else_8743499621440 + j else_8743499621440 + + then_8743499621440: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 56 + sb $t0, 8($v0) # internal_44[0] = '8' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 36($sp) # internal_44 = "8" + + # internal_40 = internal_44 + lw $t0, 36($sp) + sw $t0, 52($sp) + + # Jumping to endif_8743499621440 + j endif_8743499621440 + + else_8743499621440: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_46 = address of allocated object Int + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # internal_47 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 228($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_47 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_47 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 32($sp) # internal_48 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_46 = internal_48 + lw $t0, 20($sp) + sw $t0, 28($sp) + + # If internal_46 then goto then_8743499621419 + lw $t0, 28($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743499621419 + + # Jumping to else_8743499621419 + j else_8743499621419 + + then_8743499621419: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 57 + sb $t0, 8($v0) # internal_49[0] = '9' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 16($sp) # internal_49 = "9" + + # internal_45 = internal_49 + lw $t0, 16($sp) + sw $t0, 32($sp) + + # Jumping to endif_8743499621419 + j endif_8743499621419 + + else_8743499621419: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_51 = address of allocated object Int + + # Get method abort of A2I + lw $t0, 220($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 8($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 4($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 228($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_52 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_50 = result of internal_52 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 9 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 9 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + sb $zero, 8($v0) # Null-terminator at the end of the string + + sw $v0, 0($sp) # internal_53 = "" + + # internal_45 = internal_53 + lw $t0, 0($sp) + sw $t0, 32($sp) + + # Jumping to endif_8743499621419 + j endif_8743499621419 + + endif_8743499621419: + + # internal_40 = internal_45 + lw $t0, 32($sp) + sw $t0, 52($sp) + + # Jumping to endif_8743499621440 + j endif_8743499621440 + + endif_8743499621440: + + # internal_35 = internal_40 + lw $t0, 52($sp) + sw $t0, 72($sp) + + # Jumping to endif_8743499621446 + j endif_8743499621446 + + endif_8743499621446: + + # internal_30 = internal_35 + lw $t0, 72($sp) + sw $t0, 92($sp) + + # Jumping to endif_8743499621452 + j endif_8743499621452 + + endif_8743499621452: + + # internal_25 = internal_30 + lw $t0, 92($sp) + sw $t0, 112($sp) + + # Jumping to endif_8743499621458 + j endif_8743499621458 + + endif_8743499621458: + + # internal_20 = internal_25 + lw $t0, 112($sp) + sw $t0, 132($sp) + + # Jumping to endif_8743499621464 + j endif_8743499621464 + + endif_8743499621464: + + # internal_15 = internal_20 + lw $t0, 132($sp) + sw $t0, 152($sp) + + # Jumping to endif_8743499621470 + j endif_8743499621470 + + endif_8743499621470: + + # internal_10 = internal_15 + lw $t0, 152($sp) + sw $t0, 172($sp) + + # Jumping to endif_8743499621476 + j endif_8743499621476 + + endif_8743499621476: + + # internal_5 = internal_10 + lw $t0, 172($sp) + sw $t0, 192($sp) + + # Jumping to endif_8743499621482 + j endif_8743499621482 + + endif_8743499621482: + + # internal_0 = internal_5 + lw $t0, 192($sp) + sw $t0, 212($sp) + + # Jumping to endif_8743499621488 + j endif_8743499621488 + + endif_8743499621488: + + # Loading return value in $v1 + lw $v1, 212($sp) + + # Freeing space for local variables + addi $sp, $sp, 216 + + jr $ra + + function_a2i_at_A2I: + # Function parameters + # $ra = 232($sp) + # self = 228($sp) + # s = 224($sp) + + # Reserving space for local variables + addi $sp, $sp, -224 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 216($sp) # internal_1 = address of allocated object Int + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 208($sp) # internal_3 = address of allocated object Int + + # Get method length of String + lw $t0, 224($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 208($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 204($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument s + lw $t0, 232($sp) + sw $t0, 0($sp) # Storing s + + # Calling function internal_4 + lw $t0, 212($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 220($sp) # internal_2 = result of internal_4 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 200($sp) # internal_5 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_5 + lw $t0, 212($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 208($sp) # internal_6 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_1 = internal_6 + lw $t0, 196($sp) + sw $t0, 216($sp) + + # If internal_1 then goto then_8743499622190 + lw $t0, 216($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743499622190 + + # Jumping to else_8743499622190 + j else_8743499622190 + + then_8743499622190: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 192($sp) # internal_7 = address of allocated object Int + + # internal_0 = internal_7 + lw $t0, 192($sp) + sw $t0, 220($sp) + + # Jumping to endif_8743499622190 + j endif_8743499622190 + + else_8743499622190: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 184($sp) # internal_9 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 180($sp) # internal_10 = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 176($sp) # internal_11 = address of allocated object Int + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 168($sp) # internal_13 = address of allocated object Int + + # Get method substr of String + lw $t0, 224($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 168($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 164($sp) + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument s + lw $t0, 240($sp) + sw $t0, 8($sp) # Storing s + + # Argument internal_10 + lw $t0, 196($sp) + sw $t0, 4($sp) # Storing internal_10 + + # Argument internal_11 + lw $t0, 192($sp) + sw $t0, 0($sp) # Storing internal_11 + + # Calling function internal_14 + lw $t0, 180($sp) + jalr $t0 + lw $ra, 12($sp) + sw $v1, 188($sp) # internal_12 = result of internal_14 + addi $sp, $sp, 16 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 45 + sb $t0, 8($v0) # internal_15[0] = '-' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 160($sp) # internal_15 = "-" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_12 + lw $t0, 184($sp) + sw $t0, 4($sp) # Storing internal_12 + + # Argument internal_15 + lw $t0, 172($sp) + sw $t0, 0($sp) # Storing internal_15 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 168($sp) # internal_16 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_9 = internal_16 + lw $t0, 156($sp) + sw $t0, 184($sp) + + # If internal_9 then goto then_8743499622205 + lw $t0, 184($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743499622205 + + # Jumping to else_8743499622205 + j else_8743499622205 + + then_8743499622205: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 152($sp) # internal_17 = address of allocated object Int + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 144($sp) # internal_19 = address of allocated object Int + + # Get method length of String + lw $t0, 224($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 144($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 140($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument s + lw $t0, 232($sp) + sw $t0, 0($sp) # Storing s + + # Calling function internal_20 + lw $t0, 148($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 156($sp) # internal_18 = result of internal_20 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 136($sp) # internal_21 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_18 + lw $t0, 160($sp) + sw $t0, 4($sp) # Storing internal_18 + + # Argument internal_21 + lw $t0, 148($sp) + sw $t0, 0($sp) # Storing internal_21 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 144($sp) # internal_22 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 124($sp) # internal_24 = address of allocated object Int + + # Get method substr of String + lw $t0, 224($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 124($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 120($sp) + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument s + lw $t0, 240($sp) + sw $t0, 8($sp) # Storing s + + # Argument internal_17 + lw $t0, 168($sp) + sw $t0, 4($sp) # Storing internal_17 + + # Argument internal_22 + lw $t0, 148($sp) + sw $t0, 0($sp) # Storing internal_22 + + # Calling function internal_25 + lw $t0, 136($sp) + jalr $t0 + lw $ra, 12($sp) + sw $v1, 144($sp) # internal_23 = result of internal_25 + addi $sp, $sp, 16 # Freeing space for arguments + + # Allocating Int 7 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 7 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 112($sp) # internal_27 = address of allocated object Int + + # Get method a2i_aux of A2I + lw $t0, 228($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 112($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 108($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 240($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_23 + lw $t0, 140($sp) + sw $t0, 0($sp) # Storing internal_23 + + # Calling function internal_28 + lw $t0, 120($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 128($sp) # internal_26 = result of internal_28 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 104($sp) # internal_29 = address of allocated object Int + + # Allocating Int 4294967295 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4294967295 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 100($sp) # internal_30 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 96($sp) # internal_31 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_26 + lw $t0, 128($sp) + sw $t0, 4($sp) # Storing internal_26 + + # Argument internal_30 + lw $t0, 112($sp) + sw $t0, 0($sp) # Storing internal_30 + + # Calling function function_xor + jal function_xor + lw $ra, 8($sp) + sw $v1, 108($sp) # internal_31 = result of function_xor + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_31 + lw $t0, 108($sp) + sw $t0, 4($sp) # Storing internal_31 + + # Argument internal_29 + lw $t0, 116($sp) + sw $t0, 0($sp) # Storing internal_29 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 108($sp) # internal_31 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_8 = internal_31 + lw $t0, 96($sp) + sw $t0, 188($sp) + + # Jumping to endif_8743499622205 + j endif_8743499622205 + + else_8743499622205: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 88($sp) # internal_33 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 84($sp) # internal_34 = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 80($sp) # internal_35 = address of allocated object Int + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 72($sp) # internal_37 = address of allocated object Int + + # Get method substr of String + lw $t0, 224($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 72($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 68($sp) + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument s + lw $t0, 240($sp) + sw $t0, 8($sp) # Storing s + + # Argument internal_34 + lw $t0, 100($sp) + sw $t0, 4($sp) # Storing internal_34 + + # Argument internal_35 + lw $t0, 96($sp) + sw $t0, 0($sp) # Storing internal_35 + + # Calling function internal_38 + lw $t0, 84($sp) + jalr $t0 + lw $ra, 12($sp) + sw $v1, 92($sp) # internal_36 = result of internal_38 + addi $sp, $sp, 16 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 43 + sb $t0, 8($v0) # internal_39[0] = '+' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 64($sp) # internal_39 = "+" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_36 + lw $t0, 88($sp) + sw $t0, 4($sp) # Storing internal_36 + + # Argument internal_39 + lw $t0, 76($sp) + sw $t0, 0($sp) # Storing internal_39 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 72($sp) # internal_40 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_33 = internal_40 + lw $t0, 60($sp) + sw $t0, 88($sp) + + # If internal_33 then goto then_8743499622199 + lw $t0, 88($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743499622199 + + # Jumping to else_8743499622199 + j else_8743499622199 + + then_8743499622199: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 56($sp) # internal_41 = address of allocated object Int + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 48($sp) # internal_43 = address of allocated object Int + + # Get method length of String + lw $t0, 224($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 48($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 44($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument s + lw $t0, 232($sp) + sw $t0, 0($sp) # Storing s + + # Calling function internal_44 + lw $t0, 52($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 60($sp) # internal_42 = result of internal_44 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_45 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_42 + lw $t0, 64($sp) + sw $t0, 4($sp) # Storing internal_42 + + # Argument internal_45 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_45 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 48($sp) # internal_46 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_48 = address of allocated object Int + + # Get method substr of String + lw $t0, 224($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 28($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 24($sp) + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument s + lw $t0, 240($sp) + sw $t0, 8($sp) # Storing s + + # Argument internal_41 + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing internal_41 + + # Argument internal_46 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_46 + + # Calling function internal_49 + lw $t0, 40($sp) + jalr $t0 + lw $ra, 12($sp) + sw $v1, 48($sp) # internal_47 = result of internal_49 + addi $sp, $sp, 16 # Freeing space for arguments + + # Allocating Int 7 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 7 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_51 = address of allocated object Int + + # Get method a2i_aux of A2I + lw $t0, 228($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 16($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 12($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 240($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_47 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_47 + + # Calling function internal_52 + lw $t0, 24($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 32($sp) # internal_50 = result of internal_52 + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_32 = internal_50 + lw $t0, 20($sp) + sw $t0, 92($sp) + + # Jumping to endif_8743499622199 + j endif_8743499622199 + + else_8743499622199: + + # Allocating Int 7 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 7 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_54 = address of allocated object Int + + # Get method a2i_aux of A2I + lw $t0, 228($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 240($sp) + sw $t0, 4($sp) # Storing self + + # Argument s + lw $t0, 236($sp) + sw $t0, 0($sp) # Storing s + + # Calling function internal_55 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_53 = result of internal_55 + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_32 = internal_53 + lw $t0, 8($sp) + sw $t0, 92($sp) + + # Jumping to endif_8743499622199 + j endif_8743499622199 + + endif_8743499622199: + + # internal_8 = internal_32 + lw $t0, 92($sp) + sw $t0, 188($sp) + + # Jumping to endif_8743499622205 + j endif_8743499622205 + + endif_8743499622205: + + # internal_0 = internal_8 + lw $t0, 188($sp) + sw $t0, 220($sp) + + # Jumping to endif_8743499622190 + j endif_8743499622190 + + endif_8743499622190: + + # Loading return value in $v1 + lw $v1, 220($sp) + + # Freeing space for local variables + addi $sp, $sp, 224 + + jr $ra + + function_a2i_aux_at_A2I: + # Function parameters + # $ra = 96($sp) + # self = 92($sp) + # s = 88($sp) + + # Reserving space for local variables + addi $sp, $sp, -88 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 80($sp) # internal_1 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument int + lw $t0, 96($sp) + sw $t0, 4($sp) # Storing int + + # Argument internal_1 + lw $t0, 92($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 96($sp) # int = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 68($sp) # internal_4 = address of allocated object Int + + # Get method length of String + lw $t0, 88($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 68($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 64($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument s + lw $t0, 96($sp) + sw $t0, 0($sp) # Storing s + + # Calling function internal_5 + lw $t0, 72($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 80($sp) # internal_3 = result of internal_5 + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument j + lw $t0, 88($sp) + sw $t0, 4($sp) # Storing j + + # Argument internal_3 + lw $t0, 84($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 88($sp) # j = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 56($sp) # internal_7 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_7 + lw $t0, 68($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 72($sp) # i = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating NUll to internal_8 + sw $zero, 52($sp) # internal_8 = 0 + + while_start_8743499622343: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing i + + # Argument j + lw $t0, 88($sp) + sw $t0, 0($sp) # Storing j + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 60($sp) # internal_9 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_9 then goto while_body_8743499622343 + lw $t0, 48($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_body_8743499622343 + + # Jumping to while_end_8743499622343 + j while_end_8743499622343 + + while_body_8743499622343: + + # Allocating Int 10 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 10 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_10 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument int + lw $t0, 96($sp) + sw $t0, 4($sp) # Storing int + + # Argument internal_10 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_10 + + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 52($sp) # internal_11 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_12 = address of allocated object Int + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_14 = address of allocated object Int + + # Get method substr of String + lw $t0, 88($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 28($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 24($sp) + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument s + lw $t0, 104($sp) + sw $t0, 8($sp) # Storing s + + # Argument i + lw $t0, 76($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_12 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_12 + + # Calling function internal_15 + lw $t0, 40($sp) + jalr $t0 + lw $ra, 12($sp) + sw $v1, 48($sp) # internal_13 = result of internal_15 + addi $sp, $sp, 16 # Freeing space for arguments + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_17 = address of allocated object Int + + # Get method c2i of A2I + lw $t0, 92($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 16($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 12($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 104($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_13 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_13 + + # Calling function internal_18 + lw $t0, 24($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 32($sp) # internal_16 = result of internal_18 + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_11 + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing internal_11 + + # Argument internal_16 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_16 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_19 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument int + lw $t0, 96($sp) + sw $t0, 4($sp) # Storing int + + # Argument internal_19 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_19 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 96($sp) # int = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_20 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_20 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_20 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_21 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_21 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_21 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 72($sp) # i = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to while_start_8743499622343 + j while_start_8743499622343 + + while_end_8743499622343: + + # Loading return value in $v1 + lw $v1, 84($sp) + + # Freeing space for local variables + addi $sp, $sp, 88 + + jr $ra + + function_i2a_at_A2I: + # Function parameters + # $ra = 104($sp) + # self = 100($sp) + # i = 96($sp) + + # Reserving space for local variables + addi $sp, $sp, -96 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 88($sp) # internal_1 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 84($sp) # internal_2 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 108($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_2 + lw $t0, 96($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 92($sp) # internal_3 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_1 = internal_3 + lw $t0, 80($sp) + sw $t0, 88($sp) + + # If internal_1 then goto then_8743499622988 + lw $t0, 88($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743499622988 + + # Jumping to else_8743499622988 + j else_8743499622988 + + then_8743499622988: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 48 + sb $t0, 8($v0) # internal_4[0] = '0' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 76($sp) # internal_4 = "0" + + # internal_0 = internal_4 + lw $t0, 76($sp) + sw $t0, 92($sp) + + # Jumping to endif_8743499622988 + j endif_8743499622988 + + else_8743499622988: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 68($sp) # internal_6 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 64($sp) # internal_7 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_7 + lw $t0, 76($sp) + sw $t0, 4($sp) # Storing internal_7 + + # Argument i + lw $t0, 108($sp) + sw $t0, 0($sp) # Storing i + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 72($sp) # internal_8 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_6 = internal_8 + lw $t0, 60($sp) + sw $t0, 68($sp) + + # If internal_6 then goto then_8743499622994 + lw $t0, 68($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743499622994 + + # Jumping to else_8743499622994 + j else_8743499622994 + + then_8743499622994: + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 52($sp) # internal_10 = address of allocated object Int + + # Get method i2a_aux of A2I + lw $t0, 100($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 52($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 48($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 112($sp) + sw $t0, 4($sp) # Storing self + + # Argument i + lw $t0, 108($sp) + sw $t0, 0($sp) # Storing i + + # Calling function internal_11 + lw $t0, 60($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 68($sp) # internal_9 = result of internal_11 + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_5 = internal_9 + lw $t0, 56($sp) + sw $t0, 72($sp) + + # Jumping to endif_8743499622994 + j endif_8743499622994 + + else_8743499622994: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 45 + sb $t0, 8($v0) # internal_12[0] = '-' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 44($sp) # internal_12 = "-" + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_13 = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_14 = address of allocated object Int + + # Allocating Int 4294967295 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4294967295 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_15 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_16 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_13 + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing internal_13 + + # Argument internal_15 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_15 + + # Calling function function_xor + jal function_xor + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_16 = result of function_xor + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_16 + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing internal_16 + + # Argument internal_14 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_14 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_16 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 108($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_16 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_16 + + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_17 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_19 = address of allocated object Int + + # Get method i2a_aux of A2I + lw $t0, 100($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 16($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 12($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 112($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_17 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_17 + + # Calling function internal_20 + lw $t0, 24($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 32($sp) # internal_18 = result of internal_20 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_22 = address of allocated object Int + + # Get method concat of String + lw $t0, 44($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_12 + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing internal_12 + + # Argument internal_18 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_18 + + # Calling function internal_23 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_21 = result of internal_23 + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_5 = internal_21 + lw $t0, 8($sp) + sw $t0, 72($sp) + + # Jumping to endif_8743499622994 + j endif_8743499622994 + + endif_8743499622994: + + # internal_0 = internal_5 + lw $t0, 72($sp) + sw $t0, 92($sp) + + # Jumping to endif_8743499622988 + j endif_8743499622988 + + endif_8743499622988: + + # Loading return value in $v1 + lw $v1, 92($sp) + + # Freeing space for local variables + addi $sp, $sp, 96 + + jr $ra + + function_i2a_aux_at_A2I: + # Function parameters + # $ra = 88($sp) + # self = 84($sp) + # i = 80($sp) + + # Reserving space for local variables + addi $sp, $sp, -80 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 72($sp) # internal_1 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 68($sp) # internal_2 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 92($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_2 + lw $t0, 80($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 76($sp) # internal_3 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_1 = internal_3 + lw $t0, 64($sp) + sw $t0, 72($sp) + + # If internal_1 then goto then_8743499623102 + lw $t0, 72($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8743499623102 + + # Jumping to else_8743499623102 + j else_8743499623102 + + then_8743499623102: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 9 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 9 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + sb $zero, 8($v0) # Null-terminator at the end of the string + + sw $v0, 60($sp) # internal_4 = "" + + # internal_0 = internal_4 + lw $t0, 60($sp) + sw $t0, 76($sp) + + # Jumping to endif_8743499623102 + j endif_8743499623102 + + else_8743499623102: + + # Allocating Int 10 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 10 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 52($sp) # internal_6 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 92($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_6 + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing internal_6 + + # Calling function function_div + jal function_div + lw $ra, 8($sp) + sw $v1, 60($sp) # internal_7 = result of function_div + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument next + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing next + + # Argument internal_7 + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 68($sp) # next = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_9 = address of allocated object Int + + # Get method i2a_aux of A2I + lw $t0, 84($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 40($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 36($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 96($sp) + sw $t0, 4($sp) # Storing self + + # Argument next + lw $t0, 68($sp) + sw $t0, 0($sp) # Storing next + + # Calling function internal_10 + lw $t0, 48($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 56($sp) # internal_8 = result of internal_10 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 10 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 10 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_11 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument next + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing next + + # Argument internal_11 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_11 + + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_12 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 92($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_12 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_12 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_13 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_15 = address of allocated object Int + + # Get method i2c of A2I + lw $t0, 84($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 16($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 12($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 96($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_13 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_13 + + # Calling function internal_16 + lw $t0, 24($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 32($sp) # internal_14 = result of internal_16 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_18 = address of allocated object Int + + # Get method concat of String + lw $t0, 44($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_8 + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing internal_8 + + # Argument internal_14 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_14 + + # Calling function internal_19 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_17 = result of internal_19 + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_0 = internal_17 + lw $t0, 8($sp) + sw $t0, 76($sp) + + # Jumping to endif_8743499623102 + j endif_8743499623102 + + endif_8743499623102: + + # Loading return value in $v1 + lw $v1, 76($sp) + + # Freeing space for local variables + addi $sp, $sp, 80 + + jr $ra + + function___init___at_Main: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_main_at_Main: + # Function parameters + # $ra = 108($sp) + # self = 104($sp) + + # Reserving space for local variables + addi $sp, $sp, -104 + + # Allocating A2I + li $v0, 9 + lw $a0, type_A2I + syscall + la $t0, type_A2I # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 96($sp) # internal_1 = address of allocated object A2I + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_1 + lw $t0, 104($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function___init___at_A2I + jal function___init___at_A2I + lw $ra, 4($sp) + sw $v1, 104($sp) # internal_1 = result of function___init___at_A2I + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 15 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 15 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 54 + sb $t0, 8($v0) # internal_2[0] = '6' + + addi $t0, $zero, 55 + sb $t0, 9($v0) # internal_2[1] = '7' + + addi $t0, $zero, 56 + sb $t0, 10($v0) # internal_2[2] = '8' + + addi $t0, $zero, 57 + sb $t0, 11($v0) # internal_2[3] = '9' + + addi $t0, $zero, 56 + sb $t0, 12($v0) # internal_2[4] = '8' + + addi $t0, $zero, 55 + sb $t0, 13($v0) # internal_2[5] = '7' + + sb $zero, 14($v0) # Null-terminator at the end of the string + + sw $v0, 92($sp) # internal_2 = "678987" + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 84($sp) # internal_4 = address of allocated object Int + + # Get method a2i of A2I + lw $t0, 96($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 84($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 80($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_1 + lw $t0, 108($sp) + sw $t0, 4($sp) # Storing internal_1 + + # Argument internal_2 + lw $t0, 104($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function internal_5 + lw $t0, 92($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 100($sp) # internal_3 = result of internal_5 + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument a + lw $t0, 112($sp) + sw $t0, 4($sp) # Storing a + + # Argument internal_3 + lw $t0, 100($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 112($sp) # a = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating A2I + li $v0, 9 + lw $a0, type_A2I + syscall + la $t0, type_A2I # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 72($sp) # internal_7 = address of allocated object A2I + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_7 + lw $t0, 80($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function function___init___at_A2I + jal function___init___at_A2I + lw $ra, 4($sp) + sw $v1, 80($sp) # internal_7 = result of function___init___at_A2I + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 678987 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 678987 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 68($sp) # internal_8 = address of allocated object Int + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 60($sp) # internal_10 = address of allocated object Int + + # Get method i2a of A2I + lw $t0, 72($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 60($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 56($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_7 + lw $t0, 84($sp) + sw $t0, 4($sp) # Storing internal_7 + + # Argument internal_8 + lw $t0, 80($sp) + sw $t0, 0($sp) # Storing internal_8 + + # Calling function internal_11 + lw $t0, 68($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 76($sp) # internal_9 = result of internal_11 + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument b + lw $t0, 88($sp) + sw $t0, 4($sp) # Storing b + + # Argument internal_9 + lw $t0, 76($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 88($sp) # b = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 48($sp) # internal_13 = address of allocated object Int + + # Get method out_int of Main + lw $t0, 104($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 48($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 44($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 116($sp) + sw $t0, 4($sp) # Storing self + + # Argument a + lw $t0, 112($sp) + sw $t0, 0($sp) # Storing a + + # Calling function internal_14 + lw $t0, 56($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 64($sp) # internal_12 = result of internal_14 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 13 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 13 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_15[0] = ' ' + + addi $t0, $zero, 61 + sb $t0, 9($v0) # internal_15[1] = '=' + + addi $t0, $zero, 61 + sb $t0, 10($v0) # internal_15[2] = '=' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_15[3] = ' ' + + sb $zero, 12($v0) # Null-terminator at the end of the string + + sw $v0, 40($sp) # internal_15 = " == " + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_17 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 104($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 32($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 28($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 116($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_15 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_15 + + # Calling function internal_18 + lw $t0, 40($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 48($sp) # internal_16 = result of internal_18 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_20 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 104($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 20($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 16($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 116($sp) + sw $t0, 4($sp) # Storing self + + # Argument b + lw $t0, 88($sp) + sw $t0, 0($sp) # Storing b + + # Calling function internal_21 + lw $t0, 28($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_19 = result of internal_21 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_22[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_22 = "\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_24 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 104($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 116($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_22 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_22 + + # Calling function internal_25 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_23 = result of internal_25 + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 104 + + jr $ra + + main: + # Reserving space for local variables + addi $sp, $sp, -16 + + # Allocating Main + li $v0, 9 + lw $a0, type_Main + syscall + la $t0, type_Main # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 12($sp) # internal_0 = address of allocated object Main + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_Main + jal function___init___at_Main + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_0 = result of function___init___at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_2 = address of allocated object Int + + # Get method main of Main + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function internal_3 + lw $t0, 8($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_1 = result of internal_3 + addi $sp, $sp, 8 # Freeing space for arguments + + # Exit program + li $v0, 10 + syscall + + \ No newline at end of file diff --git a/tests/codegen/atoi_output.txt b/tests/codegen/atoi_output.txt index 51b815a48..c51d7bad6 100644 --- a/tests/codegen/atoi_output.txt +++ b/tests/codegen/atoi_output.txt @@ -1 +1 @@ -678987 == 678987 +678987 == 678987 diff --git a/tests/codegen/book_list.cl b/tests/codegen/book_list.cl index 025ea1695..d39f86bbe 100755 --- a/tests/codegen/book_list.cl +++ b/tests/codegen/book_list.cl @@ -1,132 +1,132 @@ --- example of static and dynamic type differing for a dispatch - -Class Book inherits IO { - title : String; - author : String; - - initBook(title_p : String, author_p : String) : Book { - { - title <- title_p; - author <- author_p; - self; - } - }; - - print() : Book { - { - out_string("title: ").out_string(title).out_string("\n"); - out_string("author: ").out_string(author).out_string("\n"); - self; - } - }; -}; - -Class Article inherits Book { - per_title : String; - - initArticle(title_p : String, author_p : String, - per_title_p : String) : Article { - { - initBook(title_p, author_p); - per_title <- per_title_p; - self; - } - }; - - print() : Book { - { - self@Book.print(); - out_string("periodical: ").out_string(per_title).out_string("\n"); - self; - } - }; -}; - -Class BookList inherits IO { - (* Since abort "returns" type Object, we have to add - an expression of type Bool here to satisfy the typechecker. - This code is unreachable, since abort() halts the program. - *) - isNil() : Bool { { abort(); true; } }; - - cons(hd : Book) : Cons { - (let new_cell : Cons <- new Cons in - new_cell.init(hd,self) - ) - }; - - (* Since abort "returns" type Object, we have to add - an expression of type Book here to satisfy the typechecker. - This code is unreachable, since abort() halts the program. - *) - car() : Book { { abort(); new Book; } }; - - (* Since abort "returns" type Object, we have to add - an expression of type BookList here to satisfy the typechecker. - This code is unreachable, since abort() halts the program. - *) - cdr() : BookList { { abort(); new BookList; } }; - - print_list() : Object { abort() }; -}; - -Class Cons inherits BookList { - xcar : Book; -- We keep the car and cdr in attributes. - xcdr : BookList; -- Because methods and features must have different names, - -- we use xcar and xcdr for the attributes and reserve - -- car and cdr for the features. - - isNil() : Bool { false }; - - init(hd : Book, tl : BookList) : Cons { - { - xcar <- hd; - xcdr <- tl; - self; - } - }; - - car() : Book { xcar }; - - cdr() : BookList { xcdr }; - - print_list() : Object { - { - case xcar.print() of - dummy : Book => out_string("- dynamic type was Book -\n"); - dummy : Article => out_string("- dynamic type was Article -\n"); - esac; - xcdr.print_list(); - } - }; -}; - -Class Nil inherits BookList { - isNil() : Bool { true }; - - print_list() : Object { true }; -}; - - -Class Main { - - books : BookList; - - main() : Object { - (let a_book : Book <- - (new Book).initBook("Compilers, Principles, Techniques, and Tools", - "Aho, Sethi, and Ullman") - in - (let an_article : Article <- - (new Article).initArticle("The Top 100 CD_ROMs", - "Ulanoff", - "PC Magazine") - in - { - books <- (new Nil).cons(a_book).cons(an_article); - books.print_list(); - } - ) -- end let an_article - ) -- end let a_book - }; -}; +-- example of static and dynamic type differing for a dispatch + +Class Book inherits IO { + title : String; + author : String; + + initBook(title_p : String, author_p : String) : Book { + { + title <- title_p; + author <- author_p; + self; + } + }; + + print() : Book { + { + out_string("title: ").out_string(title).out_string("\n"); + out_string("author: ").out_string(author).out_string("\n"); + self; + } + }; +}; + +Class Article inherits Book { + per_title : String; + + initArticle(title_p : String, author_p : String, + per_title_p : String) : Article { + { + initBook(title_p, author_p); + per_title <- per_title_p; + self; + } + }; + + print() : Book { + { + self@Book.print(); + out_string("periodical: ").out_string(per_title).out_string("\n"); + self; + } + }; +}; + +Class BookList inherits IO { + (* Since abort "returns" type Object, we have to add + an expression of type Bool here to satisfy the typechecker. + This code is unreachable, since abort() halts the program. + *) + isNil() : Bool { { abort(); true; } }; + + cons(hd : Book) : Cons { + (let new_cell : Cons <- new Cons in + new_cell.init(hd,self) + ) + }; + + (* Since abort "returns" type Object, we have to add + an expression of type Book here to satisfy the typechecker. + This code is unreachable, since abort() halts the program. + *) + car() : Book { { abort(); new Book; } }; + + (* Since abort "returns" type Object, we have to add + an expression of type BookList here to satisfy the typechecker. + This code is unreachable, since abort() halts the program. + *) + cdr() : BookList { { abort(); new BookList; } }; + + print_list() : Object { abort() }; +}; + +Class Cons inherits BookList { + xcar : Book; -- We keep the car and cdr in attributes. + xcdr : BookList; -- Because methods and features must have different names, + -- we use xcar and xcdr for the attributes and reserve + -- car and cdr for the features. + + isNil() : Bool { false }; + + init(hd : Book, tl : BookList) : Cons { + { + xcar <- hd; + xcdr <- tl; + self; + } + }; + + car() : Book { xcar }; + + cdr() : BookList { xcdr }; + + print_list() : Object { + { + case xcar.print() of + dummy : Book => out_string("- dynamic type was Book -\n"); + dummy : Article => out_string("- dynamic type was Article -\n"); + esac; + xcdr.print_list(); + } + }; +}; + +Class Nil inherits BookList { + isNil() : Bool { true }; + + print_list() : Object { true }; +}; + + +Class Main { + + books : BookList; + + main() : Object { + (let a_book : Book <- + (new Book).initBook("Compilers, Principles, Techniques, and Tools", + "Aho, Sethi, and Ullman") + in + (let an_article : Article <- + (new Article).initArticle("The Top 100 CD_ROMs", + "Ulanoff", + "PC Magazine") + in + { + books <- (new Nil).cons(a_book).cons(an_article); + books.print_list(); + } + ) -- end let an_article + ) -- end let a_book + }; +}; diff --git a/tests/codegen/book_list.mips b/tests/codegen/book_list.mips new file mode 100644 index 000000000..70d280afd --- /dev/null +++ b/tests/codegen/book_list.mips @@ -0,0 +1,5934 @@ +.data + type_Object: .word 24 + type_Object_inherits_from: .word 0 + type_Object_name_address: .word type_Object_name_size + type_Object___init__: .word function___init___at_Object + type_Object_abort: .word function_abort_at_Object + type_Object_type_name: .word function_type_name_at_Object + type_Object_copy: .word function_copy_at_Object + + type_IO: .word 40 + type_IO_inherits_from: .word type_Object + type_IO_name_address: .word type_IO_name_size + type_IO___init__: .word function___init___at_IO + type_IO_abort: .word function_abort_at_Object + type_IO_type_name: .word function_type_name_at_Object + type_IO_copy: .word function_copy_at_Object + type_IO_out_string: .word function_out_string_at_IO + type_IO_out_int: .word function_out_int_at_IO + type_IO_in_string: .word function_in_string_at_IO + type_IO_in_int: .word function_in_int_at_IO + + type_String: .word 36 + type_String_inherits_from: .word type_Object + type_String_name_address: .word type_String_name_size + type_String___init__: .word function___init___at_String + type_String_abort: .word function_abort_at_Object + type_String_type_name: .word function_type_name_at_Object + type_String_copy: .word function_copy_at_Object + type_String_length: .word function_length_at_String + type_String_concat: .word function_concat_at_String + type_String_substr: .word function_substr_at_String + + type_Int: .word 24 + type_Int_inherits_from: .word type_Object + type_Int_name_address: .word type_Int_name_size + type_Int___init__: .word function___init___at_Int + type_Int_abort: .word function_abort_at_Object + type_Int_type_name: .word function_type_name_at_Object + type_Int_copy: .word function_copy_at_Object + + type_Bool: .word 24 + type_Bool_inherits_from: .word type_Object + type_Bool_name_address: .word type_Bool_name_size + type_Bool___init__: .word function___init___at_Bool + type_Bool_abort: .word function_abort_at_Object + type_Bool_type_name: .word function_type_name_at_Object + type_Bool_copy: .word function_copy_at_Object + + type_Book: .word 56 + type_Book_inherits_from: .word type_IO + type_Book_name_address: .word type_Book_name_size + type_Book___init__: .word function___init___at_Book + type_Book_abort: .word function_abort_at_Object + type_Book_type_name: .word function_type_name_at_Object + type_Book_copy: .word function_copy_at_Object + type_Book_out_string: .word function_out_string_at_IO + type_Book_out_int: .word function_out_int_at_IO + type_Book_in_string: .word function_in_string_at_IO + type_Book_in_int: .word function_in_int_at_IO + type_Book_initBook: .word function_initBook_at_Book + type_Book_print: .word function_print_at_Book + + type_Article: .word 64 + type_Article_inherits_from: .word type_Book + type_Article_name_address: .word type_Article_name_size + type_Article___init__: .word function___init___at_Article + type_Article_abort: .word function_abort_at_Object + type_Article_type_name: .word function_type_name_at_Object + type_Article_copy: .word function_copy_at_Object + type_Article_out_string: .word function_out_string_at_IO + type_Article_out_int: .word function_out_int_at_IO + type_Article_in_string: .word function_in_string_at_IO + type_Article_in_int: .word function_in_int_at_IO + type_Article_initBook: .word function_initBook_at_Book + type_Article_print: .word function_print_at_Article + type_Article_initArticle: .word function_initArticle_at_Article + + type_BookList: .word 60 + type_BookList_inherits_from: .word type_IO + type_BookList_name_address: .word type_BookList_name_size + type_BookList___init__: .word function___init___at_BookList + type_BookList_abort: .word function_abort_at_Object + type_BookList_type_name: .word function_type_name_at_Object + type_BookList_copy: .word function_copy_at_Object + type_BookList_out_string: .word function_out_string_at_IO + type_BookList_out_int: .word function_out_int_at_IO + type_BookList_in_string: .word function_in_string_at_IO + type_BookList_in_int: .word function_in_int_at_IO + type_BookList_isNil: .word function_isNil_at_BookList + type_BookList_cons: .word function_cons_at_BookList + type_BookList_car: .word function_car_at_BookList + type_BookList_cdr: .word function_cdr_at_BookList + type_BookList_print_list: .word function_print_list_at_BookList + + type_Cons: .word 72 + type_Cons_inherits_from: .word type_BookList + type_Cons_name_address: .word type_Cons_name_size + type_Cons___init__: .word function___init___at_Cons + type_Cons_abort: .word function_abort_at_Object + type_Cons_type_name: .word function_type_name_at_Object + type_Cons_copy: .word function_copy_at_Object + type_Cons_out_string: .word function_out_string_at_IO + type_Cons_out_int: .word function_out_int_at_IO + type_Cons_in_string: .word function_in_string_at_IO + type_Cons_in_int: .word function_in_int_at_IO + type_Cons_isNil: .word function_isNil_at_Cons + type_Cons_cons: .word function_cons_at_BookList + type_Cons_car: .word function_car_at_Cons + type_Cons_cdr: .word function_cdr_at_Cons + type_Cons_print_list: .word function_print_list_at_Cons + type_Cons_init: .word function_init_at_Cons + + type_Nil: .word 60 + type_Nil_inherits_from: .word type_BookList + type_Nil_name_address: .word type_Nil_name_size + type_Nil___init__: .word function___init___at_Nil + type_Nil_abort: .word function_abort_at_Object + type_Nil_type_name: .word function_type_name_at_Object + type_Nil_copy: .word function_copy_at_Object + type_Nil_out_string: .word function_out_string_at_IO + type_Nil_out_int: .word function_out_int_at_IO + type_Nil_in_string: .word function_in_string_at_IO + type_Nil_in_int: .word function_in_int_at_IO + type_Nil_isNil: .word function_isNil_at_Nil + type_Nil_cons: .word function_cons_at_BookList + type_Nil_car: .word function_car_at_BookList + type_Nil_cdr: .word function_cdr_at_BookList + type_Nil_print_list: .word function_print_list_at_Nil + + type_Main: .word 32 + type_Main_inherits_from: .word type_Object + type_Main_name_address: .word type_Main_name_size + type_Main___init__: .word function___init___at_Main + type_Main_abort: .word function_abort_at_Object + type_Main_type_name: .word function_type_name_at_Object + type_Main_copy: .word function_copy_at_Object + type_Main_main: .word function_main_at_Main + + type_Object_name_size: .word 6 + type_Object_name: .asciiz "Object" + + type_IO_name_size: .word 2 + type_IO_name: .asciiz "IO" + + type_String_name_size: .word 6 + type_String_name: .asciiz "String" + + type_Int_name_size: .word 3 + type_Int_name: .asciiz "Int" + + type_Bool_name_size: .word 4 + type_Bool_name: .asciiz "Bool" + + type_Book_name_size: .word 4 + type_Book_name: .asciiz "Book" + + type_Article_name_size: .word 7 + type_Article_name: .asciiz "Article" + + type_BookList_name_size: .word 8 + type_BookList_name: .asciiz "BookList" + + type_Cons_name_size: .word 4 + type_Cons_name: .asciiz "Cons" + + type_Nil_name_size: .word 3 + type_Nil_name: .asciiz "Nil" + + type_Main_name_size: .word 4 + type_Main_name: .asciiz "Main" + + buffer_input: .space 1024 + debug_log: .asciiz "debug_log\n" + +.text + function_add: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Addition operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + add $t2, $t0, $t1 # $t2 = $t0 + $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_sub: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Subtraction operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sub $t2, $t0, $t1 # $t2 = $t0 - $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_mult: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Multiplication operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + mult $t0, $t1 # $t2 = $t0 * $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_div: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Division operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + div $t0, $t1 # $t2 = $t0 / $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_xor: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Xor operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than_or_equal: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sle $t2, $t0, $t1 # $t2 = $t0 <= $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_equal: + # Function parameters + # $ra = 48($sp) + # a = 44($sp) + # b = 40($sp) + + # Reserving space for local variables + addi $sp, $sp, -40 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_0 = address of allocated object Int + + # Allocating NUll to internal_1 + sw $zero, 32($sp) # internal_1 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_2 = address of allocated object Int + + # internal_2 = EqualAddress(a, internal_1) + lw $t0, 44($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # internal_2 = EqualAddress(b, internal_1) + lw $t0, 40($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # If internal_2 then goto a_is_type_object + lw $t0, 28($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_object + + # internal_3 = typeof a that is the first word of the object + lw $t0, 44($sp) + lw $t0, 0($t0) + sw $t0, 24($sp) + + # internal_4 = direction of Int + la $t0, type_Int + sw $t0, 20($sp) + + # internal_5 = direction of Bool + la $t0, type_Bool + sw $t0, 16($sp) + + # internal_6 = direction of String + la $t0, type_String + sw $t0, 12($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_7 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_8 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_9 = address of allocated object Int + + # internal_7 = EqualAddress(internal_3, internal_4) + lw $t0, 24($sp) + lw $t1, 20($sp) + seq $t2, $t0, $t1 + lw $t0, 8($sp) + sw $t2, 8($t0) + + # internal_8 = EqualAddress(internal_3, internal_5) + lw $t0, 24($sp) + lw $t1, 16($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_9 = EqualAddress(internal_3, internal_6) + lw $t0, 24($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_7 then goto a_is_type_int_or_bool + lw $t0, 8($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_8 then goto a_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_9 then goto a_is_type_string + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_string + + # Jumping to a_is_type_object + j a_is_type_object + + a_is_type_int_or_bool: + + # internal_0 = EqualInt(a, b) + lw $t0, 44($sp) + lw $t0, 8($t0) + lw $t1, 40($sp) + lw $t1, 8($t1) + seq $t2, $t0, $t1 + lw $t0, 36($sp) + sw $t2, 8($t0) + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_string: + + # internal_0 = EqualStr(a, b) + lw $t0, 44($sp) + lw $t1, 40($sp) + addi $t0, $t0, 8 + addi $t1, $t1, 8 + + # By default we assume the strings are equals + addi $t4, $zero, 1 + lw $t5, 36($sp) + sw $t4, 8($t5) + + while_compare_strings_start: + lb $t2, 0($t0) + lb $t3, 0($t1) + beq $t2, $t3, while_compare_strings_update + + # The strings are no equals + lw $t5, 36($sp) + sw $zero, 8($t5) + j while_compare_strings_end + + while_compare_strings_update: + addi $t0, $t0, 1 + addi $t1, $t1, 1 + beq $t2, $zero, while_compare_strings_end + beq $t3, $zero, while_compare_strings_end + j while_compare_strings_start + while_compare_strings_end: + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_object: + + # Equal operation + lw $t0, 44($sp) # Save in $t0 the left operand address + lw $t1, 40($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 36($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Jumping to end_of_equal + j end_of_equal + + end_of_equal: + + # Loading return value in $v1 + lw $v1, 36($sp) + + # Freeing space for local variables + addi $sp, $sp, 40 + + jr $ra + + function_assign: + # Function parameters + # $ra = 36($sp) + # dest = 32($sp) + # source = 28($sp) + + # Reserving space for local variables + addi $sp, $sp, -28 + + # Allocating NUll to internal_0 + sw $zero, 24($sp) # internal_0 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_1 = address of allocated object Int + + # internal_1 = EqualAddress(source, internal_0) + lw $t0, 28($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # internal_1 = EqualAddress(dest, internal_0) + lw $t0, 32($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # If internal_1 then goto source_is_type_object + lw $t0, 20($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_object + + # internal_2 = typeof source that is the first word of the object + lw $t0, 28($sp) + lw $t0, 0($t0) + sw $t0, 16($sp) + + # internal_3 = direction of Int + la $t0, type_Int + sw $t0, 12($sp) + + # internal_4 = direction of Bool + la $t0, type_Bool + sw $t0, 8($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_5 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_6 = address of allocated object Int + + # internal_5 = EqualAddress(internal_2, internal_3) + lw $t0, 16($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_6 = EqualAddress(internal_2, internal_4) + lw $t0, 16($sp) + lw $t1, 8($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_5 then goto source_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # If internal_6 then goto source_is_type_int_or_bool + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # Jumping to source_is_type_object + j source_is_type_object + + source_is_type_int_or_bool: + + # dest = source where source is an integer + li $v0, 9 + addi $a0, $zero, 12 + syscall + lw $t0, 28($sp) # Pointer to source + lw $t1, 0($t0) # $t1 = type of source + lw $t2, 8($t0) # $t2 = value of source + sw $t1, 0($v0) # Save type of dest + sw $a0, 4($v0) # Save size of dest + sw $t2, 8($v0) # Save value of dest + sw $v0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_is_type_object: + + # dest = source + lw $t0, 28($sp) + sw $t0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_end_of_equal: + + # Loading return value in $v1 + lw $v1, 32($sp) + + # Freeing space for local variables + addi $sp, $sp, 28 + + jr $ra + + function___init___at_Object: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_abort_at_Object: + # Function parameters + # $ra = 28($sp) + # self = 24($sp) + + # Reserving space for local variables + addi $sp, $sp, -24 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 33 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 33 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 65 + sb $t0, 8($v0) # internal_0[0] = 'A' + + addi $t0, $zero, 98 + sb $t0, 9($v0) # internal_0[1] = 'b' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_0[2] = 'o' + + addi $t0, $zero, 114 + sb $t0, 11($v0) # internal_0[3] = 'r' + + addi $t0, $zero, 116 + sb $t0, 12($v0) # internal_0[4] = 't' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_0[5] = ' ' + + addi $t0, $zero, 99 + sb $t0, 14($v0) # internal_0[6] = 'c' + + addi $t0, $zero, 97 + sb $t0, 15($v0) # internal_0[7] = 'a' + + addi $t0, $zero, 108 + sb $t0, 16($v0) # internal_0[8] = 'l' + + addi $t0, $zero, 108 + sb $t0, 17($v0) # internal_0[9] = 'l' + + addi $t0, $zero, 101 + sb $t0, 18($v0) # internal_0[10] = 'e' + + addi $t0, $zero, 100 + sb $t0, 19($v0) # internal_0[11] = 'd' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_0[12] = ' ' + + addi $t0, $zero, 102 + sb $t0, 21($v0) # internal_0[13] = 'f' + + addi $t0, $zero, 114 + sb $t0, 22($v0) # internal_0[14] = 'r' + + addi $t0, $zero, 111 + sb $t0, 23($v0) # internal_0[15] = 'o' + + addi $t0, $zero, 109 + sb $t0, 24($v0) # internal_0[16] = 'm' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_0[17] = ' ' + + addi $t0, $zero, 99 + sb $t0, 26($v0) # internal_0[18] = 'c' + + addi $t0, $zero, 108 + sb $t0, 27($v0) # internal_0[19] = 'l' + + addi $t0, $zero, 97 + sb $t0, 28($v0) # internal_0[20] = 'a' + + addi $t0, $zero, 115 + sb $t0, 29($v0) # internal_0[21] = 's' + + addi $t0, $zero, 115 + sb $t0, 30($v0) # internal_0[22] = 's' + + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_0[23] = ' ' + + sb $zero, 32($v0) # Null-terminator at the end of the string + + sw $v0, 20($sp) # internal_0 = "Abort called from class " + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_3[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 8($sp) # internal_3 = "\n" + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method type_name of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_5 + lw $t0, 8($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 24($sp) # internal_1 = result of internal_5 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_1 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_2 = result of internal_5 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_3 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_2 = result of internal_5 + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 12($sp) # $t0 = internal_2 + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the String internal_2 + li $v0, 4 + move $a0, $t0 + syscall + + # Exit program + li $v0, 10 + syscall + + # Loading return value in $v1 + lw $v1, 24($sp) + + # Freeing space for local variables + addi $sp, $sp, 24 + + jr $ra + + function_type_name_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = name of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 8($t1) # $t2 = direction of the type name + la $t3, 4($t2) # $t3 = address of the name + lw $t2, 0($t2) # $t2 = length of the name + + addi $t2, $t2, 9 # Setting space for the type, the size and the null byte + li $v0, 9 + move $a0, $t2 + syscall + addi $t2, $t2, -9 # Restoring space for the type, the size and the null byte + + la $t4, type_String + sw $t4, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t4, $v0, 0 # $t4 = direction of the new string + addi $t4, $t4, 8 # Pointer to the first character of the string + xor $t5, $t5, $t5 # Initializing counter + while_copy_name_start: + beq $t5, $t2, while_copy_name_end + lb $t6, 0($t3) # Loading the character + sb $t6, 0($t4) + addi $t4, $t4, 1 # Incrementing the pointer to the new string + addi $t3, $t3, 1 # Incrementing the pointer to the string in self + addi $t5, $t5, 1 # Incrementing counter + j while_copy_name_start + while_copy_name_end: + + sb $zero, 0($t4) # Setting the null byte + + sw $v0, 0($sp) # Storing the new string in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_copy_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = copy of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 4($t0) # $t2 = length of self in bytes + + # Allocating space for the new object + li $v0, 9 + move $a0, $t2 + syscall + move $t3, $v0 # $t3 = direction of the new object + sw $t1, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + # Initializing the variable of the loop + addi $t0, $t0, 8 # Pointer to the first character of the object + addi $t3, $t3, 8 # Pointer to the first character of the object + addi $t2, $2, -8 # Decrementing in 8 the length of the object + xor $t4, $t4, $t4 # Initializing counter + + # Loop copying the object + while_copy_start: + beq $t4, $t2, while_copy_end + lb $t5, 0($t0) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t0, $t0, 1 # Incrementing the pointer to the object + addi $t3, $t3, 1 # Incrementing the pointer to the new object + addi $t4, $t4, 1 # Incrementing counter + j while_copy_start + while_copy_end: + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_IO: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_out_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + lw $t0, 0($sp) # $t0 = x + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the String x + li $v0, 4 + move $a0, $t0 + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_out_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + # Printing the Int x + li $v0, 1 + lw $a0, 0($sp) + lw $a0, 8($a0) + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_in_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + li $v0, 8 + la $a0, buffer_input + li $a1, 1024 + syscall + + xor $t0, $t0, $t0 # Initializing counter + while_read_start: + lb $t1, buffer_input($t0) # Loading the byte + addi $t2, $zero, 10 + beq $t1, $t2, while_read_end + addi $t2, $zero, 13 + beq $t1, $t2, while_read_end + addi $t0, $t0, 1 # Incrementing counter + j while_read_start + while_read_end: + + addi $t0, $t0, 9 # Adding space for the type, the size and the null byte + li $v0, 9 + move $a0, $t0 + syscall + addi $t0, $t0, -9 # Adding space for the type, the size and the null byte + la $t2, type_String + sw $t2, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t3, $v0, 8 # Pointer to the first character of the string + xor $t4, $t4, $t4 # Initializing counter + + while_copy_from_buffer_start: + beq $t4, $t0, while_copy_from_buffer_end + lb $t5, buffer_input($t4) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t3, $t3, 1 # Imcremeenting pointer + addi $t4, $t4, 1 # Incrementing counter + j while_copy_from_buffer_start + while_copy_from_buffer_end: + + sb $zero, 0($t3) # Storing the null byte + + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_in_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + li $v0, 5 + syscall + lw $t0, 0($sp) + sw $v0, 8($t0) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_String: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_length_at_String: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # internal_0 = length of self + lw $t0, 4($sp) + lw $t1, 4($t0) + addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator + lw $t0, 0($sp) + sw $t1, 8($t0) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_concat_at_String: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + # s = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self + s + lw $t0, 8($sp) + lw $t1, 4($sp) + lw $t2, 4($t0) # $t2 = length of str1 + lw $t3, 4($t1) # $t3 = length of str2 + addi $t2, $t2, -9 + addi $t3, $t3, -9 + add $t4, $t2, $t3 # $t4 = length of str1 + str2 + addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) + + li $v0, 9 + move $a0, $t4 + syscall + addi $t4, $t4, -9 # Restoring $t4 = length of str1 + str2 + add $t5, $zero, $v0 # $t5 = address of the new string object + addi $t5, $t5, 8 # $t5 = address of the first byte of the new string + + la $t8, type_String + sw $t8, 0($v0) # Setting type in the first word of th object + + sw $a0, 4($v0) # Setting length of the string in the second word of the object + + # Copying str1 to the new string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_str1_start: + beq $t6, $t2, while_copy_str1_end + lb $t7, 8($t0) + sb $t7, 0($t5) + add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str1_start + while_copy_str1_end: + + # Copying str2 to the new string + while_copy_str2_start: + beq $t6, $t4, while_copy_str2_end + lb $t7, 8($t1) + sb $t7, 0($t5) + add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str2_start + while_copy_str2_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self + s + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_substr_at_String: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + # i = 8($sp) + # l = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self[i:i + l] + lw $t0, 12($sp) # $t0 = address of the string + lw $t1, 4($t0) # $t1 = length of the string + addi $t1, $t1, -9 # $t1 = length of the string + 9 + lw $t2, 8($sp) # $t2 = start of the substring + lw $t2, 8($t2) + lw $t3, 4($sp) # $t3 = length of the substring + lw $t3, 8($t3) + add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring + + bgt $t4, $t1, substring_out_of_bounds + + addi $t3, $t3, 9 + li $v0, 9 + move $a0, $t3 + syscall + addi $t3, $t3, -9 + + la $t5, type_String + sw $t5, 0($v0) # Setting type in the first word of the object + + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t0, $t0, 8 # pointing to the first byte of the string + add $t0, $t0, $t2 # pointing to the first byte of the substring + move $t5, $v0 # $t5 = address of the new string + add $t5, $t5, 8 # pointing to the first byte of the string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_substr_start: + beq $t6, $t3, while_copy_substr_end + lb $t7, 0($t0) + sb $t7, 0($t5) + addi $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of the string + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_substr_start + while_copy_substr_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self[i:i + l] + j substring_not_out_of_bounds + + substring_out_of_bounds: + li $v0, 17 + addi $a0, $zero, 1 + syscall + + substring_not_out_of_bounds: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_Int: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function___init___at_Bool: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function___init___at_Book: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + + # Reserving space for local variables + addi $sp, $sp, -8 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 9 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 9 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + sb $zero, 8($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_0 = "" + + # Set attribute title of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 4($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8728344732944 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8728344732944 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8728344732944 + j object_set_attribute_8728344732944 + int_set_attribute_8728344732944: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.title = internal_0 + j end_set_attribute_8728344732944 + bool_set_attribute_8728344732944: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.title = internal_0 + j end_set_attribute_8728344732944 + object_set_attribute_8728344732944: + sw $t1, 8($t0) # self.title = internal_0 + end_set_attribute_8728344732944: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 9 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 9 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + sb $zero, 8($v0) # Null-terminator at the end of the string + + sw $v0, 0($sp) # internal_1 = "" + + # Set attribute author of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_1 + beq $t1, $zero, object_set_attribute_8728344732965 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8728344732965 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8728344732965 + j object_set_attribute_8728344732965 + int_set_attribute_8728344732965: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.author = internal_1 + j end_set_attribute_8728344732965 + bool_set_attribute_8728344732965: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.author = internal_1 + j end_set_attribute_8728344732965 + object_set_attribute_8728344732965: + sw $t1, 12($t0) # self.author = internal_1 + end_set_attribute_8728344732965: + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 8 + + jr $ra + + function_initBook_at_Book: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + # title_p = 4($sp) + # author_p = 0($sp) + + # Set attribute title of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 4($sp) # $t1 = title_p + beq $t1, $zero, object_set_attribute_8728344733016 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8728344733016 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8728344733016 + j object_set_attribute_8728344733016 + int_set_attribute_8728344733016: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.title = title_p + j end_set_attribute_8728344733016 + bool_set_attribute_8728344733016: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.title = title_p + j end_set_attribute_8728344733016 + object_set_attribute_8728344733016: + sw $t1, 8($t0) # self.title = title_p + end_set_attribute_8728344733016: + + # Set attribute author of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = author_p + beq $t1, $zero, object_set_attribute_8728344733025 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8728344733025 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8728344733025 + j object_set_attribute_8728344733025 + int_set_attribute_8728344733025: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.author = author_p + j end_set_attribute_8728344733025 + bool_set_attribute_8728344733025: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.author = author_p + j end_set_attribute_8728344733025 + object_set_attribute_8728344733025: + sw $t1, 12($t0) # self.author = author_p + end_set_attribute_8728344733025: + + # Loading return value in $v1 + lw $v1, 8($sp) + + jr $ra + + function_print_at_Book: + # Function parameters + # $ra = 100($sp) + # self = 96($sp) + + # Reserving space for local variables + addi $sp, $sp, -96 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 21 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 21 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 116 + sb $t0, 8($v0) # internal_0[0] = 't' + + addi $t0, $zero, 105 + sb $t0, 9($v0) # internal_0[1] = 'i' + + addi $t0, $zero, 116 + sb $t0, 10($v0) # internal_0[2] = 't' + + addi $t0, $zero, 108 + sb $t0, 11($v0) # internal_0[3] = 'l' + + addi $t0, $zero, 101 + sb $t0, 12($v0) # internal_0[4] = 'e' + + addi $t0, $zero, 58 + sb $t0, 13($v0) # internal_0[5] = ':' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_0[6] = ' ' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_0[7] = ' ' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_0[8] = ' ' + + addi $t0, $zero, 32 + sb $t0, 17($v0) # internal_0[9] = ' ' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_0[10] = ' ' + + addi $t0, $zero, 32 + sb $t0, 19($v0) # internal_0[11] = ' ' + + sb $zero, 20($v0) # Null-terminator at the end of the string + + sw $v0, 92($sp) # internal_0 = "title: " + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 84($sp) # internal_2 = address of allocated object Int + + # Get method out_string of Book + lw $t0, 96($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 84($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 80($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 108($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_0 + lw $t0, 104($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function internal_3 + lw $t0, 92($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 100($sp) # internal_1 = result of internal_3 + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute title of self + lw $t0, 96($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'title' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8728344733139 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8728344733139 + j object_get_attribute_8728344733139 + int_get_attribute_8728344733139: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 76($sp) # internal_4 = self.title + j end_get_attribute_8728344733139 + bool_get_attribute_8728344733139: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 76($sp) # internal_4 = self.title + j end_get_attribute_8728344733139 + object_get_attribute_8728344733139: + sw $t1, 76($sp) # internal_4 = self.title + end_get_attribute_8728344733139: + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 68($sp) # internal_6 = address of allocated object Int + + # Get method out_string of Book + lw $t0, 88($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 68($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 64($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_1 + lw $t0, 100($sp) + sw $t0, 4($sp) # Storing internal_1 + + # Argument internal_4 + lw $t0, 88($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function internal_7 + lw $t0, 76($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 84($sp) # internal_5 = result of internal_7 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_8[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 60($sp) # internal_8 = "\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 52($sp) # internal_10 = address of allocated object Int + + # Get method out_string of Book + lw $t0, 72($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 52($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 48($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_5 + lw $t0, 84($sp) + sw $t0, 4($sp) # Storing internal_5 + + # Argument internal_8 + lw $t0, 72($sp) + sw $t0, 0($sp) # Storing internal_8 + + # Calling function internal_11 + lw $t0, 60($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 68($sp) # internal_9 = result of internal_11 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 21 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 21 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 97 + sb $t0, 8($v0) # internal_12[0] = 'a' + + addi $t0, $zero, 117 + sb $t0, 9($v0) # internal_12[1] = 'u' + + addi $t0, $zero, 116 + sb $t0, 10($v0) # internal_12[2] = 't' + + addi $t0, $zero, 104 + sb $t0, 11($v0) # internal_12[3] = 'h' + + addi $t0, $zero, 111 + sb $t0, 12($v0) # internal_12[4] = 'o' + + addi $t0, $zero, 114 + sb $t0, 13($v0) # internal_12[5] = 'r' + + addi $t0, $zero, 58 + sb $t0, 14($v0) # internal_12[6] = ':' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_12[7] = ' ' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_12[8] = ' ' + + addi $t0, $zero, 32 + sb $t0, 17($v0) # internal_12[9] = ' ' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_12[10] = ' ' + + addi $t0, $zero, 32 + sb $t0, 19($v0) # internal_12[11] = ' ' + + sb $zero, 20($v0) # Null-terminator at the end of the string + + sw $v0, 44($sp) # internal_12 = "author: " + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_14 = address of allocated object Int + + # Get method out_string of Book + lw $t0, 96($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 36($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 32($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 108($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_12 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_12 + + # Calling function internal_15 + lw $t0, 44($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 52($sp) # internal_13 = result of internal_15 + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute author of self + lw $t0, 96($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'author' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8728344734347 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8728344734347 + j object_get_attribute_8728344734347 + int_get_attribute_8728344734347: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 28($sp) # internal_16 = self.author + j end_get_attribute_8728344734347 + bool_get_attribute_8728344734347: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 28($sp) # internal_16 = self.author + j end_get_attribute_8728344734347 + object_get_attribute_8728344734347: + sw $t1, 28($sp) # internal_16 = self.author + end_get_attribute_8728344734347: + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_18 = address of allocated object Int + + # Get method out_string of Book + lw $t0, 40($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 20($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 16($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_13 + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing internal_13 + + # Argument internal_16 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_16 + + # Calling function internal_19 + lw $t0, 28($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_17 = result of internal_19 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_20[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_20 = "\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_22 = address of allocated object Int + + # Get method out_string of Book + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_17 + lw $t0, 36($sp) + sw $t0, 4($sp) # Storing internal_17 + + # Argument internal_20 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_20 + + # Calling function internal_23 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_21 = result of internal_23 + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 96($sp) + + # Freeing space for local variables + addi $sp, $sp, 96 + + jr $ra + + function___init___at_Article: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + + # Reserving space for local variables + addi $sp, $sp, -12 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 9 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 9 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + sb $zero, 8($v0) # Null-terminator at the end of the string + + sw $v0, 8($sp) # internal_0 = "" + + # Set attribute title of self + lw $t0, 12($sp) # $t0 = self + lw $t1, 8($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8728344734458 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8728344734458 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8728344734458 + j object_set_attribute_8728344734458 + int_set_attribute_8728344734458: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.title = internal_0 + j end_set_attribute_8728344734458 + bool_set_attribute_8728344734458: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.title = internal_0 + j end_set_attribute_8728344734458 + object_set_attribute_8728344734458: + sw $t1, 8($t0) # self.title = internal_0 + end_set_attribute_8728344734458: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 9 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 9 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + sb $zero, 8($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_1 = "" + + # Set attribute author of self + lw $t0, 12($sp) # $t0 = self + lw $t1, 4($sp) # $t1 = internal_1 + beq $t1, $zero, object_set_attribute_8728344732441 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8728344732441 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8728344732441 + j object_set_attribute_8728344732441 + int_set_attribute_8728344732441: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.author = internal_1 + j end_set_attribute_8728344732441 + bool_set_attribute_8728344732441: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.author = internal_1 + j end_set_attribute_8728344732441 + object_set_attribute_8728344732441: + sw $t1, 12($t0) # self.author = internal_1 + end_set_attribute_8728344732441: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 9 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 9 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + sb $zero, 8($v0) # Null-terminator at the end of the string + + sw $v0, 0($sp) # internal_2 = "" + + # Set attribute per_title of self + lw $t0, 12($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_2 + beq $t1, $zero, object_set_attribute_8728344732462 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8728344732462 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8728344732462 + j object_set_attribute_8728344732462 + int_set_attribute_8728344732462: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.per_title = internal_2 + j end_set_attribute_8728344732462 + bool_set_attribute_8728344732462: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.per_title = internal_2 + j end_set_attribute_8728344732462 + object_set_attribute_8728344732462: + sw $t1, 16($t0) # self.per_title = internal_2 + end_set_attribute_8728344732462: + + # Loading return value in $v1 + lw $v1, 12($sp) + + # Freeing space for local variables + addi $sp, $sp, 12 + + jr $ra + + function_initArticle_at_Article: + # Function parameters + # $ra = 28($sp) + # self = 24($sp) + # title_p = 20($sp) + # author_p = 16($sp) + # per_title_p = 12($sp) + + # Reserving space for local variables + addi $sp, $sp, -12 + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_1 = address of allocated object Int + + # Get method initBook of Article + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument self + lw $t0, 40($sp) + sw $t0, 8($sp) # Storing self + + # Argument title_p + lw $t0, 36($sp) + sw $t0, 4($sp) # Storing title_p + + # Argument author_p + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing author_p + + # Calling function internal_2 + lw $t0, 16($sp) + jalr $t0 + lw $ra, 12($sp) + sw $v1, 24($sp) # internal_0 = result of internal_2 + addi $sp, $sp, 16 # Freeing space for arguments + + # Set attribute per_title of self + lw $t0, 24($sp) # $t0 = self + lw $t1, 12($sp) # $t1 = per_title_p + beq $t1, $zero, object_set_attribute_8728344732573 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8728344732573 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8728344732573 + j object_set_attribute_8728344732573 + int_set_attribute_8728344732573: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.per_title = per_title_p + j end_set_attribute_8728344732573 + bool_set_attribute_8728344732573: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.per_title = per_title_p + j end_set_attribute_8728344732573 + object_set_attribute_8728344732573: + sw $t1, 16($t0) # self.per_title = per_title_p + end_set_attribute_8728344732573: + + # Loading return value in $v1 + lw $v1, 24($sp) + + # Freeing space for local variables + addi $sp, $sp, 12 + + jr $ra + + function_print_at_Article: + # Function parameters + # $ra = 64($sp) + # self = 60($sp) + + # Reserving space for local variables + addi $sp, $sp, -60 + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 52($sp) # internal_1 = address of allocated object Int + + # Get method print of Book + lw $t0, 60($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 52($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 48($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 68($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_print_at_Book + jal function_print_at_Book + lw $ra, 4($sp) + sw $v1, 64($sp) # internal_0 = result of function_print_at_Book + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 22 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 22 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 112 + sb $t0, 8($v0) # internal_3[0] = 'p' + + addi $t0, $zero, 101 + sb $t0, 9($v0) # internal_3[1] = 'e' + + addi $t0, $zero, 114 + sb $t0, 10($v0) # internal_3[2] = 'r' + + addi $t0, $zero, 105 + sb $t0, 11($v0) # internal_3[3] = 'i' + + addi $t0, $zero, 111 + sb $t0, 12($v0) # internal_3[4] = 'o' + + addi $t0, $zero, 100 + sb $t0, 13($v0) # internal_3[5] = 'd' + + addi $t0, $zero, 105 + sb $t0, 14($v0) # internal_3[6] = 'i' + + addi $t0, $zero, 99 + sb $t0, 15($v0) # internal_3[7] = 'c' + + addi $t0, $zero, 97 + sb $t0, 16($v0) # internal_3[8] = 'a' + + addi $t0, $zero, 108 + sb $t0, 17($v0) # internal_3[9] = 'l' + + addi $t0, $zero, 58 + sb $t0, 18($v0) # internal_3[10] = ':' + + addi $t0, $zero, 32 + sb $t0, 19($v0) # internal_3[11] = ' ' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_3[12] = ' ' + + sb $zero, 21($v0) # Null-terminator at the end of the string + + sw $v0, 44($sp) # internal_3 = "periodical: " + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_5 = address of allocated object Int + + # Get method out_string of Article + lw $t0, 60($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 36($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 32($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_3 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function internal_6 + lw $t0, 44($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 52($sp) # internal_4 = result of internal_6 + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute per_title of self + lw $t0, 60($sp) # Get the address of self + lw $t1, 16($t0) # Get the attribute 'per_title' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8728344703037 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8728344703037 + j object_get_attribute_8728344703037 + int_get_attribute_8728344703037: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 28($sp) # internal_7 = self.per_title + j end_get_attribute_8728344703037 + bool_get_attribute_8728344703037: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 28($sp) # internal_7 = self.per_title + j end_get_attribute_8728344703037 + object_get_attribute_8728344703037: + sw $t1, 28($sp) # internal_7 = self.per_title + end_get_attribute_8728344703037: + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_9 = address of allocated object Int + + # Get method out_string of Article + lw $t0, 40($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 20($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 16($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_4 + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing internal_4 + + # Argument internal_7 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function internal_10 + lw $t0, 28($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_8 = result of internal_10 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_11[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_11 = "\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_13 = address of allocated object Int + + # Get method out_string of Article + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_8 + lw $t0, 36($sp) + sw $t0, 4($sp) # Storing internal_8 + + # Argument internal_11 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_11 + + # Calling function internal_14 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_12 = result of internal_14 + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 60($sp) + + # Freeing space for local variables + addi $sp, $sp, 60 + + jr $ra + + function___init___at_BookList: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_isNil_at_BookList: + # Function parameters + # $ra = 20($sp) + # self = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_1 = address of allocated object Int + + # Get method abort of BookList + lw $t0, 16($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 8($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 4($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_2 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_0 = result of internal_2 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Bool 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_3 = address of allocated object Int + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 + + jr $ra + + function_cons_at_BookList: + # Function parameters + # $ra = 28($sp) + # self = 24($sp) + # hd = 20($sp) + + # Reserving space for local variables + addi $sp, $sp, -20 + + # Allocating Cons + li $v0, 9 + lw $a0, type_Cons + syscall + la $t0, type_Cons # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 12($sp) # internal_1 = address of allocated object Cons + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_1 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function___init___at_Cons + jal function___init___at_Cons + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_1 = result of function___init___at_Cons + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument new_cell + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing new_cell + + # Argument internal_1 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 28($sp) # new_cell = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 13 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 13 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_3 = address of allocated object Int + + # Get method init of Cons + lw $t0, 16($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument new_cell + lw $t0, 32($sp) + sw $t0, 8($sp) # Storing new_cell + + # Argument hd + lw $t0, 36($sp) + sw $t0, 4($sp) # Storing hd + + # Argument self + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_4 + lw $t0, 16($sp) + jalr $t0 + lw $ra, 12($sp) + sw $v1, 24($sp) # internal_2 = result of internal_4 + addi $sp, $sp, 16 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 20 + + jr $ra + + function_car_at_BookList: + # Function parameters + # $ra = 20($sp) + # self = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_1 = address of allocated object Int + + # Get method abort of BookList + lw $t0, 16($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 8($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 4($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_2 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_0 = result of internal_2 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Book + li $v0, 9 + lw $a0, type_Book + syscall + la $t0, type_Book # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 0($sp) # internal_3 = address of allocated object Book + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_3 + lw $t0, 8($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function___init___at_Book + jal function___init___at_Book + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_3 = result of function___init___at_Book + addi $sp, $sp, 8 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 + + jr $ra + + function_cdr_at_BookList: + # Function parameters + # $ra = 20($sp) + # self = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_1 = address of allocated object Int + + # Get method abort of BookList + lw $t0, 16($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 8($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 4($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_2 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_0 = result of internal_2 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating BookList + li $v0, 9 + lw $a0, type_BookList + syscall + la $t0, type_BookList # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 0($sp) # internal_3 = address of allocated object BookList + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_3 + lw $t0, 8($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function___init___at_BookList + jal function___init___at_BookList + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_3 = result of function___init___at_BookList + addi $sp, $sp, 8 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 + + jr $ra + + function_print_list_at_BookList: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + + # Reserving space for local variables + addi $sp, $sp, -12 + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_1 = address of allocated object Int + + # Get method abort of BookList + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_2 + lw $t0, 8($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_0 = result of internal_2 + addi $sp, $sp, 8 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 12 + + jr $ra + + function___init___at_Cons: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + + # Reserving space for local variables + addi $sp, $sp, -8 + + # Allocating NUll to internal_0 + sw $zero, 4($sp) # internal_0 = 0 + + # Set attribute xcar of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 4($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8728344704645 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8728344704645 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8728344704645 + j object_set_attribute_8728344704645 + int_set_attribute_8728344704645: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.xcar = internal_0 + j end_set_attribute_8728344704645 + bool_set_attribute_8728344704645: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.xcar = internal_0 + j end_set_attribute_8728344704645 + object_set_attribute_8728344704645: + sw $t1, 8($t0) # self.xcar = internal_0 + end_set_attribute_8728344704645: + + # Allocating NUll to internal_1 + sw $zero, 0($sp) # internal_1 = 0 + + # Set attribute xcdr of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_1 + beq $t1, $zero, object_set_attribute_8728344704666 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8728344704666 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8728344704666 + j object_set_attribute_8728344704666 + int_set_attribute_8728344704666: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.xcdr = internal_1 + j end_set_attribute_8728344704666 + bool_set_attribute_8728344704666: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.xcdr = internal_1 + j end_set_attribute_8728344704666 + object_set_attribute_8728344704666: + sw $t1, 12($t0) # self.xcdr = internal_1 + end_set_attribute_8728344704666: + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 8 + + jr $ra + + function_isNil_at_Cons: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_init_at_Cons: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + # hd = 4($sp) + # tl = 0($sp) + + # Set attribute xcar of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 4($sp) # $t1 = hd + beq $t1, $zero, object_set_attribute_8728344704747 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8728344704747 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8728344704747 + j object_set_attribute_8728344704747 + int_set_attribute_8728344704747: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.xcar = hd + j end_set_attribute_8728344704747 + bool_set_attribute_8728344704747: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.xcar = hd + j end_set_attribute_8728344704747 + object_set_attribute_8728344704747: + sw $t1, 8($t0) # self.xcar = hd + end_set_attribute_8728344704747: + + # Set attribute xcdr of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = tl + beq $t1, $zero, object_set_attribute_8728344704756 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8728344704756 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8728344704756 + j object_set_attribute_8728344704756 + int_set_attribute_8728344704756: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.xcdr = tl + j end_set_attribute_8728344704756 + bool_set_attribute_8728344704756: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.xcdr = tl + j end_set_attribute_8728344704756 + object_set_attribute_8728344704756: + sw $t1, 12($t0) # self.xcdr = tl + end_set_attribute_8728344704756: + + # Loading return value in $v1 + lw $v1, 8($sp) + + jr $ra + + function_car_at_Cons: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Get attribute xcar of self + lw $t0, 4($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'xcar' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8728344705028 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8728344705028 + j object_get_attribute_8728344705028 + int_get_attribute_8728344705028: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_0 = self.xcar + j end_get_attribute_8728344705028 + bool_get_attribute_8728344705028: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_0 = self.xcar + j end_get_attribute_8728344705028 + object_get_attribute_8728344705028: + sw $t1, 0($sp) # internal_0 = self.xcar + end_get_attribute_8728344705028: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_cdr_at_Cons: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Get attribute xcdr of self + lw $t0, 4($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'xcdr' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8728344705058 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8728344705058 + j object_get_attribute_8728344705058 + int_get_attribute_8728344705058: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_0 = self.xcdr + j end_get_attribute_8728344705058 + bool_get_attribute_8728344705058: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_0 = self.xcdr + j end_get_attribute_8728344705058 + object_get_attribute_8728344705058: + sw $t1, 0($sp) # internal_0 = self.xcdr + end_get_attribute_8728344705058: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_print_list_at_Cons: + # Function parameters + # $ra = 224($sp) + # self = 220($sp) + + # Reserving space for local variables + addi $sp, $sp, -220 + + # Get attribute xcar of self + lw $t0, 220($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'xcar' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8728344705130 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8728344705130 + j object_get_attribute_8728344705130 + int_get_attribute_8728344705130: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 216($sp) # internal_0 = self.xcar + j end_get_attribute_8728344705130 + bool_get_attribute_8728344705130: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 216($sp) # internal_0 = self.xcar + j end_get_attribute_8728344705130 + object_get_attribute_8728344705130: + sw $t1, 216($sp) # internal_0 = self.xcar + end_get_attribute_8728344705130: + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 208($sp) # internal_2 = address of allocated object Int + + # Get method print of Book + lw $t0, 216($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 208($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 204($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 224($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function internal_3 + lw $t0, 212($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 220($sp) # internal_1 = result of internal_3 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 200($sp) # internal_4 = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 196($sp) # internal_5 = address of allocated object Int + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 192($sp) # internal_6 = address of allocated object Int + + # Allocating NUll to internal_7 + sw $zero, 188($sp) # internal_7 = 0 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 184($sp) # internal_8 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 172($sp) # internal_11 = address of allocated object Int + + # internal_9 = typeof internal_1 that is the first word of the object + lw $t0, 212($sp) + lw $t0, 0($t0) + sw $t0, 180($sp) + + # internal_10 = internal_9 + lw $t0, 180($sp) + sw $t0, 176($sp) + + while_start_8728344748960: + + # internal_11 = EqualAddress(internal_10, internal_7) + lw $t0, 176($sp) + lw $t1, 188($sp) + seq $t2, $t0, $t1 + lw $t0, 172($sp) + sw $t2, 8($t0) + + # If internal_11 then goto while_end_8728344748960 + lw $t0, 172($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_end_8728344748960 + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_8 + lw $t0, 196($sp) + sw $t0, 4($sp) # Storing internal_8 + + # Argument internal_5 + lw $t0, 208($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 196($sp) # internal_8 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_10 = ancestor of internal_10 + lw $t0, 176($sp) + lw $t0, 4($t0) + sw $t0, 176($sp) + + # Jumping to while_start_8728344748960 + j while_start_8728344748960 + + while_end_8728344748960: + + # internal_10 = internal_9 + lw $t0, 180($sp) + sw $t0, 176($sp) + + # initialize Array [internal_8] + lw $t0, 184($sp) # $t0 = internal_8 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 168($sp) # internal_12 = new Array[internal_8] + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 164($sp) # internal_13 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 160($sp) # internal_14 = address of allocated object Int + + foreach_start_8728344748960: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_13 + lw $t0, 176($sp) + sw $t0, 4($sp) # Storing internal_13 + + # Argument internal_8 + lw $t0, 196($sp) + sw $t0, 0($sp) # Storing internal_8 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 172($sp) # internal_14 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_14 then goto foreach_body_8728344748960 + lw $t0, 160($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_body_8728344748960 + + # Jumping to foreach_end_8728344748960 + j foreach_end_8728344748960 + + foreach_body_8728344748960: + + # array internal_12[4 * internal_13] = internal_10 + lw $t0, 164($sp) # $t0 = internal_13 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 168($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 176($sp) + sw $t0, 0($t1) + + # internal_10 = ancestor of internal_10 + lw $t0, 176($sp) + lw $t0, 4($t0) + sw $t0, 176($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_13 + lw $t0, 176($sp) + sw $t0, 4($sp) # Storing internal_13 + + # Argument internal_5 + lw $t0, 208($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 176($sp) # internal_13 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_start_8728344748960 + j foreach_start_8728344748960 + + foreach_end_8728344748960: + + # initialize Array [internal_6] + lw $t0, 192($sp) # $t0 = internal_6 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 156($sp) # internal_15 = new Array[internal_6] + + # initialize Array [internal_6] + lw $t0, 192($sp) # $t0 = internal_6 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 152($sp) # internal_16 = new Array[internal_6] + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 144($sp) # internal_18 = address of allocated object Int + + # internal_17 = direction of Book + la $t0, type_Book + sw $t0, 148($sp) + + # array internal_15[4 * internal_18] = internal_17 + lw $t0, 144($sp) # $t0 = internal_18 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 156($sp) # $t1 = internal_15 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 148($sp) + sw $t0, 0($t1) + + # array internal_16[4 * internal_18] = internal_8 + lw $t0, 144($sp) # $t0 = internal_18 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 152($sp) # $t1 = internal_16 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 184($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 136($sp) # internal_20 = address of allocated object Int + + # internal_19 = direction of Article + la $t0, type_Article + sw $t0, 140($sp) + + # array internal_15[4 * internal_20] = internal_19 + lw $t0, 136($sp) # $t0 = internal_20 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 156($sp) # $t1 = internal_15 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 140($sp) + sw $t0, 0($t1) + + # array internal_16[4 * internal_20] = internal_8 + lw $t0, 136($sp) # $t0 = internal_20 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 152($sp) # $t1 = internal_16 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 184($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 132($sp) # internal_21 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 128($sp) # internal_22 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 120($sp) # internal_24 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 116($sp) # internal_25 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 108($sp) # internal_27 = address of allocated object Int + + foreach_type_start_8728344748960: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_21 + lw $t0, 144($sp) + sw $t0, 4($sp) # Storing internal_21 + + # Argument internal_6 + lw $t0, 204($sp) + sw $t0, 0($sp) # Storing internal_6 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 140($sp) # internal_22 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_22 then goto foreach_type_body_8728344748960 + lw $t0, 128($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_type_body_8728344748960 + + # Jumping to foreach_type_end_8728344748960 + j foreach_type_end_8728344748960 + + foreach_type_body_8728344748960: + + # internal_23 = array internal_15[4 * internal_21] + lw $t0, 132($sp) # $t0 = internal_21 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 156($sp) # $t1 = internal_15 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + sw $t0, 124($sp) # internal_23 = array internal_15[4 * internal_21] + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_24 + lw $t0, 132($sp) + sw $t0, 4($sp) # Storing internal_24 + + # Argument internal_4 + lw $t0, 212($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 132($sp) # internal_24 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + foreach_ancestor_start_8728344748960: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_24 + lw $t0, 132($sp) + sw $t0, 4($sp) # Storing internal_24 + + # Argument internal_8 + lw $t0, 196($sp) + sw $t0, 0($sp) # Storing internal_8 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 128($sp) # internal_25 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_25 then goto foreach_ancestor_body_8728344748960 + lw $t0, 116($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_body_8728344748960 + + # Jumping to foreach_ancestor_end_8728344748960 + j foreach_ancestor_end_8728344748960 + + foreach_ancestor_body_8728344748960: + + # internal_26 = array internal_12[4 * internal_24] + lw $t0, 120($sp) # $t0 = internal_24 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 168($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + sw $t0, 112($sp) # internal_26 = array internal_12[4 * internal_24] + + # internal_27 = EqualAddress(internal_23, internal_26) + lw $t0, 124($sp) + lw $t1, 112($sp) + seq $t2, $t0, $t1 + lw $t0, 108($sp) + sw $t2, 8($t0) + + # If internal_27 then goto foreach_ancestor_end_8728344748960 + lw $t0, 108($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_end_8728344748960 + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_24 + lw $t0, 132($sp) + sw $t0, 4($sp) # Storing internal_24 + + # Argument internal_5 + lw $t0, 208($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 132($sp) # internal_24 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_ancestor_start_8728344748960 + j foreach_ancestor_start_8728344748960 + + foreach_ancestor_end_8728344748960: + + # array internal_16[4 * internal_21] = internal_24 + lw $t0, 132($sp) # $t0 = internal_21 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 152($sp) # $t1 = internal_16 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 120($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_21 + lw $t0, 144($sp) + sw $t0, 4($sp) # Storing internal_21 + + # Argument internal_5 + lw $t0, 208($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 144($sp) # internal_21 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_type_start_8728344748960 + j foreach_type_start_8728344748960 + + foreach_type_end_8728344748960: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 104($sp) # internal_28 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 100($sp) # internal_29 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 96($sp) # internal_30 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 92($sp) # internal_31 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 88($sp) # internal_32 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_31 + lw $t0, 104($sp) + sw $t0, 4($sp) # Storing internal_31 + + # Argument internal_8 + lw $t0, 196($sp) + sw $t0, 0($sp) # Storing internal_8 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 104($sp) # internal_31 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + foreach_min_start_8728344748960: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_28 + lw $t0, 116($sp) + sw $t0, 4($sp) # Storing internal_28 + + # Argument internal_6 + lw $t0, 204($sp) + sw $t0, 0($sp) # Storing internal_6 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 100($sp) # internal_32 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_32 then goto foreach_min_body_8728344748960 + lw $t0, 88($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_min_body_8728344748960 + + # Jumping to foreach_min_end_8728344748960 + j foreach_min_end_8728344748960 + + foreach_min_body_8728344748960: + + # internal_30 = array internal_16[4 * internal_28] + lw $t0, 104($sp) # $t0 = internal_28 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 152($sp) # $t1 = internal_16 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 96($sp) # internal_30 = array internal_16[4 * internal_28] + sw $t0, 8($t2) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_30 + lw $t0, 108($sp) + sw $t0, 4($sp) # Storing internal_30 + + # Argument internal_31 + lw $t0, 104($sp) + sw $t0, 0($sp) # Storing internal_31 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 100($sp) # internal_32 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_32 then goto update_min_8728344748960 + lw $t0, 88($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, update_min_8728344748960 + + # Jumping to update_min_end_8728344748960 + j update_min_end_8728344748960 + + update_min_8728344748960: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_31 + lw $t0, 104($sp) + sw $t0, 4($sp) # Storing internal_31 + + # Argument internal_30 + lw $t0, 108($sp) + sw $t0, 0($sp) # Storing internal_30 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 104($sp) # internal_31 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_29 + lw $t0, 112($sp) + sw $t0, 4($sp) # Storing internal_29 + + # Argument internal_28 + lw $t0, 116($sp) + sw $t0, 0($sp) # Storing internal_28 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 112($sp) # internal_29 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + update_min_end_8728344748960: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_28 + lw $t0, 116($sp) + sw $t0, 4($sp) # Storing internal_28 + + # Argument internal_5 + lw $t0, 208($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 116($sp) # internal_28 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_min_start_8728344748960 + j foreach_min_start_8728344748960 + + foreach_min_end_8728344748960: + + # initialize Array [internal_6] + lw $t0, 192($sp) # $t0 = internal_6 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 84($sp) # internal_33 = new Array[internal_6] + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 80($sp) # internal_34 = address of allocated object Int + + # array internal_33[4 * internal_34] = internal_4 + lw $t0, 80($sp) # $t0 = internal_34 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 84($sp) # $t1 = internal_33 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 200($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 76($sp) # internal_35 = address of allocated object Int + + # array internal_33[4 * internal_35] = internal_4 + lw $t0, 76($sp) # $t0 = internal_35 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 84($sp) # $t1 = internal_33 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 200($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 72($sp) # internal_36 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_31 + lw $t0, 104($sp) + sw $t0, 4($sp) # Storing internal_31 + + # Argument internal_8 + lw $t0, 196($sp) + sw $t0, 0($sp) # Storing internal_8 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 84($sp) # internal_36 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_36 then goto error_branch_8728344748960 + lw $t0, 72($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, error_branch_8728344748960 + + # array internal_33[4 * internal_29] = internal_5 + lw $t0, 100($sp) # $t0 = internal_29 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 84($sp) # $t1 = internal_33 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 196($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 68($sp) # internal_37 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 64($sp) # internal_38 = address of allocated object Int + + # internal_37 = array internal_33[4 * internal_38] + lw $t0, 64($sp) # $t0 = internal_38 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 84($sp) # $t1 = internal_33 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 68($sp) # internal_37 = array internal_33[4 * internal_38] + sw $t0, 8($t2) + + # If internal_37 then goto branch_Book_8728344748960 + lw $t0, 68($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Book_8728344748960 + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 60($sp) # internal_39 = address of allocated object Int + + # internal_37 = array internal_33[4 * internal_39] + lw $t0, 60($sp) # $t0 = internal_39 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 84($sp) # $t1 = internal_33 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 68($sp) # internal_37 = array internal_33[4 * internal_39] + sw $t0, 8($t2) + + # If internal_37 then goto branch_Article_8728344748960 + lw $t0, 68($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Article_8728344748960 + + branch_Book_8728344748960: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument dummy + lw $t0, 64($sp) + sw $t0, 4($sp) # Storing dummy + + # Argument internal_1 + lw $t0, 224($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 64($sp) # dummy = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 35 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 35 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 45 + sb $t0, 8($v0) # internal_42[0] = '-' + + addi $t0, $zero, 32 + sb $t0, 9($v0) # internal_42[1] = ' ' + + addi $t0, $zero, 100 + sb $t0, 10($v0) # internal_42[2] = 'd' + + addi $t0, $zero, 121 + sb $t0, 11($v0) # internal_42[3] = 'y' + + addi $t0, $zero, 110 + sb $t0, 12($v0) # internal_42[4] = 'n' + + addi $t0, $zero, 97 + sb $t0, 13($v0) # internal_42[5] = 'a' + + addi $t0, $zero, 109 + sb $t0, 14($v0) # internal_42[6] = 'm' + + addi $t0, $zero, 105 + sb $t0, 15($v0) # internal_42[7] = 'i' + + addi $t0, $zero, 99 + sb $t0, 16($v0) # internal_42[8] = 'c' + + addi $t0, $zero, 32 + sb $t0, 17($v0) # internal_42[9] = ' ' + + addi $t0, $zero, 116 + sb $t0, 18($v0) # internal_42[10] = 't' + + addi $t0, $zero, 121 + sb $t0, 19($v0) # internal_42[11] = 'y' + + addi $t0, $zero, 112 + sb $t0, 20($v0) # internal_42[12] = 'p' + + addi $t0, $zero, 101 + sb $t0, 21($v0) # internal_42[13] = 'e' + + addi $t0, $zero, 32 + sb $t0, 22($v0) # internal_42[14] = ' ' + + addi $t0, $zero, 119 + sb $t0, 23($v0) # internal_42[15] = 'w' + + addi $t0, $zero, 97 + sb $t0, 24($v0) # internal_42[16] = 'a' + + addi $t0, $zero, 115 + sb $t0, 25($v0) # internal_42[17] = 's' + + addi $t0, $zero, 32 + sb $t0, 26($v0) # internal_42[18] = ' ' + + addi $t0, $zero, 66 + sb $t0, 27($v0) # internal_42[19] = 'B' + + addi $t0, $zero, 111 + sb $t0, 28($v0) # internal_42[20] = 'o' + + addi $t0, $zero, 111 + sb $t0, 29($v0) # internal_42[21] = 'o' + + addi $t0, $zero, 107 + sb $t0, 30($v0) # internal_42[22] = 'k' + + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_42[23] = ' ' + + addi $t0, $zero, 45 + sb $t0, 32($v0) # internal_42[24] = '-' + + addi $t0, $zero, 10 + sb $t0, 33($v0) # internal_42[25] = '\n' + + sb $zero, 34($v0) # Null-terminator at the end of the string + + sw $v0, 48($sp) # internal_42 = "- dynamic type was Book -\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_44 = address of allocated object Int + + # Get method out_string of Cons + lw $t0, 220($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 40($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 36($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 232($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_42 + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing internal_42 + + # Calling function internal_45 + lw $t0, 48($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 56($sp) # internal_43 = result of internal_45 + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_40 + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing internal_40 + + # Argument internal_43 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_43 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 68($sp) # internal_40 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_40 = internal_43 + lw $t0, 44($sp) + sw $t0, 56($sp) + + # Jumping to branch_end_8728344748960 + j branch_end_8728344748960 + + branch_Article_8728344748960: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument dummy + lw $t0, 64($sp) + sw $t0, 4($sp) # Storing dummy + + # Argument internal_1 + lw $t0, 224($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 64($sp) # dummy = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 38 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 38 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 45 + sb $t0, 8($v0) # internal_47[0] = '-' + + addi $t0, $zero, 32 + sb $t0, 9($v0) # internal_47[1] = ' ' + + addi $t0, $zero, 100 + sb $t0, 10($v0) # internal_47[2] = 'd' + + addi $t0, $zero, 121 + sb $t0, 11($v0) # internal_47[3] = 'y' + + addi $t0, $zero, 110 + sb $t0, 12($v0) # internal_47[4] = 'n' + + addi $t0, $zero, 97 + sb $t0, 13($v0) # internal_47[5] = 'a' + + addi $t0, $zero, 109 + sb $t0, 14($v0) # internal_47[6] = 'm' + + addi $t0, $zero, 105 + sb $t0, 15($v0) # internal_47[7] = 'i' + + addi $t0, $zero, 99 + sb $t0, 16($v0) # internal_47[8] = 'c' + + addi $t0, $zero, 32 + sb $t0, 17($v0) # internal_47[9] = ' ' + + addi $t0, $zero, 116 + sb $t0, 18($v0) # internal_47[10] = 't' + + addi $t0, $zero, 121 + sb $t0, 19($v0) # internal_47[11] = 'y' + + addi $t0, $zero, 112 + sb $t0, 20($v0) # internal_47[12] = 'p' + + addi $t0, $zero, 101 + sb $t0, 21($v0) # internal_47[13] = 'e' + + addi $t0, $zero, 32 + sb $t0, 22($v0) # internal_47[14] = ' ' + + addi $t0, $zero, 119 + sb $t0, 23($v0) # internal_47[15] = 'w' + + addi $t0, $zero, 97 + sb $t0, 24($v0) # internal_47[16] = 'a' + + addi $t0, $zero, 115 + sb $t0, 25($v0) # internal_47[17] = 's' + + addi $t0, $zero, 32 + sb $t0, 26($v0) # internal_47[18] = ' ' + + addi $t0, $zero, 65 + sb $t0, 27($v0) # internal_47[19] = 'A' + + addi $t0, $zero, 114 + sb $t0, 28($v0) # internal_47[20] = 'r' + + addi $t0, $zero, 116 + sb $t0, 29($v0) # internal_47[21] = 't' + + addi $t0, $zero, 105 + sb $t0, 30($v0) # internal_47[22] = 'i' + + addi $t0, $zero, 99 + sb $t0, 31($v0) # internal_47[23] = 'c' + + addi $t0, $zero, 108 + sb $t0, 32($v0) # internal_47[24] = 'l' + + addi $t0, $zero, 101 + sb $t0, 33($v0) # internal_47[25] = 'e' + + addi $t0, $zero, 32 + sb $t0, 34($v0) # internal_47[26] = ' ' + + addi $t0, $zero, 45 + sb $t0, 35($v0) # internal_47[27] = '-' + + addi $t0, $zero, 10 + sb $t0, 36($v0) # internal_47[28] = '\n' + + sb $zero, 37($v0) # Null-terminator at the end of the string + + sw $v0, 28($sp) # internal_47 = "- dynamic type was Article -\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_49 = address of allocated object Int + + # Get method out_string of Cons + lw $t0, 220($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 20($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 16($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 232($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_47 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_47 + + # Calling function internal_50 + lw $t0, 28($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_48 = result of internal_50 + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_40 + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing internal_40 + + # Argument internal_48 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_48 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 68($sp) # internal_40 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_40 = internal_48 + lw $t0, 24($sp) + sw $t0, 56($sp) + + # Jumping to branch_end_8728344748960 + j branch_end_8728344748960 + + error_branch_8728344748960: + + branch_end_8728344748960: + + # Get attribute xcdr of self + lw $t0, 220($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'xcdr' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8728344708774 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8728344708774 + j object_get_attribute_8728344708774 + int_get_attribute_8728344708774: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_51 = self.xcdr + j end_get_attribute_8728344708774 + bool_get_attribute_8728344708774: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_51 = self.xcdr + j end_get_attribute_8728344708774 + object_get_attribute_8728344708774: + sw $t1, 12($sp) # internal_51 = self.xcdr + end_get_attribute_8728344708774: + + # Allocating Int 12 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 12 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_53 = address of allocated object Int + + # Get method print_list of BookList + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_51 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_51 + + # Calling function internal_54 + lw $t0, 8($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_52 = result of internal_54 + addi $sp, $sp, 8 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 220 + + jr $ra + + function___init___at_Nil: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_isNil_at_Nil: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_print_list_at_Nil: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_Main: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating NUll to internal_0 + sw $zero, 0($sp) # internal_0 = 0 + + # Set attribute books of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8728344709184 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8728344709184 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8728344709184 + j object_set_attribute_8728344709184 + int_set_attribute_8728344709184: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.books = internal_0 + j end_set_attribute_8728344709184 + bool_set_attribute_8728344709184: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.books = internal_0 + j end_set_attribute_8728344709184 + object_set_attribute_8728344709184: + sw $t1, 8($t0) # self.books = internal_0 + end_set_attribute_8728344709184: + + # Loading return value in $v1 + lw $v1, 4($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_main_at_Main: + # Function parameters + # $ra = 108($sp) + # self = 104($sp) + + # Reserving space for local variables + addi $sp, $sp, -104 + + # Allocating Book + li $v0, 9 + lw $a0, type_Book + syscall + la $t0, type_Book # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 96($sp) # internal_1 = address of allocated object Book + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_1 + lw $t0, 104($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function___init___at_Book + jal function___init___at_Book + lw $ra, 4($sp) + sw $v1, 104($sp) # internal_1 = result of function___init___at_Book + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 53 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 53 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 67 + sb $t0, 8($v0) # internal_2[0] = 'C' + + addi $t0, $zero, 111 + sb $t0, 9($v0) # internal_2[1] = 'o' + + addi $t0, $zero, 109 + sb $t0, 10($v0) # internal_2[2] = 'm' + + addi $t0, $zero, 112 + sb $t0, 11($v0) # internal_2[3] = 'p' + + addi $t0, $zero, 105 + sb $t0, 12($v0) # internal_2[4] = 'i' + + addi $t0, $zero, 108 + sb $t0, 13($v0) # internal_2[5] = 'l' + + addi $t0, $zero, 101 + sb $t0, 14($v0) # internal_2[6] = 'e' + + addi $t0, $zero, 114 + sb $t0, 15($v0) # internal_2[7] = 'r' + + addi $t0, $zero, 115 + sb $t0, 16($v0) # internal_2[8] = 's' + + addi $t0, $zero, 44 + sb $t0, 17($v0) # internal_2[9] = ',' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_2[10] = ' ' + + addi $t0, $zero, 80 + sb $t0, 19($v0) # internal_2[11] = 'P' + + addi $t0, $zero, 114 + sb $t0, 20($v0) # internal_2[12] = 'r' + + addi $t0, $zero, 105 + sb $t0, 21($v0) # internal_2[13] = 'i' + + addi $t0, $zero, 110 + sb $t0, 22($v0) # internal_2[14] = 'n' + + addi $t0, $zero, 99 + sb $t0, 23($v0) # internal_2[15] = 'c' + + addi $t0, $zero, 105 + sb $t0, 24($v0) # internal_2[16] = 'i' + + addi $t0, $zero, 112 + sb $t0, 25($v0) # internal_2[17] = 'p' + + addi $t0, $zero, 108 + sb $t0, 26($v0) # internal_2[18] = 'l' + + addi $t0, $zero, 101 + sb $t0, 27($v0) # internal_2[19] = 'e' + + addi $t0, $zero, 115 + sb $t0, 28($v0) # internal_2[20] = 's' + + addi $t0, $zero, 44 + sb $t0, 29($v0) # internal_2[21] = ',' + + addi $t0, $zero, 32 + sb $t0, 30($v0) # internal_2[22] = ' ' + + addi $t0, $zero, 84 + sb $t0, 31($v0) # internal_2[23] = 'T' + + addi $t0, $zero, 101 + sb $t0, 32($v0) # internal_2[24] = 'e' + + addi $t0, $zero, 99 + sb $t0, 33($v0) # internal_2[25] = 'c' + + addi $t0, $zero, 104 + sb $t0, 34($v0) # internal_2[26] = 'h' + + addi $t0, $zero, 110 + sb $t0, 35($v0) # internal_2[27] = 'n' + + addi $t0, $zero, 105 + sb $t0, 36($v0) # internal_2[28] = 'i' + + addi $t0, $zero, 113 + sb $t0, 37($v0) # internal_2[29] = 'q' + + addi $t0, $zero, 117 + sb $t0, 38($v0) # internal_2[30] = 'u' + + addi $t0, $zero, 101 + sb $t0, 39($v0) # internal_2[31] = 'e' + + addi $t0, $zero, 115 + sb $t0, 40($v0) # internal_2[32] = 's' + + addi $t0, $zero, 44 + sb $t0, 41($v0) # internal_2[33] = ',' + + addi $t0, $zero, 32 + sb $t0, 42($v0) # internal_2[34] = ' ' + + addi $t0, $zero, 97 + sb $t0, 43($v0) # internal_2[35] = 'a' + + addi $t0, $zero, 110 + sb $t0, 44($v0) # internal_2[36] = 'n' + + addi $t0, $zero, 100 + sb $t0, 45($v0) # internal_2[37] = 'd' + + addi $t0, $zero, 32 + sb $t0, 46($v0) # internal_2[38] = ' ' + + addi $t0, $zero, 84 + sb $t0, 47($v0) # internal_2[39] = 'T' + + addi $t0, $zero, 111 + sb $t0, 48($v0) # internal_2[40] = 'o' + + addi $t0, $zero, 111 + sb $t0, 49($v0) # internal_2[41] = 'o' + + addi $t0, $zero, 108 + sb $t0, 50($v0) # internal_2[42] = 'l' + + addi $t0, $zero, 115 + sb $t0, 51($v0) # internal_2[43] = 's' + + sb $zero, 52($v0) # Null-terminator at the end of the string + + sw $v0, 92($sp) # internal_2 = "Compilers, Principles, Techniques, and Tools" + + # Allocating String + li $v0, 9 + addi $a0, $zero, 31 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 31 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 65 + sb $t0, 8($v0) # internal_3[0] = 'A' + + addi $t0, $zero, 104 + sb $t0, 9($v0) # internal_3[1] = 'h' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_3[2] = 'o' + + addi $t0, $zero, 44 + sb $t0, 11($v0) # internal_3[3] = ',' + + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_3[4] = ' ' + + addi $t0, $zero, 83 + sb $t0, 13($v0) # internal_3[5] = 'S' + + addi $t0, $zero, 101 + sb $t0, 14($v0) # internal_3[6] = 'e' + + addi $t0, $zero, 116 + sb $t0, 15($v0) # internal_3[7] = 't' + + addi $t0, $zero, 104 + sb $t0, 16($v0) # internal_3[8] = 'h' + + addi $t0, $zero, 105 + sb $t0, 17($v0) # internal_3[9] = 'i' + + addi $t0, $zero, 44 + sb $t0, 18($v0) # internal_3[10] = ',' + + addi $t0, $zero, 32 + sb $t0, 19($v0) # internal_3[11] = ' ' + + addi $t0, $zero, 97 + sb $t0, 20($v0) # internal_3[12] = 'a' + + addi $t0, $zero, 110 + sb $t0, 21($v0) # internal_3[13] = 'n' + + addi $t0, $zero, 100 + sb $t0, 22($v0) # internal_3[14] = 'd' + + addi $t0, $zero, 32 + sb $t0, 23($v0) # internal_3[15] = ' ' + + addi $t0, $zero, 85 + sb $t0, 24($v0) # internal_3[16] = 'U' + + addi $t0, $zero, 108 + sb $t0, 25($v0) # internal_3[17] = 'l' + + addi $t0, $zero, 108 + sb $t0, 26($v0) # internal_3[18] = 'l' + + addi $t0, $zero, 109 + sb $t0, 27($v0) # internal_3[19] = 'm' + + addi $t0, $zero, 97 + sb $t0, 28($v0) # internal_3[20] = 'a' + + addi $t0, $zero, 110 + sb $t0, 29($v0) # internal_3[21] = 'n' + + sb $zero, 30($v0) # Null-terminator at the end of the string + + sw $v0, 88($sp) # internal_3 = "Aho, Sethi, and Ullman" + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 80($sp) # internal_5 = address of allocated object Int + + # Get method initBook of Book + lw $t0, 96($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 80($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 76($sp) + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument internal_1 + lw $t0, 112($sp) + sw $t0, 8($sp) # Storing internal_1 + + # Argument internal_2 + lw $t0, 108($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_3 + lw $t0, 104($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function internal_6 + lw $t0, 92($sp) + jalr $t0 + lw $ra, 12($sp) + sw $v1, 100($sp) # internal_4 = result of internal_6 + addi $sp, $sp, 16 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument a_book + lw $t0, 112($sp) + sw $t0, 4($sp) # Storing a_book + + # Argument internal_4 + lw $t0, 96($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 112($sp) # a_book = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Article + li $v0, 9 + lw $a0, type_Article + syscall + la $t0, type_Article # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 68($sp) # internal_8 = address of allocated object Article + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_8 + lw $t0, 76($sp) + sw $t0, 0($sp) # Storing internal_8 + + # Calling function function___init___at_Article + jal function___init___at_Article + lw $ra, 4($sp) + sw $v1, 76($sp) # internal_8 = result of function___init___at_Article + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 28 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 28 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 84 + sb $t0, 8($v0) # internal_9[0] = 'T' + + addi $t0, $zero, 104 + sb $t0, 9($v0) # internal_9[1] = 'h' + + addi $t0, $zero, 101 + sb $t0, 10($v0) # internal_9[2] = 'e' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_9[3] = ' ' + + addi $t0, $zero, 84 + sb $t0, 12($v0) # internal_9[4] = 'T' + + addi $t0, $zero, 111 + sb $t0, 13($v0) # internal_9[5] = 'o' + + addi $t0, $zero, 112 + sb $t0, 14($v0) # internal_9[6] = 'p' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_9[7] = ' ' + + addi $t0, $zero, 49 + sb $t0, 16($v0) # internal_9[8] = '1' + + addi $t0, $zero, 48 + sb $t0, 17($v0) # internal_9[9] = '0' + + addi $t0, $zero, 48 + sb $t0, 18($v0) # internal_9[10] = '0' + + addi $t0, $zero, 32 + sb $t0, 19($v0) # internal_9[11] = ' ' + + addi $t0, $zero, 67 + sb $t0, 20($v0) # internal_9[12] = 'C' + + addi $t0, $zero, 68 + sb $t0, 21($v0) # internal_9[13] = 'D' + + addi $t0, $zero, 95 + sb $t0, 22($v0) # internal_9[14] = '_' + + addi $t0, $zero, 82 + sb $t0, 23($v0) # internal_9[15] = 'R' + + addi $t0, $zero, 79 + sb $t0, 24($v0) # internal_9[16] = 'O' + + addi $t0, $zero, 77 + sb $t0, 25($v0) # internal_9[17] = 'M' + + addi $t0, $zero, 115 + sb $t0, 26($v0) # internal_9[18] = 's' + + sb $zero, 27($v0) # Null-terminator at the end of the string + + sw $v0, 64($sp) # internal_9 = "The Top 100 CD_ROMs" + + # Allocating String + li $v0, 9 + addi $a0, $zero, 16 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 16 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 85 + sb $t0, 8($v0) # internal_10[0] = 'U' + + addi $t0, $zero, 108 + sb $t0, 9($v0) # internal_10[1] = 'l' + + addi $t0, $zero, 97 + sb $t0, 10($v0) # internal_10[2] = 'a' + + addi $t0, $zero, 110 + sb $t0, 11($v0) # internal_10[3] = 'n' + + addi $t0, $zero, 111 + sb $t0, 12($v0) # internal_10[4] = 'o' + + addi $t0, $zero, 102 + sb $t0, 13($v0) # internal_10[5] = 'f' + + addi $t0, $zero, 102 + sb $t0, 14($v0) # internal_10[6] = 'f' + + sb $zero, 15($v0) # Null-terminator at the end of the string + + sw $v0, 60($sp) # internal_10 = "Ulanoff" + + # Allocating String + li $v0, 9 + addi $a0, $zero, 20 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 20 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 80 + sb $t0, 8($v0) # internal_11[0] = 'P' + + addi $t0, $zero, 67 + sb $t0, 9($v0) # internal_11[1] = 'C' + + addi $t0, $zero, 32 + sb $t0, 10($v0) # internal_11[2] = ' ' + + addi $t0, $zero, 77 + sb $t0, 11($v0) # internal_11[3] = 'M' + + addi $t0, $zero, 97 + sb $t0, 12($v0) # internal_11[4] = 'a' + + addi $t0, $zero, 103 + sb $t0, 13($v0) # internal_11[5] = 'g' + + addi $t0, $zero, 97 + sb $t0, 14($v0) # internal_11[6] = 'a' + + addi $t0, $zero, 122 + sb $t0, 15($v0) # internal_11[7] = 'z' + + addi $t0, $zero, 105 + sb $t0, 16($v0) # internal_11[8] = 'i' + + addi $t0, $zero, 110 + sb $t0, 17($v0) # internal_11[9] = 'n' + + addi $t0, $zero, 101 + sb $t0, 18($v0) # internal_11[10] = 'e' + + sb $zero, 19($v0) # Null-terminator at the end of the string + + sw $v0, 56($sp) # internal_11 = "PC Magazine" + + # Allocating Int 10 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 10 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 48($sp) # internal_13 = address of allocated object Int + + # Get method initArticle of Article + lw $t0, 68($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 48($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 44($sp) + + # Passing function arguments + addi $sp, $sp, -20 # Reserving space for arguments + sw $ra, 16($sp) # Storing return address + + # Argument internal_8 + lw $t0, 88($sp) + sw $t0, 12($sp) # Storing internal_8 + + # Argument internal_9 + lw $t0, 84($sp) + sw $t0, 8($sp) # Storing internal_9 + + # Argument internal_10 + lw $t0, 80($sp) + sw $t0, 4($sp) # Storing internal_10 + + # Argument internal_11 + lw $t0, 76($sp) + sw $t0, 0($sp) # Storing internal_11 + + # Calling function internal_14 + lw $t0, 64($sp) + jalr $t0 + lw $ra, 16($sp) + sw $v1, 72($sp) # internal_12 = result of internal_14 + addi $sp, $sp, 20 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument an_article + lw $t0, 84($sp) + sw $t0, 4($sp) # Storing an_article + + # Argument internal_12 + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing internal_12 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 84($sp) # an_article = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Nil + li $v0, 9 + lw $a0, type_Nil + syscall + la $t0, type_Nil # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 40($sp) # internal_15 = address of allocated object Nil + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_15 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_15 + + # Calling function function___init___at_Nil + jal function___init___at_Nil + lw $ra, 4($sp) + sw $v1, 48($sp) # internal_15 = result of function___init___at_Nil + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_17 = address of allocated object Int + + # Get method cons of Nil + lw $t0, 40($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 32($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 28($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_15 + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing internal_15 + + # Argument a_book + lw $t0, 112($sp) + sw $t0, 0($sp) # Storing a_book + + # Calling function internal_18 + lw $t0, 40($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 48($sp) # internal_16 = result of internal_18 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_20 = address of allocated object Int + + # Get method cons of Cons + lw $t0, 36($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 20($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 16($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_16 + lw $t0, 48($sp) + sw $t0, 4($sp) # Storing internal_16 + + # Argument an_article + lw $t0, 84($sp) + sw $t0, 0($sp) # Storing an_article + + # Calling function internal_21 + lw $t0, 28($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_19 = result of internal_21 + addi $sp, $sp, 12 # Freeing space for arguments + + # Set attribute books of self + lw $t0, 104($sp) # $t0 = self + lw $t1, 24($sp) # $t1 = internal_19 + beq $t1, $zero, object_set_attribute_8728344710051 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8728344710051 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8728344710051 + j object_set_attribute_8728344710051 + int_set_attribute_8728344710051: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.books = internal_19 + j end_set_attribute_8728344710051 + bool_set_attribute_8728344710051: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.books = internal_19 + j end_set_attribute_8728344710051 + object_set_attribute_8728344710051: + sw $t1, 8($t0) # self.books = internal_19 + end_set_attribute_8728344710051: + + # Get attribute books of self + lw $t0, 104($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'books' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8728344710708 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8728344710708 + j object_get_attribute_8728344710708 + int_get_attribute_8728344710708: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_22 = self.books + j end_get_attribute_8728344710708 + bool_get_attribute_8728344710708: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_22 = self.books + j end_get_attribute_8728344710708 + object_get_attribute_8728344710708: + sw $t1, 12($sp) # internal_22 = self.books + end_get_attribute_8728344710708: + + # Allocating Int 12 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 12 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_24 = address of allocated object Int + + # Get method print_list of BookList + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_22 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_22 + + # Calling function internal_25 + lw $t0, 8($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_23 = result of internal_25 + addi $sp, $sp, 8 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 104 + + jr $ra + + main: + # Reserving space for local variables + addi $sp, $sp, -16 + + # Allocating Main + li $v0, 9 + lw $a0, type_Main + syscall + la $t0, type_Main # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 12($sp) # internal_0 = address of allocated object Main + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_Main + jal function___init___at_Main + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_0 = result of function___init___at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_2 = address of allocated object Int + + # Get method main of Main + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function internal_3 + lw $t0, 8($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_1 = result of internal_3 + addi $sp, $sp, 8 # Freeing space for arguments + + # Exit program + li $v0, 10 + syscall + + \ No newline at end of file diff --git a/tests/codegen/book_list_output.txt b/tests/codegen/book_list_output.txt index 3408320b2..ced587a4f 100644 --- a/tests/codegen/book_list_output.txt +++ b/tests/codegen/book_list_output.txt @@ -1,7 +1,7 @@ -title: The Top 100 CD_ROMs -author: Ulanoff -periodical: PC Magazine -- dynamic type was Article - -title: Compilers, Principles, Techniques, and Tools -author: Aho, Sethi, and Ullman -- dynamic type was Book - +title: The Top 100 CD_ROMs +author: Ulanoff +periodical: PC Magazine +- dynamic type was Article - +title: Compilers, Principles, Techniques, and Tools +author: Aho, Sethi, and Ullman +- dynamic type was Book - diff --git a/tests/codegen/cells.cl b/tests/codegen/cells.cl index 9fd6741bb..bcd891498 100755 --- a/tests/codegen/cells.cl +++ b/tests/codegen/cells.cl @@ -1,97 +1,97 @@ -(* models one-dimensional cellular automaton on a circle of finite radius - arrays are faked as Strings, - X's respresent live cells, dots represent dead cells, - no error checking is done *) -class CellularAutomaton inherits IO { - population_map : String; - - init(map : String) : CellularAutomaton { - { - population_map <- map; - self; - } - }; - - print() : CellularAutomaton { - { - out_string(population_map.concat("\n")); - self; - } - }; - - num_cells() : Int { - population_map.length() - }; - - cell(position : Int) : String { - population_map.substr(position, 1) - }; - - cell_left_neighbor(position : Int) : String { - if position = 0 then - cell(num_cells() - 1) - else - cell(position - 1) - fi - }; - - cell_right_neighbor(position : Int) : String { - if position = num_cells() - 1 then - cell(0) - else - cell(position + 1) - fi - }; - - (* a cell will live if exactly 1 of itself and it's immediate - neighbors are alive *) - cell_at_next_evolution(position : Int) : String { - if (if cell(position) = "X" then 1 else 0 fi - + if cell_left_neighbor(position) = "X" then 1 else 0 fi - + if cell_right_neighbor(position) = "X" then 1 else 0 fi - = 1) - then - "X" - else - "." - fi - }; - - evolve() : CellularAutomaton { - (let position : Int in - (let num : Int <- num_cells() in - (let temp : String in - { - while position < num loop - { - temp <- temp.concat(cell_at_next_evolution(position)); - position <- position + 1; - } - pool; - population_map <- temp; - self; - } - ) ) ) - }; -}; - -class Main { - cells : CellularAutomaton; - - main() : Main { - { - cells <- (new CellularAutomaton).init(" X "); - cells.print(); - (let countdown : Int <- 20 in - while 0 < countdown loop - { - cells.evolve(); - cells.print(); - countdown <- countdown - 1; - } - pool - ); - self; - } - }; -}; +(* models one-dimensional cellular automaton on a circle of finite radius + arrays are faked as Strings, + X's respresent live cells, dots represent dead cells, + no error checking is done *) +class CellularAutomaton inherits IO { + population_map : String; + + init(map : String) : CellularAutomaton { + { + population_map <- map; + self; + } + }; + + print() : CellularAutomaton { + { + out_string(population_map.concat("\n")); + self; + } + }; + + num_cells() : Int { + population_map.length() + }; + + cell(position : Int) : String { + population_map.substr(position, 1) + }; + + cell_left_neighbor(position : Int) : String { + if position = 0 then + cell(num_cells() - 1) + else + cell(position - 1) + fi + }; + + cell_right_neighbor(position : Int) : String { + if position = num_cells() - 1 then + cell(0) + else + cell(position + 1) + fi + }; + + (* a cell will live if exactly 1 of itself and it's immediate + neighbors are alive *) + cell_at_next_evolution(position : Int) : String { + if (if cell(position) = "X" then 1 else 0 fi + + if cell_left_neighbor(position) = "X" then 1 else 0 fi + + if cell_right_neighbor(position) = "X" then 1 else 0 fi + = 1) + then + "X" + else + "." + fi + }; + + evolve() : CellularAutomaton { + (let position : Int in + (let num : Int <- num_cells() in + (let temp : String in + { + while position < num loop + { + temp <- temp.concat(cell_at_next_evolution(position)); + position <- position + 1; + } + pool; + population_map <- temp; + self; + } + ) ) ) + }; +}; + +class Main { + cells : CellularAutomaton; + + main() : Main { + { + cells <- (new CellularAutomaton).init(" X "); + cells.print(); + (let countdown : Int <- 20 in + while 0 < countdown loop + { + cells.evolve(); + cells.print(); + countdown <- countdown - 1; + } + pool + ); + self; + } + }; +}; diff --git a/tests/codegen/cells.mips b/tests/codegen/cells.mips new file mode 100644 index 000000000..f04830399 --- /dev/null +++ b/tests/codegen/cells.mips @@ -0,0 +1,4058 @@ +.data + type_Object: .word 24 + type_Object_inherits_from: .word 0 + type_Object_name_address: .word type_Object_name_size + type_Object___init__: .word function___init___at_Object + type_Object_abort: .word function_abort_at_Object + type_Object_type_name: .word function_type_name_at_Object + type_Object_copy: .word function_copy_at_Object + + type_IO: .word 40 + type_IO_inherits_from: .word type_Object + type_IO_name_address: .word type_IO_name_size + type_IO___init__: .word function___init___at_IO + type_IO_abort: .word function_abort_at_Object + type_IO_type_name: .word function_type_name_at_Object + type_IO_copy: .word function_copy_at_Object + type_IO_out_string: .word function_out_string_at_IO + type_IO_out_int: .word function_out_int_at_IO + type_IO_in_string: .word function_in_string_at_IO + type_IO_in_int: .word function_in_int_at_IO + + type_String: .word 36 + type_String_inherits_from: .word type_Object + type_String_name_address: .word type_String_name_size + type_String___init__: .word function___init___at_String + type_String_abort: .word function_abort_at_Object + type_String_type_name: .word function_type_name_at_Object + type_String_copy: .word function_copy_at_Object + type_String_length: .word function_length_at_String + type_String_concat: .word function_concat_at_String + type_String_substr: .word function_substr_at_String + + type_Int: .word 24 + type_Int_inherits_from: .word type_Object + type_Int_name_address: .word type_Int_name_size + type_Int___init__: .word function___init___at_Int + type_Int_abort: .word function_abort_at_Object + type_Int_type_name: .word function_type_name_at_Object + type_Int_copy: .word function_copy_at_Object + + type_Bool: .word 24 + type_Bool_inherits_from: .word type_Object + type_Bool_name_address: .word type_Bool_name_size + type_Bool___init__: .word function___init___at_Bool + type_Bool_abort: .word function_abort_at_Object + type_Bool_type_name: .word function_type_name_at_Object + type_Bool_copy: .word function_copy_at_Object + + type_CellularAutomaton: .word 76 + type_CellularAutomaton_inherits_from: .word type_IO + type_CellularAutomaton_name_address: .word type_CellularAutomaton_name_size + type_CellularAutomaton___init__: .word function___init___at_CellularAutomaton + type_CellularAutomaton_abort: .word function_abort_at_Object + type_CellularAutomaton_type_name: .word function_type_name_at_Object + type_CellularAutomaton_copy: .word function_copy_at_Object + type_CellularAutomaton_out_string: .word function_out_string_at_IO + type_CellularAutomaton_out_int: .word function_out_int_at_IO + type_CellularAutomaton_in_string: .word function_in_string_at_IO + type_CellularAutomaton_in_int: .word function_in_int_at_IO + type_CellularAutomaton_init: .word function_init_at_CellularAutomaton + type_CellularAutomaton_print: .word function_print_at_CellularAutomaton + type_CellularAutomaton_num_cells: .word function_num_cells_at_CellularAutomaton + type_CellularAutomaton_cell: .word function_cell_at_CellularAutomaton + type_CellularAutomaton_cell_left_neighbor: .word function_cell_left_neighbor_at_CellularAutomaton + type_CellularAutomaton_cell_right_neighbor: .word function_cell_right_neighbor_at_CellularAutomaton + type_CellularAutomaton_cell_at_next_evolution: .word function_cell_at_next_evolution_at_CellularAutomaton + type_CellularAutomaton_evolve: .word function_evolve_at_CellularAutomaton + + type_Main: .word 32 + type_Main_inherits_from: .word type_Object + type_Main_name_address: .word type_Main_name_size + type_Main___init__: .word function___init___at_Main + type_Main_abort: .word function_abort_at_Object + type_Main_type_name: .word function_type_name_at_Object + type_Main_copy: .word function_copy_at_Object + type_Main_main: .word function_main_at_Main + + type_Object_name_size: .word 6 + type_Object_name: .asciiz "Object" + + type_IO_name_size: .word 2 + type_IO_name: .asciiz "IO" + + type_String_name_size: .word 6 + type_String_name: .asciiz "String" + + type_Int_name_size: .word 3 + type_Int_name: .asciiz "Int" + + type_Bool_name_size: .word 4 + type_Bool_name: .asciiz "Bool" + + type_CellularAutomaton_name_size: .word 17 + type_CellularAutomaton_name: .asciiz "CellularAutomaton" + + type_Main_name_size: .word 4 + type_Main_name: .asciiz "Main" + + buffer_input: .space 1024 + debug_log: .asciiz "debug_log\n" + +.text + function_add: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Addition operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + add $t2, $t0, $t1 # $t2 = $t0 + $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_sub: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Subtraction operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sub $t2, $t0, $t1 # $t2 = $t0 - $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_mult: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Multiplication operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + mult $t0, $t1 # $t2 = $t0 * $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_div: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Division operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + div $t0, $t1 # $t2 = $t0 / $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_xor: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Xor operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than_or_equal: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sle $t2, $t0, $t1 # $t2 = $t0 <= $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_equal: + # Function parameters + # $ra = 48($sp) + # a = 44($sp) + # b = 40($sp) + + # Reserving space for local variables + addi $sp, $sp, -40 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_0 = address of allocated object Int + + # Allocating NUll to internal_1 + sw $zero, 32($sp) # internal_1 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_2 = address of allocated object Int + + # internal_2 = EqualAddress(a, internal_1) + lw $t0, 44($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # internal_2 = EqualAddress(b, internal_1) + lw $t0, 40($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # If internal_2 then goto a_is_type_object + lw $t0, 28($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_object + + # internal_3 = typeof a that is the first word of the object + lw $t0, 44($sp) + lw $t0, 0($t0) + sw $t0, 24($sp) + + # internal_4 = direction of Int + la $t0, type_Int + sw $t0, 20($sp) + + # internal_5 = direction of Bool + la $t0, type_Bool + sw $t0, 16($sp) + + # internal_6 = direction of String + la $t0, type_String + sw $t0, 12($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_7 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_8 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_9 = address of allocated object Int + + # internal_7 = EqualAddress(internal_3, internal_4) + lw $t0, 24($sp) + lw $t1, 20($sp) + seq $t2, $t0, $t1 + lw $t0, 8($sp) + sw $t2, 8($t0) + + # internal_8 = EqualAddress(internal_3, internal_5) + lw $t0, 24($sp) + lw $t1, 16($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_9 = EqualAddress(internal_3, internal_6) + lw $t0, 24($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_7 then goto a_is_type_int_or_bool + lw $t0, 8($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_8 then goto a_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_9 then goto a_is_type_string + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_string + + # Jumping to a_is_type_object + j a_is_type_object + + a_is_type_int_or_bool: + + # internal_0 = EqualInt(a, b) + lw $t0, 44($sp) + lw $t0, 8($t0) + lw $t1, 40($sp) + lw $t1, 8($t1) + seq $t2, $t0, $t1 + lw $t0, 36($sp) + sw $t2, 8($t0) + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_string: + + # internal_0 = EqualStr(a, b) + lw $t0, 44($sp) + lw $t1, 40($sp) + addi $t0, $t0, 8 + addi $t1, $t1, 8 + + # By default we assume the strings are equals + addi $t4, $zero, 1 + lw $t5, 36($sp) + sw $t4, 8($t5) + + while_compare_strings_start: + lb $t2, 0($t0) + lb $t3, 0($t1) + beq $t2, $t3, while_compare_strings_update + + # The strings are no equals + lw $t5, 36($sp) + sw $zero, 8($t5) + j while_compare_strings_end + + while_compare_strings_update: + addi $t0, $t0, 1 + addi $t1, $t1, 1 + beq $t2, $zero, while_compare_strings_end + beq $t3, $zero, while_compare_strings_end + j while_compare_strings_start + while_compare_strings_end: + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_object: + + # Equal operation + lw $t0, 44($sp) # Save in $t0 the left operand address + lw $t1, 40($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 36($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Jumping to end_of_equal + j end_of_equal + + end_of_equal: + + # Loading return value in $v1 + lw $v1, 36($sp) + + # Freeing space for local variables + addi $sp, $sp, 40 + + jr $ra + + function_assign: + # Function parameters + # $ra = 36($sp) + # dest = 32($sp) + # source = 28($sp) + + # Reserving space for local variables + addi $sp, $sp, -28 + + # Allocating NUll to internal_0 + sw $zero, 24($sp) # internal_0 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_1 = address of allocated object Int + + # internal_1 = EqualAddress(source, internal_0) + lw $t0, 28($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # internal_1 = EqualAddress(dest, internal_0) + lw $t0, 32($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # If internal_1 then goto source_is_type_object + lw $t0, 20($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_object + + # internal_2 = typeof source that is the first word of the object + lw $t0, 28($sp) + lw $t0, 0($t0) + sw $t0, 16($sp) + + # internal_3 = direction of Int + la $t0, type_Int + sw $t0, 12($sp) + + # internal_4 = direction of Bool + la $t0, type_Bool + sw $t0, 8($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_5 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_6 = address of allocated object Int + + # internal_5 = EqualAddress(internal_2, internal_3) + lw $t0, 16($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_6 = EqualAddress(internal_2, internal_4) + lw $t0, 16($sp) + lw $t1, 8($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_5 then goto source_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # If internal_6 then goto source_is_type_int_or_bool + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # Jumping to source_is_type_object + j source_is_type_object + + source_is_type_int_or_bool: + + # dest = source where source is an integer + li $v0, 9 + addi $a0, $zero, 12 + syscall + lw $t0, 28($sp) # Pointer to source + lw $t1, 0($t0) # $t1 = type of source + lw $t2, 8($t0) # $t2 = value of source + sw $t1, 0($v0) # Save type of dest + sw $a0, 4($v0) # Save size of dest + sw $t2, 8($v0) # Save value of dest + sw $v0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_is_type_object: + + # dest = source + lw $t0, 28($sp) + sw $t0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_end_of_equal: + + # Loading return value in $v1 + lw $v1, 32($sp) + + # Freeing space for local variables + addi $sp, $sp, 28 + + jr $ra + + function___init___at_Object: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_abort_at_Object: + # Function parameters + # $ra = 28($sp) + # self = 24($sp) + + # Reserving space for local variables + addi $sp, $sp, -24 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 33 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 33 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 65 + sb $t0, 8($v0) # internal_0[0] = 'A' + + addi $t0, $zero, 98 + sb $t0, 9($v0) # internal_0[1] = 'b' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_0[2] = 'o' + + addi $t0, $zero, 114 + sb $t0, 11($v0) # internal_0[3] = 'r' + + addi $t0, $zero, 116 + sb $t0, 12($v0) # internal_0[4] = 't' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_0[5] = ' ' + + addi $t0, $zero, 99 + sb $t0, 14($v0) # internal_0[6] = 'c' + + addi $t0, $zero, 97 + sb $t0, 15($v0) # internal_0[7] = 'a' + + addi $t0, $zero, 108 + sb $t0, 16($v0) # internal_0[8] = 'l' + + addi $t0, $zero, 108 + sb $t0, 17($v0) # internal_0[9] = 'l' + + addi $t0, $zero, 101 + sb $t0, 18($v0) # internal_0[10] = 'e' + + addi $t0, $zero, 100 + sb $t0, 19($v0) # internal_0[11] = 'd' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_0[12] = ' ' + + addi $t0, $zero, 102 + sb $t0, 21($v0) # internal_0[13] = 'f' + + addi $t0, $zero, 114 + sb $t0, 22($v0) # internal_0[14] = 'r' + + addi $t0, $zero, 111 + sb $t0, 23($v0) # internal_0[15] = 'o' + + addi $t0, $zero, 109 + sb $t0, 24($v0) # internal_0[16] = 'm' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_0[17] = ' ' + + addi $t0, $zero, 99 + sb $t0, 26($v0) # internal_0[18] = 'c' + + addi $t0, $zero, 108 + sb $t0, 27($v0) # internal_0[19] = 'l' + + addi $t0, $zero, 97 + sb $t0, 28($v0) # internal_0[20] = 'a' + + addi $t0, $zero, 115 + sb $t0, 29($v0) # internal_0[21] = 's' + + addi $t0, $zero, 115 + sb $t0, 30($v0) # internal_0[22] = 's' + + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_0[23] = ' ' + + sb $zero, 32($v0) # Null-terminator at the end of the string + + sw $v0, 20($sp) # internal_0 = "Abort called from class " + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_3[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 8($sp) # internal_3 = "\n" + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method type_name of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_5 + lw $t0, 8($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 24($sp) # internal_1 = result of internal_5 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_1 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_2 = result of internal_5 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_3 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_2 = result of internal_5 + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 12($sp) # $t0 = internal_2 + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the String internal_2 + li $v0, 4 + move $a0, $t0 + syscall + + # Exit program + li $v0, 10 + syscall + + # Loading return value in $v1 + lw $v1, 24($sp) + + # Freeing space for local variables + addi $sp, $sp, 24 + + jr $ra + + function_type_name_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = name of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 8($t1) # $t2 = direction of the type name + la $t3, 4($t2) # $t3 = address of the name + lw $t2, 0($t2) # $t2 = length of the name + + addi $t2, $t2, 9 # Setting space for the type, the size and the null byte + li $v0, 9 + move $a0, $t2 + syscall + addi $t2, $t2, -9 # Restoring space for the type, the size and the null byte + + la $t4, type_String + sw $t4, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t4, $v0, 0 # $t4 = direction of the new string + addi $t4, $t4, 8 # Pointer to the first character of the string + xor $t5, $t5, $t5 # Initializing counter + while_copy_name_start: + beq $t5, $t2, while_copy_name_end + lb $t6, 0($t3) # Loading the character + sb $t6, 0($t4) + addi $t4, $t4, 1 # Incrementing the pointer to the new string + addi $t3, $t3, 1 # Incrementing the pointer to the string in self + addi $t5, $t5, 1 # Incrementing counter + j while_copy_name_start + while_copy_name_end: + + sb $zero, 0($t4) # Setting the null byte + + sw $v0, 0($sp) # Storing the new string in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_copy_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = copy of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 4($t0) # $t2 = length of self in bytes + + # Allocating space for the new object + li $v0, 9 + move $a0, $t2 + syscall + move $t3, $v0 # $t3 = direction of the new object + sw $t1, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + # Initializing the variable of the loop + addi $t0, $t0, 8 # Pointer to the first character of the object + addi $t3, $t3, 8 # Pointer to the first character of the object + addi $t2, $2, -8 # Decrementing in 8 the length of the object + xor $t4, $t4, $t4 # Initializing counter + + # Loop copying the object + while_copy_start: + beq $t4, $t2, while_copy_end + lb $t5, 0($t0) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t0, $t0, 1 # Incrementing the pointer to the object + addi $t3, $t3, 1 # Incrementing the pointer to the new object + addi $t4, $t4, 1 # Incrementing counter + j while_copy_start + while_copy_end: + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_IO: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_out_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + lw $t0, 0($sp) # $t0 = x + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the String x + li $v0, 4 + move $a0, $t0 + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_out_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + # Printing the Int x + li $v0, 1 + lw $a0, 0($sp) + lw $a0, 8($a0) + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_in_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + li $v0, 8 + la $a0, buffer_input + li $a1, 1024 + syscall + + xor $t0, $t0, $t0 # Initializing counter + while_read_start: + lb $t1, buffer_input($t0) # Loading the byte + addi $t2, $zero, 10 + beq $t1, $t2, while_read_end + addi $t2, $zero, 13 + beq $t1, $t2, while_read_end + addi $t0, $t0, 1 # Incrementing counter + j while_read_start + while_read_end: + + addi $t0, $t0, 9 # Adding space for the type, the size and the null byte + li $v0, 9 + move $a0, $t0 + syscall + addi $t0, $t0, -9 # Adding space for the type, the size and the null byte + la $t2, type_String + sw $t2, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t3, $v0, 8 # Pointer to the first character of the string + xor $t4, $t4, $t4 # Initializing counter + + while_copy_from_buffer_start: + beq $t4, $t0, while_copy_from_buffer_end + lb $t5, buffer_input($t4) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t3, $t3, 1 # Imcremeenting pointer + addi $t4, $t4, 1 # Incrementing counter + j while_copy_from_buffer_start + while_copy_from_buffer_end: + + sb $zero, 0($t3) # Storing the null byte + + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_in_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + li $v0, 5 + syscall + lw $t0, 0($sp) + sw $v0, 8($t0) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_String: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_length_at_String: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # internal_0 = length of self + lw $t0, 4($sp) + lw $t1, 4($t0) + addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator + lw $t0, 0($sp) + sw $t1, 8($t0) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_concat_at_String: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + # s = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self + s + lw $t0, 8($sp) + lw $t1, 4($sp) + lw $t2, 4($t0) # $t2 = length of str1 + lw $t3, 4($t1) # $t3 = length of str2 + addi $t2, $t2, -9 + addi $t3, $t3, -9 + add $t4, $t2, $t3 # $t4 = length of str1 + str2 + addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) + + li $v0, 9 + move $a0, $t4 + syscall + addi $t4, $t4, -9 # Restoring $t4 = length of str1 + str2 + add $t5, $zero, $v0 # $t5 = address of the new string object + addi $t5, $t5, 8 # $t5 = address of the first byte of the new string + + la $t8, type_String + sw $t8, 0($v0) # Setting type in the first word of th object + + sw $a0, 4($v0) # Setting length of the string in the second word of the object + + # Copying str1 to the new string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_str1_start: + beq $t6, $t2, while_copy_str1_end + lb $t7, 8($t0) + sb $t7, 0($t5) + add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str1_start + while_copy_str1_end: + + # Copying str2 to the new string + while_copy_str2_start: + beq $t6, $t4, while_copy_str2_end + lb $t7, 8($t1) + sb $t7, 0($t5) + add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str2_start + while_copy_str2_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self + s + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_substr_at_String: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + # i = 8($sp) + # l = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self[i:i + l] + lw $t0, 12($sp) # $t0 = address of the string + lw $t1, 4($t0) # $t1 = length of the string + addi $t1, $t1, -9 # $t1 = length of the string + 9 + lw $t2, 8($sp) # $t2 = start of the substring + lw $t2, 8($t2) + lw $t3, 4($sp) # $t3 = length of the substring + lw $t3, 8($t3) + add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring + + bgt $t4, $t1, substring_out_of_bounds + + addi $t3, $t3, 9 + li $v0, 9 + move $a0, $t3 + syscall + addi $t3, $t3, -9 + + la $t5, type_String + sw $t5, 0($v0) # Setting type in the first word of the object + + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t0, $t0, 8 # pointing to the first byte of the string + add $t0, $t0, $t2 # pointing to the first byte of the substring + move $t5, $v0 # $t5 = address of the new string + add $t5, $t5, 8 # pointing to the first byte of the string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_substr_start: + beq $t6, $t3, while_copy_substr_end + lb $t7, 0($t0) + sb $t7, 0($t5) + addi $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of the string + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_substr_start + while_copy_substr_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self[i:i + l] + j substring_not_out_of_bounds + + substring_out_of_bounds: + li $v0, 17 + addi $a0, $zero, 1 + syscall + + substring_not_out_of_bounds: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_Int: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function___init___at_Bool: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function___init___at_CellularAutomaton: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 9 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 9 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + sb $zero, 8($v0) # Null-terminator at the end of the string + + sw $v0, 0($sp) # internal_0 = "" + + # Set attribute population_map of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8754020047171 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8754020047171 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8754020047171 + j object_set_attribute_8754020047171 + int_set_attribute_8754020047171: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.population_map = internal_0 + j end_set_attribute_8754020047171 + bool_set_attribute_8754020047171: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.population_map = internal_0 + j end_set_attribute_8754020047171 + object_set_attribute_8754020047171: + sw $t1, 8($t0) # self.population_map = internal_0 + end_set_attribute_8754020047171: + + # Loading return value in $v1 + lw $v1, 4($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_init_at_CellularAutomaton: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # map = 0($sp) + + # Set attribute population_map of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = map + beq $t1, $zero, object_set_attribute_8754020047216 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8754020047216 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8754020047216 + j object_set_attribute_8754020047216 + int_set_attribute_8754020047216: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.population_map = map + j end_set_attribute_8754020047216 + bool_set_attribute_8754020047216: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.population_map = map + j end_set_attribute_8754020047216 + object_set_attribute_8754020047216: + sw $t1, 8($t0) # self.population_map = map + end_set_attribute_8754020047216: + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_print_at_CellularAutomaton: + # Function parameters + # $ra = 36($sp) + # self = 32($sp) + + # Reserving space for local variables + addi $sp, $sp, -32 + + # Get attribute population_map of self + lw $t0, 32($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'population_map' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8754020047270 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8754020047270 + j object_get_attribute_8754020047270 + int_get_attribute_8754020047270: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 28($sp) # internal_0 = self.population_map + j end_get_attribute_8754020047270 + bool_get_attribute_8754020047270: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 28($sp) # internal_0 = self.population_map + j end_get_attribute_8754020047270 + object_get_attribute_8754020047270: + sw $t1, 28($sp) # internal_0 = self.population_map + end_get_attribute_8754020047270: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_1[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 24($sp) # internal_1 = "\n" + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_3 = address of allocated object Int + + # Get method concat of String + lw $t0, 28($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 16($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 12($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_1 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function internal_4 + lw $t0, 24($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 32($sp) # internal_2 = result of internal_4 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_6 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 32($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 44($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_2 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function internal_7 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_5 = result of internal_7 + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 32($sp) + + # Freeing space for local variables + addi $sp, $sp, 32 + + jr $ra + + function_num_cells_at_CellularAutomaton: + # Function parameters + # $ra = 20($sp) + # self = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Get attribute population_map of self + lw $t0, 16($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'population_map' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8754020048918 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8754020048918 + j object_get_attribute_8754020048918 + int_get_attribute_8754020048918: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_0 = self.population_map + j end_get_attribute_8754020048918 + bool_get_attribute_8754020048918: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_0 = self.population_map + j end_get_attribute_8754020048918 + object_get_attribute_8754020048918: + sw $t1, 12($sp) # internal_0 = self.population_map + end_get_attribute_8754020048918: + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_2 = address of allocated object Int + + # Get method length of String + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function internal_3 + lw $t0, 8($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_1 = result of internal_3 + addi $sp, $sp, 8 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 + + jr $ra + + function_cell_at_CellularAutomaton: + # Function parameters + # $ra = 28($sp) + # self = 24($sp) + # position = 20($sp) + + # Reserving space for local variables + addi $sp, $sp, -20 + + # Get attribute population_map of self + lw $t0, 24($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'population_map' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8754020048996 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8754020048996 + j object_get_attribute_8754020048996 + int_get_attribute_8754020048996: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($sp) # internal_0 = self.population_map + j end_get_attribute_8754020048996 + bool_get_attribute_8754020048996: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($sp) # internal_0 = self.population_map + j end_get_attribute_8754020048996 + object_get_attribute_8754020048996: + sw $t1, 16($sp) # internal_0 = self.population_map + end_get_attribute_8754020048996: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 12($sp) # internal_1 = address of allocated object Int + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_3 = address of allocated object Int + + # Get method substr of String + lw $t0, 16($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument internal_0 + lw $t0, 32($sp) + sw $t0, 8($sp) # Storing internal_0 + + # Argument position + lw $t0, 36($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_1 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function internal_4 + lw $t0, 16($sp) + jalr $t0 + lw $ra, 12($sp) + sw $v1, 24($sp) # internal_2 = result of internal_4 + addi $sp, $sp, 16 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 20 + + jr $ra + + function_cell_left_neighbor_at_CellularAutomaton: + # Function parameters + # $ra = 76($sp) + # self = 72($sp) + # position = 68($sp) + + # Reserving space for local variables + addi $sp, $sp, -68 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 60($sp) # internal_1 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 56($sp) # internal_2 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 80($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_2 + lw $t0, 68($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 64($sp) # internal_3 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_1 = internal_3 + lw $t0, 52($sp) + sw $t0, 60($sp) + + # If internal_1 then goto then_8754020062838 + lw $t0, 60($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8754020062838 + + # Jumping to else_8754020062838 + j else_8754020062838 + + then_8754020062838: + + # Allocating Int 10 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 10 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_5 = address of allocated object Int + + # Get method num_cells of CellularAutomaton + lw $t0, 72($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 44($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 40($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 80($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_6 + lw $t0, 48($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 56($sp) # internal_4 = result of internal_6 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_7 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_4 + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing internal_4 + + # Argument internal_7 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 44($sp) # internal_8 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 11 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 11 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # internal_10 = address of allocated object Int + + # Get method cell of CellularAutomaton + lw $t0, 72($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 24($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 20($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 84($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_8 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_8 + + # Calling function internal_11 + lw $t0, 32($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_9 = result of internal_11 + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_0 = internal_9 + lw $t0, 28($sp) + sw $t0, 64($sp) + + # Jumping to endif_8754020062838 + j endif_8754020062838 + + else_8754020062838: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_12 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 80($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_12 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_12 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_13 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 11 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 11 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_15 = address of allocated object Int + + # Get method cell of CellularAutomaton + lw $t0, 72($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 84($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_13 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_13 + + # Calling function internal_16 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_14 = result of internal_16 + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_0 = internal_14 + lw $t0, 8($sp) + sw $t0, 64($sp) + + # Jumping to endif_8754020062838 + j endif_8754020062838 + + endif_8754020062838: + + # Loading return value in $v1 + lw $v1, 64($sp) + + # Freeing space for local variables + addi $sp, $sp, 68 + + jr $ra + + function_cell_right_neighbor_at_CellularAutomaton: + # Function parameters + # $ra = 76($sp) + # self = 72($sp) + # position = 68($sp) + + # Reserving space for local variables + addi $sp, $sp, -68 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 60($sp) # internal_1 = address of allocated object Int + + # Allocating Int 10 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 10 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 52($sp) # internal_3 = address of allocated object Int + + # Get method num_cells of CellularAutomaton + lw $t0, 72($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 52($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 48($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 80($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_4 + lw $t0, 56($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 64($sp) # internal_2 = result of internal_4 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_5 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_5 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 52($sp) # internal_6 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 80($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_6 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_6 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 48($sp) # internal_7 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_1 = internal_7 + lw $t0, 36($sp) + sw $t0, 60($sp) + + # If internal_1 then goto then_8754020062904 + lw $t0, 60($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8754020062904 + + # Jumping to else_8754020062904 + j else_8754020062904 + + then_8754020062904: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_8 = address of allocated object Int + + # Allocating Int 11 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 11 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # internal_10 = address of allocated object Int + + # Get method cell of CellularAutomaton + lw $t0, 72($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 24($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 20($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 84($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_8 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_8 + + # Calling function internal_11 + lw $t0, 32($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_9 = result of internal_11 + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_0 = internal_9 + lw $t0, 28($sp) + sw $t0, 64($sp) + + # Jumping to endif_8754020062904 + j endif_8754020062904 + + else_8754020062904: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_12 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 80($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_12 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_12 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_13 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 11 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 11 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_15 = address of allocated object Int + + # Get method cell of CellularAutomaton + lw $t0, 72($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 84($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_13 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_13 + + # Calling function internal_16 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_14 = result of internal_16 + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_0 = internal_14 + lw $t0, 8($sp) + sw $t0, 64($sp) + + # Jumping to endif_8754020062904 + j endif_8754020062904 + + endif_8754020062904: + + # Loading return value in $v1 + lw $v1, 64($sp) + + # Freeing space for local variables + addi $sp, $sp, 68 + + jr $ra + + function_cell_at_next_evolution_at_CellularAutomaton: + # Function parameters + # $ra = 148($sp) + # self = 144($sp) + # position = 140($sp) + + # Reserving space for local variables + addi $sp, $sp, -140 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 132($sp) # internal_1 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 124($sp) # internal_3 = address of allocated object Int + + # Allocating Int 11 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 11 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 116($sp) # internal_5 = address of allocated object Int + + # Get method cell of CellularAutomaton + lw $t0, 144($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 116($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 112($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 156($sp) + sw $t0, 4($sp) # Storing self + + # Argument position + lw $t0, 152($sp) + sw $t0, 0($sp) # Storing position + + # Calling function internal_6 + lw $t0, 124($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 132($sp) # internal_4 = result of internal_6 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 88 + sb $t0, 8($v0) # internal_7[0] = 'X' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 108($sp) # internal_7 = "X" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_4 + lw $t0, 132($sp) + sw $t0, 4($sp) # Storing internal_4 + + # Argument internal_7 + lw $t0, 120($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 116($sp) # internal_8 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_3 = internal_8 + lw $t0, 104($sp) + sw $t0, 124($sp) + + # If internal_3 then goto then_8754020062940 + lw $t0, 124($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8754020062940 + + # Jumping to else_8754020062940 + j else_8754020062940 + + then_8754020062940: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 100($sp) # internal_9 = address of allocated object Int + + # internal_2 = internal_9 + lw $t0, 100($sp) + sw $t0, 128($sp) + + # Jumping to endif_8754020062940 + j endif_8754020062940 + + else_8754020062940: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 96($sp) # internal_10 = address of allocated object Int + + # internal_2 = internal_10 + lw $t0, 96($sp) + sw $t0, 128($sp) + + # Jumping to endif_8754020062940 + j endif_8754020062940 + + endif_8754020062940: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 88($sp) # internal_12 = address of allocated object Int + + # Allocating Int 12 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 12 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 80($sp) # internal_14 = address of allocated object Int + + # Get method cell_left_neighbor of CellularAutomaton + lw $t0, 144($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 80($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 76($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 156($sp) + sw $t0, 4($sp) # Storing self + + # Argument position + lw $t0, 152($sp) + sw $t0, 0($sp) # Storing position + + # Calling function internal_15 + lw $t0, 88($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 96($sp) # internal_13 = result of internal_15 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 88 + sb $t0, 8($v0) # internal_16[0] = 'X' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 72($sp) # internal_16 = "X" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_13 + lw $t0, 96($sp) + sw $t0, 4($sp) # Storing internal_13 + + # Argument internal_16 + lw $t0, 84($sp) + sw $t0, 0($sp) # Storing internal_16 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 80($sp) # internal_17 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_12 = internal_17 + lw $t0, 68($sp) + sw $t0, 88($sp) + + # If internal_12 then goto then_8754020063751 + lw $t0, 88($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8754020063751 + + # Jumping to else_8754020063751 + j else_8754020063751 + + then_8754020063751: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 64($sp) # internal_18 = address of allocated object Int + + # internal_11 = internal_18 + lw $t0, 64($sp) + sw $t0, 92($sp) + + # Jumping to endif_8754020063751 + j endif_8754020063751 + + else_8754020063751: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 60($sp) # internal_19 = address of allocated object Int + + # internal_11 = internal_19 + lw $t0, 60($sp) + sw $t0, 92($sp) + + # Jumping to endif_8754020063751 + j endif_8754020063751 + + endif_8754020063751: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 140($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_11 + lw $t0, 104($sp) + sw $t0, 0($sp) # Storing internal_11 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 68($sp) # internal_20 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 48($sp) # internal_22 = address of allocated object Int + + # Allocating Int 13 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 13 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_24 = address of allocated object Int + + # Get method cell_right_neighbor of CellularAutomaton + lw $t0, 144($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 40($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 36($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 156($sp) + sw $t0, 4($sp) # Storing self + + # Argument position + lw $t0, 152($sp) + sw $t0, 0($sp) # Storing position + + # Calling function internal_25 + lw $t0, 48($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 56($sp) # internal_23 = result of internal_25 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 88 + sb $t0, 8($v0) # internal_26[0] = 'X' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 32($sp) # internal_26 = "X" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_23 + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing internal_23 + + # Argument internal_26 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_26 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_27 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_22 = internal_27 + lw $t0, 28($sp) + sw $t0, 48($sp) + + # If internal_22 then goto then_8754020063796 + lw $t0, 48($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8754020063796 + + # Jumping to else_8754020063796 + j else_8754020063796 + + then_8754020063796: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # internal_28 = address of allocated object Int + + # internal_21 = internal_28 + lw $t0, 24($sp) + sw $t0, 52($sp) + + # Jumping to endif_8754020063796 + j endif_8754020063796 + + else_8754020063796: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_29 = address of allocated object Int + + # internal_21 = internal_29 + lw $t0, 20($sp) + sw $t0, 52($sp) + + # Jumping to endif_8754020063796 + j endif_8754020063796 + + endif_8754020063796: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_20 + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing internal_20 + + # Argument internal_21 + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing internal_21 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_30 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 12($sp) # internal_31 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_30 + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing internal_30 + + # Argument internal_31 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_31 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_32 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_1 = internal_32 + lw $t0, 8($sp) + sw $t0, 132($sp) + + # If internal_1 then goto then_8754020063832 + lw $t0, 132($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8754020063832 + + # Jumping to else_8754020063832 + j else_8754020063832 + + then_8754020063832: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 88 + sb $t0, 8($v0) # internal_33[0] = 'X' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_33 = "X" + + # internal_0 = internal_33 + lw $t0, 4($sp) + sw $t0, 136($sp) + + # Jumping to endif_8754020063832 + j endif_8754020063832 + + else_8754020063832: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 46 + sb $t0, 8($v0) # internal_34[0] = '.' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 0($sp) # internal_34 = "." + + # internal_0 = internal_34 + lw $t0, 0($sp) + sw $t0, 136($sp) + + # Jumping to endif_8754020063832 + j endif_8754020063832 + + endif_8754020063832: + + # Loading return value in $v1 + lw $v1, 136($sp) + + # Freeing space for local variables + addi $sp, $sp, 140 + + jr $ra + + function_evolve_at_CellularAutomaton: + # Function parameters + # $ra = 68($sp) + # self = 64($sp) + + # Reserving space for local variables + addi $sp, $sp, -64 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 60($sp) # position = address of allocated object Int + + # Allocating Int 10 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 10 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 48($sp) # internal_3 = address of allocated object Int + + # Get method num_cells of CellularAutomaton + lw $t0, 64($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 48($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 44($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 72($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_4 + lw $t0, 52($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 60($sp) # internal_2 = result of internal_4 + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing num + + # Argument internal_2 + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 68($sp) # num = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 9 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 9 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + sb $zero, 8($v0) # Null-terminator at the end of the string + + sw $v0, 40($sp) # temp = "" + + # Allocating NUll to internal_6 + sw $zero, 36($sp) # internal_6 = 0 + + while_start_8754020063916: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing position + + # Argument num + lw $t0, 68($sp) + sw $t0, 0($sp) # Storing num + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 44($sp) # internal_7 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_7 then goto while_body_8754020063916 + lw $t0, 32($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_body_8754020063916 + + # Jumping to while_end_8754020063916 + j while_end_8754020063916 + + while_body_8754020063916: + + # Allocating Int 14 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 14 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # internal_9 = address of allocated object Int + + # Get method cell_at_next_evolution of CellularAutomaton + lw $t0, 64($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 24($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 20($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 76($sp) + sw $t0, 4($sp) # Storing self + + # Argument position + lw $t0, 72($sp) + sw $t0, 0($sp) # Storing position + + # Calling function internal_10 + lw $t0, 32($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_8 = result of internal_10 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 12($sp) # internal_12 = address of allocated object Int + + # Get method concat of String + lw $t0, 40($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 12($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 8($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument temp + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing temp + + # Argument internal_8 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_8 + + # Calling function internal_13 + lw $t0, 20($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_11 = result of internal_13 + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument temp + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing temp + + # Argument internal_11 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_11 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 52($sp) # temp = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_14 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_14 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_14 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_15 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_15 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_15 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 72($sp) # position = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to while_start_8754020063916 + j while_start_8754020063916 + + while_end_8754020063916: + + # Set attribute population_map of self + lw $t0, 64($sp) # $t0 = self + lw $t1, 40($sp) # $t1 = temp + beq $t1, $zero, object_set_attribute_8754020049930 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8754020049930 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8754020049930 + j object_set_attribute_8754020049930 + int_set_attribute_8754020049930: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.population_map = temp + j end_set_attribute_8754020049930 + bool_set_attribute_8754020049930: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.population_map = temp + j end_set_attribute_8754020049930 + object_set_attribute_8754020049930: + sw $t1, 8($t0) # self.population_map = temp + end_set_attribute_8754020049930: + + # Loading return value in $v1 + lw $v1, 64($sp) + + # Freeing space for local variables + addi $sp, $sp, 64 + + jr $ra + + function___init___at_Main: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating NUll to internal_0 + sw $zero, 0($sp) # internal_0 = 0 + + # Set attribute cells of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8754020020637 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8754020020637 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8754020020637 + j object_set_attribute_8754020020637 + int_set_attribute_8754020020637: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.cells = internal_0 + j end_set_attribute_8754020020637 + bool_set_attribute_8754020020637: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.cells = internal_0 + j end_set_attribute_8754020020637 + object_set_attribute_8754020020637: + sw $t1, 8($t0) # self.cells = internal_0 + end_set_attribute_8754020020637: + + # Loading return value in $v1 + lw $v1, 4($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_main_at_Main: + # Function parameters + # $ra = 100($sp) + # self = 96($sp) + + # Reserving space for local variables + addi $sp, $sp, -96 + + # Allocating CellularAutomaton + li $v0, 9 + lw $a0, type_CellularAutomaton + syscall + la $t0, type_CellularAutomaton # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 92($sp) # internal_0 = address of allocated object CellularAutomaton + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 100($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_CellularAutomaton + jal function___init___at_CellularAutomaton + lw $ra, 4($sp) + sw $v1, 100($sp) # internal_0 = result of function___init___at_CellularAutomaton + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 28 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 28 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_1[0] = ' ' + + addi $t0, $zero, 32 + sb $t0, 9($v0) # internal_1[1] = ' ' + + addi $t0, $zero, 32 + sb $t0, 10($v0) # internal_1[2] = ' ' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_1[3] = ' ' + + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_1[4] = ' ' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_1[5] = ' ' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_1[6] = ' ' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_1[7] = ' ' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_1[8] = ' ' + + addi $t0, $zero, 88 + sb $t0, 17($v0) # internal_1[9] = 'X' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_1[10] = ' ' + + addi $t0, $zero, 32 + sb $t0, 19($v0) # internal_1[11] = ' ' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_1[12] = ' ' + + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_1[13] = ' ' + + addi $t0, $zero, 32 + sb $t0, 22($v0) # internal_1[14] = ' ' + + addi $t0, $zero, 32 + sb $t0, 23($v0) # internal_1[15] = ' ' + + addi $t0, $zero, 32 + sb $t0, 24($v0) # internal_1[16] = ' ' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_1[17] = ' ' + + addi $t0, $zero, 32 + sb $t0, 26($v0) # internal_1[18] = ' ' + + sb $zero, 27($v0) # Null-terminator at the end of the string + + sw $v0, 88($sp) # internal_1 = " X " + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 80($sp) # internal_3 = address of allocated object Int + + # Get method init of CellularAutomaton + lw $t0, 92($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 80($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 76($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 104($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_1 + lw $t0, 100($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function internal_4 + lw $t0, 88($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 96($sp) # internal_2 = result of internal_4 + addi $sp, $sp, 12 # Freeing space for arguments + + # Set attribute cells of self + lw $t0, 96($sp) # $t0 = self + lw $t1, 84($sp) # $t1 = internal_2 + beq $t1, $zero, object_set_attribute_8754020050143 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8754020050143 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8754020050143 + j object_set_attribute_8754020050143 + int_set_attribute_8754020050143: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.cells = internal_2 + j end_set_attribute_8754020050143 + bool_set_attribute_8754020050143: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.cells = internal_2 + j end_set_attribute_8754020050143 + object_set_attribute_8754020050143: + sw $t1, 8($t0) # self.cells = internal_2 + end_set_attribute_8754020050143: + + # Get attribute cells of self + lw $t0, 96($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'cells' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8754020022092 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8754020022092 + j object_get_attribute_8754020022092 + int_get_attribute_8754020022092: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 72($sp) # internal_5 = self.cells + j end_get_attribute_8754020022092 + bool_get_attribute_8754020022092: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 72($sp) # internal_5 = self.cells + j end_get_attribute_8754020022092 + object_get_attribute_8754020022092: + sw $t1, 72($sp) # internal_5 = self.cells + end_get_attribute_8754020022092: + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 64($sp) # internal_7 = address of allocated object Int + + # Get method print of CellularAutomaton + lw $t0, 72($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 64($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 60($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_5 + lw $t0, 80($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function internal_8 + lw $t0, 68($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 76($sp) # internal_6 = result of internal_8 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 20 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 20 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 52($sp) # internal_10 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument countdown + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing countdown + + # Argument internal_10 + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing internal_10 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 68($sp) # countdown = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating NUll to internal_11 + sw $zero, 48($sp) # internal_11 = 0 + + while_start_8754020064841: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_12 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_12 + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing internal_12 + + # Argument countdown + lw $t0, 68($sp) + sw $t0, 0($sp) # Storing countdown + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 52($sp) # internal_13 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_13 then goto while_body_8754020064841 + lw $t0, 40($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_body_8754020064841 + + # Jumping to while_end_8754020064841 + j while_end_8754020064841 + + while_body_8754020064841: + + # Get attribute cells of self + lw $t0, 96($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'cells' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8754020022577 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8754020022577 + j object_get_attribute_8754020022577 + int_get_attribute_8754020022577: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 36($sp) # internal_14 = self.cells + j end_get_attribute_8754020022577 + bool_get_attribute_8754020022577: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 36($sp) # internal_14 = self.cells + j end_get_attribute_8754020022577 + object_get_attribute_8754020022577: + sw $t1, 36($sp) # internal_14 = self.cells + end_get_attribute_8754020022577: + + # Allocating Int 15 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 15 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_16 = address of allocated object Int + + # Get method evolve of CellularAutomaton + lw $t0, 36($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 28($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 24($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_14 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_14 + + # Calling function internal_17 + lw $t0, 32($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 40($sp) # internal_15 = result of internal_17 + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute cells of self + lw $t0, 96($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'cells' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8754020022631 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8754020022631 + j object_get_attribute_8754020022631 + int_get_attribute_8754020022631: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($sp) # internal_18 = self.cells + j end_get_attribute_8754020022631 + bool_get_attribute_8754020022631: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($sp) # internal_18 = self.cells + j end_get_attribute_8754020022631 + object_get_attribute_8754020022631: + sw $t1, 20($sp) # internal_18 = self.cells + end_get_attribute_8754020022631: + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 12($sp) # internal_20 = address of allocated object Int + + # Get method print of CellularAutomaton + lw $t0, 20($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 12($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 8($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_18 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_18 + + # Calling function internal_21 + lw $t0, 16($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 24($sp) # internal_19 = result of internal_21 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_22 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument countdown + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing countdown + + # Argument internal_22 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_22 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_23 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument countdown + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing countdown + + # Argument internal_23 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_23 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 68($sp) # countdown = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to while_start_8754020064841 + j while_start_8754020064841 + + while_end_8754020064841: + + # Loading return value in $v1 + lw $v1, 96($sp) + + # Freeing space for local variables + addi $sp, $sp, 96 + + jr $ra + + main: + # Reserving space for local variables + addi $sp, $sp, -16 + + # Allocating Main + li $v0, 9 + lw $a0, type_Main + syscall + la $t0, type_Main # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 12($sp) # internal_0 = address of allocated object Main + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_Main + jal function___init___at_Main + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_0 = result of function___init___at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_2 = address of allocated object Int + + # Get method main of Main + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function internal_3 + lw $t0, 8($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_1 = result of internal_3 + addi $sp, $sp, 8 # Freeing space for arguments + + # Exit program + li $v0, 10 + syscall + + \ No newline at end of file diff --git a/tests/codegen/cells_output.txt b/tests/codegen/cells_output.txt index 6304902cc..9d06c27bc 100644 --- a/tests/codegen/cells_output.txt +++ b/tests/codegen/cells_output.txt @@ -1,21 +1,21 @@ - X -........XXX........ -.......X...X....... -......XXX.XXX...... -.....X.......X..... -....XXX.....XXX.... -...X...X...X...X... -..XXX.XXX.XXX.XXX.. -.X...............X. -XXX.............XXX -...X...........X... -..XXX.........XXX.. -.X...X.......X...X. -XXX.XXX.....XXX.XXX -.......X...X....... -......XXX.XXX...... -.....X.......X..... -....XXX.....XXX.... -...X...X...X...X... -..XXX.XXX.XXX.XXX.. -.X...............X. + X +........XXX........ +.......X...X....... +......XXX.XXX...... +.....X.......X..... +....XXX.....XXX.... +...X...X...X...X... +..XXX.XXX.XXX.XXX.. +.X...............X. +XXX.............XXX +...X...........X... +..XXX.........XXX.. +.X...X.......X...X. +XXX.XXX.....XXX.XXX +.......X...X....... +......XXX.XXX...... +.....X.......X..... +....XXX.....XXX.... +...X...X...X...X... +..XXX.XXX.XXX.XXX.. +.X...............X. diff --git a/tests/codegen/complex.cl b/tests/codegen/complex.cl index 0b7aa44e9..9edb6151d 100755 --- a/tests/codegen/complex.cl +++ b/tests/codegen/complex.cl @@ -1,52 +1,52 @@ -class Main inherits IO { - main() : IO { - (let c : Complex <- (new Complex).init(1, 1) in - if c.reflect_X().reflect_Y() = c.reflect_0() - then out_string("=)\n") - else out_string("=(\n") - fi - ) - }; -}; - -class Complex inherits IO { - x : Int; - y : Int; - - init(a : Int, b : Int) : Complex { - { - x = a; - y = b; - self; - } - }; - - print() : Object { - if y = 0 - then out_int(x) - else out_int(x).out_string("+").out_int(y).out_string("I") - fi - }; - - reflect_0() : Complex { - { - x = ~x; - y = ~y; - self; - } - }; - - reflect_X() : Complex { - { - y = ~y; - self; - } - }; - - reflect_Y() : Complex { - { - x = ~x; - self; - } - }; -}; +class Main inherits IO { + main() : IO { + (let c : Complex <- (new Complex).init(1, 1) in + if c.reflect_X().reflect_Y() = c.reflect_0() + then out_string("=)\n") + else out_string("=(\n") + fi + ) + }; +}; + +class Complex inherits IO { + x : Int; + y : Int; + + init(a : Int, b : Int) : Complex { + { + x = a; + y = b; + self; + } + }; + + print() : Object { + if y = 0 + then out_int(x) + else out_int(x).out_string("+").out_int(y).out_string("I") + fi + }; + + reflect_0() : Complex { + { + x = ~x; + y = ~y; + self; + } + }; + + reflect_X() : Complex { + { + y = ~y; + self; + } + }; + + reflect_Y() : Complex { + { + x = ~x; + self; + } + }; +}; diff --git a/tests/codegen/complex.mips b/tests/codegen/complex.mips new file mode 100644 index 000000000..a433db5d5 --- /dev/null +++ b/tests/codegen/complex.mips @@ -0,0 +1,3376 @@ +.data + type_Object: .word 24 + type_Object_inherits_from: .word 0 + type_Object_name_address: .word type_Object_name_size + type_Object___init__: .word function___init___at_Object + type_Object_abort: .word function_abort_at_Object + type_Object_type_name: .word function_type_name_at_Object + type_Object_copy: .word function_copy_at_Object + + type_IO: .word 40 + type_IO_inherits_from: .word type_Object + type_IO_name_address: .word type_IO_name_size + type_IO___init__: .word function___init___at_IO + type_IO_abort: .word function_abort_at_Object + type_IO_type_name: .word function_type_name_at_Object + type_IO_copy: .word function_copy_at_Object + type_IO_out_string: .word function_out_string_at_IO + type_IO_out_int: .word function_out_int_at_IO + type_IO_in_string: .word function_in_string_at_IO + type_IO_in_int: .word function_in_int_at_IO + + type_String: .word 36 + type_String_inherits_from: .word type_Object + type_String_name_address: .word type_String_name_size + type_String___init__: .word function___init___at_String + type_String_abort: .word function_abort_at_Object + type_String_type_name: .word function_type_name_at_Object + type_String_copy: .word function_copy_at_Object + type_String_length: .word function_length_at_String + type_String_concat: .word function_concat_at_String + type_String_substr: .word function_substr_at_String + + type_Int: .word 24 + type_Int_inherits_from: .word type_Object + type_Int_name_address: .word type_Int_name_size + type_Int___init__: .word function___init___at_Int + type_Int_abort: .word function_abort_at_Object + type_Int_type_name: .word function_type_name_at_Object + type_Int_copy: .word function_copy_at_Object + + type_Bool: .word 24 + type_Bool_inherits_from: .word type_Object + type_Bool_name_address: .word type_Bool_name_size + type_Bool___init__: .word function___init___at_Bool + type_Bool_abort: .word function_abort_at_Object + type_Bool_type_name: .word function_type_name_at_Object + type_Bool_copy: .word function_copy_at_Object + + type_Main: .word 44 + type_Main_inherits_from: .word type_IO + type_Main_name_address: .word type_Main_name_size + type_Main___init__: .word function___init___at_Main + type_Main_abort: .word function_abort_at_Object + type_Main_type_name: .word function_type_name_at_Object + type_Main_copy: .word function_copy_at_Object + type_Main_out_string: .word function_out_string_at_IO + type_Main_out_int: .word function_out_int_at_IO + type_Main_in_string: .word function_in_string_at_IO + type_Main_in_int: .word function_in_int_at_IO + type_Main_main: .word function_main_at_Main + + type_Complex: .word 68 + type_Complex_inherits_from: .word type_IO + type_Complex_name_address: .word type_Complex_name_size + type_Complex___init__: .word function___init___at_Complex + type_Complex_abort: .word function_abort_at_Object + type_Complex_type_name: .word function_type_name_at_Object + type_Complex_copy: .word function_copy_at_Object + type_Complex_out_string: .word function_out_string_at_IO + type_Complex_out_int: .word function_out_int_at_IO + type_Complex_in_string: .word function_in_string_at_IO + type_Complex_in_int: .word function_in_int_at_IO + type_Complex_init: .word function_init_at_Complex + type_Complex_print: .word function_print_at_Complex + type_Complex_reflect_0: .word function_reflect_0_at_Complex + type_Complex_reflect_X: .word function_reflect_X_at_Complex + type_Complex_reflect_Y: .word function_reflect_Y_at_Complex + + type_Object_name_size: .word 6 + type_Object_name: .asciiz "Object" + + type_IO_name_size: .word 2 + type_IO_name: .asciiz "IO" + + type_String_name_size: .word 6 + type_String_name: .asciiz "String" + + type_Int_name_size: .word 3 + type_Int_name: .asciiz "Int" + + type_Bool_name_size: .word 4 + type_Bool_name: .asciiz "Bool" + + type_Main_name_size: .word 4 + type_Main_name: .asciiz "Main" + + type_Complex_name_size: .word 7 + type_Complex_name: .asciiz "Complex" + + buffer_input: .space 1024 + debug_log: .asciiz "debug_log\n" + +.text + function_add: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Addition operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + add $t2, $t0, $t1 # $t2 = $t0 + $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_sub: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Subtraction operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sub $t2, $t0, $t1 # $t2 = $t0 - $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_mult: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Multiplication operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + mult $t0, $t1 # $t2 = $t0 * $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_div: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Division operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + div $t0, $t1 # $t2 = $t0 / $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_xor: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Xor operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than_or_equal: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sle $t2, $t0, $t1 # $t2 = $t0 <= $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_equal: + # Function parameters + # $ra = 48($sp) + # a = 44($sp) + # b = 40($sp) + + # Reserving space for local variables + addi $sp, $sp, -40 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_0 = address of allocated object Int + + # Allocating NUll to internal_1 + sw $zero, 32($sp) # internal_1 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_2 = address of allocated object Int + + # internal_2 = EqualAddress(a, internal_1) + lw $t0, 44($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # internal_2 = EqualAddress(b, internal_1) + lw $t0, 40($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # If internal_2 then goto a_is_type_object + lw $t0, 28($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_object + + # internal_3 = typeof a that is the first word of the object + lw $t0, 44($sp) + lw $t0, 0($t0) + sw $t0, 24($sp) + + # internal_4 = direction of Int + la $t0, type_Int + sw $t0, 20($sp) + + # internal_5 = direction of Bool + la $t0, type_Bool + sw $t0, 16($sp) + + # internal_6 = direction of String + la $t0, type_String + sw $t0, 12($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_7 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_8 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_9 = address of allocated object Int + + # internal_7 = EqualAddress(internal_3, internal_4) + lw $t0, 24($sp) + lw $t1, 20($sp) + seq $t2, $t0, $t1 + lw $t0, 8($sp) + sw $t2, 8($t0) + + # internal_8 = EqualAddress(internal_3, internal_5) + lw $t0, 24($sp) + lw $t1, 16($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_9 = EqualAddress(internal_3, internal_6) + lw $t0, 24($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_7 then goto a_is_type_int_or_bool + lw $t0, 8($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_8 then goto a_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_9 then goto a_is_type_string + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_string + + # Jumping to a_is_type_object + j a_is_type_object + + a_is_type_int_or_bool: + + # internal_0 = EqualInt(a, b) + lw $t0, 44($sp) + lw $t0, 8($t0) + lw $t1, 40($sp) + lw $t1, 8($t1) + seq $t2, $t0, $t1 + lw $t0, 36($sp) + sw $t2, 8($t0) + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_string: + + # internal_0 = EqualStr(a, b) + lw $t0, 44($sp) + lw $t1, 40($sp) + addi $t0, $t0, 8 + addi $t1, $t1, 8 + + # By default we assume the strings are equals + addi $t4, $zero, 1 + lw $t5, 36($sp) + sw $t4, 8($t5) + + while_compare_strings_start: + lb $t2, 0($t0) + lb $t3, 0($t1) + beq $t2, $t3, while_compare_strings_update + + # The strings are no equals + lw $t5, 36($sp) + sw $zero, 8($t5) + j while_compare_strings_end + + while_compare_strings_update: + addi $t0, $t0, 1 + addi $t1, $t1, 1 + beq $t2, $zero, while_compare_strings_end + beq $t3, $zero, while_compare_strings_end + j while_compare_strings_start + while_compare_strings_end: + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_object: + + # Equal operation + lw $t0, 44($sp) # Save in $t0 the left operand address + lw $t1, 40($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 36($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Jumping to end_of_equal + j end_of_equal + + end_of_equal: + + # Loading return value in $v1 + lw $v1, 36($sp) + + # Freeing space for local variables + addi $sp, $sp, 40 + + jr $ra + + function_assign: + # Function parameters + # $ra = 36($sp) + # dest = 32($sp) + # source = 28($sp) + + # Reserving space for local variables + addi $sp, $sp, -28 + + # Allocating NUll to internal_0 + sw $zero, 24($sp) # internal_0 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_1 = address of allocated object Int + + # internal_1 = EqualAddress(source, internal_0) + lw $t0, 28($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # internal_1 = EqualAddress(dest, internal_0) + lw $t0, 32($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # If internal_1 then goto source_is_type_object + lw $t0, 20($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_object + + # internal_2 = typeof source that is the first word of the object + lw $t0, 28($sp) + lw $t0, 0($t0) + sw $t0, 16($sp) + + # internal_3 = direction of Int + la $t0, type_Int + sw $t0, 12($sp) + + # internal_4 = direction of Bool + la $t0, type_Bool + sw $t0, 8($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_5 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_6 = address of allocated object Int + + # internal_5 = EqualAddress(internal_2, internal_3) + lw $t0, 16($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_6 = EqualAddress(internal_2, internal_4) + lw $t0, 16($sp) + lw $t1, 8($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_5 then goto source_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # If internal_6 then goto source_is_type_int_or_bool + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # Jumping to source_is_type_object + j source_is_type_object + + source_is_type_int_or_bool: + + # dest = source where source is an integer + li $v0, 9 + addi $a0, $zero, 12 + syscall + lw $t0, 28($sp) # Pointer to source + lw $t1, 0($t0) # $t1 = type of source + lw $t2, 8($t0) # $t2 = value of source + sw $t1, 0($v0) # Save type of dest + sw $a0, 4($v0) # Save size of dest + sw $t2, 8($v0) # Save value of dest + sw $v0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_is_type_object: + + # dest = source + lw $t0, 28($sp) + sw $t0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_end_of_equal: + + # Loading return value in $v1 + lw $v1, 32($sp) + + # Freeing space for local variables + addi $sp, $sp, 28 + + jr $ra + + function___init___at_Object: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_abort_at_Object: + # Function parameters + # $ra = 28($sp) + # self = 24($sp) + + # Reserving space for local variables + addi $sp, $sp, -24 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 33 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 33 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 65 + sb $t0, 8($v0) # internal_0[0] = 'A' + + addi $t0, $zero, 98 + sb $t0, 9($v0) # internal_0[1] = 'b' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_0[2] = 'o' + + addi $t0, $zero, 114 + sb $t0, 11($v0) # internal_0[3] = 'r' + + addi $t0, $zero, 116 + sb $t0, 12($v0) # internal_0[4] = 't' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_0[5] = ' ' + + addi $t0, $zero, 99 + sb $t0, 14($v0) # internal_0[6] = 'c' + + addi $t0, $zero, 97 + sb $t0, 15($v0) # internal_0[7] = 'a' + + addi $t0, $zero, 108 + sb $t0, 16($v0) # internal_0[8] = 'l' + + addi $t0, $zero, 108 + sb $t0, 17($v0) # internal_0[9] = 'l' + + addi $t0, $zero, 101 + sb $t0, 18($v0) # internal_0[10] = 'e' + + addi $t0, $zero, 100 + sb $t0, 19($v0) # internal_0[11] = 'd' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_0[12] = ' ' + + addi $t0, $zero, 102 + sb $t0, 21($v0) # internal_0[13] = 'f' + + addi $t0, $zero, 114 + sb $t0, 22($v0) # internal_0[14] = 'r' + + addi $t0, $zero, 111 + sb $t0, 23($v0) # internal_0[15] = 'o' + + addi $t0, $zero, 109 + sb $t0, 24($v0) # internal_0[16] = 'm' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_0[17] = ' ' + + addi $t0, $zero, 99 + sb $t0, 26($v0) # internal_0[18] = 'c' + + addi $t0, $zero, 108 + sb $t0, 27($v0) # internal_0[19] = 'l' + + addi $t0, $zero, 97 + sb $t0, 28($v0) # internal_0[20] = 'a' + + addi $t0, $zero, 115 + sb $t0, 29($v0) # internal_0[21] = 's' + + addi $t0, $zero, 115 + sb $t0, 30($v0) # internal_0[22] = 's' + + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_0[23] = ' ' + + sb $zero, 32($v0) # Null-terminator at the end of the string + + sw $v0, 20($sp) # internal_0 = "Abort called from class " + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_3[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 8($sp) # internal_3 = "\n" + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method type_name of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_5 + lw $t0, 8($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 24($sp) # internal_1 = result of internal_5 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_1 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_2 = result of internal_5 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_3 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_2 = result of internal_5 + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 12($sp) # $t0 = internal_2 + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the String internal_2 + li $v0, 4 + move $a0, $t0 + syscall + + # Exit program + li $v0, 10 + syscall + + # Loading return value in $v1 + lw $v1, 24($sp) + + # Freeing space for local variables + addi $sp, $sp, 24 + + jr $ra + + function_type_name_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = name of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 8($t1) # $t2 = direction of the type name + la $t3, 4($t2) # $t3 = address of the name + lw $t2, 0($t2) # $t2 = length of the name + + addi $t2, $t2, 9 # Setting space for the type, the size and the null byte + li $v0, 9 + move $a0, $t2 + syscall + addi $t2, $t2, -9 # Restoring space for the type, the size and the null byte + + la $t4, type_String + sw $t4, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t4, $v0, 0 # $t4 = direction of the new string + addi $t4, $t4, 8 # Pointer to the first character of the string + xor $t5, $t5, $t5 # Initializing counter + while_copy_name_start: + beq $t5, $t2, while_copy_name_end + lb $t6, 0($t3) # Loading the character + sb $t6, 0($t4) + addi $t4, $t4, 1 # Incrementing the pointer to the new string + addi $t3, $t3, 1 # Incrementing the pointer to the string in self + addi $t5, $t5, 1 # Incrementing counter + j while_copy_name_start + while_copy_name_end: + + sb $zero, 0($t4) # Setting the null byte + + sw $v0, 0($sp) # Storing the new string in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_copy_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = copy of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 4($t0) # $t2 = length of self in bytes + + # Allocating space for the new object + li $v0, 9 + move $a0, $t2 + syscall + move $t3, $v0 # $t3 = direction of the new object + sw $t1, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + # Initializing the variable of the loop + addi $t0, $t0, 8 # Pointer to the first character of the object + addi $t3, $t3, 8 # Pointer to the first character of the object + addi $t2, $2, -8 # Decrementing in 8 the length of the object + xor $t4, $t4, $t4 # Initializing counter + + # Loop copying the object + while_copy_start: + beq $t4, $t2, while_copy_end + lb $t5, 0($t0) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t0, $t0, 1 # Incrementing the pointer to the object + addi $t3, $t3, 1 # Incrementing the pointer to the new object + addi $t4, $t4, 1 # Incrementing counter + j while_copy_start + while_copy_end: + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_IO: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_out_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + lw $t0, 0($sp) # $t0 = x + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the String x + li $v0, 4 + move $a0, $t0 + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_out_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + # Printing the Int x + li $v0, 1 + lw $a0, 0($sp) + lw $a0, 8($a0) + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_in_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + li $v0, 8 + la $a0, buffer_input + li $a1, 1024 + syscall + + xor $t0, $t0, $t0 # Initializing counter + while_read_start: + lb $t1, buffer_input($t0) # Loading the byte + addi $t2, $zero, 10 + beq $t1, $t2, while_read_end + addi $t2, $zero, 13 + beq $t1, $t2, while_read_end + addi $t0, $t0, 1 # Incrementing counter + j while_read_start + while_read_end: + + addi $t0, $t0, 9 # Adding space for the type, the size and the null byte + li $v0, 9 + move $a0, $t0 + syscall + addi $t0, $t0, -9 # Adding space for the type, the size and the null byte + la $t2, type_String + sw $t2, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t3, $v0, 8 # Pointer to the first character of the string + xor $t4, $t4, $t4 # Initializing counter + + while_copy_from_buffer_start: + beq $t4, $t0, while_copy_from_buffer_end + lb $t5, buffer_input($t4) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t3, $t3, 1 # Imcremeenting pointer + addi $t4, $t4, 1 # Incrementing counter + j while_copy_from_buffer_start + while_copy_from_buffer_end: + + sb $zero, 0($t3) # Storing the null byte + + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_in_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + li $v0, 5 + syscall + lw $t0, 0($sp) + sw $v0, 8($t0) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_String: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_length_at_String: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # internal_0 = length of self + lw $t0, 4($sp) + lw $t1, 4($t0) + addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator + lw $t0, 0($sp) + sw $t1, 8($t0) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_concat_at_String: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + # s = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self + s + lw $t0, 8($sp) + lw $t1, 4($sp) + lw $t2, 4($t0) # $t2 = length of str1 + lw $t3, 4($t1) # $t3 = length of str2 + addi $t2, $t2, -9 + addi $t3, $t3, -9 + add $t4, $t2, $t3 # $t4 = length of str1 + str2 + addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) + + li $v0, 9 + move $a0, $t4 + syscall + addi $t4, $t4, -9 # Restoring $t4 = length of str1 + str2 + add $t5, $zero, $v0 # $t5 = address of the new string object + addi $t5, $t5, 8 # $t5 = address of the first byte of the new string + + la $t8, type_String + sw $t8, 0($v0) # Setting type in the first word of th object + + sw $a0, 4($v0) # Setting length of the string in the second word of the object + + # Copying str1 to the new string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_str1_start: + beq $t6, $t2, while_copy_str1_end + lb $t7, 8($t0) + sb $t7, 0($t5) + add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str1_start + while_copy_str1_end: + + # Copying str2 to the new string + while_copy_str2_start: + beq $t6, $t4, while_copy_str2_end + lb $t7, 8($t1) + sb $t7, 0($t5) + add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str2_start + while_copy_str2_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self + s + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_substr_at_String: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + # i = 8($sp) + # l = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self[i:i + l] + lw $t0, 12($sp) # $t0 = address of the string + lw $t1, 4($t0) # $t1 = length of the string + addi $t1, $t1, -9 # $t1 = length of the string + 9 + lw $t2, 8($sp) # $t2 = start of the substring + lw $t2, 8($t2) + lw $t3, 4($sp) # $t3 = length of the substring + lw $t3, 8($t3) + add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring + + bgt $t4, $t1, substring_out_of_bounds + + addi $t3, $t3, 9 + li $v0, 9 + move $a0, $t3 + syscall + addi $t3, $t3, -9 + + la $t5, type_String + sw $t5, 0($v0) # Setting type in the first word of the object + + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t0, $t0, 8 # pointing to the first byte of the string + add $t0, $t0, $t2 # pointing to the first byte of the substring + move $t5, $v0 # $t5 = address of the new string + add $t5, $t5, 8 # pointing to the first byte of the string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_substr_start: + beq $t6, $t3, while_copy_substr_end + lb $t7, 0($t0) + sb $t7, 0($t5) + addi $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of the string + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_substr_start + while_copy_substr_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self[i:i + l] + j substring_not_out_of_bounds + + substring_out_of_bounds: + li $v0, 17 + addi $a0, $zero, 1 + syscall + + substring_not_out_of_bounds: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_Int: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function___init___at_Bool: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function___init___at_Main: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_main_at_Main: + # Function parameters + # $ra = 112($sp) + # self = 108($sp) + + # Reserving space for local variables + addi $sp, $sp, -108 + + # Allocating Complex + li $v0, 9 + lw $a0, type_Complex + syscall + la $t0, type_Complex # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 100($sp) # internal_1 = address of allocated object Complex + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_1 + lw $t0, 108($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function___init___at_Complex + jal function___init___at_Complex + lw $ra, 4($sp) + sw $v1, 108($sp) # internal_1 = result of function___init___at_Complex + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 96($sp) # internal_2 = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 92($sp) # internal_3 = address of allocated object Int + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 84($sp) # internal_5 = address of allocated object Int + + # Get method init of Complex + lw $t0, 100($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 84($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 80($sp) + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument internal_1 + lw $t0, 116($sp) + sw $t0, 8($sp) # Storing internal_1 + + # Argument internal_2 + lw $t0, 112($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_3 + lw $t0, 108($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function internal_6 + lw $t0, 96($sp) + jalr $t0 + lw $ra, 12($sp) + sw $v1, 104($sp) # internal_4 = result of internal_6 + addi $sp, $sp, 16 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument c + lw $t0, 116($sp) + sw $t0, 4($sp) # Storing c + + # Argument internal_4 + lw $t0, 100($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 116($sp) # c = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 72($sp) # internal_8 = address of allocated object Int + + # Allocating Int 11 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 11 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 64($sp) # internal_10 = address of allocated object Int + + # Get method reflect_X of Complex + lw $t0, 104($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 64($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 60($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument c + lw $t0, 112($sp) + sw $t0, 0($sp) # Storing c + + # Calling function internal_11 + lw $t0, 68($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 76($sp) # internal_9 = result of internal_11 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 12 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 12 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 52($sp) # internal_13 = address of allocated object Int + + # Get method reflect_Y of Complex + lw $t0, 68($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 52($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 48($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_9 + lw $t0, 76($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function internal_14 + lw $t0, 56($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 64($sp) # internal_12 = result of internal_14 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 10 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 10 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_16 = address of allocated object Int + + # Get method reflect_0 of Complex + lw $t0, 104($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 40($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 36($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument c + lw $t0, 112($sp) + sw $t0, 0($sp) # Storing c + + # Calling function internal_17 + lw $t0, 44($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 52($sp) # internal_15 = result of internal_17 + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_12 + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing internal_12 + + # Argument internal_15 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_15 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 44($sp) # internal_18 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_8 = internal_18 + lw $t0, 32($sp) + sw $t0, 72($sp) + + # If internal_8 then goto then_8758062354023 + lw $t0, 72($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8758062354023 + + # Jumping to else_8758062354023 + j else_8758062354023 + + then_8758062354023: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 12 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 12 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 61 + sb $t0, 8($v0) # internal_19[0] = '=' + + addi $t0, $zero, 41 + sb $t0, 9($v0) # internal_19[1] = ')' + + addi $t0, $zero, 10 + sb $t0, 10($v0) # internal_19[2] = '\n' + + sb $zero, 11($v0) # Null-terminator at the end of the string + + sw $v0, 28($sp) # internal_19 = "=)\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_21 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 108($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 20($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 16($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 120($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_19 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_19 + + # Calling function internal_22 + lw $t0, 28($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_20 = result of internal_22 + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_7 = internal_20 + lw $t0, 24($sp) + sw $t0, 76($sp) + + # Jumping to endif_8758062354023 + j endif_8758062354023 + + else_8758062354023: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 12 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 12 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 61 + sb $t0, 8($v0) # internal_23[0] = '=' + + addi $t0, $zero, 40 + sb $t0, 9($v0) # internal_23[1] = '(' + + addi $t0, $zero, 10 + sb $t0, 10($v0) # internal_23[2] = '\n' + + sb $zero, 11($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_23 = "=(\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_25 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 108($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 120($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_23 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_23 + + # Calling function internal_26 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_24 = result of internal_26 + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_7 = internal_24 + lw $t0, 8($sp) + sw $t0, 76($sp) + + # Jumping to endif_8758062354023 + j endif_8758062354023 + + endif_8758062354023: + + # Loading return value in $v1 + lw $v1, 76($sp) + + # Freeing space for local variables + addi $sp, $sp, 108 + + jr $ra + + function___init___at_Complex: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + + # Reserving space for local variables + addi $sp, $sp, -8 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_0 = address of allocated object Int + + # Set attribute x of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 4($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8758062313289 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8758062313289 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8758062313289 + j object_set_attribute_8758062313289 + int_set_attribute_8758062313289: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.x = internal_0 + j end_set_attribute_8758062313289 + bool_set_attribute_8758062313289: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.x = internal_0 + j end_set_attribute_8758062313289 + object_set_attribute_8758062313289: + sw $t1, 8($t0) # self.x = internal_0 + end_set_attribute_8758062313289: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_1 = address of allocated object Int + + # Set attribute y of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_1 + beq $t1, $zero, object_set_attribute_8758062313310 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8758062313310 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8758062313310 + j object_set_attribute_8758062313310 + int_set_attribute_8758062313310: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.y = internal_1 + j end_set_attribute_8758062313310 + bool_set_attribute_8758062313310: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.y = internal_1 + j end_set_attribute_8758062313310 + object_set_attribute_8758062313310: + sw $t1, 12($t0) # self.y = internal_1 + end_set_attribute_8758062313310: + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 8 + + jr $ra + + function_init_at_Complex: + # Function parameters + # $ra = 28($sp) + # self = 24($sp) + # a = 20($sp) + # b = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Get attribute x of self + lw $t0, 24($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'x' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8758062313373 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8758062313373 + j object_get_attribute_8758062313373 + int_get_attribute_8758062313373: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_0 = self.x + j end_get_attribute_8758062313373 + bool_get_attribute_8758062313373: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_0 = self.x + j end_get_attribute_8758062313373 + object_get_attribute_8758062313373: + sw $t1, 12($sp) # internal_0 = self.x + end_get_attribute_8758062313373: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument a + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing a + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_1 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute y of self + lw $t0, 24($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'y' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8758062313412 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8758062313412 + j object_get_attribute_8758062313412 + int_get_attribute_8758062313412: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 4($sp) # internal_2 = self.y + j end_get_attribute_8758062313412 + bool_get_attribute_8758062313412: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 4($sp) # internal_2 = self.y + j end_get_attribute_8758062313412 + object_get_attribute_8758062313412: + sw $t1, 4($sp) # internal_2 = self.y + end_get_attribute_8758062313412: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 16($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument b + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing b + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_3 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 24($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 + + jr $ra + + function_print_at_Complex: + # Function parameters + # $ra = 104($sp) + # self = 100($sp) + + # Reserving space for local variables + addi $sp, $sp, -100 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 92($sp) # internal_1 = address of allocated object Int + + # Get attribute y of self + lw $t0, 100($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'y' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8758062314262 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8758062314262 + j object_get_attribute_8758062314262 + int_get_attribute_8758062314262: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 88($sp) # internal_2 = self.y + j end_get_attribute_8758062314262 + bool_get_attribute_8758062314262: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 88($sp) # internal_2 = self.y + j end_get_attribute_8758062314262 + object_get_attribute_8758062314262: + sw $t1, 88($sp) # internal_2 = self.y + end_get_attribute_8758062314262: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 84($sp) # internal_3 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 100($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_3 + lw $t0, 96($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 92($sp) # internal_4 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_1 = internal_4 + lw $t0, 80($sp) + sw $t0, 92($sp) + + # If internal_1 then goto then_8758062354167 + lw $t0, 92($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8758062354167 + + # Jumping to else_8758062354167 + j else_8758062354167 + + then_8758062354167: + + # Get attribute x of self + lw $t0, 100($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'x' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8758062314343 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8758062314343 + j object_get_attribute_8758062314343 + int_get_attribute_8758062314343: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 76($sp) # internal_5 = self.x + j end_get_attribute_8758062314343 + bool_get_attribute_8758062314343: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 76($sp) # internal_5 = self.x + j end_get_attribute_8758062314343 + object_get_attribute_8758062314343: + sw $t1, 76($sp) # internal_5 = self.x + end_get_attribute_8758062314343: + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 68($sp) # internal_7 = address of allocated object Int + + # Get method out_int of Complex + lw $t0, 100($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 68($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 64($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 112($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_5 + lw $t0, 88($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function internal_8 + lw $t0, 76($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 84($sp) # internal_6 = result of internal_8 + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_0 = internal_6 + lw $t0, 72($sp) + sw $t0, 96($sp) + + # Jumping to endif_8758062354167 + j endif_8758062354167 + + else_8758062354167: + + # Get attribute x of self + lw $t0, 100($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'x' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8758062314460 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8758062314460 + j object_get_attribute_8758062314460 + int_get_attribute_8758062314460: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 60($sp) # internal_9 = self.x + j end_get_attribute_8758062314460 + bool_get_attribute_8758062314460: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 60($sp) # internal_9 = self.x + j end_get_attribute_8758062314460 + object_get_attribute_8758062314460: + sw $t1, 60($sp) # internal_9 = self.x + end_get_attribute_8758062314460: + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 52($sp) # internal_11 = address of allocated object Int + + # Get method out_int of Complex + lw $t0, 100($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 52($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 48($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 112($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_9 + lw $t0, 72($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function internal_12 + lw $t0, 60($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 68($sp) # internal_10 = result of internal_12 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 43 + sb $t0, 8($v0) # internal_13[0] = '+' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 44($sp) # internal_13 = "+" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_15 = address of allocated object Int + + # Get method out_string of Complex + lw $t0, 56($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 36($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 32($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_10 + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing internal_10 + + # Argument internal_13 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_13 + + # Calling function internal_16 + lw $t0, 44($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 52($sp) # internal_14 = result of internal_16 + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute y of self + lw $t0, 100($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'y' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8758062314816 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8758062314816 + j object_get_attribute_8758062314816 + int_get_attribute_8758062314816: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 28($sp) # internal_17 = self.y + j end_get_attribute_8758062314816 + bool_get_attribute_8758062314816: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 28($sp) # internal_17 = self.y + j end_get_attribute_8758062314816 + object_get_attribute_8758062314816: + sw $t1, 28($sp) # internal_17 = self.y + end_get_attribute_8758062314816: + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_19 = address of allocated object Int + + # Get method out_int of Complex + lw $t0, 40($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 20($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 16($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_14 + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing internal_14 + + # Argument internal_17 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_17 + + # Calling function internal_20 + lw $t0, 28($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_18 = result of internal_20 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 73 + sb $t0, 8($v0) # internal_21[0] = 'I' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_21 = "I" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_23 = address of allocated object Int + + # Get method out_string of Complex + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_18 + lw $t0, 36($sp) + sw $t0, 4($sp) # Storing internal_18 + + # Argument internal_21 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_21 + + # Calling function internal_24 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_22 = result of internal_24 + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_0 = internal_22 + lw $t0, 8($sp) + sw $t0, 96($sp) + + # Jumping to endif_8758062354167 + j endif_8758062354167 + + endif_8758062354167: + + # Loading return value in $v1 + lw $v1, 96($sp) + + # Freeing space for local variables + addi $sp, $sp, 100 + + jr $ra + + function_reflect_0_at_Complex: + # Function parameters + # $ra = 52($sp) + # self = 48($sp) + + # Reserving space for local variables + addi $sp, $sp, -48 + + # Get attribute x of self + lw $t0, 48($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'x' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8758062314963 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8758062314963 + j object_get_attribute_8758062314963 + int_get_attribute_8758062314963: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 44($sp) # internal_0 = self.x + j end_get_attribute_8758062314963 + bool_get_attribute_8758062314963: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 44($sp) # internal_0 = self.x + j end_get_attribute_8758062314963 + object_get_attribute_8758062314963: + sw $t1, 44($sp) # internal_0 = self.x + end_get_attribute_8758062314963: + + # Get attribute x of self + lw $t0, 48($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'x' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8758062314987 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8758062314987 + j object_get_attribute_8758062314987 + int_get_attribute_8758062314987: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 40($sp) # internal_1 = self.x + j end_get_attribute_8758062314987 + bool_get_attribute_8758062314987: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 40($sp) # internal_1 = self.x + j end_get_attribute_8758062314987 + object_get_attribute_8758062314987: + sw $t1, 40($sp) # internal_1 = self.x + end_get_attribute_8758062314987: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_2 = address of allocated object Int + + # Allocating Int 4294967295 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4294967295 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_3 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_4 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_1 + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing internal_1 + + # Argument internal_3 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_xor + jal function_xor + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_4 = result of function_xor + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_4 + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing internal_4 + + # Argument internal_2 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_4 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_4 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_5 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute y of self + lw $t0, 48($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'y' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8758062315346 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8758062315346 + j object_get_attribute_8758062315346 + int_get_attribute_8758062315346: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($sp) # internal_6 = self.y + j end_get_attribute_8758062315346 + bool_get_attribute_8758062315346: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($sp) # internal_6 = self.y + j end_get_attribute_8758062315346 + object_get_attribute_8758062315346: + sw $t1, 20($sp) # internal_6 = self.y + end_get_attribute_8758062315346: + + # Get attribute y of self + lw $t0, 48($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'y' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8758062315370 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8758062315370 + j object_get_attribute_8758062315370 + int_get_attribute_8758062315370: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($sp) # internal_7 = self.y + j end_get_attribute_8758062315370 + bool_get_attribute_8758062315370: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($sp) # internal_7 = self.y + j end_get_attribute_8758062315370 + object_get_attribute_8758062315370: + sw $t1, 16($sp) # internal_7 = self.y + end_get_attribute_8758062315370: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 12($sp) # internal_8 = address of allocated object Int + + # Allocating Int 4294967295 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4294967295 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_9 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_10 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_7 + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing internal_7 + + # Argument internal_9 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function function_xor + jal function_xor + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_10 = result of function_xor + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_10 + lw $t0, 16($sp) + sw $t0, 4($sp) # Storing internal_10 + + # Argument internal_8 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_8 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_10 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_6 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_6 + + # Argument internal_10 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_10 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_11 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 48($sp) + + # Freeing space for local variables + addi $sp, $sp, 48 + + jr $ra + + function_reflect_X_at_Complex: + # Function parameters + # $ra = 28($sp) + # self = 24($sp) + + # Reserving space for local variables + addi $sp, $sp, -24 + + # Get attribute y of self + lw $t0, 24($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'y' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8758062315487 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8758062315487 + j object_get_attribute_8758062315487 + int_get_attribute_8758062315487: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($sp) # internal_0 = self.y + j end_get_attribute_8758062315487 + bool_get_attribute_8758062315487: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($sp) # internal_0 = self.y + j end_get_attribute_8758062315487 + object_get_attribute_8758062315487: + sw $t1, 20($sp) # internal_0 = self.y + end_get_attribute_8758062315487: + + # Get attribute y of self + lw $t0, 24($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'y' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8758062315511 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8758062315511 + j object_get_attribute_8758062315511 + int_get_attribute_8758062315511: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($sp) # internal_1 = self.y + j end_get_attribute_8758062315511 + bool_get_attribute_8758062315511: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($sp) # internal_1 = self.y + j end_get_attribute_8758062315511 + object_get_attribute_8758062315511: + sw $t1, 16($sp) # internal_1 = self.y + end_get_attribute_8758062315511: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 12($sp) # internal_2 = address of allocated object Int + + # Allocating Int 4294967295 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4294967295 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_3 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_1 + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing internal_1 + + # Argument internal_3 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_xor + jal function_xor + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_4 = result of function_xor + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_4 + lw $t0, 16($sp) + sw $t0, 4($sp) # Storing internal_4 + + # Argument internal_2 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_4 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_4 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_5 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 24($sp) + + # Freeing space for local variables + addi $sp, $sp, 24 + + jr $ra + + function_reflect_Y_at_Complex: + # Function parameters + # $ra = 28($sp) + # self = 24($sp) + + # Reserving space for local variables + addi $sp, $sp, -24 + + # Get attribute x of self + lw $t0, 24($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'x' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8758062316144 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8758062316144 + j object_get_attribute_8758062316144 + int_get_attribute_8758062316144: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($sp) # internal_0 = self.x + j end_get_attribute_8758062316144 + bool_get_attribute_8758062316144: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($sp) # internal_0 = self.x + j end_get_attribute_8758062316144 + object_get_attribute_8758062316144: + sw $t1, 20($sp) # internal_0 = self.x + end_get_attribute_8758062316144: + + # Get attribute x of self + lw $t0, 24($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'x' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8758062316168 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8758062316168 + j object_get_attribute_8758062316168 + int_get_attribute_8758062316168: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($sp) # internal_1 = self.x + j end_get_attribute_8758062316168 + bool_get_attribute_8758062316168: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($sp) # internal_1 = self.x + j end_get_attribute_8758062316168 + object_get_attribute_8758062316168: + sw $t1, 16($sp) # internal_1 = self.x + end_get_attribute_8758062316168: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 12($sp) # internal_2 = address of allocated object Int + + # Allocating Int 4294967295 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4294967295 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_3 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_1 + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing internal_1 + + # Argument internal_3 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_xor + jal function_xor + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_4 = result of function_xor + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_4 + lw $t0, 16($sp) + sw $t0, 4($sp) # Storing internal_4 + + # Argument internal_2 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_4 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_4 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_5 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 24($sp) + + # Freeing space for local variables + addi $sp, $sp, 24 + + jr $ra + + main: + # Reserving space for local variables + addi $sp, $sp, -16 + + # Allocating Main + li $v0, 9 + lw $a0, type_Main + syscall + la $t0, type_Main # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 12($sp) # internal_0 = address of allocated object Main + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_Main + jal function___init___at_Main + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_0 = result of function___init___at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_2 = address of allocated object Int + + # Get method main of Main + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function internal_3 + lw $t0, 8($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_1 = result of internal_3 + addi $sp, $sp, 8 # Freeing space for arguments + + # Exit program + li $v0, 10 + syscall + + \ No newline at end of file diff --git a/tests/codegen/complex_output.txt b/tests/codegen/complex_output.txt index 18b77c1fc..7d6173685 100644 --- a/tests/codegen/complex_output.txt +++ b/tests/codegen/complex_output.txt @@ -1 +1 @@ -=) +=) diff --git a/tests/codegen/fib.cl b/tests/codegen/fib.cl index 08ceaede8..ced8cee48 100644 --- a/tests/codegen/fib.cl +++ b/tests/codegen/fib.cl @@ -1,29 +1,29 @@ -class Main inherits IO { - -- the class has features. Only methods in this case. - main(): Object { - { - out_string("Enter n to find nth fibonacci number!\n"); - out_int(fib(in_int())); - out_string("\n"); - } - }; - - fib(i : Int) : Int { -- list of formals. And the return type of the method. - let a : Int <- 1, - b : Int <- 0, - c : Int <- 0 - in - { - while (not (i = 0)) loop -- expressions are nested. - { - c <- a + b; - i <- i - 1; - b <- a; - a <- c; - } - pool; - c; - } - }; - -}; +class Main inherits IO { + -- the class has features. Only methods in this case. + main(): Object { + { + out_string("Enter n to find nth fibonacci number!\n"); + out_int(fib(in_int())); + out_string("\n"); + } + }; + + fib(i : Int) : Int { -- list of formals. And the return type of the method. + let a : Int <- 1, + b : Int <- 0, + c : Int <- 0 + in + { + while (not (i = 0)) loop -- expressions are nested. + { + c <- a + b; + i <- i - 1; + b <- a; + a <- c; + } + pool; + c; + } + }; + +}; diff --git a/tests/codegen/fib.mips b/tests/codegen/fib.mips new file mode 100644 index 000000000..41559974f --- /dev/null +++ b/tests/codegen/fib.mips @@ -0,0 +1,2193 @@ +.data + type_Object: .word 24 + type_Object_inherits_from: .word 0 + type_Object_name_address: .word type_Object_name_size + type_Object___init__: .word function___init___at_Object + type_Object_abort: .word function_abort_at_Object + type_Object_type_name: .word function_type_name_at_Object + type_Object_copy: .word function_copy_at_Object + + type_IO: .word 40 + type_IO_inherits_from: .word type_Object + type_IO_name_address: .word type_IO_name_size + type_IO___init__: .word function___init___at_IO + type_IO_abort: .word function_abort_at_Object + type_IO_type_name: .word function_type_name_at_Object + type_IO_copy: .word function_copy_at_Object + type_IO_out_string: .word function_out_string_at_IO + type_IO_out_int: .word function_out_int_at_IO + type_IO_in_string: .word function_in_string_at_IO + type_IO_in_int: .word function_in_int_at_IO + + type_String: .word 36 + type_String_inherits_from: .word type_Object + type_String_name_address: .word type_String_name_size + type_String___init__: .word function___init___at_String + type_String_abort: .word function_abort_at_Object + type_String_type_name: .word function_type_name_at_Object + type_String_copy: .word function_copy_at_Object + type_String_length: .word function_length_at_String + type_String_concat: .word function_concat_at_String + type_String_substr: .word function_substr_at_String + + type_Int: .word 24 + type_Int_inherits_from: .word type_Object + type_Int_name_address: .word type_Int_name_size + type_Int___init__: .word function___init___at_Int + type_Int_abort: .word function_abort_at_Object + type_Int_type_name: .word function_type_name_at_Object + type_Int_copy: .word function_copy_at_Object + + type_Bool: .word 24 + type_Bool_inherits_from: .word type_Object + type_Bool_name_address: .word type_Bool_name_size + type_Bool___init__: .word function___init___at_Bool + type_Bool_abort: .word function_abort_at_Object + type_Bool_type_name: .word function_type_name_at_Object + type_Bool_copy: .word function_copy_at_Object + + type_Main: .word 48 + type_Main_inherits_from: .word type_IO + type_Main_name_address: .word type_Main_name_size + type_Main___init__: .word function___init___at_Main + type_Main_abort: .word function_abort_at_Object + type_Main_type_name: .word function_type_name_at_Object + type_Main_copy: .word function_copy_at_Object + type_Main_out_string: .word function_out_string_at_IO + type_Main_out_int: .word function_out_int_at_IO + type_Main_in_string: .word function_in_string_at_IO + type_Main_in_int: .word function_in_int_at_IO + type_Main_main: .word function_main_at_Main + type_Main_fib: .word function_fib_at_Main + + type_Object_name_size: .word 6 + type_Object_name: .asciiz "Object" + + type_IO_name_size: .word 2 + type_IO_name: .asciiz "IO" + + type_String_name_size: .word 6 + type_String_name: .asciiz "String" + + type_Int_name_size: .word 3 + type_Int_name: .asciiz "Int" + + type_Bool_name_size: .word 4 + type_Bool_name: .asciiz "Bool" + + type_Main_name_size: .word 4 + type_Main_name: .asciiz "Main" + + buffer_input: .space 1024 + debug_log: .asciiz "debug_log\n" + +.text + function_add: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Addition operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + add $t2, $t0, $t1 # $t2 = $t0 + $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_sub: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Subtraction operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sub $t2, $t0, $t1 # $t2 = $t0 - $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_mult: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Multiplication operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + mult $t0, $t1 # $t2 = $t0 * $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_div: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Division operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + div $t0, $t1 # $t2 = $t0 / $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_xor: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Xor operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than_or_equal: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sle $t2, $t0, $t1 # $t2 = $t0 <= $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_equal: + # Function parameters + # $ra = 48($sp) + # a = 44($sp) + # b = 40($sp) + + # Reserving space for local variables + addi $sp, $sp, -40 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_0 = address of allocated object Int + + # Allocating NUll to internal_1 + sw $zero, 32($sp) # internal_1 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_2 = address of allocated object Int + + # internal_2 = EqualAddress(a, internal_1) + lw $t0, 44($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # internal_2 = EqualAddress(b, internal_1) + lw $t0, 40($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # If internal_2 then goto a_is_type_object + lw $t0, 28($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_object + + # internal_3 = typeof a that is the first word of the object + lw $t0, 44($sp) + lw $t0, 0($t0) + sw $t0, 24($sp) + + # internal_4 = direction of Int + la $t0, type_Int + sw $t0, 20($sp) + + # internal_5 = direction of Bool + la $t0, type_Bool + sw $t0, 16($sp) + + # internal_6 = direction of String + la $t0, type_String + sw $t0, 12($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_7 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_8 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_9 = address of allocated object Int + + # internal_7 = EqualAddress(internal_3, internal_4) + lw $t0, 24($sp) + lw $t1, 20($sp) + seq $t2, $t0, $t1 + lw $t0, 8($sp) + sw $t2, 8($t0) + + # internal_8 = EqualAddress(internal_3, internal_5) + lw $t0, 24($sp) + lw $t1, 16($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_9 = EqualAddress(internal_3, internal_6) + lw $t0, 24($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_7 then goto a_is_type_int_or_bool + lw $t0, 8($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_8 then goto a_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_9 then goto a_is_type_string + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_string + + # Jumping to a_is_type_object + j a_is_type_object + + a_is_type_int_or_bool: + + # internal_0 = EqualInt(a, b) + lw $t0, 44($sp) + lw $t0, 8($t0) + lw $t1, 40($sp) + lw $t1, 8($t1) + seq $t2, $t0, $t1 + lw $t0, 36($sp) + sw $t2, 8($t0) + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_string: + + # internal_0 = EqualStr(a, b) + lw $t0, 44($sp) + lw $t1, 40($sp) + addi $t0, $t0, 8 + addi $t1, $t1, 8 + + # By default we assume the strings are equals + addi $t4, $zero, 1 + lw $t5, 36($sp) + sw $t4, 8($t5) + + while_compare_strings_start: + lb $t2, 0($t0) + lb $t3, 0($t1) + beq $t2, $t3, while_compare_strings_update + + # The strings are no equals + lw $t5, 36($sp) + sw $zero, 8($t5) + j while_compare_strings_end + + while_compare_strings_update: + addi $t0, $t0, 1 + addi $t1, $t1, 1 + beq $t2, $zero, while_compare_strings_end + beq $t3, $zero, while_compare_strings_end + j while_compare_strings_start + while_compare_strings_end: + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_object: + + # Equal operation + lw $t0, 44($sp) # Save in $t0 the left operand address + lw $t1, 40($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 36($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Jumping to end_of_equal + j end_of_equal + + end_of_equal: + + # Loading return value in $v1 + lw $v1, 36($sp) + + # Freeing space for local variables + addi $sp, $sp, 40 + + jr $ra + + function_assign: + # Function parameters + # $ra = 36($sp) + # dest = 32($sp) + # source = 28($sp) + + # Reserving space for local variables + addi $sp, $sp, -28 + + # Allocating NUll to internal_0 + sw $zero, 24($sp) # internal_0 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_1 = address of allocated object Int + + # internal_1 = EqualAddress(source, internal_0) + lw $t0, 28($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # internal_1 = EqualAddress(dest, internal_0) + lw $t0, 32($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # If internal_1 then goto source_is_type_object + lw $t0, 20($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_object + + # internal_2 = typeof source that is the first word of the object + lw $t0, 28($sp) + lw $t0, 0($t0) + sw $t0, 16($sp) + + # internal_3 = direction of Int + la $t0, type_Int + sw $t0, 12($sp) + + # internal_4 = direction of Bool + la $t0, type_Bool + sw $t0, 8($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_5 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_6 = address of allocated object Int + + # internal_5 = EqualAddress(internal_2, internal_3) + lw $t0, 16($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_6 = EqualAddress(internal_2, internal_4) + lw $t0, 16($sp) + lw $t1, 8($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_5 then goto source_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # If internal_6 then goto source_is_type_int_or_bool + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # Jumping to source_is_type_object + j source_is_type_object + + source_is_type_int_or_bool: + + # dest = source where source is an integer + li $v0, 9 + addi $a0, $zero, 12 + syscall + lw $t0, 28($sp) # Pointer to source + lw $t1, 0($t0) # $t1 = type of source + lw $t2, 8($t0) # $t2 = value of source + sw $t1, 0($v0) # Save type of dest + sw $a0, 4($v0) # Save size of dest + sw $t2, 8($v0) # Save value of dest + sw $v0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_is_type_object: + + # dest = source + lw $t0, 28($sp) + sw $t0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_end_of_equal: + + # Loading return value in $v1 + lw $v1, 32($sp) + + # Freeing space for local variables + addi $sp, $sp, 28 + + jr $ra + + function___init___at_Object: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_abort_at_Object: + # Function parameters + # $ra = 28($sp) + # self = 24($sp) + + # Reserving space for local variables + addi $sp, $sp, -24 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 33 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 33 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 65 + sb $t0, 8($v0) # internal_0[0] = 'A' + + addi $t0, $zero, 98 + sb $t0, 9($v0) # internal_0[1] = 'b' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_0[2] = 'o' + + addi $t0, $zero, 114 + sb $t0, 11($v0) # internal_0[3] = 'r' + + addi $t0, $zero, 116 + sb $t0, 12($v0) # internal_0[4] = 't' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_0[5] = ' ' + + addi $t0, $zero, 99 + sb $t0, 14($v0) # internal_0[6] = 'c' + + addi $t0, $zero, 97 + sb $t0, 15($v0) # internal_0[7] = 'a' + + addi $t0, $zero, 108 + sb $t0, 16($v0) # internal_0[8] = 'l' + + addi $t0, $zero, 108 + sb $t0, 17($v0) # internal_0[9] = 'l' + + addi $t0, $zero, 101 + sb $t0, 18($v0) # internal_0[10] = 'e' + + addi $t0, $zero, 100 + sb $t0, 19($v0) # internal_0[11] = 'd' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_0[12] = ' ' + + addi $t0, $zero, 102 + sb $t0, 21($v0) # internal_0[13] = 'f' + + addi $t0, $zero, 114 + sb $t0, 22($v0) # internal_0[14] = 'r' + + addi $t0, $zero, 111 + sb $t0, 23($v0) # internal_0[15] = 'o' + + addi $t0, $zero, 109 + sb $t0, 24($v0) # internal_0[16] = 'm' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_0[17] = ' ' + + addi $t0, $zero, 99 + sb $t0, 26($v0) # internal_0[18] = 'c' + + addi $t0, $zero, 108 + sb $t0, 27($v0) # internal_0[19] = 'l' + + addi $t0, $zero, 97 + sb $t0, 28($v0) # internal_0[20] = 'a' + + addi $t0, $zero, 115 + sb $t0, 29($v0) # internal_0[21] = 's' + + addi $t0, $zero, 115 + sb $t0, 30($v0) # internal_0[22] = 's' + + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_0[23] = ' ' + + sb $zero, 32($v0) # Null-terminator at the end of the string + + sw $v0, 20($sp) # internal_0 = "Abort called from class " + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_3[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 8($sp) # internal_3 = "\n" + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method type_name of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_5 + lw $t0, 8($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 24($sp) # internal_1 = result of internal_5 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_1 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_2 = result of internal_5 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_3 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_2 = result of internal_5 + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 12($sp) # $t0 = internal_2 + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the String internal_2 + li $v0, 4 + move $a0, $t0 + syscall + + # Exit program + li $v0, 10 + syscall + + # Loading return value in $v1 + lw $v1, 24($sp) + + # Freeing space for local variables + addi $sp, $sp, 24 + + jr $ra + + function_type_name_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = name of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 8($t1) # $t2 = direction of the type name + la $t3, 4($t2) # $t3 = address of the name + lw $t2, 0($t2) # $t2 = length of the name + + addi $t2, $t2, 9 # Setting space for the type, the size and the null byte + li $v0, 9 + move $a0, $t2 + syscall + addi $t2, $t2, -9 # Restoring space for the type, the size and the null byte + + la $t4, type_String + sw $t4, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t4, $v0, 0 # $t4 = direction of the new string + addi $t4, $t4, 8 # Pointer to the first character of the string + xor $t5, $t5, $t5 # Initializing counter + while_copy_name_start: + beq $t5, $t2, while_copy_name_end + lb $t6, 0($t3) # Loading the character + sb $t6, 0($t4) + addi $t4, $t4, 1 # Incrementing the pointer to the new string + addi $t3, $t3, 1 # Incrementing the pointer to the string in self + addi $t5, $t5, 1 # Incrementing counter + j while_copy_name_start + while_copy_name_end: + + sb $zero, 0($t4) # Setting the null byte + + sw $v0, 0($sp) # Storing the new string in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_copy_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = copy of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 4($t0) # $t2 = length of self in bytes + + # Allocating space for the new object + li $v0, 9 + move $a0, $t2 + syscall + move $t3, $v0 # $t3 = direction of the new object + sw $t1, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + # Initializing the variable of the loop + addi $t0, $t0, 8 # Pointer to the first character of the object + addi $t3, $t3, 8 # Pointer to the first character of the object + addi $t2, $2, -8 # Decrementing in 8 the length of the object + xor $t4, $t4, $t4 # Initializing counter + + # Loop copying the object + while_copy_start: + beq $t4, $t2, while_copy_end + lb $t5, 0($t0) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t0, $t0, 1 # Incrementing the pointer to the object + addi $t3, $t3, 1 # Incrementing the pointer to the new object + addi $t4, $t4, 1 # Incrementing counter + j while_copy_start + while_copy_end: + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_IO: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_out_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + lw $t0, 0($sp) # $t0 = x + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the String x + li $v0, 4 + move $a0, $t0 + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_out_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + # Printing the Int x + li $v0, 1 + lw $a0, 0($sp) + lw $a0, 8($a0) + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_in_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + li $v0, 8 + la $a0, buffer_input + li $a1, 1024 + syscall + + xor $t0, $t0, $t0 # Initializing counter + while_read_start: + lb $t1, buffer_input($t0) # Loading the byte + addi $t2, $zero, 10 + beq $t1, $t2, while_read_end + addi $t2, $zero, 13 + beq $t1, $t2, while_read_end + addi $t0, $t0, 1 # Incrementing counter + j while_read_start + while_read_end: + + addi $t0, $t0, 9 # Adding space for the type, the size and the null byte + li $v0, 9 + move $a0, $t0 + syscall + addi $t0, $t0, -9 # Adding space for the type, the size and the null byte + la $t2, type_String + sw $t2, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t3, $v0, 8 # Pointer to the first character of the string + xor $t4, $t4, $t4 # Initializing counter + + while_copy_from_buffer_start: + beq $t4, $t0, while_copy_from_buffer_end + lb $t5, buffer_input($t4) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t3, $t3, 1 # Imcremeenting pointer + addi $t4, $t4, 1 # Incrementing counter + j while_copy_from_buffer_start + while_copy_from_buffer_end: + + sb $zero, 0($t3) # Storing the null byte + + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_in_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + li $v0, 5 + syscall + lw $t0, 0($sp) + sw $v0, 8($t0) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_String: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_length_at_String: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # internal_0 = length of self + lw $t0, 4($sp) + lw $t1, 4($t0) + addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator + lw $t0, 0($sp) + sw $t1, 8($t0) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_concat_at_String: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + # s = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self + s + lw $t0, 8($sp) + lw $t1, 4($sp) + lw $t2, 4($t0) # $t2 = length of str1 + lw $t3, 4($t1) # $t3 = length of str2 + addi $t2, $t2, -9 + addi $t3, $t3, -9 + add $t4, $t2, $t3 # $t4 = length of str1 + str2 + addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) + + li $v0, 9 + move $a0, $t4 + syscall + addi $t4, $t4, -9 # Restoring $t4 = length of str1 + str2 + add $t5, $zero, $v0 # $t5 = address of the new string object + addi $t5, $t5, 8 # $t5 = address of the first byte of the new string + + la $t8, type_String + sw $t8, 0($v0) # Setting type in the first word of th object + + sw $a0, 4($v0) # Setting length of the string in the second word of the object + + # Copying str1 to the new string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_str1_start: + beq $t6, $t2, while_copy_str1_end + lb $t7, 8($t0) + sb $t7, 0($t5) + add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str1_start + while_copy_str1_end: + + # Copying str2 to the new string + while_copy_str2_start: + beq $t6, $t4, while_copy_str2_end + lb $t7, 8($t1) + sb $t7, 0($t5) + add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str2_start + while_copy_str2_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self + s + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_substr_at_String: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + # i = 8($sp) + # l = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self[i:i + l] + lw $t0, 12($sp) # $t0 = address of the string + lw $t1, 4($t0) # $t1 = length of the string + addi $t1, $t1, -9 # $t1 = length of the string + 9 + lw $t2, 8($sp) # $t2 = start of the substring + lw $t2, 8($t2) + lw $t3, 4($sp) # $t3 = length of the substring + lw $t3, 8($t3) + add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring + + bgt $t4, $t1, substring_out_of_bounds + + addi $t3, $t3, 9 + li $v0, 9 + move $a0, $t3 + syscall + addi $t3, $t3, -9 + + la $t5, type_String + sw $t5, 0($v0) # Setting type in the first word of the object + + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t0, $t0, 8 # pointing to the first byte of the string + add $t0, $t0, $t2 # pointing to the first byte of the substring + move $t5, $v0 # $t5 = address of the new string + add $t5, $t5, 8 # pointing to the first byte of the string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_substr_start: + beq $t6, $t3, while_copy_substr_end + lb $t7, 0($t0) + sb $t7, 0($t5) + addi $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of the string + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_substr_start + while_copy_substr_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self[i:i + l] + j substring_not_out_of_bounds + + substring_out_of_bounds: + li $v0, 17 + addi $a0, $zero, 1 + syscall + + substring_not_out_of_bounds: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_Int: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function___init___at_Bool: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function___init___at_Main: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_main_at_Main: + # Function parameters + # $ra = 72($sp) + # self = 68($sp) + + # Reserving space for local variables + addi $sp, $sp, -68 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 47 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 47 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 69 + sb $t0, 8($v0) # internal_0[0] = 'E' + + addi $t0, $zero, 110 + sb $t0, 9($v0) # internal_0[1] = 'n' + + addi $t0, $zero, 116 + sb $t0, 10($v0) # internal_0[2] = 't' + + addi $t0, $zero, 101 + sb $t0, 11($v0) # internal_0[3] = 'e' + + addi $t0, $zero, 114 + sb $t0, 12($v0) # internal_0[4] = 'r' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_0[5] = ' ' + + addi $t0, $zero, 110 + sb $t0, 14($v0) # internal_0[6] = 'n' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_0[7] = ' ' + + addi $t0, $zero, 116 + sb $t0, 16($v0) # internal_0[8] = 't' + + addi $t0, $zero, 111 + sb $t0, 17($v0) # internal_0[9] = 'o' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_0[10] = ' ' + + addi $t0, $zero, 102 + sb $t0, 19($v0) # internal_0[11] = 'f' + + addi $t0, $zero, 105 + sb $t0, 20($v0) # internal_0[12] = 'i' + + addi $t0, $zero, 110 + sb $t0, 21($v0) # internal_0[13] = 'n' + + addi $t0, $zero, 100 + sb $t0, 22($v0) # internal_0[14] = 'd' + + addi $t0, $zero, 32 + sb $t0, 23($v0) # internal_0[15] = ' ' + + addi $t0, $zero, 110 + sb $t0, 24($v0) # internal_0[16] = 'n' + + addi $t0, $zero, 116 + sb $t0, 25($v0) # internal_0[17] = 't' + + addi $t0, $zero, 104 + sb $t0, 26($v0) # internal_0[18] = 'h' + + addi $t0, $zero, 32 + sb $t0, 27($v0) # internal_0[19] = ' ' + + addi $t0, $zero, 102 + sb $t0, 28($v0) # internal_0[20] = 'f' + + addi $t0, $zero, 105 + sb $t0, 29($v0) # internal_0[21] = 'i' + + addi $t0, $zero, 98 + sb $t0, 30($v0) # internal_0[22] = 'b' + + addi $t0, $zero, 111 + sb $t0, 31($v0) # internal_0[23] = 'o' + + addi $t0, $zero, 110 + sb $t0, 32($v0) # internal_0[24] = 'n' + + addi $t0, $zero, 97 + sb $t0, 33($v0) # internal_0[25] = 'a' + + addi $t0, $zero, 99 + sb $t0, 34($v0) # internal_0[26] = 'c' + + addi $t0, $zero, 99 + sb $t0, 35($v0) # internal_0[27] = 'c' + + addi $t0, $zero, 105 + sb $t0, 36($v0) # internal_0[28] = 'i' + + addi $t0, $zero, 32 + sb $t0, 37($v0) # internal_0[29] = ' ' + + addi $t0, $zero, 110 + sb $t0, 38($v0) # internal_0[30] = 'n' + + addi $t0, $zero, 117 + sb $t0, 39($v0) # internal_0[31] = 'u' + + addi $t0, $zero, 109 + sb $t0, 40($v0) # internal_0[32] = 'm' + + addi $t0, $zero, 98 + sb $t0, 41($v0) # internal_0[33] = 'b' + + addi $t0, $zero, 101 + sb $t0, 42($v0) # internal_0[34] = 'e' + + addi $t0, $zero, 114 + sb $t0, 43($v0) # internal_0[35] = 'r' + + addi $t0, $zero, 33 + sb $t0, 44($v0) # internal_0[36] = '!' + + addi $t0, $zero, 10 + sb $t0, 45($v0) # internal_0[37] = '\n' + + sb $zero, 46($v0) # Null-terminator at the end of the string + + sw $v0, 64($sp) # internal_0 = "Enter n to find nth fibonacci number!\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 56($sp) # internal_2 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 68($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 56($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 52($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 80($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_0 + lw $t0, 76($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function internal_3 + lw $t0, 64($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 72($sp) # internal_1 = result of internal_3 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 7 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 7 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_5 = address of allocated object Int + + # Get method in_int of Main + lw $t0, 68($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 44($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 40($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 76($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_6 + lw $t0, 48($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 56($sp) # internal_4 = result of internal_6 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_8 = address of allocated object Int + + # Get method fib of Main + lw $t0, 68($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 32($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 28($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 80($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_4 + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function internal_9 + lw $t0, 40($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 48($sp) # internal_7 = result of internal_9 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_11 = address of allocated object Int + + # Get method out_int of Main + lw $t0, 68($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 20($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 16($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 80($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_7 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function internal_12 + lw $t0, 28($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_10 = result of internal_12 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_13[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_13 = "\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_15 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 68($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 80($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_13 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_13 + + # Calling function internal_16 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_14 = result of internal_16 + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 68 + + jr $ra + + function_fib_at_Main: + # Function parameters + # $ra = 64($sp) + # self = 60($sp) + # i = 56($sp) + + # Reserving space for local variables + addi $sp, $sp, -56 + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 48($sp) # internal_1 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument a + lw $t0, 64($sp) + sw $t0, 4($sp) # Storing a + + # Argument internal_1 + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 64($sp) # a = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_3 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument b + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing b + + # Argument internal_3 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 56($sp) # b = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_5 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument c + lw $t0, 48($sp) + sw $t0, 4($sp) # Storing c + + # Argument internal_5 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 48($sp) # c = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating NUll to internal_6 + sw $zero, 28($sp) # internal_6 = 0 + + while_start_8732083779214: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # internal_7 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_7 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 32($sp) # internal_8 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_9 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 12($sp) # internal_10 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_8 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_8 + + # Argument internal_9 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function function_xor + jal function_xor + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_10 = result of function_xor + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_10 then goto while_body_8732083779214 + lw $t0, 12($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_body_8732083779214 + + # Jumping to while_end_8732083779214 + j while_end_8732083779214 + + while_body_8732083779214: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument a + lw $t0, 64($sp) + sw $t0, 4($sp) # Storing a + + # Argument b + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing b + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_11 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument c + lw $t0, 48($sp) + sw $t0, 4($sp) # Storing c + + # Argument internal_11 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_11 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 48($sp) # c = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_12 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_12 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_12 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_13 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_13 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_13 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 68($sp) # i = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument b + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing b + + # Argument a + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing a + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 56($sp) # b = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument a + lw $t0, 64($sp) + sw $t0, 4($sp) # Storing a + + # Argument c + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing c + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 64($sp) # a = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to while_start_8732083779214 + j while_start_8732083779214 + + while_end_8732083779214: + + # Loading return value in $v1 + lw $v1, 36($sp) + + # Freeing space for local variables + addi $sp, $sp, 56 + + jr $ra + + main: + # Reserving space for local variables + addi $sp, $sp, -16 + + # Allocating Main + li $v0, 9 + lw $a0, type_Main + syscall + la $t0, type_Main # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 12($sp) # internal_0 = address of allocated object Main + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_Main + jal function___init___at_Main + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_0 = result of function___init___at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_2 = address of allocated object Int + + # Get method main of Main + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function internal_3 + lw $t0, 8($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_1 = result of internal_3 + addi $sp, $sp, 8 # Freeing space for arguments + + # Exit program + li $v0, 10 + syscall + + \ No newline at end of file diff --git a/tests/codegen/fib_input.txt b/tests/codegen/fib_input.txt index f599e28b8..d43401489 100644 --- a/tests/codegen/fib_input.txt +++ b/tests/codegen/fib_input.txt @@ -1 +1 @@ -10 +10 diff --git a/tests/codegen/fib_output.txt b/tests/codegen/fib_output.txt index d402da6af..2552f4479 100644 --- a/tests/codegen/fib_output.txt +++ b/tests/codegen/fib_output.txt @@ -1,2 +1,2 @@ -Enter n to find nth fibonacci number! -89 +Enter n to find nth fibonacci number! +89 diff --git a/tests/codegen/graph.cl b/tests/codegen/graph.cl index 8e511358c..59e29bbf4 100755 --- a/tests/codegen/graph.cl +++ b/tests/codegen/graph.cl @@ -1,381 +1,381 @@ -(* - * Cool program reading descriptions of weighted directed graphs - * from stdin. It builds up a graph objects with a list of vertices - * and a list of edges. Every vertice has a list of outgoing edges. - * - * INPUT FORMAT - * Every line has the form vertice successor* - * Where vertice is an int, and successor is vertice,weight - * - * An empty line or EOF terminates the input. - * - * The list of vertices and the edge list is printed out by the Main - * class. - * - * TEST - * Once compiled, the file g1.graph can be fed to the program. - * The output should look like this: - -nautilus.CS.Berkeley.EDU 53# spim -file graph.s (new Bar); - n : Foo => (new Razz); - n : Bar => n; - esac; - - b : Int <- a.doh() + g.doh() + doh() + printh(); - - doh() : Int { (let i : Int <- h in { h <- h + 2; i; } ) }; - -}; - -class Bar inherits Razz { - - c : Int <- doh(); - - d : Object <- printh(); -}; - - -class Razz inherits Foo { - - e : Bar <- case self of - n : Razz => (new Bar); - n : Bar => n; - esac; - - f : Int <- a@Bazz.doh() + g.doh() + e.doh() + doh() + printh(); - -}; - -class Bazz inherits IO { - - h : Int <- 1; - - g : Foo <- case self of - n : Bazz => (new Foo); - n : Razz => (new Bar); - n : Foo => (new Razz); - n : Bar => n; - esac; - - i : Object <- printh(); - - printh() : Int { { out_int(h); 0; } }; - - doh() : Int { (let i: Int <- h in { h <- h + 1; i; } ) }; -}; - -(* scary . . . *) -class Main { - a : Bazz <- new Bazz; - b : Foo <- new Foo; - c : Razz <- new Razz; - d : Bar <- new Bar; - - main(): String { "do nothing" }; - -}; - - - - - +(* hairy . . .*) + +class Foo inherits Bazz { + a : Razz <- case self of + n : Razz => (new Bar); + n : Foo => (new Razz); + n : Bar => n; + esac; + + b : Int <- a.doh() + g.doh() + doh() + printh(); + + doh() : Int { (let i : Int <- h in { h <- h + 2; i; } ) }; + +}; + +class Bar inherits Razz { + + c : Int <- doh(); + + d : Object <- printh(); +}; + + +class Razz inherits Foo { + + e : Bar <- case self of + n : Razz => (new Bar); + n : Bar => n; + esac; + + f : Int <- a@Bazz.doh() + g.doh() + e.doh() + doh() + printh(); + +}; + +class Bazz inherits IO { + + h : Int <- 1; + + g : Foo <- case self of + n : Bazz => (new Foo); + n : Razz => (new Bar); + n : Foo => (new Razz); + n : Bar => n; + esac; + + i : Object <- printh(); + + printh() : Int { { out_int(h); 0; } }; + + doh() : Int { (let i: Int <- h in { h <- h + 1; i; } ) }; +}; + +(* scary . . . *) +class Main { + a : Bazz <- new Bazz; + b : Foo <- new Foo; + c : Razz <- new Razz; + d : Bar <- new Bar; + + main(): String { "do nothing" }; + +}; + + + + + diff --git a/tests/codegen/hairyscary.mips b/tests/codegen/hairyscary.mips new file mode 100644 index 000000000..a6f377ab6 --- /dev/null +++ b/tests/codegen/hairyscary.mips @@ -0,0 +1,16473 @@ +.data + type_Object: .word 24 + type_Object_inherits_from: .word 0 + type_Object_name_address: .word type_Object_name_size + type_Object___init__: .word function___init___at_Object + type_Object_abort: .word function_abort_at_Object + type_Object_type_name: .word function_type_name_at_Object + type_Object_copy: .word function_copy_at_Object + + type_IO: .word 40 + type_IO_inherits_from: .word type_Object + type_IO_name_address: .word type_IO_name_size + type_IO___init__: .word function___init___at_IO + type_IO_abort: .word function_abort_at_Object + type_IO_type_name: .word function_type_name_at_Object + type_IO_copy: .word function_copy_at_Object + type_IO_out_string: .word function_out_string_at_IO + type_IO_out_int: .word function_out_int_at_IO + type_IO_in_string: .word function_in_string_at_IO + type_IO_in_int: .word function_in_int_at_IO + + type_String: .word 36 + type_String_inherits_from: .word type_Object + type_String_name_address: .word type_String_name_size + type_String___init__: .word function___init___at_String + type_String_abort: .word function_abort_at_Object + type_String_type_name: .word function_type_name_at_Object + type_String_copy: .word function_copy_at_Object + type_String_length: .word function_length_at_String + type_String_concat: .word function_concat_at_String + type_String_substr: .word function_substr_at_String + + type_Int: .word 24 + type_Int_inherits_from: .word type_Object + type_Int_name_address: .word type_Int_name_size + type_Int___init__: .word function___init___at_Int + type_Int_abort: .word function_abort_at_Object + type_Int_type_name: .word function_type_name_at_Object + type_Int_copy: .word function_copy_at_Object + + type_Bool: .word 24 + type_Bool_inherits_from: .word type_Object + type_Bool_name_address: .word type_Bool_name_size + type_Bool___init__: .word function___init___at_Bool + type_Bool_abort: .word function_abort_at_Object + type_Bool_type_name: .word function_type_name_at_Object + type_Bool_copy: .word function_copy_at_Object + + type_Foo: .word 68 + type_Foo_inherits_from: .word type_Bazz + type_Foo_name_address: .word type_Foo_name_size + type_Foo___init__: .word function___init___at_Foo + type_Foo_abort: .word function_abort_at_Object + type_Foo_type_name: .word function_type_name_at_Object + type_Foo_copy: .word function_copy_at_Object + type_Foo_out_string: .word function_out_string_at_IO + type_Foo_out_int: .word function_out_int_at_IO + type_Foo_in_string: .word function_in_string_at_IO + type_Foo_in_int: .word function_in_int_at_IO + type_Foo_printh: .word function_printh_at_Bazz + type_Foo_doh: .word function_doh_at_Foo + + type_Bar: .word 84 + type_Bar_inherits_from: .word type_Razz + type_Bar_name_address: .word type_Bar_name_size + type_Bar___init__: .word function___init___at_Bar + type_Bar_abort: .word function_abort_at_Object + type_Bar_type_name: .word function_type_name_at_Object + type_Bar_copy: .word function_copy_at_Object + type_Bar_out_string: .word function_out_string_at_IO + type_Bar_out_int: .word function_out_int_at_IO + type_Bar_in_string: .word function_in_string_at_IO + type_Bar_in_int: .word function_in_int_at_IO + type_Bar_printh: .word function_printh_at_Bazz + type_Bar_doh: .word function_doh_at_Foo + + type_Razz: .word 76 + type_Razz_inherits_from: .word type_Foo + type_Razz_name_address: .word type_Razz_name_size + type_Razz___init__: .word function___init___at_Razz + type_Razz_abort: .word function_abort_at_Object + type_Razz_type_name: .word function_type_name_at_Object + type_Razz_copy: .word function_copy_at_Object + type_Razz_out_string: .word function_out_string_at_IO + type_Razz_out_int: .word function_out_int_at_IO + type_Razz_in_string: .word function_in_string_at_IO + type_Razz_in_int: .word function_in_int_at_IO + type_Razz_printh: .word function_printh_at_Bazz + type_Razz_doh: .word function_doh_at_Foo + + type_Bazz: .word 60 + type_Bazz_inherits_from: .word type_IO + type_Bazz_name_address: .word type_Bazz_name_size + type_Bazz___init__: .word function___init___at_Bazz + type_Bazz_abort: .word function_abort_at_Object + type_Bazz_type_name: .word function_type_name_at_Object + type_Bazz_copy: .word function_copy_at_Object + type_Bazz_out_string: .word function_out_string_at_IO + type_Bazz_out_int: .word function_out_int_at_IO + type_Bazz_in_string: .word function_in_string_at_IO + type_Bazz_in_int: .word function_in_int_at_IO + type_Bazz_printh: .word function_printh_at_Bazz + type_Bazz_doh: .word function_doh_at_Bazz + + type_Main: .word 44 + type_Main_inherits_from: .word type_Object + type_Main_name_address: .word type_Main_name_size + type_Main___init__: .word function___init___at_Main + type_Main_abort: .word function_abort_at_Object + type_Main_type_name: .word function_type_name_at_Object + type_Main_copy: .word function_copy_at_Object + type_Main_main: .word function_main_at_Main + + type_Object_name_size: .word 6 + type_Object_name: .asciiz "Object" + + type_IO_name_size: .word 2 + type_IO_name: .asciiz "IO" + + type_String_name_size: .word 6 + type_String_name: .asciiz "String" + + type_Int_name_size: .word 3 + type_Int_name: .asciiz "Int" + + type_Bool_name_size: .word 4 + type_Bool_name: .asciiz "Bool" + + type_Foo_name_size: .word 3 + type_Foo_name: .asciiz "Foo" + + type_Bar_name_size: .word 3 + type_Bar_name: .asciiz "Bar" + + type_Razz_name_size: .word 4 + type_Razz_name: .asciiz "Razz" + + type_Bazz_name_size: .word 4 + type_Bazz_name: .asciiz "Bazz" + + type_Main_name_size: .word 4 + type_Main_name: .asciiz "Main" + + buffer_input: .space 1024 + debug_log: .asciiz "debug_log\n" + +.text + function_add: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Addition operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + add $t2, $t0, $t1 # $t2 = $t0 + $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_sub: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Subtraction operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sub $t2, $t0, $t1 # $t2 = $t0 - $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_mult: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Multiplication operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + mult $t0, $t1 # $t2 = $t0 * $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_div: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Division operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + div $t0, $t1 # $t2 = $t0 / $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_xor: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Xor operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than_or_equal: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sle $t2, $t0, $t1 # $t2 = $t0 <= $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_equal: + # Function parameters + # $ra = 48($sp) + # a = 44($sp) + # b = 40($sp) + + # Reserving space for local variables + addi $sp, $sp, -40 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_0 = address of allocated object Int + + # Allocating NUll to internal_1 + sw $zero, 32($sp) # internal_1 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_2 = address of allocated object Int + + # internal_2 = EqualAddress(a, internal_1) + lw $t0, 44($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # internal_2 = EqualAddress(b, internal_1) + lw $t0, 40($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # If internal_2 then goto a_is_type_object + lw $t0, 28($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_object + + # internal_3 = typeof a that is the first word of the object + lw $t0, 44($sp) + lw $t0, 0($t0) + sw $t0, 24($sp) + + # internal_4 = direction of Int + la $t0, type_Int + sw $t0, 20($sp) + + # internal_5 = direction of Bool + la $t0, type_Bool + sw $t0, 16($sp) + + # internal_6 = direction of String + la $t0, type_String + sw $t0, 12($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_7 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_8 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_9 = address of allocated object Int + + # internal_7 = EqualAddress(internal_3, internal_4) + lw $t0, 24($sp) + lw $t1, 20($sp) + seq $t2, $t0, $t1 + lw $t0, 8($sp) + sw $t2, 8($t0) + + # internal_8 = EqualAddress(internal_3, internal_5) + lw $t0, 24($sp) + lw $t1, 16($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_9 = EqualAddress(internal_3, internal_6) + lw $t0, 24($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_7 then goto a_is_type_int_or_bool + lw $t0, 8($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_8 then goto a_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_9 then goto a_is_type_string + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_string + + # Jumping to a_is_type_object + j a_is_type_object + + a_is_type_int_or_bool: + + # internal_0 = EqualInt(a, b) + lw $t0, 44($sp) + lw $t0, 8($t0) + lw $t1, 40($sp) + lw $t1, 8($t1) + seq $t2, $t0, $t1 + lw $t0, 36($sp) + sw $t2, 8($t0) + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_string: + + # internal_0 = EqualStr(a, b) + lw $t0, 44($sp) + lw $t1, 40($sp) + addi $t0, $t0, 8 + addi $t1, $t1, 8 + + # By default we assume the strings are equals + addi $t4, $zero, 1 + lw $t5, 36($sp) + sw $t4, 8($t5) + + while_compare_strings_start: + lb $t2, 0($t0) + lb $t3, 0($t1) + beq $t2, $t3, while_compare_strings_update + + # The strings are no equals + lw $t5, 36($sp) + sw $zero, 8($t5) + j while_compare_strings_end + + while_compare_strings_update: + addi $t0, $t0, 1 + addi $t1, $t1, 1 + beq $t2, $zero, while_compare_strings_end + beq $t3, $zero, while_compare_strings_end + j while_compare_strings_start + while_compare_strings_end: + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_object: + + # Equal operation + lw $t0, 44($sp) # Save in $t0 the left operand address + lw $t1, 40($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 36($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Jumping to end_of_equal + j end_of_equal + + end_of_equal: + + # Loading return value in $v1 + lw $v1, 36($sp) + + # Freeing space for local variables + addi $sp, $sp, 40 + + jr $ra + + function_assign: + # Function parameters + # $ra = 36($sp) + # dest = 32($sp) + # source = 28($sp) + + # Reserving space for local variables + addi $sp, $sp, -28 + + # Allocating NUll to internal_0 + sw $zero, 24($sp) # internal_0 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_1 = address of allocated object Int + + # internal_1 = EqualAddress(source, internal_0) + lw $t0, 28($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # internal_1 = EqualAddress(dest, internal_0) + lw $t0, 32($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # If internal_1 then goto source_is_type_object + lw $t0, 20($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_object + + # internal_2 = typeof source that is the first word of the object + lw $t0, 28($sp) + lw $t0, 0($t0) + sw $t0, 16($sp) + + # internal_3 = direction of Int + la $t0, type_Int + sw $t0, 12($sp) + + # internal_4 = direction of Bool + la $t0, type_Bool + sw $t0, 8($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_5 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_6 = address of allocated object Int + + # internal_5 = EqualAddress(internal_2, internal_3) + lw $t0, 16($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_6 = EqualAddress(internal_2, internal_4) + lw $t0, 16($sp) + lw $t1, 8($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_5 then goto source_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # If internal_6 then goto source_is_type_int_or_bool + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # Jumping to source_is_type_object + j source_is_type_object + + source_is_type_int_or_bool: + + # dest = source where source is an integer + li $v0, 9 + addi $a0, $zero, 12 + syscall + lw $t0, 28($sp) # Pointer to source + lw $t1, 0($t0) # $t1 = type of source + lw $t2, 8($t0) # $t2 = value of source + sw $t1, 0($v0) # Save type of dest + sw $a0, 4($v0) # Save size of dest + sw $t2, 8($v0) # Save value of dest + sw $v0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_is_type_object: + + # dest = source + lw $t0, 28($sp) + sw $t0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_end_of_equal: + + # Loading return value in $v1 + lw $v1, 32($sp) + + # Freeing space for local variables + addi $sp, $sp, 28 + + jr $ra + + function___init___at_Object: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_abort_at_Object: + # Function parameters + # $ra = 28($sp) + # self = 24($sp) + + # Reserving space for local variables + addi $sp, $sp, -24 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 33 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 33 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 65 + sb $t0, 8($v0) # internal_0[0] = 'A' + + addi $t0, $zero, 98 + sb $t0, 9($v0) # internal_0[1] = 'b' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_0[2] = 'o' + + addi $t0, $zero, 114 + sb $t0, 11($v0) # internal_0[3] = 'r' + + addi $t0, $zero, 116 + sb $t0, 12($v0) # internal_0[4] = 't' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_0[5] = ' ' + + addi $t0, $zero, 99 + sb $t0, 14($v0) # internal_0[6] = 'c' + + addi $t0, $zero, 97 + sb $t0, 15($v0) # internal_0[7] = 'a' + + addi $t0, $zero, 108 + sb $t0, 16($v0) # internal_0[8] = 'l' + + addi $t0, $zero, 108 + sb $t0, 17($v0) # internal_0[9] = 'l' + + addi $t0, $zero, 101 + sb $t0, 18($v0) # internal_0[10] = 'e' + + addi $t0, $zero, 100 + sb $t0, 19($v0) # internal_0[11] = 'd' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_0[12] = ' ' + + addi $t0, $zero, 102 + sb $t0, 21($v0) # internal_0[13] = 'f' + + addi $t0, $zero, 114 + sb $t0, 22($v0) # internal_0[14] = 'r' + + addi $t0, $zero, 111 + sb $t0, 23($v0) # internal_0[15] = 'o' + + addi $t0, $zero, 109 + sb $t0, 24($v0) # internal_0[16] = 'm' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_0[17] = ' ' + + addi $t0, $zero, 99 + sb $t0, 26($v0) # internal_0[18] = 'c' + + addi $t0, $zero, 108 + sb $t0, 27($v0) # internal_0[19] = 'l' + + addi $t0, $zero, 97 + sb $t0, 28($v0) # internal_0[20] = 'a' + + addi $t0, $zero, 115 + sb $t0, 29($v0) # internal_0[21] = 's' + + addi $t0, $zero, 115 + sb $t0, 30($v0) # internal_0[22] = 's' + + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_0[23] = ' ' + + sb $zero, 32($v0) # Null-terminator at the end of the string + + sw $v0, 20($sp) # internal_0 = "Abort called from class " + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_3[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 8($sp) # internal_3 = "\n" + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method type_name of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_5 + lw $t0, 8($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 24($sp) # internal_1 = result of internal_5 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_1 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_2 = result of internal_5 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_3 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_2 = result of internal_5 + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 12($sp) # $t0 = internal_2 + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the String internal_2 + li $v0, 4 + move $a0, $t0 + syscall + + # Exit program + li $v0, 10 + syscall + + # Loading return value in $v1 + lw $v1, 24($sp) + + # Freeing space for local variables + addi $sp, $sp, 24 + + jr $ra + + function_type_name_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = name of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 8($t1) # $t2 = direction of the type name + la $t3, 4($t2) # $t3 = address of the name + lw $t2, 0($t2) # $t2 = length of the name + + addi $t2, $t2, 9 # Setting space for the type, the size and the null byte + li $v0, 9 + move $a0, $t2 + syscall + addi $t2, $t2, -9 # Restoring space for the type, the size and the null byte + + la $t4, type_String + sw $t4, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t4, $v0, 0 # $t4 = direction of the new string + addi $t4, $t4, 8 # Pointer to the first character of the string + xor $t5, $t5, $t5 # Initializing counter + while_copy_name_start: + beq $t5, $t2, while_copy_name_end + lb $t6, 0($t3) # Loading the character + sb $t6, 0($t4) + addi $t4, $t4, 1 # Incrementing the pointer to the new string + addi $t3, $t3, 1 # Incrementing the pointer to the string in self + addi $t5, $t5, 1 # Incrementing counter + j while_copy_name_start + while_copy_name_end: + + sb $zero, 0($t4) # Setting the null byte + + sw $v0, 0($sp) # Storing the new string in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_copy_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = copy of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 4($t0) # $t2 = length of self in bytes + + # Allocating space for the new object + li $v0, 9 + move $a0, $t2 + syscall + move $t3, $v0 # $t3 = direction of the new object + sw $t1, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + # Initializing the variable of the loop + addi $t0, $t0, 8 # Pointer to the first character of the object + addi $t3, $t3, 8 # Pointer to the first character of the object + addi $t2, $2, -8 # Decrementing in 8 the length of the object + xor $t4, $t4, $t4 # Initializing counter + + # Loop copying the object + while_copy_start: + beq $t4, $t2, while_copy_end + lb $t5, 0($t0) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t0, $t0, 1 # Incrementing the pointer to the object + addi $t3, $t3, 1 # Incrementing the pointer to the new object + addi $t4, $t4, 1 # Incrementing counter + j while_copy_start + while_copy_end: + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_IO: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_out_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + lw $t0, 0($sp) # $t0 = x + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the String x + li $v0, 4 + move $a0, $t0 + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_out_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + # Printing the Int x + li $v0, 1 + lw $a0, 0($sp) + lw $a0, 8($a0) + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_in_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + li $v0, 8 + la $a0, buffer_input + li $a1, 1024 + syscall + + xor $t0, $t0, $t0 # Initializing counter + while_read_start: + lb $t1, buffer_input($t0) # Loading the byte + addi $t2, $zero, 10 + beq $t1, $t2, while_read_end + addi $t2, $zero, 13 + beq $t1, $t2, while_read_end + addi $t0, $t0, 1 # Incrementing counter + j while_read_start + while_read_end: + + addi $t0, $t0, 9 # Adding space for the type, the size and the null byte + li $v0, 9 + move $a0, $t0 + syscall + addi $t0, $t0, -9 # Adding space for the type, the size and the null byte + la $t2, type_String + sw $t2, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t3, $v0, 8 # Pointer to the first character of the string + xor $t4, $t4, $t4 # Initializing counter + + while_copy_from_buffer_start: + beq $t4, $t0, while_copy_from_buffer_end + lb $t5, buffer_input($t4) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t3, $t3, 1 # Imcremeenting pointer + addi $t4, $t4, 1 # Incrementing counter + j while_copy_from_buffer_start + while_copy_from_buffer_end: + + sb $zero, 0($t3) # Storing the null byte + + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_in_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + li $v0, 5 + syscall + lw $t0, 0($sp) + sw $v0, 8($t0) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_String: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_length_at_String: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # internal_0 = length of self + lw $t0, 4($sp) + lw $t1, 4($t0) + addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator + lw $t0, 0($sp) + sw $t1, 8($t0) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_concat_at_String: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + # s = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self + s + lw $t0, 8($sp) + lw $t1, 4($sp) + lw $t2, 4($t0) # $t2 = length of str1 + lw $t3, 4($t1) # $t3 = length of str2 + addi $t2, $t2, -9 + addi $t3, $t3, -9 + add $t4, $t2, $t3 # $t4 = length of str1 + str2 + addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) + + li $v0, 9 + move $a0, $t4 + syscall + addi $t4, $t4, -9 # Restoring $t4 = length of str1 + str2 + add $t5, $zero, $v0 # $t5 = address of the new string object + addi $t5, $t5, 8 # $t5 = address of the first byte of the new string + + la $t8, type_String + sw $t8, 0($v0) # Setting type in the first word of th object + + sw $a0, 4($v0) # Setting length of the string in the second word of the object + + # Copying str1 to the new string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_str1_start: + beq $t6, $t2, while_copy_str1_end + lb $t7, 8($t0) + sb $t7, 0($t5) + add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str1_start + while_copy_str1_end: + + # Copying str2 to the new string + while_copy_str2_start: + beq $t6, $t4, while_copy_str2_end + lb $t7, 8($t1) + sb $t7, 0($t5) + add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str2_start + while_copy_str2_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self + s + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_substr_at_String: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + # i = 8($sp) + # l = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self[i:i + l] + lw $t0, 12($sp) # $t0 = address of the string + lw $t1, 4($t0) # $t1 = length of the string + addi $t1, $t1, -9 # $t1 = length of the string + 9 + lw $t2, 8($sp) # $t2 = start of the substring + lw $t2, 8($t2) + lw $t3, 4($sp) # $t3 = length of the substring + lw $t3, 8($t3) + add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring + + bgt $t4, $t1, substring_out_of_bounds + + addi $t3, $t3, 9 + li $v0, 9 + move $a0, $t3 + syscall + addi $t3, $t3, -9 + + la $t5, type_String + sw $t5, 0($v0) # Setting type in the first word of the object + + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t0, $t0, 8 # pointing to the first byte of the string + add $t0, $t0, $t2 # pointing to the first byte of the substring + move $t5, $v0 # $t5 = address of the new string + add $t5, $t5, 8 # pointing to the first byte of the string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_substr_start: + beq $t6, $t3, while_copy_substr_end + lb $t7, 0($t0) + sb $t7, 0($t5) + addi $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of the string + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_substr_start + while_copy_substr_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self[i:i + l] + j substring_not_out_of_bounds + + substring_out_of_bounds: + li $v0, 17 + addi $a0, $zero, 1 + syscall + + substring_not_out_of_bounds: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_Int: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function___init___at_Bool: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function___init___at_Foo: + # Function parameters + # $ra = 480($sp) + # self = 476($sp) + + # Reserving space for local variables + addi $sp, $sp, -476 + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 472($sp) # internal_0 = address of allocated object Int + + # Set attribute h of self + lw $t0, 476($sp) # $t0 = self + lw $t1, 472($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8794484661456 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8794484661456 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8794484661456 + j object_set_attribute_8794484661456 + int_set_attribute_8794484661456: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.h = internal_0 + j end_set_attribute_8794484661456 + bool_set_attribute_8794484661456: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.h = internal_0 + j end_set_attribute_8794484661456 + object_set_attribute_8794484661456: + sw $t1, 8($t0) # self.h = internal_0 + end_set_attribute_8794484661456: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 468($sp) # internal_1 = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 464($sp) # internal_2 = address of allocated object Int + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 460($sp) # internal_3 = address of allocated object Int + + # Allocating NUll to internal_4 + sw $zero, 456($sp) # internal_4 = 0 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 452($sp) # internal_5 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 440($sp) # internal_8 = address of allocated object Int + + # internal_6 = typeof self that is the first word of the object + lw $t0, 476($sp) + lw $t0, 0($t0) + sw $t0, 448($sp) + + # internal_7 = internal_6 + lw $t0, 448($sp) + sw $t0, 444($sp) + + while_start_8794484741346: + + # internal_8 = EqualAddress(internal_7, internal_4) + lw $t0, 444($sp) + lw $t1, 456($sp) + seq $t2, $t0, $t1 + lw $t0, 440($sp) + sw $t2, 8($t0) + + # If internal_8 then goto while_end_8794484741346 + lw $t0, 440($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_end_8794484741346 + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_5 + lw $t0, 464($sp) + sw $t0, 4($sp) # Storing internal_5 + + # Argument internal_2 + lw $t0, 476($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 464($sp) # internal_5 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_7 = ancestor of internal_7 + lw $t0, 444($sp) + lw $t0, 4($t0) + sw $t0, 444($sp) + + # Jumping to while_start_8794484741346 + j while_start_8794484741346 + + while_end_8794484741346: + + # internal_7 = internal_6 + lw $t0, 448($sp) + sw $t0, 444($sp) + + # initialize Array [internal_5] + lw $t0, 452($sp) # $t0 = internal_5 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 436($sp) # internal_9 = new Array[internal_5] + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 432($sp) # internal_10 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 428($sp) # internal_11 = address of allocated object Int + + foreach_start_8794484741346: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_10 + lw $t0, 444($sp) + sw $t0, 4($sp) # Storing internal_10 + + # Argument internal_5 + lw $t0, 464($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 440($sp) # internal_11 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_11 then goto foreach_body_8794484741346 + lw $t0, 428($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_body_8794484741346 + + # Jumping to foreach_end_8794484741346 + j foreach_end_8794484741346 + + foreach_body_8794484741346: + + # array internal_9[4 * internal_10] = internal_7 + lw $t0, 432($sp) # $t0 = internal_10 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 436($sp) # $t1 = internal_9 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 444($sp) + sw $t0, 0($t1) + + # internal_7 = ancestor of internal_7 + lw $t0, 444($sp) + lw $t0, 4($t0) + sw $t0, 444($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_10 + lw $t0, 444($sp) + sw $t0, 4($sp) # Storing internal_10 + + # Argument internal_2 + lw $t0, 476($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 444($sp) # internal_10 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_start_8794484741346 + j foreach_start_8794484741346 + + foreach_end_8794484741346: + + # initialize Array [internal_3] + lw $t0, 460($sp) # $t0 = internal_3 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 424($sp) # internal_12 = new Array[internal_3] + + # initialize Array [internal_3] + lw $t0, 460($sp) # $t0 = internal_3 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 420($sp) # internal_13 = new Array[internal_3] + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 412($sp) # internal_15 = address of allocated object Int + + # internal_14 = direction of Bazz + la $t0, type_Bazz + sw $t0, 416($sp) + + # array internal_12[4 * internal_15] = internal_14 + lw $t0, 412($sp) # $t0 = internal_15 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 424($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 416($sp) + sw $t0, 0($t1) + + # array internal_13[4 * internal_15] = internal_5 + lw $t0, 412($sp) # $t0 = internal_15 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 420($sp) # $t1 = internal_13 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 452($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 404($sp) # internal_17 = address of allocated object Int + + # internal_16 = direction of Razz + la $t0, type_Razz + sw $t0, 408($sp) + + # array internal_12[4 * internal_17] = internal_16 + lw $t0, 404($sp) # $t0 = internal_17 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 424($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 408($sp) + sw $t0, 0($t1) + + # array internal_13[4 * internal_17] = internal_5 + lw $t0, 404($sp) # $t0 = internal_17 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 420($sp) # $t1 = internal_13 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 452($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 396($sp) # internal_19 = address of allocated object Int + + # internal_18 = direction of Foo + la $t0, type_Foo + sw $t0, 400($sp) + + # array internal_12[4 * internal_19] = internal_18 + lw $t0, 396($sp) # $t0 = internal_19 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 424($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 400($sp) + sw $t0, 0($t1) + + # array internal_13[4 * internal_19] = internal_5 + lw $t0, 396($sp) # $t0 = internal_19 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 420($sp) # $t1 = internal_13 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 452($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 388($sp) # internal_21 = address of allocated object Int + + # internal_20 = direction of Bar + la $t0, type_Bar + sw $t0, 392($sp) + + # array internal_12[4 * internal_21] = internal_20 + lw $t0, 388($sp) # $t0 = internal_21 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 424($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 392($sp) + sw $t0, 0($t1) + + # array internal_13[4 * internal_21] = internal_5 + lw $t0, 388($sp) # $t0 = internal_21 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 420($sp) # $t1 = internal_13 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 452($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 384($sp) # internal_22 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 380($sp) # internal_23 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 372($sp) # internal_25 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 368($sp) # internal_26 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 360($sp) # internal_28 = address of allocated object Int + + foreach_type_start_8794484741346: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_22 + lw $t0, 396($sp) + sw $t0, 4($sp) # Storing internal_22 + + # Argument internal_3 + lw $t0, 472($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 392($sp) # internal_23 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_23 then goto foreach_type_body_8794484741346 + lw $t0, 380($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_type_body_8794484741346 + + # Jumping to foreach_type_end_8794484741346 + j foreach_type_end_8794484741346 + + foreach_type_body_8794484741346: + + # internal_24 = array internal_12[4 * internal_22] + lw $t0, 384($sp) # $t0 = internal_22 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 424($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + sw $t0, 376($sp) # internal_24 = array internal_12[4 * internal_22] + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_25 + lw $t0, 384($sp) + sw $t0, 4($sp) # Storing internal_25 + + # Argument internal_1 + lw $t0, 480($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 384($sp) # internal_25 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + foreach_ancestor_start_8794484741346: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_25 + lw $t0, 384($sp) + sw $t0, 4($sp) # Storing internal_25 + + # Argument internal_5 + lw $t0, 464($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 380($sp) # internal_26 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_26 then goto foreach_ancestor_body_8794484741346 + lw $t0, 368($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_body_8794484741346 + + # Jumping to foreach_ancestor_end_8794484741346 + j foreach_ancestor_end_8794484741346 + + foreach_ancestor_body_8794484741346: + + # internal_27 = array internal_9[4 * internal_25] + lw $t0, 372($sp) # $t0 = internal_25 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 436($sp) # $t1 = internal_9 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + sw $t0, 364($sp) # internal_27 = array internal_9[4 * internal_25] + + # internal_28 = EqualAddress(internal_24, internal_27) + lw $t0, 376($sp) + lw $t1, 364($sp) + seq $t2, $t0, $t1 + lw $t0, 360($sp) + sw $t2, 8($t0) + + # If internal_28 then goto foreach_ancestor_end_8794484741346 + lw $t0, 360($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_end_8794484741346 + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_25 + lw $t0, 384($sp) + sw $t0, 4($sp) # Storing internal_25 + + # Argument internal_2 + lw $t0, 476($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 384($sp) # internal_25 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_ancestor_start_8794484741346 + j foreach_ancestor_start_8794484741346 + + foreach_ancestor_end_8794484741346: + + # array internal_13[4 * internal_22] = internal_25 + lw $t0, 384($sp) # $t0 = internal_22 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 420($sp) # $t1 = internal_13 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 372($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_22 + lw $t0, 396($sp) + sw $t0, 4($sp) # Storing internal_22 + + # Argument internal_2 + lw $t0, 476($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 396($sp) # internal_22 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_type_start_8794484741346 + j foreach_type_start_8794484741346 + + foreach_type_end_8794484741346: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 356($sp) # internal_29 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 352($sp) # internal_30 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 348($sp) # internal_31 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 344($sp) # internal_32 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 340($sp) # internal_33 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_32 + lw $t0, 356($sp) + sw $t0, 4($sp) # Storing internal_32 + + # Argument internal_5 + lw $t0, 464($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 356($sp) # internal_32 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + foreach_min_start_8794484741346: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_29 + lw $t0, 368($sp) + sw $t0, 4($sp) # Storing internal_29 + + # Argument internal_3 + lw $t0, 472($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 352($sp) # internal_33 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_33 then goto foreach_min_body_8794484741346 + lw $t0, 340($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_min_body_8794484741346 + + # Jumping to foreach_min_end_8794484741346 + j foreach_min_end_8794484741346 + + foreach_min_body_8794484741346: + + # internal_31 = array internal_13[4 * internal_29] + lw $t0, 356($sp) # $t0 = internal_29 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 420($sp) # $t1 = internal_13 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 348($sp) # internal_31 = array internal_13[4 * internal_29] + sw $t0, 8($t2) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_31 + lw $t0, 360($sp) + sw $t0, 4($sp) # Storing internal_31 + + # Argument internal_32 + lw $t0, 356($sp) + sw $t0, 0($sp) # Storing internal_32 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 352($sp) # internal_33 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_33 then goto update_min_8794484741346 + lw $t0, 340($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, update_min_8794484741346 + + # Jumping to update_min_end_8794484741346 + j update_min_end_8794484741346 + + update_min_8794484741346: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_32 + lw $t0, 356($sp) + sw $t0, 4($sp) # Storing internal_32 + + # Argument internal_31 + lw $t0, 360($sp) + sw $t0, 0($sp) # Storing internal_31 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 356($sp) # internal_32 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_30 + lw $t0, 364($sp) + sw $t0, 4($sp) # Storing internal_30 + + # Argument internal_29 + lw $t0, 368($sp) + sw $t0, 0($sp) # Storing internal_29 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 364($sp) # internal_30 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + update_min_end_8794484741346: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_29 + lw $t0, 368($sp) + sw $t0, 4($sp) # Storing internal_29 + + # Argument internal_2 + lw $t0, 476($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 368($sp) # internal_29 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_min_start_8794484741346 + j foreach_min_start_8794484741346 + + foreach_min_end_8794484741346: + + # initialize Array [internal_3] + lw $t0, 460($sp) # $t0 = internal_3 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 336($sp) # internal_34 = new Array[internal_3] + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 332($sp) # internal_35 = address of allocated object Int + + # array internal_34[4 * internal_35] = internal_1 + lw $t0, 332($sp) # $t0 = internal_35 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 336($sp) # $t1 = internal_34 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 468($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 328($sp) # internal_36 = address of allocated object Int + + # array internal_34[4 * internal_36] = internal_1 + lw $t0, 328($sp) # $t0 = internal_36 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 336($sp) # $t1 = internal_34 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 468($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 324($sp) # internal_37 = address of allocated object Int + + # array internal_34[4 * internal_37] = internal_1 + lw $t0, 324($sp) # $t0 = internal_37 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 336($sp) # $t1 = internal_34 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 468($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 320($sp) # internal_38 = address of allocated object Int + + # array internal_34[4 * internal_38] = internal_1 + lw $t0, 320($sp) # $t0 = internal_38 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 336($sp) # $t1 = internal_34 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 468($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 316($sp) # internal_39 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_32 + lw $t0, 356($sp) + sw $t0, 4($sp) # Storing internal_32 + + # Argument internal_5 + lw $t0, 464($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 328($sp) # internal_39 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_39 then goto error_branch_8794484741346 + lw $t0, 316($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, error_branch_8794484741346 + + # array internal_34[4 * internal_30] = internal_2 + lw $t0, 352($sp) # $t0 = internal_30 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 336($sp) # $t1 = internal_34 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 464($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 312($sp) # internal_40 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 308($sp) # internal_41 = address of allocated object Int + + # internal_40 = array internal_34[4 * internal_41] + lw $t0, 308($sp) # $t0 = internal_41 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 336($sp) # $t1 = internal_34 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 312($sp) # internal_40 = array internal_34[4 * internal_41] + sw $t0, 8($t2) + + # If internal_40 then goto branch_Bazz_8794484741346 + lw $t0, 312($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Bazz_8794484741346 + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 304($sp) # internal_42 = address of allocated object Int + + # internal_40 = array internal_34[4 * internal_42] + lw $t0, 304($sp) # $t0 = internal_42 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 336($sp) # $t1 = internal_34 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 312($sp) # internal_40 = array internal_34[4 * internal_42] + sw $t0, 8($t2) + + # If internal_40 then goto branch_Razz_8794484741346 + lw $t0, 312($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Razz_8794484741346 + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 300($sp) # internal_43 = address of allocated object Int + + # internal_40 = array internal_34[4 * internal_43] + lw $t0, 300($sp) # $t0 = internal_43 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 336($sp) # $t1 = internal_34 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 312($sp) # internal_40 = array internal_34[4 * internal_43] + sw $t0, 8($t2) + + # If internal_40 then goto branch_Foo_8794484741346 + lw $t0, 312($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Foo_8794484741346 + + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 296($sp) # internal_44 = address of allocated object Int + + # internal_40 = array internal_34[4 * internal_44] + lw $t0, 296($sp) # $t0 = internal_44 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 336($sp) # $t1 = internal_34 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 312($sp) # internal_40 = array internal_34[4 * internal_44] + sw $t0, 8($t2) + + # If internal_40 then goto branch_Bar_8794484741346 + lw $t0, 312($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Bar_8794484741346 + + branch_Bazz_8794484741346: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument n + lw $t0, 300($sp) + sw $t0, 4($sp) # Storing n + + # Argument self + lw $t0, 488($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 300($sp) # n = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Foo + li $v0, 9 + lw $a0, type_Foo + syscall + la $t0, type_Foo # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 284($sp) # internal_47 = address of allocated object Foo + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_47 + lw $t0, 292($sp) + sw $t0, 0($sp) # Storing internal_47 + + # Calling function function___init___at_Foo + jal function___init___at_Foo + lw $ra, 4($sp) + sw $v1, 292($sp) # internal_47 = result of function___init___at_Foo + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_45 + lw $t0, 304($sp) + sw $t0, 4($sp) # Storing internal_45 + + # Argument internal_47 + lw $t0, 296($sp) + sw $t0, 0($sp) # Storing internal_47 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 304($sp) # internal_45 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_45 = internal_47 + lw $t0, 284($sp) + sw $t0, 292($sp) + + # Jumping to branch_end_8794484741346 + j branch_end_8794484741346 + + branch_Razz_8794484741346: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument n + lw $t0, 300($sp) + sw $t0, 4($sp) # Storing n + + # Argument self + lw $t0, 488($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 300($sp) # n = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Bar + li $v0, 9 + lw $a0, type_Bar + syscall + la $t0, type_Bar # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 276($sp) # internal_49 = address of allocated object Bar + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_49 + lw $t0, 284($sp) + sw $t0, 0($sp) # Storing internal_49 + + # Calling function function___init___at_Bar + jal function___init___at_Bar + lw $ra, 4($sp) + sw $v1, 284($sp) # internal_49 = result of function___init___at_Bar + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_45 + lw $t0, 304($sp) + sw $t0, 4($sp) # Storing internal_45 + + # Argument internal_49 + lw $t0, 288($sp) + sw $t0, 0($sp) # Storing internal_49 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 304($sp) # internal_45 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_45 = internal_49 + lw $t0, 276($sp) + sw $t0, 292($sp) + + # Jumping to branch_end_8794484741346 + j branch_end_8794484741346 + + branch_Foo_8794484741346: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument n + lw $t0, 300($sp) + sw $t0, 4($sp) # Storing n + + # Argument self + lw $t0, 488($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 300($sp) # n = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Razz + li $v0, 9 + lw $a0, type_Razz + syscall + la $t0, type_Razz # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 268($sp) # internal_51 = address of allocated object Razz + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_51 + lw $t0, 276($sp) + sw $t0, 0($sp) # Storing internal_51 + + # Calling function function___init___at_Razz + jal function___init___at_Razz + lw $ra, 4($sp) + sw $v1, 276($sp) # internal_51 = result of function___init___at_Razz + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_45 + lw $t0, 304($sp) + sw $t0, 4($sp) # Storing internal_45 + + # Argument internal_51 + lw $t0, 280($sp) + sw $t0, 0($sp) # Storing internal_51 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 304($sp) # internal_45 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_45 = internal_51 + lw $t0, 268($sp) + sw $t0, 292($sp) + + # Jumping to branch_end_8794484741346 + j branch_end_8794484741346 + + branch_Bar_8794484741346: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument n + lw $t0, 300($sp) + sw $t0, 4($sp) # Storing n + + # Argument self + lw $t0, 488($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 300($sp) # n = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_45 + lw $t0, 304($sp) + sw $t0, 4($sp) # Storing internal_45 + + # Argument n + lw $t0, 300($sp) + sw $t0, 0($sp) # Storing n + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 304($sp) # internal_45 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_45 = n + lw $t0, 288($sp) + sw $t0, 292($sp) + + # Jumping to branch_end_8794484741346 + j branch_end_8794484741346 + + error_branch_8794484741346: + + branch_end_8794484741346: + + # Set attribute g of self + lw $t0, 476($sp) # $t0 = self + lw $t1, 292($sp) # $t1 = internal_45 + beq $t1, $zero, object_set_attribute_8794484661477 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8794484661477 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8794484661477 + j object_set_attribute_8794484661477 + int_set_attribute_8794484661477: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.g = internal_45 + j end_set_attribute_8794484661477 + bool_set_attribute_8794484661477: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.g = internal_45 + j end_set_attribute_8794484661477 + object_set_attribute_8794484661477: + sw $t1, 12($t0) # self.g = internal_45 + end_set_attribute_8794484661477: + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 256($sp) # internal_54 = address of allocated object Int + + # Get method printh of Foo + lw $t0, 476($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 256($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 252($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 484($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_55 + lw $t0, 260($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 268($sp) # internal_53 = result of internal_55 + addi $sp, $sp, 8 # Freeing space for arguments + + # Set attribute i of self + lw $t0, 476($sp) # $t0 = self + lw $t1, 260($sp) # $t1 = internal_53 + beq $t1, $zero, object_set_attribute_8794484666103 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8794484666103 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8794484666103 + j object_set_attribute_8794484666103 + int_set_attribute_8794484666103: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.i = internal_53 + j end_set_attribute_8794484666103 + bool_set_attribute_8794484666103: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.i = internal_53 + j end_set_attribute_8794484666103 + object_set_attribute_8794484666103: + sw $t1, 16($t0) # self.i = internal_53 + end_set_attribute_8794484666103: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 248($sp) # internal_56 = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 244($sp) # internal_57 = address of allocated object Int + + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 240($sp) # internal_58 = address of allocated object Int + + # Allocating NUll to internal_59 + sw $zero, 236($sp) # internal_59 = 0 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 232($sp) # internal_60 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 220($sp) # internal_63 = address of allocated object Int + + # internal_61 = typeof self that is the first word of the object + lw $t0, 476($sp) + lw $t0, 0($t0) + sw $t0, 228($sp) + + # internal_62 = internal_61 + lw $t0, 228($sp) + sw $t0, 224($sp) + + while_start_8794484748198: + + # internal_63 = EqualAddress(internal_62, internal_59) + lw $t0, 224($sp) + lw $t1, 236($sp) + seq $t2, $t0, $t1 + lw $t0, 220($sp) + sw $t2, 8($t0) + + # If internal_63 then goto while_end_8794484748198 + lw $t0, 220($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_end_8794484748198 + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_60 + lw $t0, 244($sp) + sw $t0, 4($sp) # Storing internal_60 + + # Argument internal_57 + lw $t0, 256($sp) + sw $t0, 0($sp) # Storing internal_57 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 244($sp) # internal_60 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_62 = ancestor of internal_62 + lw $t0, 224($sp) + lw $t0, 4($t0) + sw $t0, 224($sp) + + # Jumping to while_start_8794484748198 + j while_start_8794484748198 + + while_end_8794484748198: + + # internal_62 = internal_61 + lw $t0, 228($sp) + sw $t0, 224($sp) + + # initialize Array [internal_60] + lw $t0, 232($sp) # $t0 = internal_60 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 216($sp) # internal_64 = new Array[internal_60] + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 212($sp) # internal_65 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 208($sp) # internal_66 = address of allocated object Int + + foreach_start_8794484748198: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_65 + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing internal_65 + + # Argument internal_60 + lw $t0, 244($sp) + sw $t0, 0($sp) # Storing internal_60 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 220($sp) # internal_66 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_66 then goto foreach_body_8794484748198 + lw $t0, 208($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_body_8794484748198 + + # Jumping to foreach_end_8794484748198 + j foreach_end_8794484748198 + + foreach_body_8794484748198: + + # array internal_64[4 * internal_65] = internal_62 + lw $t0, 212($sp) # $t0 = internal_65 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 216($sp) # $t1 = internal_64 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 224($sp) + sw $t0, 0($t1) + + # internal_62 = ancestor of internal_62 + lw $t0, 224($sp) + lw $t0, 4($t0) + sw $t0, 224($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_65 + lw $t0, 224($sp) + sw $t0, 4($sp) # Storing internal_65 + + # Argument internal_57 + lw $t0, 256($sp) + sw $t0, 0($sp) # Storing internal_57 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 224($sp) # internal_65 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_start_8794484748198 + j foreach_start_8794484748198 + + foreach_end_8794484748198: + + # initialize Array [internal_58] + lw $t0, 240($sp) # $t0 = internal_58 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 204($sp) # internal_67 = new Array[internal_58] + + # initialize Array [internal_58] + lw $t0, 240($sp) # $t0 = internal_58 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 200($sp) # internal_68 = new Array[internal_58] + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 192($sp) # internal_70 = address of allocated object Int + + # internal_69 = direction of Razz + la $t0, type_Razz + sw $t0, 196($sp) + + # array internal_67[4 * internal_70] = internal_69 + lw $t0, 192($sp) # $t0 = internal_70 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 204($sp) # $t1 = internal_67 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 196($sp) + sw $t0, 0($t1) + + # array internal_68[4 * internal_70] = internal_60 + lw $t0, 192($sp) # $t0 = internal_70 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 200($sp) # $t1 = internal_68 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 232($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 184($sp) # internal_72 = address of allocated object Int + + # internal_71 = direction of Foo + la $t0, type_Foo + sw $t0, 188($sp) + + # array internal_67[4 * internal_72] = internal_71 + lw $t0, 184($sp) # $t0 = internal_72 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 204($sp) # $t1 = internal_67 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 188($sp) + sw $t0, 0($t1) + + # array internal_68[4 * internal_72] = internal_60 + lw $t0, 184($sp) # $t0 = internal_72 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 200($sp) # $t1 = internal_68 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 232($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 176($sp) # internal_74 = address of allocated object Int + + # internal_73 = direction of Bar + la $t0, type_Bar + sw $t0, 180($sp) + + # array internal_67[4 * internal_74] = internal_73 + lw $t0, 176($sp) # $t0 = internal_74 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 204($sp) # $t1 = internal_67 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 180($sp) + sw $t0, 0($t1) + + # array internal_68[4 * internal_74] = internal_60 + lw $t0, 176($sp) # $t0 = internal_74 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 200($sp) # $t1 = internal_68 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 232($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 172($sp) # internal_75 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 168($sp) # internal_76 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 160($sp) # internal_78 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 156($sp) # internal_79 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 148($sp) # internal_81 = address of allocated object Int + + foreach_type_start_8794484748198: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_75 + lw $t0, 184($sp) + sw $t0, 4($sp) # Storing internal_75 + + # Argument internal_58 + lw $t0, 252($sp) + sw $t0, 0($sp) # Storing internal_58 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 180($sp) # internal_76 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_76 then goto foreach_type_body_8794484748198 + lw $t0, 168($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_type_body_8794484748198 + + # Jumping to foreach_type_end_8794484748198 + j foreach_type_end_8794484748198 + + foreach_type_body_8794484748198: + + # internal_77 = array internal_67[4 * internal_75] + lw $t0, 172($sp) # $t0 = internal_75 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 204($sp) # $t1 = internal_67 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + sw $t0, 164($sp) # internal_77 = array internal_67[4 * internal_75] + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_78 + lw $t0, 172($sp) + sw $t0, 4($sp) # Storing internal_78 + + # Argument internal_56 + lw $t0, 260($sp) + sw $t0, 0($sp) # Storing internal_56 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 172($sp) # internal_78 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + foreach_ancestor_start_8794484748198: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_78 + lw $t0, 172($sp) + sw $t0, 4($sp) # Storing internal_78 + + # Argument internal_60 + lw $t0, 244($sp) + sw $t0, 0($sp) # Storing internal_60 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 168($sp) # internal_79 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_79 then goto foreach_ancestor_body_8794484748198 + lw $t0, 156($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_body_8794484748198 + + # Jumping to foreach_ancestor_end_8794484748198 + j foreach_ancestor_end_8794484748198 + + foreach_ancestor_body_8794484748198: + + # internal_80 = array internal_64[4 * internal_78] + lw $t0, 160($sp) # $t0 = internal_78 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 216($sp) # $t1 = internal_64 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + sw $t0, 152($sp) # internal_80 = array internal_64[4 * internal_78] + + # internal_81 = EqualAddress(internal_77, internal_80) + lw $t0, 164($sp) + lw $t1, 152($sp) + seq $t2, $t0, $t1 + lw $t0, 148($sp) + sw $t2, 8($t0) + + # If internal_81 then goto foreach_ancestor_end_8794484748198 + lw $t0, 148($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_end_8794484748198 + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_78 + lw $t0, 172($sp) + sw $t0, 4($sp) # Storing internal_78 + + # Argument internal_57 + lw $t0, 256($sp) + sw $t0, 0($sp) # Storing internal_57 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 172($sp) # internal_78 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_ancestor_start_8794484748198 + j foreach_ancestor_start_8794484748198 + + foreach_ancestor_end_8794484748198: + + # array internal_68[4 * internal_75] = internal_78 + lw $t0, 172($sp) # $t0 = internal_75 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 200($sp) # $t1 = internal_68 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 160($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_75 + lw $t0, 184($sp) + sw $t0, 4($sp) # Storing internal_75 + + # Argument internal_57 + lw $t0, 256($sp) + sw $t0, 0($sp) # Storing internal_57 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 184($sp) # internal_75 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_type_start_8794484748198 + j foreach_type_start_8794484748198 + + foreach_type_end_8794484748198: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 144($sp) # internal_82 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 140($sp) # internal_83 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 136($sp) # internal_84 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 132($sp) # internal_85 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 128($sp) # internal_86 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_85 + lw $t0, 144($sp) + sw $t0, 4($sp) # Storing internal_85 + + # Argument internal_60 + lw $t0, 244($sp) + sw $t0, 0($sp) # Storing internal_60 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 144($sp) # internal_85 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + foreach_min_start_8794484748198: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_82 + lw $t0, 156($sp) + sw $t0, 4($sp) # Storing internal_82 + + # Argument internal_58 + lw $t0, 252($sp) + sw $t0, 0($sp) # Storing internal_58 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 140($sp) # internal_86 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_86 then goto foreach_min_body_8794484748198 + lw $t0, 128($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_min_body_8794484748198 + + # Jumping to foreach_min_end_8794484748198 + j foreach_min_end_8794484748198 + + foreach_min_body_8794484748198: + + # internal_84 = array internal_68[4 * internal_82] + lw $t0, 144($sp) # $t0 = internal_82 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 200($sp) # $t1 = internal_68 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 136($sp) # internal_84 = array internal_68[4 * internal_82] + sw $t0, 8($t2) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_84 + lw $t0, 148($sp) + sw $t0, 4($sp) # Storing internal_84 + + # Argument internal_85 + lw $t0, 144($sp) + sw $t0, 0($sp) # Storing internal_85 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 140($sp) # internal_86 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_86 then goto update_min_8794484748198 + lw $t0, 128($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, update_min_8794484748198 + + # Jumping to update_min_end_8794484748198 + j update_min_end_8794484748198 + + update_min_8794484748198: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_85 + lw $t0, 144($sp) + sw $t0, 4($sp) # Storing internal_85 + + # Argument internal_84 + lw $t0, 148($sp) + sw $t0, 0($sp) # Storing internal_84 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 144($sp) # internal_85 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_83 + lw $t0, 152($sp) + sw $t0, 4($sp) # Storing internal_83 + + # Argument internal_82 + lw $t0, 156($sp) + sw $t0, 0($sp) # Storing internal_82 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 152($sp) # internal_83 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + update_min_end_8794484748198: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_82 + lw $t0, 156($sp) + sw $t0, 4($sp) # Storing internal_82 + + # Argument internal_57 + lw $t0, 256($sp) + sw $t0, 0($sp) # Storing internal_57 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 156($sp) # internal_82 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_min_start_8794484748198 + j foreach_min_start_8794484748198 + + foreach_min_end_8794484748198: + + # initialize Array [internal_58] + lw $t0, 240($sp) # $t0 = internal_58 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 124($sp) # internal_87 = new Array[internal_58] + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 120($sp) # internal_88 = address of allocated object Int + + # array internal_87[4 * internal_88] = internal_56 + lw $t0, 120($sp) # $t0 = internal_88 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 124($sp) # $t1 = internal_87 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 248($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 116($sp) # internal_89 = address of allocated object Int + + # array internal_87[4 * internal_89] = internal_56 + lw $t0, 116($sp) # $t0 = internal_89 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 124($sp) # $t1 = internal_87 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 248($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 112($sp) # internal_90 = address of allocated object Int + + # array internal_87[4 * internal_90] = internal_56 + lw $t0, 112($sp) # $t0 = internal_90 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 124($sp) # $t1 = internal_87 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 248($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 108($sp) # internal_91 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_85 + lw $t0, 144($sp) + sw $t0, 4($sp) # Storing internal_85 + + # Argument internal_60 + lw $t0, 244($sp) + sw $t0, 0($sp) # Storing internal_60 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 120($sp) # internal_91 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_91 then goto error_branch_8794484748198 + lw $t0, 108($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, error_branch_8794484748198 + + # array internal_87[4 * internal_83] = internal_57 + lw $t0, 140($sp) # $t0 = internal_83 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 124($sp) # $t1 = internal_87 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 244($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 104($sp) # internal_92 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 100($sp) # internal_93 = address of allocated object Int + + # internal_92 = array internal_87[4 * internal_93] + lw $t0, 100($sp) # $t0 = internal_93 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 124($sp) # $t1 = internal_87 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 104($sp) # internal_92 = array internal_87[4 * internal_93] + sw $t0, 8($t2) + + # If internal_92 then goto branch_Razz_8794484748198 + lw $t0, 104($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Razz_8794484748198 + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 96($sp) # internal_94 = address of allocated object Int + + # internal_92 = array internal_87[4 * internal_94] + lw $t0, 96($sp) # $t0 = internal_94 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 124($sp) # $t1 = internal_87 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 104($sp) # internal_92 = array internal_87[4 * internal_94] + sw $t0, 8($t2) + + # If internal_92 then goto branch_Foo_8794484748198 + lw $t0, 104($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Foo_8794484748198 + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 92($sp) # internal_95 = address of allocated object Int + + # internal_92 = array internal_87[4 * internal_95] + lw $t0, 92($sp) # $t0 = internal_95 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 124($sp) # $t1 = internal_87 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 104($sp) # internal_92 = array internal_87[4 * internal_95] + sw $t0, 8($t2) + + # If internal_92 then goto branch_Bar_8794484748198 + lw $t0, 104($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Bar_8794484748198 + + branch_Razz_8794484748198: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument n + lw $t0, 300($sp) + sw $t0, 4($sp) # Storing n + + # Argument self + lw $t0, 488($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 300($sp) # n = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Bar + li $v0, 9 + lw $a0, type_Bar + syscall + la $t0, type_Bar # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 80($sp) # internal_98 = address of allocated object Bar + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_98 + lw $t0, 88($sp) + sw $t0, 0($sp) # Storing internal_98 + + # Calling function function___init___at_Bar + jal function___init___at_Bar + lw $ra, 4($sp) + sw $v1, 88($sp) # internal_98 = result of function___init___at_Bar + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_96 + lw $t0, 100($sp) + sw $t0, 4($sp) # Storing internal_96 + + # Argument internal_98 + lw $t0, 92($sp) + sw $t0, 0($sp) # Storing internal_98 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 100($sp) # internal_96 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_96 = internal_98 + lw $t0, 80($sp) + sw $t0, 88($sp) + + # Jumping to branch_end_8794484748198 + j branch_end_8794484748198 + + branch_Foo_8794484748198: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument n + lw $t0, 300($sp) + sw $t0, 4($sp) # Storing n + + # Argument self + lw $t0, 488($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 300($sp) # n = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Razz + li $v0, 9 + lw $a0, type_Razz + syscall + la $t0, type_Razz # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 72($sp) # internal_100 = address of allocated object Razz + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_100 + lw $t0, 80($sp) + sw $t0, 0($sp) # Storing internal_100 + + # Calling function function___init___at_Razz + jal function___init___at_Razz + lw $ra, 4($sp) + sw $v1, 80($sp) # internal_100 = result of function___init___at_Razz + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_96 + lw $t0, 100($sp) + sw $t0, 4($sp) # Storing internal_96 + + # Argument internal_100 + lw $t0, 84($sp) + sw $t0, 0($sp) # Storing internal_100 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 100($sp) # internal_96 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_96 = internal_100 + lw $t0, 72($sp) + sw $t0, 88($sp) + + # Jumping to branch_end_8794484748198 + j branch_end_8794484748198 + + branch_Bar_8794484748198: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument n + lw $t0, 300($sp) + sw $t0, 4($sp) # Storing n + + # Argument self + lw $t0, 488($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 300($sp) # n = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_96 + lw $t0, 100($sp) + sw $t0, 4($sp) # Storing internal_96 + + # Argument n + lw $t0, 300($sp) + sw $t0, 0($sp) # Storing n + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 100($sp) # internal_96 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_96 = n + lw $t0, 288($sp) + sw $t0, 88($sp) + + # Jumping to branch_end_8794484748198 + j branch_end_8794484748198 + + error_branch_8794484748198: + + branch_end_8794484748198: + + # Set attribute a of self + lw $t0, 476($sp) # $t0 = self + lw $t1, 88($sp) # $t1 = internal_96 + beq $t1, $zero, object_set_attribute_8794484666673 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8794484666673 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8794484666673 + j object_set_attribute_8794484666673 + int_set_attribute_8794484666673: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($t0) # self.a = internal_96 + j end_set_attribute_8794484666673 + bool_set_attribute_8794484666673: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($t0) # self.a = internal_96 + j end_set_attribute_8794484666673 + object_set_attribute_8794484666673: + sw $t1, 20($t0) # self.a = internal_96 + end_set_attribute_8794484666673: + + # Get attribute a of self + lw $t0, 476($sp) # Get the address of self + lw $t1, 20($t0) # Get the attribute 'a' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8794484637392 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8794484637392 + j object_get_attribute_8794484637392 + int_get_attribute_8794484637392: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 64($sp) # internal_102 = self.a + j end_get_attribute_8794484637392 + bool_get_attribute_8794484637392: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 64($sp) # internal_102 = self.a + j end_get_attribute_8794484637392 + object_get_attribute_8794484637392: + sw $t1, 64($sp) # internal_102 = self.a + end_get_attribute_8794484637392: + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 56($sp) # internal_104 = address of allocated object Int + + # Get method doh of Razz + lw $t0, 64($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 56($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 52($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_102 + lw $t0, 72($sp) + sw $t0, 0($sp) # Storing internal_102 + + # Calling function internal_105 + lw $t0, 60($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 68($sp) # internal_103 = result of internal_105 + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute g of self + lw $t0, 476($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'g' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8794484637706 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8794484637706 + j object_get_attribute_8794484637706 + int_get_attribute_8794484637706: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 48($sp) # internal_106 = self.g + j end_get_attribute_8794484637706 + bool_get_attribute_8794484637706: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 48($sp) # internal_106 = self.g + j end_get_attribute_8794484637706 + object_get_attribute_8794484637706: + sw $t1, 48($sp) # internal_106 = self.g + end_get_attribute_8794484637706: + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_108 = address of allocated object Int + + # Get method doh of Foo + lw $t0, 48($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 40($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 36($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_106 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_106 + + # Calling function internal_109 + lw $t0, 44($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 52($sp) # internal_107 = result of internal_109 + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_103 + lw $t0, 72($sp) + sw $t0, 4($sp) # Storing internal_103 + + # Argument internal_107 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_107 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 44($sp) # internal_110 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # internal_112 = address of allocated object Int + + # Get method doh of Foo + lw $t0, 476($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 24($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 20($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 484($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_113 + lw $t0, 28($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 36($sp) # internal_111 = result of internal_113 + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_110 + lw $t0, 44($sp) + sw $t0, 4($sp) # Storing internal_110 + + # Argument internal_111 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_111 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_114 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_116 = address of allocated object Int + + # Get method printh of Foo + lw $t0, 476($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 8($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 4($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 484($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_117 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_115 = result of internal_117 + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_114 + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing internal_114 + + # Argument internal_115 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_115 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_118 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Set attribute b of self + lw $t0, 476($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_118 + beq $t1, $zero, object_set_attribute_8794484637332 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8794484637332 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8794484637332 + j object_set_attribute_8794484637332 + int_set_attribute_8794484637332: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 24($t0) # self.b = internal_118 + j end_set_attribute_8794484637332 + bool_set_attribute_8794484637332: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 24($t0) # self.b = internal_118 + j end_set_attribute_8794484637332 + object_set_attribute_8794484637332: + sw $t1, 24($t0) # self.b = internal_118 + end_set_attribute_8794484637332: + + # Loading return value in $v1 + lw $v1, 476($sp) + + # Freeing space for local variables + addi $sp, $sp, 476 + + jr $ra + + function_doh_at_Foo: + # Function parameters + # $ra = 24($sp) + # self = 20($sp) + + # Reserving space for local variables + addi $sp, $sp, -20 + + # Get attribute h of self + lw $t0, 20($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'h' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8794484637907 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8794484637907 + j object_get_attribute_8794484637907 + int_get_attribute_8794484637907: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_1 = self.h + j end_get_attribute_8794484637907 + bool_get_attribute_8794484637907: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_1 = self.h + j end_get_attribute_8794484637907 + object_get_attribute_8794484637907: + sw $t1, 12($sp) # internal_1 = self.h + end_get_attribute_8794484637907: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_1 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 28($sp) # i = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute h of self + lw $t0, 20($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'h' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8794484638233 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8794484638233 + j object_get_attribute_8794484638233 + int_get_attribute_8794484638233: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($sp) # internal_2 = self.h + j end_get_attribute_8794484638233 + bool_get_attribute_8794484638233: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($sp) # internal_2 = self.h + j end_get_attribute_8794484638233 + object_get_attribute_8794484638233: + sw $t1, 8($sp) # internal_2 = self.h + end_get_attribute_8794484638233: + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_3 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 20($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_3 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_4 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Set attribute h of self + lw $t0, 20($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_4 + beq $t1, $zero, object_set_attribute_8794484637946 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8794484637946 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8794484637946 + j object_set_attribute_8794484637946 + int_set_attribute_8794484637946: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.h = internal_4 + j end_set_attribute_8794484637946 + bool_set_attribute_8794484637946: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.h = internal_4 + j end_set_attribute_8794484637946 + object_set_attribute_8794484637946: + sw $t1, 8($t0) # self.h = internal_4 + end_set_attribute_8794484637946: + + # Loading return value in $v1 + lw $v1, 16($sp) + + # Freeing space for local variables + addi $sp, $sp, 20 + + jr $ra + + function___init___at_Bar: + # Function parameters + # $ra = 752($sp) + # self = 748($sp) + + # Reserving space for local variables + addi $sp, $sp, -748 + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 744($sp) # internal_0 = address of allocated object Int + + # Set attribute h of self + lw $t0, 748($sp) # $t0 = self + lw $t1, 744($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8794484638281 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8794484638281 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8794484638281 + j object_set_attribute_8794484638281 + int_set_attribute_8794484638281: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.h = internal_0 + j end_set_attribute_8794484638281 + bool_set_attribute_8794484638281: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.h = internal_0 + j end_set_attribute_8794484638281 + object_set_attribute_8794484638281: + sw $t1, 8($t0) # self.h = internal_0 + end_set_attribute_8794484638281: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 740($sp) # internal_1 = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 736($sp) # internal_2 = address of allocated object Int + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 732($sp) # internal_3 = address of allocated object Int + + # Allocating NUll to internal_4 + sw $zero, 728($sp) # internal_4 = 0 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 724($sp) # internal_5 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 712($sp) # internal_8 = address of allocated object Int + + # internal_6 = typeof self that is the first word of the object + lw $t0, 748($sp) + lw $t0, 0($t0) + sw $t0, 720($sp) + + # internal_7 = internal_6 + lw $t0, 720($sp) + sw $t0, 716($sp) + + while_start_8794484723258: + + # internal_8 = EqualAddress(internal_7, internal_4) + lw $t0, 716($sp) + lw $t1, 728($sp) + seq $t2, $t0, $t1 + lw $t0, 712($sp) + sw $t2, 8($t0) + + # If internal_8 then goto while_end_8794484723258 + lw $t0, 712($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_end_8794484723258 + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_5 + lw $t0, 736($sp) + sw $t0, 4($sp) # Storing internal_5 + + # Argument internal_2 + lw $t0, 748($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 736($sp) # internal_5 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_7 = ancestor of internal_7 + lw $t0, 716($sp) + lw $t0, 4($t0) + sw $t0, 716($sp) + + # Jumping to while_start_8794484723258 + j while_start_8794484723258 + + while_end_8794484723258: + + # internal_7 = internal_6 + lw $t0, 720($sp) + sw $t0, 716($sp) + + # initialize Array [internal_5] + lw $t0, 724($sp) # $t0 = internal_5 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 708($sp) # internal_9 = new Array[internal_5] + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 704($sp) # internal_10 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 700($sp) # internal_11 = address of allocated object Int + + foreach_start_8794484723258: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_10 + lw $t0, 716($sp) + sw $t0, 4($sp) # Storing internal_10 + + # Argument internal_5 + lw $t0, 736($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 712($sp) # internal_11 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_11 then goto foreach_body_8794484723258 + lw $t0, 700($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_body_8794484723258 + + # Jumping to foreach_end_8794484723258 + j foreach_end_8794484723258 + + foreach_body_8794484723258: + + # array internal_9[4 * internal_10] = internal_7 + lw $t0, 704($sp) # $t0 = internal_10 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 708($sp) # $t1 = internal_9 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 716($sp) + sw $t0, 0($t1) + + # internal_7 = ancestor of internal_7 + lw $t0, 716($sp) + lw $t0, 4($t0) + sw $t0, 716($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_10 + lw $t0, 716($sp) + sw $t0, 4($sp) # Storing internal_10 + + # Argument internal_2 + lw $t0, 748($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 716($sp) # internal_10 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_start_8794484723258 + j foreach_start_8794484723258 + + foreach_end_8794484723258: + + # initialize Array [internal_3] + lw $t0, 732($sp) # $t0 = internal_3 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 696($sp) # internal_12 = new Array[internal_3] + + # initialize Array [internal_3] + lw $t0, 732($sp) # $t0 = internal_3 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 692($sp) # internal_13 = new Array[internal_3] + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 684($sp) # internal_15 = address of allocated object Int + + # internal_14 = direction of Bazz + la $t0, type_Bazz + sw $t0, 688($sp) + + # array internal_12[4 * internal_15] = internal_14 + lw $t0, 684($sp) # $t0 = internal_15 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 696($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 688($sp) + sw $t0, 0($t1) + + # array internal_13[4 * internal_15] = internal_5 + lw $t0, 684($sp) # $t0 = internal_15 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 692($sp) # $t1 = internal_13 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 724($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 676($sp) # internal_17 = address of allocated object Int + + # internal_16 = direction of Razz + la $t0, type_Razz + sw $t0, 680($sp) + + # array internal_12[4 * internal_17] = internal_16 + lw $t0, 676($sp) # $t0 = internal_17 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 696($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 680($sp) + sw $t0, 0($t1) + + # array internal_13[4 * internal_17] = internal_5 + lw $t0, 676($sp) # $t0 = internal_17 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 692($sp) # $t1 = internal_13 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 724($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 668($sp) # internal_19 = address of allocated object Int + + # internal_18 = direction of Foo + la $t0, type_Foo + sw $t0, 672($sp) + + # array internal_12[4 * internal_19] = internal_18 + lw $t0, 668($sp) # $t0 = internal_19 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 696($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 672($sp) + sw $t0, 0($t1) + + # array internal_13[4 * internal_19] = internal_5 + lw $t0, 668($sp) # $t0 = internal_19 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 692($sp) # $t1 = internal_13 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 724($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 660($sp) # internal_21 = address of allocated object Int + + # internal_20 = direction of Bar + la $t0, type_Bar + sw $t0, 664($sp) + + # array internal_12[4 * internal_21] = internal_20 + lw $t0, 660($sp) # $t0 = internal_21 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 696($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 664($sp) + sw $t0, 0($t1) + + # array internal_13[4 * internal_21] = internal_5 + lw $t0, 660($sp) # $t0 = internal_21 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 692($sp) # $t1 = internal_13 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 724($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 656($sp) # internal_22 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 652($sp) # internal_23 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 644($sp) # internal_25 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 640($sp) # internal_26 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 632($sp) # internal_28 = address of allocated object Int + + foreach_type_start_8794484723258: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_22 + lw $t0, 668($sp) + sw $t0, 4($sp) # Storing internal_22 + + # Argument internal_3 + lw $t0, 744($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 664($sp) # internal_23 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_23 then goto foreach_type_body_8794484723258 + lw $t0, 652($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_type_body_8794484723258 + + # Jumping to foreach_type_end_8794484723258 + j foreach_type_end_8794484723258 + + foreach_type_body_8794484723258: + + # internal_24 = array internal_12[4 * internal_22] + lw $t0, 656($sp) # $t0 = internal_22 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 696($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + sw $t0, 648($sp) # internal_24 = array internal_12[4 * internal_22] + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_25 + lw $t0, 656($sp) + sw $t0, 4($sp) # Storing internal_25 + + # Argument internal_1 + lw $t0, 752($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 656($sp) # internal_25 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + foreach_ancestor_start_8794484723258: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_25 + lw $t0, 656($sp) + sw $t0, 4($sp) # Storing internal_25 + + # Argument internal_5 + lw $t0, 736($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 652($sp) # internal_26 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_26 then goto foreach_ancestor_body_8794484723258 + lw $t0, 640($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_body_8794484723258 + + # Jumping to foreach_ancestor_end_8794484723258 + j foreach_ancestor_end_8794484723258 + + foreach_ancestor_body_8794484723258: + + # internal_27 = array internal_9[4 * internal_25] + lw $t0, 644($sp) # $t0 = internal_25 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 708($sp) # $t1 = internal_9 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + sw $t0, 636($sp) # internal_27 = array internal_9[4 * internal_25] + + # internal_28 = EqualAddress(internal_24, internal_27) + lw $t0, 648($sp) + lw $t1, 636($sp) + seq $t2, $t0, $t1 + lw $t0, 632($sp) + sw $t2, 8($t0) + + # If internal_28 then goto foreach_ancestor_end_8794484723258 + lw $t0, 632($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_end_8794484723258 + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_25 + lw $t0, 656($sp) + sw $t0, 4($sp) # Storing internal_25 + + # Argument internal_2 + lw $t0, 748($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 656($sp) # internal_25 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_ancestor_start_8794484723258 + j foreach_ancestor_start_8794484723258 + + foreach_ancestor_end_8794484723258: + + # array internal_13[4 * internal_22] = internal_25 + lw $t0, 656($sp) # $t0 = internal_22 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 692($sp) # $t1 = internal_13 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 644($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_22 + lw $t0, 668($sp) + sw $t0, 4($sp) # Storing internal_22 + + # Argument internal_2 + lw $t0, 748($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 668($sp) # internal_22 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_type_start_8794484723258 + j foreach_type_start_8794484723258 + + foreach_type_end_8794484723258: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 628($sp) # internal_29 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 624($sp) # internal_30 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 620($sp) # internal_31 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 616($sp) # internal_32 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 612($sp) # internal_33 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_32 + lw $t0, 628($sp) + sw $t0, 4($sp) # Storing internal_32 + + # Argument internal_5 + lw $t0, 736($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 628($sp) # internal_32 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + foreach_min_start_8794484723258: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_29 + lw $t0, 640($sp) + sw $t0, 4($sp) # Storing internal_29 + + # Argument internal_3 + lw $t0, 744($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 624($sp) # internal_33 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_33 then goto foreach_min_body_8794484723258 + lw $t0, 612($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_min_body_8794484723258 + + # Jumping to foreach_min_end_8794484723258 + j foreach_min_end_8794484723258 + + foreach_min_body_8794484723258: + + # internal_31 = array internal_13[4 * internal_29] + lw $t0, 628($sp) # $t0 = internal_29 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 692($sp) # $t1 = internal_13 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 620($sp) # internal_31 = array internal_13[4 * internal_29] + sw $t0, 8($t2) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_31 + lw $t0, 632($sp) + sw $t0, 4($sp) # Storing internal_31 + + # Argument internal_32 + lw $t0, 628($sp) + sw $t0, 0($sp) # Storing internal_32 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 624($sp) # internal_33 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_33 then goto update_min_8794484723258 + lw $t0, 612($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, update_min_8794484723258 + + # Jumping to update_min_end_8794484723258 + j update_min_end_8794484723258 + + update_min_8794484723258: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_32 + lw $t0, 628($sp) + sw $t0, 4($sp) # Storing internal_32 + + # Argument internal_31 + lw $t0, 632($sp) + sw $t0, 0($sp) # Storing internal_31 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 628($sp) # internal_32 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_30 + lw $t0, 636($sp) + sw $t0, 4($sp) # Storing internal_30 + + # Argument internal_29 + lw $t0, 640($sp) + sw $t0, 0($sp) # Storing internal_29 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 636($sp) # internal_30 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + update_min_end_8794484723258: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_29 + lw $t0, 640($sp) + sw $t0, 4($sp) # Storing internal_29 + + # Argument internal_2 + lw $t0, 748($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 640($sp) # internal_29 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_min_start_8794484723258 + j foreach_min_start_8794484723258 + + foreach_min_end_8794484723258: + + # initialize Array [internal_3] + lw $t0, 732($sp) # $t0 = internal_3 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 608($sp) # internal_34 = new Array[internal_3] + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 604($sp) # internal_35 = address of allocated object Int + + # array internal_34[4 * internal_35] = internal_1 + lw $t0, 604($sp) # $t0 = internal_35 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 608($sp) # $t1 = internal_34 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 740($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 600($sp) # internal_36 = address of allocated object Int + + # array internal_34[4 * internal_36] = internal_1 + lw $t0, 600($sp) # $t0 = internal_36 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 608($sp) # $t1 = internal_34 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 740($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 596($sp) # internal_37 = address of allocated object Int + + # array internal_34[4 * internal_37] = internal_1 + lw $t0, 596($sp) # $t0 = internal_37 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 608($sp) # $t1 = internal_34 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 740($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 592($sp) # internal_38 = address of allocated object Int + + # array internal_34[4 * internal_38] = internal_1 + lw $t0, 592($sp) # $t0 = internal_38 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 608($sp) # $t1 = internal_34 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 740($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 588($sp) # internal_39 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_32 + lw $t0, 628($sp) + sw $t0, 4($sp) # Storing internal_32 + + # Argument internal_5 + lw $t0, 736($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 600($sp) # internal_39 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_39 then goto error_branch_8794484723258 + lw $t0, 588($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, error_branch_8794484723258 + + # array internal_34[4 * internal_30] = internal_2 + lw $t0, 624($sp) # $t0 = internal_30 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 608($sp) # $t1 = internal_34 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 736($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 584($sp) # internal_40 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 580($sp) # internal_41 = address of allocated object Int + + # internal_40 = array internal_34[4 * internal_41] + lw $t0, 580($sp) # $t0 = internal_41 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 608($sp) # $t1 = internal_34 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 584($sp) # internal_40 = array internal_34[4 * internal_41] + sw $t0, 8($t2) + + # If internal_40 then goto branch_Bazz_8794484723258 + lw $t0, 584($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Bazz_8794484723258 + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 576($sp) # internal_42 = address of allocated object Int + + # internal_40 = array internal_34[4 * internal_42] + lw $t0, 576($sp) # $t0 = internal_42 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 608($sp) # $t1 = internal_34 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 584($sp) # internal_40 = array internal_34[4 * internal_42] + sw $t0, 8($t2) + + # If internal_40 then goto branch_Razz_8794484723258 + lw $t0, 584($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Razz_8794484723258 + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 572($sp) # internal_43 = address of allocated object Int + + # internal_40 = array internal_34[4 * internal_43] + lw $t0, 572($sp) # $t0 = internal_43 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 608($sp) # $t1 = internal_34 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 584($sp) # internal_40 = array internal_34[4 * internal_43] + sw $t0, 8($t2) + + # If internal_40 then goto branch_Foo_8794484723258 + lw $t0, 584($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Foo_8794484723258 + + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 568($sp) # internal_44 = address of allocated object Int + + # internal_40 = array internal_34[4 * internal_44] + lw $t0, 568($sp) # $t0 = internal_44 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 608($sp) # $t1 = internal_34 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 584($sp) # internal_40 = array internal_34[4 * internal_44] + sw $t0, 8($t2) + + # If internal_40 then goto branch_Bar_8794484723258 + lw $t0, 584($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Bar_8794484723258 + + branch_Bazz_8794484723258: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument n + lw $t0, 572($sp) + sw $t0, 4($sp) # Storing n + + # Argument self + lw $t0, 760($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 572($sp) # n = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Foo + li $v0, 9 + lw $a0, type_Foo + syscall + la $t0, type_Foo # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 556($sp) # internal_47 = address of allocated object Foo + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_47 + lw $t0, 564($sp) + sw $t0, 0($sp) # Storing internal_47 + + # Calling function function___init___at_Foo + jal function___init___at_Foo + lw $ra, 4($sp) + sw $v1, 564($sp) # internal_47 = result of function___init___at_Foo + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_45 + lw $t0, 576($sp) + sw $t0, 4($sp) # Storing internal_45 + + # Argument internal_47 + lw $t0, 568($sp) + sw $t0, 0($sp) # Storing internal_47 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 576($sp) # internal_45 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_45 = internal_47 + lw $t0, 556($sp) + sw $t0, 564($sp) + + # Jumping to branch_end_8794484723258 + j branch_end_8794484723258 + + branch_Razz_8794484723258: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument n + lw $t0, 572($sp) + sw $t0, 4($sp) # Storing n + + # Argument self + lw $t0, 760($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 572($sp) # n = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Bar + li $v0, 9 + lw $a0, type_Bar + syscall + la $t0, type_Bar # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 548($sp) # internal_49 = address of allocated object Bar + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_49 + lw $t0, 556($sp) + sw $t0, 0($sp) # Storing internal_49 + + # Calling function function___init___at_Bar + jal function___init___at_Bar + lw $ra, 4($sp) + sw $v1, 556($sp) # internal_49 = result of function___init___at_Bar + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_45 + lw $t0, 576($sp) + sw $t0, 4($sp) # Storing internal_45 + + # Argument internal_49 + lw $t0, 560($sp) + sw $t0, 0($sp) # Storing internal_49 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 576($sp) # internal_45 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_45 = internal_49 + lw $t0, 548($sp) + sw $t0, 564($sp) + + # Jumping to branch_end_8794484723258 + j branch_end_8794484723258 + + branch_Foo_8794484723258: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument n + lw $t0, 572($sp) + sw $t0, 4($sp) # Storing n + + # Argument self + lw $t0, 760($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 572($sp) # n = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Razz + li $v0, 9 + lw $a0, type_Razz + syscall + la $t0, type_Razz # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 540($sp) # internal_51 = address of allocated object Razz + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_51 + lw $t0, 548($sp) + sw $t0, 0($sp) # Storing internal_51 + + # Calling function function___init___at_Razz + jal function___init___at_Razz + lw $ra, 4($sp) + sw $v1, 548($sp) # internal_51 = result of function___init___at_Razz + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_45 + lw $t0, 576($sp) + sw $t0, 4($sp) # Storing internal_45 + + # Argument internal_51 + lw $t0, 552($sp) + sw $t0, 0($sp) # Storing internal_51 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 576($sp) # internal_45 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_45 = internal_51 + lw $t0, 540($sp) + sw $t0, 564($sp) + + # Jumping to branch_end_8794484723258 + j branch_end_8794484723258 + + branch_Bar_8794484723258: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument n + lw $t0, 572($sp) + sw $t0, 4($sp) # Storing n + + # Argument self + lw $t0, 760($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 572($sp) # n = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_45 + lw $t0, 576($sp) + sw $t0, 4($sp) # Storing internal_45 + + # Argument n + lw $t0, 572($sp) + sw $t0, 0($sp) # Storing n + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 576($sp) # internal_45 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_45 = n + lw $t0, 560($sp) + sw $t0, 564($sp) + + # Jumping to branch_end_8794484723258 + j branch_end_8794484723258 + + error_branch_8794484723258: + + branch_end_8794484723258: + + # Set attribute g of self + lw $t0, 748($sp) # $t0 = self + lw $t1, 564($sp) # $t1 = internal_45 + beq $t1, $zero, object_set_attribute_8794484638299 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8794484638299 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8794484638299 + j object_set_attribute_8794484638299 + int_set_attribute_8794484638299: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.g = internal_45 + j end_set_attribute_8794484638299 + bool_set_attribute_8794484638299: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.g = internal_45 + j end_set_attribute_8794484638299 + object_set_attribute_8794484638299: + sw $t1, 12($t0) # self.g = internal_45 + end_set_attribute_8794484638299: + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 528($sp) # internal_54 = address of allocated object Int + + # Get method printh of Bar + lw $t0, 748($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 528($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 524($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 756($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_55 + lw $t0, 532($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 540($sp) # internal_53 = result of internal_55 + addi $sp, $sp, 8 # Freeing space for arguments + + # Set attribute i of self + lw $t0, 748($sp) # $t0 = self + lw $t1, 532($sp) # $t1 = internal_53 + beq $t1, $zero, object_set_attribute_8794484638302 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8794484638302 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8794484638302 + j object_set_attribute_8794484638302 + int_set_attribute_8794484638302: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.i = internal_53 + j end_set_attribute_8794484638302 + bool_set_attribute_8794484638302: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.i = internal_53 + j end_set_attribute_8794484638302 + object_set_attribute_8794484638302: + sw $t1, 16($t0) # self.i = internal_53 + end_set_attribute_8794484638302: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 520($sp) # internal_56 = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 516($sp) # internal_57 = address of allocated object Int + + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 512($sp) # internal_58 = address of allocated object Int + + # Allocating NUll to internal_59 + sw $zero, 508($sp) # internal_59 = 0 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 504($sp) # internal_60 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 492($sp) # internal_63 = address of allocated object Int + + # internal_61 = typeof self that is the first word of the object + lw $t0, 748($sp) + lw $t0, 0($t0) + sw $t0, 500($sp) + + # internal_62 = internal_61 + lw $t0, 500($sp) + sw $t0, 496($sp) + + while_start_8794484728583: + + # internal_63 = EqualAddress(internal_62, internal_59) + lw $t0, 496($sp) + lw $t1, 508($sp) + seq $t2, $t0, $t1 + lw $t0, 492($sp) + sw $t2, 8($t0) + + # If internal_63 then goto while_end_8794484728583 + lw $t0, 492($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_end_8794484728583 + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_60 + lw $t0, 516($sp) + sw $t0, 4($sp) # Storing internal_60 + + # Argument internal_57 + lw $t0, 528($sp) + sw $t0, 0($sp) # Storing internal_57 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 516($sp) # internal_60 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_62 = ancestor of internal_62 + lw $t0, 496($sp) + lw $t0, 4($t0) + sw $t0, 496($sp) + + # Jumping to while_start_8794484728583 + j while_start_8794484728583 + + while_end_8794484728583: + + # internal_62 = internal_61 + lw $t0, 500($sp) + sw $t0, 496($sp) + + # initialize Array [internal_60] + lw $t0, 504($sp) # $t0 = internal_60 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 488($sp) # internal_64 = new Array[internal_60] + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 484($sp) # internal_65 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 480($sp) # internal_66 = address of allocated object Int + + foreach_start_8794484728583: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_65 + lw $t0, 496($sp) + sw $t0, 4($sp) # Storing internal_65 + + # Argument internal_60 + lw $t0, 516($sp) + sw $t0, 0($sp) # Storing internal_60 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 492($sp) # internal_66 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_66 then goto foreach_body_8794484728583 + lw $t0, 480($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_body_8794484728583 + + # Jumping to foreach_end_8794484728583 + j foreach_end_8794484728583 + + foreach_body_8794484728583: + + # array internal_64[4 * internal_65] = internal_62 + lw $t0, 484($sp) # $t0 = internal_65 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 488($sp) # $t1 = internal_64 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 496($sp) + sw $t0, 0($t1) + + # internal_62 = ancestor of internal_62 + lw $t0, 496($sp) + lw $t0, 4($t0) + sw $t0, 496($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_65 + lw $t0, 496($sp) + sw $t0, 4($sp) # Storing internal_65 + + # Argument internal_57 + lw $t0, 528($sp) + sw $t0, 0($sp) # Storing internal_57 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 496($sp) # internal_65 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_start_8794484728583 + j foreach_start_8794484728583 + + foreach_end_8794484728583: + + # initialize Array [internal_58] + lw $t0, 512($sp) # $t0 = internal_58 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 476($sp) # internal_67 = new Array[internal_58] + + # initialize Array [internal_58] + lw $t0, 512($sp) # $t0 = internal_58 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 472($sp) # internal_68 = new Array[internal_58] + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 464($sp) # internal_70 = address of allocated object Int + + # internal_69 = direction of Razz + la $t0, type_Razz + sw $t0, 468($sp) + + # array internal_67[4 * internal_70] = internal_69 + lw $t0, 464($sp) # $t0 = internal_70 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 476($sp) # $t1 = internal_67 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 468($sp) + sw $t0, 0($t1) + + # array internal_68[4 * internal_70] = internal_60 + lw $t0, 464($sp) # $t0 = internal_70 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 472($sp) # $t1 = internal_68 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 504($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 456($sp) # internal_72 = address of allocated object Int + + # internal_71 = direction of Foo + la $t0, type_Foo + sw $t0, 460($sp) + + # array internal_67[4 * internal_72] = internal_71 + lw $t0, 456($sp) # $t0 = internal_72 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 476($sp) # $t1 = internal_67 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 460($sp) + sw $t0, 0($t1) + + # array internal_68[4 * internal_72] = internal_60 + lw $t0, 456($sp) # $t0 = internal_72 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 472($sp) # $t1 = internal_68 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 504($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 448($sp) # internal_74 = address of allocated object Int + + # internal_73 = direction of Bar + la $t0, type_Bar + sw $t0, 452($sp) + + # array internal_67[4 * internal_74] = internal_73 + lw $t0, 448($sp) # $t0 = internal_74 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 476($sp) # $t1 = internal_67 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 452($sp) + sw $t0, 0($t1) + + # array internal_68[4 * internal_74] = internal_60 + lw $t0, 448($sp) # $t0 = internal_74 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 472($sp) # $t1 = internal_68 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 504($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 444($sp) # internal_75 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 440($sp) # internal_76 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 432($sp) # internal_78 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 428($sp) # internal_79 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 420($sp) # internal_81 = address of allocated object Int + + foreach_type_start_8794484728583: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_75 + lw $t0, 456($sp) + sw $t0, 4($sp) # Storing internal_75 + + # Argument internal_58 + lw $t0, 524($sp) + sw $t0, 0($sp) # Storing internal_58 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 452($sp) # internal_76 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_76 then goto foreach_type_body_8794484728583 + lw $t0, 440($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_type_body_8794484728583 + + # Jumping to foreach_type_end_8794484728583 + j foreach_type_end_8794484728583 + + foreach_type_body_8794484728583: + + # internal_77 = array internal_67[4 * internal_75] + lw $t0, 444($sp) # $t0 = internal_75 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 476($sp) # $t1 = internal_67 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + sw $t0, 436($sp) # internal_77 = array internal_67[4 * internal_75] + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_78 + lw $t0, 444($sp) + sw $t0, 4($sp) # Storing internal_78 + + # Argument internal_56 + lw $t0, 532($sp) + sw $t0, 0($sp) # Storing internal_56 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 444($sp) # internal_78 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + foreach_ancestor_start_8794484728583: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_78 + lw $t0, 444($sp) + sw $t0, 4($sp) # Storing internal_78 + + # Argument internal_60 + lw $t0, 516($sp) + sw $t0, 0($sp) # Storing internal_60 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 440($sp) # internal_79 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_79 then goto foreach_ancestor_body_8794484728583 + lw $t0, 428($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_body_8794484728583 + + # Jumping to foreach_ancestor_end_8794484728583 + j foreach_ancestor_end_8794484728583 + + foreach_ancestor_body_8794484728583: + + # internal_80 = array internal_64[4 * internal_78] + lw $t0, 432($sp) # $t0 = internal_78 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 488($sp) # $t1 = internal_64 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + sw $t0, 424($sp) # internal_80 = array internal_64[4 * internal_78] + + # internal_81 = EqualAddress(internal_77, internal_80) + lw $t0, 436($sp) + lw $t1, 424($sp) + seq $t2, $t0, $t1 + lw $t0, 420($sp) + sw $t2, 8($t0) + + # If internal_81 then goto foreach_ancestor_end_8794484728583 + lw $t0, 420($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_end_8794484728583 + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_78 + lw $t0, 444($sp) + sw $t0, 4($sp) # Storing internal_78 + + # Argument internal_57 + lw $t0, 528($sp) + sw $t0, 0($sp) # Storing internal_57 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 444($sp) # internal_78 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_ancestor_start_8794484728583 + j foreach_ancestor_start_8794484728583 + + foreach_ancestor_end_8794484728583: + + # array internal_68[4 * internal_75] = internal_78 + lw $t0, 444($sp) # $t0 = internal_75 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 472($sp) # $t1 = internal_68 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 432($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_75 + lw $t0, 456($sp) + sw $t0, 4($sp) # Storing internal_75 + + # Argument internal_57 + lw $t0, 528($sp) + sw $t0, 0($sp) # Storing internal_57 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 456($sp) # internal_75 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_type_start_8794484728583 + j foreach_type_start_8794484728583 + + foreach_type_end_8794484728583: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 416($sp) # internal_82 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 412($sp) # internal_83 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 408($sp) # internal_84 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 404($sp) # internal_85 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 400($sp) # internal_86 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_85 + lw $t0, 416($sp) + sw $t0, 4($sp) # Storing internal_85 + + # Argument internal_60 + lw $t0, 516($sp) + sw $t0, 0($sp) # Storing internal_60 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 416($sp) # internal_85 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + foreach_min_start_8794484728583: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_82 + lw $t0, 428($sp) + sw $t0, 4($sp) # Storing internal_82 + + # Argument internal_58 + lw $t0, 524($sp) + sw $t0, 0($sp) # Storing internal_58 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 412($sp) # internal_86 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_86 then goto foreach_min_body_8794484728583 + lw $t0, 400($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_min_body_8794484728583 + + # Jumping to foreach_min_end_8794484728583 + j foreach_min_end_8794484728583 + + foreach_min_body_8794484728583: + + # internal_84 = array internal_68[4 * internal_82] + lw $t0, 416($sp) # $t0 = internal_82 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 472($sp) # $t1 = internal_68 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 408($sp) # internal_84 = array internal_68[4 * internal_82] + sw $t0, 8($t2) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_84 + lw $t0, 420($sp) + sw $t0, 4($sp) # Storing internal_84 + + # Argument internal_85 + lw $t0, 416($sp) + sw $t0, 0($sp) # Storing internal_85 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 412($sp) # internal_86 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_86 then goto update_min_8794484728583 + lw $t0, 400($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, update_min_8794484728583 + + # Jumping to update_min_end_8794484728583 + j update_min_end_8794484728583 + + update_min_8794484728583: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_85 + lw $t0, 416($sp) + sw $t0, 4($sp) # Storing internal_85 + + # Argument internal_84 + lw $t0, 420($sp) + sw $t0, 0($sp) # Storing internal_84 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 416($sp) # internal_85 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_83 + lw $t0, 424($sp) + sw $t0, 4($sp) # Storing internal_83 + + # Argument internal_82 + lw $t0, 428($sp) + sw $t0, 0($sp) # Storing internal_82 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 424($sp) # internal_83 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + update_min_end_8794484728583: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_82 + lw $t0, 428($sp) + sw $t0, 4($sp) # Storing internal_82 + + # Argument internal_57 + lw $t0, 528($sp) + sw $t0, 0($sp) # Storing internal_57 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 428($sp) # internal_82 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_min_start_8794484728583 + j foreach_min_start_8794484728583 + + foreach_min_end_8794484728583: + + # initialize Array [internal_58] + lw $t0, 512($sp) # $t0 = internal_58 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 396($sp) # internal_87 = new Array[internal_58] + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 392($sp) # internal_88 = address of allocated object Int + + # array internal_87[4 * internal_88] = internal_56 + lw $t0, 392($sp) # $t0 = internal_88 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 396($sp) # $t1 = internal_87 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 520($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 388($sp) # internal_89 = address of allocated object Int + + # array internal_87[4 * internal_89] = internal_56 + lw $t0, 388($sp) # $t0 = internal_89 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 396($sp) # $t1 = internal_87 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 520($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 384($sp) # internal_90 = address of allocated object Int + + # array internal_87[4 * internal_90] = internal_56 + lw $t0, 384($sp) # $t0 = internal_90 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 396($sp) # $t1 = internal_87 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 520($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 380($sp) # internal_91 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_85 + lw $t0, 416($sp) + sw $t0, 4($sp) # Storing internal_85 + + # Argument internal_60 + lw $t0, 516($sp) + sw $t0, 0($sp) # Storing internal_60 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 392($sp) # internal_91 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_91 then goto error_branch_8794484728583 + lw $t0, 380($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, error_branch_8794484728583 + + # array internal_87[4 * internal_83] = internal_57 + lw $t0, 412($sp) # $t0 = internal_83 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 396($sp) # $t1 = internal_87 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 516($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 376($sp) # internal_92 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 372($sp) # internal_93 = address of allocated object Int + + # internal_92 = array internal_87[4 * internal_93] + lw $t0, 372($sp) # $t0 = internal_93 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 396($sp) # $t1 = internal_87 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 376($sp) # internal_92 = array internal_87[4 * internal_93] + sw $t0, 8($t2) + + # If internal_92 then goto branch_Razz_8794484728583 + lw $t0, 376($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Razz_8794484728583 + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 368($sp) # internal_94 = address of allocated object Int + + # internal_92 = array internal_87[4 * internal_94] + lw $t0, 368($sp) # $t0 = internal_94 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 396($sp) # $t1 = internal_87 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 376($sp) # internal_92 = array internal_87[4 * internal_94] + sw $t0, 8($t2) + + # If internal_92 then goto branch_Foo_8794484728583 + lw $t0, 376($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Foo_8794484728583 + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 364($sp) # internal_95 = address of allocated object Int + + # internal_92 = array internal_87[4 * internal_95] + lw $t0, 364($sp) # $t0 = internal_95 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 396($sp) # $t1 = internal_87 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 376($sp) # internal_92 = array internal_87[4 * internal_95] + sw $t0, 8($t2) + + # If internal_92 then goto branch_Bar_8794484728583 + lw $t0, 376($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Bar_8794484728583 + + branch_Razz_8794484728583: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument n + lw $t0, 572($sp) + sw $t0, 4($sp) # Storing n + + # Argument self + lw $t0, 760($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 572($sp) # n = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Bar + li $v0, 9 + lw $a0, type_Bar + syscall + la $t0, type_Bar # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 352($sp) # internal_98 = address of allocated object Bar + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_98 + lw $t0, 360($sp) + sw $t0, 0($sp) # Storing internal_98 + + # Calling function function___init___at_Bar + jal function___init___at_Bar + lw $ra, 4($sp) + sw $v1, 360($sp) # internal_98 = result of function___init___at_Bar + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_96 + lw $t0, 372($sp) + sw $t0, 4($sp) # Storing internal_96 + + # Argument internal_98 + lw $t0, 364($sp) + sw $t0, 0($sp) # Storing internal_98 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 372($sp) # internal_96 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_96 = internal_98 + lw $t0, 352($sp) + sw $t0, 360($sp) + + # Jumping to branch_end_8794484728583 + j branch_end_8794484728583 + + branch_Foo_8794484728583: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument n + lw $t0, 572($sp) + sw $t0, 4($sp) # Storing n + + # Argument self + lw $t0, 760($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 572($sp) # n = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Razz + li $v0, 9 + lw $a0, type_Razz + syscall + la $t0, type_Razz # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 344($sp) # internal_100 = address of allocated object Razz + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_100 + lw $t0, 352($sp) + sw $t0, 0($sp) # Storing internal_100 + + # Calling function function___init___at_Razz + jal function___init___at_Razz + lw $ra, 4($sp) + sw $v1, 352($sp) # internal_100 = result of function___init___at_Razz + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_96 + lw $t0, 372($sp) + sw $t0, 4($sp) # Storing internal_96 + + # Argument internal_100 + lw $t0, 356($sp) + sw $t0, 0($sp) # Storing internal_100 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 372($sp) # internal_96 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_96 = internal_100 + lw $t0, 344($sp) + sw $t0, 360($sp) + + # Jumping to branch_end_8794484728583 + j branch_end_8794484728583 + + branch_Bar_8794484728583: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument n + lw $t0, 572($sp) + sw $t0, 4($sp) # Storing n + + # Argument self + lw $t0, 760($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 572($sp) # n = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_96 + lw $t0, 372($sp) + sw $t0, 4($sp) # Storing internal_96 + + # Argument n + lw $t0, 572($sp) + sw $t0, 0($sp) # Storing n + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 372($sp) # internal_96 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_96 = n + lw $t0, 560($sp) + sw $t0, 360($sp) + + # Jumping to branch_end_8794484728583 + j branch_end_8794484728583 + + error_branch_8794484728583: + + branch_end_8794484728583: + + # Set attribute a of self + lw $t0, 748($sp) # $t0 = self + lw $t1, 360($sp) # $t1 = internal_96 + beq $t1, $zero, object_set_attribute_8794484641952 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8794484641952 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8794484641952 + j object_set_attribute_8794484641952 + int_set_attribute_8794484641952: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($t0) # self.a = internal_96 + j end_set_attribute_8794484641952 + bool_set_attribute_8794484641952: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($t0) # self.a = internal_96 + j end_set_attribute_8794484641952 + object_set_attribute_8794484641952: + sw $t1, 20($t0) # self.a = internal_96 + end_set_attribute_8794484641952: + + # Get attribute a of self + lw $t0, 748($sp) # Get the address of self + lw $t1, 20($t0) # Get the attribute 'a' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8794484645705 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8794484645705 + j object_get_attribute_8794484645705 + int_get_attribute_8794484645705: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 336($sp) # internal_102 = self.a + j end_get_attribute_8794484645705 + bool_get_attribute_8794484645705: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 336($sp) # internal_102 = self.a + j end_get_attribute_8794484645705 + object_get_attribute_8794484645705: + sw $t1, 336($sp) # internal_102 = self.a + end_get_attribute_8794484645705: + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 328($sp) # internal_104 = address of allocated object Int + + # Get method doh of Razz + lw $t0, 336($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 328($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 324($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_102 + lw $t0, 344($sp) + sw $t0, 0($sp) # Storing internal_102 + + # Calling function internal_105 + lw $t0, 332($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 340($sp) # internal_103 = result of internal_105 + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute g of self + lw $t0, 748($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'g' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8794484645759 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8794484645759 + j object_get_attribute_8794484645759 + int_get_attribute_8794484645759: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 320($sp) # internal_106 = self.g + j end_get_attribute_8794484645759 + bool_get_attribute_8794484645759: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 320($sp) # internal_106 = self.g + j end_get_attribute_8794484645759 + object_get_attribute_8794484645759: + sw $t1, 320($sp) # internal_106 = self.g + end_get_attribute_8794484645759: + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 312($sp) # internal_108 = address of allocated object Int + + # Get method doh of Foo + lw $t0, 320($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 312($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 308($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_106 + lw $t0, 328($sp) + sw $t0, 0($sp) # Storing internal_106 + + # Calling function internal_109 + lw $t0, 316($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 324($sp) # internal_107 = result of internal_109 + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_103 + lw $t0, 344($sp) + sw $t0, 4($sp) # Storing internal_103 + + # Argument internal_107 + lw $t0, 328($sp) + sw $t0, 0($sp) # Storing internal_107 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 316($sp) # internal_110 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 296($sp) # internal_112 = address of allocated object Int + + # Get method doh of Bar + lw $t0, 748($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 296($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 292($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 756($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_113 + lw $t0, 300($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 308($sp) # internal_111 = result of internal_113 + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_110 + lw $t0, 316($sp) + sw $t0, 4($sp) # Storing internal_110 + + # Argument internal_111 + lw $t0, 312($sp) + sw $t0, 0($sp) # Storing internal_111 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 300($sp) # internal_114 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 280($sp) # internal_116 = address of allocated object Int + + # Get method printh of Bar + lw $t0, 748($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 280($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 276($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 756($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_117 + lw $t0, 284($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 292($sp) # internal_115 = result of internal_117 + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_114 + lw $t0, 300($sp) + sw $t0, 4($sp) # Storing internal_114 + + # Argument internal_115 + lw $t0, 296($sp) + sw $t0, 0($sp) # Storing internal_115 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 284($sp) # internal_118 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Set attribute b of self + lw $t0, 748($sp) # $t0 = self + lw $t1, 272($sp) # $t1 = internal_118 + beq $t1, $zero, object_set_attribute_8794484645645 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8794484645645 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8794484645645 + j object_set_attribute_8794484645645 + int_set_attribute_8794484645645: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 24($t0) # self.b = internal_118 + j end_set_attribute_8794484645645 + bool_set_attribute_8794484645645: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 24($t0) # self.b = internal_118 + j end_set_attribute_8794484645645 + object_set_attribute_8794484645645: + sw $t1, 24($t0) # self.b = internal_118 + end_set_attribute_8794484645645: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 268($sp) # internal_119 = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 264($sp) # internal_120 = address of allocated object Int + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 260($sp) # internal_121 = address of allocated object Int + + # Allocating NUll to internal_122 + sw $zero, 256($sp) # internal_122 = 0 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 252($sp) # internal_123 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 240($sp) # internal_126 = address of allocated object Int + + # internal_124 = typeof self that is the first word of the object + lw $t0, 748($sp) + lw $t0, 0($t0) + sw $t0, 248($sp) + + # internal_125 = internal_124 + lw $t0, 248($sp) + sw $t0, 244($sp) + + while_start_8794484734308: + + # internal_126 = EqualAddress(internal_125, internal_122) + lw $t0, 244($sp) + lw $t1, 256($sp) + seq $t2, $t0, $t1 + lw $t0, 240($sp) + sw $t2, 8($t0) + + # If internal_126 then goto while_end_8794484734308 + lw $t0, 240($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_end_8794484734308 + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_123 + lw $t0, 264($sp) + sw $t0, 4($sp) # Storing internal_123 + + # Argument internal_120 + lw $t0, 276($sp) + sw $t0, 0($sp) # Storing internal_120 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 264($sp) # internal_123 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_125 = ancestor of internal_125 + lw $t0, 244($sp) + lw $t0, 4($t0) + sw $t0, 244($sp) + + # Jumping to while_start_8794484734308 + j while_start_8794484734308 + + while_end_8794484734308: + + # internal_125 = internal_124 + lw $t0, 248($sp) + sw $t0, 244($sp) + + # initialize Array [internal_123] + lw $t0, 252($sp) # $t0 = internal_123 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 236($sp) # internal_127 = new Array[internal_123] + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 232($sp) # internal_128 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 228($sp) # internal_129 = address of allocated object Int + + foreach_start_8794484734308: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_128 + lw $t0, 244($sp) + sw $t0, 4($sp) # Storing internal_128 + + # Argument internal_123 + lw $t0, 264($sp) + sw $t0, 0($sp) # Storing internal_123 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 240($sp) # internal_129 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_129 then goto foreach_body_8794484734308 + lw $t0, 228($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_body_8794484734308 + + # Jumping to foreach_end_8794484734308 + j foreach_end_8794484734308 + + foreach_body_8794484734308: + + # array internal_127[4 * internal_128] = internal_125 + lw $t0, 232($sp) # $t0 = internal_128 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 236($sp) # $t1 = internal_127 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 244($sp) + sw $t0, 0($t1) + + # internal_125 = ancestor of internal_125 + lw $t0, 244($sp) + lw $t0, 4($t0) + sw $t0, 244($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_128 + lw $t0, 244($sp) + sw $t0, 4($sp) # Storing internal_128 + + # Argument internal_120 + lw $t0, 276($sp) + sw $t0, 0($sp) # Storing internal_120 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 244($sp) # internal_128 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_start_8794484734308 + j foreach_start_8794484734308 + + foreach_end_8794484734308: + + # initialize Array [internal_121] + lw $t0, 260($sp) # $t0 = internal_121 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 224($sp) # internal_130 = new Array[internal_121] + + # initialize Array [internal_121] + lw $t0, 260($sp) # $t0 = internal_121 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 220($sp) # internal_131 = new Array[internal_121] + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 212($sp) # internal_133 = address of allocated object Int + + # internal_132 = direction of Razz + la $t0, type_Razz + sw $t0, 216($sp) + + # array internal_130[4 * internal_133] = internal_132 + lw $t0, 212($sp) # $t0 = internal_133 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 224($sp) # $t1 = internal_130 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 216($sp) + sw $t0, 0($t1) + + # array internal_131[4 * internal_133] = internal_123 + lw $t0, 212($sp) # $t0 = internal_133 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 220($sp) # $t1 = internal_131 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 252($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 204($sp) # internal_135 = address of allocated object Int + + # internal_134 = direction of Bar + la $t0, type_Bar + sw $t0, 208($sp) + + # array internal_130[4 * internal_135] = internal_134 + lw $t0, 204($sp) # $t0 = internal_135 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 224($sp) # $t1 = internal_130 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 208($sp) + sw $t0, 0($t1) + + # array internal_131[4 * internal_135] = internal_123 + lw $t0, 204($sp) # $t0 = internal_135 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 220($sp) # $t1 = internal_131 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 252($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 200($sp) # internal_136 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 196($sp) # internal_137 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 188($sp) # internal_139 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 184($sp) # internal_140 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 176($sp) # internal_142 = address of allocated object Int + + foreach_type_start_8794484734308: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_136 + lw $t0, 212($sp) + sw $t0, 4($sp) # Storing internal_136 + + # Argument internal_121 + lw $t0, 272($sp) + sw $t0, 0($sp) # Storing internal_121 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 208($sp) # internal_137 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_137 then goto foreach_type_body_8794484734308 + lw $t0, 196($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_type_body_8794484734308 + + # Jumping to foreach_type_end_8794484734308 + j foreach_type_end_8794484734308 + + foreach_type_body_8794484734308: + + # internal_138 = array internal_130[4 * internal_136] + lw $t0, 200($sp) # $t0 = internal_136 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 224($sp) # $t1 = internal_130 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + sw $t0, 192($sp) # internal_138 = array internal_130[4 * internal_136] + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_139 + lw $t0, 200($sp) + sw $t0, 4($sp) # Storing internal_139 + + # Argument internal_119 + lw $t0, 280($sp) + sw $t0, 0($sp) # Storing internal_119 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 200($sp) # internal_139 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + foreach_ancestor_start_8794484734308: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_139 + lw $t0, 200($sp) + sw $t0, 4($sp) # Storing internal_139 + + # Argument internal_123 + lw $t0, 264($sp) + sw $t0, 0($sp) # Storing internal_123 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 196($sp) # internal_140 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_140 then goto foreach_ancestor_body_8794484734308 + lw $t0, 184($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_body_8794484734308 + + # Jumping to foreach_ancestor_end_8794484734308 + j foreach_ancestor_end_8794484734308 + + foreach_ancestor_body_8794484734308: + + # internal_141 = array internal_127[4 * internal_139] + lw $t0, 188($sp) # $t0 = internal_139 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 236($sp) # $t1 = internal_127 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + sw $t0, 180($sp) # internal_141 = array internal_127[4 * internal_139] + + # internal_142 = EqualAddress(internal_138, internal_141) + lw $t0, 192($sp) + lw $t1, 180($sp) + seq $t2, $t0, $t1 + lw $t0, 176($sp) + sw $t2, 8($t0) + + # If internal_142 then goto foreach_ancestor_end_8794484734308 + lw $t0, 176($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_end_8794484734308 + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_139 + lw $t0, 200($sp) + sw $t0, 4($sp) # Storing internal_139 + + # Argument internal_120 + lw $t0, 276($sp) + sw $t0, 0($sp) # Storing internal_120 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 200($sp) # internal_139 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_ancestor_start_8794484734308 + j foreach_ancestor_start_8794484734308 + + foreach_ancestor_end_8794484734308: + + # array internal_131[4 * internal_136] = internal_139 + lw $t0, 200($sp) # $t0 = internal_136 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 220($sp) # $t1 = internal_131 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 188($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_136 + lw $t0, 212($sp) + sw $t0, 4($sp) # Storing internal_136 + + # Argument internal_120 + lw $t0, 276($sp) + sw $t0, 0($sp) # Storing internal_120 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 212($sp) # internal_136 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_type_start_8794484734308 + j foreach_type_start_8794484734308 + + foreach_type_end_8794484734308: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 172($sp) # internal_143 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 168($sp) # internal_144 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 164($sp) # internal_145 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 160($sp) # internal_146 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 156($sp) # internal_147 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_146 + lw $t0, 172($sp) + sw $t0, 4($sp) # Storing internal_146 + + # Argument internal_123 + lw $t0, 264($sp) + sw $t0, 0($sp) # Storing internal_123 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 172($sp) # internal_146 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + foreach_min_start_8794484734308: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_143 + lw $t0, 184($sp) + sw $t0, 4($sp) # Storing internal_143 + + # Argument internal_121 + lw $t0, 272($sp) + sw $t0, 0($sp) # Storing internal_121 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 168($sp) # internal_147 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_147 then goto foreach_min_body_8794484734308 + lw $t0, 156($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_min_body_8794484734308 + + # Jumping to foreach_min_end_8794484734308 + j foreach_min_end_8794484734308 + + foreach_min_body_8794484734308: + + # internal_145 = array internal_131[4 * internal_143] + lw $t0, 172($sp) # $t0 = internal_143 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 220($sp) # $t1 = internal_131 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 164($sp) # internal_145 = array internal_131[4 * internal_143] + sw $t0, 8($t2) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_145 + lw $t0, 176($sp) + sw $t0, 4($sp) # Storing internal_145 + + # Argument internal_146 + lw $t0, 172($sp) + sw $t0, 0($sp) # Storing internal_146 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 168($sp) # internal_147 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_147 then goto update_min_8794484734308 + lw $t0, 156($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, update_min_8794484734308 + + # Jumping to update_min_end_8794484734308 + j update_min_end_8794484734308 + + update_min_8794484734308: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_146 + lw $t0, 172($sp) + sw $t0, 4($sp) # Storing internal_146 + + # Argument internal_145 + lw $t0, 176($sp) + sw $t0, 0($sp) # Storing internal_145 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 172($sp) # internal_146 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_144 + lw $t0, 180($sp) + sw $t0, 4($sp) # Storing internal_144 + + # Argument internal_143 + lw $t0, 184($sp) + sw $t0, 0($sp) # Storing internal_143 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 180($sp) # internal_144 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + update_min_end_8794484734308: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_143 + lw $t0, 184($sp) + sw $t0, 4($sp) # Storing internal_143 + + # Argument internal_120 + lw $t0, 276($sp) + sw $t0, 0($sp) # Storing internal_120 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 184($sp) # internal_143 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_min_start_8794484734308 + j foreach_min_start_8794484734308 + + foreach_min_end_8794484734308: + + # initialize Array [internal_121] + lw $t0, 260($sp) # $t0 = internal_121 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 152($sp) # internal_148 = new Array[internal_121] + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 148($sp) # internal_149 = address of allocated object Int + + # array internal_148[4 * internal_149] = internal_119 + lw $t0, 148($sp) # $t0 = internal_149 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 152($sp) # $t1 = internal_148 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 268($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 144($sp) # internal_150 = address of allocated object Int + + # array internal_148[4 * internal_150] = internal_119 + lw $t0, 144($sp) # $t0 = internal_150 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 152($sp) # $t1 = internal_148 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 268($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 140($sp) # internal_151 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_146 + lw $t0, 172($sp) + sw $t0, 4($sp) # Storing internal_146 + + # Argument internal_123 + lw $t0, 264($sp) + sw $t0, 0($sp) # Storing internal_123 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 152($sp) # internal_151 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_151 then goto error_branch_8794484734308 + lw $t0, 140($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, error_branch_8794484734308 + + # array internal_148[4 * internal_144] = internal_120 + lw $t0, 168($sp) # $t0 = internal_144 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 152($sp) # $t1 = internal_148 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 264($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 136($sp) # internal_152 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 132($sp) # internal_153 = address of allocated object Int + + # internal_152 = array internal_148[4 * internal_153] + lw $t0, 132($sp) # $t0 = internal_153 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 152($sp) # $t1 = internal_148 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 136($sp) # internal_152 = array internal_148[4 * internal_153] + sw $t0, 8($t2) + + # If internal_152 then goto branch_Razz_8794484734308 + lw $t0, 136($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Razz_8794484734308 + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 128($sp) # internal_154 = address of allocated object Int + + # internal_152 = array internal_148[4 * internal_154] + lw $t0, 128($sp) # $t0 = internal_154 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 152($sp) # $t1 = internal_148 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 136($sp) # internal_152 = array internal_148[4 * internal_154] + sw $t0, 8($t2) + + # If internal_152 then goto branch_Bar_8794484734308 + lw $t0, 136($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Bar_8794484734308 + + branch_Razz_8794484734308: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument n + lw $t0, 572($sp) + sw $t0, 4($sp) # Storing n + + # Argument self + lw $t0, 760($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 572($sp) # n = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Bar + li $v0, 9 + lw $a0, type_Bar + syscall + la $t0, type_Bar # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 116($sp) # internal_157 = address of allocated object Bar + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_157 + lw $t0, 124($sp) + sw $t0, 0($sp) # Storing internal_157 + + # Calling function function___init___at_Bar + jal function___init___at_Bar + lw $ra, 4($sp) + sw $v1, 124($sp) # internal_157 = result of function___init___at_Bar + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_155 + lw $t0, 136($sp) + sw $t0, 4($sp) # Storing internal_155 + + # Argument internal_157 + lw $t0, 128($sp) + sw $t0, 0($sp) # Storing internal_157 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 136($sp) # internal_155 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_155 = internal_157 + lw $t0, 116($sp) + sw $t0, 124($sp) + + # Jumping to branch_end_8794484734308 + j branch_end_8794484734308 + + branch_Bar_8794484734308: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument n + lw $t0, 572($sp) + sw $t0, 4($sp) # Storing n + + # Argument self + lw $t0, 760($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 572($sp) # n = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_155 + lw $t0, 136($sp) + sw $t0, 4($sp) # Storing internal_155 + + # Argument n + lw $t0, 572($sp) + sw $t0, 0($sp) # Storing n + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 136($sp) # internal_155 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_155 = n + lw $t0, 560($sp) + sw $t0, 124($sp) + + # Jumping to branch_end_8794484734308 + j branch_end_8794484734308 + + error_branch_8794484734308: + + branch_end_8794484734308: + + # Set attribute e of self + lw $t0, 748($sp) # $t0 = self + lw $t1, 124($sp) # $t1 = internal_155 + beq $t1, $zero, object_set_attribute_8794484646446 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8794484646446 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8794484646446 + j object_set_attribute_8794484646446 + int_set_attribute_8794484646446: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 28($t0) # self.e = internal_155 + j end_set_attribute_8794484646446 + bool_set_attribute_8794484646446: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 28($t0) # self.e = internal_155 + j end_set_attribute_8794484646446 + object_set_attribute_8794484646446: + sw $t1, 28($t0) # self.e = internal_155 + end_set_attribute_8794484646446: + + # Get attribute a of self + lw $t0, 748($sp) # Get the address of self + lw $t1, 20($t0) # Get the attribute 'a' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8794484649521 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8794484649521 + j object_get_attribute_8794484649521 + int_get_attribute_8794484649521: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 108($sp) # internal_159 = self.a + j end_get_attribute_8794484649521 + bool_get_attribute_8794484649521: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 108($sp) # internal_159 = self.a + j end_get_attribute_8794484649521 + object_get_attribute_8794484649521: + sw $t1, 108($sp) # internal_159 = self.a + end_get_attribute_8794484649521: + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 100($sp) # internal_161 = address of allocated object Int + + # Get method doh of Bazz + lw $t0, 108($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 100($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 96($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_159 + lw $t0, 116($sp) + sw $t0, 0($sp) # Storing internal_159 + + # Calling function function_doh_at_Bazz + jal function_doh_at_Bazz + lw $ra, 4($sp) + sw $v1, 112($sp) # internal_160 = result of function_doh_at_Bazz + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute g of self + lw $t0, 748($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'g' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8794484649575 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8794484649575 + j object_get_attribute_8794484649575 + int_get_attribute_8794484649575: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 92($sp) # internal_163 = self.g + j end_get_attribute_8794484649575 + bool_get_attribute_8794484649575: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 92($sp) # internal_163 = self.g + j end_get_attribute_8794484649575 + object_get_attribute_8794484649575: + sw $t1, 92($sp) # internal_163 = self.g + end_get_attribute_8794484649575: + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 84($sp) # internal_165 = address of allocated object Int + + # Get method doh of Foo + lw $t0, 92($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 84($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 80($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_163 + lw $t0, 100($sp) + sw $t0, 0($sp) # Storing internal_163 + + # Calling function internal_166 + lw $t0, 88($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 96($sp) # internal_164 = result of internal_166 + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_160 + lw $t0, 116($sp) + sw $t0, 4($sp) # Storing internal_160 + + # Argument internal_164 + lw $t0, 100($sp) + sw $t0, 0($sp) # Storing internal_164 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 88($sp) # internal_167 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute e of self + lw $t0, 748($sp) # Get the address of self + lw $t1, 28($t0) # Get the attribute 'e' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8794484649644 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8794484649644 + j object_get_attribute_8794484649644 + int_get_attribute_8794484649644: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 72($sp) # internal_168 = self.e + j end_get_attribute_8794484649644 + bool_get_attribute_8794484649644: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 72($sp) # internal_168 = self.e + j end_get_attribute_8794484649644 + object_get_attribute_8794484649644: + sw $t1, 72($sp) # internal_168 = self.e + end_get_attribute_8794484649644: + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 64($sp) # internal_170 = address of allocated object Int + + # Get method doh of Bar + lw $t0, 72($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 64($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 60($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_168 + lw $t0, 80($sp) + sw $t0, 0($sp) # Storing internal_168 + + # Calling function internal_171 + lw $t0, 68($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 76($sp) # internal_169 = result of internal_171 + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_167 + lw $t0, 88($sp) + sw $t0, 4($sp) # Storing internal_167 + + # Argument internal_169 + lw $t0, 80($sp) + sw $t0, 0($sp) # Storing internal_169 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 68($sp) # internal_172 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 48($sp) # internal_174 = address of allocated object Int + + # Get method doh of Bar + lw $t0, 748($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 48($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 44($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 756($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_175 + lw $t0, 52($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 60($sp) # internal_173 = result of internal_175 + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_172 + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing internal_172 + + # Argument internal_173 + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing internal_173 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 52($sp) # internal_176 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_178 = address of allocated object Int + + # Get method printh of Bar + lw $t0, 748($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 32($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 28($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 756($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_179 + lw $t0, 36($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 44($sp) # internal_177 = result of internal_179 + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_176 + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing internal_176 + + # Argument internal_177 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_177 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_180 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Set attribute f of self + lw $t0, 748($sp) # $t0 = self + lw $t1, 24($sp) # $t1 = internal_180 + beq $t1, $zero, object_set_attribute_8794484649189 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8794484649189 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8794484649189 + j object_set_attribute_8794484649189 + int_set_attribute_8794484649189: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 32($t0) # self.f = internal_180 + j end_set_attribute_8794484649189 + bool_set_attribute_8794484649189: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 32($t0) # self.f = internal_180 + j end_set_attribute_8794484649189 + object_set_attribute_8794484649189: + sw $t1, 32($t0) # self.f = internal_180 + end_set_attribute_8794484649189: + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_182 = address of allocated object Int + + # Get method doh of Bar + lw $t0, 748($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 16($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 12($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 756($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_183 + lw $t0, 20($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 28($sp) # internal_181 = result of internal_183 + addi $sp, $sp, 8 # Freeing space for arguments + + # Set attribute c of self + lw $t0, 748($sp) # $t0 = self + lw $t1, 20($sp) # $t1 = internal_181 + beq $t1, $zero, object_set_attribute_8794484650075 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8794484650075 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8794484650075 + j object_set_attribute_8794484650075 + int_set_attribute_8794484650075: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 36($t0) # self.c = internal_181 + j end_set_attribute_8794484650075 + bool_set_attribute_8794484650075: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 36($t0) # self.c = internal_181 + j end_set_attribute_8794484650075 + object_set_attribute_8794484650075: + sw $t1, 36($t0) # self.c = internal_181 + end_set_attribute_8794484650075: + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_185 = address of allocated object Int + + # Get method printh of Bar + lw $t0, 748($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 756($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_186 + lw $t0, 8($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_184 = result of internal_186 + addi $sp, $sp, 8 # Freeing space for arguments + + # Set attribute d of self + lw $t0, 748($sp) # $t0 = self + lw $t1, 8($sp) # $t1 = internal_184 + beq $t1, $zero, object_set_attribute_8794484650120 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8794484650120 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8794484650120 + j object_set_attribute_8794484650120 + int_set_attribute_8794484650120: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 40($t0) # self.d = internal_184 + j end_set_attribute_8794484650120 + bool_set_attribute_8794484650120: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 40($t0) # self.d = internal_184 + j end_set_attribute_8794484650120 + object_set_attribute_8794484650120: + sw $t1, 40($t0) # self.d = internal_184 + end_set_attribute_8794484650120: + + # Loading return value in $v1 + lw $v1, 748($sp) + + # Freeing space for local variables + addi $sp, $sp, 748 + + jr $ra + + function___init___at_Razz: + # Function parameters + # $ra = 728($sp) + # self = 724($sp) + + # Reserving space for local variables + addi $sp, $sp, -724 + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 720($sp) # internal_0 = address of allocated object Int + + # Set attribute h of self + lw $t0, 724($sp) # $t0 = self + lw $t1, 720($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8794484650198 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8794484650198 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8794484650198 + j object_set_attribute_8794484650198 + int_set_attribute_8794484650198: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.h = internal_0 + j end_set_attribute_8794484650198 + bool_set_attribute_8794484650198: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.h = internal_0 + j end_set_attribute_8794484650198 + object_set_attribute_8794484650198: + sw $t1, 8($t0) # self.h = internal_0 + end_set_attribute_8794484650198: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 716($sp) # internal_1 = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 712($sp) # internal_2 = address of allocated object Int + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 708($sp) # internal_3 = address of allocated object Int + + # Allocating NUll to internal_4 + sw $zero, 704($sp) # internal_4 = 0 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 700($sp) # internal_5 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 688($sp) # internal_8 = address of allocated object Int + + # internal_6 = typeof self that is the first word of the object + lw $t0, 724($sp) + lw $t0, 0($t0) + sw $t0, 696($sp) + + # internal_7 = internal_6 + lw $t0, 696($sp) + sw $t0, 692($sp) + + while_start_8794484717692: + + # internal_8 = EqualAddress(internal_7, internal_4) + lw $t0, 692($sp) + lw $t1, 704($sp) + seq $t2, $t0, $t1 + lw $t0, 688($sp) + sw $t2, 8($t0) + + # If internal_8 then goto while_end_8794484717692 + lw $t0, 688($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_end_8794484717692 + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_5 + lw $t0, 712($sp) + sw $t0, 4($sp) # Storing internal_5 + + # Argument internal_2 + lw $t0, 724($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 712($sp) # internal_5 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_7 = ancestor of internal_7 + lw $t0, 692($sp) + lw $t0, 4($t0) + sw $t0, 692($sp) + + # Jumping to while_start_8794484717692 + j while_start_8794484717692 + + while_end_8794484717692: + + # internal_7 = internal_6 + lw $t0, 696($sp) + sw $t0, 692($sp) + + # initialize Array [internal_5] + lw $t0, 700($sp) # $t0 = internal_5 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 684($sp) # internal_9 = new Array[internal_5] + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 680($sp) # internal_10 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 676($sp) # internal_11 = address of allocated object Int + + foreach_start_8794484717692: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_10 + lw $t0, 692($sp) + sw $t0, 4($sp) # Storing internal_10 + + # Argument internal_5 + lw $t0, 712($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 688($sp) # internal_11 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_11 then goto foreach_body_8794484717692 + lw $t0, 676($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_body_8794484717692 + + # Jumping to foreach_end_8794484717692 + j foreach_end_8794484717692 + + foreach_body_8794484717692: + + # array internal_9[4 * internal_10] = internal_7 + lw $t0, 680($sp) # $t0 = internal_10 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 684($sp) # $t1 = internal_9 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 692($sp) + sw $t0, 0($t1) + + # internal_7 = ancestor of internal_7 + lw $t0, 692($sp) + lw $t0, 4($t0) + sw $t0, 692($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_10 + lw $t0, 692($sp) + sw $t0, 4($sp) # Storing internal_10 + + # Argument internal_2 + lw $t0, 724($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 692($sp) # internal_10 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_start_8794484717692 + j foreach_start_8794484717692 + + foreach_end_8794484717692: + + # initialize Array [internal_3] + lw $t0, 708($sp) # $t0 = internal_3 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 672($sp) # internal_12 = new Array[internal_3] + + # initialize Array [internal_3] + lw $t0, 708($sp) # $t0 = internal_3 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 668($sp) # internal_13 = new Array[internal_3] + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 660($sp) # internal_15 = address of allocated object Int + + # internal_14 = direction of Bazz + la $t0, type_Bazz + sw $t0, 664($sp) + + # array internal_12[4 * internal_15] = internal_14 + lw $t0, 660($sp) # $t0 = internal_15 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 672($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 664($sp) + sw $t0, 0($t1) + + # array internal_13[4 * internal_15] = internal_5 + lw $t0, 660($sp) # $t0 = internal_15 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 668($sp) # $t1 = internal_13 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 700($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 652($sp) # internal_17 = address of allocated object Int + + # internal_16 = direction of Razz + la $t0, type_Razz + sw $t0, 656($sp) + + # array internal_12[4 * internal_17] = internal_16 + lw $t0, 652($sp) # $t0 = internal_17 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 672($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 656($sp) + sw $t0, 0($t1) + + # array internal_13[4 * internal_17] = internal_5 + lw $t0, 652($sp) # $t0 = internal_17 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 668($sp) # $t1 = internal_13 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 700($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 644($sp) # internal_19 = address of allocated object Int + + # internal_18 = direction of Foo + la $t0, type_Foo + sw $t0, 648($sp) + + # array internal_12[4 * internal_19] = internal_18 + lw $t0, 644($sp) # $t0 = internal_19 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 672($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 648($sp) + sw $t0, 0($t1) + + # array internal_13[4 * internal_19] = internal_5 + lw $t0, 644($sp) # $t0 = internal_19 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 668($sp) # $t1 = internal_13 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 700($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 636($sp) # internal_21 = address of allocated object Int + + # internal_20 = direction of Bar + la $t0, type_Bar + sw $t0, 640($sp) + + # array internal_12[4 * internal_21] = internal_20 + lw $t0, 636($sp) # $t0 = internal_21 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 672($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 640($sp) + sw $t0, 0($t1) + + # array internal_13[4 * internal_21] = internal_5 + lw $t0, 636($sp) # $t0 = internal_21 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 668($sp) # $t1 = internal_13 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 700($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 632($sp) # internal_22 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 628($sp) # internal_23 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 620($sp) # internal_25 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 616($sp) # internal_26 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 608($sp) # internal_28 = address of allocated object Int + + foreach_type_start_8794484717692: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_22 + lw $t0, 644($sp) + sw $t0, 4($sp) # Storing internal_22 + + # Argument internal_3 + lw $t0, 720($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 640($sp) # internal_23 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_23 then goto foreach_type_body_8794484717692 + lw $t0, 628($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_type_body_8794484717692 + + # Jumping to foreach_type_end_8794484717692 + j foreach_type_end_8794484717692 + + foreach_type_body_8794484717692: + + # internal_24 = array internal_12[4 * internal_22] + lw $t0, 632($sp) # $t0 = internal_22 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 672($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + sw $t0, 624($sp) # internal_24 = array internal_12[4 * internal_22] + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_25 + lw $t0, 632($sp) + sw $t0, 4($sp) # Storing internal_25 + + # Argument internal_1 + lw $t0, 728($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 632($sp) # internal_25 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + foreach_ancestor_start_8794484717692: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_25 + lw $t0, 632($sp) + sw $t0, 4($sp) # Storing internal_25 + + # Argument internal_5 + lw $t0, 712($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 628($sp) # internal_26 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_26 then goto foreach_ancestor_body_8794484717692 + lw $t0, 616($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_body_8794484717692 + + # Jumping to foreach_ancestor_end_8794484717692 + j foreach_ancestor_end_8794484717692 + + foreach_ancestor_body_8794484717692: + + # internal_27 = array internal_9[4 * internal_25] + lw $t0, 620($sp) # $t0 = internal_25 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 684($sp) # $t1 = internal_9 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + sw $t0, 612($sp) # internal_27 = array internal_9[4 * internal_25] + + # internal_28 = EqualAddress(internal_24, internal_27) + lw $t0, 624($sp) + lw $t1, 612($sp) + seq $t2, $t0, $t1 + lw $t0, 608($sp) + sw $t2, 8($t0) + + # If internal_28 then goto foreach_ancestor_end_8794484717692 + lw $t0, 608($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_end_8794484717692 + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_25 + lw $t0, 632($sp) + sw $t0, 4($sp) # Storing internal_25 + + # Argument internal_2 + lw $t0, 724($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 632($sp) # internal_25 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_ancestor_start_8794484717692 + j foreach_ancestor_start_8794484717692 + + foreach_ancestor_end_8794484717692: + + # array internal_13[4 * internal_22] = internal_25 + lw $t0, 632($sp) # $t0 = internal_22 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 668($sp) # $t1 = internal_13 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 620($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_22 + lw $t0, 644($sp) + sw $t0, 4($sp) # Storing internal_22 + + # Argument internal_2 + lw $t0, 724($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 644($sp) # internal_22 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_type_start_8794484717692 + j foreach_type_start_8794484717692 + + foreach_type_end_8794484717692: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 604($sp) # internal_29 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 600($sp) # internal_30 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 596($sp) # internal_31 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 592($sp) # internal_32 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 588($sp) # internal_33 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_32 + lw $t0, 604($sp) + sw $t0, 4($sp) # Storing internal_32 + + # Argument internal_5 + lw $t0, 712($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 604($sp) # internal_32 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + foreach_min_start_8794484717692: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_29 + lw $t0, 616($sp) + sw $t0, 4($sp) # Storing internal_29 + + # Argument internal_3 + lw $t0, 720($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 600($sp) # internal_33 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_33 then goto foreach_min_body_8794484717692 + lw $t0, 588($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_min_body_8794484717692 + + # Jumping to foreach_min_end_8794484717692 + j foreach_min_end_8794484717692 + + foreach_min_body_8794484717692: + + # internal_31 = array internal_13[4 * internal_29] + lw $t0, 604($sp) # $t0 = internal_29 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 668($sp) # $t1 = internal_13 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 596($sp) # internal_31 = array internal_13[4 * internal_29] + sw $t0, 8($t2) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_31 + lw $t0, 608($sp) + sw $t0, 4($sp) # Storing internal_31 + + # Argument internal_32 + lw $t0, 604($sp) + sw $t0, 0($sp) # Storing internal_32 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 600($sp) # internal_33 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_33 then goto update_min_8794484717692 + lw $t0, 588($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, update_min_8794484717692 + + # Jumping to update_min_end_8794484717692 + j update_min_end_8794484717692 + + update_min_8794484717692: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_32 + lw $t0, 604($sp) + sw $t0, 4($sp) # Storing internal_32 + + # Argument internal_31 + lw $t0, 608($sp) + sw $t0, 0($sp) # Storing internal_31 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 604($sp) # internal_32 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_30 + lw $t0, 612($sp) + sw $t0, 4($sp) # Storing internal_30 + + # Argument internal_29 + lw $t0, 616($sp) + sw $t0, 0($sp) # Storing internal_29 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 612($sp) # internal_30 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + update_min_end_8794484717692: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_29 + lw $t0, 616($sp) + sw $t0, 4($sp) # Storing internal_29 + + # Argument internal_2 + lw $t0, 724($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 616($sp) # internal_29 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_min_start_8794484717692 + j foreach_min_start_8794484717692 + + foreach_min_end_8794484717692: + + # initialize Array [internal_3] + lw $t0, 708($sp) # $t0 = internal_3 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 584($sp) # internal_34 = new Array[internal_3] + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 580($sp) # internal_35 = address of allocated object Int + + # array internal_34[4 * internal_35] = internal_1 + lw $t0, 580($sp) # $t0 = internal_35 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 584($sp) # $t1 = internal_34 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 716($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 576($sp) # internal_36 = address of allocated object Int + + # array internal_34[4 * internal_36] = internal_1 + lw $t0, 576($sp) # $t0 = internal_36 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 584($sp) # $t1 = internal_34 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 716($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 572($sp) # internal_37 = address of allocated object Int + + # array internal_34[4 * internal_37] = internal_1 + lw $t0, 572($sp) # $t0 = internal_37 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 584($sp) # $t1 = internal_34 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 716($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 568($sp) # internal_38 = address of allocated object Int + + # array internal_34[4 * internal_38] = internal_1 + lw $t0, 568($sp) # $t0 = internal_38 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 584($sp) # $t1 = internal_34 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 716($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 564($sp) # internal_39 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_32 + lw $t0, 604($sp) + sw $t0, 4($sp) # Storing internal_32 + + # Argument internal_5 + lw $t0, 712($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 576($sp) # internal_39 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_39 then goto error_branch_8794484717692 + lw $t0, 564($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, error_branch_8794484717692 + + # array internal_34[4 * internal_30] = internal_2 + lw $t0, 600($sp) # $t0 = internal_30 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 584($sp) # $t1 = internal_34 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 712($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 560($sp) # internal_40 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 556($sp) # internal_41 = address of allocated object Int + + # internal_40 = array internal_34[4 * internal_41] + lw $t0, 556($sp) # $t0 = internal_41 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 584($sp) # $t1 = internal_34 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 560($sp) # internal_40 = array internal_34[4 * internal_41] + sw $t0, 8($t2) + + # If internal_40 then goto branch_Bazz_8794484717692 + lw $t0, 560($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Bazz_8794484717692 + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 552($sp) # internal_42 = address of allocated object Int + + # internal_40 = array internal_34[4 * internal_42] + lw $t0, 552($sp) # $t0 = internal_42 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 584($sp) # $t1 = internal_34 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 560($sp) # internal_40 = array internal_34[4 * internal_42] + sw $t0, 8($t2) + + # If internal_40 then goto branch_Razz_8794484717692 + lw $t0, 560($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Razz_8794484717692 + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 548($sp) # internal_43 = address of allocated object Int + + # internal_40 = array internal_34[4 * internal_43] + lw $t0, 548($sp) # $t0 = internal_43 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 584($sp) # $t1 = internal_34 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 560($sp) # internal_40 = array internal_34[4 * internal_43] + sw $t0, 8($t2) + + # If internal_40 then goto branch_Foo_8794484717692 + lw $t0, 560($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Foo_8794484717692 + + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 544($sp) # internal_44 = address of allocated object Int + + # internal_40 = array internal_34[4 * internal_44] + lw $t0, 544($sp) # $t0 = internal_44 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 584($sp) # $t1 = internal_34 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 560($sp) # internal_40 = array internal_34[4 * internal_44] + sw $t0, 8($t2) + + # If internal_40 then goto branch_Bar_8794484717692 + lw $t0, 560($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Bar_8794484717692 + + branch_Bazz_8794484717692: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument n + lw $t0, 548($sp) + sw $t0, 4($sp) # Storing n + + # Argument self + lw $t0, 736($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 548($sp) # n = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Foo + li $v0, 9 + lw $a0, type_Foo + syscall + la $t0, type_Foo # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 532($sp) # internal_47 = address of allocated object Foo + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_47 + lw $t0, 540($sp) + sw $t0, 0($sp) # Storing internal_47 + + # Calling function function___init___at_Foo + jal function___init___at_Foo + lw $ra, 4($sp) + sw $v1, 540($sp) # internal_47 = result of function___init___at_Foo + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_45 + lw $t0, 552($sp) + sw $t0, 4($sp) # Storing internal_45 + + # Argument internal_47 + lw $t0, 544($sp) + sw $t0, 0($sp) # Storing internal_47 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 552($sp) # internal_45 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_45 = internal_47 + lw $t0, 532($sp) + sw $t0, 540($sp) + + # Jumping to branch_end_8794484717692 + j branch_end_8794484717692 + + branch_Razz_8794484717692: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument n + lw $t0, 548($sp) + sw $t0, 4($sp) # Storing n + + # Argument self + lw $t0, 736($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 548($sp) # n = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Bar + li $v0, 9 + lw $a0, type_Bar + syscall + la $t0, type_Bar # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 524($sp) # internal_49 = address of allocated object Bar + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_49 + lw $t0, 532($sp) + sw $t0, 0($sp) # Storing internal_49 + + # Calling function function___init___at_Bar + jal function___init___at_Bar + lw $ra, 4($sp) + sw $v1, 532($sp) # internal_49 = result of function___init___at_Bar + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_45 + lw $t0, 552($sp) + sw $t0, 4($sp) # Storing internal_45 + + # Argument internal_49 + lw $t0, 536($sp) + sw $t0, 0($sp) # Storing internal_49 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 552($sp) # internal_45 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_45 = internal_49 + lw $t0, 524($sp) + sw $t0, 540($sp) + + # Jumping to branch_end_8794484717692 + j branch_end_8794484717692 + + branch_Foo_8794484717692: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument n + lw $t0, 548($sp) + sw $t0, 4($sp) # Storing n + + # Argument self + lw $t0, 736($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 548($sp) # n = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Razz + li $v0, 9 + lw $a0, type_Razz + syscall + la $t0, type_Razz # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 516($sp) # internal_51 = address of allocated object Razz + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_51 + lw $t0, 524($sp) + sw $t0, 0($sp) # Storing internal_51 + + # Calling function function___init___at_Razz + jal function___init___at_Razz + lw $ra, 4($sp) + sw $v1, 524($sp) # internal_51 = result of function___init___at_Razz + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_45 + lw $t0, 552($sp) + sw $t0, 4($sp) # Storing internal_45 + + # Argument internal_51 + lw $t0, 528($sp) + sw $t0, 0($sp) # Storing internal_51 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 552($sp) # internal_45 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_45 = internal_51 + lw $t0, 516($sp) + sw $t0, 540($sp) + + # Jumping to branch_end_8794484717692 + j branch_end_8794484717692 + + branch_Bar_8794484717692: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument n + lw $t0, 548($sp) + sw $t0, 4($sp) # Storing n + + # Argument self + lw $t0, 736($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 548($sp) # n = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_45 + lw $t0, 552($sp) + sw $t0, 4($sp) # Storing internal_45 + + # Argument n + lw $t0, 548($sp) + sw $t0, 0($sp) # Storing n + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 552($sp) # internal_45 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_45 = n + lw $t0, 536($sp) + sw $t0, 540($sp) + + # Jumping to branch_end_8794484717692 + j branch_end_8794484717692 + + error_branch_8794484717692: + + branch_end_8794484717692: + + # Set attribute g of self + lw $t0, 724($sp) # $t0 = self + lw $t1, 540($sp) # $t1 = internal_45 + beq $t1, $zero, object_set_attribute_8794484650219 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8794484650219 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8794484650219 + j object_set_attribute_8794484650219 + int_set_attribute_8794484650219: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.g = internal_45 + j end_set_attribute_8794484650219 + bool_set_attribute_8794484650219: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.g = internal_45 + j end_set_attribute_8794484650219 + object_set_attribute_8794484650219: + sw $t1, 12($t0) # self.g = internal_45 + end_set_attribute_8794484650219: + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 504($sp) # internal_54 = address of allocated object Int + + # Get method printh of Razz + lw $t0, 724($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 504($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 500($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 732($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_55 + lw $t0, 508($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 516($sp) # internal_53 = result of internal_55 + addi $sp, $sp, 8 # Freeing space for arguments + + # Set attribute i of self + lw $t0, 724($sp) # $t0 = self + lw $t1, 508($sp) # $t1 = internal_53 + beq $t1, $zero, object_set_attribute_8794484650195 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8794484650195 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8794484650195 + j object_set_attribute_8794484650195 + int_set_attribute_8794484650195: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.i = internal_53 + j end_set_attribute_8794484650195 + bool_set_attribute_8794484650195: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.i = internal_53 + j end_set_attribute_8794484650195 + object_set_attribute_8794484650195: + sw $t1, 16($t0) # self.i = internal_53 + end_set_attribute_8794484650195: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 496($sp) # internal_56 = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 492($sp) # internal_57 = address of allocated object Int + + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 488($sp) # internal_58 = address of allocated object Int + + # Allocating NUll to internal_59 + sw $zero, 484($sp) # internal_59 = 0 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 480($sp) # internal_60 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 468($sp) # internal_63 = address of allocated object Int + + # internal_61 = typeof self that is the first word of the object + lw $t0, 724($sp) + lw $t0, 0($t0) + sw $t0, 476($sp) + + # internal_62 = internal_61 + lw $t0, 476($sp) + sw $t0, 472($sp) + + while_start_8794484687207: + + # internal_63 = EqualAddress(internal_62, internal_59) + lw $t0, 472($sp) + lw $t1, 484($sp) + seq $t2, $t0, $t1 + lw $t0, 468($sp) + sw $t2, 8($t0) + + # If internal_63 then goto while_end_8794484687207 + lw $t0, 468($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_end_8794484687207 + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_60 + lw $t0, 492($sp) + sw $t0, 4($sp) # Storing internal_60 + + # Argument internal_57 + lw $t0, 504($sp) + sw $t0, 0($sp) # Storing internal_57 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 492($sp) # internal_60 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_62 = ancestor of internal_62 + lw $t0, 472($sp) + lw $t0, 4($t0) + sw $t0, 472($sp) + + # Jumping to while_start_8794484687207 + j while_start_8794484687207 + + while_end_8794484687207: + + # internal_62 = internal_61 + lw $t0, 476($sp) + sw $t0, 472($sp) + + # initialize Array [internal_60] + lw $t0, 480($sp) # $t0 = internal_60 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 464($sp) # internal_64 = new Array[internal_60] + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 460($sp) # internal_65 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 456($sp) # internal_66 = address of allocated object Int + + foreach_start_8794484687207: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_65 + lw $t0, 472($sp) + sw $t0, 4($sp) # Storing internal_65 + + # Argument internal_60 + lw $t0, 492($sp) + sw $t0, 0($sp) # Storing internal_60 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 468($sp) # internal_66 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_66 then goto foreach_body_8794484687207 + lw $t0, 456($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_body_8794484687207 + + # Jumping to foreach_end_8794484687207 + j foreach_end_8794484687207 + + foreach_body_8794484687207: + + # array internal_64[4 * internal_65] = internal_62 + lw $t0, 460($sp) # $t0 = internal_65 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 464($sp) # $t1 = internal_64 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 472($sp) + sw $t0, 0($t1) + + # internal_62 = ancestor of internal_62 + lw $t0, 472($sp) + lw $t0, 4($t0) + sw $t0, 472($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_65 + lw $t0, 472($sp) + sw $t0, 4($sp) # Storing internal_65 + + # Argument internal_57 + lw $t0, 504($sp) + sw $t0, 0($sp) # Storing internal_57 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 472($sp) # internal_65 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_start_8794484687207 + j foreach_start_8794484687207 + + foreach_end_8794484687207: + + # initialize Array [internal_58] + lw $t0, 488($sp) # $t0 = internal_58 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 452($sp) # internal_67 = new Array[internal_58] + + # initialize Array [internal_58] + lw $t0, 488($sp) # $t0 = internal_58 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 448($sp) # internal_68 = new Array[internal_58] + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 440($sp) # internal_70 = address of allocated object Int + + # internal_69 = direction of Razz + la $t0, type_Razz + sw $t0, 444($sp) + + # array internal_67[4 * internal_70] = internal_69 + lw $t0, 440($sp) # $t0 = internal_70 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 452($sp) # $t1 = internal_67 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 444($sp) + sw $t0, 0($t1) + + # array internal_68[4 * internal_70] = internal_60 + lw $t0, 440($sp) # $t0 = internal_70 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 448($sp) # $t1 = internal_68 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 480($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 432($sp) # internal_72 = address of allocated object Int + + # internal_71 = direction of Foo + la $t0, type_Foo + sw $t0, 436($sp) + + # array internal_67[4 * internal_72] = internal_71 + lw $t0, 432($sp) # $t0 = internal_72 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 452($sp) # $t1 = internal_67 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 436($sp) + sw $t0, 0($t1) + + # array internal_68[4 * internal_72] = internal_60 + lw $t0, 432($sp) # $t0 = internal_72 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 448($sp) # $t1 = internal_68 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 480($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 424($sp) # internal_74 = address of allocated object Int + + # internal_73 = direction of Bar + la $t0, type_Bar + sw $t0, 428($sp) + + # array internal_67[4 * internal_74] = internal_73 + lw $t0, 424($sp) # $t0 = internal_74 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 452($sp) # $t1 = internal_67 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 428($sp) + sw $t0, 0($t1) + + # array internal_68[4 * internal_74] = internal_60 + lw $t0, 424($sp) # $t0 = internal_74 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 448($sp) # $t1 = internal_68 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 480($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 420($sp) # internal_75 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 416($sp) # internal_76 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 408($sp) # internal_78 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 404($sp) # internal_79 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 396($sp) # internal_81 = address of allocated object Int + + foreach_type_start_8794484687207: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_75 + lw $t0, 432($sp) + sw $t0, 4($sp) # Storing internal_75 + + # Argument internal_58 + lw $t0, 500($sp) + sw $t0, 0($sp) # Storing internal_58 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 428($sp) # internal_76 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_76 then goto foreach_type_body_8794484687207 + lw $t0, 416($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_type_body_8794484687207 + + # Jumping to foreach_type_end_8794484687207 + j foreach_type_end_8794484687207 + + foreach_type_body_8794484687207: + + # internal_77 = array internal_67[4 * internal_75] + lw $t0, 420($sp) # $t0 = internal_75 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 452($sp) # $t1 = internal_67 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + sw $t0, 412($sp) # internal_77 = array internal_67[4 * internal_75] + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_78 + lw $t0, 420($sp) + sw $t0, 4($sp) # Storing internal_78 + + # Argument internal_56 + lw $t0, 508($sp) + sw $t0, 0($sp) # Storing internal_56 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 420($sp) # internal_78 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + foreach_ancestor_start_8794484687207: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_78 + lw $t0, 420($sp) + sw $t0, 4($sp) # Storing internal_78 + + # Argument internal_60 + lw $t0, 492($sp) + sw $t0, 0($sp) # Storing internal_60 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 416($sp) # internal_79 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_79 then goto foreach_ancestor_body_8794484687207 + lw $t0, 404($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_body_8794484687207 + + # Jumping to foreach_ancestor_end_8794484687207 + j foreach_ancestor_end_8794484687207 + + foreach_ancestor_body_8794484687207: + + # internal_80 = array internal_64[4 * internal_78] + lw $t0, 408($sp) # $t0 = internal_78 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 464($sp) # $t1 = internal_64 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + sw $t0, 400($sp) # internal_80 = array internal_64[4 * internal_78] + + # internal_81 = EqualAddress(internal_77, internal_80) + lw $t0, 412($sp) + lw $t1, 400($sp) + seq $t2, $t0, $t1 + lw $t0, 396($sp) + sw $t2, 8($t0) + + # If internal_81 then goto foreach_ancestor_end_8794484687207 + lw $t0, 396($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_end_8794484687207 + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_78 + lw $t0, 420($sp) + sw $t0, 4($sp) # Storing internal_78 + + # Argument internal_57 + lw $t0, 504($sp) + sw $t0, 0($sp) # Storing internal_57 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 420($sp) # internal_78 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_ancestor_start_8794484687207 + j foreach_ancestor_start_8794484687207 + + foreach_ancestor_end_8794484687207: + + # array internal_68[4 * internal_75] = internal_78 + lw $t0, 420($sp) # $t0 = internal_75 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 448($sp) # $t1 = internal_68 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 408($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_75 + lw $t0, 432($sp) + sw $t0, 4($sp) # Storing internal_75 + + # Argument internal_57 + lw $t0, 504($sp) + sw $t0, 0($sp) # Storing internal_57 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 432($sp) # internal_75 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_type_start_8794484687207 + j foreach_type_start_8794484687207 + + foreach_type_end_8794484687207: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 392($sp) # internal_82 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 388($sp) # internal_83 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 384($sp) # internal_84 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 380($sp) # internal_85 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 376($sp) # internal_86 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_85 + lw $t0, 392($sp) + sw $t0, 4($sp) # Storing internal_85 + + # Argument internal_60 + lw $t0, 492($sp) + sw $t0, 0($sp) # Storing internal_60 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 392($sp) # internal_85 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + foreach_min_start_8794484687207: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_82 + lw $t0, 404($sp) + sw $t0, 4($sp) # Storing internal_82 + + # Argument internal_58 + lw $t0, 500($sp) + sw $t0, 0($sp) # Storing internal_58 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 388($sp) # internal_86 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_86 then goto foreach_min_body_8794484687207 + lw $t0, 376($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_min_body_8794484687207 + + # Jumping to foreach_min_end_8794484687207 + j foreach_min_end_8794484687207 + + foreach_min_body_8794484687207: + + # internal_84 = array internal_68[4 * internal_82] + lw $t0, 392($sp) # $t0 = internal_82 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 448($sp) # $t1 = internal_68 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 384($sp) # internal_84 = array internal_68[4 * internal_82] + sw $t0, 8($t2) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_84 + lw $t0, 396($sp) + sw $t0, 4($sp) # Storing internal_84 + + # Argument internal_85 + lw $t0, 392($sp) + sw $t0, 0($sp) # Storing internal_85 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 388($sp) # internal_86 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_86 then goto update_min_8794484687207 + lw $t0, 376($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, update_min_8794484687207 + + # Jumping to update_min_end_8794484687207 + j update_min_end_8794484687207 + + update_min_8794484687207: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_85 + lw $t0, 392($sp) + sw $t0, 4($sp) # Storing internal_85 + + # Argument internal_84 + lw $t0, 396($sp) + sw $t0, 0($sp) # Storing internal_84 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 392($sp) # internal_85 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_83 + lw $t0, 400($sp) + sw $t0, 4($sp) # Storing internal_83 + + # Argument internal_82 + lw $t0, 404($sp) + sw $t0, 0($sp) # Storing internal_82 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 400($sp) # internal_83 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + update_min_end_8794484687207: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_82 + lw $t0, 404($sp) + sw $t0, 4($sp) # Storing internal_82 + + # Argument internal_57 + lw $t0, 504($sp) + sw $t0, 0($sp) # Storing internal_57 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 404($sp) # internal_82 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_min_start_8794484687207 + j foreach_min_start_8794484687207 + + foreach_min_end_8794484687207: + + # initialize Array [internal_58] + lw $t0, 488($sp) # $t0 = internal_58 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 372($sp) # internal_87 = new Array[internal_58] + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 368($sp) # internal_88 = address of allocated object Int + + # array internal_87[4 * internal_88] = internal_56 + lw $t0, 368($sp) # $t0 = internal_88 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 372($sp) # $t1 = internal_87 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 496($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 364($sp) # internal_89 = address of allocated object Int + + # array internal_87[4 * internal_89] = internal_56 + lw $t0, 364($sp) # $t0 = internal_89 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 372($sp) # $t1 = internal_87 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 496($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 360($sp) # internal_90 = address of allocated object Int + + # array internal_87[4 * internal_90] = internal_56 + lw $t0, 360($sp) # $t0 = internal_90 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 372($sp) # $t1 = internal_87 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 496($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 356($sp) # internal_91 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_85 + lw $t0, 392($sp) + sw $t0, 4($sp) # Storing internal_85 + + # Argument internal_60 + lw $t0, 492($sp) + sw $t0, 0($sp) # Storing internal_60 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 368($sp) # internal_91 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_91 then goto error_branch_8794484687207 + lw $t0, 356($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, error_branch_8794484687207 + + # array internal_87[4 * internal_83] = internal_57 + lw $t0, 388($sp) # $t0 = internal_83 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 372($sp) # $t1 = internal_87 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 492($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 352($sp) # internal_92 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 348($sp) # internal_93 = address of allocated object Int + + # internal_92 = array internal_87[4 * internal_93] + lw $t0, 348($sp) # $t0 = internal_93 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 372($sp) # $t1 = internal_87 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 352($sp) # internal_92 = array internal_87[4 * internal_93] + sw $t0, 8($t2) + + # If internal_92 then goto branch_Razz_8794484687207 + lw $t0, 352($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Razz_8794484687207 + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 344($sp) # internal_94 = address of allocated object Int + + # internal_92 = array internal_87[4 * internal_94] + lw $t0, 344($sp) # $t0 = internal_94 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 372($sp) # $t1 = internal_87 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 352($sp) # internal_92 = array internal_87[4 * internal_94] + sw $t0, 8($t2) + + # If internal_92 then goto branch_Foo_8794484687207 + lw $t0, 352($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Foo_8794484687207 + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 340($sp) # internal_95 = address of allocated object Int + + # internal_92 = array internal_87[4 * internal_95] + lw $t0, 340($sp) # $t0 = internal_95 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 372($sp) # $t1 = internal_87 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 352($sp) # internal_92 = array internal_87[4 * internal_95] + sw $t0, 8($t2) + + # If internal_92 then goto branch_Bar_8794484687207 + lw $t0, 352($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Bar_8794484687207 + + branch_Razz_8794484687207: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument n + lw $t0, 548($sp) + sw $t0, 4($sp) # Storing n + + # Argument self + lw $t0, 736($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 548($sp) # n = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Bar + li $v0, 9 + lw $a0, type_Bar + syscall + la $t0, type_Bar # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 328($sp) # internal_98 = address of allocated object Bar + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_98 + lw $t0, 336($sp) + sw $t0, 0($sp) # Storing internal_98 + + # Calling function function___init___at_Bar + jal function___init___at_Bar + lw $ra, 4($sp) + sw $v1, 336($sp) # internal_98 = result of function___init___at_Bar + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_96 + lw $t0, 348($sp) + sw $t0, 4($sp) # Storing internal_96 + + # Argument internal_98 + lw $t0, 340($sp) + sw $t0, 0($sp) # Storing internal_98 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 348($sp) # internal_96 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_96 = internal_98 + lw $t0, 328($sp) + sw $t0, 336($sp) + + # Jumping to branch_end_8794484687207 + j branch_end_8794484687207 + + branch_Foo_8794484687207: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument n + lw $t0, 548($sp) + sw $t0, 4($sp) # Storing n + + # Argument self + lw $t0, 736($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 548($sp) # n = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Razz + li $v0, 9 + lw $a0, type_Razz + syscall + la $t0, type_Razz # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 320($sp) # internal_100 = address of allocated object Razz + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_100 + lw $t0, 328($sp) + sw $t0, 0($sp) # Storing internal_100 + + # Calling function function___init___at_Razz + jal function___init___at_Razz + lw $ra, 4($sp) + sw $v1, 328($sp) # internal_100 = result of function___init___at_Razz + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_96 + lw $t0, 348($sp) + sw $t0, 4($sp) # Storing internal_96 + + # Argument internal_100 + lw $t0, 332($sp) + sw $t0, 0($sp) # Storing internal_100 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 348($sp) # internal_96 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_96 = internal_100 + lw $t0, 320($sp) + sw $t0, 336($sp) + + # Jumping to branch_end_8794484687207 + j branch_end_8794484687207 + + branch_Bar_8794484687207: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument n + lw $t0, 548($sp) + sw $t0, 4($sp) # Storing n + + # Argument self + lw $t0, 736($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 548($sp) # n = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_96 + lw $t0, 348($sp) + sw $t0, 4($sp) # Storing internal_96 + + # Argument n + lw $t0, 548($sp) + sw $t0, 0($sp) # Storing n + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 348($sp) # internal_96 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_96 = n + lw $t0, 536($sp) + sw $t0, 336($sp) + + # Jumping to branch_end_8794484687207 + j branch_end_8794484687207 + + error_branch_8794484687207: + + branch_end_8794484687207: + + # Set attribute a of self + lw $t0, 724($sp) # $t0 = self + lw $t1, 336($sp) # $t1 = internal_96 + beq $t1, $zero, object_set_attribute_8794484622132 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8794484622132 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8794484622132 + j object_set_attribute_8794484622132 + int_set_attribute_8794484622132: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($t0) # self.a = internal_96 + j end_set_attribute_8794484622132 + bool_set_attribute_8794484622132: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($t0) # self.a = internal_96 + j end_set_attribute_8794484622132 + object_set_attribute_8794484622132: + sw $t1, 20($t0) # self.a = internal_96 + end_set_attribute_8794484622132: + + # Get attribute a of self + lw $t0, 724($sp) # Get the address of self + lw $t1, 20($t0) # Get the attribute 'a' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8794484677946 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8794484677946 + j object_get_attribute_8794484677946 + int_get_attribute_8794484677946: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 312($sp) # internal_102 = self.a + j end_get_attribute_8794484677946 + bool_get_attribute_8794484677946: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 312($sp) # internal_102 = self.a + j end_get_attribute_8794484677946 + object_get_attribute_8794484677946: + sw $t1, 312($sp) # internal_102 = self.a + end_get_attribute_8794484677946: + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 304($sp) # internal_104 = address of allocated object Int + + # Get method doh of Razz + lw $t0, 312($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 304($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 300($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_102 + lw $t0, 320($sp) + sw $t0, 0($sp) # Storing internal_102 + + # Calling function internal_105 + lw $t0, 308($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 316($sp) # internal_103 = result of internal_105 + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute g of self + lw $t0, 724($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'g' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8794484677985 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8794484677985 + j object_get_attribute_8794484677985 + int_get_attribute_8794484677985: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 296($sp) # internal_106 = self.g + j end_get_attribute_8794484677985 + bool_get_attribute_8794484677985: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 296($sp) # internal_106 = self.g + j end_get_attribute_8794484677985 + object_get_attribute_8794484677985: + sw $t1, 296($sp) # internal_106 = self.g + end_get_attribute_8794484677985: + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 288($sp) # internal_108 = address of allocated object Int + + # Get method doh of Foo + lw $t0, 296($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 288($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 284($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_106 + lw $t0, 304($sp) + sw $t0, 0($sp) # Storing internal_106 + + # Calling function internal_109 + lw $t0, 292($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 300($sp) # internal_107 = result of internal_109 + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_103 + lw $t0, 320($sp) + sw $t0, 4($sp) # Storing internal_103 + + # Argument internal_107 + lw $t0, 304($sp) + sw $t0, 0($sp) # Storing internal_107 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 292($sp) # internal_110 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 272($sp) # internal_112 = address of allocated object Int + + # Get method doh of Razz + lw $t0, 724($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 272($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 268($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 732($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_113 + lw $t0, 276($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 284($sp) # internal_111 = result of internal_113 + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_110 + lw $t0, 292($sp) + sw $t0, 4($sp) # Storing internal_110 + + # Argument internal_111 + lw $t0, 288($sp) + sw $t0, 0($sp) # Storing internal_111 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 276($sp) # internal_114 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 256($sp) # internal_116 = address of allocated object Int + + # Get method printh of Razz + lw $t0, 724($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 256($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 252($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 732($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_117 + lw $t0, 260($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 268($sp) # internal_115 = result of internal_117 + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_114 + lw $t0, 276($sp) + sw $t0, 4($sp) # Storing internal_114 + + # Argument internal_115 + lw $t0, 272($sp) + sw $t0, 0($sp) # Storing internal_115 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 260($sp) # internal_118 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Set attribute b of self + lw $t0, 724($sp) # $t0 = self + lw $t1, 248($sp) # $t1 = internal_118 + beq $t1, $zero, object_set_attribute_8794484673540 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8794484673540 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8794484673540 + j object_set_attribute_8794484673540 + int_set_attribute_8794484673540: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 24($t0) # self.b = internal_118 + j end_set_attribute_8794484673540 + bool_set_attribute_8794484673540: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 24($t0) # self.b = internal_118 + j end_set_attribute_8794484673540 + object_set_attribute_8794484673540: + sw $t1, 24($t0) # self.b = internal_118 + end_set_attribute_8794484673540: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 244($sp) # internal_119 = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 240($sp) # internal_120 = address of allocated object Int + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 236($sp) # internal_121 = address of allocated object Int + + # Allocating NUll to internal_122 + sw $zero, 232($sp) # internal_122 = 0 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 228($sp) # internal_123 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 216($sp) # internal_126 = address of allocated object Int + + # internal_124 = typeof self that is the first word of the object + lw $t0, 724($sp) + lw $t0, 0($t0) + sw $t0, 224($sp) + + # internal_125 = internal_124 + lw $t0, 224($sp) + sw $t0, 220($sp) + + while_start_8794484690189: + + # internal_126 = EqualAddress(internal_125, internal_122) + lw $t0, 220($sp) + lw $t1, 232($sp) + seq $t2, $t0, $t1 + lw $t0, 216($sp) + sw $t2, 8($t0) + + # If internal_126 then goto while_end_8794484690189 + lw $t0, 216($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_end_8794484690189 + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_123 + lw $t0, 240($sp) + sw $t0, 4($sp) # Storing internal_123 + + # Argument internal_120 + lw $t0, 252($sp) + sw $t0, 0($sp) # Storing internal_120 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 240($sp) # internal_123 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_125 = ancestor of internal_125 + lw $t0, 220($sp) + lw $t0, 4($t0) + sw $t0, 220($sp) + + # Jumping to while_start_8794484690189 + j while_start_8794484690189 + + while_end_8794484690189: + + # internal_125 = internal_124 + lw $t0, 224($sp) + sw $t0, 220($sp) + + # initialize Array [internal_123] + lw $t0, 228($sp) # $t0 = internal_123 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 212($sp) # internal_127 = new Array[internal_123] + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 208($sp) # internal_128 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 204($sp) # internal_129 = address of allocated object Int + + foreach_start_8794484690189: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_128 + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing internal_128 + + # Argument internal_123 + lw $t0, 240($sp) + sw $t0, 0($sp) # Storing internal_123 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 216($sp) # internal_129 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_129 then goto foreach_body_8794484690189 + lw $t0, 204($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_body_8794484690189 + + # Jumping to foreach_end_8794484690189 + j foreach_end_8794484690189 + + foreach_body_8794484690189: + + # array internal_127[4 * internal_128] = internal_125 + lw $t0, 208($sp) # $t0 = internal_128 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 212($sp) # $t1 = internal_127 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 220($sp) + sw $t0, 0($t1) + + # internal_125 = ancestor of internal_125 + lw $t0, 220($sp) + lw $t0, 4($t0) + sw $t0, 220($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_128 + lw $t0, 220($sp) + sw $t0, 4($sp) # Storing internal_128 + + # Argument internal_120 + lw $t0, 252($sp) + sw $t0, 0($sp) # Storing internal_120 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 220($sp) # internal_128 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_start_8794484690189 + j foreach_start_8794484690189 + + foreach_end_8794484690189: + + # initialize Array [internal_121] + lw $t0, 236($sp) # $t0 = internal_121 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 200($sp) # internal_130 = new Array[internal_121] + + # initialize Array [internal_121] + lw $t0, 236($sp) # $t0 = internal_121 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 196($sp) # internal_131 = new Array[internal_121] + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 188($sp) # internal_133 = address of allocated object Int + + # internal_132 = direction of Razz + la $t0, type_Razz + sw $t0, 192($sp) + + # array internal_130[4 * internal_133] = internal_132 + lw $t0, 188($sp) # $t0 = internal_133 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 200($sp) # $t1 = internal_130 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 192($sp) + sw $t0, 0($t1) + + # array internal_131[4 * internal_133] = internal_123 + lw $t0, 188($sp) # $t0 = internal_133 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 196($sp) # $t1 = internal_131 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 228($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 180($sp) # internal_135 = address of allocated object Int + + # internal_134 = direction of Bar + la $t0, type_Bar + sw $t0, 184($sp) + + # array internal_130[4 * internal_135] = internal_134 + lw $t0, 180($sp) # $t0 = internal_135 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 200($sp) # $t1 = internal_130 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 184($sp) + sw $t0, 0($t1) + + # array internal_131[4 * internal_135] = internal_123 + lw $t0, 180($sp) # $t0 = internal_135 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 196($sp) # $t1 = internal_131 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 228($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 176($sp) # internal_136 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 172($sp) # internal_137 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 164($sp) # internal_139 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 160($sp) # internal_140 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 152($sp) # internal_142 = address of allocated object Int + + foreach_type_start_8794484690189: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_136 + lw $t0, 188($sp) + sw $t0, 4($sp) # Storing internal_136 + + # Argument internal_121 + lw $t0, 248($sp) + sw $t0, 0($sp) # Storing internal_121 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 184($sp) # internal_137 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_137 then goto foreach_type_body_8794484690189 + lw $t0, 172($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_type_body_8794484690189 + + # Jumping to foreach_type_end_8794484690189 + j foreach_type_end_8794484690189 + + foreach_type_body_8794484690189: + + # internal_138 = array internal_130[4 * internal_136] + lw $t0, 176($sp) # $t0 = internal_136 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 200($sp) # $t1 = internal_130 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + sw $t0, 168($sp) # internal_138 = array internal_130[4 * internal_136] + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_139 + lw $t0, 176($sp) + sw $t0, 4($sp) # Storing internal_139 + + # Argument internal_119 + lw $t0, 256($sp) + sw $t0, 0($sp) # Storing internal_119 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 176($sp) # internal_139 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + foreach_ancestor_start_8794484690189: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_139 + lw $t0, 176($sp) + sw $t0, 4($sp) # Storing internal_139 + + # Argument internal_123 + lw $t0, 240($sp) + sw $t0, 0($sp) # Storing internal_123 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 172($sp) # internal_140 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_140 then goto foreach_ancestor_body_8794484690189 + lw $t0, 160($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_body_8794484690189 + + # Jumping to foreach_ancestor_end_8794484690189 + j foreach_ancestor_end_8794484690189 + + foreach_ancestor_body_8794484690189: + + # internal_141 = array internal_127[4 * internal_139] + lw $t0, 164($sp) # $t0 = internal_139 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 212($sp) # $t1 = internal_127 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + sw $t0, 156($sp) # internal_141 = array internal_127[4 * internal_139] + + # internal_142 = EqualAddress(internal_138, internal_141) + lw $t0, 168($sp) + lw $t1, 156($sp) + seq $t2, $t0, $t1 + lw $t0, 152($sp) + sw $t2, 8($t0) + + # If internal_142 then goto foreach_ancestor_end_8794484690189 + lw $t0, 152($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_end_8794484690189 + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_139 + lw $t0, 176($sp) + sw $t0, 4($sp) # Storing internal_139 + + # Argument internal_120 + lw $t0, 252($sp) + sw $t0, 0($sp) # Storing internal_120 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 176($sp) # internal_139 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_ancestor_start_8794484690189 + j foreach_ancestor_start_8794484690189 + + foreach_ancestor_end_8794484690189: + + # array internal_131[4 * internal_136] = internal_139 + lw $t0, 176($sp) # $t0 = internal_136 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 196($sp) # $t1 = internal_131 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 164($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_136 + lw $t0, 188($sp) + sw $t0, 4($sp) # Storing internal_136 + + # Argument internal_120 + lw $t0, 252($sp) + sw $t0, 0($sp) # Storing internal_120 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 188($sp) # internal_136 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_type_start_8794484690189 + j foreach_type_start_8794484690189 + + foreach_type_end_8794484690189: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 148($sp) # internal_143 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 144($sp) # internal_144 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 140($sp) # internal_145 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 136($sp) # internal_146 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 132($sp) # internal_147 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_146 + lw $t0, 148($sp) + sw $t0, 4($sp) # Storing internal_146 + + # Argument internal_123 + lw $t0, 240($sp) + sw $t0, 0($sp) # Storing internal_123 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 148($sp) # internal_146 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + foreach_min_start_8794484690189: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_143 + lw $t0, 160($sp) + sw $t0, 4($sp) # Storing internal_143 + + # Argument internal_121 + lw $t0, 248($sp) + sw $t0, 0($sp) # Storing internal_121 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 144($sp) # internal_147 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_147 then goto foreach_min_body_8794484690189 + lw $t0, 132($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_min_body_8794484690189 + + # Jumping to foreach_min_end_8794484690189 + j foreach_min_end_8794484690189 + + foreach_min_body_8794484690189: + + # internal_145 = array internal_131[4 * internal_143] + lw $t0, 148($sp) # $t0 = internal_143 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 196($sp) # $t1 = internal_131 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 140($sp) # internal_145 = array internal_131[4 * internal_143] + sw $t0, 8($t2) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_145 + lw $t0, 152($sp) + sw $t0, 4($sp) # Storing internal_145 + + # Argument internal_146 + lw $t0, 148($sp) + sw $t0, 0($sp) # Storing internal_146 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 144($sp) # internal_147 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_147 then goto update_min_8794484690189 + lw $t0, 132($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, update_min_8794484690189 + + # Jumping to update_min_end_8794484690189 + j update_min_end_8794484690189 + + update_min_8794484690189: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_146 + lw $t0, 148($sp) + sw $t0, 4($sp) # Storing internal_146 + + # Argument internal_145 + lw $t0, 152($sp) + sw $t0, 0($sp) # Storing internal_145 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 148($sp) # internal_146 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_144 + lw $t0, 156($sp) + sw $t0, 4($sp) # Storing internal_144 + + # Argument internal_143 + lw $t0, 160($sp) + sw $t0, 0($sp) # Storing internal_143 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 156($sp) # internal_144 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + update_min_end_8794484690189: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_143 + lw $t0, 160($sp) + sw $t0, 4($sp) # Storing internal_143 + + # Argument internal_120 + lw $t0, 252($sp) + sw $t0, 0($sp) # Storing internal_120 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 160($sp) # internal_143 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_min_start_8794484690189 + j foreach_min_start_8794484690189 + + foreach_min_end_8794484690189: + + # initialize Array [internal_121] + lw $t0, 236($sp) # $t0 = internal_121 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 128($sp) # internal_148 = new Array[internal_121] + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 124($sp) # internal_149 = address of allocated object Int + + # array internal_148[4 * internal_149] = internal_119 + lw $t0, 124($sp) # $t0 = internal_149 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 128($sp) # $t1 = internal_148 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 244($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 120($sp) # internal_150 = address of allocated object Int + + # array internal_148[4 * internal_150] = internal_119 + lw $t0, 120($sp) # $t0 = internal_150 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 128($sp) # $t1 = internal_148 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 244($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 116($sp) # internal_151 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_146 + lw $t0, 148($sp) + sw $t0, 4($sp) # Storing internal_146 + + # Argument internal_123 + lw $t0, 240($sp) + sw $t0, 0($sp) # Storing internal_123 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 128($sp) # internal_151 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_151 then goto error_branch_8794484690189 + lw $t0, 116($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, error_branch_8794484690189 + + # array internal_148[4 * internal_144] = internal_120 + lw $t0, 144($sp) # $t0 = internal_144 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 128($sp) # $t1 = internal_148 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 240($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 112($sp) # internal_152 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 108($sp) # internal_153 = address of allocated object Int + + # internal_152 = array internal_148[4 * internal_153] + lw $t0, 108($sp) # $t0 = internal_153 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 128($sp) # $t1 = internal_148 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 112($sp) # internal_152 = array internal_148[4 * internal_153] + sw $t0, 8($t2) + + # If internal_152 then goto branch_Razz_8794484690189 + lw $t0, 112($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Razz_8794484690189 + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 104($sp) # internal_154 = address of allocated object Int + + # internal_152 = array internal_148[4 * internal_154] + lw $t0, 104($sp) # $t0 = internal_154 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 128($sp) # $t1 = internal_148 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 112($sp) # internal_152 = array internal_148[4 * internal_154] + sw $t0, 8($t2) + + # If internal_152 then goto branch_Bar_8794484690189 + lw $t0, 112($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Bar_8794484690189 + + branch_Razz_8794484690189: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument n + lw $t0, 548($sp) + sw $t0, 4($sp) # Storing n + + # Argument self + lw $t0, 736($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 548($sp) # n = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Bar + li $v0, 9 + lw $a0, type_Bar + syscall + la $t0, type_Bar # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 92($sp) # internal_157 = address of allocated object Bar + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_157 + lw $t0, 100($sp) + sw $t0, 0($sp) # Storing internal_157 + + # Calling function function___init___at_Bar + jal function___init___at_Bar + lw $ra, 4($sp) + sw $v1, 100($sp) # internal_157 = result of function___init___at_Bar + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_155 + lw $t0, 112($sp) + sw $t0, 4($sp) # Storing internal_155 + + # Argument internal_157 + lw $t0, 104($sp) + sw $t0, 0($sp) # Storing internal_157 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 112($sp) # internal_155 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_155 = internal_157 + lw $t0, 92($sp) + sw $t0, 100($sp) + + # Jumping to branch_end_8794484690189 + j branch_end_8794484690189 + + branch_Bar_8794484690189: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument n + lw $t0, 548($sp) + sw $t0, 4($sp) # Storing n + + # Argument self + lw $t0, 736($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 548($sp) # n = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_155 + lw $t0, 112($sp) + sw $t0, 4($sp) # Storing internal_155 + + # Argument n + lw $t0, 548($sp) + sw $t0, 0($sp) # Storing n + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 112($sp) # internal_155 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_155 = n + lw $t0, 536($sp) + sw $t0, 100($sp) + + # Jumping to branch_end_8794484690189 + j branch_end_8794484690189 + + error_branch_8794484690189: + + branch_end_8794484690189: + + # Set attribute e of self + lw $t0, 724($sp) # $t0 = self + lw $t1, 100($sp) # $t1 = internal_155 + beq $t1, $zero, object_set_attribute_8794484675603 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8794484675603 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8794484675603 + j object_set_attribute_8794484675603 + int_set_attribute_8794484675603: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 28($t0) # self.e = internal_155 + j end_set_attribute_8794484675603 + bool_set_attribute_8794484675603: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 28($t0) # self.e = internal_155 + j end_set_attribute_8794484675603 + object_set_attribute_8794484675603: + sw $t1, 28($t0) # self.e = internal_155 + end_set_attribute_8794484675603: + + # Get attribute a of self + lw $t0, 724($sp) # Get the address of self + lw $t1, 20($t0) # Get the attribute 'a' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8794484654758 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8794484654758 + j object_get_attribute_8794484654758 + int_get_attribute_8794484654758: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 84($sp) # internal_159 = self.a + j end_get_attribute_8794484654758 + bool_get_attribute_8794484654758: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 84($sp) # internal_159 = self.a + j end_get_attribute_8794484654758 + object_get_attribute_8794484654758: + sw $t1, 84($sp) # internal_159 = self.a + end_get_attribute_8794484654758: + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 76($sp) # internal_161 = address of allocated object Int + + # Get method doh of Bazz + lw $t0, 84($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 76($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 72($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_159 + lw $t0, 92($sp) + sw $t0, 0($sp) # Storing internal_159 + + # Calling function function_doh_at_Bazz + jal function_doh_at_Bazz + lw $ra, 4($sp) + sw $v1, 88($sp) # internal_160 = result of function_doh_at_Bazz + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute g of self + lw $t0, 724($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'g' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8794484654680 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8794484654680 + j object_get_attribute_8794484654680 + int_get_attribute_8794484654680: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 68($sp) # internal_163 = self.g + j end_get_attribute_8794484654680 + bool_get_attribute_8794484654680: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 68($sp) # internal_163 = self.g + j end_get_attribute_8794484654680 + object_get_attribute_8794484654680: + sw $t1, 68($sp) # internal_163 = self.g + end_get_attribute_8794484654680: + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 60($sp) # internal_165 = address of allocated object Int + + # Get method doh of Foo + lw $t0, 68($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 60($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 56($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_163 + lw $t0, 76($sp) + sw $t0, 0($sp) # Storing internal_163 + + # Calling function internal_166 + lw $t0, 64($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 72($sp) # internal_164 = result of internal_166 + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_160 + lw $t0, 92($sp) + sw $t0, 4($sp) # Storing internal_160 + + # Argument internal_164 + lw $t0, 76($sp) + sw $t0, 0($sp) # Storing internal_164 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 64($sp) # internal_167 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute e of self + lw $t0, 724($sp) # Get the address of self + lw $t1, 28($t0) # Get the attribute 'e' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8794484654806 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8794484654806 + j object_get_attribute_8794484654806 + int_get_attribute_8794484654806: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 48($sp) # internal_168 = self.e + j end_get_attribute_8794484654806 + bool_get_attribute_8794484654806: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 48($sp) # internal_168 = self.e + j end_get_attribute_8794484654806 + object_get_attribute_8794484654806: + sw $t1, 48($sp) # internal_168 = self.e + end_get_attribute_8794484654806: + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_170 = address of allocated object Int + + # Get method doh of Bar + lw $t0, 48($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 40($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 36($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_168 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_168 + + # Calling function internal_171 + lw $t0, 44($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 52($sp) # internal_169 = result of internal_171 + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_167 + lw $t0, 64($sp) + sw $t0, 4($sp) # Storing internal_167 + + # Argument internal_169 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_169 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 44($sp) # internal_172 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # internal_174 = address of allocated object Int + + # Get method doh of Razz + lw $t0, 724($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 24($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 20($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 732($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_175 + lw $t0, 28($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 36($sp) # internal_173 = result of internal_175 + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_172 + lw $t0, 44($sp) + sw $t0, 4($sp) # Storing internal_172 + + # Argument internal_173 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_173 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_176 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_178 = address of allocated object Int + + # Get method printh of Razz + lw $t0, 724($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 8($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 4($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 732($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_179 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_177 = result of internal_179 + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_176 + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing internal_176 + + # Argument internal_177 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_177 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_180 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Set attribute f of self + lw $t0, 724($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_180 + beq $t1, $zero, object_set_attribute_8794484654695 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8794484654695 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8794484654695 + j object_set_attribute_8794484654695 + int_set_attribute_8794484654695: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 32($t0) # self.f = internal_180 + j end_set_attribute_8794484654695 + bool_set_attribute_8794484654695: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 32($t0) # self.f = internal_180 + j end_set_attribute_8794484654695 + object_set_attribute_8794484654695: + sw $t1, 32($t0) # self.f = internal_180 + end_set_attribute_8794484654695: + + # Loading return value in $v1 + lw $v1, 724($sp) + + # Freeing space for local variables + addi $sp, $sp, 724 + + jr $ra + + function___init___at_Bazz: + # Function parameters + # $ra = 228($sp) + # self = 224($sp) + + # Reserving space for local variables + addi $sp, $sp, -224 + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 220($sp) # internal_0 = address of allocated object Int + + # Set attribute h of self + lw $t0, 224($sp) # $t0 = self + lw $t1, 220($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8794484653707 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8794484653707 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8794484653707 + j object_set_attribute_8794484653707 + int_set_attribute_8794484653707: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.h = internal_0 + j end_set_attribute_8794484653707 + bool_set_attribute_8794484653707: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.h = internal_0 + j end_set_attribute_8794484653707 + object_set_attribute_8794484653707: + sw $t1, 8($t0) # self.h = internal_0 + end_set_attribute_8794484653707: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 216($sp) # internal_1 = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 212($sp) # internal_2 = address of allocated object Int + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 208($sp) # internal_3 = address of allocated object Int + + # Allocating NUll to internal_4 + sw $zero, 204($sp) # internal_4 = 0 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 200($sp) # internal_5 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 188($sp) # internal_8 = address of allocated object Int + + # internal_6 = typeof self that is the first word of the object + lw $t0, 224($sp) + lw $t0, 0($t0) + sw $t0, 196($sp) + + # internal_7 = internal_6 + lw $t0, 196($sp) + sw $t0, 192($sp) + + while_start_8794484671537: + + # internal_8 = EqualAddress(internal_7, internal_4) + lw $t0, 192($sp) + lw $t1, 204($sp) + seq $t2, $t0, $t1 + lw $t0, 188($sp) + sw $t2, 8($t0) + + # If internal_8 then goto while_end_8794484671537 + lw $t0, 188($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_end_8794484671537 + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_5 + lw $t0, 212($sp) + sw $t0, 4($sp) # Storing internal_5 + + # Argument internal_2 + lw $t0, 224($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 212($sp) # internal_5 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_7 = ancestor of internal_7 + lw $t0, 192($sp) + lw $t0, 4($t0) + sw $t0, 192($sp) + + # Jumping to while_start_8794484671537 + j while_start_8794484671537 + + while_end_8794484671537: + + # internal_7 = internal_6 + lw $t0, 196($sp) + sw $t0, 192($sp) + + # initialize Array [internal_5] + lw $t0, 200($sp) # $t0 = internal_5 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 184($sp) # internal_9 = new Array[internal_5] + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 180($sp) # internal_10 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 176($sp) # internal_11 = address of allocated object Int + + foreach_start_8794484671537: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_10 + lw $t0, 192($sp) + sw $t0, 4($sp) # Storing internal_10 + + # Argument internal_5 + lw $t0, 212($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 188($sp) # internal_11 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_11 then goto foreach_body_8794484671537 + lw $t0, 176($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_body_8794484671537 + + # Jumping to foreach_end_8794484671537 + j foreach_end_8794484671537 + + foreach_body_8794484671537: + + # array internal_9[4 * internal_10] = internal_7 + lw $t0, 180($sp) # $t0 = internal_10 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 184($sp) # $t1 = internal_9 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 192($sp) + sw $t0, 0($t1) + + # internal_7 = ancestor of internal_7 + lw $t0, 192($sp) + lw $t0, 4($t0) + sw $t0, 192($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_10 + lw $t0, 192($sp) + sw $t0, 4($sp) # Storing internal_10 + + # Argument internal_2 + lw $t0, 224($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 192($sp) # internal_10 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_start_8794484671537 + j foreach_start_8794484671537 + + foreach_end_8794484671537: + + # initialize Array [internal_3] + lw $t0, 208($sp) # $t0 = internal_3 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 172($sp) # internal_12 = new Array[internal_3] + + # initialize Array [internal_3] + lw $t0, 208($sp) # $t0 = internal_3 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 168($sp) # internal_13 = new Array[internal_3] + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 160($sp) # internal_15 = address of allocated object Int + + # internal_14 = direction of Bazz + la $t0, type_Bazz + sw $t0, 164($sp) + + # array internal_12[4 * internal_15] = internal_14 + lw $t0, 160($sp) # $t0 = internal_15 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 172($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 164($sp) + sw $t0, 0($t1) + + # array internal_13[4 * internal_15] = internal_5 + lw $t0, 160($sp) # $t0 = internal_15 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 168($sp) # $t1 = internal_13 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 200($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 152($sp) # internal_17 = address of allocated object Int + + # internal_16 = direction of Razz + la $t0, type_Razz + sw $t0, 156($sp) + + # array internal_12[4 * internal_17] = internal_16 + lw $t0, 152($sp) # $t0 = internal_17 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 172($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 156($sp) + sw $t0, 0($t1) + + # array internal_13[4 * internal_17] = internal_5 + lw $t0, 152($sp) # $t0 = internal_17 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 168($sp) # $t1 = internal_13 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 200($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 144($sp) # internal_19 = address of allocated object Int + + # internal_18 = direction of Foo + la $t0, type_Foo + sw $t0, 148($sp) + + # array internal_12[4 * internal_19] = internal_18 + lw $t0, 144($sp) # $t0 = internal_19 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 172($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 148($sp) + sw $t0, 0($t1) + + # array internal_13[4 * internal_19] = internal_5 + lw $t0, 144($sp) # $t0 = internal_19 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 168($sp) # $t1 = internal_13 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 200($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 136($sp) # internal_21 = address of allocated object Int + + # internal_20 = direction of Bar + la $t0, type_Bar + sw $t0, 140($sp) + + # array internal_12[4 * internal_21] = internal_20 + lw $t0, 136($sp) # $t0 = internal_21 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 172($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 140($sp) + sw $t0, 0($t1) + + # array internal_13[4 * internal_21] = internal_5 + lw $t0, 136($sp) # $t0 = internal_21 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 168($sp) # $t1 = internal_13 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 200($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 132($sp) # internal_22 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 128($sp) # internal_23 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 120($sp) # internal_25 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 116($sp) # internal_26 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 108($sp) # internal_28 = address of allocated object Int + + foreach_type_start_8794484671537: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_22 + lw $t0, 144($sp) + sw $t0, 4($sp) # Storing internal_22 + + # Argument internal_3 + lw $t0, 220($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 140($sp) # internal_23 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_23 then goto foreach_type_body_8794484671537 + lw $t0, 128($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_type_body_8794484671537 + + # Jumping to foreach_type_end_8794484671537 + j foreach_type_end_8794484671537 + + foreach_type_body_8794484671537: + + # internal_24 = array internal_12[4 * internal_22] + lw $t0, 132($sp) # $t0 = internal_22 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 172($sp) # $t1 = internal_12 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + sw $t0, 124($sp) # internal_24 = array internal_12[4 * internal_22] + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_25 + lw $t0, 132($sp) + sw $t0, 4($sp) # Storing internal_25 + + # Argument internal_1 + lw $t0, 228($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 132($sp) # internal_25 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + foreach_ancestor_start_8794484671537: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_25 + lw $t0, 132($sp) + sw $t0, 4($sp) # Storing internal_25 + + # Argument internal_5 + lw $t0, 212($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 128($sp) # internal_26 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_26 then goto foreach_ancestor_body_8794484671537 + lw $t0, 116($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_body_8794484671537 + + # Jumping to foreach_ancestor_end_8794484671537 + j foreach_ancestor_end_8794484671537 + + foreach_ancestor_body_8794484671537: + + # internal_27 = array internal_9[4 * internal_25] + lw $t0, 120($sp) # $t0 = internal_25 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 184($sp) # $t1 = internal_9 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + sw $t0, 112($sp) # internal_27 = array internal_9[4 * internal_25] + + # internal_28 = EqualAddress(internal_24, internal_27) + lw $t0, 124($sp) + lw $t1, 112($sp) + seq $t2, $t0, $t1 + lw $t0, 108($sp) + sw $t2, 8($t0) + + # If internal_28 then goto foreach_ancestor_end_8794484671537 + lw $t0, 108($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_ancestor_end_8794484671537 + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_25 + lw $t0, 132($sp) + sw $t0, 4($sp) # Storing internal_25 + + # Argument internal_2 + lw $t0, 224($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 132($sp) # internal_25 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_ancestor_start_8794484671537 + j foreach_ancestor_start_8794484671537 + + foreach_ancestor_end_8794484671537: + + # array internal_13[4 * internal_22] = internal_25 + lw $t0, 132($sp) # $t0 = internal_22 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 168($sp) # $t1 = internal_13 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 120($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_22 + lw $t0, 144($sp) + sw $t0, 4($sp) # Storing internal_22 + + # Argument internal_2 + lw $t0, 224($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 144($sp) # internal_22 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_type_start_8794484671537 + j foreach_type_start_8794484671537 + + foreach_type_end_8794484671537: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 104($sp) # internal_29 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 100($sp) # internal_30 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 96($sp) # internal_31 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 92($sp) # internal_32 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 88($sp) # internal_33 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_32 + lw $t0, 104($sp) + sw $t0, 4($sp) # Storing internal_32 + + # Argument internal_5 + lw $t0, 212($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 104($sp) # internal_32 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + foreach_min_start_8794484671537: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_29 + lw $t0, 116($sp) + sw $t0, 4($sp) # Storing internal_29 + + # Argument internal_3 + lw $t0, 220($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 100($sp) # internal_33 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_33 then goto foreach_min_body_8794484671537 + lw $t0, 88($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, foreach_min_body_8794484671537 + + # Jumping to foreach_min_end_8794484671537 + j foreach_min_end_8794484671537 + + foreach_min_body_8794484671537: + + # internal_31 = array internal_13[4 * internal_29] + lw $t0, 104($sp) # $t0 = internal_29 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 168($sp) # $t1 = internal_13 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 96($sp) # internal_31 = array internal_13[4 * internal_29] + sw $t0, 8($t2) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_31 + lw $t0, 108($sp) + sw $t0, 4($sp) # Storing internal_31 + + # Argument internal_32 + lw $t0, 104($sp) + sw $t0, 0($sp) # Storing internal_32 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 100($sp) # internal_33 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_33 then goto update_min_8794484671537 + lw $t0, 88($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, update_min_8794484671537 + + # Jumping to update_min_end_8794484671537 + j update_min_end_8794484671537 + + update_min_8794484671537: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_32 + lw $t0, 104($sp) + sw $t0, 4($sp) # Storing internal_32 + + # Argument internal_31 + lw $t0, 108($sp) + sw $t0, 0($sp) # Storing internal_31 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 104($sp) # internal_32 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_30 + lw $t0, 112($sp) + sw $t0, 4($sp) # Storing internal_30 + + # Argument internal_29 + lw $t0, 116($sp) + sw $t0, 0($sp) # Storing internal_29 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 112($sp) # internal_30 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + update_min_end_8794484671537: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_29 + lw $t0, 116($sp) + sw $t0, 4($sp) # Storing internal_29 + + # Argument internal_2 + lw $t0, 224($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 116($sp) # internal_29 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to foreach_min_start_8794484671537 + j foreach_min_start_8794484671537 + + foreach_min_end_8794484671537: + + # initialize Array [internal_3] + lw $t0, 208($sp) # $t0 = internal_3 + lw $t0, 8($t0) # $t0 = value of the size + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + li $v0, 9 + move $a0, $t0 + syscall + sw $v0, 84($sp) # internal_34 = new Array[internal_3] + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 80($sp) # internal_35 = address of allocated object Int + + # array internal_34[4 * internal_35] = internal_1 + lw $t0, 80($sp) # $t0 = internal_35 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 84($sp) # $t1 = internal_34 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 216($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 76($sp) # internal_36 = address of allocated object Int + + # array internal_34[4 * internal_36] = internal_1 + lw $t0, 76($sp) # $t0 = internal_36 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 84($sp) # $t1 = internal_34 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 216($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 72($sp) # internal_37 = address of allocated object Int + + # array internal_34[4 * internal_37] = internal_1 + lw $t0, 72($sp) # $t0 = internal_37 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 84($sp) # $t1 = internal_34 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 216($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 68($sp) # internal_38 = address of allocated object Int + + # array internal_34[4 * internal_38] = internal_1 + lw $t0, 68($sp) # $t0 = internal_38 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 84($sp) # $t1 = internal_34 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 216($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 64($sp) # internal_39 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_32 + lw $t0, 104($sp) + sw $t0, 4($sp) # Storing internal_32 + + # Argument internal_5 + lw $t0, 212($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 76($sp) # internal_39 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_39 then goto error_branch_8794484671537 + lw $t0, 64($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, error_branch_8794484671537 + + # array internal_34[4 * internal_30] = internal_2 + lw $t0, 100($sp) # $t0 = internal_30 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 84($sp) # $t1 = internal_34 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 212($sp) + lw $t0, 8($t0) + sw $t0, 0($t1) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 60($sp) # internal_40 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 56($sp) # internal_41 = address of allocated object Int + + # internal_40 = array internal_34[4 * internal_41] + lw $t0, 56($sp) # $t0 = internal_41 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 84($sp) # $t1 = internal_34 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 60($sp) # internal_40 = array internal_34[4 * internal_41] + sw $t0, 8($t2) + + # If internal_40 then goto branch_Bazz_8794484671537 + lw $t0, 60($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Bazz_8794484671537 + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 52($sp) # internal_42 = address of allocated object Int + + # internal_40 = array internal_34[4 * internal_42] + lw $t0, 52($sp) # $t0 = internal_42 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 84($sp) # $t1 = internal_34 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 60($sp) # internal_40 = array internal_34[4 * internal_42] + sw $t0, 8($t2) + + # If internal_40 then goto branch_Razz_8794484671537 + lw $t0, 60($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Razz_8794484671537 + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 48($sp) # internal_43 = address of allocated object Int + + # internal_40 = array internal_34[4 * internal_43] + lw $t0, 48($sp) # $t0 = internal_43 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 84($sp) # $t1 = internal_34 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 60($sp) # internal_40 = array internal_34[4 * internal_43] + sw $t0, 8($t2) + + # If internal_40 then goto branch_Foo_8794484671537 + lw $t0, 60($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Foo_8794484671537 + + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_44 = address of allocated object Int + + # internal_40 = array internal_34[4 * internal_44] + lw $t0, 44($sp) # $t0 = internal_44 + lw $t0, 8($t0) # $t0 = value of the index + addi $t1, $zero, 4 # $t1 = 4 + mult $t0, $t1 # $t0 = $t0 * 4 + mflo $t0 + lw $t1, 84($sp) # $t1 = internal_34 + add $t1, $t1, $t0 # Move the pointer to the index + lw $t0, 0($t1) # $t1 = value in the position + lw $t2, 60($sp) # internal_40 = array internal_34[4 * internal_44] + sw $t0, 8($t2) + + # If internal_40 then goto branch_Bar_8794484671537 + lw $t0, 60($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, branch_Bar_8794484671537 + + branch_Bazz_8794484671537: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument n + lw $t0, 48($sp) + sw $t0, 4($sp) # Storing n + + # Argument self + lw $t0, 236($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 48($sp) # n = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Foo + li $v0, 9 + lw $a0, type_Foo + syscall + la $t0, type_Foo # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 32($sp) # internal_47 = address of allocated object Foo + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_47 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_47 + + # Calling function function___init___at_Foo + jal function___init___at_Foo + lw $ra, 4($sp) + sw $v1, 40($sp) # internal_47 = result of function___init___at_Foo + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_45 + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing internal_45 + + # Argument internal_47 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_47 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 52($sp) # internal_45 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_45 = internal_47 + lw $t0, 32($sp) + sw $t0, 40($sp) + + # Jumping to branch_end_8794484671537 + j branch_end_8794484671537 + + branch_Razz_8794484671537: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument n + lw $t0, 48($sp) + sw $t0, 4($sp) # Storing n + + # Argument self + lw $t0, 236($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 48($sp) # n = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Bar + li $v0, 9 + lw $a0, type_Bar + syscall + la $t0, type_Bar # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 24($sp) # internal_49 = address of allocated object Bar + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_49 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_49 + + # Calling function function___init___at_Bar + jal function___init___at_Bar + lw $ra, 4($sp) + sw $v1, 32($sp) # internal_49 = result of function___init___at_Bar + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_45 + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing internal_45 + + # Argument internal_49 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_49 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 52($sp) # internal_45 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_45 = internal_49 + lw $t0, 24($sp) + sw $t0, 40($sp) + + # Jumping to branch_end_8794484671537 + j branch_end_8794484671537 + + branch_Foo_8794484671537: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument n + lw $t0, 48($sp) + sw $t0, 4($sp) # Storing n + + # Argument self + lw $t0, 236($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 48($sp) # n = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Razz + li $v0, 9 + lw $a0, type_Razz + syscall + la $t0, type_Razz # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 16($sp) # internal_51 = address of allocated object Razz + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_51 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_51 + + # Calling function function___init___at_Razz + jal function___init___at_Razz + lw $ra, 4($sp) + sw $v1, 24($sp) # internal_51 = result of function___init___at_Razz + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_45 + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing internal_45 + + # Argument internal_51 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_51 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 52($sp) # internal_45 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_45 = internal_51 + lw $t0, 16($sp) + sw $t0, 40($sp) + + # Jumping to branch_end_8794484671537 + j branch_end_8794484671537 + + branch_Bar_8794484671537: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument n + lw $t0, 48($sp) + sw $t0, 4($sp) # Storing n + + # Argument self + lw $t0, 236($sp) + sw $t0, 0($sp) # Storing self + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 48($sp) # n = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_45 + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing internal_45 + + # Argument n + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing n + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 52($sp) # internal_45 = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_45 = n + lw $t0, 36($sp) + sw $t0, 40($sp) + + # Jumping to branch_end_8794484671537 + j branch_end_8794484671537 + + error_branch_8794484671537: + + branch_end_8794484671537: + + # Set attribute g of self + lw $t0, 224($sp) # $t0 = self + lw $t1, 40($sp) # $t1 = internal_45 + beq $t1, $zero, object_set_attribute_8794484653728 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8794484653728 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8794484653728 + j object_set_attribute_8794484653728 + int_set_attribute_8794484653728: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.g = internal_45 + j end_set_attribute_8794484653728 + bool_set_attribute_8794484653728: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.g = internal_45 + j end_set_attribute_8794484653728 + object_set_attribute_8794484653728: + sw $t1, 12($t0) # self.g = internal_45 + end_set_attribute_8794484653728: + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_54 = address of allocated object Int + + # Get method printh of Bazz + lw $t0, 224($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 232($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_55 + lw $t0, 8($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_53 = result of internal_55 + addi $sp, $sp, 8 # Freeing space for arguments + + # Set attribute i of self + lw $t0, 224($sp) # $t0 = self + lw $t1, 8($sp) # $t1 = internal_53 + beq $t1, $zero, object_set_attribute_8794484653701 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8794484653701 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8794484653701 + j object_set_attribute_8794484653701 + int_set_attribute_8794484653701: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.i = internal_53 + j end_set_attribute_8794484653701 + bool_set_attribute_8794484653701: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.i = internal_53 + j end_set_attribute_8794484653701 + object_set_attribute_8794484653701: + sw $t1, 16($t0) # self.i = internal_53 + end_set_attribute_8794484653701: + + # Loading return value in $v1 + lw $v1, 224($sp) + + # Freeing space for local variables + addi $sp, $sp, 224 + + jr $ra + + function_printh_at_Bazz: + # Function parameters + # $ra = 24($sp) + # self = 20($sp) + + # Reserving space for local variables + addi $sp, $sp, -20 + + # Get attribute h of self + lw $t0, 20($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'h' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8794484682042 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8794484682042 + j object_get_attribute_8794484682042 + int_get_attribute_8794484682042: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($sp) # internal_0 = self.h + j end_get_attribute_8794484682042 + bool_get_attribute_8794484682042: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($sp) # internal_0 = self.h + j end_get_attribute_8794484682042 + object_get_attribute_8794484682042: + sw $t1, 16($sp) # internal_0 = self.h + end_get_attribute_8794484682042: + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_2 = address of allocated object Int + + # Get method out_int of Bazz + lw $t0, 20($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 8($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 4($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_0 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function internal_3 + lw $t0, 16($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_1 = result of internal_3 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_4 = address of allocated object Int + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 20 + + jr $ra + + function_doh_at_Bazz: + # Function parameters + # $ra = 24($sp) + # self = 20($sp) + + # Reserving space for local variables + addi $sp, $sp, -20 + + # Get attribute h of self + lw $t0, 20($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'h' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8794484682015 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8794484682015 + j object_get_attribute_8794484682015 + int_get_attribute_8794484682015: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_1 = self.h + j end_get_attribute_8794484682015 + bool_get_attribute_8794484682015: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_1 = self.h + j end_get_attribute_8794484682015 + object_get_attribute_8794484682015: + sw $t1, 12($sp) # internal_1 = self.h + end_get_attribute_8794484682015: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_1 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 28($sp) # i = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute h of self + lw $t0, 20($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'h' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8794484682141 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8794484682141 + j object_get_attribute_8794484682141 + int_get_attribute_8794484682141: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($sp) # internal_2 = self.h + j end_get_attribute_8794484682141 + bool_get_attribute_8794484682141: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($sp) # internal_2 = self.h + j end_get_attribute_8794484682141 + object_get_attribute_8794484682141: + sw $t1, 8($sp) # internal_2 = self.h + end_get_attribute_8794484682141: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_3 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 20($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_3 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_4 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Set attribute h of self + lw $t0, 20($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_4 + beq $t1, $zero, object_set_attribute_8794484682165 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8794484682165 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8794484682165 + j object_set_attribute_8794484682165 + int_set_attribute_8794484682165: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.h = internal_4 + j end_set_attribute_8794484682165 + bool_set_attribute_8794484682165: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.h = internal_4 + j end_set_attribute_8794484682165 + object_set_attribute_8794484682165: + sw $t1, 8($t0) # self.h = internal_4 + end_set_attribute_8794484682165: + + # Loading return value in $v1 + lw $v1, 16($sp) + + # Freeing space for local variables + addi $sp, $sp, 20 + + jr $ra + + function___init___at_Main: + # Function parameters + # $ra = 20($sp) + # self = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Allocating Bazz + li $v0, 9 + lw $a0, type_Bazz + syscall + la $t0, type_Bazz # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 12($sp) # internal_0 = address of allocated object Bazz + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_Bazz + jal function___init___at_Bazz + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_0 = result of function___init___at_Bazz + addi $sp, $sp, 8 # Freeing space for arguments + + # Set attribute a of self + lw $t0, 16($sp) # $t0 = self + lw $t1, 12($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8794484682219 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8794484682219 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8794484682219 + j object_set_attribute_8794484682219 + int_set_attribute_8794484682219: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.a = internal_0 + j end_set_attribute_8794484682219 + bool_set_attribute_8794484682219: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.a = internal_0 + j end_set_attribute_8794484682219 + object_set_attribute_8794484682219: + sw $t1, 8($t0) # self.a = internal_0 + end_set_attribute_8794484682219: + + # Allocating Foo + li $v0, 9 + lw $a0, type_Foo + syscall + la $t0, type_Foo # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 8($sp) # internal_1 = address of allocated object Foo + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_1 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function___init___at_Foo + jal function___init___at_Foo + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_1 = result of function___init___at_Foo + addi $sp, $sp, 8 # Freeing space for arguments + + # Set attribute b of self + lw $t0, 16($sp) # $t0 = self + lw $t1, 8($sp) # $t1 = internal_1 + beq $t1, $zero, object_set_attribute_8794484682045 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8794484682045 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8794484682045 + j object_set_attribute_8794484682045 + int_set_attribute_8794484682045: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.b = internal_1 + j end_set_attribute_8794484682045 + bool_set_attribute_8794484682045: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.b = internal_1 + j end_set_attribute_8794484682045 + object_set_attribute_8794484682045: + sw $t1, 12($t0) # self.b = internal_1 + end_set_attribute_8794484682045: + + # Allocating Razz + li $v0, 9 + lw $a0, type_Razz + syscall + la $t0, type_Razz # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 4($sp) # internal_2 = address of allocated object Razz + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_2 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function___init___at_Razz + jal function___init___at_Razz + lw $ra, 4($sp) + sw $v1, 12($sp) # internal_2 = result of function___init___at_Razz + addi $sp, $sp, 8 # Freeing space for arguments + + # Set attribute c of self + lw $t0, 16($sp) # $t0 = self + lw $t1, 4($sp) # $t1 = internal_2 + beq $t1, $zero, object_set_attribute_8794484682527 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8794484682527 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8794484682527 + j object_set_attribute_8794484682527 + int_set_attribute_8794484682527: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.c = internal_2 + j end_set_attribute_8794484682527 + bool_set_attribute_8794484682527: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.c = internal_2 + j end_set_attribute_8794484682527 + object_set_attribute_8794484682527: + sw $t1, 16($t0) # self.c = internal_2 + end_set_attribute_8794484682527: + + # Allocating Bar + li $v0, 9 + lw $a0, type_Bar + syscall + la $t0, type_Bar # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 0($sp) # internal_3 = address of allocated object Bar + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_3 + lw $t0, 8($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function___init___at_Bar + jal function___init___at_Bar + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_3 = result of function___init___at_Bar + addi $sp, $sp, 8 # Freeing space for arguments + + # Set attribute d of self + lw $t0, 16($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_3 + beq $t1, $zero, object_set_attribute_8794484682557 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8794484682557 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8794484682557 + j object_set_attribute_8794484682557 + int_set_attribute_8794484682557: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($t0) # self.d = internal_3 + j end_set_attribute_8794484682557 + bool_set_attribute_8794484682557: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($t0) # self.d = internal_3 + j end_set_attribute_8794484682557 + object_set_attribute_8794484682557: + sw $t1, 20($t0) # self.d = internal_3 + end_set_attribute_8794484682557: + + # Loading return value in $v1 + lw $v1, 16($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 + + jr $ra + + function_main_at_Main: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 19 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 19 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 100 + sb $t0, 8($v0) # internal_0[0] = 'd' + + addi $t0, $zero, 111 + sb $t0, 9($v0) # internal_0[1] = 'o' + + addi $t0, $zero, 32 + sb $t0, 10($v0) # internal_0[2] = ' ' + + addi $t0, $zero, 110 + sb $t0, 11($v0) # internal_0[3] = 'n' + + addi $t0, $zero, 111 + sb $t0, 12($v0) # internal_0[4] = 'o' + + addi $t0, $zero, 116 + sb $t0, 13($v0) # internal_0[5] = 't' + + addi $t0, $zero, 104 + sb $t0, 14($v0) # internal_0[6] = 'h' + + addi $t0, $zero, 105 + sb $t0, 15($v0) # internal_0[7] = 'i' + + addi $t0, $zero, 110 + sb $t0, 16($v0) # internal_0[8] = 'n' + + addi $t0, $zero, 103 + sb $t0, 17($v0) # internal_0[9] = 'g' + + sb $zero, 18($v0) # Null-terminator at the end of the string + + sw $v0, 0($sp) # internal_0 = "do nothing" + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + main: + # Reserving space for local variables + addi $sp, $sp, -16 + + # Allocating Main + li $v0, 9 + lw $a0, type_Main + syscall + la $t0, type_Main # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 12($sp) # internal_0 = address of allocated object Main + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_Main + jal function___init___at_Main + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_0 = result of function___init___at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_2 = address of allocated object Int + + # Get method main of Main + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function internal_3 + lw $t0, 8($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_1 = result of internal_3 + addi $sp, $sp, 8 # Freeing space for arguments + + # Exit program + li $v0, 10 + syscall + + \ No newline at end of file diff --git a/tests/codegen/hello_world.cl b/tests/codegen/hello_world.cl index 0c818f908..b0a180a2e 100755 --- a/tests/codegen/hello_world.cl +++ b/tests/codegen/hello_world.cl @@ -1,5 +1,5 @@ -class Main inherits IO { - main(): IO { - out_string("Hello, World.\n") - }; -}; +class Main inherits IO { + main(): IO { + out_string("Hello, World.\n") + }; +}; diff --git a/tests/codegen/hello_world.mips b/tests/codegen/hello_world.mips new file mode 100644 index 000000000..aaa620711 --- /dev/null +++ b/tests/codegen/hello_world.mips @@ -0,0 +1,1618 @@ +.data + type_Object: .word 24 + type_Object_inherits_from: .word 0 + type_Object_name_address: .word type_Object_name_size + type_Object___init__: .word function___init___at_Object + type_Object_abort: .word function_abort_at_Object + type_Object_type_name: .word function_type_name_at_Object + type_Object_copy: .word function_copy_at_Object + + type_IO: .word 40 + type_IO_inherits_from: .word type_Object + type_IO_name_address: .word type_IO_name_size + type_IO___init__: .word function___init___at_IO + type_IO_abort: .word function_abort_at_Object + type_IO_type_name: .word function_type_name_at_Object + type_IO_copy: .word function_copy_at_Object + type_IO_out_string: .word function_out_string_at_IO + type_IO_out_int: .word function_out_int_at_IO + type_IO_in_string: .word function_in_string_at_IO + type_IO_in_int: .word function_in_int_at_IO + + type_String: .word 36 + type_String_inherits_from: .word type_Object + type_String_name_address: .word type_String_name_size + type_String___init__: .word function___init___at_String + type_String_abort: .word function_abort_at_Object + type_String_type_name: .word function_type_name_at_Object + type_String_copy: .word function_copy_at_Object + type_String_length: .word function_length_at_String + type_String_concat: .word function_concat_at_String + type_String_substr: .word function_substr_at_String + + type_Int: .word 24 + type_Int_inherits_from: .word type_Object + type_Int_name_address: .word type_Int_name_size + type_Int___init__: .word function___init___at_Int + type_Int_abort: .word function_abort_at_Object + type_Int_type_name: .word function_type_name_at_Object + type_Int_copy: .word function_copy_at_Object + + type_Bool: .word 24 + type_Bool_inherits_from: .word type_Object + type_Bool_name_address: .word type_Bool_name_size + type_Bool___init__: .word function___init___at_Bool + type_Bool_abort: .word function_abort_at_Object + type_Bool_type_name: .word function_type_name_at_Object + type_Bool_copy: .word function_copy_at_Object + + type_Main: .word 44 + type_Main_inherits_from: .word type_IO + type_Main_name_address: .word type_Main_name_size + type_Main___init__: .word function___init___at_Main + type_Main_abort: .word function_abort_at_Object + type_Main_type_name: .word function_type_name_at_Object + type_Main_copy: .word function_copy_at_Object + type_Main_out_string: .word function_out_string_at_IO + type_Main_out_int: .word function_out_int_at_IO + type_Main_in_string: .word function_in_string_at_IO + type_Main_in_int: .word function_in_int_at_IO + type_Main_main: .word function_main_at_Main + + type_Object_name_size: .word 6 + type_Object_name: .asciiz "Object" + + type_IO_name_size: .word 2 + type_IO_name: .asciiz "IO" + + type_String_name_size: .word 6 + type_String_name: .asciiz "String" + + type_Int_name_size: .word 3 + type_Int_name: .asciiz "Int" + + type_Bool_name_size: .word 4 + type_Bool_name: .asciiz "Bool" + + type_Main_name_size: .word 4 + type_Main_name: .asciiz "Main" + + buffer_input: .space 1024 + debug_log: .asciiz "debug_log\n" + +.text + function_add: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Addition operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + add $t2, $t0, $t1 # $t2 = $t0 + $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_sub: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Subtraction operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sub $t2, $t0, $t1 # $t2 = $t0 - $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_mult: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Multiplication operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + mult $t0, $t1 # $t2 = $t0 * $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_div: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Division operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + div $t0, $t1 # $t2 = $t0 / $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_xor: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Xor operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than_or_equal: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sle $t2, $t0, $t1 # $t2 = $t0 <= $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_equal: + # Function parameters + # $ra = 48($sp) + # a = 44($sp) + # b = 40($sp) + + # Reserving space for local variables + addi $sp, $sp, -40 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_0 = address of allocated object Int + + # Allocating NUll to internal_1 + sw $zero, 32($sp) # internal_1 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_2 = address of allocated object Int + + # internal_2 = EqualAddress(a, internal_1) + lw $t0, 44($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # internal_2 = EqualAddress(b, internal_1) + lw $t0, 40($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # If internal_2 then goto a_is_type_object + lw $t0, 28($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_object + + # internal_3 = typeof a that is the first word of the object + lw $t0, 44($sp) + lw $t0, 0($t0) + sw $t0, 24($sp) + + # internal_4 = direction of Int + la $t0, type_Int + sw $t0, 20($sp) + + # internal_5 = direction of Bool + la $t0, type_Bool + sw $t0, 16($sp) + + # internal_6 = direction of String + la $t0, type_String + sw $t0, 12($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_7 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_8 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_9 = address of allocated object Int + + # internal_7 = EqualAddress(internal_3, internal_4) + lw $t0, 24($sp) + lw $t1, 20($sp) + seq $t2, $t0, $t1 + lw $t0, 8($sp) + sw $t2, 8($t0) + + # internal_8 = EqualAddress(internal_3, internal_5) + lw $t0, 24($sp) + lw $t1, 16($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_9 = EqualAddress(internal_3, internal_6) + lw $t0, 24($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_7 then goto a_is_type_int_or_bool + lw $t0, 8($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_8 then goto a_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_9 then goto a_is_type_string + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_string + + # Jumping to a_is_type_object + j a_is_type_object + + a_is_type_int_or_bool: + + # internal_0 = EqualInt(a, b) + lw $t0, 44($sp) + lw $t0, 8($t0) + lw $t1, 40($sp) + lw $t1, 8($t1) + seq $t2, $t0, $t1 + lw $t0, 36($sp) + sw $t2, 8($t0) + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_string: + + # internal_0 = EqualStr(a, b) + lw $t0, 44($sp) + lw $t1, 40($sp) + addi $t0, $t0, 8 + addi $t1, $t1, 8 + + # By default we assume the strings are equals + addi $t4, $zero, 1 + lw $t5, 36($sp) + sw $t4, 8($t5) + + while_compare_strings_start: + lb $t2, 0($t0) + lb $t3, 0($t1) + beq $t2, $t3, while_compare_strings_update + + # The strings are no equals + lw $t5, 36($sp) + sw $zero, 8($t5) + j while_compare_strings_end + + while_compare_strings_update: + addi $t0, $t0, 1 + addi $t1, $t1, 1 + beq $t2, $zero, while_compare_strings_end + beq $t3, $zero, while_compare_strings_end + j while_compare_strings_start + while_compare_strings_end: + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_object: + + # Equal operation + lw $t0, 44($sp) # Save in $t0 the left operand address + lw $t1, 40($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 36($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Jumping to end_of_equal + j end_of_equal + + end_of_equal: + + # Loading return value in $v1 + lw $v1, 36($sp) + + # Freeing space for local variables + addi $sp, $sp, 40 + + jr $ra + + function_assign: + # Function parameters + # $ra = 36($sp) + # dest = 32($sp) + # source = 28($sp) + + # Reserving space for local variables + addi $sp, $sp, -28 + + # Allocating NUll to internal_0 + sw $zero, 24($sp) # internal_0 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_1 = address of allocated object Int + + # internal_1 = EqualAddress(source, internal_0) + lw $t0, 28($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # internal_1 = EqualAddress(dest, internal_0) + lw $t0, 32($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # If internal_1 then goto source_is_type_object + lw $t0, 20($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_object + + # internal_2 = typeof source that is the first word of the object + lw $t0, 28($sp) + lw $t0, 0($t0) + sw $t0, 16($sp) + + # internal_3 = direction of Int + la $t0, type_Int + sw $t0, 12($sp) + + # internal_4 = direction of Bool + la $t0, type_Bool + sw $t0, 8($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_5 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_6 = address of allocated object Int + + # internal_5 = EqualAddress(internal_2, internal_3) + lw $t0, 16($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_6 = EqualAddress(internal_2, internal_4) + lw $t0, 16($sp) + lw $t1, 8($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_5 then goto source_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # If internal_6 then goto source_is_type_int_or_bool + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # Jumping to source_is_type_object + j source_is_type_object + + source_is_type_int_or_bool: + + # dest = source where source is an integer + li $v0, 9 + addi $a0, $zero, 12 + syscall + lw $t0, 28($sp) # Pointer to source + lw $t1, 0($t0) # $t1 = type of source + lw $t2, 8($t0) # $t2 = value of source + sw $t1, 0($v0) # Save type of dest + sw $a0, 4($v0) # Save size of dest + sw $t2, 8($v0) # Save value of dest + sw $v0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_is_type_object: + + # dest = source + lw $t0, 28($sp) + sw $t0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_end_of_equal: + + # Loading return value in $v1 + lw $v1, 32($sp) + + # Freeing space for local variables + addi $sp, $sp, 28 + + jr $ra + + function___init___at_Object: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_abort_at_Object: + # Function parameters + # $ra = 28($sp) + # self = 24($sp) + + # Reserving space for local variables + addi $sp, $sp, -24 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 33 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 33 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 65 + sb $t0, 8($v0) # internal_0[0] = 'A' + + addi $t0, $zero, 98 + sb $t0, 9($v0) # internal_0[1] = 'b' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_0[2] = 'o' + + addi $t0, $zero, 114 + sb $t0, 11($v0) # internal_0[3] = 'r' + + addi $t0, $zero, 116 + sb $t0, 12($v0) # internal_0[4] = 't' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_0[5] = ' ' + + addi $t0, $zero, 99 + sb $t0, 14($v0) # internal_0[6] = 'c' + + addi $t0, $zero, 97 + sb $t0, 15($v0) # internal_0[7] = 'a' + + addi $t0, $zero, 108 + sb $t0, 16($v0) # internal_0[8] = 'l' + + addi $t0, $zero, 108 + sb $t0, 17($v0) # internal_0[9] = 'l' + + addi $t0, $zero, 101 + sb $t0, 18($v0) # internal_0[10] = 'e' + + addi $t0, $zero, 100 + sb $t0, 19($v0) # internal_0[11] = 'd' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_0[12] = ' ' + + addi $t0, $zero, 102 + sb $t0, 21($v0) # internal_0[13] = 'f' + + addi $t0, $zero, 114 + sb $t0, 22($v0) # internal_0[14] = 'r' + + addi $t0, $zero, 111 + sb $t0, 23($v0) # internal_0[15] = 'o' + + addi $t0, $zero, 109 + sb $t0, 24($v0) # internal_0[16] = 'm' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_0[17] = ' ' + + addi $t0, $zero, 99 + sb $t0, 26($v0) # internal_0[18] = 'c' + + addi $t0, $zero, 108 + sb $t0, 27($v0) # internal_0[19] = 'l' + + addi $t0, $zero, 97 + sb $t0, 28($v0) # internal_0[20] = 'a' + + addi $t0, $zero, 115 + sb $t0, 29($v0) # internal_0[21] = 's' + + addi $t0, $zero, 115 + sb $t0, 30($v0) # internal_0[22] = 's' + + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_0[23] = ' ' + + sb $zero, 32($v0) # Null-terminator at the end of the string + + sw $v0, 20($sp) # internal_0 = "Abort called from class " + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_3[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 8($sp) # internal_3 = "\n" + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method type_name of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_5 + lw $t0, 8($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 24($sp) # internal_1 = result of internal_5 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_1 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_2 = result of internal_5 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_3 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_2 = result of internal_5 + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 12($sp) # $t0 = internal_2 + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the String internal_2 + li $v0, 4 + move $a0, $t0 + syscall + + # Exit program + li $v0, 10 + syscall + + # Loading return value in $v1 + lw $v1, 24($sp) + + # Freeing space for local variables + addi $sp, $sp, 24 + + jr $ra + + function_type_name_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = name of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 8($t1) # $t2 = direction of the type name + la $t3, 4($t2) # $t3 = address of the name + lw $t2, 0($t2) # $t2 = length of the name + + addi $t2, $t2, 9 # Setting space for the type, the size and the null byte + li $v0, 9 + move $a0, $t2 + syscall + addi $t2, $t2, -9 # Restoring space for the type, the size and the null byte + + la $t4, type_String + sw $t4, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t4, $v0, 0 # $t4 = direction of the new string + addi $t4, $t4, 8 # Pointer to the first character of the string + xor $t5, $t5, $t5 # Initializing counter + while_copy_name_start: + beq $t5, $t2, while_copy_name_end + lb $t6, 0($t3) # Loading the character + sb $t6, 0($t4) + addi $t4, $t4, 1 # Incrementing the pointer to the new string + addi $t3, $t3, 1 # Incrementing the pointer to the string in self + addi $t5, $t5, 1 # Incrementing counter + j while_copy_name_start + while_copy_name_end: + + sb $zero, 0($t4) # Setting the null byte + + sw $v0, 0($sp) # Storing the new string in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_copy_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = copy of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 4($t0) # $t2 = length of self in bytes + + # Allocating space for the new object + li $v0, 9 + move $a0, $t2 + syscall + move $t3, $v0 # $t3 = direction of the new object + sw $t1, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + # Initializing the variable of the loop + addi $t0, $t0, 8 # Pointer to the first character of the object + addi $t3, $t3, 8 # Pointer to the first character of the object + addi $t2, $2, -8 # Decrementing in 8 the length of the object + xor $t4, $t4, $t4 # Initializing counter + + # Loop copying the object + while_copy_start: + beq $t4, $t2, while_copy_end + lb $t5, 0($t0) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t0, $t0, 1 # Incrementing the pointer to the object + addi $t3, $t3, 1 # Incrementing the pointer to the new object + addi $t4, $t4, 1 # Incrementing counter + j while_copy_start + while_copy_end: + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_IO: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_out_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + lw $t0, 0($sp) # $t0 = x + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the String x + li $v0, 4 + move $a0, $t0 + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_out_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + # Printing the Int x + li $v0, 1 + lw $a0, 0($sp) + lw $a0, 8($a0) + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_in_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + li $v0, 8 + la $a0, buffer_input + li $a1, 1024 + syscall + + xor $t0, $t0, $t0 # Initializing counter + while_read_start: + lb $t1, buffer_input($t0) # Loading the byte + addi $t2, $zero, 10 + beq $t1, $t2, while_read_end + addi $t2, $zero, 13 + beq $t1, $t2, while_read_end + addi $t0, $t0, 1 # Incrementing counter + j while_read_start + while_read_end: + + addi $t0, $t0, 9 # Adding space for the type, the size and the null byte + li $v0, 9 + move $a0, $t0 + syscall + addi $t0, $t0, -9 # Adding space for the type, the size and the null byte + la $t2, type_String + sw $t2, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t3, $v0, 8 # Pointer to the first character of the string + xor $t4, $t4, $t4 # Initializing counter + + while_copy_from_buffer_start: + beq $t4, $t0, while_copy_from_buffer_end + lb $t5, buffer_input($t4) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t3, $t3, 1 # Imcremeenting pointer + addi $t4, $t4, 1 # Incrementing counter + j while_copy_from_buffer_start + while_copy_from_buffer_end: + + sb $zero, 0($t3) # Storing the null byte + + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_in_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + li $v0, 5 + syscall + lw $t0, 0($sp) + sw $v0, 8($t0) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_String: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_length_at_String: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # internal_0 = length of self + lw $t0, 4($sp) + lw $t1, 4($t0) + addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator + lw $t0, 0($sp) + sw $t1, 8($t0) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_concat_at_String: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + # s = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self + s + lw $t0, 8($sp) + lw $t1, 4($sp) + lw $t2, 4($t0) # $t2 = length of str1 + lw $t3, 4($t1) # $t3 = length of str2 + addi $t2, $t2, -9 + addi $t3, $t3, -9 + add $t4, $t2, $t3 # $t4 = length of str1 + str2 + addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) + + li $v0, 9 + move $a0, $t4 + syscall + addi $t4, $t4, -9 # Restoring $t4 = length of str1 + str2 + add $t5, $zero, $v0 # $t5 = address of the new string object + addi $t5, $t5, 8 # $t5 = address of the first byte of the new string + + la $t8, type_String + sw $t8, 0($v0) # Setting type in the first word of th object + + sw $a0, 4($v0) # Setting length of the string in the second word of the object + + # Copying str1 to the new string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_str1_start: + beq $t6, $t2, while_copy_str1_end + lb $t7, 8($t0) + sb $t7, 0($t5) + add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str1_start + while_copy_str1_end: + + # Copying str2 to the new string + while_copy_str2_start: + beq $t6, $t4, while_copy_str2_end + lb $t7, 8($t1) + sb $t7, 0($t5) + add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str2_start + while_copy_str2_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self + s + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_substr_at_String: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + # i = 8($sp) + # l = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self[i:i + l] + lw $t0, 12($sp) # $t0 = address of the string + lw $t1, 4($t0) # $t1 = length of the string + addi $t1, $t1, -9 # $t1 = length of the string + 9 + lw $t2, 8($sp) # $t2 = start of the substring + lw $t2, 8($t2) + lw $t3, 4($sp) # $t3 = length of the substring + lw $t3, 8($t3) + add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring + + bgt $t4, $t1, substring_out_of_bounds + + addi $t3, $t3, 9 + li $v0, 9 + move $a0, $t3 + syscall + addi $t3, $t3, -9 + + la $t5, type_String + sw $t5, 0($v0) # Setting type in the first word of the object + + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t0, $t0, 8 # pointing to the first byte of the string + add $t0, $t0, $t2 # pointing to the first byte of the substring + move $t5, $v0 # $t5 = address of the new string + add $t5, $t5, 8 # pointing to the first byte of the string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_substr_start: + beq $t6, $t3, while_copy_substr_end + lb $t7, 0($t0) + sb $t7, 0($t5) + addi $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of the string + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_substr_start + while_copy_substr_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self[i:i + l] + j substring_not_out_of_bounds + + substring_out_of_bounds: + li $v0, 17 + addi $a0, $zero, 1 + syscall + + substring_not_out_of_bounds: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_Int: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function___init___at_Bool: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function___init___at_Main: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_main_at_Main: + # Function parameters + # $ra = 20($sp) + # self = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 23 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 23 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 72 + sb $t0, 8($v0) # internal_0[0] = 'H' + + addi $t0, $zero, 101 + sb $t0, 9($v0) # internal_0[1] = 'e' + + addi $t0, $zero, 108 + sb $t0, 10($v0) # internal_0[2] = 'l' + + addi $t0, $zero, 108 + sb $t0, 11($v0) # internal_0[3] = 'l' + + addi $t0, $zero, 111 + sb $t0, 12($v0) # internal_0[4] = 'o' + + addi $t0, $zero, 44 + sb $t0, 13($v0) # internal_0[5] = ',' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_0[6] = ' ' + + addi $t0, $zero, 87 + sb $t0, 15($v0) # internal_0[7] = 'W' + + addi $t0, $zero, 111 + sb $t0, 16($v0) # internal_0[8] = 'o' + + addi $t0, $zero, 114 + sb $t0, 17($v0) # internal_0[9] = 'r' + + addi $t0, $zero, 108 + sb $t0, 18($v0) # internal_0[10] = 'l' + + addi $t0, $zero, 100 + sb $t0, 19($v0) # internal_0[11] = 'd' + + addi $t0, $zero, 46 + sb $t0, 20($v0) # internal_0[12] = '.' + + addi $t0, $zero, 10 + sb $t0, 21($v0) # internal_0[13] = '\n' + + sb $zero, 22($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_0 = "Hello, World.\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_2 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 16($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_0 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function internal_3 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_1 = result of internal_3 + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 + + jr $ra + + main: + # Reserving space for local variables + addi $sp, $sp, -16 + + # Allocating Main + li $v0, 9 + lw $a0, type_Main + syscall + la $t0, type_Main # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 12($sp) # internal_0 = address of allocated object Main + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_Main + jal function___init___at_Main + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_0 = result of function___init___at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_2 = address of allocated object Int + + # Get method main of Main + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function internal_3 + lw $t0, 8($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_1 = result of internal_3 + addi $sp, $sp, 8 # Freeing space for arguments + + # Exit program + li $v0, 10 + syscall + + \ No newline at end of file diff --git a/tests/codegen/hello_world_output.txt b/tests/codegen/hello_world_output.txt index 349db2bfe..9c1c7a002 100644 --- a/tests/codegen/hello_world_output.txt +++ b/tests/codegen/hello_world_output.txt @@ -1 +1 @@ -Hello, World. +Hello, World. diff --git a/tests/codegen/io.cl b/tests/codegen/io.cl index 7f0de869e..42ee6854e 100755 --- a/tests/codegen/io.cl +++ b/tests/codegen/io.cl @@ -1,103 +1,103 @@ -(* - * The IO class is predefined and has 4 methods: - * - * out_string(s : String) : SELF_TYPE - * out_int(i : Int) : SELF_TYPE - * in_string() : String - * in_int() : Int - * - * The out operations print their argument to the terminal. The - * in_string method reads an entire line from the terminal and returns a - * string not containing the new line. The in_int method also reads - * an entire line from the terminal and returns the integer - * corresponding to the first non blank word on the line. If that - * word is not an integer, it returns 0. - * - * - * Because our language is object oriented, we need an object of type - * IO in order to call any of these methods. - * - * There are basically two ways of getting access to IO in a class C. - * - * 1) Define C to Inherit from IO. This way the IO methods become - * methods of C, and they can be called using the abbreviated - * dispatch, i.e. - * - * class C inherits IO is - * ... - * out_string("Hello world\n") - * ... - * end; - * - * 2) If your class C does not directly or indirectly inherit from - * IO, the best way to access IO is through an initialized - * attribute of type IO. - * - * class C inherits Foo is - * io : IO <- new IO; - * ... - * io.out_string("Hello world\n"); - * ... - * end; - * - * Approach 1) is most often used, in particular when you need IO - * functions in the Main class. - * - *) - - -class A { - - -- Let's assume that we don't want A to not inherit from IO. - - io : IO <- new IO; - - out_a() : Object { io.out_string("A: Hello world\n") }; - -}; - - -class B inherits A { - - -- B does not have to an extra attribute, since it inherits io from A. - - out_b() : Object { io.out_string("B: Hello world\n") }; - -}; - - -class C inherits IO { - - -- Now the IO methods are part of C. - - out_c() : Object { out_string("C: Hello world\n") }; - - -- Note that out_string(...) is just a shorthand for self.out_string(...) - -}; - - -class D inherits C { - - -- Inherits IO methods from C. - - out_d() : Object { out_string("D: Hello world\n") }; - -}; - - -class Main inherits IO { - - -- Same case as class C. - - main() : Object { - { - (new A).out_a(); - (new B).out_b(); - (new C).out_c(); - (new D).out_d(); - out_string("Done.\n"); - } - }; - -}; +(* + * The IO class is predefined and has 4 methods: + * + * out_string(s : String) : SELF_TYPE + * out_int(i : Int) : SELF_TYPE + * in_string() : String + * in_int() : Int + * + * The out operations print their argument to the terminal. The + * in_string method reads an entire line from the terminal and returns a + * string not containing the new line. The in_int method also reads + * an entire line from the terminal and returns the integer + * corresponding to the first non blank word on the line. If that + * word is not an integer, it returns 0. + * + * + * Because our language is object oriented, we need an object of type + * IO in order to call any of these methods. + * + * There are basically two ways of getting access to IO in a class C. + * + * 1) Define C to Inherit from IO. This way the IO methods become + * methods of C, and they can be called using the abbreviated + * dispatch, i.e. + * + * class C inherits IO is + * ... + * out_string("Hello world\n") + * ... + * end; + * + * 2) If your class C does not directly or indirectly inherit from + * IO, the best way to access IO is through an initialized + * attribute of type IO. + * + * class C inherits Foo is + * io : IO <- new IO; + * ... + * io.out_string("Hello world\n"); + * ... + * end; + * + * Approach 1) is most often used, in particular when you need IO + * functions in the Main class. + * + *) + + +class A { + + -- Let's assume that we don't want A to not inherit from IO. + + io : IO <- new IO; + + out_a() : Object { io.out_string("A: Hello world\n") }; + +}; + + +class B inherits A { + + -- B does not have to an extra attribute, since it inherits io from A. + + out_b() : Object { io.out_string("B: Hello world\n") }; + +}; + + +class C inherits IO { + + -- Now the IO methods are part of C. + + out_c() : Object { out_string("C: Hello world\n") }; + + -- Note that out_string(...) is just a shorthand for self.out_string(...) + +}; + + +class D inherits C { + + -- Inherits IO methods from C. + + out_d() : Object { out_string("D: Hello world\n") }; + +}; + + +class Main inherits IO { + + -- Same case as class C. + + main() : Object { + { + (new A).out_a(); + (new B).out_b(); + (new C).out_c(); + (new D).out_d(); + out_string("Done.\n"); + } + }; + +}; diff --git a/tests/codegen/io.mips b/tests/codegen/io.mips new file mode 100644 index 000000000..c1d9b7cda --- /dev/null +++ b/tests/codegen/io.mips @@ -0,0 +1,2612 @@ +.data + type_Object: .word 24 + type_Object_inherits_from: .word 0 + type_Object_name_address: .word type_Object_name_size + type_Object___init__: .word function___init___at_Object + type_Object_abort: .word function_abort_at_Object + type_Object_type_name: .word function_type_name_at_Object + type_Object_copy: .word function_copy_at_Object + + type_IO: .word 40 + type_IO_inherits_from: .word type_Object + type_IO_name_address: .word type_IO_name_size + type_IO___init__: .word function___init___at_IO + type_IO_abort: .word function_abort_at_Object + type_IO_type_name: .word function_type_name_at_Object + type_IO_copy: .word function_copy_at_Object + type_IO_out_string: .word function_out_string_at_IO + type_IO_out_int: .word function_out_int_at_IO + type_IO_in_string: .word function_in_string_at_IO + type_IO_in_int: .word function_in_int_at_IO + + type_String: .word 36 + type_String_inherits_from: .word type_Object + type_String_name_address: .word type_String_name_size + type_String___init__: .word function___init___at_String + type_String_abort: .word function_abort_at_Object + type_String_type_name: .word function_type_name_at_Object + type_String_copy: .word function_copy_at_Object + type_String_length: .word function_length_at_String + type_String_concat: .word function_concat_at_String + type_String_substr: .word function_substr_at_String + + type_Int: .word 24 + type_Int_inherits_from: .word type_Object + type_Int_name_address: .word type_Int_name_size + type_Int___init__: .word function___init___at_Int + type_Int_abort: .word function_abort_at_Object + type_Int_type_name: .word function_type_name_at_Object + type_Int_copy: .word function_copy_at_Object + + type_Bool: .word 24 + type_Bool_inherits_from: .word type_Object + type_Bool_name_address: .word type_Bool_name_size + type_Bool___init__: .word function___init___at_Bool + type_Bool_abort: .word function_abort_at_Object + type_Bool_type_name: .word function_type_name_at_Object + type_Bool_copy: .word function_copy_at_Object + + type_A: .word 32 + type_A_inherits_from: .word type_Object + type_A_name_address: .word type_A_name_size + type_A___init__: .word function___init___at_A + type_A_abort: .word function_abort_at_Object + type_A_type_name: .word function_type_name_at_Object + type_A_copy: .word function_copy_at_Object + type_A_out_a: .word function_out_a_at_A + + type_B: .word 36 + type_B_inherits_from: .word type_A + type_B_name_address: .word type_B_name_size + type_B___init__: .word function___init___at_B + type_B_abort: .word function_abort_at_Object + type_B_type_name: .word function_type_name_at_Object + type_B_copy: .word function_copy_at_Object + type_B_out_a: .word function_out_a_at_A + type_B_out_b: .word function_out_b_at_B + + type_C: .word 44 + type_C_inherits_from: .word type_IO + type_C_name_address: .word type_C_name_size + type_C___init__: .word function___init___at_C + type_C_abort: .word function_abort_at_Object + type_C_type_name: .word function_type_name_at_Object + type_C_copy: .word function_copy_at_Object + type_C_out_string: .word function_out_string_at_IO + type_C_out_int: .word function_out_int_at_IO + type_C_in_string: .word function_in_string_at_IO + type_C_in_int: .word function_in_int_at_IO + type_C_out_c: .word function_out_c_at_C + + type_D: .word 48 + type_D_inherits_from: .word type_C + type_D_name_address: .word type_D_name_size + type_D___init__: .word function___init___at_D + type_D_abort: .word function_abort_at_Object + type_D_type_name: .word function_type_name_at_Object + type_D_copy: .word function_copy_at_Object + type_D_out_string: .word function_out_string_at_IO + type_D_out_int: .word function_out_int_at_IO + type_D_in_string: .word function_in_string_at_IO + type_D_in_int: .word function_in_int_at_IO + type_D_out_c: .word function_out_c_at_C + type_D_out_d: .word function_out_d_at_D + + type_Main: .word 44 + type_Main_inherits_from: .word type_IO + type_Main_name_address: .word type_Main_name_size + type_Main___init__: .word function___init___at_Main + type_Main_abort: .word function_abort_at_Object + type_Main_type_name: .word function_type_name_at_Object + type_Main_copy: .word function_copy_at_Object + type_Main_out_string: .word function_out_string_at_IO + type_Main_out_int: .word function_out_int_at_IO + type_Main_in_string: .word function_in_string_at_IO + type_Main_in_int: .word function_in_int_at_IO + type_Main_main: .word function_main_at_Main + + type_Object_name_size: .word 6 + type_Object_name: .asciiz "Object" + + type_IO_name_size: .word 2 + type_IO_name: .asciiz "IO" + + type_String_name_size: .word 6 + type_String_name: .asciiz "String" + + type_Int_name_size: .word 3 + type_Int_name: .asciiz "Int" + + type_Bool_name_size: .word 4 + type_Bool_name: .asciiz "Bool" + + type_A_name_size: .word 1 + type_A_name: .asciiz "A" + + type_B_name_size: .word 1 + type_B_name: .asciiz "B" + + type_C_name_size: .word 1 + type_C_name: .asciiz "C" + + type_D_name_size: .word 1 + type_D_name: .asciiz "D" + + type_Main_name_size: .word 4 + type_Main_name: .asciiz "Main" + + buffer_input: .space 1024 + debug_log: .asciiz "debug_log\n" + +.text + function_add: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Addition operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + add $t2, $t0, $t1 # $t2 = $t0 + $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_sub: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Subtraction operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sub $t2, $t0, $t1 # $t2 = $t0 - $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_mult: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Multiplication operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + mult $t0, $t1 # $t2 = $t0 * $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_div: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Division operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + div $t0, $t1 # $t2 = $t0 / $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_xor: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Xor operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than_or_equal: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sle $t2, $t0, $t1 # $t2 = $t0 <= $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_equal: + # Function parameters + # $ra = 48($sp) + # a = 44($sp) + # b = 40($sp) + + # Reserving space for local variables + addi $sp, $sp, -40 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_0 = address of allocated object Int + + # Allocating NUll to internal_1 + sw $zero, 32($sp) # internal_1 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_2 = address of allocated object Int + + # internal_2 = EqualAddress(a, internal_1) + lw $t0, 44($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # internal_2 = EqualAddress(b, internal_1) + lw $t0, 40($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # If internal_2 then goto a_is_type_object + lw $t0, 28($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_object + + # internal_3 = typeof a that is the first word of the object + lw $t0, 44($sp) + lw $t0, 0($t0) + sw $t0, 24($sp) + + # internal_4 = direction of Int + la $t0, type_Int + sw $t0, 20($sp) + + # internal_5 = direction of Bool + la $t0, type_Bool + sw $t0, 16($sp) + + # internal_6 = direction of String + la $t0, type_String + sw $t0, 12($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_7 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_8 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_9 = address of allocated object Int + + # internal_7 = EqualAddress(internal_3, internal_4) + lw $t0, 24($sp) + lw $t1, 20($sp) + seq $t2, $t0, $t1 + lw $t0, 8($sp) + sw $t2, 8($t0) + + # internal_8 = EqualAddress(internal_3, internal_5) + lw $t0, 24($sp) + lw $t1, 16($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_9 = EqualAddress(internal_3, internal_6) + lw $t0, 24($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_7 then goto a_is_type_int_or_bool + lw $t0, 8($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_8 then goto a_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_9 then goto a_is_type_string + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_string + + # Jumping to a_is_type_object + j a_is_type_object + + a_is_type_int_or_bool: + + # internal_0 = EqualInt(a, b) + lw $t0, 44($sp) + lw $t0, 8($t0) + lw $t1, 40($sp) + lw $t1, 8($t1) + seq $t2, $t0, $t1 + lw $t0, 36($sp) + sw $t2, 8($t0) + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_string: + + # internal_0 = EqualStr(a, b) + lw $t0, 44($sp) + lw $t1, 40($sp) + addi $t0, $t0, 8 + addi $t1, $t1, 8 + + # By default we assume the strings are equals + addi $t4, $zero, 1 + lw $t5, 36($sp) + sw $t4, 8($t5) + + while_compare_strings_start: + lb $t2, 0($t0) + lb $t3, 0($t1) + beq $t2, $t3, while_compare_strings_update + + # The strings are no equals + lw $t5, 36($sp) + sw $zero, 8($t5) + j while_compare_strings_end + + while_compare_strings_update: + addi $t0, $t0, 1 + addi $t1, $t1, 1 + beq $t2, $zero, while_compare_strings_end + beq $t3, $zero, while_compare_strings_end + j while_compare_strings_start + while_compare_strings_end: + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_object: + + # Equal operation + lw $t0, 44($sp) # Save in $t0 the left operand address + lw $t1, 40($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 36($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Jumping to end_of_equal + j end_of_equal + + end_of_equal: + + # Loading return value in $v1 + lw $v1, 36($sp) + + # Freeing space for local variables + addi $sp, $sp, 40 + + jr $ra + + function_assign: + # Function parameters + # $ra = 36($sp) + # dest = 32($sp) + # source = 28($sp) + + # Reserving space for local variables + addi $sp, $sp, -28 + + # Allocating NUll to internal_0 + sw $zero, 24($sp) # internal_0 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_1 = address of allocated object Int + + # internal_1 = EqualAddress(source, internal_0) + lw $t0, 28($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # internal_1 = EqualAddress(dest, internal_0) + lw $t0, 32($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # If internal_1 then goto source_is_type_object + lw $t0, 20($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_object + + # internal_2 = typeof source that is the first word of the object + lw $t0, 28($sp) + lw $t0, 0($t0) + sw $t0, 16($sp) + + # internal_3 = direction of Int + la $t0, type_Int + sw $t0, 12($sp) + + # internal_4 = direction of Bool + la $t0, type_Bool + sw $t0, 8($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_5 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_6 = address of allocated object Int + + # internal_5 = EqualAddress(internal_2, internal_3) + lw $t0, 16($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_6 = EqualAddress(internal_2, internal_4) + lw $t0, 16($sp) + lw $t1, 8($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_5 then goto source_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # If internal_6 then goto source_is_type_int_or_bool + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # Jumping to source_is_type_object + j source_is_type_object + + source_is_type_int_or_bool: + + # dest = source where source is an integer + li $v0, 9 + addi $a0, $zero, 12 + syscall + lw $t0, 28($sp) # Pointer to source + lw $t1, 0($t0) # $t1 = type of source + lw $t2, 8($t0) # $t2 = value of source + sw $t1, 0($v0) # Save type of dest + sw $a0, 4($v0) # Save size of dest + sw $t2, 8($v0) # Save value of dest + sw $v0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_is_type_object: + + # dest = source + lw $t0, 28($sp) + sw $t0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_end_of_equal: + + # Loading return value in $v1 + lw $v1, 32($sp) + + # Freeing space for local variables + addi $sp, $sp, 28 + + jr $ra + + function___init___at_Object: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_abort_at_Object: + # Function parameters + # $ra = 28($sp) + # self = 24($sp) + + # Reserving space for local variables + addi $sp, $sp, -24 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 33 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 33 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 65 + sb $t0, 8($v0) # internal_0[0] = 'A' + + addi $t0, $zero, 98 + sb $t0, 9($v0) # internal_0[1] = 'b' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_0[2] = 'o' + + addi $t0, $zero, 114 + sb $t0, 11($v0) # internal_0[3] = 'r' + + addi $t0, $zero, 116 + sb $t0, 12($v0) # internal_0[4] = 't' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_0[5] = ' ' + + addi $t0, $zero, 99 + sb $t0, 14($v0) # internal_0[6] = 'c' + + addi $t0, $zero, 97 + sb $t0, 15($v0) # internal_0[7] = 'a' + + addi $t0, $zero, 108 + sb $t0, 16($v0) # internal_0[8] = 'l' + + addi $t0, $zero, 108 + sb $t0, 17($v0) # internal_0[9] = 'l' + + addi $t0, $zero, 101 + sb $t0, 18($v0) # internal_0[10] = 'e' + + addi $t0, $zero, 100 + sb $t0, 19($v0) # internal_0[11] = 'd' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_0[12] = ' ' + + addi $t0, $zero, 102 + sb $t0, 21($v0) # internal_0[13] = 'f' + + addi $t0, $zero, 114 + sb $t0, 22($v0) # internal_0[14] = 'r' + + addi $t0, $zero, 111 + sb $t0, 23($v0) # internal_0[15] = 'o' + + addi $t0, $zero, 109 + sb $t0, 24($v0) # internal_0[16] = 'm' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_0[17] = ' ' + + addi $t0, $zero, 99 + sb $t0, 26($v0) # internal_0[18] = 'c' + + addi $t0, $zero, 108 + sb $t0, 27($v0) # internal_0[19] = 'l' + + addi $t0, $zero, 97 + sb $t0, 28($v0) # internal_0[20] = 'a' + + addi $t0, $zero, 115 + sb $t0, 29($v0) # internal_0[21] = 's' + + addi $t0, $zero, 115 + sb $t0, 30($v0) # internal_0[22] = 's' + + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_0[23] = ' ' + + sb $zero, 32($v0) # Null-terminator at the end of the string + + sw $v0, 20($sp) # internal_0 = "Abort called from class " + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_3[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 8($sp) # internal_3 = "\n" + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method type_name of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_5 + lw $t0, 8($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 24($sp) # internal_1 = result of internal_5 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_1 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_2 = result of internal_5 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_3 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_2 = result of internal_5 + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 12($sp) # $t0 = internal_2 + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the String internal_2 + li $v0, 4 + move $a0, $t0 + syscall + + # Exit program + li $v0, 10 + syscall + + # Loading return value in $v1 + lw $v1, 24($sp) + + # Freeing space for local variables + addi $sp, $sp, 24 + + jr $ra + + function_type_name_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = name of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 8($t1) # $t2 = direction of the type name + la $t3, 4($t2) # $t3 = address of the name + lw $t2, 0($t2) # $t2 = length of the name + + addi $t2, $t2, 9 # Setting space for the type, the size and the null byte + li $v0, 9 + move $a0, $t2 + syscall + addi $t2, $t2, -9 # Restoring space for the type, the size and the null byte + + la $t4, type_String + sw $t4, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t4, $v0, 0 # $t4 = direction of the new string + addi $t4, $t4, 8 # Pointer to the first character of the string + xor $t5, $t5, $t5 # Initializing counter + while_copy_name_start: + beq $t5, $t2, while_copy_name_end + lb $t6, 0($t3) # Loading the character + sb $t6, 0($t4) + addi $t4, $t4, 1 # Incrementing the pointer to the new string + addi $t3, $t3, 1 # Incrementing the pointer to the string in self + addi $t5, $t5, 1 # Incrementing counter + j while_copy_name_start + while_copy_name_end: + + sb $zero, 0($t4) # Setting the null byte + + sw $v0, 0($sp) # Storing the new string in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_copy_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = copy of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 4($t0) # $t2 = length of self in bytes + + # Allocating space for the new object + li $v0, 9 + move $a0, $t2 + syscall + move $t3, $v0 # $t3 = direction of the new object + sw $t1, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + # Initializing the variable of the loop + addi $t0, $t0, 8 # Pointer to the first character of the object + addi $t3, $t3, 8 # Pointer to the first character of the object + addi $t2, $2, -8 # Decrementing in 8 the length of the object + xor $t4, $t4, $t4 # Initializing counter + + # Loop copying the object + while_copy_start: + beq $t4, $t2, while_copy_end + lb $t5, 0($t0) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t0, $t0, 1 # Incrementing the pointer to the object + addi $t3, $t3, 1 # Incrementing the pointer to the new object + addi $t4, $t4, 1 # Incrementing counter + j while_copy_start + while_copy_end: + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_IO: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_out_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + lw $t0, 0($sp) # $t0 = x + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the String x + li $v0, 4 + move $a0, $t0 + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_out_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + # Printing the Int x + li $v0, 1 + lw $a0, 0($sp) + lw $a0, 8($a0) + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_in_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + li $v0, 8 + la $a0, buffer_input + li $a1, 1024 + syscall + + xor $t0, $t0, $t0 # Initializing counter + while_read_start: + lb $t1, buffer_input($t0) # Loading the byte + addi $t2, $zero, 10 + beq $t1, $t2, while_read_end + addi $t2, $zero, 13 + beq $t1, $t2, while_read_end + addi $t0, $t0, 1 # Incrementing counter + j while_read_start + while_read_end: + + addi $t0, $t0, 9 # Adding space for the type, the size and the null byte + li $v0, 9 + move $a0, $t0 + syscall + addi $t0, $t0, -9 # Adding space for the type, the size and the null byte + la $t2, type_String + sw $t2, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t3, $v0, 8 # Pointer to the first character of the string + xor $t4, $t4, $t4 # Initializing counter + + while_copy_from_buffer_start: + beq $t4, $t0, while_copy_from_buffer_end + lb $t5, buffer_input($t4) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t3, $t3, 1 # Imcremeenting pointer + addi $t4, $t4, 1 # Incrementing counter + j while_copy_from_buffer_start + while_copy_from_buffer_end: + + sb $zero, 0($t3) # Storing the null byte + + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_in_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + li $v0, 5 + syscall + lw $t0, 0($sp) + sw $v0, 8($t0) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_String: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_length_at_String: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # internal_0 = length of self + lw $t0, 4($sp) + lw $t1, 4($t0) + addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator + lw $t0, 0($sp) + sw $t1, 8($t0) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_concat_at_String: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + # s = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self + s + lw $t0, 8($sp) + lw $t1, 4($sp) + lw $t2, 4($t0) # $t2 = length of str1 + lw $t3, 4($t1) # $t3 = length of str2 + addi $t2, $t2, -9 + addi $t3, $t3, -9 + add $t4, $t2, $t3 # $t4 = length of str1 + str2 + addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) + + li $v0, 9 + move $a0, $t4 + syscall + addi $t4, $t4, -9 # Restoring $t4 = length of str1 + str2 + add $t5, $zero, $v0 # $t5 = address of the new string object + addi $t5, $t5, 8 # $t5 = address of the first byte of the new string + + la $t8, type_String + sw $t8, 0($v0) # Setting type in the first word of th object + + sw $a0, 4($v0) # Setting length of the string in the second word of the object + + # Copying str1 to the new string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_str1_start: + beq $t6, $t2, while_copy_str1_end + lb $t7, 8($t0) + sb $t7, 0($t5) + add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str1_start + while_copy_str1_end: + + # Copying str2 to the new string + while_copy_str2_start: + beq $t6, $t4, while_copy_str2_end + lb $t7, 8($t1) + sb $t7, 0($t5) + add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str2_start + while_copy_str2_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self + s + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_substr_at_String: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + # i = 8($sp) + # l = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self[i:i + l] + lw $t0, 12($sp) # $t0 = address of the string + lw $t1, 4($t0) # $t1 = length of the string + addi $t1, $t1, -9 # $t1 = length of the string + 9 + lw $t2, 8($sp) # $t2 = start of the substring + lw $t2, 8($t2) + lw $t3, 4($sp) # $t3 = length of the substring + lw $t3, 8($t3) + add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring + + bgt $t4, $t1, substring_out_of_bounds + + addi $t3, $t3, 9 + li $v0, 9 + move $a0, $t3 + syscall + addi $t3, $t3, -9 + + la $t5, type_String + sw $t5, 0($v0) # Setting type in the first word of the object + + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t0, $t0, 8 # pointing to the first byte of the string + add $t0, $t0, $t2 # pointing to the first byte of the substring + move $t5, $v0 # $t5 = address of the new string + add $t5, $t5, 8 # pointing to the first byte of the string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_substr_start: + beq $t6, $t3, while_copy_substr_end + lb $t7, 0($t0) + sb $t7, 0($t5) + addi $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of the string + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_substr_start + while_copy_substr_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self[i:i + l] + j substring_not_out_of_bounds + + substring_out_of_bounds: + li $v0, 17 + addi $a0, $zero, 1 + syscall + + substring_not_out_of_bounds: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_Int: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function___init___at_Bool: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function___init___at_A: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating IO + li $v0, 9 + lw $a0, type_IO + syscall + la $t0, type_IO # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 0($sp) # internal_0 = address of allocated object IO + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 8($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_IO + jal function___init___at_IO + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_0 = result of function___init___at_IO + addi $sp, $sp, 8 # Freeing space for arguments + + # Set attribute io of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8786052814141 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8786052814141 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8786052814141 + j object_set_attribute_8786052814141 + int_set_attribute_8786052814141: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.io = internal_0 + j end_set_attribute_8786052814141 + bool_set_attribute_8786052814141: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.io = internal_0 + j end_set_attribute_8786052814141 + object_set_attribute_8786052814141: + sw $t1, 8($t0) # self.io = internal_0 + end_set_attribute_8786052814141: + + # Loading return value in $v1 + lw $v1, 4($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_out_a_at_A: + # Function parameters + # $ra = 24($sp) + # self = 20($sp) + + # Reserving space for local variables + addi $sp, $sp, -20 + + # Get attribute io of self + lw $t0, 20($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'io' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8786052814189 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8786052814189 + j object_get_attribute_8786052814189 + int_get_attribute_8786052814189: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($sp) # internal_0 = self.io + j end_get_attribute_8786052814189 + bool_get_attribute_8786052814189: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($sp) # internal_0 = self.io + j end_get_attribute_8786052814189 + object_get_attribute_8786052814189: + sw $t1, 16($sp) # internal_0 = self.io + end_get_attribute_8786052814189: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 24 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 24 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 65 + sb $t0, 8($v0) # internal_1[0] = 'A' + + addi $t0, $zero, 58 + sb $t0, 9($v0) # internal_1[1] = ':' + + addi $t0, $zero, 32 + sb $t0, 10($v0) # internal_1[2] = ' ' + + addi $t0, $zero, 72 + sb $t0, 11($v0) # internal_1[3] = 'H' + + addi $t0, $zero, 101 + sb $t0, 12($v0) # internal_1[4] = 'e' + + addi $t0, $zero, 108 + sb $t0, 13($v0) # internal_1[5] = 'l' + + addi $t0, $zero, 108 + sb $t0, 14($v0) # internal_1[6] = 'l' + + addi $t0, $zero, 111 + sb $t0, 15($v0) # internal_1[7] = 'o' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_1[8] = ' ' + + addi $t0, $zero, 119 + sb $t0, 17($v0) # internal_1[9] = 'w' + + addi $t0, $zero, 111 + sb $t0, 18($v0) # internal_1[10] = 'o' + + addi $t0, $zero, 114 + sb $t0, 19($v0) # internal_1[11] = 'r' + + addi $t0, $zero, 108 + sb $t0, 20($v0) # internal_1[12] = 'l' + + addi $t0, $zero, 100 + sb $t0, 21($v0) # internal_1[13] = 'd' + + addi $t0, $zero, 10 + sb $t0, 22($v0) # internal_1[14] = '\n' + + sb $zero, 23($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_1 = "A: Hello world\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_3 = address of allocated object Int + + # Get method out_string of IO + lw $t0, 16($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_1 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function internal_4 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_2 = result of internal_4 + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 20 + + jr $ra + + function___init___at_B: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating IO + li $v0, 9 + lw $a0, type_IO + syscall + la $t0, type_IO # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 0($sp) # internal_0 = address of allocated object IO + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 8($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_IO + jal function___init___at_IO + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_0 = result of function___init___at_IO + addi $sp, $sp, 8 # Freeing space for arguments + + # Set attribute io of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8786052814288 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8786052814288 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8786052814288 + j object_set_attribute_8786052814288 + int_set_attribute_8786052814288: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.io = internal_0 + j end_set_attribute_8786052814288 + bool_set_attribute_8786052814288: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.io = internal_0 + j end_set_attribute_8786052814288 + object_set_attribute_8786052814288: + sw $t1, 8($t0) # self.io = internal_0 + end_set_attribute_8786052814288: + + # Loading return value in $v1 + lw $v1, 4($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_out_b_at_B: + # Function parameters + # $ra = 24($sp) + # self = 20($sp) + + # Reserving space for local variables + addi $sp, $sp, -20 + + # Get attribute io of self + lw $t0, 20($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'io' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8786052815364 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8786052815364 + j object_get_attribute_8786052815364 + int_get_attribute_8786052815364: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($sp) # internal_0 = self.io + j end_get_attribute_8786052815364 + bool_get_attribute_8786052815364: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($sp) # internal_0 = self.io + j end_get_attribute_8786052815364 + object_get_attribute_8786052815364: + sw $t1, 16($sp) # internal_0 = self.io + end_get_attribute_8786052815364: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 24 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 24 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 66 + sb $t0, 8($v0) # internal_1[0] = 'B' + + addi $t0, $zero, 58 + sb $t0, 9($v0) # internal_1[1] = ':' + + addi $t0, $zero, 32 + sb $t0, 10($v0) # internal_1[2] = ' ' + + addi $t0, $zero, 72 + sb $t0, 11($v0) # internal_1[3] = 'H' + + addi $t0, $zero, 101 + sb $t0, 12($v0) # internal_1[4] = 'e' + + addi $t0, $zero, 108 + sb $t0, 13($v0) # internal_1[5] = 'l' + + addi $t0, $zero, 108 + sb $t0, 14($v0) # internal_1[6] = 'l' + + addi $t0, $zero, 111 + sb $t0, 15($v0) # internal_1[7] = 'o' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_1[8] = ' ' + + addi $t0, $zero, 119 + sb $t0, 17($v0) # internal_1[9] = 'w' + + addi $t0, $zero, 111 + sb $t0, 18($v0) # internal_1[10] = 'o' + + addi $t0, $zero, 114 + sb $t0, 19($v0) # internal_1[11] = 'r' + + addi $t0, $zero, 108 + sb $t0, 20($v0) # internal_1[12] = 'l' + + addi $t0, $zero, 100 + sb $t0, 21($v0) # internal_1[13] = 'd' + + addi $t0, $zero, 10 + sb $t0, 22($v0) # internal_1[14] = '\n' + + sb $zero, 23($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_1 = "B: Hello world\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_3 = address of allocated object Int + + # Get method out_string of IO + lw $t0, 16($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_1 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function internal_4 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_2 = result of internal_4 + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 20 + + jr $ra + + function___init___at_C: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_out_c_at_C: + # Function parameters + # $ra = 20($sp) + # self = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 24 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 24 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 67 + sb $t0, 8($v0) # internal_0[0] = 'C' + + addi $t0, $zero, 58 + sb $t0, 9($v0) # internal_0[1] = ':' + + addi $t0, $zero, 32 + sb $t0, 10($v0) # internal_0[2] = ' ' + + addi $t0, $zero, 72 + sb $t0, 11($v0) # internal_0[3] = 'H' + + addi $t0, $zero, 101 + sb $t0, 12($v0) # internal_0[4] = 'e' + + addi $t0, $zero, 108 + sb $t0, 13($v0) # internal_0[5] = 'l' + + addi $t0, $zero, 108 + sb $t0, 14($v0) # internal_0[6] = 'l' + + addi $t0, $zero, 111 + sb $t0, 15($v0) # internal_0[7] = 'o' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_0[8] = ' ' + + addi $t0, $zero, 119 + sb $t0, 17($v0) # internal_0[9] = 'w' + + addi $t0, $zero, 111 + sb $t0, 18($v0) # internal_0[10] = 'o' + + addi $t0, $zero, 114 + sb $t0, 19($v0) # internal_0[11] = 'r' + + addi $t0, $zero, 108 + sb $t0, 20($v0) # internal_0[12] = 'l' + + addi $t0, $zero, 100 + sb $t0, 21($v0) # internal_0[13] = 'd' + + addi $t0, $zero, 10 + sb $t0, 22($v0) # internal_0[14] = '\n' + + sb $zero, 23($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_0 = "C: Hello world\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_2 = address of allocated object Int + + # Get method out_string of C + lw $t0, 16($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_0 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function internal_3 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_1 = result of internal_3 + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 + + jr $ra + + function___init___at_D: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_out_d_at_D: + # Function parameters + # $ra = 20($sp) + # self = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 24 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 24 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 68 + sb $t0, 8($v0) # internal_0[0] = 'D' + + addi $t0, $zero, 58 + sb $t0, 9($v0) # internal_0[1] = ':' + + addi $t0, $zero, 32 + sb $t0, 10($v0) # internal_0[2] = ' ' + + addi $t0, $zero, 72 + sb $t0, 11($v0) # internal_0[3] = 'H' + + addi $t0, $zero, 101 + sb $t0, 12($v0) # internal_0[4] = 'e' + + addi $t0, $zero, 108 + sb $t0, 13($v0) # internal_0[5] = 'l' + + addi $t0, $zero, 108 + sb $t0, 14($v0) # internal_0[6] = 'l' + + addi $t0, $zero, 111 + sb $t0, 15($v0) # internal_0[7] = 'o' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_0[8] = ' ' + + addi $t0, $zero, 119 + sb $t0, 17($v0) # internal_0[9] = 'w' + + addi $t0, $zero, 111 + sb $t0, 18($v0) # internal_0[10] = 'o' + + addi $t0, $zero, 114 + sb $t0, 19($v0) # internal_0[11] = 'r' + + addi $t0, $zero, 108 + sb $t0, 20($v0) # internal_0[12] = 'l' + + addi $t0, $zero, 100 + sb $t0, 21($v0) # internal_0[13] = 'd' + + addi $t0, $zero, 10 + sb $t0, 22($v0) # internal_0[14] = '\n' + + sb $zero, 23($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_0 = "D: Hello world\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_2 = address of allocated object Int + + # Get method out_string of D + lw $t0, 16($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_0 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function internal_3 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_1 = result of internal_3 + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 + + jr $ra + + function___init___at_Main: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_main_at_Main: + # Function parameters + # $ra = 84($sp) + # self = 80($sp) + + # Reserving space for local variables + addi $sp, $sp, -80 + + # Allocating A + li $v0, 9 + lw $a0, type_A + syscall + la $t0, type_A # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 76($sp) # internal_0 = address of allocated object A + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 84($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_A + jal function___init___at_A + lw $ra, 4($sp) + sw $v1, 84($sp) # internal_0 = result of function___init___at_A + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 68($sp) # internal_2 = address of allocated object Int + + # Get method out_a of A + lw $t0, 76($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 68($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 64($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 84($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function internal_3 + lw $t0, 72($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 80($sp) # internal_1 = result of internal_3 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating B + li $v0, 9 + lw $a0, type_B + syscall + la $t0, type_B # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 60($sp) # internal_4 = address of allocated object B + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_4 + lw $t0, 68($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function___init___at_B + jal function___init___at_B + lw $ra, 4($sp) + sw $v1, 68($sp) # internal_4 = result of function___init___at_B + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 52($sp) # internal_6 = address of allocated object Int + + # Get method out_b of B + lw $t0, 60($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 52($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 48($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_4 + lw $t0, 68($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function internal_7 + lw $t0, 56($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 64($sp) # internal_5 = result of internal_7 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating C + li $v0, 9 + lw $a0, type_C + syscall + la $t0, type_C # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 44($sp) # internal_8 = address of allocated object C + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_8 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_8 + + # Calling function function___init___at_C + jal function___init___at_C + lw $ra, 4($sp) + sw $v1, 52($sp) # internal_8 = result of function___init___at_C + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_10 = address of allocated object Int + + # Get method out_c of C + lw $t0, 44($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 36($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 32($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_8 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_8 + + # Calling function internal_11 + lw $t0, 40($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 48($sp) # internal_9 = result of internal_11 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating D + li $v0, 9 + lw $a0, type_D + syscall + la $t0, type_D # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 28($sp) # internal_12 = address of allocated object D + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_12 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_12 + + # Calling function function___init___at_D + jal function___init___at_D + lw $ra, 4($sp) + sw $v1, 36($sp) # internal_12 = result of function___init___at_D + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_14 = address of allocated object Int + + # Get method out_d of D + lw $t0, 28($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 20($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 16($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_12 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_12 + + # Calling function internal_15 + lw $t0, 24($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 32($sp) # internal_13 = result of internal_15 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 15 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 15 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 68 + sb $t0, 8($v0) # internal_16[0] = 'D' + + addi $t0, $zero, 111 + sb $t0, 9($v0) # internal_16[1] = 'o' + + addi $t0, $zero, 110 + sb $t0, 10($v0) # internal_16[2] = 'n' + + addi $t0, $zero, 101 + sb $t0, 11($v0) # internal_16[3] = 'e' + + addi $t0, $zero, 46 + sb $t0, 12($v0) # internal_16[4] = '.' + + addi $t0, $zero, 10 + sb $t0, 13($v0) # internal_16[5] = '\n' + + sb $zero, 14($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_16 = "Done.\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_18 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 80($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 92($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_16 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_16 + + # Calling function internal_19 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_17 = result of internal_19 + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 80 + + jr $ra + + main: + # Reserving space for local variables + addi $sp, $sp, -16 + + # Allocating Main + li $v0, 9 + lw $a0, type_Main + syscall + la $t0, type_Main # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 12($sp) # internal_0 = address of allocated object Main + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_Main + jal function___init___at_Main + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_0 = result of function___init___at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_2 = address of allocated object Int + + # Get method main of Main + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function internal_3 + lw $t0, 8($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_1 = result of internal_3 + addi $sp, $sp, 8 # Freeing space for arguments + + # Exit program + li $v0, 10 + syscall + + \ No newline at end of file diff --git a/tests/codegen/io_output.txt b/tests/codegen/io_output.txt index f846f596d..870cffce6 100644 --- a/tests/codegen/io_output.txt +++ b/tests/codegen/io_output.txt @@ -1,5 +1,5 @@ -A: Hello world -B: Hello world -C: Hello world -D: Hello world -Done. +A: Hello world +B: Hello world +C: Hello world +D: Hello world +Done. diff --git a/tests/codegen/life.cl b/tests/codegen/life.cl index b83d97957..7d7a41fdb 100755 --- a/tests/codegen/life.cl +++ b/tests/codegen/life.cl @@ -1,436 +1,436 @@ -(* The Game of Life - Tendo Kayiira, Summer '95 - With code taken from /private/cool/class/examples/cells.cl - - This introduction was taken off the internet. It gives a brief - description of the Game Of Life. It also gives the rules by which - this particular game follows. - - Introduction - - John Conway's Game of Life is a mathematical amusement, but it - is also much more: an insight into how a system of simple - cellualar automata can create complex, odd, and often aesthetically - pleasing patterns. It is played on a cartesian grid of cells - which are either 'on' or 'off' The game gets it's name from the - similarity between the behaviour of these cells and the behaviour - of living organisms. - - The Rules - - The playfield is a cartesian grid of arbitrary size. Each cell in - this grid can be in an 'on' state or an 'off' state. On each 'turn' - (called a generation,) the state of each cell changes simultaneously - depending on it's state and the state of all cells adjacent to it. - - For 'on' cells, - If the cell has 0 or 1 neighbours which are 'on', the cell turns - 'off'. ('dies of loneliness') - If the cell has 2 or 3 neighbours which are 'on', the cell stays - 'on'. (nothing happens to that cell) - If the cell has 4, 5, 6, 7, 8, or 9 neighbours which are 'on', - the cell turns 'off'. ('dies of overcrowding') - - For 'off' cells, - If the cell has 0, 1, 2, 4, 5, 6, 7, 8, or 9 neighbours which - are 'on', the cell stays 'off'. (nothing happens to that cell) - If the cell has 3 neighbours which are 'on', the cell turns - 'on'. (3 neighbouring 'alive' cells 'give birth' to a fourth.) - - Repeat for as many generations as desired. - - *) - - -class Board inherits IO { - - rows : Int; - columns : Int; - board_size : Int; - - size_of_board(initial : String) : Int { - initial.length() - }; - - board_init(start : String) : Board { - (let size :Int <- size_of_board(start) in - { - if size = 15 then - { - rows <- 3; - columns <- 5; - board_size <- size; - } - else if size = 16 then - { - rows <- 4; - columns <- 4; - board_size <- size; - } - else if size = 20 then - { - rows <- 4; - columns <- 5; - board_size <- size; - } - else if size = 21 then - { - rows <- 3; - columns <- 7; - board_size <- size; - } - else if size = 25 then - { - rows <- 5; - columns <- 5; - board_size <- size; - } - else if size = 28 then - { - rows <- 7; - columns <- 4; - board_size <- size; - } - else -- If none of the above fit, then just give - { -- the configuration of the most common board - rows <- 5; - columns <- 5; - board_size <- size; - } - fi fi fi fi fi fi; - self; - } - ) - }; - -}; - - - -class CellularAutomaton inherits Board { - population_map : String; - - init(map : String) : CellularAutomaton { - { - population_map <- map; - board_init(map); - self; - } - }; - - - - - print() : CellularAutomaton { - - (let i : Int <- 0 in - (let num : Int <- board_size in - { - out_string("\n"); - while i < num loop - { - out_string(population_map.substr(i,columns)); - out_string("\n"); - i <- i + columns; - } - pool; - out_string("\n"); - self; - } - ) ) - }; - - num_cells() : Int { - population_map.length() - }; - - cell(position : Int) : String { - if board_size - 1 < position then - " " - else - population_map.substr(position, 1) - fi - }; - - north(position : Int): String { - if (position - columns) < 0 then - " " - else - cell(position - columns) - fi - }; - - south(position : Int): String { - if board_size < (position + columns) then - " " - else - cell(position + columns) - fi - }; - - east(position : Int): String { - if (((position + 1) /columns ) * columns) = (position + 1) then - " " - else - cell(position + 1) - fi - }; - - west(position : Int): String { - if position = 0 then - " " - else - if ((position / columns) * columns) = position then - " " - else - cell(position - 1) - fi fi - }; - - northwest(position : Int): String { - if (position - columns) < 0 then - " " - else if ((position / columns) * columns) = position then - " " - else - north(position - 1) - fi fi - }; - - northeast(position : Int): String { - if (position - columns) < 0 then - " " - else if (((position + 1) /columns ) * columns) = (position + 1) then - " " - else - north(position + 1) - fi fi - }; - - southeast(position : Int): String { - if board_size < (position + columns) then - " " - else if (((position + 1) /columns ) * columns) = (position + 1) then - " " - else - south(position + 1) - fi fi - }; - - southwest(position : Int): String { - if board_size < (position + columns) then - " " - else if ((position / columns) * columns) = position then - " " - else - south(position - 1) - fi fi - }; - - neighbors(position: Int): Int { - { - if north(position) = "X" then 1 else 0 fi - + if south(position) = "X" then 1 else 0 fi - + if east(position) = "X" then 1 else 0 fi - + if west(position) = "X" then 1 else 0 fi - + if northeast(position) = "X" then 1 else 0 fi - + if northwest(position) = "X" then 1 else 0 fi - + if southeast(position) = "X" then 1 else 0 fi - + if southwest(position) = "X" then 1 else 0 fi; - } - }; - - -(* A cell will live if 2 or 3 of it's neighbors are alive. It dies - otherwise. A cell is born if only 3 of it's neighbors are alive. *) - - cell_at_next_evolution(position : Int) : String { - - if neighbors(position) = 3 then - "X" - else - if neighbors(position) = 2 then - if cell(position) = "X" then - "X" - else - "-" - fi - else - "-" - fi fi - }; - - - evolve() : CellularAutomaton { - (let position : Int <- 0 in - (let num : Int <- num_cells() in - (let temp : String in - { - while position < num loop - { - temp <- temp.concat(cell_at_next_evolution(position)); - position <- position + 1; - } - pool; - population_map <- temp; - self; - } - ) ) ) - }; - -(* This is where the background pattern is detremined by the user. More - patterns can be added as long as whoever adds keeps the board either - 3x5, 4x5, 5x5, 3x7, 7x4, 4x4 with the row first then column. *) - option(): String { - { - (let num : Int in - { - out_string("\nPlease chose a number:\n"); - out_string("\t1: A cross\n"); - out_string("\t2: A slash from the upper left to lower right\n"); - out_string("\t3: A slash from the upper right to lower left\n"); - out_string("\t4: An X\n"); - out_string("\t5: A greater than sign \n"); - out_string("\t6: A less than sign\n"); - out_string("\t7: Two greater than signs\n"); - out_string("\t8: Two less than signs\n"); - out_string("\t9: A 'V'\n"); - out_string("\t10: An inverse 'V'\n"); - out_string("\t11: Numbers 9 and 10 combined\n"); - out_string("\t12: A full grid\n"); - out_string("\t13: A 'T'\n"); - out_string("\t14: A plus '+'\n"); - out_string("\t15: A 'W'\n"); - out_string("\t16: An 'M'\n"); - out_string("\t17: An 'E'\n"); - out_string("\t18: A '3'\n"); - out_string("\t19: An 'O'\n"); - out_string("\t20: An '8'\n"); - out_string("\t21: An 'S'\n"); - out_string("Your choice => "); - num <- in_int(); - out_string("\n"); - if num = 1 then - " XX XXXX XXXX XX " - else if num = 2 then - " X X X X X " - else if num = 3 then - "X X X X X" - else if num = 4 then - "X X X X X X X X X" - else if num = 5 then - "X X X X X " - else if num = 6 then - " X X X X X" - else if num = 7 then - "X X X XX X " - else if num = 8 then - " X XX X X X " - else if num = 9 then - "X X X X X " - else if num = 10 then - " X X X X X" - else if num = 11 then - "X X X X X X X X" - else if num = 12 then - "XXXXXXXXXXXXXXXXXXXXXXXXX" - else if num = 13 then - "XXXXX X X X X " - else if num = 14 then - " X X XXXXX X X " - else if num = 15 then - "X X X X X X X " - else if num = 16 then - " X X X X X X X" - else if num = 17 then - "XXXXX X XXXXX X XXXX" - else if num = 18 then - "XXX X X X X XXXX " - else if num = 19 then - " XX X XX X XX " - else if num = 20 then - " XX X XX X XX X XX X XX " - else if num = 21 then - " XXXX X XX X XXXX " - else - " " - fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi; - } - ); - } - }; - - - - - prompt() : Bool { - { - (let ans : String in - { - out_string("Would you like to continue with the next generation? \n"); - out_string("Please use lowercase y or n for your answer [y]: "); - ans <- in_string(); - out_string("\n"); - if ans = "n" then - false - else - true - fi; - } - ); - } - }; - - - prompt2() : Bool { - (let ans : String in - { - out_string("\n\n"); - out_string("Would you like to choose a background pattern? \n"); - out_string("Please use lowercase y or n for your answer [n]: "); - ans <- in_string(); - if ans = "y" then - true - else - false - fi; - } - ) - }; - - -}; - -class Main inherits CellularAutomaton { - cells : CellularAutomaton; - - main() : Main { - { - (let continue : Bool in - (let choice : String in - { - out_string("Welcome to the Game of Life.\n"); - out_string("There are many initial states to choose from. \n"); - while prompt2() loop - { - continue <- true; - choice <- option(); - cells <- (new CellularAutomaton).init(choice); - cells.print(); - while continue loop - if prompt() then - { - cells.evolve(); - cells.print(); - } - else - continue <- false - fi - pool; - } - pool; - self; - } ) ); } - }; -}; - +(* The Game of Life + Tendo Kayiira, Summer '95 + With code taken from /private/cool/class/examples/cells.cl + + This introduction was taken off the internet. It gives a brief + description of the Game Of Life. It also gives the rules by which + this particular game follows. + + Introduction + + John Conway's Game of Life is a mathematical amusement, but it + is also much more: an insight into how a system of simple + cellualar automata can create complex, odd, and often aesthetically + pleasing patterns. It is played on a cartesian grid of cells + which are either 'on' or 'off' The game gets it's name from the + similarity between the behaviour of these cells and the behaviour + of living organisms. + + The Rules + + The playfield is a cartesian grid of arbitrary size. Each cell in + this grid can be in an 'on' state or an 'off' state. On each 'turn' + (called a generation,) the state of each cell changes simultaneously + depending on it's state and the state of all cells adjacent to it. + + For 'on' cells, + If the cell has 0 or 1 neighbours which are 'on', the cell turns + 'off'. ('dies of loneliness') + If the cell has 2 or 3 neighbours which are 'on', the cell stays + 'on'. (nothing happens to that cell) + If the cell has 4, 5, 6, 7, 8, or 9 neighbours which are 'on', + the cell turns 'off'. ('dies of overcrowding') + + For 'off' cells, + If the cell has 0, 1, 2, 4, 5, 6, 7, 8, or 9 neighbours which + are 'on', the cell stays 'off'. (nothing happens to that cell) + If the cell has 3 neighbours which are 'on', the cell turns + 'on'. (3 neighbouring 'alive' cells 'give birth' to a fourth.) + + Repeat for as many generations as desired. + + *) + + +class Board inherits IO { + + rows : Int; + columns : Int; + board_size : Int; + + size_of_board(initial : String) : Int { + initial.length() + }; + + board_init(start : String) : Board { + (let size :Int <- size_of_board(start) in + { + if size = 15 then + { + rows <- 3; + columns <- 5; + board_size <- size; + } + else if size = 16 then + { + rows <- 4; + columns <- 4; + board_size <- size; + } + else if size = 20 then + { + rows <- 4; + columns <- 5; + board_size <- size; + } + else if size = 21 then + { + rows <- 3; + columns <- 7; + board_size <- size; + } + else if size = 25 then + { + rows <- 5; + columns <- 5; + board_size <- size; + } + else if size = 28 then + { + rows <- 7; + columns <- 4; + board_size <- size; + } + else -- If none of the above fit, then just give + { -- the configuration of the most common board + rows <- 5; + columns <- 5; + board_size <- size; + } + fi fi fi fi fi fi; + self; + } + ) + }; + +}; + + + +class CellularAutomaton inherits Board { + population_map : String; + + init(map : String) : CellularAutomaton { + { + population_map <- map; + board_init(map); + self; + } + }; + + + + + print() : CellularAutomaton { + + (let i : Int <- 0 in + (let num : Int <- board_size in + { + out_string("\n"); + while i < num loop + { + out_string(population_map.substr(i,columns)); + out_string("\n"); + i <- i + columns; + } + pool; + out_string("\n"); + self; + } + ) ) + }; + + num_cells() : Int { + population_map.length() + }; + + cell(position : Int) : String { + if board_size - 1 < position then + " " + else + population_map.substr(position, 1) + fi + }; + + north(position : Int): String { + if (position - columns) < 0 then + " " + else + cell(position - columns) + fi + }; + + south(position : Int): String { + if board_size < (position + columns) then + " " + else + cell(position + columns) + fi + }; + + east(position : Int): String { + if (((position + 1) /columns ) * columns) = (position + 1) then + " " + else + cell(position + 1) + fi + }; + + west(position : Int): String { + if position = 0 then + " " + else + if ((position / columns) * columns) = position then + " " + else + cell(position - 1) + fi fi + }; + + northwest(position : Int): String { + if (position - columns) < 0 then + " " + else if ((position / columns) * columns) = position then + " " + else + north(position - 1) + fi fi + }; + + northeast(position : Int): String { + if (position - columns) < 0 then + " " + else if (((position + 1) /columns ) * columns) = (position + 1) then + " " + else + north(position + 1) + fi fi + }; + + southeast(position : Int): String { + if board_size < (position + columns) then + " " + else if (((position + 1) /columns ) * columns) = (position + 1) then + " " + else + south(position + 1) + fi fi + }; + + southwest(position : Int): String { + if board_size < (position + columns) then + " " + else if ((position / columns) * columns) = position then + " " + else + south(position - 1) + fi fi + }; + + neighbors(position: Int): Int { + { + if north(position) = "X" then 1 else 0 fi + + if south(position) = "X" then 1 else 0 fi + + if east(position) = "X" then 1 else 0 fi + + if west(position) = "X" then 1 else 0 fi + + if northeast(position) = "X" then 1 else 0 fi + + if northwest(position) = "X" then 1 else 0 fi + + if southeast(position) = "X" then 1 else 0 fi + + if southwest(position) = "X" then 1 else 0 fi; + } + }; + + +(* A cell will live if 2 or 3 of it's neighbors are alive. It dies + otherwise. A cell is born if only 3 of it's neighbors are alive. *) + + cell_at_next_evolution(position : Int) : String { + + if neighbors(position) = 3 then + "X" + else + if neighbors(position) = 2 then + if cell(position) = "X" then + "X" + else + "-" + fi + else + "-" + fi fi + }; + + + evolve() : CellularAutomaton { + (let position : Int <- 0 in + (let num : Int <- num_cells() in + (let temp : String in + { + while position < num loop + { + temp <- temp.concat(cell_at_next_evolution(position)); + position <- position + 1; + } + pool; + population_map <- temp; + self; + } + ) ) ) + }; + +(* This is where the background pattern is detremined by the user. More + patterns can be added as long as whoever adds keeps the board either + 3x5, 4x5, 5x5, 3x7, 7x4, 4x4 with the row first then column. *) + option(): String { + { + (let num : Int in + { + out_string("\nPlease chose a number:\n"); + out_string("\t1: A cross\n"); + out_string("\t2: A slash from the upper left to lower right\n"); + out_string("\t3: A slash from the upper right to lower left\n"); + out_string("\t4: An X\n"); + out_string("\t5: A greater than sign \n"); + out_string("\t6: A less than sign\n"); + out_string("\t7: Two greater than signs\n"); + out_string("\t8: Two less than signs\n"); + out_string("\t9: A 'V'\n"); + out_string("\t10: An inverse 'V'\n"); + out_string("\t11: Numbers 9 and 10 combined\n"); + out_string("\t12: A full grid\n"); + out_string("\t13: A 'T'\n"); + out_string("\t14: A plus '+'\n"); + out_string("\t15: A 'W'\n"); + out_string("\t16: An 'M'\n"); + out_string("\t17: An 'E'\n"); + out_string("\t18: A '3'\n"); + out_string("\t19: An 'O'\n"); + out_string("\t20: An '8'\n"); + out_string("\t21: An 'S'\n"); + out_string("Your choice => "); + num <- in_int(); + out_string("\n"); + if num = 1 then + " XX XXXX XXXX XX " + else if num = 2 then + " X X X X X " + else if num = 3 then + "X X X X X" + else if num = 4 then + "X X X X X X X X X" + else if num = 5 then + "X X X X X " + else if num = 6 then + " X X X X X" + else if num = 7 then + "X X X XX X " + else if num = 8 then + " X XX X X X " + else if num = 9 then + "X X X X X " + else if num = 10 then + " X X X X X" + else if num = 11 then + "X X X X X X X X" + else if num = 12 then + "XXXXXXXXXXXXXXXXXXXXXXXXX" + else if num = 13 then + "XXXXX X X X X " + else if num = 14 then + " X X XXXXX X X " + else if num = 15 then + "X X X X X X X " + else if num = 16 then + " X X X X X X X" + else if num = 17 then + "XXXXX X XXXXX X XXXX" + else if num = 18 then + "XXX X X X X XXXX " + else if num = 19 then + " XX X XX X XX " + else if num = 20 then + " XX X XX X XX X XX X XX " + else if num = 21 then + " XXXX X XX X XXXX " + else + " " + fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi; + } + ); + } + }; + + + + + prompt() : Bool { + { + (let ans : String in + { + out_string("Would you like to continue with the next generation? \n"); + out_string("Please use lowercase y or n for your answer [y]: "); + ans <- in_string(); + out_string("\n"); + if ans = "n" then + false + else + true + fi; + } + ); + } + }; + + + prompt2() : Bool { + (let ans : String in + { + out_string("\n\n"); + out_string("Would you like to choose a background pattern? \n"); + out_string("Please use lowercase y or n for your answer [n]: "); + ans <- in_string(); + if ans = "y" then + true + else + false + fi; + } + ) + }; + + +}; + +class Main inherits CellularAutomaton { + cells : CellularAutomaton; + + main() : Main { + { + (let continue : Bool in + (let choice : String in + { + out_string("Welcome to the Game of Life.\n"); + out_string("There are many initial states to choose from. \n"); + while prompt2() loop + { + continue <- true; + choice <- option(); + cells <- (new CellularAutomaton).init(choice); + cells.print(); + while continue loop + if prompt() then + { + cells.evolve(); + cells.print(); + } + else + continue <- false + fi + pool; + } + pool; + self; + } ) ); } + }; +}; + diff --git a/tests/codegen/life.mips b/tests/codegen/life.mips new file mode 100644 index 000000000..8aa7a5ce6 --- /dev/null +++ b/tests/codegen/life.mips @@ -0,0 +1,18446 @@ +.data + type_Object: .word 24 + type_Object_inherits_from: .word 0 + type_Object_name_address: .word type_Object_name_size + type_Object___init__: .word function___init___at_Object + type_Object_abort: .word function_abort_at_Object + type_Object_type_name: .word function_type_name_at_Object + type_Object_copy: .word function_copy_at_Object + + type_IO: .word 40 + type_IO_inherits_from: .word type_Object + type_IO_name_address: .word type_IO_name_size + type_IO___init__: .word function___init___at_IO + type_IO_abort: .word function_abort_at_Object + type_IO_type_name: .word function_type_name_at_Object + type_IO_copy: .word function_copy_at_Object + type_IO_out_string: .word function_out_string_at_IO + type_IO_out_int: .word function_out_int_at_IO + type_IO_in_string: .word function_in_string_at_IO + type_IO_in_int: .word function_in_int_at_IO + + type_String: .word 36 + type_String_inherits_from: .word type_Object + type_String_name_address: .word type_String_name_size + type_String___init__: .word function___init___at_String + type_String_abort: .word function_abort_at_Object + type_String_type_name: .word function_type_name_at_Object + type_String_copy: .word function_copy_at_Object + type_String_length: .word function_length_at_String + type_String_concat: .word function_concat_at_String + type_String_substr: .word function_substr_at_String + + type_Int: .word 24 + type_Int_inherits_from: .word type_Object + type_Int_name_address: .word type_Int_name_size + type_Int___init__: .word function___init___at_Int + type_Int_abort: .word function_abort_at_Object + type_Int_type_name: .word function_type_name_at_Object + type_Int_copy: .word function_copy_at_Object + + type_Bool: .word 24 + type_Bool_inherits_from: .word type_Object + type_Bool_name_address: .word type_Bool_name_size + type_Bool___init__: .word function___init___at_Bool + type_Bool_abort: .word function_abort_at_Object + type_Bool_type_name: .word function_type_name_at_Object + type_Bool_copy: .word function_copy_at_Object + + type_Board: .word 60 + type_Board_inherits_from: .word type_IO + type_Board_name_address: .word type_Board_name_size + type_Board___init__: .word function___init___at_Board + type_Board_abort: .word function_abort_at_Object + type_Board_type_name: .word function_type_name_at_Object + type_Board_copy: .word function_copy_at_Object + type_Board_out_string: .word function_out_string_at_IO + type_Board_out_int: .word function_out_int_at_IO + type_Board_in_string: .word function_in_string_at_IO + type_Board_in_int: .word function_in_int_at_IO + type_Board_size_of_board: .word function_size_of_board_at_Board + type_Board_board_init: .word function_board_init_at_Board + + type_CellularAutomaton: .word 136 + type_CellularAutomaton_inherits_from: .word type_Board + type_CellularAutomaton_name_address: .word type_CellularAutomaton_name_size + type_CellularAutomaton___init__: .word function___init___at_CellularAutomaton + type_CellularAutomaton_abort: .word function_abort_at_Object + type_CellularAutomaton_type_name: .word function_type_name_at_Object + type_CellularAutomaton_copy: .word function_copy_at_Object + type_CellularAutomaton_out_string: .word function_out_string_at_IO + type_CellularAutomaton_out_int: .word function_out_int_at_IO + type_CellularAutomaton_in_string: .word function_in_string_at_IO + type_CellularAutomaton_in_int: .word function_in_int_at_IO + type_CellularAutomaton_size_of_board: .word function_size_of_board_at_Board + type_CellularAutomaton_board_init: .word function_board_init_at_Board + type_CellularAutomaton_init: .word function_init_at_CellularAutomaton + type_CellularAutomaton_print: .word function_print_at_CellularAutomaton + type_CellularAutomaton_num_cells: .word function_num_cells_at_CellularAutomaton + type_CellularAutomaton_cell: .word function_cell_at_CellularAutomaton + type_CellularAutomaton_north: .word function_north_at_CellularAutomaton + type_CellularAutomaton_south: .word function_south_at_CellularAutomaton + type_CellularAutomaton_east: .word function_east_at_CellularAutomaton + type_CellularAutomaton_west: .word function_west_at_CellularAutomaton + type_CellularAutomaton_northwest: .word function_northwest_at_CellularAutomaton + type_CellularAutomaton_northeast: .word function_northeast_at_CellularAutomaton + type_CellularAutomaton_southeast: .word function_southeast_at_CellularAutomaton + type_CellularAutomaton_southwest: .word function_southwest_at_CellularAutomaton + type_CellularAutomaton_neighbors: .word function_neighbors_at_CellularAutomaton + type_CellularAutomaton_cell_at_next_evolution: .word function_cell_at_next_evolution_at_CellularAutomaton + type_CellularAutomaton_evolve: .word function_evolve_at_CellularAutomaton + type_CellularAutomaton_option: .word function_option_at_CellularAutomaton + type_CellularAutomaton_prompt: .word function_prompt_at_CellularAutomaton + type_CellularAutomaton_prompt2: .word function_prompt2_at_CellularAutomaton + + type_Main: .word 144 + type_Main_inherits_from: .word type_CellularAutomaton + type_Main_name_address: .word type_Main_name_size + type_Main___init__: .word function___init___at_Main + type_Main_abort: .word function_abort_at_Object + type_Main_type_name: .word function_type_name_at_Object + type_Main_copy: .word function_copy_at_Object + type_Main_out_string: .word function_out_string_at_IO + type_Main_out_int: .word function_out_int_at_IO + type_Main_in_string: .word function_in_string_at_IO + type_Main_in_int: .word function_in_int_at_IO + type_Main_size_of_board: .word function_size_of_board_at_Board + type_Main_board_init: .word function_board_init_at_Board + type_Main_init: .word function_init_at_CellularAutomaton + type_Main_print: .word function_print_at_CellularAutomaton + type_Main_num_cells: .word function_num_cells_at_CellularAutomaton + type_Main_cell: .word function_cell_at_CellularAutomaton + type_Main_north: .word function_north_at_CellularAutomaton + type_Main_south: .word function_south_at_CellularAutomaton + type_Main_east: .word function_east_at_CellularAutomaton + type_Main_west: .word function_west_at_CellularAutomaton + type_Main_northwest: .word function_northwest_at_CellularAutomaton + type_Main_northeast: .word function_northeast_at_CellularAutomaton + type_Main_southeast: .word function_southeast_at_CellularAutomaton + type_Main_southwest: .word function_southwest_at_CellularAutomaton + type_Main_neighbors: .word function_neighbors_at_CellularAutomaton + type_Main_cell_at_next_evolution: .word function_cell_at_next_evolution_at_CellularAutomaton + type_Main_evolve: .word function_evolve_at_CellularAutomaton + type_Main_option: .word function_option_at_CellularAutomaton + type_Main_prompt: .word function_prompt_at_CellularAutomaton + type_Main_prompt2: .word function_prompt2_at_CellularAutomaton + type_Main_main: .word function_main_at_Main + + type_Object_name_size: .word 6 + type_Object_name: .asciiz "Object" + + type_IO_name_size: .word 2 + type_IO_name: .asciiz "IO" + + type_String_name_size: .word 6 + type_String_name: .asciiz "String" + + type_Int_name_size: .word 3 + type_Int_name: .asciiz "Int" + + type_Bool_name_size: .word 4 + type_Bool_name: .asciiz "Bool" + + type_Board_name_size: .word 5 + type_Board_name: .asciiz "Board" + + type_CellularAutomaton_name_size: .word 17 + type_CellularAutomaton_name: .asciiz "CellularAutomaton" + + type_Main_name_size: .word 4 + type_Main_name: .asciiz "Main" + + buffer_input: .space 1024 + debug_log: .asciiz "debug_log\n" + +.text + function_add: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Addition operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + add $t2, $t0, $t1 # $t2 = $t0 + $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_sub: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Subtraction operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sub $t2, $t0, $t1 # $t2 = $t0 - $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_mult: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Multiplication operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + mult $t0, $t1 # $t2 = $t0 * $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_div: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Division operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + div $t0, $t1 # $t2 = $t0 / $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_xor: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Xor operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than_or_equal: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sle $t2, $t0, $t1 # $t2 = $t0 <= $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_equal: + # Function parameters + # $ra = 48($sp) + # a = 44($sp) + # b = 40($sp) + + # Reserving space for local variables + addi $sp, $sp, -40 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_0 = address of allocated object Int + + # Allocating NUll to internal_1 + sw $zero, 32($sp) # internal_1 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_2 = address of allocated object Int + + # internal_2 = EqualAddress(a, internal_1) + lw $t0, 44($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # internal_2 = EqualAddress(b, internal_1) + lw $t0, 40($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # If internal_2 then goto a_is_type_object + lw $t0, 28($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_object + + # internal_3 = typeof a that is the first word of the object + lw $t0, 44($sp) + lw $t0, 0($t0) + sw $t0, 24($sp) + + # internal_4 = direction of Int + la $t0, type_Int + sw $t0, 20($sp) + + # internal_5 = direction of Bool + la $t0, type_Bool + sw $t0, 16($sp) + + # internal_6 = direction of String + la $t0, type_String + sw $t0, 12($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_7 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_8 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_9 = address of allocated object Int + + # internal_7 = EqualAddress(internal_3, internal_4) + lw $t0, 24($sp) + lw $t1, 20($sp) + seq $t2, $t0, $t1 + lw $t0, 8($sp) + sw $t2, 8($t0) + + # internal_8 = EqualAddress(internal_3, internal_5) + lw $t0, 24($sp) + lw $t1, 16($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_9 = EqualAddress(internal_3, internal_6) + lw $t0, 24($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_7 then goto a_is_type_int_or_bool + lw $t0, 8($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_8 then goto a_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_9 then goto a_is_type_string + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_string + + # Jumping to a_is_type_object + j a_is_type_object + + a_is_type_int_or_bool: + + # internal_0 = EqualInt(a, b) + lw $t0, 44($sp) + lw $t0, 8($t0) + lw $t1, 40($sp) + lw $t1, 8($t1) + seq $t2, $t0, $t1 + lw $t0, 36($sp) + sw $t2, 8($t0) + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_string: + + # internal_0 = EqualStr(a, b) + lw $t0, 44($sp) + lw $t1, 40($sp) + addi $t0, $t0, 8 + addi $t1, $t1, 8 + + # By default we assume the strings are equals + addi $t4, $zero, 1 + lw $t5, 36($sp) + sw $t4, 8($t5) + + while_compare_strings_start: + lb $t2, 0($t0) + lb $t3, 0($t1) + beq $t2, $t3, while_compare_strings_update + + # The strings are no equals + lw $t5, 36($sp) + sw $zero, 8($t5) + j while_compare_strings_end + + while_compare_strings_update: + addi $t0, $t0, 1 + addi $t1, $t1, 1 + beq $t2, $zero, while_compare_strings_end + beq $t3, $zero, while_compare_strings_end + j while_compare_strings_start + while_compare_strings_end: + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_object: + + # Equal operation + lw $t0, 44($sp) # Save in $t0 the left operand address + lw $t1, 40($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 36($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Jumping to end_of_equal + j end_of_equal + + end_of_equal: + + # Loading return value in $v1 + lw $v1, 36($sp) + + # Freeing space for local variables + addi $sp, $sp, 40 + + jr $ra + + function_assign: + # Function parameters + # $ra = 36($sp) + # dest = 32($sp) + # source = 28($sp) + + # Reserving space for local variables + addi $sp, $sp, -28 + + # Allocating NUll to internal_0 + sw $zero, 24($sp) # internal_0 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_1 = address of allocated object Int + + # internal_1 = EqualAddress(source, internal_0) + lw $t0, 28($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # internal_1 = EqualAddress(dest, internal_0) + lw $t0, 32($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # If internal_1 then goto source_is_type_object + lw $t0, 20($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_object + + # internal_2 = typeof source that is the first word of the object + lw $t0, 28($sp) + lw $t0, 0($t0) + sw $t0, 16($sp) + + # internal_3 = direction of Int + la $t0, type_Int + sw $t0, 12($sp) + + # internal_4 = direction of Bool + la $t0, type_Bool + sw $t0, 8($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_5 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_6 = address of allocated object Int + + # internal_5 = EqualAddress(internal_2, internal_3) + lw $t0, 16($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_6 = EqualAddress(internal_2, internal_4) + lw $t0, 16($sp) + lw $t1, 8($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_5 then goto source_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # If internal_6 then goto source_is_type_int_or_bool + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # Jumping to source_is_type_object + j source_is_type_object + + source_is_type_int_or_bool: + + # dest = source where source is an integer + li $v0, 9 + addi $a0, $zero, 12 + syscall + lw $t0, 28($sp) # Pointer to source + lw $t1, 0($t0) # $t1 = type of source + lw $t2, 8($t0) # $t2 = value of source + sw $t1, 0($v0) # Save type of dest + sw $a0, 4($v0) # Save size of dest + sw $t2, 8($v0) # Save value of dest + sw $v0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_is_type_object: + + # dest = source + lw $t0, 28($sp) + sw $t0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_end_of_equal: + + # Loading return value in $v1 + lw $v1, 32($sp) + + # Freeing space for local variables + addi $sp, $sp, 28 + + jr $ra + + function___init___at_Object: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_abort_at_Object: + # Function parameters + # $ra = 28($sp) + # self = 24($sp) + + # Reserving space for local variables + addi $sp, $sp, -24 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 33 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 33 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 65 + sb $t0, 8($v0) # internal_0[0] = 'A' + + addi $t0, $zero, 98 + sb $t0, 9($v0) # internal_0[1] = 'b' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_0[2] = 'o' + + addi $t0, $zero, 114 + sb $t0, 11($v0) # internal_0[3] = 'r' + + addi $t0, $zero, 116 + sb $t0, 12($v0) # internal_0[4] = 't' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_0[5] = ' ' + + addi $t0, $zero, 99 + sb $t0, 14($v0) # internal_0[6] = 'c' + + addi $t0, $zero, 97 + sb $t0, 15($v0) # internal_0[7] = 'a' + + addi $t0, $zero, 108 + sb $t0, 16($v0) # internal_0[8] = 'l' + + addi $t0, $zero, 108 + sb $t0, 17($v0) # internal_0[9] = 'l' + + addi $t0, $zero, 101 + sb $t0, 18($v0) # internal_0[10] = 'e' + + addi $t0, $zero, 100 + sb $t0, 19($v0) # internal_0[11] = 'd' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_0[12] = ' ' + + addi $t0, $zero, 102 + sb $t0, 21($v0) # internal_0[13] = 'f' + + addi $t0, $zero, 114 + sb $t0, 22($v0) # internal_0[14] = 'r' + + addi $t0, $zero, 111 + sb $t0, 23($v0) # internal_0[15] = 'o' + + addi $t0, $zero, 109 + sb $t0, 24($v0) # internal_0[16] = 'm' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_0[17] = ' ' + + addi $t0, $zero, 99 + sb $t0, 26($v0) # internal_0[18] = 'c' + + addi $t0, $zero, 108 + sb $t0, 27($v0) # internal_0[19] = 'l' + + addi $t0, $zero, 97 + sb $t0, 28($v0) # internal_0[20] = 'a' + + addi $t0, $zero, 115 + sb $t0, 29($v0) # internal_0[21] = 's' + + addi $t0, $zero, 115 + sb $t0, 30($v0) # internal_0[22] = 's' + + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_0[23] = ' ' + + sb $zero, 32($v0) # Null-terminator at the end of the string + + sw $v0, 20($sp) # internal_0 = "Abort called from class " + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_3[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 8($sp) # internal_3 = "\n" + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method type_name of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_5 + lw $t0, 8($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 24($sp) # internal_1 = result of internal_5 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_1 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_2 = result of internal_5 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_3 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_2 = result of internal_5 + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 12($sp) # $t0 = internal_2 + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the String internal_2 + li $v0, 4 + move $a0, $t0 + syscall + + # Exit program + li $v0, 10 + syscall + + # Loading return value in $v1 + lw $v1, 24($sp) + + # Freeing space for local variables + addi $sp, $sp, 24 + + jr $ra + + function_type_name_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = name of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 8($t1) # $t2 = direction of the type name + la $t3, 4($t2) # $t3 = address of the name + lw $t2, 0($t2) # $t2 = length of the name + + addi $t2, $t2, 9 # Setting space for the type, the size and the null byte + li $v0, 9 + move $a0, $t2 + syscall + addi $t2, $t2, -9 # Restoring space for the type, the size and the null byte + + la $t4, type_String + sw $t4, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t4, $v0, 0 # $t4 = direction of the new string + addi $t4, $t4, 8 # Pointer to the first character of the string + xor $t5, $t5, $t5 # Initializing counter + while_copy_name_start: + beq $t5, $t2, while_copy_name_end + lb $t6, 0($t3) # Loading the character + sb $t6, 0($t4) + addi $t4, $t4, 1 # Incrementing the pointer to the new string + addi $t3, $t3, 1 # Incrementing the pointer to the string in self + addi $t5, $t5, 1 # Incrementing counter + j while_copy_name_start + while_copy_name_end: + + sb $zero, 0($t4) # Setting the null byte + + sw $v0, 0($sp) # Storing the new string in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_copy_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = copy of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 4($t0) # $t2 = length of self in bytes + + # Allocating space for the new object + li $v0, 9 + move $a0, $t2 + syscall + move $t3, $v0 # $t3 = direction of the new object + sw $t1, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + # Initializing the variable of the loop + addi $t0, $t0, 8 # Pointer to the first character of the object + addi $t3, $t3, 8 # Pointer to the first character of the object + addi $t2, $2, -8 # Decrementing in 8 the length of the object + xor $t4, $t4, $t4 # Initializing counter + + # Loop copying the object + while_copy_start: + beq $t4, $t2, while_copy_end + lb $t5, 0($t0) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t0, $t0, 1 # Incrementing the pointer to the object + addi $t3, $t3, 1 # Incrementing the pointer to the new object + addi $t4, $t4, 1 # Incrementing counter + j while_copy_start + while_copy_end: + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_IO: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_out_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + lw $t0, 0($sp) # $t0 = x + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the String x + li $v0, 4 + move $a0, $t0 + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_out_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + # Printing the Int x + li $v0, 1 + lw $a0, 0($sp) + lw $a0, 8($a0) + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_in_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + li $v0, 8 + la $a0, buffer_input + li $a1, 1024 + syscall + + xor $t0, $t0, $t0 # Initializing counter + while_read_start: + lb $t1, buffer_input($t0) # Loading the byte + addi $t2, $zero, 10 + beq $t1, $t2, while_read_end + addi $t2, $zero, 13 + beq $t1, $t2, while_read_end + addi $t0, $t0, 1 # Incrementing counter + j while_read_start + while_read_end: + + addi $t0, $t0, 9 # Adding space for the type, the size and the null byte + li $v0, 9 + move $a0, $t0 + syscall + addi $t0, $t0, -9 # Adding space for the type, the size and the null byte + la $t2, type_String + sw $t2, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t3, $v0, 8 # Pointer to the first character of the string + xor $t4, $t4, $t4 # Initializing counter + + while_copy_from_buffer_start: + beq $t4, $t0, while_copy_from_buffer_end + lb $t5, buffer_input($t4) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t3, $t3, 1 # Imcremeenting pointer + addi $t4, $t4, 1 # Incrementing counter + j while_copy_from_buffer_start + while_copy_from_buffer_end: + + sb $zero, 0($t3) # Storing the null byte + + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_in_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + li $v0, 5 + syscall + lw $t0, 0($sp) + sw $v0, 8($t0) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_String: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_length_at_String: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # internal_0 = length of self + lw $t0, 4($sp) + lw $t1, 4($t0) + addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator + lw $t0, 0($sp) + sw $t1, 8($t0) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_concat_at_String: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + # s = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self + s + lw $t0, 8($sp) + lw $t1, 4($sp) + lw $t2, 4($t0) # $t2 = length of str1 + lw $t3, 4($t1) # $t3 = length of str2 + addi $t2, $t2, -9 + addi $t3, $t3, -9 + add $t4, $t2, $t3 # $t4 = length of str1 + str2 + addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) + + li $v0, 9 + move $a0, $t4 + syscall + addi $t4, $t4, -9 # Restoring $t4 = length of str1 + str2 + add $t5, $zero, $v0 # $t5 = address of the new string object + addi $t5, $t5, 8 # $t5 = address of the first byte of the new string + + la $t8, type_String + sw $t8, 0($v0) # Setting type in the first word of th object + + sw $a0, 4($v0) # Setting length of the string in the second word of the object + + # Copying str1 to the new string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_str1_start: + beq $t6, $t2, while_copy_str1_end + lb $t7, 8($t0) + sb $t7, 0($t5) + add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str1_start + while_copy_str1_end: + + # Copying str2 to the new string + while_copy_str2_start: + beq $t6, $t4, while_copy_str2_end + lb $t7, 8($t1) + sb $t7, 0($t5) + add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str2_start + while_copy_str2_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self + s + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_substr_at_String: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + # i = 8($sp) + # l = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self[i:i + l] + lw $t0, 12($sp) # $t0 = address of the string + lw $t1, 4($t0) # $t1 = length of the string + addi $t1, $t1, -9 # $t1 = length of the string + 9 + lw $t2, 8($sp) # $t2 = start of the substring + lw $t2, 8($t2) + lw $t3, 4($sp) # $t3 = length of the substring + lw $t3, 8($t3) + add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring + + bgt $t4, $t1, substring_out_of_bounds + + addi $t3, $t3, 9 + li $v0, 9 + move $a0, $t3 + syscall + addi $t3, $t3, -9 + + la $t5, type_String + sw $t5, 0($v0) # Setting type in the first word of the object + + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t0, $t0, 8 # pointing to the first byte of the string + add $t0, $t0, $t2 # pointing to the first byte of the substring + move $t5, $v0 # $t5 = address of the new string + add $t5, $t5, 8 # pointing to the first byte of the string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_substr_start: + beq $t6, $t3, while_copy_substr_end + lb $t7, 0($t0) + sb $t7, 0($t5) + addi $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of the string + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_substr_start + while_copy_substr_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self[i:i + l] + j substring_not_out_of_bounds + + substring_out_of_bounds: + li $v0, 17 + addi $a0, $zero, 1 + syscall + + substring_not_out_of_bounds: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_Int: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function___init___at_Bool: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function___init___at_Board: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + + # Reserving space for local variables + addi $sp, $sp, -12 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_0 = address of allocated object Int + + # Set attribute rows of self + lw $t0, 12($sp) # $t0 = self + lw $t1, 8($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8737379815328 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8737379815328 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8737379815328 + j object_set_attribute_8737379815328 + int_set_attribute_8737379815328: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.rows = internal_0 + j end_set_attribute_8737379815328 + bool_set_attribute_8737379815328: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.rows = internal_0 + j end_set_attribute_8737379815328 + object_set_attribute_8737379815328: + sw $t1, 8($t0) # self.rows = internal_0 + end_set_attribute_8737379815328: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_1 = address of allocated object Int + + # Set attribute columns of self + lw $t0, 12($sp) # $t0 = self + lw $t1, 4($sp) # $t1 = internal_1 + beq $t1, $zero, object_set_attribute_8737379815349 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8737379815349 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8737379815349 + j object_set_attribute_8737379815349 + int_set_attribute_8737379815349: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.columns = internal_1 + j end_set_attribute_8737379815349 + bool_set_attribute_8737379815349: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.columns = internal_1 + j end_set_attribute_8737379815349 + object_set_attribute_8737379815349: + sw $t1, 12($t0) # self.columns = internal_1 + end_set_attribute_8737379815349: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_2 = address of allocated object Int + + # Set attribute board_size of self + lw $t0, 12($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_2 + beq $t1, $zero, object_set_attribute_8737379815370 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8737379815370 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8737379815370 + j object_set_attribute_8737379815370 + int_set_attribute_8737379815370: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.board_size = internal_2 + j end_set_attribute_8737379815370 + bool_set_attribute_8737379815370: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.board_size = internal_2 + j end_set_attribute_8737379815370 + object_set_attribute_8737379815370: + sw $t1, 16($t0) # self.board_size = internal_2 + end_set_attribute_8737379815370: + + # Loading return value in $v1 + lw $v1, 12($sp) + + # Freeing space for local variables + addi $sp, $sp, 12 + + jr $ra + + function_size_of_board_at_Board: + # Function parameters + # $ra = 20($sp) + # self = 16($sp) + # initial = 12($sp) + + # Reserving space for local variables + addi $sp, $sp, -12 + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_1 = address of allocated object Int + + # Get method length of String + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument initial + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing initial + + # Calling function internal_2 + lw $t0, 8($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_0 = result of internal_2 + addi $sp, $sp, 8 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 12 + + jr $ra + + function_board_init_at_Board: + # Function parameters + # $ra = 176($sp) + # self = 172($sp) + # start = 168($sp) + + # Reserving space for local variables + addi $sp, $sp, -168 + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 156($sp) # internal_2 = address of allocated object Int + + # Get method size_of_board of Board + lw $t0, 172($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 156($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 152($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 184($sp) + sw $t0, 4($sp) # Storing self + + # Argument start + lw $t0, 180($sp) + sw $t0, 0($sp) # Storing start + + # Calling function internal_3 + lw $t0, 164($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 172($sp) # internal_1 = result of internal_3 + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument size + lw $t0, 176($sp) + sw $t0, 4($sp) # Storing size + + # Argument internal_1 + lw $t0, 172($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 176($sp) # size = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 144($sp) # internal_5 = address of allocated object Int + + # Allocating Int 15 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 15 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 140($sp) # internal_6 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument size + lw $t0, 176($sp) + sw $t0, 4($sp) # Storing size + + # Argument internal_6 + lw $t0, 152($sp) + sw $t0, 0($sp) # Storing internal_6 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 148($sp) # internal_7 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_5 = internal_7 + lw $t0, 136($sp) + sw $t0, 144($sp) + + # If internal_5 then goto then_8737379850719 + lw $t0, 144($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8737379850719 + + # Jumping to else_8737379850719 + j else_8737379850719 + + then_8737379850719: + + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 132($sp) # internal_8 = address of allocated object Int + + # Set attribute rows of self + lw $t0, 172($sp) # $t0 = self + lw $t1, 132($sp) # $t1 = internal_8 + beq $t1, $zero, object_set_attribute_8737379817747 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8737379817747 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8737379817747 + j object_set_attribute_8737379817747 + int_set_attribute_8737379817747: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.rows = internal_8 + j end_set_attribute_8737379817747 + bool_set_attribute_8737379817747: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.rows = internal_8 + j end_set_attribute_8737379817747 + object_set_attribute_8737379817747: + sw $t1, 8($t0) # self.rows = internal_8 + end_set_attribute_8737379817747: + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 128($sp) # internal_9 = address of allocated object Int + + # Set attribute columns of self + lw $t0, 172($sp) # $t0 = self + lw $t1, 128($sp) # $t1 = internal_9 + beq $t1, $zero, object_set_attribute_8737379817768 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8737379817768 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8737379817768 + j object_set_attribute_8737379817768 + int_set_attribute_8737379817768: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.columns = internal_9 + j end_set_attribute_8737379817768 + bool_set_attribute_8737379817768: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.columns = internal_9 + j end_set_attribute_8737379817768 + object_set_attribute_8737379817768: + sw $t1, 12($t0) # self.columns = internal_9 + end_set_attribute_8737379817768: + + # Set attribute board_size of self + lw $t0, 172($sp) # $t0 = self + lw $t1, 164($sp) # $t1 = size + beq $t1, $zero, object_set_attribute_8737379817789 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8737379817789 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8737379817789 + j object_set_attribute_8737379817789 + int_set_attribute_8737379817789: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.board_size = size + j end_set_attribute_8737379817789 + bool_set_attribute_8737379817789: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.board_size = size + j end_set_attribute_8737379817789 + object_set_attribute_8737379817789: + sw $t1, 16($t0) # self.board_size = size + end_set_attribute_8737379817789: + + # internal_4 = size + lw $t0, 164($sp) + sw $t0, 148($sp) + + # Jumping to endif_8737379850719 + j endif_8737379850719 + + else_8737379850719: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 120($sp) # internal_11 = address of allocated object Int + + # Allocating Int 16 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 16 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 116($sp) # internal_12 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument size + lw $t0, 176($sp) + sw $t0, 4($sp) # Storing size + + # Argument internal_12 + lw $t0, 128($sp) + sw $t0, 0($sp) # Storing internal_12 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 124($sp) # internal_13 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_11 = internal_13 + lw $t0, 112($sp) + sw $t0, 120($sp) + + # If internal_11 then goto then_8737379850713 + lw $t0, 120($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8737379850713 + + # Jumping to else_8737379850713 + j else_8737379850713 + + then_8737379850713: + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 108($sp) # internal_14 = address of allocated object Int + + # Set attribute rows of self + lw $t0, 172($sp) # $t0 = self + lw $t1, 108($sp) # $t1 = internal_14 + beq $t1, $zero, object_set_attribute_8737379817921 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8737379817921 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8737379817921 + j object_set_attribute_8737379817921 + int_set_attribute_8737379817921: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.rows = internal_14 + j end_set_attribute_8737379817921 + bool_set_attribute_8737379817921: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.rows = internal_14 + j end_set_attribute_8737379817921 + object_set_attribute_8737379817921: + sw $t1, 8($t0) # self.rows = internal_14 + end_set_attribute_8737379817921: + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 104($sp) # internal_15 = address of allocated object Int + + # Set attribute columns of self + lw $t0, 172($sp) # $t0 = self + lw $t1, 104($sp) # $t1 = internal_15 + beq $t1, $zero, object_set_attribute_8737379817942 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8737379817942 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8737379817942 + j object_set_attribute_8737379817942 + int_set_attribute_8737379817942: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.columns = internal_15 + j end_set_attribute_8737379817942 + bool_set_attribute_8737379817942: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.columns = internal_15 + j end_set_attribute_8737379817942 + object_set_attribute_8737379817942: + sw $t1, 12($t0) # self.columns = internal_15 + end_set_attribute_8737379817942: + + # Set attribute board_size of self + lw $t0, 172($sp) # $t0 = self + lw $t1, 164($sp) # $t1 = size + beq $t1, $zero, object_set_attribute_8737379817963 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8737379817963 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8737379817963 + j object_set_attribute_8737379817963 + int_set_attribute_8737379817963: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.board_size = size + j end_set_attribute_8737379817963 + bool_set_attribute_8737379817963: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.board_size = size + j end_set_attribute_8737379817963 + object_set_attribute_8737379817963: + sw $t1, 16($t0) # self.board_size = size + end_set_attribute_8737379817963: + + # internal_10 = size + lw $t0, 164($sp) + sw $t0, 124($sp) + + # Jumping to endif_8737379850713 + j endif_8737379850713 + + else_8737379850713: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 96($sp) # internal_17 = address of allocated object Int + + # Allocating Int 20 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 20 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 92($sp) # internal_18 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument size + lw $t0, 176($sp) + sw $t0, 4($sp) # Storing size + + # Argument internal_18 + lw $t0, 104($sp) + sw $t0, 0($sp) # Storing internal_18 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 100($sp) # internal_19 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_17 = internal_19 + lw $t0, 88($sp) + sw $t0, 96($sp) + + # If internal_17 then goto then_8737379850707 + lw $t0, 96($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8737379850707 + + # Jumping to else_8737379850707 + j else_8737379850707 + + then_8737379850707: + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 84($sp) # internal_20 = address of allocated object Int + + # Set attribute rows of self + lw $t0, 172($sp) # $t0 = self + lw $t1, 84($sp) # $t1 = internal_20 + beq $t1, $zero, object_set_attribute_8737379818355 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8737379818355 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8737379818355 + j object_set_attribute_8737379818355 + int_set_attribute_8737379818355: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.rows = internal_20 + j end_set_attribute_8737379818355 + bool_set_attribute_8737379818355: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.rows = internal_20 + j end_set_attribute_8737379818355 + object_set_attribute_8737379818355: + sw $t1, 8($t0) # self.rows = internal_20 + end_set_attribute_8737379818355: + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 80($sp) # internal_21 = address of allocated object Int + + # Set attribute columns of self + lw $t0, 172($sp) # $t0 = self + lw $t1, 80($sp) # $t1 = internal_21 + beq $t1, $zero, object_set_attribute_8737379818376 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8737379818376 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8737379818376 + j object_set_attribute_8737379818376 + int_set_attribute_8737379818376: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.columns = internal_21 + j end_set_attribute_8737379818376 + bool_set_attribute_8737379818376: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.columns = internal_21 + j end_set_attribute_8737379818376 + object_set_attribute_8737379818376: + sw $t1, 12($t0) # self.columns = internal_21 + end_set_attribute_8737379818376: + + # Set attribute board_size of self + lw $t0, 172($sp) # $t0 = self + lw $t1, 164($sp) # $t1 = size + beq $t1, $zero, object_set_attribute_8737379818397 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8737379818397 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8737379818397 + j object_set_attribute_8737379818397 + int_set_attribute_8737379818397: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.board_size = size + j end_set_attribute_8737379818397 + bool_set_attribute_8737379818397: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.board_size = size + j end_set_attribute_8737379818397 + object_set_attribute_8737379818397: + sw $t1, 16($t0) # self.board_size = size + end_set_attribute_8737379818397: + + # internal_16 = size + lw $t0, 164($sp) + sw $t0, 100($sp) + + # Jumping to endif_8737379850707 + j endif_8737379850707 + + else_8737379850707: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 72($sp) # internal_23 = address of allocated object Int + + # Allocating Int 21 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 21 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 68($sp) # internal_24 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument size + lw $t0, 176($sp) + sw $t0, 4($sp) # Storing size + + # Argument internal_24 + lw $t0, 80($sp) + sw $t0, 0($sp) # Storing internal_24 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 76($sp) # internal_25 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_23 = internal_25 + lw $t0, 64($sp) + sw $t0, 72($sp) + + # If internal_23 then goto then_8737379850701 + lw $t0, 72($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8737379850701 + + # Jumping to else_8737379850701 + j else_8737379850701 + + then_8737379850701: + + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 60($sp) # internal_26 = address of allocated object Int + + # Set attribute rows of self + lw $t0, 172($sp) # $t0 = self + lw $t1, 60($sp) # $t1 = internal_26 + beq $t1, $zero, object_set_attribute_8737379819045 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8737379819045 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8737379819045 + j object_set_attribute_8737379819045 + int_set_attribute_8737379819045: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.rows = internal_26 + j end_set_attribute_8737379819045 + bool_set_attribute_8737379819045: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.rows = internal_26 + j end_set_attribute_8737379819045 + object_set_attribute_8737379819045: + sw $t1, 8($t0) # self.rows = internal_26 + end_set_attribute_8737379819045: + + # Allocating Int 7 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 7 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 56($sp) # internal_27 = address of allocated object Int + + # Set attribute columns of self + lw $t0, 172($sp) # $t0 = self + lw $t1, 56($sp) # $t1 = internal_27 + beq $t1, $zero, object_set_attribute_8737379819066 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8737379819066 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8737379819066 + j object_set_attribute_8737379819066 + int_set_attribute_8737379819066: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.columns = internal_27 + j end_set_attribute_8737379819066 + bool_set_attribute_8737379819066: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.columns = internal_27 + j end_set_attribute_8737379819066 + object_set_attribute_8737379819066: + sw $t1, 12($t0) # self.columns = internal_27 + end_set_attribute_8737379819066: + + # Set attribute board_size of self + lw $t0, 172($sp) # $t0 = self + lw $t1, 164($sp) # $t1 = size + beq $t1, $zero, object_set_attribute_8737379819087 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8737379819087 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8737379819087 + j object_set_attribute_8737379819087 + int_set_attribute_8737379819087: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.board_size = size + j end_set_attribute_8737379819087 + bool_set_attribute_8737379819087: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.board_size = size + j end_set_attribute_8737379819087 + object_set_attribute_8737379819087: + sw $t1, 16($t0) # self.board_size = size + end_set_attribute_8737379819087: + + # internal_22 = size + lw $t0, 164($sp) + sw $t0, 76($sp) + + # Jumping to endif_8737379850701 + j endif_8737379850701 + + else_8737379850701: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 48($sp) # internal_29 = address of allocated object Int + + # Allocating Int 25 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 25 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_30 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument size + lw $t0, 176($sp) + sw $t0, 4($sp) # Storing size + + # Argument internal_30 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_30 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 52($sp) # internal_31 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_29 = internal_31 + lw $t0, 40($sp) + sw $t0, 48($sp) + + # If internal_29 then goto then_8737379850695 + lw $t0, 48($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8737379850695 + + # Jumping to else_8737379850695 + j else_8737379850695 + + then_8737379850695: + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_32 = address of allocated object Int + + # Set attribute rows of self + lw $t0, 172($sp) # $t0 = self + lw $t1, 36($sp) # $t1 = internal_32 + beq $t1, $zero, object_set_attribute_8737379819219 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8737379819219 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8737379819219 + j object_set_attribute_8737379819219 + int_set_attribute_8737379819219: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.rows = internal_32 + j end_set_attribute_8737379819219 + bool_set_attribute_8737379819219: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.rows = internal_32 + j end_set_attribute_8737379819219 + object_set_attribute_8737379819219: + sw $t1, 8($t0) # self.rows = internal_32 + end_set_attribute_8737379819219: + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_33 = address of allocated object Int + + # Set attribute columns of self + lw $t0, 172($sp) # $t0 = self + lw $t1, 32($sp) # $t1 = internal_33 + beq $t1, $zero, object_set_attribute_8737379819240 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8737379819240 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8737379819240 + j object_set_attribute_8737379819240 + int_set_attribute_8737379819240: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.columns = internal_33 + j end_set_attribute_8737379819240 + bool_set_attribute_8737379819240: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.columns = internal_33 + j end_set_attribute_8737379819240 + object_set_attribute_8737379819240: + sw $t1, 12($t0) # self.columns = internal_33 + end_set_attribute_8737379819240: + + # Set attribute board_size of self + lw $t0, 172($sp) # $t0 = self + lw $t1, 164($sp) # $t1 = size + beq $t1, $zero, object_set_attribute_8737379819258 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8737379819258 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8737379819258 + j object_set_attribute_8737379819258 + int_set_attribute_8737379819258: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.board_size = size + j end_set_attribute_8737379819258 + bool_set_attribute_8737379819258: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.board_size = size + j end_set_attribute_8737379819258 + object_set_attribute_8737379819258: + sw $t1, 16($t0) # self.board_size = size + end_set_attribute_8737379819258: + + # internal_28 = size + lw $t0, 164($sp) + sw $t0, 52($sp) + + # Jumping to endif_8737379850695 + j endif_8737379850695 + + else_8737379850695: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # internal_35 = address of allocated object Int + + # Allocating Int 28 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 28 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_36 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument size + lw $t0, 176($sp) + sw $t0, 4($sp) # Storing size + + # Argument internal_36 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_36 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_37 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_35 = internal_37 + lw $t0, 16($sp) + sw $t0, 24($sp) + + # If internal_35 then goto then_8737379850683 + lw $t0, 24($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8737379850683 + + # Jumping to else_8737379850683 + j else_8737379850683 + + then_8737379850683: + + # Allocating Int 7 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 7 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 12($sp) # internal_38 = address of allocated object Int + + # Set attribute rows of self + lw $t0, 172($sp) # $t0 = self + lw $t1, 12($sp) # $t1 = internal_38 + beq $t1, $zero, object_set_attribute_8737379819397 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8737379819397 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8737379819397 + j object_set_attribute_8737379819397 + int_set_attribute_8737379819397: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.rows = internal_38 + j end_set_attribute_8737379819397 + bool_set_attribute_8737379819397: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.rows = internal_38 + j end_set_attribute_8737379819397 + object_set_attribute_8737379819397: + sw $t1, 8($t0) # self.rows = internal_38 + end_set_attribute_8737379819397: + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_39 = address of allocated object Int + + # Set attribute columns of self + lw $t0, 172($sp) # $t0 = self + lw $t1, 8($sp) # $t1 = internal_39 + beq $t1, $zero, object_set_attribute_8737379819418 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8737379819418 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8737379819418 + j object_set_attribute_8737379819418 + int_set_attribute_8737379819418: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.columns = internal_39 + j end_set_attribute_8737379819418 + bool_set_attribute_8737379819418: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.columns = internal_39 + j end_set_attribute_8737379819418 + object_set_attribute_8737379819418: + sw $t1, 12($t0) # self.columns = internal_39 + end_set_attribute_8737379819418: + + # Set attribute board_size of self + lw $t0, 172($sp) # $t0 = self + lw $t1, 164($sp) # $t1 = size + beq $t1, $zero, object_set_attribute_8737379819439 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8737379819439 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8737379819439 + j object_set_attribute_8737379819439 + int_set_attribute_8737379819439: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.board_size = size + j end_set_attribute_8737379819439 + bool_set_attribute_8737379819439: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.board_size = size + j end_set_attribute_8737379819439 + object_set_attribute_8737379819439: + sw $t1, 16($t0) # self.board_size = size + end_set_attribute_8737379819439: + + # internal_34 = size + lw $t0, 164($sp) + sw $t0, 28($sp) + + # Jumping to endif_8737379850683 + j endif_8737379850683 + + else_8737379850683: + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_40 = address of allocated object Int + + # Set attribute rows of self + lw $t0, 172($sp) # $t0 = self + lw $t1, 4($sp) # $t1 = internal_40 + beq $t1, $zero, object_set_attribute_8737379819469 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8737379819469 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8737379819469 + j object_set_attribute_8737379819469 + int_set_attribute_8737379819469: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.rows = internal_40 + j end_set_attribute_8737379819469 + bool_set_attribute_8737379819469: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.rows = internal_40 + j end_set_attribute_8737379819469 + object_set_attribute_8737379819469: + sw $t1, 8($t0) # self.rows = internal_40 + end_set_attribute_8737379819469: + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_41 = address of allocated object Int + + # Set attribute columns of self + lw $t0, 172($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_41 + beq $t1, $zero, object_set_attribute_8737379819490 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8737379819490 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8737379819490 + j object_set_attribute_8737379819490 + int_set_attribute_8737379819490: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.columns = internal_41 + j end_set_attribute_8737379819490 + bool_set_attribute_8737379819490: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.columns = internal_41 + j end_set_attribute_8737379819490 + object_set_attribute_8737379819490: + sw $t1, 12($t0) # self.columns = internal_41 + end_set_attribute_8737379819490: + + # Set attribute board_size of self + lw $t0, 172($sp) # $t0 = self + lw $t1, 164($sp) # $t1 = size + beq $t1, $zero, object_set_attribute_8737379819511 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8737379819511 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8737379819511 + j object_set_attribute_8737379819511 + int_set_attribute_8737379819511: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.board_size = size + j end_set_attribute_8737379819511 + bool_set_attribute_8737379819511: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.board_size = size + j end_set_attribute_8737379819511 + object_set_attribute_8737379819511: + sw $t1, 16($t0) # self.board_size = size + end_set_attribute_8737379819511: + + # internal_34 = size + lw $t0, 164($sp) + sw $t0, 28($sp) + + # Jumping to endif_8737379850683 + j endif_8737379850683 + + endif_8737379850683: + + # internal_28 = internal_34 + lw $t0, 28($sp) + sw $t0, 52($sp) + + # Jumping to endif_8737379850695 + j endif_8737379850695 + + endif_8737379850695: + + # internal_22 = internal_28 + lw $t0, 52($sp) + sw $t0, 76($sp) + + # Jumping to endif_8737379850701 + j endif_8737379850701 + + endif_8737379850701: + + # internal_16 = internal_22 + lw $t0, 76($sp) + sw $t0, 100($sp) + + # Jumping to endif_8737379850707 + j endif_8737379850707 + + endif_8737379850707: + + # internal_10 = internal_16 + lw $t0, 100($sp) + sw $t0, 124($sp) + + # Jumping to endif_8737379850713 + j endif_8737379850713 + + endif_8737379850713: + + # internal_4 = internal_10 + lw $t0, 124($sp) + sw $t0, 148($sp) + + # Jumping to endif_8737379850719 + j endif_8737379850719 + + endif_8737379850719: + + # Loading return value in $v1 + lw $v1, 172($sp) + + # Freeing space for local variables + addi $sp, $sp, 168 + + jr $ra + + function___init___at_CellularAutomaton: + # Function parameters + # $ra = 20($sp) + # self = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 12($sp) # internal_0 = address of allocated object Int + + # Set attribute rows of self + lw $t0, 16($sp) # $t0 = self + lw $t1, 12($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8737379820087 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8737379820087 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8737379820087 + j object_set_attribute_8737379820087 + int_set_attribute_8737379820087: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.rows = internal_0 + j end_set_attribute_8737379820087 + bool_set_attribute_8737379820087: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.rows = internal_0 + j end_set_attribute_8737379820087 + object_set_attribute_8737379820087: + sw $t1, 8($t0) # self.rows = internal_0 + end_set_attribute_8737379820087: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_1 = address of allocated object Int + + # Set attribute columns of self + lw $t0, 16($sp) # $t0 = self + lw $t1, 8($sp) # $t1 = internal_1 + beq $t1, $zero, object_set_attribute_8737379820108 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8737379820108 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8737379820108 + j object_set_attribute_8737379820108 + int_set_attribute_8737379820108: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.columns = internal_1 + j end_set_attribute_8737379820108 + bool_set_attribute_8737379820108: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.columns = internal_1 + j end_set_attribute_8737379820108 + object_set_attribute_8737379820108: + sw $t1, 12($t0) # self.columns = internal_1 + end_set_attribute_8737379820108: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_2 = address of allocated object Int + + # Set attribute board_size of self + lw $t0, 16($sp) # $t0 = self + lw $t1, 4($sp) # $t1 = internal_2 + beq $t1, $zero, object_set_attribute_8737379820129 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8737379820129 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8737379820129 + j object_set_attribute_8737379820129 + int_set_attribute_8737379820129: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.board_size = internal_2 + j end_set_attribute_8737379820129 + bool_set_attribute_8737379820129: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.board_size = internal_2 + j end_set_attribute_8737379820129 + object_set_attribute_8737379820129: + sw $t1, 16($t0) # self.board_size = internal_2 + end_set_attribute_8737379820129: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 9 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 9 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + sb $zero, 8($v0) # Null-terminator at the end of the string + + sw $v0, 0($sp) # internal_3 = "" + + # Set attribute population_map of self + lw $t0, 16($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_3 + beq $t1, $zero, object_set_attribute_8737379820150 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8737379820150 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8737379820150 + j object_set_attribute_8737379820150 + int_set_attribute_8737379820150: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($t0) # self.population_map = internal_3 + j end_set_attribute_8737379820150 + bool_set_attribute_8737379820150: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($t0) # self.population_map = internal_3 + j end_set_attribute_8737379820150 + object_set_attribute_8737379820150: + sw $t1, 20($t0) # self.population_map = internal_3 + end_set_attribute_8737379820150: + + # Loading return value in $v1 + lw $v1, 16($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 + + jr $ra + + function_init_at_CellularAutomaton: + # Function parameters + # $ra = 20($sp) + # self = 16($sp) + # map = 12($sp) + + # Reserving space for local variables + addi $sp, $sp, -12 + + # Set attribute population_map of self + lw $t0, 16($sp) # $t0 = self + lw $t1, 12($sp) # $t1 = map + beq $t1, $zero, object_set_attribute_8737379820195 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8737379820195 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8737379820195 + j object_set_attribute_8737379820195 + int_set_attribute_8737379820195: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($t0) # self.population_map = map + j end_set_attribute_8737379820195 + bool_set_attribute_8737379820195: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($t0) # self.population_map = map + j end_set_attribute_8737379820195 + object_set_attribute_8737379820195: + sw $t1, 20($t0) # self.population_map = map + end_set_attribute_8737379820195: + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_1 = address of allocated object Int + + # Get method board_init of CellularAutomaton + lw $t0, 16($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing self + + # Argument map + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing map + + # Calling function internal_2 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_0 = result of internal_2 + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 16($sp) + + # Freeing space for local variables + addi $sp, $sp, 12 + + jr $ra + + function_print_at_CellularAutomaton: + # Function parameters + # $ra = 116($sp) + # self = 112($sp) + + # Reserving space for local variables + addi $sp, $sp, -112 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 104($sp) # internal_1 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 120($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_1 + lw $t0, 116($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 120($sp) # i = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute board_size of self + lw $t0, 112($sp) # Get the address of self + lw $t1, 16($t0) # Get the attribute 'board_size' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8737379821114 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8737379821114 + j object_get_attribute_8737379821114 + int_get_attribute_8737379821114: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 96($sp) # internal_3 = self.board_size + j end_get_attribute_8737379821114 + bool_get_attribute_8737379821114: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 96($sp) # internal_3 = self.board_size + j end_get_attribute_8737379821114 + object_get_attribute_8737379821114: + sw $t1, 96($sp) # internal_3 = self.board_size + end_get_attribute_8737379821114: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 112($sp) + sw $t0, 4($sp) # Storing num + + # Argument internal_3 + lw $t0, 108($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 112($sp) # num = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_4[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 92($sp) # internal_4 = "\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 84($sp) # internal_6 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 112($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 84($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 80($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 124($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_4 + lw $t0, 104($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function internal_7 + lw $t0, 92($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 100($sp) # internal_5 = result of internal_7 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating NUll to internal_8 + sw $zero, 76($sp) # internal_8 = 0 + + while_start_8737379851659: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 120($sp) + sw $t0, 4($sp) # Storing i + + # Argument num + lw $t0, 112($sp) + sw $t0, 0($sp) # Storing num + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 84($sp) # internal_9 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_9 then goto while_body_8737379851659 + lw $t0, 72($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_body_8737379851659 + + # Jumping to while_end_8737379851659 + j while_end_8737379851659 + + while_body_8737379851659: + + # Get attribute population_map of self + lw $t0, 112($sp) # Get the address of self + lw $t1, 20($t0) # Get the attribute 'population_map' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8737379821861 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8737379821861 + j object_get_attribute_8737379821861 + int_get_attribute_8737379821861: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 68($sp) # internal_10 = self.population_map + j end_get_attribute_8737379821861 + bool_get_attribute_8737379821861: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 68($sp) # internal_10 = self.population_map + j end_get_attribute_8737379821861 + object_get_attribute_8737379821861: + sw $t1, 68($sp) # internal_10 = self.population_map + end_get_attribute_8737379821861: + + # Get attribute columns of self + lw $t0, 112($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8737379821876 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8737379821876 + j object_get_attribute_8737379821876 + int_get_attribute_8737379821876: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 64($sp) # internal_11 = self.columns + j end_get_attribute_8737379821876 + bool_get_attribute_8737379821876: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 64($sp) # internal_11 = self.columns + j end_get_attribute_8737379821876 + object_get_attribute_8737379821876: + sw $t1, 64($sp) # internal_11 = self.columns + end_get_attribute_8737379821876: + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 56($sp) # internal_13 = address of allocated object Int + + # Get method substr of String + lw $t0, 68($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 56($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 52($sp) + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument internal_10 + lw $t0, 84($sp) + sw $t0, 8($sp) # Storing internal_10 + + # Argument i + lw $t0, 124($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_11 + lw $t0, 80($sp) + sw $t0, 0($sp) # Storing internal_11 + + # Calling function internal_14 + lw $t0, 68($sp) + jalr $t0 + lw $ra, 12($sp) + sw $v1, 76($sp) # internal_12 = result of internal_14 + addi $sp, $sp, 16 # Freeing space for arguments + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_16 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 112($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 44($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 40($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 124($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_12 + lw $t0, 72($sp) + sw $t0, 0($sp) # Storing internal_12 + + # Calling function internal_17 + lw $t0, 52($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 60($sp) # internal_15 = result of internal_17 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_18[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 36($sp) # internal_18 = "\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_20 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 112($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 28($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 24($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 124($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_18 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_18 + + # Calling function internal_21 + lw $t0, 36($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 44($sp) # internal_19 = result of internal_21 + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute columns of self + lw $t0, 112($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8737379822044 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8737379822044 + j object_get_attribute_8737379822044 + int_get_attribute_8737379822044: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($sp) # internal_22 = self.columns + j end_get_attribute_8737379822044 + bool_get_attribute_8737379822044: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($sp) # internal_22 = self.columns + j end_get_attribute_8737379822044 + object_get_attribute_8737379822044: + sw $t1, 20($sp) # internal_22 = self.columns + end_get_attribute_8737379822044: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 120($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_22 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_22 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_23 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 120($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_23 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_23 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 120($sp) # i = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to while_start_8737379851659 + j while_start_8737379851659 + + while_end_8737379851659: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_24[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_24 = "\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_26 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 112($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 124($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_24 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_24 + + # Calling function internal_27 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_25 = result of internal_27 + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 112($sp) + + # Freeing space for local variables + addi $sp, $sp, 112 + + jr $ra + + function_num_cells_at_CellularAutomaton: + # Function parameters + # $ra = 20($sp) + # self = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Get attribute population_map of self + lw $t0, 16($sp) # Get the address of self + lw $t1, 20($t0) # Get the attribute 'population_map' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8737379821147 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8737379821147 + j object_get_attribute_8737379821147 + int_get_attribute_8737379821147: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_0 = self.population_map + j end_get_attribute_8737379821147 + bool_get_attribute_8737379821147: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_0 = self.population_map + j end_get_attribute_8737379821147 + object_get_attribute_8737379821147: + sw $t1, 12($sp) # internal_0 = self.population_map + end_get_attribute_8737379821147: + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_2 = address of allocated object Int + + # Get method length of String + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function internal_3 + lw $t0, 8($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_1 = result of internal_3 + addi $sp, $sp, 8 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 + + jr $ra + + function_cell_at_CellularAutomaton: + # Function parameters + # $ra = 56($sp) + # self = 52($sp) + # position = 48($sp) + + # Reserving space for local variables + addi $sp, $sp, -48 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_1 = address of allocated object Int + + # Get attribute board_size of self + lw $t0, 52($sp) # Get the address of self + lw $t1, 16($t0) # Get the attribute 'board_size' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8737379822761 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8737379822761 + j object_get_attribute_8737379822761 + int_get_attribute_8737379822761: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 36($sp) # internal_2 = self.board_size + j end_get_attribute_8737379822761 + bool_get_attribute_8737379822761: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 36($sp) # internal_2 = self.board_size + j end_get_attribute_8737379822761 + object_get_attribute_8737379822761: + sw $t1, 36($sp) # internal_2 = self.board_size + end_get_attribute_8737379822761: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_3 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 48($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_3 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_4 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_4 + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing internal_4 + + # Argument position + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing position + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_5 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_1 = internal_5 + lw $t0, 24($sp) + sw $t0, 40($sp) + + # If internal_1 then goto then_8737379852304 + lw $t0, 40($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8737379852304 + + # Jumping to else_8737379852304 + j else_8737379852304 + + then_8737379852304: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_6[0] = ' ' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 20($sp) # internal_6 = " " + + # internal_0 = internal_6 + lw $t0, 20($sp) + sw $t0, 44($sp) + + # Jumping to endif_8737379852304 + j endif_8737379852304 + + else_8737379852304: + + # Get attribute population_map of self + lw $t0, 52($sp) # Get the address of self + lw $t1, 20($t0) # Get the attribute 'population_map' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8737379816235 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8737379816235 + j object_get_attribute_8737379816235 + int_get_attribute_8737379816235: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($sp) # internal_7 = self.population_map + j end_get_attribute_8737379816235 + bool_get_attribute_8737379816235: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($sp) # internal_7 = self.population_map + j end_get_attribute_8737379816235 + object_get_attribute_8737379816235: + sw $t1, 16($sp) # internal_7 = self.population_map + end_get_attribute_8737379816235: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 12($sp) # internal_8 = address of allocated object Int + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_10 = address of allocated object Int + + # Get method substr of String + lw $t0, 16($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument internal_7 + lw $t0, 32($sp) + sw $t0, 8($sp) # Storing internal_7 + + # Argument position + lw $t0, 64($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_8 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_8 + + # Calling function internal_11 + lw $t0, 16($sp) + jalr $t0 + lw $ra, 12($sp) + sw $v1, 24($sp) # internal_9 = result of internal_11 + addi $sp, $sp, 16 # Freeing space for arguments + + # internal_0 = internal_9 + lw $t0, 8($sp) + sw $t0, 44($sp) + + # Jumping to endif_8737379852304 + j endif_8737379852304 + + endif_8737379852304: + + # Loading return value in $v1 + lw $v1, 44($sp) + + # Freeing space for local variables + addi $sp, $sp, 48 + + jr $ra + + function_north_at_CellularAutomaton: + # Function parameters + # $ra = 56($sp) + # self = 52($sp) + # position = 48($sp) + + # Reserving space for local variables + addi $sp, $sp, -48 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_1 = address of allocated object Int + + # Get attribute columns of self + lw $t0, 52($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8737379816394 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8737379816394 + j object_get_attribute_8737379816394 + int_get_attribute_8737379816394: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 36($sp) # internal_2 = self.columns + j end_get_attribute_8737379816394 + bool_get_attribute_8737379816394: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 36($sp) # internal_2 = self.columns + j end_get_attribute_8737379816394 + object_get_attribute_8737379816394: + sw $t1, 36($sp) # internal_2 = self.columns + end_get_attribute_8737379816394: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_2 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 44($sp) # internal_3 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_4 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_3 + lw $t0, 44($sp) + sw $t0, 4($sp) # Storing internal_3 + + # Argument internal_4 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_5 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_1 = internal_5 + lw $t0, 24($sp) + sw $t0, 40($sp) + + # If internal_1 then goto then_8737379852370 + lw $t0, 40($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8737379852370 + + # Jumping to else_8737379852370 + j else_8737379852370 + + then_8737379852370: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_6[0] = ' ' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 20($sp) # internal_6 = " " + + # internal_0 = internal_6 + lw $t0, 20($sp) + sw $t0, 44($sp) + + # Jumping to endif_8737379852370 + j endif_8737379852370 + + else_8737379852370: + + # Get attribute columns of self + lw $t0, 52($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8737379823707 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8737379823707 + j object_get_attribute_8737379823707 + int_get_attribute_8737379823707: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($sp) # internal_7 = self.columns + j end_get_attribute_8737379823707 + bool_get_attribute_8737379823707: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($sp) # internal_7 = self.columns + j end_get_attribute_8737379823707 + object_get_attribute_8737379823707: + sw $t1, 16($sp) # internal_7 = self.columns + end_get_attribute_8737379823707: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_7 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_8 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 13 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 13 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_10 = address of allocated object Int + + # Get method cell of CellularAutomaton + lw $t0, 52($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 64($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_8 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_8 + + # Calling function internal_11 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_9 = result of internal_11 + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_0 = internal_9 + lw $t0, 8($sp) + sw $t0, 44($sp) + + # Jumping to endif_8737379852370 + j endif_8737379852370 + + endif_8737379852370: + + # Loading return value in $v1 + lw $v1, 44($sp) + + # Freeing space for local variables + addi $sp, $sp, 48 + + jr $ra + + function_south_at_CellularAutomaton: + # Function parameters + # $ra = 56($sp) + # self = 52($sp) + # position = 48($sp) + + # Reserving space for local variables + addi $sp, $sp, -48 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_1 = address of allocated object Int + + # Get attribute board_size of self + lw $t0, 52($sp) # Get the address of self + lw $t1, 16($t0) # Get the attribute 'board_size' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8737379823848 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8737379823848 + j object_get_attribute_8737379823848 + int_get_attribute_8737379823848: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 36($sp) # internal_2 = self.board_size + j end_get_attribute_8737379823848 + bool_get_attribute_8737379823848: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 36($sp) # internal_2 = self.board_size + j end_get_attribute_8737379823848 + object_get_attribute_8737379823848: + sw $t1, 36($sp) # internal_2 = self.board_size + end_get_attribute_8737379823848: + + # Get attribute columns of self + lw $t0, 52($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8737379824388 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8737379824388 + j object_get_attribute_8737379824388 + int_get_attribute_8737379824388: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 32($sp) # internal_3 = self.columns + j end_get_attribute_8737379824388 + bool_get_attribute_8737379824388: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 32($sp) # internal_3 = self.columns + j end_get_attribute_8737379824388 + object_get_attribute_8737379824388: + sw $t1, 32($sp) # internal_3 = self.columns + end_get_attribute_8737379824388: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_3 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_4 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 48($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_4 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_5 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_1 = internal_5 + lw $t0, 24($sp) + sw $t0, 40($sp) + + # If internal_1 then goto then_8737379852436 + lw $t0, 40($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8737379852436 + + # Jumping to else_8737379852436 + j else_8737379852436 + + then_8737379852436: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_6[0] = ' ' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 20($sp) # internal_6 = " " + + # internal_0 = internal_6 + lw $t0, 20($sp) + sw $t0, 44($sp) + + # Jumping to endif_8737379852436 + j endif_8737379852436 + + else_8737379852436: + + # Get attribute columns of self + lw $t0, 52($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8737379824517 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8737379824517 + j object_get_attribute_8737379824517 + int_get_attribute_8737379824517: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($sp) # internal_7 = self.columns + j end_get_attribute_8737379824517 + bool_get_attribute_8737379824517: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($sp) # internal_7 = self.columns + j end_get_attribute_8737379824517 + object_get_attribute_8737379824517: + sw $t1, 16($sp) # internal_7 = self.columns + end_get_attribute_8737379824517: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_7 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_8 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 13 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 13 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_10 = address of allocated object Int + + # Get method cell of CellularAutomaton + lw $t0, 52($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 64($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_8 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_8 + + # Calling function internal_11 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_9 = result of internal_11 + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_0 = internal_9 + lw $t0, 8($sp) + sw $t0, 44($sp) + + # Jumping to endif_8737379852436 + j endif_8737379852436 + + endif_8737379852436: + + # Loading return value in $v1 + lw $v1, 44($sp) + + # Freeing space for local variables + addi $sp, $sp, 48 + + jr $ra + + function_east_at_CellularAutomaton: + # Function parameters + # $ra = 76($sp) + # self = 72($sp) + # position = 68($sp) + + # Reserving space for local variables + addi $sp, $sp, -68 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 60($sp) # internal_1 = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 56($sp) # internal_2 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 80($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_2 + lw $t0, 68($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 64($sp) # internal_3 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute columns of self + lw $t0, 72($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8737379824981 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8737379824981 + j object_get_attribute_8737379824981 + int_get_attribute_8737379824981: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 48($sp) # internal_4 = self.columns + j end_get_attribute_8737379824981 + bool_get_attribute_8737379824981: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 48($sp) # internal_4 = self.columns + j end_get_attribute_8737379824981 + object_get_attribute_8737379824981: + sw $t1, 48($sp) # internal_4 = self.columns + end_get_attribute_8737379824981: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_3 + lw $t0, 64($sp) + sw $t0, 4($sp) # Storing internal_3 + + # Argument internal_4 + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function_div + jal function_div + lw $ra, 8($sp) + sw $v1, 56($sp) # internal_5 = result of function_div + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute columns of self + lw $t0, 72($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8737379825008 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8737379825008 + j object_get_attribute_8737379825008 + int_get_attribute_8737379825008: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 40($sp) # internal_6 = self.columns + j end_get_attribute_8737379825008 + bool_get_attribute_8737379825008: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 40($sp) # internal_6 = self.columns + j end_get_attribute_8737379825008 + object_get_attribute_8737379825008: + sw $t1, 40($sp) # internal_6 = self.columns + end_get_attribute_8737379825008: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_5 + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing internal_5 + + # Argument internal_6 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_6 + + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 48($sp) # internal_7 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_8 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 80($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_8 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_8 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_9 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_7 + lw $t0, 48($sp) + sw $t0, 4($sp) # Storing internal_7 + + # Argument internal_9 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_10 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_1 = internal_10 + lw $t0, 24($sp) + sw $t0, 60($sp) + + # If internal_1 then goto then_8737379852538 + lw $t0, 60($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8737379852538 + + # Jumping to else_8737379852538 + j else_8737379852538 + + then_8737379852538: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_11[0] = ' ' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 20($sp) # internal_11 = " " + + # internal_0 = internal_11 + lw $t0, 20($sp) + sw $t0, 64($sp) + + # Jumping to endif_8737379852538 + j endif_8737379852538 + + else_8737379852538: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_12 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 80($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_12 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_12 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_13 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 13 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 13 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_15 = address of allocated object Int + + # Get method cell of CellularAutomaton + lw $t0, 72($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 84($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_13 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_13 + + # Calling function internal_16 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_14 = result of internal_16 + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_0 = internal_14 + lw $t0, 8($sp) + sw $t0, 64($sp) + + # Jumping to endif_8737379852538 + j endif_8737379852538 + + endif_8737379852538: + + # Loading return value in $v1 + lw $v1, 64($sp) + + # Freeing space for local variables + addi $sp, $sp, 68 + + jr $ra + + function_west_at_CellularAutomaton: + # Function parameters + # $ra = 80($sp) + # self = 76($sp) + # position = 72($sp) + + # Reserving space for local variables + addi $sp, $sp, -72 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 64($sp) # internal_1 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 60($sp) # internal_2 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 84($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_2 + lw $t0, 72($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 68($sp) # internal_3 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_1 = internal_3 + lw $t0, 56($sp) + sw $t0, 64($sp) + + # If internal_1 then goto then_8737379852894 + lw $t0, 64($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8737379852894 + + # Jumping to else_8737379852894 + j else_8737379852894 + + then_8737379852894: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_4[0] = ' ' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 52($sp) # internal_4 = " " + + # internal_0 = internal_4 + lw $t0, 52($sp) + sw $t0, 68($sp) + + # Jumping to endif_8737379852894 + j endif_8737379852894 + + else_8737379852894: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_6 = address of allocated object Int + + # Get attribute columns of self + lw $t0, 76($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8737379825740 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8737379825740 + j object_get_attribute_8737379825740 + int_get_attribute_8737379825740: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 40($sp) # internal_7 = self.columns + j end_get_attribute_8737379825740 + bool_get_attribute_8737379825740: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 40($sp) # internal_7 = self.columns + j end_get_attribute_8737379825740 + object_get_attribute_8737379825740: + sw $t1, 40($sp) # internal_7 = self.columns + end_get_attribute_8737379825740: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 84($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_7 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function function_div + jal function_div + lw $ra, 8($sp) + sw $v1, 48($sp) # internal_8 = result of function_div + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute columns of self + lw $t0, 76($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8737379825767 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8737379825767 + j object_get_attribute_8737379825767 + int_get_attribute_8737379825767: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 32($sp) # internal_9 = self.columns + j end_get_attribute_8737379825767 + bool_get_attribute_8737379825767: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 32($sp) # internal_9 = self.columns + j end_get_attribute_8737379825767 + object_get_attribute_8737379825767: + sw $t1, 32($sp) # internal_9 = self.columns + end_get_attribute_8737379825767: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_8 + lw $t0, 48($sp) + sw $t0, 4($sp) # Storing internal_8 + + # Argument internal_9 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_10 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_10 + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing internal_10 + + # Argument position + lw $t0, 84($sp) + sw $t0, 0($sp) # Storing position + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_11 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_6 = internal_11 + lw $t0, 24($sp) + sw $t0, 44($sp) + + # If internal_6 then goto then_8737379852900 + lw $t0, 44($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8737379852900 + + # Jumping to else_8737379852900 + j else_8737379852900 + + then_8737379852900: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_12[0] = ' ' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 20($sp) # internal_12 = " " + + # internal_5 = internal_12 + lw $t0, 20($sp) + sw $t0, 48($sp) + + # Jumping to endif_8737379852900 + j endif_8737379852900 + + else_8737379852900: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_13 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 84($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_13 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_13 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_14 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 13 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 13 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_16 = address of allocated object Int + + # Get method cell of CellularAutomaton + lw $t0, 76($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 88($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_14 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_14 + + # Calling function internal_17 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_15 = result of internal_17 + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_5 = internal_15 + lw $t0, 8($sp) + sw $t0, 48($sp) + + # Jumping to endif_8737379852900 + j endif_8737379852900 + + endif_8737379852900: + + # internal_0 = internal_5 + lw $t0, 48($sp) + sw $t0, 68($sp) + + # Jumping to endif_8737379852894 + j endif_8737379852894 + + endif_8737379852894: + + # Loading return value in $v1 + lw $v1, 68($sp) + + # Freeing space for local variables + addi $sp, $sp, 72 + + jr $ra + + function_northwest_at_CellularAutomaton: + # Function parameters + # $ra = 88($sp) + # self = 84($sp) + # position = 80($sp) + + # Reserving space for local variables + addi $sp, $sp, -80 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 72($sp) # internal_1 = address of allocated object Int + + # Get attribute columns of self + lw $t0, 84($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8737379793550 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8737379793550 + j object_get_attribute_8737379793550 + int_get_attribute_8737379793550: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 68($sp) # internal_2 = self.columns + j end_get_attribute_8737379793550 + bool_get_attribute_8737379793550: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 68($sp) # internal_2 = self.columns + j end_get_attribute_8737379793550 + object_get_attribute_8737379793550: + sw $t1, 68($sp) # internal_2 = self.columns + end_get_attribute_8737379793550: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 92($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_2 + lw $t0, 80($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 76($sp) # internal_3 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 60($sp) # internal_4 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_3 + lw $t0, 76($sp) + sw $t0, 4($sp) # Storing internal_3 + + # Argument internal_4 + lw $t0, 72($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 68($sp) # internal_5 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_1 = internal_5 + lw $t0, 56($sp) + sw $t0, 72($sp) + + # If internal_1 then goto then_8737379853014 + lw $t0, 72($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8737379853014 + + # Jumping to else_8737379853014 + j else_8737379853014 + + then_8737379853014: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_6[0] = ' ' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 52($sp) # internal_6 = " " + + # internal_0 = internal_6 + lw $t0, 52($sp) + sw $t0, 76($sp) + + # Jumping to endif_8737379853014 + j endif_8737379853014 + + else_8737379853014: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_8 = address of allocated object Int + + # Get attribute columns of self + lw $t0, 84($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8737379794252 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8737379794252 + j object_get_attribute_8737379794252 + int_get_attribute_8737379794252: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 40($sp) # internal_9 = self.columns + j end_get_attribute_8737379794252 + bool_get_attribute_8737379794252: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 40($sp) # internal_9 = self.columns + j end_get_attribute_8737379794252 + object_get_attribute_8737379794252: + sw $t1, 40($sp) # internal_9 = self.columns + end_get_attribute_8737379794252: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 92($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_9 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function function_div + jal function_div + lw $ra, 8($sp) + sw $v1, 48($sp) # internal_10 = result of function_div + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute columns of self + lw $t0, 84($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8737379794279 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8737379794279 + j object_get_attribute_8737379794279 + int_get_attribute_8737379794279: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 32($sp) # internal_11 = self.columns + j end_get_attribute_8737379794279 + bool_get_attribute_8737379794279: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 32($sp) # internal_11 = self.columns + j end_get_attribute_8737379794279 + object_get_attribute_8737379794279: + sw $t1, 32($sp) # internal_11 = self.columns + end_get_attribute_8737379794279: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_10 + lw $t0, 48($sp) + sw $t0, 4($sp) # Storing internal_10 + + # Argument internal_11 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_11 + + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_12 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_12 + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing internal_12 + + # Argument position + lw $t0, 92($sp) + sw $t0, 0($sp) # Storing position + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_13 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_8 = internal_13 + lw $t0, 24($sp) + sw $t0, 44($sp) + + # If internal_8 then goto then_8737379853020 + lw $t0, 44($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8737379853020 + + # Jumping to else_8737379853020 + j else_8737379853020 + + then_8737379853020: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_14[0] = ' ' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 20($sp) # internal_14 = " " + + # internal_7 = internal_14 + lw $t0, 20($sp) + sw $t0, 48($sp) + + # Jumping to endif_8737379853020 + j endif_8737379853020 + + else_8737379853020: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_15 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 92($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_15 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_15 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_16 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 14 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 14 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_18 = address of allocated object Int + + # Get method north of CellularAutomaton + lw $t0, 84($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 96($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_16 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_16 + + # Calling function internal_19 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_17 = result of internal_19 + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_7 = internal_17 + lw $t0, 8($sp) + sw $t0, 48($sp) + + # Jumping to endif_8737379853020 + j endif_8737379853020 + + endif_8737379853020: + + # internal_0 = internal_7 + lw $t0, 48($sp) + sw $t0, 76($sp) + + # Jumping to endif_8737379853014 + j endif_8737379853014 + + endif_8737379853014: + + # Loading return value in $v1 + lw $v1, 76($sp) + + # Freeing space for local variables + addi $sp, $sp, 80 + + jr $ra + + function_northeast_at_CellularAutomaton: + # Function parameters + # $ra = 104($sp) + # self = 100($sp) + # position = 96($sp) + + # Reserving space for local variables + addi $sp, $sp, -96 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 88($sp) # internal_1 = address of allocated object Int + + # Get attribute columns of self + lw $t0, 100($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8737379794830 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8737379794830 + j object_get_attribute_8737379794830 + int_get_attribute_8737379794830: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 84($sp) # internal_2 = self.columns + j end_get_attribute_8737379794830 + bool_get_attribute_8737379794830: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 84($sp) # internal_2 = self.columns + j end_get_attribute_8737379794830 + object_get_attribute_8737379794830: + sw $t1, 84($sp) # internal_2 = self.columns + end_get_attribute_8737379794830: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 108($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_2 + lw $t0, 96($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 92($sp) # internal_3 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 76($sp) # internal_4 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_3 + lw $t0, 92($sp) + sw $t0, 4($sp) # Storing internal_3 + + # Argument internal_4 + lw $t0, 88($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 84($sp) # internal_5 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_1 = internal_5 + lw $t0, 72($sp) + sw $t0, 88($sp) + + # If internal_1 then goto then_8737379853418 + lw $t0, 88($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8737379853418 + + # Jumping to else_8737379853418 + j else_8737379853418 + + then_8737379853418: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_6[0] = ' ' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 68($sp) # internal_6 = " " + + # internal_0 = internal_6 + lw $t0, 68($sp) + sw $t0, 92($sp) + + # Jumping to endif_8737379853418 + j endif_8737379853418 + + else_8737379853418: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 60($sp) # internal_8 = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 56($sp) # internal_9 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 108($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_9 + lw $t0, 68($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 64($sp) # internal_10 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute columns of self + lw $t0, 100($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8737379795315 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8737379795315 + j object_get_attribute_8737379795315 + int_get_attribute_8737379795315: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 48($sp) # internal_11 = self.columns + j end_get_attribute_8737379795315 + bool_get_attribute_8737379795315: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 48($sp) # internal_11 = self.columns + j end_get_attribute_8737379795315 + object_get_attribute_8737379795315: + sw $t1, 48($sp) # internal_11 = self.columns + end_get_attribute_8737379795315: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_10 + lw $t0, 64($sp) + sw $t0, 4($sp) # Storing internal_10 + + # Argument internal_11 + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing internal_11 + + # Calling function function_div + jal function_div + lw $ra, 8($sp) + sw $v1, 56($sp) # internal_12 = result of function_div + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute columns of self + lw $t0, 100($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8737379795342 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8737379795342 + j object_get_attribute_8737379795342 + int_get_attribute_8737379795342: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 40($sp) # internal_13 = self.columns + j end_get_attribute_8737379795342 + bool_get_attribute_8737379795342: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 40($sp) # internal_13 = self.columns + j end_get_attribute_8737379795342 + object_get_attribute_8737379795342: + sw $t1, 40($sp) # internal_13 = self.columns + end_get_attribute_8737379795342: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_12 + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing internal_12 + + # Argument internal_13 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_13 + + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 48($sp) # internal_14 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_15 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 108($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_15 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_15 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_16 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_14 + lw $t0, 48($sp) + sw $t0, 4($sp) # Storing internal_14 + + # Argument internal_16 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_16 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_17 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_8 = internal_17 + lw $t0, 24($sp) + sw $t0, 60($sp) + + # If internal_8 then goto then_8737379853424 + lw $t0, 60($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8737379853424 + + # Jumping to else_8737379853424 + j else_8737379853424 + + then_8737379853424: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_18[0] = ' ' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 20($sp) # internal_18 = " " + + # internal_7 = internal_18 + lw $t0, 20($sp) + sw $t0, 64($sp) + + # Jumping to endif_8737379853424 + j endif_8737379853424 + + else_8737379853424: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_19 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 108($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_19 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_19 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_20 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 14 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 14 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_22 = address of allocated object Int + + # Get method north of CellularAutomaton + lw $t0, 100($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 112($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_20 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_20 + + # Calling function internal_23 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_21 = result of internal_23 + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_7 = internal_21 + lw $t0, 8($sp) + sw $t0, 64($sp) + + # Jumping to endif_8737379853424 + j endif_8737379853424 + + endif_8737379853424: + + # internal_0 = internal_7 + lw $t0, 64($sp) + sw $t0, 92($sp) + + # Jumping to endif_8737379853418 + j endif_8737379853418 + + endif_8737379853418: + + # Loading return value in $v1 + lw $v1, 92($sp) + + # Freeing space for local variables + addi $sp, $sp, 96 + + jr $ra + + function_southeast_at_CellularAutomaton: + # Function parameters + # $ra = 104($sp) + # self = 100($sp) + # position = 96($sp) + + # Reserving space for local variables + addi $sp, $sp, -96 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 88($sp) # internal_1 = address of allocated object Int + + # Get attribute board_size of self + lw $t0, 100($sp) # Get the address of self + lw $t1, 16($t0) # Get the attribute 'board_size' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8737379796176 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8737379796176 + j object_get_attribute_8737379796176 + int_get_attribute_8737379796176: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 84($sp) # internal_2 = self.board_size + j end_get_attribute_8737379796176 + bool_get_attribute_8737379796176: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 84($sp) # internal_2 = self.board_size + j end_get_attribute_8737379796176 + object_get_attribute_8737379796176: + sw $t1, 84($sp) # internal_2 = self.board_size + end_get_attribute_8737379796176: + + # Get attribute columns of self + lw $t0, 100($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8737379796200 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8737379796200 + j object_get_attribute_8737379796200 + int_get_attribute_8737379796200: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 80($sp) # internal_3 = self.columns + j end_get_attribute_8737379796200 + bool_get_attribute_8737379796200: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 80($sp) # internal_3 = self.columns + j end_get_attribute_8737379796200 + object_get_attribute_8737379796200: + sw $t1, 80($sp) # internal_3 = self.columns + end_get_attribute_8737379796200: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 108($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_3 + lw $t0, 92($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 88($sp) # internal_4 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 96($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_4 + lw $t0, 88($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 84($sp) # internal_5 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_1 = internal_5 + lw $t0, 72($sp) + sw $t0, 88($sp) + + # If internal_1 then goto then_8737379853562 + lw $t0, 88($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8737379853562 + + # Jumping to else_8737379853562 + j else_8737379853562 + + then_8737379853562: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_6[0] = ' ' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 68($sp) # internal_6 = " " + + # internal_0 = internal_6 + lw $t0, 68($sp) + sw $t0, 92($sp) + + # Jumping to endif_8737379853562 + j endif_8737379853562 + + else_8737379853562: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 60($sp) # internal_8 = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 56($sp) # internal_9 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 108($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_9 + lw $t0, 68($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 64($sp) # internal_10 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute columns of self + lw $t0, 100($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8737379796673 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8737379796673 + j object_get_attribute_8737379796673 + int_get_attribute_8737379796673: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 48($sp) # internal_11 = self.columns + j end_get_attribute_8737379796673 + bool_get_attribute_8737379796673: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 48($sp) # internal_11 = self.columns + j end_get_attribute_8737379796673 + object_get_attribute_8737379796673: + sw $t1, 48($sp) # internal_11 = self.columns + end_get_attribute_8737379796673: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_10 + lw $t0, 64($sp) + sw $t0, 4($sp) # Storing internal_10 + + # Argument internal_11 + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing internal_11 + + # Calling function function_div + jal function_div + lw $ra, 8($sp) + sw $v1, 56($sp) # internal_12 = result of function_div + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute columns of self + lw $t0, 100($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8737379796700 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8737379796700 + j object_get_attribute_8737379796700 + int_get_attribute_8737379796700: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 40($sp) # internal_13 = self.columns + j end_get_attribute_8737379796700 + bool_get_attribute_8737379796700: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 40($sp) # internal_13 = self.columns + j end_get_attribute_8737379796700 + object_get_attribute_8737379796700: + sw $t1, 40($sp) # internal_13 = self.columns + end_get_attribute_8737379796700: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_12 + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing internal_12 + + # Argument internal_13 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_13 + + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 48($sp) # internal_14 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_15 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 108($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_15 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_15 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_16 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_14 + lw $t0, 48($sp) + sw $t0, 4($sp) # Storing internal_14 + + # Argument internal_16 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_16 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_17 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_8 = internal_17 + lw $t0, 24($sp) + sw $t0, 60($sp) + + # If internal_8 then goto then_8737379853828 + lw $t0, 60($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8737379853828 + + # Jumping to else_8737379853828 + j else_8737379853828 + + then_8737379853828: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_18[0] = ' ' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 20($sp) # internal_18 = " " + + # internal_7 = internal_18 + lw $t0, 20($sp) + sw $t0, 64($sp) + + # Jumping to endif_8737379853828 + j endif_8737379853828 + + else_8737379853828: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_19 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 108($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_19 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_19 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_20 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 15 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 15 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_22 = address of allocated object Int + + # Get method south of CellularAutomaton + lw $t0, 100($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 112($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_20 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_20 + + # Calling function internal_23 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_21 = result of internal_23 + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_7 = internal_21 + lw $t0, 8($sp) + sw $t0, 64($sp) + + # Jumping to endif_8737379853828 + j endif_8737379853828 + + endif_8737379853828: + + # internal_0 = internal_7 + lw $t0, 64($sp) + sw $t0, 92($sp) + + # Jumping to endif_8737379853562 + j endif_8737379853562 + + endif_8737379853562: + + # Loading return value in $v1 + lw $v1, 92($sp) + + # Freeing space for local variables + addi $sp, $sp, 96 + + jr $ra + + function_southwest_at_CellularAutomaton: + # Function parameters + # $ra = 88($sp) + # self = 84($sp) + # position = 80($sp) + + # Reserving space for local variables + addi $sp, $sp, -80 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 72($sp) # internal_1 = address of allocated object Int + + # Get attribute board_size of self + lw $t0, 84($sp) # Get the address of self + lw $t1, 16($t0) # Get the attribute 'board_size' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8737379797538 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8737379797538 + j object_get_attribute_8737379797538 + int_get_attribute_8737379797538: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 68($sp) # internal_2 = self.board_size + j end_get_attribute_8737379797538 + bool_get_attribute_8737379797538: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 68($sp) # internal_2 = self.board_size + j end_get_attribute_8737379797538 + object_get_attribute_8737379797538: + sw $t1, 68($sp) # internal_2 = self.board_size + end_get_attribute_8737379797538: + + # Get attribute columns of self + lw $t0, 84($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8737379797562 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8737379797562 + j object_get_attribute_8737379797562 + int_get_attribute_8737379797562: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 64($sp) # internal_3 = self.columns + j end_get_attribute_8737379797562 + bool_get_attribute_8737379797562: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 64($sp) # internal_3 = self.columns + j end_get_attribute_8737379797562 + object_get_attribute_8737379797562: + sw $t1, 64($sp) # internal_3 = self.columns + end_get_attribute_8737379797562: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 92($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_3 + lw $t0, 76($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 72($sp) # internal_4 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 80($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_4 + lw $t0, 72($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 68($sp) # internal_5 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_1 = internal_5 + lw $t0, 56($sp) + sw $t0, 72($sp) + + # If internal_1 then goto then_8737379853942 + lw $t0, 72($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8737379853942 + + # Jumping to else_8737379853942 + j else_8737379853942 + + then_8737379853942: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_6[0] = ' ' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 52($sp) # internal_6 = " " + + # internal_0 = internal_6 + lw $t0, 52($sp) + sw $t0, 76($sp) + + # Jumping to endif_8737379853942 + j endif_8737379853942 + + else_8737379853942: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_8 = address of allocated object Int + + # Get attribute columns of self + lw $t0, 84($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8737379797736 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8737379797736 + j object_get_attribute_8737379797736 + int_get_attribute_8737379797736: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 40($sp) # internal_9 = self.columns + j end_get_attribute_8737379797736 + bool_get_attribute_8737379797736: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 40($sp) # internal_9 = self.columns + j end_get_attribute_8737379797736 + object_get_attribute_8737379797736: + sw $t1, 40($sp) # internal_9 = self.columns + end_get_attribute_8737379797736: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 92($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_9 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function function_div + jal function_div + lw $ra, 8($sp) + sw $v1, 48($sp) # internal_10 = result of function_div + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute columns of self + lw $t0, 84($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'columns' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8737379798535 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8737379798535 + j object_get_attribute_8737379798535 + int_get_attribute_8737379798535: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 32($sp) # internal_11 = self.columns + j end_get_attribute_8737379798535 + bool_get_attribute_8737379798535: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 32($sp) # internal_11 = self.columns + j end_get_attribute_8737379798535 + object_get_attribute_8737379798535: + sw $t1, 32($sp) # internal_11 = self.columns + end_get_attribute_8737379798535: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_10 + lw $t0, 48($sp) + sw $t0, 4($sp) # Storing internal_10 + + # Argument internal_11 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_11 + + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_12 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_12 + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing internal_12 + + # Argument position + lw $t0, 92($sp) + sw $t0, 0($sp) # Storing position + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_13 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_8 = internal_13 + lw $t0, 24($sp) + sw $t0, 44($sp) + + # If internal_8 then goto then_8737379853948 + lw $t0, 44($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8737379853948 + + # Jumping to else_8737379853948 + j else_8737379853948 + + then_8737379853948: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_14[0] = ' ' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 20($sp) # internal_14 = " " + + # internal_7 = internal_14 + lw $t0, 20($sp) + sw $t0, 48($sp) + + # Jumping to endif_8737379853948 + j endif_8737379853948 + + else_8737379853948: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_15 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 92($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_15 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_15 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_16 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 15 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 15 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_18 = address of allocated object Int + + # Get method south of CellularAutomaton + lw $t0, 84($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 96($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_16 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_16 + + # Calling function internal_19 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_17 = result of internal_19 + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_7 = internal_17 + lw $t0, 8($sp) + sw $t0, 48($sp) + + # Jumping to endif_8737379853948 + j endif_8737379853948 + + endif_8737379853948: + + # internal_0 = internal_7 + lw $t0, 48($sp) + sw $t0, 76($sp) + + # Jumping to endif_8737379853942 + j endif_8737379853942 + + endif_8737379853942: + + # Loading return value in $v1 + lw $v1, 76($sp) + + # Freeing space for local variables + addi $sp, $sp, 80 + + jr $ra + + function_neighbors_at_CellularAutomaton: + # Function parameters + # $ra = 324($sp) + # self = 320($sp) + # position = 316($sp) + + # Reserving space for local variables + addi $sp, $sp, -316 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 308($sp) # internal_1 = address of allocated object Int + + # Allocating Int 14 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 14 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 300($sp) # internal_3 = address of allocated object Int + + # Get method north of CellularAutomaton + lw $t0, 320($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 300($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 296($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 332($sp) + sw $t0, 4($sp) # Storing self + + # Argument position + lw $t0, 328($sp) + sw $t0, 0($sp) # Storing position + + # Calling function internal_4 + lw $t0, 308($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 316($sp) # internal_2 = result of internal_4 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 88 + sb $t0, 8($v0) # internal_5[0] = 'X' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 292($sp) # internal_5 = "X" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 316($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_5 + lw $t0, 304($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 300($sp) # internal_6 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_1 = internal_6 + lw $t0, 288($sp) + sw $t0, 308($sp) + + # If internal_1 then goto then_8737379853990 + lw $t0, 308($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8737379853990 + + # Jumping to else_8737379853990 + j else_8737379853990 + + then_8737379853990: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 284($sp) # internal_7 = address of allocated object Int + + # internal_0 = internal_7 + lw $t0, 284($sp) + sw $t0, 312($sp) + + # Jumping to endif_8737379853990 + j endif_8737379853990 + + else_8737379853990: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 280($sp) # internal_8 = address of allocated object Int + + # internal_0 = internal_8 + lw $t0, 280($sp) + sw $t0, 312($sp) + + # Jumping to endif_8737379853990 + j endif_8737379853990 + + endif_8737379853990: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 272($sp) # internal_10 = address of allocated object Int + + # Allocating Int 15 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 15 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 264($sp) # internal_12 = address of allocated object Int + + # Get method south of CellularAutomaton + lw $t0, 320($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 264($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 260($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 332($sp) + sw $t0, 4($sp) # Storing self + + # Argument position + lw $t0, 328($sp) + sw $t0, 0($sp) # Storing position + + # Calling function internal_13 + lw $t0, 272($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 280($sp) # internal_11 = result of internal_13 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 88 + sb $t0, 8($v0) # internal_14[0] = 'X' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 256($sp) # internal_14 = "X" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_11 + lw $t0, 280($sp) + sw $t0, 4($sp) # Storing internal_11 + + # Argument internal_14 + lw $t0, 268($sp) + sw $t0, 0($sp) # Storing internal_14 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 264($sp) # internal_15 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_10 = internal_15 + lw $t0, 252($sp) + sw $t0, 272($sp) + + # If internal_10 then goto then_8737379854029 + lw $t0, 272($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8737379854029 + + # Jumping to else_8737379854029 + j else_8737379854029 + + then_8737379854029: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 248($sp) # internal_16 = address of allocated object Int + + # internal_9 = internal_16 + lw $t0, 248($sp) + sw $t0, 276($sp) + + # Jumping to endif_8737379854029 + j endif_8737379854029 + + else_8737379854029: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 244($sp) # internal_17 = address of allocated object Int + + # internal_9 = internal_17 + lw $t0, 244($sp) + sw $t0, 276($sp) + + # Jumping to endif_8737379854029 + j endif_8737379854029 + + endif_8737379854029: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 324($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_9 + lw $t0, 288($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 252($sp) # internal_18 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 232($sp) # internal_20 = address of allocated object Int + + # Allocating Int 16 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 16 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 224($sp) # internal_22 = address of allocated object Int + + # Get method east of CellularAutomaton + lw $t0, 320($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 224($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 220($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 332($sp) + sw $t0, 4($sp) # Storing self + + # Argument position + lw $t0, 328($sp) + sw $t0, 0($sp) # Storing position + + # Calling function internal_23 + lw $t0, 232($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 240($sp) # internal_21 = result of internal_23 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 88 + sb $t0, 8($v0) # internal_24[0] = 'X' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 216($sp) # internal_24 = "X" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_21 + lw $t0, 240($sp) + sw $t0, 4($sp) # Storing internal_21 + + # Argument internal_24 + lw $t0, 228($sp) + sw $t0, 0($sp) # Storing internal_24 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 224($sp) # internal_25 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_20 = internal_25 + lw $t0, 212($sp) + sw $t0, 232($sp) + + # If internal_20 then goto then_8737379854074 + lw $t0, 232($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8737379854074 + + # Jumping to else_8737379854074 + j else_8737379854074 + + then_8737379854074: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 208($sp) # internal_26 = address of allocated object Int + + # internal_19 = internal_26 + lw $t0, 208($sp) + sw $t0, 236($sp) + + # Jumping to endif_8737379854074 + j endif_8737379854074 + + else_8737379854074: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 204($sp) # internal_27 = address of allocated object Int + + # internal_19 = internal_27 + lw $t0, 204($sp) + sw $t0, 236($sp) + + # Jumping to endif_8737379854074 + j endif_8737379854074 + + endif_8737379854074: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_18 + lw $t0, 252($sp) + sw $t0, 4($sp) # Storing internal_18 + + # Argument internal_19 + lw $t0, 248($sp) + sw $t0, 0($sp) # Storing internal_19 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 212($sp) # internal_28 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 192($sp) # internal_30 = address of allocated object Int + + # Allocating Int 17 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 17 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 184($sp) # internal_32 = address of allocated object Int + + # Get method west of CellularAutomaton + lw $t0, 320($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 184($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 180($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 332($sp) + sw $t0, 4($sp) # Storing self + + # Argument position + lw $t0, 328($sp) + sw $t0, 0($sp) # Storing position + + # Calling function internal_33 + lw $t0, 192($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 200($sp) # internal_31 = result of internal_33 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 88 + sb $t0, 8($v0) # internal_34[0] = 'X' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 176($sp) # internal_34 = "X" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_31 + lw $t0, 200($sp) + sw $t0, 4($sp) # Storing internal_31 + + # Argument internal_34 + lw $t0, 188($sp) + sw $t0, 0($sp) # Storing internal_34 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 184($sp) # internal_35 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_30 = internal_35 + lw $t0, 172($sp) + sw $t0, 192($sp) + + # If internal_30 then goto then_8737379854379 + lw $t0, 192($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8737379854379 + + # Jumping to else_8737379854379 + j else_8737379854379 + + then_8737379854379: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 168($sp) # internal_36 = address of allocated object Int + + # internal_29 = internal_36 + lw $t0, 168($sp) + sw $t0, 196($sp) + + # Jumping to endif_8737379854379 + j endif_8737379854379 + + else_8737379854379: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 164($sp) # internal_37 = address of allocated object Int + + # internal_29 = internal_37 + lw $t0, 164($sp) + sw $t0, 196($sp) + + # Jumping to endif_8737379854379 + j endif_8737379854379 + + endif_8737379854379: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_28 + lw $t0, 212($sp) + sw $t0, 4($sp) # Storing internal_28 + + # Argument internal_29 + lw $t0, 208($sp) + sw $t0, 0($sp) # Storing internal_29 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 172($sp) # internal_38 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 152($sp) # internal_40 = address of allocated object Int + + # Allocating Int 19 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 19 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 144($sp) # internal_42 = address of allocated object Int + + # Get method northeast of CellularAutomaton + lw $t0, 320($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 144($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 140($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 332($sp) + sw $t0, 4($sp) # Storing self + + # Argument position + lw $t0, 328($sp) + sw $t0, 0($sp) # Storing position + + # Calling function internal_43 + lw $t0, 152($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 160($sp) # internal_41 = result of internal_43 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 88 + sb $t0, 8($v0) # internal_44[0] = 'X' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 136($sp) # internal_44 = "X" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_41 + lw $t0, 160($sp) + sw $t0, 4($sp) # Storing internal_41 + + # Argument internal_44 + lw $t0, 148($sp) + sw $t0, 0($sp) # Storing internal_44 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 144($sp) # internal_45 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_40 = internal_45 + lw $t0, 132($sp) + sw $t0, 152($sp) + + # If internal_40 then goto then_8737379854424 + lw $t0, 152($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8737379854424 + + # Jumping to else_8737379854424 + j else_8737379854424 + + then_8737379854424: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 128($sp) # internal_46 = address of allocated object Int + + # internal_39 = internal_46 + lw $t0, 128($sp) + sw $t0, 156($sp) + + # Jumping to endif_8737379854424 + j endif_8737379854424 + + else_8737379854424: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 124($sp) # internal_47 = address of allocated object Int + + # internal_39 = internal_47 + lw $t0, 124($sp) + sw $t0, 156($sp) + + # Jumping to endif_8737379854424 + j endif_8737379854424 + + endif_8737379854424: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_38 + lw $t0, 172($sp) + sw $t0, 4($sp) # Storing internal_38 + + # Argument internal_39 + lw $t0, 168($sp) + sw $t0, 0($sp) # Storing internal_39 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 132($sp) # internal_48 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 112($sp) # internal_50 = address of allocated object Int + + # Allocating Int 18 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 18 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 104($sp) # internal_52 = address of allocated object Int + + # Get method northwest of CellularAutomaton + lw $t0, 320($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 104($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 100($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 332($sp) + sw $t0, 4($sp) # Storing self + + # Argument position + lw $t0, 328($sp) + sw $t0, 0($sp) # Storing position + + # Calling function internal_53 + lw $t0, 112($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 120($sp) # internal_51 = result of internal_53 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 88 + sb $t0, 8($v0) # internal_54[0] = 'X' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 96($sp) # internal_54 = "X" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_51 + lw $t0, 120($sp) + sw $t0, 4($sp) # Storing internal_51 + + # Argument internal_54 + lw $t0, 108($sp) + sw $t0, 0($sp) # Storing internal_54 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 104($sp) # internal_55 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_50 = internal_55 + lw $t0, 92($sp) + sw $t0, 112($sp) + + # If internal_50 then goto then_8737379854469 + lw $t0, 112($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8737379854469 + + # Jumping to else_8737379854469 + j else_8737379854469 + + then_8737379854469: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 88($sp) # internal_56 = address of allocated object Int + + # internal_49 = internal_56 + lw $t0, 88($sp) + sw $t0, 116($sp) + + # Jumping to endif_8737379854469 + j endif_8737379854469 + + else_8737379854469: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 84($sp) # internal_57 = address of allocated object Int + + # internal_49 = internal_57 + lw $t0, 84($sp) + sw $t0, 116($sp) + + # Jumping to endif_8737379854469 + j endif_8737379854469 + + endif_8737379854469: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_48 + lw $t0, 132($sp) + sw $t0, 4($sp) # Storing internal_48 + + # Argument internal_49 + lw $t0, 128($sp) + sw $t0, 0($sp) # Storing internal_49 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 92($sp) # internal_58 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 72($sp) # internal_60 = address of allocated object Int + + # Allocating Int 20 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 20 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 64($sp) # internal_62 = address of allocated object Int + + # Get method southeast of CellularAutomaton + lw $t0, 320($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 64($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 60($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 332($sp) + sw $t0, 4($sp) # Storing self + + # Argument position + lw $t0, 328($sp) + sw $t0, 0($sp) # Storing position + + # Calling function internal_63 + lw $t0, 72($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 80($sp) # internal_61 = result of internal_63 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 88 + sb $t0, 8($v0) # internal_64[0] = 'X' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 56($sp) # internal_64 = "X" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_61 + lw $t0, 80($sp) + sw $t0, 4($sp) # Storing internal_61 + + # Argument internal_64 + lw $t0, 68($sp) + sw $t0, 0($sp) # Storing internal_64 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 64($sp) # internal_65 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_60 = internal_65 + lw $t0, 52($sp) + sw $t0, 72($sp) + + # If internal_60 then goto then_8737379854514 + lw $t0, 72($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8737379854514 + + # Jumping to else_8737379854514 + j else_8737379854514 + + then_8737379854514: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 48($sp) # internal_66 = address of allocated object Int + + # internal_59 = internal_66 + lw $t0, 48($sp) + sw $t0, 76($sp) + + # Jumping to endif_8737379854514 + j endif_8737379854514 + + else_8737379854514: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_67 = address of allocated object Int + + # internal_59 = internal_67 + lw $t0, 44($sp) + sw $t0, 76($sp) + + # Jumping to endif_8737379854514 + j endif_8737379854514 + + endif_8737379854514: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_58 + lw $t0, 92($sp) + sw $t0, 4($sp) # Storing internal_58 + + # Argument internal_59 + lw $t0, 88($sp) + sw $t0, 0($sp) # Storing internal_59 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 52($sp) # internal_68 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_70 = address of allocated object Int + + # Allocating Int 21 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 21 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # internal_72 = address of allocated object Int + + # Get method southwest of CellularAutomaton + lw $t0, 320($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 24($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 20($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 332($sp) + sw $t0, 4($sp) # Storing self + + # Argument position + lw $t0, 328($sp) + sw $t0, 0($sp) # Storing position + + # Calling function internal_73 + lw $t0, 32($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_71 = result of internal_73 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 88 + sb $t0, 8($v0) # internal_74[0] = 'X' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 16($sp) # internal_74 = "X" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_71 + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing internal_71 + + # Argument internal_74 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_74 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_75 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_70 = internal_75 + lw $t0, 12($sp) + sw $t0, 32($sp) + + # If internal_70 then goto then_8737379854559 + lw $t0, 32($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8737379854559 + + # Jumping to else_8737379854559 + j else_8737379854559 + + then_8737379854559: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_76 = address of allocated object Int + + # internal_69 = internal_76 + lw $t0, 8($sp) + sw $t0, 36($sp) + + # Jumping to endif_8737379854559 + j endif_8737379854559 + + else_8737379854559: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_77 = address of allocated object Int + + # internal_69 = internal_77 + lw $t0, 4($sp) + sw $t0, 36($sp) + + # Jumping to endif_8737379854559 + j endif_8737379854559 + + endif_8737379854559: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_68 + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing internal_68 + + # Argument internal_69 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_69 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_78 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 316 + + jr $ra + + function_cell_at_next_evolution_at_CellularAutomaton: + # Function parameters + # $ra = 108($sp) + # self = 104($sp) + # position = 100($sp) + + # Reserving space for local variables + addi $sp, $sp, -100 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 92($sp) # internal_1 = address of allocated object Int + + # Allocating Int 22 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 22 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 84($sp) # internal_3 = address of allocated object Int + + # Get method neighbors of CellularAutomaton + lw $t0, 104($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 84($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 80($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 116($sp) + sw $t0, 4($sp) # Storing self + + # Argument position + lw $t0, 112($sp) + sw $t0, 0($sp) # Storing position + + # Calling function internal_4 + lw $t0, 92($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 100($sp) # internal_2 = result of internal_4 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 76($sp) # internal_5 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 100($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_5 + lw $t0, 88($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 84($sp) # internal_6 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_1 = internal_6 + lw $t0, 72($sp) + sw $t0, 92($sp) + + # If internal_1 then goto then_8737379854939 + lw $t0, 92($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8737379854939 + + # Jumping to else_8737379854939 + j else_8737379854939 + + then_8737379854939: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 88 + sb $t0, 8($v0) # internal_7[0] = 'X' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 68($sp) # internal_7 = "X" + + # internal_0 = internal_7 + lw $t0, 68($sp) + sw $t0, 96($sp) + + # Jumping to endif_8737379854939 + j endif_8737379854939 + + else_8737379854939: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 60($sp) # internal_9 = address of allocated object Int + + # Allocating Int 22 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 22 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 52($sp) # internal_11 = address of allocated object Int + + # Get method neighbors of CellularAutomaton + lw $t0, 104($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 52($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 48($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 116($sp) + sw $t0, 4($sp) # Storing self + + # Argument position + lw $t0, 112($sp) + sw $t0, 0($sp) # Storing position + + # Calling function internal_12 + lw $t0, 60($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 68($sp) # internal_10 = result of internal_12 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_13 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_10 + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing internal_10 + + # Argument internal_13 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_13 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 52($sp) # internal_14 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_9 = internal_14 + lw $t0, 40($sp) + sw $t0, 60($sp) + + # If internal_9 then goto then_8737379854933 + lw $t0, 60($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8737379854933 + + # Jumping to else_8737379854933 + j else_8737379854933 + + then_8737379854933: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_16 = address of allocated object Int + + # Allocating Int 13 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 13 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # internal_18 = address of allocated object Int + + # Get method cell of CellularAutomaton + lw $t0, 104($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 24($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 20($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 116($sp) + sw $t0, 4($sp) # Storing self + + # Argument position + lw $t0, 112($sp) + sw $t0, 0($sp) # Storing position + + # Calling function internal_19 + lw $t0, 32($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_17 = result of internal_19 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 88 + sb $t0, 8($v0) # internal_20[0] = 'X' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 16($sp) # internal_20 = "X" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_17 + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing internal_17 + + # Argument internal_20 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_20 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_21 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_16 = internal_21 + lw $t0, 12($sp) + sw $t0, 32($sp) + + # If internal_16 then goto then_8737379854921 + lw $t0, 32($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8737379854921 + + # Jumping to else_8737379854921 + j else_8737379854921 + + then_8737379854921: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 88 + sb $t0, 8($v0) # internal_22[0] = 'X' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 8($sp) # internal_22 = "X" + + # internal_15 = internal_22 + lw $t0, 8($sp) + sw $t0, 36($sp) + + # Jumping to endif_8737379854921 + j endif_8737379854921 + + else_8737379854921: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 45 + sb $t0, 8($v0) # internal_23[0] = '-' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_23 = "-" + + # internal_15 = internal_23 + lw $t0, 4($sp) + sw $t0, 36($sp) + + # Jumping to endif_8737379854921 + j endif_8737379854921 + + endif_8737379854921: + + # internal_8 = internal_15 + lw $t0, 36($sp) + sw $t0, 64($sp) + + # Jumping to endif_8737379854933 + j endif_8737379854933 + + else_8737379854933: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 45 + sb $t0, 8($v0) # internal_24[0] = '-' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 0($sp) # internal_24 = "-" + + # internal_8 = internal_24 + lw $t0, 0($sp) + sw $t0, 64($sp) + + # Jumping to endif_8737379854933 + j endif_8737379854933 + + endif_8737379854933: + + # internal_0 = internal_8 + lw $t0, 64($sp) + sw $t0, 96($sp) + + # Jumping to endif_8737379854939 + j endif_8737379854939 + + endif_8737379854939: + + # Loading return value in $v1 + lw $v1, 96($sp) + + # Freeing space for local variables + addi $sp, $sp, 100 + + jr $ra + + function_evolve_at_CellularAutomaton: + # Function parameters + # $ra = 72($sp) + # self = 68($sp) + + # Reserving space for local variables + addi $sp, $sp, -68 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 60($sp) # internal_1 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 76($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_1 + lw $t0, 72($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 76($sp) # position = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 12 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 12 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 48($sp) # internal_4 = address of allocated object Int + + # Get method num_cells of CellularAutomaton + lw $t0, 68($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 48($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 44($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 76($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_5 + lw $t0, 52($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 60($sp) # internal_3 = result of internal_5 + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing num + + # Argument internal_3 + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 68($sp) # num = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 9 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 9 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + sb $zero, 8($v0) # Null-terminator at the end of the string + + sw $v0, 40($sp) # temp = "" + + # Allocating NUll to internal_7 + sw $zero, 36($sp) # internal_7 = 0 + + while_start_8737379855029: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 76($sp) + sw $t0, 4($sp) # Storing position + + # Argument num + lw $t0, 68($sp) + sw $t0, 0($sp) # Storing num + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 44($sp) # internal_8 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_8 then goto while_body_8737379855029 + lw $t0, 32($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_body_8737379855029 + + # Jumping to while_end_8737379855029 + j while_end_8737379855029 + + while_body_8737379855029: + + # Allocating Int 23 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 23 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # internal_10 = address of allocated object Int + + # Get method cell_at_next_evolution of CellularAutomaton + lw $t0, 68($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 24($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 20($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 80($sp) + sw $t0, 4($sp) # Storing self + + # Argument position + lw $t0, 76($sp) + sw $t0, 0($sp) # Storing position + + # Calling function internal_11 + lw $t0, 32($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_9 = result of internal_11 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 12($sp) # internal_13 = address of allocated object Int + + # Get method concat of String + lw $t0, 40($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 12($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 8($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument temp + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing temp + + # Argument internal_9 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function internal_14 + lw $t0, 20($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 28($sp) # internal_12 = result of internal_14 + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument temp + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing temp + + # Argument internal_12 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_12 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 52($sp) # temp = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_15 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 76($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_15 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_15 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_16 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument position + lw $t0, 76($sp) + sw $t0, 4($sp) # Storing position + + # Argument internal_16 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_16 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 76($sp) # position = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to while_start_8737379855029 + j while_start_8737379855029 + + while_end_8737379855029: + + # Set attribute population_map of self + lw $t0, 68($sp) # $t0 = self + lw $t1, 40($sp) # $t1 = temp + beq $t1, $zero, object_set_attribute_8737379805380 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8737379805380 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8737379805380 + j object_set_attribute_8737379805380 + int_set_attribute_8737379805380: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($t0) # self.population_map = temp + j end_set_attribute_8737379805380 + bool_set_attribute_8737379805380: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($t0) # self.population_map = temp + j end_set_attribute_8737379805380 + object_set_attribute_8737379805380: + sw $t1, 20($t0) # self.population_map = temp + end_set_attribute_8737379805380: + + # Loading return value in $v1 + lw $v1, 68($sp) + + # Freeing space for local variables + addi $sp, $sp, 68 + + jr $ra + + function_option_at_CellularAutomaton: + # Function parameters + # $ra = 828($sp) + # self = 824($sp) + + # Reserving space for local variables + addi $sp, $sp, -824 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 820($sp) # num = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 33 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 33 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_1[0] = '\n' + + addi $t0, $zero, 80 + sb $t0, 9($v0) # internal_1[1] = 'P' + + addi $t0, $zero, 108 + sb $t0, 10($v0) # internal_1[2] = 'l' + + addi $t0, $zero, 101 + sb $t0, 11($v0) # internal_1[3] = 'e' + + addi $t0, $zero, 97 + sb $t0, 12($v0) # internal_1[4] = 'a' + + addi $t0, $zero, 115 + sb $t0, 13($v0) # internal_1[5] = 's' + + addi $t0, $zero, 101 + sb $t0, 14($v0) # internal_1[6] = 'e' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_1[7] = ' ' + + addi $t0, $zero, 99 + sb $t0, 16($v0) # internal_1[8] = 'c' + + addi $t0, $zero, 104 + sb $t0, 17($v0) # internal_1[9] = 'h' + + addi $t0, $zero, 111 + sb $t0, 18($v0) # internal_1[10] = 'o' + + addi $t0, $zero, 115 + sb $t0, 19($v0) # internal_1[11] = 's' + + addi $t0, $zero, 101 + sb $t0, 20($v0) # internal_1[12] = 'e' + + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_1[13] = ' ' + + addi $t0, $zero, 97 + sb $t0, 22($v0) # internal_1[14] = 'a' + + addi $t0, $zero, 32 + sb $t0, 23($v0) # internal_1[15] = ' ' + + addi $t0, $zero, 110 + sb $t0, 24($v0) # internal_1[16] = 'n' + + addi $t0, $zero, 117 + sb $t0, 25($v0) # internal_1[17] = 'u' + + addi $t0, $zero, 109 + sb $t0, 26($v0) # internal_1[18] = 'm' + + addi $t0, $zero, 98 + sb $t0, 27($v0) # internal_1[19] = 'b' + + addi $t0, $zero, 101 + sb $t0, 28($v0) # internal_1[20] = 'e' + + addi $t0, $zero, 114 + sb $t0, 29($v0) # internal_1[21] = 'r' + + addi $t0, $zero, 58 + sb $t0, 30($v0) # internal_1[22] = ':' + + addi $t0, $zero, 10 + sb $t0, 31($v0) # internal_1[23] = '\n' + + sb $zero, 32($v0) # Null-terminator at the end of the string + + sw $v0, 816($sp) # internal_1 = "\nPlease chose a number:\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 808($sp) # internal_3 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 824($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 808($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 804($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 836($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_1 + lw $t0, 828($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function internal_4 + lw $t0, 816($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 824($sp) # internal_2 = result of internal_4 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 21 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 21 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_5[0] = '\t' + + addi $t0, $zero, 49 + sb $t0, 9($v0) # internal_5[1] = '1' + + addi $t0, $zero, 58 + sb $t0, 10($v0) # internal_5[2] = ':' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_5[3] = ' ' + + addi $t0, $zero, 65 + sb $t0, 12($v0) # internal_5[4] = 'A' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_5[5] = ' ' + + addi $t0, $zero, 99 + sb $t0, 14($v0) # internal_5[6] = 'c' + + addi $t0, $zero, 114 + sb $t0, 15($v0) # internal_5[7] = 'r' + + addi $t0, $zero, 111 + sb $t0, 16($v0) # internal_5[8] = 'o' + + addi $t0, $zero, 115 + sb $t0, 17($v0) # internal_5[9] = 's' + + addi $t0, $zero, 115 + sb $t0, 18($v0) # internal_5[10] = 's' + + addi $t0, $zero, 10 + sb $t0, 19($v0) # internal_5[11] = '\n' + + sb $zero, 20($v0) # Null-terminator at the end of the string + + sw $v0, 800($sp) # internal_5 = "\t1: A cross\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 792($sp) # internal_7 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 824($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 792($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 788($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 836($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_5 + lw $t0, 812($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function internal_8 + lw $t0, 800($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 808($sp) # internal_6 = result of internal_8 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 56 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 56 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_9[0] = '\t' + + addi $t0, $zero, 50 + sb $t0, 9($v0) # internal_9[1] = '2' + + addi $t0, $zero, 58 + sb $t0, 10($v0) # internal_9[2] = ':' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_9[3] = ' ' + + addi $t0, $zero, 65 + sb $t0, 12($v0) # internal_9[4] = 'A' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_9[5] = ' ' + + addi $t0, $zero, 115 + sb $t0, 14($v0) # internal_9[6] = 's' + + addi $t0, $zero, 108 + sb $t0, 15($v0) # internal_9[7] = 'l' + + addi $t0, $zero, 97 + sb $t0, 16($v0) # internal_9[8] = 'a' + + addi $t0, $zero, 115 + sb $t0, 17($v0) # internal_9[9] = 's' + + addi $t0, $zero, 104 + sb $t0, 18($v0) # internal_9[10] = 'h' + + addi $t0, $zero, 32 + sb $t0, 19($v0) # internal_9[11] = ' ' + + addi $t0, $zero, 102 + sb $t0, 20($v0) # internal_9[12] = 'f' + + addi $t0, $zero, 114 + sb $t0, 21($v0) # internal_9[13] = 'r' + + addi $t0, $zero, 111 + sb $t0, 22($v0) # internal_9[14] = 'o' + + addi $t0, $zero, 109 + sb $t0, 23($v0) # internal_9[15] = 'm' + + addi $t0, $zero, 32 + sb $t0, 24($v0) # internal_9[16] = ' ' + + addi $t0, $zero, 116 + sb $t0, 25($v0) # internal_9[17] = 't' + + addi $t0, $zero, 104 + sb $t0, 26($v0) # internal_9[18] = 'h' + + addi $t0, $zero, 101 + sb $t0, 27($v0) # internal_9[19] = 'e' + + addi $t0, $zero, 32 + sb $t0, 28($v0) # internal_9[20] = ' ' + + addi $t0, $zero, 117 + sb $t0, 29($v0) # internal_9[21] = 'u' + + addi $t0, $zero, 112 + sb $t0, 30($v0) # internal_9[22] = 'p' + + addi $t0, $zero, 112 + sb $t0, 31($v0) # internal_9[23] = 'p' + + addi $t0, $zero, 101 + sb $t0, 32($v0) # internal_9[24] = 'e' + + addi $t0, $zero, 114 + sb $t0, 33($v0) # internal_9[25] = 'r' + + addi $t0, $zero, 32 + sb $t0, 34($v0) # internal_9[26] = ' ' + + addi $t0, $zero, 108 + sb $t0, 35($v0) # internal_9[27] = 'l' + + addi $t0, $zero, 101 + sb $t0, 36($v0) # internal_9[28] = 'e' + + addi $t0, $zero, 102 + sb $t0, 37($v0) # internal_9[29] = 'f' + + addi $t0, $zero, 116 + sb $t0, 38($v0) # internal_9[30] = 't' + + addi $t0, $zero, 32 + sb $t0, 39($v0) # internal_9[31] = ' ' + + addi $t0, $zero, 116 + sb $t0, 40($v0) # internal_9[32] = 't' + + addi $t0, $zero, 111 + sb $t0, 41($v0) # internal_9[33] = 'o' + + addi $t0, $zero, 32 + sb $t0, 42($v0) # internal_9[34] = ' ' + + addi $t0, $zero, 108 + sb $t0, 43($v0) # internal_9[35] = 'l' + + addi $t0, $zero, 111 + sb $t0, 44($v0) # internal_9[36] = 'o' + + addi $t0, $zero, 119 + sb $t0, 45($v0) # internal_9[37] = 'w' + + addi $t0, $zero, 101 + sb $t0, 46($v0) # internal_9[38] = 'e' + + addi $t0, $zero, 114 + sb $t0, 47($v0) # internal_9[39] = 'r' + + addi $t0, $zero, 32 + sb $t0, 48($v0) # internal_9[40] = ' ' + + addi $t0, $zero, 114 + sb $t0, 49($v0) # internal_9[41] = 'r' + + addi $t0, $zero, 105 + sb $t0, 50($v0) # internal_9[42] = 'i' + + addi $t0, $zero, 103 + sb $t0, 51($v0) # internal_9[43] = 'g' + + addi $t0, $zero, 104 + sb $t0, 52($v0) # internal_9[44] = 'h' + + addi $t0, $zero, 116 + sb $t0, 53($v0) # internal_9[45] = 't' + + addi $t0, $zero, 10 + sb $t0, 54($v0) # internal_9[46] = '\n' + + sb $zero, 55($v0) # Null-terminator at the end of the string + + sw $v0, 784($sp) # internal_9 = "\t2: A slash from the upper left to lower right\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 776($sp) # internal_11 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 824($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 776($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 772($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 836($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_9 + lw $t0, 796($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function internal_12 + lw $t0, 784($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 792($sp) # internal_10 = result of internal_12 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 56 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 56 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_13[0] = '\t' + + addi $t0, $zero, 51 + sb $t0, 9($v0) # internal_13[1] = '3' + + addi $t0, $zero, 58 + sb $t0, 10($v0) # internal_13[2] = ':' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_13[3] = ' ' + + addi $t0, $zero, 65 + sb $t0, 12($v0) # internal_13[4] = 'A' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_13[5] = ' ' + + addi $t0, $zero, 115 + sb $t0, 14($v0) # internal_13[6] = 's' + + addi $t0, $zero, 108 + sb $t0, 15($v0) # internal_13[7] = 'l' + + addi $t0, $zero, 97 + sb $t0, 16($v0) # internal_13[8] = 'a' + + addi $t0, $zero, 115 + sb $t0, 17($v0) # internal_13[9] = 's' + + addi $t0, $zero, 104 + sb $t0, 18($v0) # internal_13[10] = 'h' + + addi $t0, $zero, 32 + sb $t0, 19($v0) # internal_13[11] = ' ' + + addi $t0, $zero, 102 + sb $t0, 20($v0) # internal_13[12] = 'f' + + addi $t0, $zero, 114 + sb $t0, 21($v0) # internal_13[13] = 'r' + + addi $t0, $zero, 111 + sb $t0, 22($v0) # internal_13[14] = 'o' + + addi $t0, $zero, 109 + sb $t0, 23($v0) # internal_13[15] = 'm' + + addi $t0, $zero, 32 + sb $t0, 24($v0) # internal_13[16] = ' ' + + addi $t0, $zero, 116 + sb $t0, 25($v0) # internal_13[17] = 't' + + addi $t0, $zero, 104 + sb $t0, 26($v0) # internal_13[18] = 'h' + + addi $t0, $zero, 101 + sb $t0, 27($v0) # internal_13[19] = 'e' + + addi $t0, $zero, 32 + sb $t0, 28($v0) # internal_13[20] = ' ' + + addi $t0, $zero, 117 + sb $t0, 29($v0) # internal_13[21] = 'u' + + addi $t0, $zero, 112 + sb $t0, 30($v0) # internal_13[22] = 'p' + + addi $t0, $zero, 112 + sb $t0, 31($v0) # internal_13[23] = 'p' + + addi $t0, $zero, 101 + sb $t0, 32($v0) # internal_13[24] = 'e' + + addi $t0, $zero, 114 + sb $t0, 33($v0) # internal_13[25] = 'r' + + addi $t0, $zero, 32 + sb $t0, 34($v0) # internal_13[26] = ' ' + + addi $t0, $zero, 114 + sb $t0, 35($v0) # internal_13[27] = 'r' + + addi $t0, $zero, 105 + sb $t0, 36($v0) # internal_13[28] = 'i' + + addi $t0, $zero, 103 + sb $t0, 37($v0) # internal_13[29] = 'g' + + addi $t0, $zero, 104 + sb $t0, 38($v0) # internal_13[30] = 'h' + + addi $t0, $zero, 116 + sb $t0, 39($v0) # internal_13[31] = 't' + + addi $t0, $zero, 32 + sb $t0, 40($v0) # internal_13[32] = ' ' + + addi $t0, $zero, 116 + sb $t0, 41($v0) # internal_13[33] = 't' + + addi $t0, $zero, 111 + sb $t0, 42($v0) # internal_13[34] = 'o' + + addi $t0, $zero, 32 + sb $t0, 43($v0) # internal_13[35] = ' ' + + addi $t0, $zero, 108 + sb $t0, 44($v0) # internal_13[36] = 'l' + + addi $t0, $zero, 111 + sb $t0, 45($v0) # internal_13[37] = 'o' + + addi $t0, $zero, 119 + sb $t0, 46($v0) # internal_13[38] = 'w' + + addi $t0, $zero, 101 + sb $t0, 47($v0) # internal_13[39] = 'e' + + addi $t0, $zero, 114 + sb $t0, 48($v0) # internal_13[40] = 'r' + + addi $t0, $zero, 32 + sb $t0, 49($v0) # internal_13[41] = ' ' + + addi $t0, $zero, 108 + sb $t0, 50($v0) # internal_13[42] = 'l' + + addi $t0, $zero, 101 + sb $t0, 51($v0) # internal_13[43] = 'e' + + addi $t0, $zero, 102 + sb $t0, 52($v0) # internal_13[44] = 'f' + + addi $t0, $zero, 116 + sb $t0, 53($v0) # internal_13[45] = 't' + + addi $t0, $zero, 10 + sb $t0, 54($v0) # internal_13[46] = '\n' + + sb $zero, 55($v0) # Null-terminator at the end of the string + + sw $v0, 768($sp) # internal_13 = "\t3: A slash from the upper right to lower left\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 760($sp) # internal_15 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 824($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 760($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 756($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 836($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_13 + lw $t0, 780($sp) + sw $t0, 0($sp) # Storing internal_13 + + # Calling function internal_16 + lw $t0, 768($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 776($sp) # internal_14 = result of internal_16 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 18 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 18 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_17[0] = '\t' + + addi $t0, $zero, 52 + sb $t0, 9($v0) # internal_17[1] = '4' + + addi $t0, $zero, 58 + sb $t0, 10($v0) # internal_17[2] = ':' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_17[3] = ' ' + + addi $t0, $zero, 65 + sb $t0, 12($v0) # internal_17[4] = 'A' + + addi $t0, $zero, 110 + sb $t0, 13($v0) # internal_17[5] = 'n' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_17[6] = ' ' + + addi $t0, $zero, 88 + sb $t0, 15($v0) # internal_17[7] = 'X' + + addi $t0, $zero, 10 + sb $t0, 16($v0) # internal_17[8] = '\n' + + sb $zero, 17($v0) # Null-terminator at the end of the string + + sw $v0, 752($sp) # internal_17 = "\t4: An X\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 744($sp) # internal_19 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 824($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 744($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 740($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 836($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_17 + lw $t0, 764($sp) + sw $t0, 0($sp) # Storing internal_17 + + # Calling function internal_20 + lw $t0, 752($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 760($sp) # internal_18 = result of internal_20 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 34 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 34 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_21[0] = '\t' + + addi $t0, $zero, 53 + sb $t0, 9($v0) # internal_21[1] = '5' + + addi $t0, $zero, 58 + sb $t0, 10($v0) # internal_21[2] = ':' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_21[3] = ' ' + + addi $t0, $zero, 65 + sb $t0, 12($v0) # internal_21[4] = 'A' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_21[5] = ' ' + + addi $t0, $zero, 103 + sb $t0, 14($v0) # internal_21[6] = 'g' + + addi $t0, $zero, 114 + sb $t0, 15($v0) # internal_21[7] = 'r' + + addi $t0, $zero, 101 + sb $t0, 16($v0) # internal_21[8] = 'e' + + addi $t0, $zero, 97 + sb $t0, 17($v0) # internal_21[9] = 'a' + + addi $t0, $zero, 116 + sb $t0, 18($v0) # internal_21[10] = 't' + + addi $t0, $zero, 101 + sb $t0, 19($v0) # internal_21[11] = 'e' + + addi $t0, $zero, 114 + sb $t0, 20($v0) # internal_21[12] = 'r' + + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_21[13] = ' ' + + addi $t0, $zero, 116 + sb $t0, 22($v0) # internal_21[14] = 't' + + addi $t0, $zero, 104 + sb $t0, 23($v0) # internal_21[15] = 'h' + + addi $t0, $zero, 97 + sb $t0, 24($v0) # internal_21[16] = 'a' + + addi $t0, $zero, 110 + sb $t0, 25($v0) # internal_21[17] = 'n' + + addi $t0, $zero, 32 + sb $t0, 26($v0) # internal_21[18] = ' ' + + addi $t0, $zero, 115 + sb $t0, 27($v0) # internal_21[19] = 's' + + addi $t0, $zero, 105 + sb $t0, 28($v0) # internal_21[20] = 'i' + + addi $t0, $zero, 103 + sb $t0, 29($v0) # internal_21[21] = 'g' + + addi $t0, $zero, 110 + sb $t0, 30($v0) # internal_21[22] = 'n' + + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_21[23] = ' ' + + addi $t0, $zero, 10 + sb $t0, 32($v0) # internal_21[24] = '\n' + + sb $zero, 33($v0) # Null-terminator at the end of the string + + sw $v0, 736($sp) # internal_21 = "\t5: A greater than sign \n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 728($sp) # internal_23 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 824($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 728($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 724($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 836($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_21 + lw $t0, 748($sp) + sw $t0, 0($sp) # Storing internal_21 + + # Calling function internal_24 + lw $t0, 736($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 744($sp) # internal_22 = result of internal_24 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 30 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 30 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_25[0] = '\t' + + addi $t0, $zero, 54 + sb $t0, 9($v0) # internal_25[1] = '6' + + addi $t0, $zero, 58 + sb $t0, 10($v0) # internal_25[2] = ':' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_25[3] = ' ' + + addi $t0, $zero, 65 + sb $t0, 12($v0) # internal_25[4] = 'A' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_25[5] = ' ' + + addi $t0, $zero, 108 + sb $t0, 14($v0) # internal_25[6] = 'l' + + addi $t0, $zero, 101 + sb $t0, 15($v0) # internal_25[7] = 'e' + + addi $t0, $zero, 115 + sb $t0, 16($v0) # internal_25[8] = 's' + + addi $t0, $zero, 115 + sb $t0, 17($v0) # internal_25[9] = 's' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_25[10] = ' ' + + addi $t0, $zero, 116 + sb $t0, 19($v0) # internal_25[11] = 't' + + addi $t0, $zero, 104 + sb $t0, 20($v0) # internal_25[12] = 'h' + + addi $t0, $zero, 97 + sb $t0, 21($v0) # internal_25[13] = 'a' + + addi $t0, $zero, 110 + sb $t0, 22($v0) # internal_25[14] = 'n' + + addi $t0, $zero, 32 + sb $t0, 23($v0) # internal_25[15] = ' ' + + addi $t0, $zero, 115 + sb $t0, 24($v0) # internal_25[16] = 's' + + addi $t0, $zero, 105 + sb $t0, 25($v0) # internal_25[17] = 'i' + + addi $t0, $zero, 103 + sb $t0, 26($v0) # internal_25[18] = 'g' + + addi $t0, $zero, 110 + sb $t0, 27($v0) # internal_25[19] = 'n' + + addi $t0, $zero, 10 + sb $t0, 28($v0) # internal_25[20] = '\n' + + sb $zero, 29($v0) # Null-terminator at the end of the string + + sw $v0, 720($sp) # internal_25 = "\t6: A less than sign\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 712($sp) # internal_27 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 824($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 712($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 708($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 836($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_25 + lw $t0, 732($sp) + sw $t0, 0($sp) # Storing internal_25 + + # Calling function internal_28 + lw $t0, 720($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 728($sp) # internal_26 = result of internal_28 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 36 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 36 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_29[0] = '\t' + + addi $t0, $zero, 55 + sb $t0, 9($v0) # internal_29[1] = '7' + + addi $t0, $zero, 58 + sb $t0, 10($v0) # internal_29[2] = ':' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_29[3] = ' ' + + addi $t0, $zero, 84 + sb $t0, 12($v0) # internal_29[4] = 'T' + + addi $t0, $zero, 119 + sb $t0, 13($v0) # internal_29[5] = 'w' + + addi $t0, $zero, 111 + sb $t0, 14($v0) # internal_29[6] = 'o' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_29[7] = ' ' + + addi $t0, $zero, 103 + sb $t0, 16($v0) # internal_29[8] = 'g' + + addi $t0, $zero, 114 + sb $t0, 17($v0) # internal_29[9] = 'r' + + addi $t0, $zero, 101 + sb $t0, 18($v0) # internal_29[10] = 'e' + + addi $t0, $zero, 97 + sb $t0, 19($v0) # internal_29[11] = 'a' + + addi $t0, $zero, 116 + sb $t0, 20($v0) # internal_29[12] = 't' + + addi $t0, $zero, 101 + sb $t0, 21($v0) # internal_29[13] = 'e' + + addi $t0, $zero, 114 + sb $t0, 22($v0) # internal_29[14] = 'r' + + addi $t0, $zero, 32 + sb $t0, 23($v0) # internal_29[15] = ' ' + + addi $t0, $zero, 116 + sb $t0, 24($v0) # internal_29[16] = 't' + + addi $t0, $zero, 104 + sb $t0, 25($v0) # internal_29[17] = 'h' + + addi $t0, $zero, 97 + sb $t0, 26($v0) # internal_29[18] = 'a' + + addi $t0, $zero, 110 + sb $t0, 27($v0) # internal_29[19] = 'n' + + addi $t0, $zero, 32 + sb $t0, 28($v0) # internal_29[20] = ' ' + + addi $t0, $zero, 115 + sb $t0, 29($v0) # internal_29[21] = 's' + + addi $t0, $zero, 105 + sb $t0, 30($v0) # internal_29[22] = 'i' + + addi $t0, $zero, 103 + sb $t0, 31($v0) # internal_29[23] = 'g' + + addi $t0, $zero, 110 + sb $t0, 32($v0) # internal_29[24] = 'n' + + addi $t0, $zero, 115 + sb $t0, 33($v0) # internal_29[25] = 's' + + addi $t0, $zero, 10 + sb $t0, 34($v0) # internal_29[26] = '\n' + + sb $zero, 35($v0) # Null-terminator at the end of the string + + sw $v0, 704($sp) # internal_29 = "\t7: Two greater than signs\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 696($sp) # internal_31 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 824($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 696($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 692($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 836($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_29 + lw $t0, 716($sp) + sw $t0, 0($sp) # Storing internal_29 + + # Calling function internal_32 + lw $t0, 704($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 712($sp) # internal_30 = result of internal_32 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 33 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 33 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_33[0] = '\t' + + addi $t0, $zero, 56 + sb $t0, 9($v0) # internal_33[1] = '8' + + addi $t0, $zero, 58 + sb $t0, 10($v0) # internal_33[2] = ':' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_33[3] = ' ' + + addi $t0, $zero, 84 + sb $t0, 12($v0) # internal_33[4] = 'T' + + addi $t0, $zero, 119 + sb $t0, 13($v0) # internal_33[5] = 'w' + + addi $t0, $zero, 111 + sb $t0, 14($v0) # internal_33[6] = 'o' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_33[7] = ' ' + + addi $t0, $zero, 108 + sb $t0, 16($v0) # internal_33[8] = 'l' + + addi $t0, $zero, 101 + sb $t0, 17($v0) # internal_33[9] = 'e' + + addi $t0, $zero, 115 + sb $t0, 18($v0) # internal_33[10] = 's' + + addi $t0, $zero, 115 + sb $t0, 19($v0) # internal_33[11] = 's' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_33[12] = ' ' + + addi $t0, $zero, 116 + sb $t0, 21($v0) # internal_33[13] = 't' + + addi $t0, $zero, 104 + sb $t0, 22($v0) # internal_33[14] = 'h' + + addi $t0, $zero, 97 + sb $t0, 23($v0) # internal_33[15] = 'a' + + addi $t0, $zero, 110 + sb $t0, 24($v0) # internal_33[16] = 'n' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_33[17] = ' ' + + addi $t0, $zero, 115 + sb $t0, 26($v0) # internal_33[18] = 's' + + addi $t0, $zero, 105 + sb $t0, 27($v0) # internal_33[19] = 'i' + + addi $t0, $zero, 103 + sb $t0, 28($v0) # internal_33[20] = 'g' + + addi $t0, $zero, 110 + sb $t0, 29($v0) # internal_33[21] = 'n' + + addi $t0, $zero, 115 + sb $t0, 30($v0) # internal_33[22] = 's' + + addi $t0, $zero, 10 + sb $t0, 31($v0) # internal_33[23] = '\n' + + sb $zero, 32($v0) # Null-terminator at the end of the string + + sw $v0, 688($sp) # internal_33 = "\t8: Two less than signs\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 680($sp) # internal_35 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 824($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 680($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 676($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 836($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_33 + lw $t0, 700($sp) + sw $t0, 0($sp) # Storing internal_33 + + # Calling function internal_36 + lw $t0, 688($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 696($sp) # internal_34 = result of internal_36 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 19 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 19 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_37[0] = '\t' + + addi $t0, $zero, 57 + sb $t0, 9($v0) # internal_37[1] = '9' + + addi $t0, $zero, 58 + sb $t0, 10($v0) # internal_37[2] = ':' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_37[3] = ' ' + + addi $t0, $zero, 65 + sb $t0, 12($v0) # internal_37[4] = 'A' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_37[5] = ' ' + + addi $t0, $zero, 39 + sb $t0, 14($v0) # internal_37[6] = ''' + + addi $t0, $zero, 86 + sb $t0, 15($v0) # internal_37[7] = 'V' + + addi $t0, $zero, 39 + sb $t0, 16($v0) # internal_37[8] = ''' + + addi $t0, $zero, 10 + sb $t0, 17($v0) # internal_37[9] = '\n' + + sb $zero, 18($v0) # Null-terminator at the end of the string + + sw $v0, 672($sp) # internal_37 = "\t9: A 'V'\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 664($sp) # internal_39 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 824($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 664($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 660($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 836($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_37 + lw $t0, 684($sp) + sw $t0, 0($sp) # Storing internal_37 + + # Calling function internal_40 + lw $t0, 672($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 680($sp) # internal_38 = result of internal_40 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 29 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 29 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_41[0] = '\t' + + addi $t0, $zero, 49 + sb $t0, 9($v0) # internal_41[1] = '1' + + addi $t0, $zero, 48 + sb $t0, 10($v0) # internal_41[2] = '0' + + addi $t0, $zero, 58 + sb $t0, 11($v0) # internal_41[3] = ':' + + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_41[4] = ' ' + + addi $t0, $zero, 65 + sb $t0, 13($v0) # internal_41[5] = 'A' + + addi $t0, $zero, 110 + sb $t0, 14($v0) # internal_41[6] = 'n' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_41[7] = ' ' + + addi $t0, $zero, 105 + sb $t0, 16($v0) # internal_41[8] = 'i' + + addi $t0, $zero, 110 + sb $t0, 17($v0) # internal_41[9] = 'n' + + addi $t0, $zero, 118 + sb $t0, 18($v0) # internal_41[10] = 'v' + + addi $t0, $zero, 101 + sb $t0, 19($v0) # internal_41[11] = 'e' + + addi $t0, $zero, 114 + sb $t0, 20($v0) # internal_41[12] = 'r' + + addi $t0, $zero, 115 + sb $t0, 21($v0) # internal_41[13] = 's' + + addi $t0, $zero, 101 + sb $t0, 22($v0) # internal_41[14] = 'e' + + addi $t0, $zero, 32 + sb $t0, 23($v0) # internal_41[15] = ' ' + + addi $t0, $zero, 39 + sb $t0, 24($v0) # internal_41[16] = ''' + + addi $t0, $zero, 86 + sb $t0, 25($v0) # internal_41[17] = 'V' + + addi $t0, $zero, 39 + sb $t0, 26($v0) # internal_41[18] = ''' + + addi $t0, $zero, 10 + sb $t0, 27($v0) # internal_41[19] = '\n' + + sb $zero, 28($v0) # Null-terminator at the end of the string + + sw $v0, 656($sp) # internal_41 = "\t10: An inverse 'V'\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 648($sp) # internal_43 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 824($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 648($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 644($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 836($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_41 + lw $t0, 668($sp) + sw $t0, 0($sp) # Storing internal_41 + + # Calling function internal_44 + lw $t0, 656($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 664($sp) # internal_42 = result of internal_44 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 40 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 40 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_45[0] = '\t' + + addi $t0, $zero, 49 + sb $t0, 9($v0) # internal_45[1] = '1' + + addi $t0, $zero, 49 + sb $t0, 10($v0) # internal_45[2] = '1' + + addi $t0, $zero, 58 + sb $t0, 11($v0) # internal_45[3] = ':' + + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_45[4] = ' ' + + addi $t0, $zero, 78 + sb $t0, 13($v0) # internal_45[5] = 'N' + + addi $t0, $zero, 117 + sb $t0, 14($v0) # internal_45[6] = 'u' + + addi $t0, $zero, 109 + sb $t0, 15($v0) # internal_45[7] = 'm' + + addi $t0, $zero, 98 + sb $t0, 16($v0) # internal_45[8] = 'b' + + addi $t0, $zero, 101 + sb $t0, 17($v0) # internal_45[9] = 'e' + + addi $t0, $zero, 114 + sb $t0, 18($v0) # internal_45[10] = 'r' + + addi $t0, $zero, 115 + sb $t0, 19($v0) # internal_45[11] = 's' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_45[12] = ' ' + + addi $t0, $zero, 57 + sb $t0, 21($v0) # internal_45[13] = '9' + + addi $t0, $zero, 32 + sb $t0, 22($v0) # internal_45[14] = ' ' + + addi $t0, $zero, 97 + sb $t0, 23($v0) # internal_45[15] = 'a' + + addi $t0, $zero, 110 + sb $t0, 24($v0) # internal_45[16] = 'n' + + addi $t0, $zero, 100 + sb $t0, 25($v0) # internal_45[17] = 'd' + + addi $t0, $zero, 32 + sb $t0, 26($v0) # internal_45[18] = ' ' + + addi $t0, $zero, 49 + sb $t0, 27($v0) # internal_45[19] = '1' + + addi $t0, $zero, 48 + sb $t0, 28($v0) # internal_45[20] = '0' + + addi $t0, $zero, 32 + sb $t0, 29($v0) # internal_45[21] = ' ' + + addi $t0, $zero, 99 + sb $t0, 30($v0) # internal_45[22] = 'c' + + addi $t0, $zero, 111 + sb $t0, 31($v0) # internal_45[23] = 'o' + + addi $t0, $zero, 109 + sb $t0, 32($v0) # internal_45[24] = 'm' + + addi $t0, $zero, 98 + sb $t0, 33($v0) # internal_45[25] = 'b' + + addi $t0, $zero, 105 + sb $t0, 34($v0) # internal_45[26] = 'i' + + addi $t0, $zero, 110 + sb $t0, 35($v0) # internal_45[27] = 'n' + + addi $t0, $zero, 101 + sb $t0, 36($v0) # internal_45[28] = 'e' + + addi $t0, $zero, 100 + sb $t0, 37($v0) # internal_45[29] = 'd' + + addi $t0, $zero, 10 + sb $t0, 38($v0) # internal_45[30] = '\n' + + sb $zero, 39($v0) # Null-terminator at the end of the string + + sw $v0, 640($sp) # internal_45 = "\t11: Numbers 9 and 10 combined\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 632($sp) # internal_47 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 824($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 632($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 628($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 836($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_45 + lw $t0, 652($sp) + sw $t0, 0($sp) # Storing internal_45 + + # Calling function internal_48 + lw $t0, 640($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 648($sp) # internal_46 = result of internal_48 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 26 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 26 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_49[0] = '\t' + + addi $t0, $zero, 49 + sb $t0, 9($v0) # internal_49[1] = '1' + + addi $t0, $zero, 50 + sb $t0, 10($v0) # internal_49[2] = '2' + + addi $t0, $zero, 58 + sb $t0, 11($v0) # internal_49[3] = ':' + + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_49[4] = ' ' + + addi $t0, $zero, 65 + sb $t0, 13($v0) # internal_49[5] = 'A' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_49[6] = ' ' + + addi $t0, $zero, 102 + sb $t0, 15($v0) # internal_49[7] = 'f' + + addi $t0, $zero, 117 + sb $t0, 16($v0) # internal_49[8] = 'u' + + addi $t0, $zero, 108 + sb $t0, 17($v0) # internal_49[9] = 'l' + + addi $t0, $zero, 108 + sb $t0, 18($v0) # internal_49[10] = 'l' + + addi $t0, $zero, 32 + sb $t0, 19($v0) # internal_49[11] = ' ' + + addi $t0, $zero, 103 + sb $t0, 20($v0) # internal_49[12] = 'g' + + addi $t0, $zero, 114 + sb $t0, 21($v0) # internal_49[13] = 'r' + + addi $t0, $zero, 105 + sb $t0, 22($v0) # internal_49[14] = 'i' + + addi $t0, $zero, 100 + sb $t0, 23($v0) # internal_49[15] = 'd' + + addi $t0, $zero, 10 + sb $t0, 24($v0) # internal_49[16] = '\n' + + sb $zero, 25($v0) # Null-terminator at the end of the string + + sw $v0, 624($sp) # internal_49 = "\t12: A full grid\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 616($sp) # internal_51 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 824($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 616($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 612($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 836($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_49 + lw $t0, 636($sp) + sw $t0, 0($sp) # Storing internal_49 + + # Calling function internal_52 + lw $t0, 624($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 632($sp) # internal_50 = result of internal_52 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 20 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 20 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_53[0] = '\t' + + addi $t0, $zero, 49 + sb $t0, 9($v0) # internal_53[1] = '1' + + addi $t0, $zero, 51 + sb $t0, 10($v0) # internal_53[2] = '3' + + addi $t0, $zero, 58 + sb $t0, 11($v0) # internal_53[3] = ':' + + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_53[4] = ' ' + + addi $t0, $zero, 65 + sb $t0, 13($v0) # internal_53[5] = 'A' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_53[6] = ' ' + + addi $t0, $zero, 39 + sb $t0, 15($v0) # internal_53[7] = ''' + + addi $t0, $zero, 84 + sb $t0, 16($v0) # internal_53[8] = 'T' + + addi $t0, $zero, 39 + sb $t0, 17($v0) # internal_53[9] = ''' + + addi $t0, $zero, 10 + sb $t0, 18($v0) # internal_53[10] = '\n' + + sb $zero, 19($v0) # Null-terminator at the end of the string + + sw $v0, 608($sp) # internal_53 = "\t13: A 'T'\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 600($sp) # internal_55 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 824($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 600($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 596($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 836($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_53 + lw $t0, 620($sp) + sw $t0, 0($sp) # Storing internal_53 + + # Calling function internal_56 + lw $t0, 608($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 616($sp) # internal_54 = result of internal_56 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 25 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 25 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_57[0] = '\t' + + addi $t0, $zero, 49 + sb $t0, 9($v0) # internal_57[1] = '1' + + addi $t0, $zero, 52 + sb $t0, 10($v0) # internal_57[2] = '4' + + addi $t0, $zero, 58 + sb $t0, 11($v0) # internal_57[3] = ':' + + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_57[4] = ' ' + + addi $t0, $zero, 65 + sb $t0, 13($v0) # internal_57[5] = 'A' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_57[6] = ' ' + + addi $t0, $zero, 112 + sb $t0, 15($v0) # internal_57[7] = 'p' + + addi $t0, $zero, 108 + sb $t0, 16($v0) # internal_57[8] = 'l' + + addi $t0, $zero, 117 + sb $t0, 17($v0) # internal_57[9] = 'u' + + addi $t0, $zero, 115 + sb $t0, 18($v0) # internal_57[10] = 's' + + addi $t0, $zero, 32 + sb $t0, 19($v0) # internal_57[11] = ' ' + + addi $t0, $zero, 39 + sb $t0, 20($v0) # internal_57[12] = ''' + + addi $t0, $zero, 43 + sb $t0, 21($v0) # internal_57[13] = '+' + + addi $t0, $zero, 39 + sb $t0, 22($v0) # internal_57[14] = ''' + + addi $t0, $zero, 10 + sb $t0, 23($v0) # internal_57[15] = '\n' + + sb $zero, 24($v0) # Null-terminator at the end of the string + + sw $v0, 592($sp) # internal_57 = "\t14: A plus '+'\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 584($sp) # internal_59 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 824($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 584($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 580($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 836($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_57 + lw $t0, 604($sp) + sw $t0, 0($sp) # Storing internal_57 + + # Calling function internal_60 + lw $t0, 592($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 600($sp) # internal_58 = result of internal_60 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 20 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 20 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_61[0] = '\t' + + addi $t0, $zero, 49 + sb $t0, 9($v0) # internal_61[1] = '1' + + addi $t0, $zero, 53 + sb $t0, 10($v0) # internal_61[2] = '5' + + addi $t0, $zero, 58 + sb $t0, 11($v0) # internal_61[3] = ':' + + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_61[4] = ' ' + + addi $t0, $zero, 65 + sb $t0, 13($v0) # internal_61[5] = 'A' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_61[6] = ' ' + + addi $t0, $zero, 39 + sb $t0, 15($v0) # internal_61[7] = ''' + + addi $t0, $zero, 87 + sb $t0, 16($v0) # internal_61[8] = 'W' + + addi $t0, $zero, 39 + sb $t0, 17($v0) # internal_61[9] = ''' + + addi $t0, $zero, 10 + sb $t0, 18($v0) # internal_61[10] = '\n' + + sb $zero, 19($v0) # Null-terminator at the end of the string + + sw $v0, 576($sp) # internal_61 = "\t15: A 'W'\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 568($sp) # internal_63 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 824($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 568($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 564($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 836($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_61 + lw $t0, 588($sp) + sw $t0, 0($sp) # Storing internal_61 + + # Calling function internal_64 + lw $t0, 576($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 584($sp) # internal_62 = result of internal_64 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 21 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 21 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_65[0] = '\t' + + addi $t0, $zero, 49 + sb $t0, 9($v0) # internal_65[1] = '1' + + addi $t0, $zero, 54 + sb $t0, 10($v0) # internal_65[2] = '6' + + addi $t0, $zero, 58 + sb $t0, 11($v0) # internal_65[3] = ':' + + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_65[4] = ' ' + + addi $t0, $zero, 65 + sb $t0, 13($v0) # internal_65[5] = 'A' + + addi $t0, $zero, 110 + sb $t0, 14($v0) # internal_65[6] = 'n' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_65[7] = ' ' + + addi $t0, $zero, 39 + sb $t0, 16($v0) # internal_65[8] = ''' + + addi $t0, $zero, 77 + sb $t0, 17($v0) # internal_65[9] = 'M' + + addi $t0, $zero, 39 + sb $t0, 18($v0) # internal_65[10] = ''' + + addi $t0, $zero, 10 + sb $t0, 19($v0) # internal_65[11] = '\n' + + sb $zero, 20($v0) # Null-terminator at the end of the string + + sw $v0, 560($sp) # internal_65 = "\t16: An 'M'\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 552($sp) # internal_67 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 824($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 552($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 548($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 836($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_65 + lw $t0, 572($sp) + sw $t0, 0($sp) # Storing internal_65 + + # Calling function internal_68 + lw $t0, 560($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 568($sp) # internal_66 = result of internal_68 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 21 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 21 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_69[0] = '\t' + + addi $t0, $zero, 49 + sb $t0, 9($v0) # internal_69[1] = '1' + + addi $t0, $zero, 55 + sb $t0, 10($v0) # internal_69[2] = '7' + + addi $t0, $zero, 58 + sb $t0, 11($v0) # internal_69[3] = ':' + + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_69[4] = ' ' + + addi $t0, $zero, 65 + sb $t0, 13($v0) # internal_69[5] = 'A' + + addi $t0, $zero, 110 + sb $t0, 14($v0) # internal_69[6] = 'n' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_69[7] = ' ' + + addi $t0, $zero, 39 + sb $t0, 16($v0) # internal_69[8] = ''' + + addi $t0, $zero, 69 + sb $t0, 17($v0) # internal_69[9] = 'E' + + addi $t0, $zero, 39 + sb $t0, 18($v0) # internal_69[10] = ''' + + addi $t0, $zero, 10 + sb $t0, 19($v0) # internal_69[11] = '\n' + + sb $zero, 20($v0) # Null-terminator at the end of the string + + sw $v0, 544($sp) # internal_69 = "\t17: An 'E'\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 536($sp) # internal_71 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 824($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 536($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 532($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 836($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_69 + lw $t0, 556($sp) + sw $t0, 0($sp) # Storing internal_69 + + # Calling function internal_72 + lw $t0, 544($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 552($sp) # internal_70 = result of internal_72 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 20 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 20 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_73[0] = '\t' + + addi $t0, $zero, 49 + sb $t0, 9($v0) # internal_73[1] = '1' + + addi $t0, $zero, 56 + sb $t0, 10($v0) # internal_73[2] = '8' + + addi $t0, $zero, 58 + sb $t0, 11($v0) # internal_73[3] = ':' + + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_73[4] = ' ' + + addi $t0, $zero, 65 + sb $t0, 13($v0) # internal_73[5] = 'A' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_73[6] = ' ' + + addi $t0, $zero, 39 + sb $t0, 15($v0) # internal_73[7] = ''' + + addi $t0, $zero, 51 + sb $t0, 16($v0) # internal_73[8] = '3' + + addi $t0, $zero, 39 + sb $t0, 17($v0) # internal_73[9] = ''' + + addi $t0, $zero, 10 + sb $t0, 18($v0) # internal_73[10] = '\n' + + sb $zero, 19($v0) # Null-terminator at the end of the string + + sw $v0, 528($sp) # internal_73 = "\t18: A '3'\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 520($sp) # internal_75 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 824($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 520($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 516($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 836($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_73 + lw $t0, 540($sp) + sw $t0, 0($sp) # Storing internal_73 + + # Calling function internal_76 + lw $t0, 528($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 536($sp) # internal_74 = result of internal_76 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 21 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 21 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_77[0] = '\t' + + addi $t0, $zero, 49 + sb $t0, 9($v0) # internal_77[1] = '1' + + addi $t0, $zero, 57 + sb $t0, 10($v0) # internal_77[2] = '9' + + addi $t0, $zero, 58 + sb $t0, 11($v0) # internal_77[3] = ':' + + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_77[4] = ' ' + + addi $t0, $zero, 65 + sb $t0, 13($v0) # internal_77[5] = 'A' + + addi $t0, $zero, 110 + sb $t0, 14($v0) # internal_77[6] = 'n' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_77[7] = ' ' + + addi $t0, $zero, 39 + sb $t0, 16($v0) # internal_77[8] = ''' + + addi $t0, $zero, 79 + sb $t0, 17($v0) # internal_77[9] = 'O' + + addi $t0, $zero, 39 + sb $t0, 18($v0) # internal_77[10] = ''' + + addi $t0, $zero, 10 + sb $t0, 19($v0) # internal_77[11] = '\n' + + sb $zero, 20($v0) # Null-terminator at the end of the string + + sw $v0, 512($sp) # internal_77 = "\t19: An 'O'\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 504($sp) # internal_79 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 824($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 504($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 500($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 836($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_77 + lw $t0, 524($sp) + sw $t0, 0($sp) # Storing internal_77 + + # Calling function internal_80 + lw $t0, 512($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 520($sp) # internal_78 = result of internal_80 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 21 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 21 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_81[0] = '\t' + + addi $t0, $zero, 50 + sb $t0, 9($v0) # internal_81[1] = '2' + + addi $t0, $zero, 48 + sb $t0, 10($v0) # internal_81[2] = '0' + + addi $t0, $zero, 58 + sb $t0, 11($v0) # internal_81[3] = ':' + + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_81[4] = ' ' + + addi $t0, $zero, 65 + sb $t0, 13($v0) # internal_81[5] = 'A' + + addi $t0, $zero, 110 + sb $t0, 14($v0) # internal_81[6] = 'n' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_81[7] = ' ' + + addi $t0, $zero, 39 + sb $t0, 16($v0) # internal_81[8] = ''' + + addi $t0, $zero, 56 + sb $t0, 17($v0) # internal_81[9] = '8' + + addi $t0, $zero, 39 + sb $t0, 18($v0) # internal_81[10] = ''' + + addi $t0, $zero, 10 + sb $t0, 19($v0) # internal_81[11] = '\n' + + sb $zero, 20($v0) # Null-terminator at the end of the string + + sw $v0, 496($sp) # internal_81 = "\t20: An '8'\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 488($sp) # internal_83 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 824($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 488($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 484($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 836($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_81 + lw $t0, 508($sp) + sw $t0, 0($sp) # Storing internal_81 + + # Calling function internal_84 + lw $t0, 496($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 504($sp) # internal_82 = result of internal_84 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 21 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 21 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 9 + sb $t0, 8($v0) # internal_85[0] = '\t' + + addi $t0, $zero, 50 + sb $t0, 9($v0) # internal_85[1] = '2' + + addi $t0, $zero, 49 + sb $t0, 10($v0) # internal_85[2] = '1' + + addi $t0, $zero, 58 + sb $t0, 11($v0) # internal_85[3] = ':' + + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_85[4] = ' ' + + addi $t0, $zero, 65 + sb $t0, 13($v0) # internal_85[5] = 'A' + + addi $t0, $zero, 110 + sb $t0, 14($v0) # internal_85[6] = 'n' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_85[7] = ' ' + + addi $t0, $zero, 39 + sb $t0, 16($v0) # internal_85[8] = ''' + + addi $t0, $zero, 83 + sb $t0, 17($v0) # internal_85[9] = 'S' + + addi $t0, $zero, 39 + sb $t0, 18($v0) # internal_85[10] = ''' + + addi $t0, $zero, 10 + sb $t0, 19($v0) # internal_85[11] = '\n' + + sb $zero, 20($v0) # Null-terminator at the end of the string + + sw $v0, 480($sp) # internal_85 = "\t21: An 'S'\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 472($sp) # internal_87 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 824($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 472($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 468($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 836($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_85 + lw $t0, 492($sp) + sw $t0, 0($sp) # Storing internal_85 + + # Calling function internal_88 + lw $t0, 480($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 488($sp) # internal_86 = result of internal_88 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 24 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 24 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 89 + sb $t0, 8($v0) # internal_89[0] = 'Y' + + addi $t0, $zero, 111 + sb $t0, 9($v0) # internal_89[1] = 'o' + + addi $t0, $zero, 117 + sb $t0, 10($v0) # internal_89[2] = 'u' + + addi $t0, $zero, 114 + sb $t0, 11($v0) # internal_89[3] = 'r' + + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_89[4] = ' ' + + addi $t0, $zero, 99 + sb $t0, 13($v0) # internal_89[5] = 'c' + + addi $t0, $zero, 104 + sb $t0, 14($v0) # internal_89[6] = 'h' + + addi $t0, $zero, 111 + sb $t0, 15($v0) # internal_89[7] = 'o' + + addi $t0, $zero, 105 + sb $t0, 16($v0) # internal_89[8] = 'i' + + addi $t0, $zero, 99 + sb $t0, 17($v0) # internal_89[9] = 'c' + + addi $t0, $zero, 101 + sb $t0, 18($v0) # internal_89[10] = 'e' + + addi $t0, $zero, 32 + sb $t0, 19($v0) # internal_89[11] = ' ' + + addi $t0, $zero, 61 + sb $t0, 20($v0) # internal_89[12] = '=' + + addi $t0, $zero, 62 + sb $t0, 21($v0) # internal_89[13] = '>' + + addi $t0, $zero, 32 + sb $t0, 22($v0) # internal_89[14] = ' ' + + sb $zero, 23($v0) # Null-terminator at the end of the string + + sw $v0, 464($sp) # internal_89 = "Your choice => " + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 456($sp) # internal_91 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 824($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 456($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 452($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 836($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_89 + lw $t0, 476($sp) + sw $t0, 0($sp) # Storing internal_89 + + # Calling function internal_92 + lw $t0, 464($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 472($sp) # internal_90 = result of internal_92 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 7 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 7 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 444($sp) # internal_94 = address of allocated object Int + + # Get method in_int of CellularAutomaton + lw $t0, 824($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 444($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 440($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 832($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_95 + lw $t0, 448($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 456($sp) # internal_93 = result of internal_95 + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 832($sp) + sw $t0, 4($sp) # Storing num + + # Argument internal_93 + lw $t0, 460($sp) + sw $t0, 0($sp) # Storing internal_93 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 832($sp) # num = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_96[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 436($sp) # internal_96 = "\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 428($sp) # internal_98 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 824($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 428($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 424($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 836($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_96 + lw $t0, 448($sp) + sw $t0, 0($sp) # Storing internal_96 + + # Calling function internal_99 + lw $t0, 436($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 444($sp) # internal_97 = result of internal_99 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 416($sp) # internal_101 = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 412($sp) # internal_102 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 832($sp) + sw $t0, 4($sp) # Storing num + + # Argument internal_102 + lw $t0, 424($sp) + sw $t0, 0($sp) # Storing internal_102 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 420($sp) # internal_103 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_101 = internal_103 + lw $t0, 408($sp) + sw $t0, 416($sp) + + # If internal_101 then goto then_8737379857231 + lw $t0, 416($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8737379857231 + + # Jumping to else_8737379857231 + j else_8737379857231 + + then_8737379857231: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 29 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 29 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_104[0] = ' ' + + addi $t0, $zero, 88 + sb $t0, 9($v0) # internal_104[1] = 'X' + + addi $t0, $zero, 88 + sb $t0, 10($v0) # internal_104[2] = 'X' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_104[3] = ' ' + + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_104[4] = ' ' + + addi $t0, $zero, 88 + sb $t0, 13($v0) # internal_104[5] = 'X' + + addi $t0, $zero, 88 + sb $t0, 14($v0) # internal_104[6] = 'X' + + addi $t0, $zero, 88 + sb $t0, 15($v0) # internal_104[7] = 'X' + + addi $t0, $zero, 88 + sb $t0, 16($v0) # internal_104[8] = 'X' + + addi $t0, $zero, 32 + sb $t0, 17($v0) # internal_104[9] = ' ' + + addi $t0, $zero, 88 + sb $t0, 18($v0) # internal_104[10] = 'X' + + addi $t0, $zero, 88 + sb $t0, 19($v0) # internal_104[11] = 'X' + + addi $t0, $zero, 88 + sb $t0, 20($v0) # internal_104[12] = 'X' + + addi $t0, $zero, 88 + sb $t0, 21($v0) # internal_104[13] = 'X' + + addi $t0, $zero, 32 + sb $t0, 22($v0) # internal_104[14] = ' ' + + addi $t0, $zero, 32 + sb $t0, 23($v0) # internal_104[15] = ' ' + + addi $t0, $zero, 88 + sb $t0, 24($v0) # internal_104[16] = 'X' + + addi $t0, $zero, 88 + sb $t0, 25($v0) # internal_104[17] = 'X' + + addi $t0, $zero, 32 + sb $t0, 26($v0) # internal_104[18] = ' ' + + addi $t0, $zero, 32 + sb $t0, 27($v0) # internal_104[19] = ' ' + + sb $zero, 28($v0) # Null-terminator at the end of the string + + sw $v0, 404($sp) # internal_104 = " XX XXXX XXXX XX " + + # internal_100 = internal_104 + lw $t0, 404($sp) + sw $t0, 420($sp) + + # Jumping to endif_8737379857231 + j endif_8737379857231 + + else_8737379857231: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 396($sp) # internal_106 = address of allocated object Int + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 392($sp) # internal_107 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 832($sp) + sw $t0, 4($sp) # Storing num + + # Argument internal_107 + lw $t0, 404($sp) + sw $t0, 0($sp) # Storing internal_107 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 400($sp) # internal_108 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_106 = internal_108 + lw $t0, 388($sp) + sw $t0, 396($sp) + + # If internal_106 then goto then_8737379857225 + lw $t0, 396($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8737379857225 + + # Jumping to else_8737379857225 + j else_8737379857225 + + then_8737379857225: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 34 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 34 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_109[0] = ' ' + + addi $t0, $zero, 32 + sb $t0, 9($v0) # internal_109[1] = ' ' + + addi $t0, $zero, 32 + sb $t0, 10($v0) # internal_109[2] = ' ' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_109[3] = ' ' + + addi $t0, $zero, 88 + sb $t0, 12($v0) # internal_109[4] = 'X' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_109[5] = ' ' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_109[6] = ' ' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_109[7] = ' ' + + addi $t0, $zero, 88 + sb $t0, 16($v0) # internal_109[8] = 'X' + + addi $t0, $zero, 32 + sb $t0, 17($v0) # internal_109[9] = ' ' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_109[10] = ' ' + + addi $t0, $zero, 32 + sb $t0, 19($v0) # internal_109[11] = ' ' + + addi $t0, $zero, 88 + sb $t0, 20($v0) # internal_109[12] = 'X' + + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_109[13] = ' ' + + addi $t0, $zero, 32 + sb $t0, 22($v0) # internal_109[14] = ' ' + + addi $t0, $zero, 32 + sb $t0, 23($v0) # internal_109[15] = ' ' + + addi $t0, $zero, 88 + sb $t0, 24($v0) # internal_109[16] = 'X' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_109[17] = ' ' + + addi $t0, $zero, 32 + sb $t0, 26($v0) # internal_109[18] = ' ' + + addi $t0, $zero, 32 + sb $t0, 27($v0) # internal_109[19] = ' ' + + addi $t0, $zero, 88 + sb $t0, 28($v0) # internal_109[20] = 'X' + + addi $t0, $zero, 32 + sb $t0, 29($v0) # internal_109[21] = ' ' + + addi $t0, $zero, 32 + sb $t0, 30($v0) # internal_109[22] = ' ' + + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_109[23] = ' ' + + addi $t0, $zero, 32 + sb $t0, 32($v0) # internal_109[24] = ' ' + + sb $zero, 33($v0) # Null-terminator at the end of the string + + sw $v0, 384($sp) # internal_109 = " X X X X X " + + # internal_105 = internal_109 + lw $t0, 384($sp) + sw $t0, 400($sp) + + # Jumping to endif_8737379857225 + j endif_8737379857225 + + else_8737379857225: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 376($sp) # internal_111 = address of allocated object Int + + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 372($sp) # internal_112 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 832($sp) + sw $t0, 4($sp) # Storing num + + # Argument internal_112 + lw $t0, 384($sp) + sw $t0, 0($sp) # Storing internal_112 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 380($sp) # internal_113 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_111 = internal_113 + lw $t0, 368($sp) + sw $t0, 376($sp) + + # If internal_111 then goto then_8737379857219 + lw $t0, 376($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8737379857219 + + # Jumping to else_8737379857219 + j else_8737379857219 + + then_8737379857219: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 34 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 34 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 88 + sb $t0, 8($v0) # internal_114[0] = 'X' + + addi $t0, $zero, 32 + sb $t0, 9($v0) # internal_114[1] = ' ' + + addi $t0, $zero, 32 + sb $t0, 10($v0) # internal_114[2] = ' ' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_114[3] = ' ' + + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_114[4] = ' ' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_114[5] = ' ' + + addi $t0, $zero, 88 + sb $t0, 14($v0) # internal_114[6] = 'X' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_114[7] = ' ' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_114[8] = ' ' + + addi $t0, $zero, 32 + sb $t0, 17($v0) # internal_114[9] = ' ' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_114[10] = ' ' + + addi $t0, $zero, 32 + sb $t0, 19($v0) # internal_114[11] = ' ' + + addi $t0, $zero, 88 + sb $t0, 20($v0) # internal_114[12] = 'X' + + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_114[13] = ' ' + + addi $t0, $zero, 32 + sb $t0, 22($v0) # internal_114[14] = ' ' + + addi $t0, $zero, 32 + sb $t0, 23($v0) # internal_114[15] = ' ' + + addi $t0, $zero, 32 + sb $t0, 24($v0) # internal_114[16] = ' ' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_114[17] = ' ' + + addi $t0, $zero, 88 + sb $t0, 26($v0) # internal_114[18] = 'X' + + addi $t0, $zero, 32 + sb $t0, 27($v0) # internal_114[19] = ' ' + + addi $t0, $zero, 32 + sb $t0, 28($v0) # internal_114[20] = ' ' + + addi $t0, $zero, 32 + sb $t0, 29($v0) # internal_114[21] = ' ' + + addi $t0, $zero, 32 + sb $t0, 30($v0) # internal_114[22] = ' ' + + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_114[23] = ' ' + + addi $t0, $zero, 88 + sb $t0, 32($v0) # internal_114[24] = 'X' + + sb $zero, 33($v0) # Null-terminator at the end of the string + + sw $v0, 364($sp) # internal_114 = "X X X X X" + + # internal_110 = internal_114 + lw $t0, 364($sp) + sw $t0, 380($sp) + + # Jumping to endif_8737379857219 + j endif_8737379857219 + + else_8737379857219: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 356($sp) # internal_116 = address of allocated object Int + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 352($sp) # internal_117 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 832($sp) + sw $t0, 4($sp) # Storing num + + # Argument internal_117 + lw $t0, 364($sp) + sw $t0, 0($sp) # Storing internal_117 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 360($sp) # internal_118 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_116 = internal_118 + lw $t0, 348($sp) + sw $t0, 356($sp) + + # If internal_116 then goto then_8737379857213 + lw $t0, 356($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8737379857213 + + # Jumping to else_8737379857213 + j else_8737379857213 + + then_8737379857213: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 34 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 34 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 88 + sb $t0, 8($v0) # internal_119[0] = 'X' + + addi $t0, $zero, 32 + sb $t0, 9($v0) # internal_119[1] = ' ' + + addi $t0, $zero, 32 + sb $t0, 10($v0) # internal_119[2] = ' ' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_119[3] = ' ' + + addi $t0, $zero, 88 + sb $t0, 12($v0) # internal_119[4] = 'X' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_119[5] = ' ' + + addi $t0, $zero, 88 + sb $t0, 14($v0) # internal_119[6] = 'X' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_119[7] = ' ' + + addi $t0, $zero, 88 + sb $t0, 16($v0) # internal_119[8] = 'X' + + addi $t0, $zero, 32 + sb $t0, 17($v0) # internal_119[9] = ' ' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_119[10] = ' ' + + addi $t0, $zero, 32 + sb $t0, 19($v0) # internal_119[11] = ' ' + + addi $t0, $zero, 88 + sb $t0, 20($v0) # internal_119[12] = 'X' + + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_119[13] = ' ' + + addi $t0, $zero, 32 + sb $t0, 22($v0) # internal_119[14] = ' ' + + addi $t0, $zero, 32 + sb $t0, 23($v0) # internal_119[15] = ' ' + + addi $t0, $zero, 88 + sb $t0, 24($v0) # internal_119[16] = 'X' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_119[17] = ' ' + + addi $t0, $zero, 88 + sb $t0, 26($v0) # internal_119[18] = 'X' + + addi $t0, $zero, 32 + sb $t0, 27($v0) # internal_119[19] = ' ' + + addi $t0, $zero, 88 + sb $t0, 28($v0) # internal_119[20] = 'X' + + addi $t0, $zero, 32 + sb $t0, 29($v0) # internal_119[21] = ' ' + + addi $t0, $zero, 32 + sb $t0, 30($v0) # internal_119[22] = ' ' + + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_119[23] = ' ' + + addi $t0, $zero, 88 + sb $t0, 32($v0) # internal_119[24] = 'X' + + sb $zero, 33($v0) # Null-terminator at the end of the string + + sw $v0, 344($sp) # internal_119 = "X X X X X X X X X" + + # internal_115 = internal_119 + lw $t0, 344($sp) + sw $t0, 360($sp) + + # Jumping to endif_8737379857213 + j endif_8737379857213 + + else_8737379857213: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 336($sp) # internal_121 = address of allocated object Int + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 332($sp) # internal_122 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 832($sp) + sw $t0, 4($sp) # Storing num + + # Argument internal_122 + lw $t0, 344($sp) + sw $t0, 0($sp) # Storing internal_122 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 340($sp) # internal_123 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_121 = internal_123 + lw $t0, 328($sp) + sw $t0, 336($sp) + + # If internal_121 then goto then_8737379857207 + lw $t0, 336($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8737379857207 + + # Jumping to else_8737379857207 + j else_8737379857207 + + then_8737379857207: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 34 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 34 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 88 + sb $t0, 8($v0) # internal_124[0] = 'X' + + addi $t0, $zero, 32 + sb $t0, 9($v0) # internal_124[1] = ' ' + + addi $t0, $zero, 32 + sb $t0, 10($v0) # internal_124[2] = ' ' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_124[3] = ' ' + + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_124[4] = ' ' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_124[5] = ' ' + + addi $t0, $zero, 88 + sb $t0, 14($v0) # internal_124[6] = 'X' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_124[7] = ' ' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_124[8] = ' ' + + addi $t0, $zero, 32 + sb $t0, 17($v0) # internal_124[9] = ' ' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_124[10] = ' ' + + addi $t0, $zero, 32 + sb $t0, 19($v0) # internal_124[11] = ' ' + + addi $t0, $zero, 88 + sb $t0, 20($v0) # internal_124[12] = 'X' + + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_124[13] = ' ' + + addi $t0, $zero, 32 + sb $t0, 22($v0) # internal_124[14] = ' ' + + addi $t0, $zero, 32 + sb $t0, 23($v0) # internal_124[15] = ' ' + + addi $t0, $zero, 88 + sb $t0, 24($v0) # internal_124[16] = 'X' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_124[17] = ' ' + + addi $t0, $zero, 32 + sb $t0, 26($v0) # internal_124[18] = ' ' + + addi $t0, $zero, 32 + sb $t0, 27($v0) # internal_124[19] = ' ' + + addi $t0, $zero, 88 + sb $t0, 28($v0) # internal_124[20] = 'X' + + addi $t0, $zero, 32 + sb $t0, 29($v0) # internal_124[21] = ' ' + + addi $t0, $zero, 32 + sb $t0, 30($v0) # internal_124[22] = ' ' + + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_124[23] = ' ' + + addi $t0, $zero, 32 + sb $t0, 32($v0) # internal_124[24] = ' ' + + sb $zero, 33($v0) # Null-terminator at the end of the string + + sw $v0, 324($sp) # internal_124 = "X X X X X " + + # internal_120 = internal_124 + lw $t0, 324($sp) + sw $t0, 340($sp) + + # Jumping to endif_8737379857207 + j endif_8737379857207 + + else_8737379857207: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 316($sp) # internal_126 = address of allocated object Int + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 312($sp) # internal_127 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 832($sp) + sw $t0, 4($sp) # Storing num + + # Argument internal_127 + lw $t0, 324($sp) + sw $t0, 0($sp) # Storing internal_127 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 320($sp) # internal_128 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_126 = internal_128 + lw $t0, 308($sp) + sw $t0, 316($sp) + + # If internal_126 then goto then_8737379857201 + lw $t0, 316($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8737379857201 + + # Jumping to else_8737379857201 + j else_8737379857201 + + then_8737379857201: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 34 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 34 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_129[0] = ' ' + + addi $t0, $zero, 32 + sb $t0, 9($v0) # internal_129[1] = ' ' + + addi $t0, $zero, 32 + sb $t0, 10($v0) # internal_129[2] = ' ' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_129[3] = ' ' + + addi $t0, $zero, 88 + sb $t0, 12($v0) # internal_129[4] = 'X' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_129[5] = ' ' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_129[6] = ' ' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_129[7] = ' ' + + addi $t0, $zero, 88 + sb $t0, 16($v0) # internal_129[8] = 'X' + + addi $t0, $zero, 32 + sb $t0, 17($v0) # internal_129[9] = ' ' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_129[10] = ' ' + + addi $t0, $zero, 32 + sb $t0, 19($v0) # internal_129[11] = ' ' + + addi $t0, $zero, 88 + sb $t0, 20($v0) # internal_129[12] = 'X' + + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_129[13] = ' ' + + addi $t0, $zero, 32 + sb $t0, 22($v0) # internal_129[14] = ' ' + + addi $t0, $zero, 32 + sb $t0, 23($v0) # internal_129[15] = ' ' + + addi $t0, $zero, 32 + sb $t0, 24($v0) # internal_129[16] = ' ' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_129[17] = ' ' + + addi $t0, $zero, 88 + sb $t0, 26($v0) # internal_129[18] = 'X' + + addi $t0, $zero, 32 + sb $t0, 27($v0) # internal_129[19] = ' ' + + addi $t0, $zero, 32 + sb $t0, 28($v0) # internal_129[20] = ' ' + + addi $t0, $zero, 32 + sb $t0, 29($v0) # internal_129[21] = ' ' + + addi $t0, $zero, 32 + sb $t0, 30($v0) # internal_129[22] = ' ' + + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_129[23] = ' ' + + addi $t0, $zero, 88 + sb $t0, 32($v0) # internal_129[24] = 'X' + + sb $zero, 33($v0) # Null-terminator at the end of the string + + sw $v0, 304($sp) # internal_129 = " X X X X X" + + # internal_125 = internal_129 + lw $t0, 304($sp) + sw $t0, 320($sp) + + # Jumping to endif_8737379857201 + j endif_8737379857201 + + else_8737379857201: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 296($sp) # internal_131 = address of allocated object Int + + # Allocating Int 7 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 7 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 292($sp) # internal_132 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 832($sp) + sw $t0, 4($sp) # Storing num + + # Argument internal_132 + lw $t0, 304($sp) + sw $t0, 0($sp) # Storing internal_132 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 300($sp) # internal_133 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_131 = internal_133 + lw $t0, 288($sp) + sw $t0, 296($sp) + + # If internal_131 then goto then_8737379857195 + lw $t0, 296($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8737379857195 + + # Jumping to else_8737379857195 + j else_8737379857195 + + then_8737379857195: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 29 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 29 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 88 + sb $t0, 8($v0) # internal_134[0] = 'X' + + addi $t0, $zero, 32 + sb $t0, 9($v0) # internal_134[1] = ' ' + + addi $t0, $zero, 32 + sb $t0, 10($v0) # internal_134[2] = ' ' + + addi $t0, $zero, 88 + sb $t0, 11($v0) # internal_134[3] = 'X' + + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_134[4] = ' ' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_134[5] = ' ' + + addi $t0, $zero, 88 + sb $t0, 14($v0) # internal_134[6] = 'X' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_134[7] = ' ' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_134[8] = ' ' + + addi $t0, $zero, 88 + sb $t0, 17($v0) # internal_134[9] = 'X' + + addi $t0, $zero, 88 + sb $t0, 18($v0) # internal_134[10] = 'X' + + addi $t0, $zero, 32 + sb $t0, 19($v0) # internal_134[11] = ' ' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_134[12] = ' ' + + addi $t0, $zero, 88 + sb $t0, 21($v0) # internal_134[13] = 'X' + + addi $t0, $zero, 32 + sb $t0, 22($v0) # internal_134[14] = ' ' + + addi $t0, $zero, 32 + sb $t0, 23($v0) # internal_134[15] = ' ' + + addi $t0, $zero, 32 + sb $t0, 24($v0) # internal_134[16] = ' ' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_134[17] = ' ' + + addi $t0, $zero, 32 + sb $t0, 26($v0) # internal_134[18] = ' ' + + addi $t0, $zero, 32 + sb $t0, 27($v0) # internal_134[19] = ' ' + + sb $zero, 28($v0) # Null-terminator at the end of the string + + sw $v0, 284($sp) # internal_134 = "X X X XX X " + + # internal_130 = internal_134 + lw $t0, 284($sp) + sw $t0, 300($sp) + + # Jumping to endif_8737379857195 + j endif_8737379857195 + + else_8737379857195: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 276($sp) # internal_136 = address of allocated object Int + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 272($sp) # internal_137 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 832($sp) + sw $t0, 4($sp) # Storing num + + # Argument internal_137 + lw $t0, 284($sp) + sw $t0, 0($sp) # Storing internal_137 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 280($sp) # internal_138 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_136 = internal_138 + lw $t0, 268($sp) + sw $t0, 276($sp) + + # If internal_136 then goto then_8737379857189 + lw $t0, 276($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8737379857189 + + # Jumping to else_8737379857189 + j else_8737379857189 + + then_8737379857189: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 29 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 29 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_139[0] = ' ' + + addi $t0, $zero, 88 + sb $t0, 9($v0) # internal_139[1] = 'X' + + addi $t0, $zero, 32 + sb $t0, 10($v0) # internal_139[2] = ' ' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_139[3] = ' ' + + addi $t0, $zero, 88 + sb $t0, 12($v0) # internal_139[4] = 'X' + + addi $t0, $zero, 88 + sb $t0, 13($v0) # internal_139[5] = 'X' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_139[6] = ' ' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_139[7] = ' ' + + addi $t0, $zero, 88 + sb $t0, 16($v0) # internal_139[8] = 'X' + + addi $t0, $zero, 32 + sb $t0, 17($v0) # internal_139[9] = ' ' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_139[10] = ' ' + + addi $t0, $zero, 88 + sb $t0, 19($v0) # internal_139[11] = 'X' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_139[12] = ' ' + + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_139[13] = ' ' + + addi $t0, $zero, 88 + sb $t0, 22($v0) # internal_139[14] = 'X' + + addi $t0, $zero, 32 + sb $t0, 23($v0) # internal_139[15] = ' ' + + addi $t0, $zero, 32 + sb $t0, 24($v0) # internal_139[16] = ' ' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_139[17] = ' ' + + addi $t0, $zero, 32 + sb $t0, 26($v0) # internal_139[18] = ' ' + + addi $t0, $zero, 32 + sb $t0, 27($v0) # internal_139[19] = ' ' + + sb $zero, 28($v0) # Null-terminator at the end of the string + + sw $v0, 264($sp) # internal_139 = " X XX X X X " + + # internal_135 = internal_139 + lw $t0, 264($sp) + sw $t0, 280($sp) + + # Jumping to endif_8737379857189 + j endif_8737379857189 + + else_8737379857189: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 256($sp) # internal_141 = address of allocated object Int + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 252($sp) # internal_142 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 832($sp) + sw $t0, 4($sp) # Storing num + + # Argument internal_142 + lw $t0, 264($sp) + sw $t0, 0($sp) # Storing internal_142 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 260($sp) # internal_143 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_141 = internal_143 + lw $t0, 248($sp) + sw $t0, 256($sp) + + # If internal_141 then goto then_8737379857183 + lw $t0, 256($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8737379857183 + + # Jumping to else_8737379857183 + j else_8737379857183 + + then_8737379857183: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 24 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 24 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 88 + sb $t0, 8($v0) # internal_144[0] = 'X' + + addi $t0, $zero, 32 + sb $t0, 9($v0) # internal_144[1] = ' ' + + addi $t0, $zero, 32 + sb $t0, 10($v0) # internal_144[2] = ' ' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_144[3] = ' ' + + addi $t0, $zero, 88 + sb $t0, 12($v0) # internal_144[4] = 'X' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_144[5] = ' ' + + addi $t0, $zero, 88 + sb $t0, 14($v0) # internal_144[6] = 'X' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_144[7] = ' ' + + addi $t0, $zero, 88 + sb $t0, 16($v0) # internal_144[8] = 'X' + + addi $t0, $zero, 32 + sb $t0, 17($v0) # internal_144[9] = ' ' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_144[10] = ' ' + + addi $t0, $zero, 32 + sb $t0, 19($v0) # internal_144[11] = ' ' + + addi $t0, $zero, 88 + sb $t0, 20($v0) # internal_144[12] = 'X' + + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_144[13] = ' ' + + addi $t0, $zero, 32 + sb $t0, 22($v0) # internal_144[14] = ' ' + + sb $zero, 23($v0) # Null-terminator at the end of the string + + sw $v0, 244($sp) # internal_144 = "X X X X X " + + # internal_140 = internal_144 + lw $t0, 244($sp) + sw $t0, 260($sp) + + # Jumping to endif_8737379857183 + j endif_8737379857183 + + else_8737379857183: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 236($sp) # internal_146 = address of allocated object Int + + # Allocating Int 10 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 10 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 232($sp) # internal_147 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 832($sp) + sw $t0, 4($sp) # Storing num + + # Argument internal_147 + lw $t0, 244($sp) + sw $t0, 0($sp) # Storing internal_147 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 240($sp) # internal_148 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_146 = internal_148 + lw $t0, 228($sp) + sw $t0, 236($sp) + + # If internal_146 then goto then_8737379857177 + lw $t0, 236($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8737379857177 + + # Jumping to else_8737379857177 + j else_8737379857177 + + then_8737379857177: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 24 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 24 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_149[0] = ' ' + + addi $t0, $zero, 32 + sb $t0, 9($v0) # internal_149[1] = ' ' + + addi $t0, $zero, 88 + sb $t0, 10($v0) # internal_149[2] = 'X' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_149[3] = ' ' + + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_149[4] = ' ' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_149[5] = ' ' + + addi $t0, $zero, 88 + sb $t0, 14($v0) # internal_149[6] = 'X' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_149[7] = ' ' + + addi $t0, $zero, 88 + sb $t0, 16($v0) # internal_149[8] = 'X' + + addi $t0, $zero, 32 + sb $t0, 17($v0) # internal_149[9] = ' ' + + addi $t0, $zero, 88 + sb $t0, 18($v0) # internal_149[10] = 'X' + + addi $t0, $zero, 32 + sb $t0, 19($v0) # internal_149[11] = ' ' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_149[12] = ' ' + + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_149[13] = ' ' + + addi $t0, $zero, 88 + sb $t0, 22($v0) # internal_149[14] = 'X' + + sb $zero, 23($v0) # Null-terminator at the end of the string + + sw $v0, 224($sp) # internal_149 = " X X X X X" + + # internal_145 = internal_149 + lw $t0, 224($sp) + sw $t0, 240($sp) + + # Jumping to endif_8737379857177 + j endif_8737379857177 + + else_8737379857177: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 216($sp) # internal_151 = address of allocated object Int + + # Allocating Int 11 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 11 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 212($sp) # internal_152 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 832($sp) + sw $t0, 4($sp) # Storing num + + # Argument internal_152 + lw $t0, 224($sp) + sw $t0, 0($sp) # Storing internal_152 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 220($sp) # internal_153 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_151 = internal_153 + lw $t0, 208($sp) + sw $t0, 216($sp) + + # If internal_151 then goto then_8737379857171 + lw $t0, 216($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8737379857171 + + # Jumping to else_8737379857171 + j else_8737379857171 + + then_8737379857171: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 24 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 24 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 88 + sb $t0, 8($v0) # internal_154[0] = 'X' + + addi $t0, $zero, 32 + sb $t0, 9($v0) # internal_154[1] = ' ' + + addi $t0, $zero, 88 + sb $t0, 10($v0) # internal_154[2] = 'X' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_154[3] = ' ' + + addi $t0, $zero, 88 + sb $t0, 12($v0) # internal_154[4] = 'X' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_154[5] = ' ' + + addi $t0, $zero, 88 + sb $t0, 14($v0) # internal_154[6] = 'X' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_154[7] = ' ' + + addi $t0, $zero, 88 + sb $t0, 16($v0) # internal_154[8] = 'X' + + addi $t0, $zero, 32 + sb $t0, 17($v0) # internal_154[9] = ' ' + + addi $t0, $zero, 88 + sb $t0, 18($v0) # internal_154[10] = 'X' + + addi $t0, $zero, 32 + sb $t0, 19($v0) # internal_154[11] = ' ' + + addi $t0, $zero, 88 + sb $t0, 20($v0) # internal_154[12] = 'X' + + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_154[13] = ' ' + + addi $t0, $zero, 88 + sb $t0, 22($v0) # internal_154[14] = 'X' + + sb $zero, 23($v0) # Null-terminator at the end of the string + + sw $v0, 204($sp) # internal_154 = "X X X X X X X X" + + # internal_150 = internal_154 + lw $t0, 204($sp) + sw $t0, 220($sp) + + # Jumping to endif_8737379857171 + j endif_8737379857171 + + else_8737379857171: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 196($sp) # internal_156 = address of allocated object Int + + # Allocating Int 12 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 12 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 192($sp) # internal_157 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 832($sp) + sw $t0, 4($sp) # Storing num + + # Argument internal_157 + lw $t0, 204($sp) + sw $t0, 0($sp) # Storing internal_157 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 200($sp) # internal_158 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_156 = internal_158 + lw $t0, 188($sp) + sw $t0, 196($sp) + + # If internal_156 then goto then_8737379857165 + lw $t0, 196($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8737379857165 + + # Jumping to else_8737379857165 + j else_8737379857165 + + then_8737379857165: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 34 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 34 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 88 + sb $t0, 8($v0) # internal_159[0] = 'X' + + addi $t0, $zero, 88 + sb $t0, 9($v0) # internal_159[1] = 'X' + + addi $t0, $zero, 88 + sb $t0, 10($v0) # internal_159[2] = 'X' + + addi $t0, $zero, 88 + sb $t0, 11($v0) # internal_159[3] = 'X' + + addi $t0, $zero, 88 + sb $t0, 12($v0) # internal_159[4] = 'X' + + addi $t0, $zero, 88 + sb $t0, 13($v0) # internal_159[5] = 'X' + + addi $t0, $zero, 88 + sb $t0, 14($v0) # internal_159[6] = 'X' + + addi $t0, $zero, 88 + sb $t0, 15($v0) # internal_159[7] = 'X' + + addi $t0, $zero, 88 + sb $t0, 16($v0) # internal_159[8] = 'X' + + addi $t0, $zero, 88 + sb $t0, 17($v0) # internal_159[9] = 'X' + + addi $t0, $zero, 88 + sb $t0, 18($v0) # internal_159[10] = 'X' + + addi $t0, $zero, 88 + sb $t0, 19($v0) # internal_159[11] = 'X' + + addi $t0, $zero, 88 + sb $t0, 20($v0) # internal_159[12] = 'X' + + addi $t0, $zero, 88 + sb $t0, 21($v0) # internal_159[13] = 'X' + + addi $t0, $zero, 88 + sb $t0, 22($v0) # internal_159[14] = 'X' + + addi $t0, $zero, 88 + sb $t0, 23($v0) # internal_159[15] = 'X' + + addi $t0, $zero, 88 + sb $t0, 24($v0) # internal_159[16] = 'X' + + addi $t0, $zero, 88 + sb $t0, 25($v0) # internal_159[17] = 'X' + + addi $t0, $zero, 88 + sb $t0, 26($v0) # internal_159[18] = 'X' + + addi $t0, $zero, 88 + sb $t0, 27($v0) # internal_159[19] = 'X' + + addi $t0, $zero, 88 + sb $t0, 28($v0) # internal_159[20] = 'X' + + addi $t0, $zero, 88 + sb $t0, 29($v0) # internal_159[21] = 'X' + + addi $t0, $zero, 88 + sb $t0, 30($v0) # internal_159[22] = 'X' + + addi $t0, $zero, 88 + sb $t0, 31($v0) # internal_159[23] = 'X' + + addi $t0, $zero, 88 + sb $t0, 32($v0) # internal_159[24] = 'X' + + sb $zero, 33($v0) # Null-terminator at the end of the string + + sw $v0, 184($sp) # internal_159 = "XXXXXXXXXXXXXXXXXXXXXXXXX" + + # internal_155 = internal_159 + lw $t0, 184($sp) + sw $t0, 200($sp) + + # Jumping to endif_8737379857165 + j endif_8737379857165 + + else_8737379857165: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 176($sp) # internal_161 = address of allocated object Int + + # Allocating Int 13 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 13 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 172($sp) # internal_162 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 832($sp) + sw $t0, 4($sp) # Storing num + + # Argument internal_162 + lw $t0, 184($sp) + sw $t0, 0($sp) # Storing internal_162 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 180($sp) # internal_163 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_161 = internal_163 + lw $t0, 168($sp) + sw $t0, 176($sp) + + # If internal_161 then goto then_8737379857159 + lw $t0, 176($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8737379857159 + + # Jumping to else_8737379857159 + j else_8737379857159 + + then_8737379857159: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 34 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 34 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 88 + sb $t0, 8($v0) # internal_164[0] = 'X' + + addi $t0, $zero, 88 + sb $t0, 9($v0) # internal_164[1] = 'X' + + addi $t0, $zero, 88 + sb $t0, 10($v0) # internal_164[2] = 'X' + + addi $t0, $zero, 88 + sb $t0, 11($v0) # internal_164[3] = 'X' + + addi $t0, $zero, 88 + sb $t0, 12($v0) # internal_164[4] = 'X' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_164[5] = ' ' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_164[6] = ' ' + + addi $t0, $zero, 88 + sb $t0, 15($v0) # internal_164[7] = 'X' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_164[8] = ' ' + + addi $t0, $zero, 32 + sb $t0, 17($v0) # internal_164[9] = ' ' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_164[10] = ' ' + + addi $t0, $zero, 32 + sb $t0, 19($v0) # internal_164[11] = ' ' + + addi $t0, $zero, 88 + sb $t0, 20($v0) # internal_164[12] = 'X' + + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_164[13] = ' ' + + addi $t0, $zero, 32 + sb $t0, 22($v0) # internal_164[14] = ' ' + + addi $t0, $zero, 32 + sb $t0, 23($v0) # internal_164[15] = ' ' + + addi $t0, $zero, 32 + sb $t0, 24($v0) # internal_164[16] = ' ' + + addi $t0, $zero, 88 + sb $t0, 25($v0) # internal_164[17] = 'X' + + addi $t0, $zero, 32 + sb $t0, 26($v0) # internal_164[18] = ' ' + + addi $t0, $zero, 32 + sb $t0, 27($v0) # internal_164[19] = ' ' + + addi $t0, $zero, 32 + sb $t0, 28($v0) # internal_164[20] = ' ' + + addi $t0, $zero, 32 + sb $t0, 29($v0) # internal_164[21] = ' ' + + addi $t0, $zero, 88 + sb $t0, 30($v0) # internal_164[22] = 'X' + + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_164[23] = ' ' + + addi $t0, $zero, 32 + sb $t0, 32($v0) # internal_164[24] = ' ' + + sb $zero, 33($v0) # Null-terminator at the end of the string + + sw $v0, 164($sp) # internal_164 = "XXXXX X X X X " + + # internal_160 = internal_164 + lw $t0, 164($sp) + sw $t0, 180($sp) + + # Jumping to endif_8737379857159 + j endif_8737379857159 + + else_8737379857159: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 156($sp) # internal_166 = address of allocated object Int + + # Allocating Int 14 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 14 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 152($sp) # internal_167 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 832($sp) + sw $t0, 4($sp) # Storing num + + # Argument internal_167 + lw $t0, 164($sp) + sw $t0, 0($sp) # Storing internal_167 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 160($sp) # internal_168 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_166 = internal_168 + lw $t0, 148($sp) + sw $t0, 156($sp) + + # If internal_166 then goto then_8737379856893 + lw $t0, 156($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8737379856893 + + # Jumping to else_8737379856893 + j else_8737379856893 + + then_8737379856893: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 34 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 34 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_169[0] = ' ' + + addi $t0, $zero, 32 + sb $t0, 9($v0) # internal_169[1] = ' ' + + addi $t0, $zero, 88 + sb $t0, 10($v0) # internal_169[2] = 'X' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_169[3] = ' ' + + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_169[4] = ' ' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_169[5] = ' ' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_169[6] = ' ' + + addi $t0, $zero, 88 + sb $t0, 15($v0) # internal_169[7] = 'X' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_169[8] = ' ' + + addi $t0, $zero, 32 + sb $t0, 17($v0) # internal_169[9] = ' ' + + addi $t0, $zero, 88 + sb $t0, 18($v0) # internal_169[10] = 'X' + + addi $t0, $zero, 88 + sb $t0, 19($v0) # internal_169[11] = 'X' + + addi $t0, $zero, 88 + sb $t0, 20($v0) # internal_169[12] = 'X' + + addi $t0, $zero, 88 + sb $t0, 21($v0) # internal_169[13] = 'X' + + addi $t0, $zero, 88 + sb $t0, 22($v0) # internal_169[14] = 'X' + + addi $t0, $zero, 32 + sb $t0, 23($v0) # internal_169[15] = ' ' + + addi $t0, $zero, 32 + sb $t0, 24($v0) # internal_169[16] = ' ' + + addi $t0, $zero, 88 + sb $t0, 25($v0) # internal_169[17] = 'X' + + addi $t0, $zero, 32 + sb $t0, 26($v0) # internal_169[18] = ' ' + + addi $t0, $zero, 32 + sb $t0, 27($v0) # internal_169[19] = ' ' + + addi $t0, $zero, 32 + sb $t0, 28($v0) # internal_169[20] = ' ' + + addi $t0, $zero, 32 + sb $t0, 29($v0) # internal_169[21] = ' ' + + addi $t0, $zero, 88 + sb $t0, 30($v0) # internal_169[22] = 'X' + + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_169[23] = ' ' + + addi $t0, $zero, 32 + sb $t0, 32($v0) # internal_169[24] = ' ' + + sb $zero, 33($v0) # Null-terminator at the end of the string + + sw $v0, 144($sp) # internal_169 = " X X XXXXX X X " + + # internal_165 = internal_169 + lw $t0, 144($sp) + sw $t0, 160($sp) + + # Jumping to endif_8737379856893 + j endif_8737379856893 + + else_8737379856893: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 136($sp) # internal_171 = address of allocated object Int + + # Allocating Int 15 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 15 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 132($sp) # internal_172 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 832($sp) + sw $t0, 4($sp) # Storing num + + # Argument internal_172 + lw $t0, 144($sp) + sw $t0, 0($sp) # Storing internal_172 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 140($sp) # internal_173 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_171 = internal_173 + lw $t0, 128($sp) + sw $t0, 136($sp) + + # If internal_171 then goto then_8737379856887 + lw $t0, 136($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8737379856887 + + # Jumping to else_8737379856887 + j else_8737379856887 + + then_8737379856887: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 30 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 30 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 88 + sb $t0, 8($v0) # internal_174[0] = 'X' + + addi $t0, $zero, 32 + sb $t0, 9($v0) # internal_174[1] = ' ' + + addi $t0, $zero, 32 + sb $t0, 10($v0) # internal_174[2] = ' ' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_174[3] = ' ' + + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_174[4] = ' ' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_174[5] = ' ' + + addi $t0, $zero, 88 + sb $t0, 14($v0) # internal_174[6] = 'X' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_174[7] = ' ' + + addi $t0, $zero, 88 + sb $t0, 16($v0) # internal_174[8] = 'X' + + addi $t0, $zero, 32 + sb $t0, 17($v0) # internal_174[9] = ' ' + + addi $t0, $zero, 88 + sb $t0, 18($v0) # internal_174[10] = 'X' + + addi $t0, $zero, 32 + sb $t0, 19($v0) # internal_174[11] = ' ' + + addi $t0, $zero, 88 + sb $t0, 20($v0) # internal_174[12] = 'X' + + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_174[13] = ' ' + + addi $t0, $zero, 32 + sb $t0, 22($v0) # internal_174[14] = ' ' + + addi $t0, $zero, 32 + sb $t0, 23($v0) # internal_174[15] = ' ' + + addi $t0, $zero, 88 + sb $t0, 24($v0) # internal_174[16] = 'X' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_174[17] = ' ' + + addi $t0, $zero, 88 + sb $t0, 26($v0) # internal_174[18] = 'X' + + addi $t0, $zero, 32 + sb $t0, 27($v0) # internal_174[19] = ' ' + + addi $t0, $zero, 32 + sb $t0, 28($v0) # internal_174[20] = ' ' + + sb $zero, 29($v0) # Null-terminator at the end of the string + + sw $v0, 124($sp) # internal_174 = "X X X X X X X " + + # internal_170 = internal_174 + lw $t0, 124($sp) + sw $t0, 140($sp) + + # Jumping to endif_8737379856887 + j endif_8737379856887 + + else_8737379856887: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 116($sp) # internal_176 = address of allocated object Int + + # Allocating Int 16 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 16 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 112($sp) # internal_177 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 832($sp) + sw $t0, 4($sp) # Storing num + + # Argument internal_177 + lw $t0, 124($sp) + sw $t0, 0($sp) # Storing internal_177 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 120($sp) # internal_178 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_176 = internal_178 + lw $t0, 108($sp) + sw $t0, 116($sp) + + # If internal_176 then goto then_8737379856881 + lw $t0, 116($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8737379856881 + + # Jumping to else_8737379856881 + j else_8737379856881 + + then_8737379856881: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 30 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 30 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_179[0] = ' ' + + addi $t0, $zero, 32 + sb $t0, 9($v0) # internal_179[1] = ' ' + + addi $t0, $zero, 88 + sb $t0, 10($v0) # internal_179[2] = 'X' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_179[3] = ' ' + + addi $t0, $zero, 88 + sb $t0, 12($v0) # internal_179[4] = 'X' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_179[5] = ' ' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_179[6] = ' ' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_179[7] = ' ' + + addi $t0, $zero, 88 + sb $t0, 16($v0) # internal_179[8] = 'X' + + addi $t0, $zero, 32 + sb $t0, 17($v0) # internal_179[9] = ' ' + + addi $t0, $zero, 88 + sb $t0, 18($v0) # internal_179[10] = 'X' + + addi $t0, $zero, 32 + sb $t0, 19($v0) # internal_179[11] = ' ' + + addi $t0, $zero, 88 + sb $t0, 20($v0) # internal_179[12] = 'X' + + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_179[13] = ' ' + + addi $t0, $zero, 88 + sb $t0, 22($v0) # internal_179[14] = 'X' + + addi $t0, $zero, 32 + sb $t0, 23($v0) # internal_179[15] = ' ' + + addi $t0, $zero, 32 + sb $t0, 24($v0) # internal_179[16] = ' ' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_179[17] = ' ' + + addi $t0, $zero, 32 + sb $t0, 26($v0) # internal_179[18] = ' ' + + addi $t0, $zero, 32 + sb $t0, 27($v0) # internal_179[19] = ' ' + + addi $t0, $zero, 88 + sb $t0, 28($v0) # internal_179[20] = 'X' + + sb $zero, 29($v0) # Null-terminator at the end of the string + + sw $v0, 104($sp) # internal_179 = " X X X X X X X" + + # internal_175 = internal_179 + lw $t0, 104($sp) + sw $t0, 120($sp) + + # Jumping to endif_8737379856881 + j endif_8737379856881 + + else_8737379856881: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 96($sp) # internal_181 = address of allocated object Int + + # Allocating Int 17 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 17 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 92($sp) # internal_182 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 832($sp) + sw $t0, 4($sp) # Storing num + + # Argument internal_182 + lw $t0, 104($sp) + sw $t0, 0($sp) # Storing internal_182 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 100($sp) # internal_183 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_181 = internal_183 + lw $t0, 88($sp) + sw $t0, 96($sp) + + # If internal_181 then goto then_8737379856875 + lw $t0, 96($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8737379856875 + + # Jumping to else_8737379856875 + j else_8737379856875 + + then_8737379856875: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 37 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 37 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 88 + sb $t0, 8($v0) # internal_184[0] = 'X' + + addi $t0, $zero, 88 + sb $t0, 9($v0) # internal_184[1] = 'X' + + addi $t0, $zero, 88 + sb $t0, 10($v0) # internal_184[2] = 'X' + + addi $t0, $zero, 88 + sb $t0, 11($v0) # internal_184[3] = 'X' + + addi $t0, $zero, 88 + sb $t0, 12($v0) # internal_184[4] = 'X' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_184[5] = ' ' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_184[6] = ' ' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_184[7] = ' ' + + addi $t0, $zero, 88 + sb $t0, 16($v0) # internal_184[8] = 'X' + + addi $t0, $zero, 32 + sb $t0, 17($v0) # internal_184[9] = ' ' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_184[10] = ' ' + + addi $t0, $zero, 32 + sb $t0, 19($v0) # internal_184[11] = ' ' + + addi $t0, $zero, 88 + sb $t0, 20($v0) # internal_184[12] = 'X' + + addi $t0, $zero, 88 + sb $t0, 21($v0) # internal_184[13] = 'X' + + addi $t0, $zero, 88 + sb $t0, 22($v0) # internal_184[14] = 'X' + + addi $t0, $zero, 88 + sb $t0, 23($v0) # internal_184[15] = 'X' + + addi $t0, $zero, 88 + sb $t0, 24($v0) # internal_184[16] = 'X' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_184[17] = ' ' + + addi $t0, $zero, 32 + sb $t0, 26($v0) # internal_184[18] = ' ' + + addi $t0, $zero, 32 + sb $t0, 27($v0) # internal_184[19] = ' ' + + addi $t0, $zero, 88 + sb $t0, 28($v0) # internal_184[20] = 'X' + + addi $t0, $zero, 32 + sb $t0, 29($v0) # internal_184[21] = ' ' + + addi $t0, $zero, 32 + sb $t0, 30($v0) # internal_184[22] = ' ' + + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_184[23] = ' ' + + addi $t0, $zero, 88 + sb $t0, 32($v0) # internal_184[24] = 'X' + + addi $t0, $zero, 88 + sb $t0, 33($v0) # internal_184[25] = 'X' + + addi $t0, $zero, 88 + sb $t0, 34($v0) # internal_184[26] = 'X' + + addi $t0, $zero, 88 + sb $t0, 35($v0) # internal_184[27] = 'X' + + sb $zero, 36($v0) # Null-terminator at the end of the string + + sw $v0, 84($sp) # internal_184 = "XXXXX X XXXXX X XXXX" + + # internal_180 = internal_184 + lw $t0, 84($sp) + sw $t0, 100($sp) + + # Jumping to endif_8737379856875 + j endif_8737379856875 + + else_8737379856875: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 76($sp) # internal_186 = address of allocated object Int + + # Allocating Int 18 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 18 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 72($sp) # internal_187 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 832($sp) + sw $t0, 4($sp) # Storing num + + # Argument internal_187 + lw $t0, 84($sp) + sw $t0, 0($sp) # Storing internal_187 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 80($sp) # internal_188 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_186 = internal_188 + lw $t0, 68($sp) + sw $t0, 76($sp) + + # If internal_186 then goto then_8737379856869 + lw $t0, 76($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8737379856869 + + # Jumping to else_8737379856869 + j else_8737379856869 + + then_8737379856869: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 37 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 37 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 88 + sb $t0, 8($v0) # internal_189[0] = 'X' + + addi $t0, $zero, 88 + sb $t0, 9($v0) # internal_189[1] = 'X' + + addi $t0, $zero, 88 + sb $t0, 10($v0) # internal_189[2] = 'X' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_189[3] = ' ' + + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_189[4] = ' ' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_189[5] = ' ' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_189[6] = ' ' + + addi $t0, $zero, 88 + sb $t0, 15($v0) # internal_189[7] = 'X' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_189[8] = ' ' + + addi $t0, $zero, 32 + sb $t0, 17($v0) # internal_189[9] = ' ' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_189[10] = ' ' + + addi $t0, $zero, 88 + sb $t0, 19($v0) # internal_189[11] = 'X' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_189[12] = ' ' + + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_189[13] = ' ' + + addi $t0, $zero, 88 + sb $t0, 22($v0) # internal_189[14] = 'X' + + addi $t0, $zero, 32 + sb $t0, 23($v0) # internal_189[15] = ' ' + + addi $t0, $zero, 32 + sb $t0, 24($v0) # internal_189[16] = ' ' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_189[17] = ' ' + + addi $t0, $zero, 32 + sb $t0, 26($v0) # internal_189[18] = ' ' + + addi $t0, $zero, 88 + sb $t0, 27($v0) # internal_189[19] = 'X' + + addi $t0, $zero, 32 + sb $t0, 28($v0) # internal_189[20] = ' ' + + addi $t0, $zero, 32 + sb $t0, 29($v0) # internal_189[21] = ' ' + + addi $t0, $zero, 32 + sb $t0, 30($v0) # internal_189[22] = ' ' + + addi $t0, $zero, 88 + sb $t0, 31($v0) # internal_189[23] = 'X' + + addi $t0, $zero, 88 + sb $t0, 32($v0) # internal_189[24] = 'X' + + addi $t0, $zero, 88 + sb $t0, 33($v0) # internal_189[25] = 'X' + + addi $t0, $zero, 88 + sb $t0, 34($v0) # internal_189[26] = 'X' + + addi $t0, $zero, 32 + sb $t0, 35($v0) # internal_189[27] = ' ' + + sb $zero, 36($v0) # Null-terminator at the end of the string + + sw $v0, 64($sp) # internal_189 = "XXX X X X X XXXX " + + # internal_185 = internal_189 + lw $t0, 64($sp) + sw $t0, 80($sp) + + # Jumping to endif_8737379856869 + j endif_8737379856869 + + else_8737379856869: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 56($sp) # internal_191 = address of allocated object Int + + # Allocating Int 19 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 19 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 52($sp) # internal_192 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 832($sp) + sw $t0, 4($sp) # Storing num + + # Argument internal_192 + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing internal_192 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 60($sp) # internal_193 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_191 = internal_193 + lw $t0, 48($sp) + sw $t0, 56($sp) + + # If internal_191 then goto then_8737379856863 + lw $t0, 56($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8737379856863 + + # Jumping to else_8737379856863 + j else_8737379856863 + + then_8737379856863: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 25 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 25 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_194[0] = ' ' + + addi $t0, $zero, 88 + sb $t0, 9($v0) # internal_194[1] = 'X' + + addi $t0, $zero, 88 + sb $t0, 10($v0) # internal_194[2] = 'X' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_194[3] = ' ' + + addi $t0, $zero, 88 + sb $t0, 12($v0) # internal_194[4] = 'X' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_194[5] = ' ' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_194[6] = ' ' + + addi $t0, $zero, 88 + sb $t0, 15($v0) # internal_194[7] = 'X' + + addi $t0, $zero, 88 + sb $t0, 16($v0) # internal_194[8] = 'X' + + addi $t0, $zero, 32 + sb $t0, 17($v0) # internal_194[9] = ' ' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_194[10] = ' ' + + addi $t0, $zero, 88 + sb $t0, 19($v0) # internal_194[11] = 'X' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_194[12] = ' ' + + addi $t0, $zero, 88 + sb $t0, 21($v0) # internal_194[13] = 'X' + + addi $t0, $zero, 88 + sb $t0, 22($v0) # internal_194[14] = 'X' + + addi $t0, $zero, 32 + sb $t0, 23($v0) # internal_194[15] = ' ' + + sb $zero, 24($v0) # Null-terminator at the end of the string + + sw $v0, 44($sp) # internal_194 = " XX X XX X XX " + + # internal_190 = internal_194 + lw $t0, 44($sp) + sw $t0, 60($sp) + + # Jumping to endif_8737379856863 + j endif_8737379856863 + + else_8737379856863: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_196 = address of allocated object Int + + # Allocating Int 20 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 20 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_197 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 832($sp) + sw $t0, 4($sp) # Storing num + + # Argument internal_197 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_197 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_198 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_196 = internal_198 + lw $t0, 28($sp) + sw $t0, 36($sp) + + # If internal_196 then goto then_8737379856857 + lw $t0, 36($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8737379856857 + + # Jumping to else_8737379856857 + j else_8737379856857 + + then_8737379856857: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 37 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 37 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_199[0] = ' ' + + addi $t0, $zero, 88 + sb $t0, 9($v0) # internal_199[1] = 'X' + + addi $t0, $zero, 88 + sb $t0, 10($v0) # internal_199[2] = 'X' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_199[3] = ' ' + + addi $t0, $zero, 88 + sb $t0, 12($v0) # internal_199[4] = 'X' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_199[5] = ' ' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_199[6] = ' ' + + addi $t0, $zero, 88 + sb $t0, 15($v0) # internal_199[7] = 'X' + + addi $t0, $zero, 88 + sb $t0, 16($v0) # internal_199[8] = 'X' + + addi $t0, $zero, 32 + sb $t0, 17($v0) # internal_199[9] = ' ' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_199[10] = ' ' + + addi $t0, $zero, 88 + sb $t0, 19($v0) # internal_199[11] = 'X' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_199[12] = ' ' + + addi $t0, $zero, 88 + sb $t0, 21($v0) # internal_199[13] = 'X' + + addi $t0, $zero, 88 + sb $t0, 22($v0) # internal_199[14] = 'X' + + addi $t0, $zero, 32 + sb $t0, 23($v0) # internal_199[15] = ' ' + + addi $t0, $zero, 88 + sb $t0, 24($v0) # internal_199[16] = 'X' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_199[17] = ' ' + + addi $t0, $zero, 32 + sb $t0, 26($v0) # internal_199[18] = ' ' + + addi $t0, $zero, 88 + sb $t0, 27($v0) # internal_199[19] = 'X' + + addi $t0, $zero, 88 + sb $t0, 28($v0) # internal_199[20] = 'X' + + addi $t0, $zero, 32 + sb $t0, 29($v0) # internal_199[21] = ' ' + + addi $t0, $zero, 32 + sb $t0, 30($v0) # internal_199[22] = ' ' + + addi $t0, $zero, 88 + sb $t0, 31($v0) # internal_199[23] = 'X' + + addi $t0, $zero, 32 + sb $t0, 32($v0) # internal_199[24] = ' ' + + addi $t0, $zero, 88 + sb $t0, 33($v0) # internal_199[25] = 'X' + + addi $t0, $zero, 88 + sb $t0, 34($v0) # internal_199[26] = 'X' + + addi $t0, $zero, 32 + sb $t0, 35($v0) # internal_199[27] = ' ' + + sb $zero, 36($v0) # Null-terminator at the end of the string + + sw $v0, 24($sp) # internal_199 = " XX X XX X XX X XX X XX " + + # internal_195 = internal_199 + lw $t0, 24($sp) + sw $t0, 40($sp) + + # Jumping to endif_8737379856857 + j endif_8737379856857 + + else_8737379856857: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_201 = address of allocated object Int + + # Allocating Int 21 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 21 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 12($sp) # internal_202 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument num + lw $t0, 832($sp) + sw $t0, 4($sp) # Storing num + + # Argument internal_202 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_202 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_203 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_201 = internal_203 + lw $t0, 8($sp) + sw $t0, 16($sp) + + # If internal_201 then goto then_8737379856851 + lw $t0, 16($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8737379856851 + + # Jumping to else_8737379856851 + j else_8737379856851 + + then_8737379856851: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 37 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 37 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_204[0] = ' ' + + addi $t0, $zero, 88 + sb $t0, 9($v0) # internal_204[1] = 'X' + + addi $t0, $zero, 88 + sb $t0, 10($v0) # internal_204[2] = 'X' + + addi $t0, $zero, 88 + sb $t0, 11($v0) # internal_204[3] = 'X' + + addi $t0, $zero, 88 + sb $t0, 12($v0) # internal_204[4] = 'X' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_204[5] = ' ' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_204[6] = ' ' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_204[7] = ' ' + + addi $t0, $zero, 88 + sb $t0, 16($v0) # internal_204[8] = 'X' + + addi $t0, $zero, 32 + sb $t0, 17($v0) # internal_204[9] = ' ' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_204[10] = ' ' + + addi $t0, $zero, 32 + sb $t0, 19($v0) # internal_204[11] = ' ' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_204[12] = ' ' + + addi $t0, $zero, 88 + sb $t0, 21($v0) # internal_204[13] = 'X' + + addi $t0, $zero, 88 + sb $t0, 22($v0) # internal_204[14] = 'X' + + addi $t0, $zero, 32 + sb $t0, 23($v0) # internal_204[15] = ' ' + + addi $t0, $zero, 32 + sb $t0, 24($v0) # internal_204[16] = ' ' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_204[17] = ' ' + + addi $t0, $zero, 32 + sb $t0, 26($v0) # internal_204[18] = ' ' + + addi $t0, $zero, 88 + sb $t0, 27($v0) # internal_204[19] = 'X' + + addi $t0, $zero, 32 + sb $t0, 28($v0) # internal_204[20] = ' ' + + addi $t0, $zero, 32 + sb $t0, 29($v0) # internal_204[21] = ' ' + + addi $t0, $zero, 32 + sb $t0, 30($v0) # internal_204[22] = ' ' + + addi $t0, $zero, 88 + sb $t0, 31($v0) # internal_204[23] = 'X' + + addi $t0, $zero, 88 + sb $t0, 32($v0) # internal_204[24] = 'X' + + addi $t0, $zero, 88 + sb $t0, 33($v0) # internal_204[25] = 'X' + + addi $t0, $zero, 88 + sb $t0, 34($v0) # internal_204[26] = 'X' + + addi $t0, $zero, 32 + sb $t0, 35($v0) # internal_204[27] = ' ' + + sb $zero, 36($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_204 = " XXXX X XX X XXXX " + + # internal_200 = internal_204 + lw $t0, 4($sp) + sw $t0, 20($sp) + + # Jumping to endif_8737379856851 + j endif_8737379856851 + + else_8737379856851: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 34 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 34 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_205[0] = ' ' + + addi $t0, $zero, 32 + sb $t0, 9($v0) # internal_205[1] = ' ' + + addi $t0, $zero, 32 + sb $t0, 10($v0) # internal_205[2] = ' ' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_205[3] = ' ' + + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_205[4] = ' ' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_205[5] = ' ' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_205[6] = ' ' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_205[7] = ' ' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_205[8] = ' ' + + addi $t0, $zero, 32 + sb $t0, 17($v0) # internal_205[9] = ' ' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_205[10] = ' ' + + addi $t0, $zero, 32 + sb $t0, 19($v0) # internal_205[11] = ' ' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_205[12] = ' ' + + addi $t0, $zero, 32 + sb $t0, 21($v0) # internal_205[13] = ' ' + + addi $t0, $zero, 32 + sb $t0, 22($v0) # internal_205[14] = ' ' + + addi $t0, $zero, 32 + sb $t0, 23($v0) # internal_205[15] = ' ' + + addi $t0, $zero, 32 + sb $t0, 24($v0) # internal_205[16] = ' ' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_205[17] = ' ' + + addi $t0, $zero, 32 + sb $t0, 26($v0) # internal_205[18] = ' ' + + addi $t0, $zero, 32 + sb $t0, 27($v0) # internal_205[19] = ' ' + + addi $t0, $zero, 32 + sb $t0, 28($v0) # internal_205[20] = ' ' + + addi $t0, $zero, 32 + sb $t0, 29($v0) # internal_205[21] = ' ' + + addi $t0, $zero, 32 + sb $t0, 30($v0) # internal_205[22] = ' ' + + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_205[23] = ' ' + + addi $t0, $zero, 32 + sb $t0, 32($v0) # internal_205[24] = ' ' + + sb $zero, 33($v0) # Null-terminator at the end of the string + + sw $v0, 0($sp) # internal_205 = " " + + # internal_200 = internal_205 + lw $t0, 0($sp) + sw $t0, 20($sp) + + # Jumping to endif_8737379856851 + j endif_8737379856851 + + endif_8737379856851: + + # internal_195 = internal_200 + lw $t0, 20($sp) + sw $t0, 40($sp) + + # Jumping to endif_8737379856857 + j endif_8737379856857 + + endif_8737379856857: + + # internal_190 = internal_195 + lw $t0, 40($sp) + sw $t0, 60($sp) + + # Jumping to endif_8737379856863 + j endif_8737379856863 + + endif_8737379856863: + + # internal_185 = internal_190 + lw $t0, 60($sp) + sw $t0, 80($sp) + + # Jumping to endif_8737379856869 + j endif_8737379856869 + + endif_8737379856869: + + # internal_180 = internal_185 + lw $t0, 80($sp) + sw $t0, 100($sp) + + # Jumping to endif_8737379856875 + j endif_8737379856875 + + endif_8737379856875: + + # internal_175 = internal_180 + lw $t0, 100($sp) + sw $t0, 120($sp) + + # Jumping to endif_8737379856881 + j endif_8737379856881 + + endif_8737379856881: + + # internal_170 = internal_175 + lw $t0, 120($sp) + sw $t0, 140($sp) + + # Jumping to endif_8737379856887 + j endif_8737379856887 + + endif_8737379856887: + + # internal_165 = internal_170 + lw $t0, 140($sp) + sw $t0, 160($sp) + + # Jumping to endif_8737379856893 + j endif_8737379856893 + + endif_8737379856893: + + # internal_160 = internal_165 + lw $t0, 160($sp) + sw $t0, 180($sp) + + # Jumping to endif_8737379857159 + j endif_8737379857159 + + endif_8737379857159: + + # internal_155 = internal_160 + lw $t0, 180($sp) + sw $t0, 200($sp) + + # Jumping to endif_8737379857165 + j endif_8737379857165 + + endif_8737379857165: + + # internal_150 = internal_155 + lw $t0, 200($sp) + sw $t0, 220($sp) + + # Jumping to endif_8737379857171 + j endif_8737379857171 + + endif_8737379857171: + + # internal_145 = internal_150 + lw $t0, 220($sp) + sw $t0, 240($sp) + + # Jumping to endif_8737379857177 + j endif_8737379857177 + + endif_8737379857177: + + # internal_140 = internal_145 + lw $t0, 240($sp) + sw $t0, 260($sp) + + # Jumping to endif_8737379857183 + j endif_8737379857183 + + endif_8737379857183: + + # internal_135 = internal_140 + lw $t0, 260($sp) + sw $t0, 280($sp) + + # Jumping to endif_8737379857189 + j endif_8737379857189 + + endif_8737379857189: + + # internal_130 = internal_135 + lw $t0, 280($sp) + sw $t0, 300($sp) + + # Jumping to endif_8737379857195 + j endif_8737379857195 + + endif_8737379857195: + + # internal_125 = internal_130 + lw $t0, 300($sp) + sw $t0, 320($sp) + + # Jumping to endif_8737379857201 + j endif_8737379857201 + + endif_8737379857201: + + # internal_120 = internal_125 + lw $t0, 320($sp) + sw $t0, 340($sp) + + # Jumping to endif_8737379857207 + j endif_8737379857207 + + endif_8737379857207: + + # internal_115 = internal_120 + lw $t0, 340($sp) + sw $t0, 360($sp) + + # Jumping to endif_8737379857213 + j endif_8737379857213 + + endif_8737379857213: + + # internal_110 = internal_115 + lw $t0, 360($sp) + sw $t0, 380($sp) + + # Jumping to endif_8737379857219 + j endif_8737379857219 + + endif_8737379857219: + + # internal_105 = internal_110 + lw $t0, 380($sp) + sw $t0, 400($sp) + + # Jumping to endif_8737379857225 + j endif_8737379857225 + + endif_8737379857225: + + # internal_100 = internal_105 + lw $t0, 400($sp) + sw $t0, 420($sp) + + # Jumping to endif_8737379857231 + j endif_8737379857231 + + endif_8737379857231: + + # Loading return value in $v1 + lw $v1, 420($sp) + + # Freeing space for local variables + addi $sp, $sp, 824 + + jr $ra + + function_prompt_at_CellularAutomaton: + # Function parameters + # $ra = 92($sp) + # self = 88($sp) + + # Reserving space for local variables + addi $sp, $sp, -88 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 9 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 9 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + sb $zero, 8($v0) # Null-terminator at the end of the string + + sw $v0, 84($sp) # ans = "" + + # Allocating String + li $v0, 9 + addi $a0, $zero, 63 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 63 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 87 + sb $t0, 8($v0) # internal_1[0] = 'W' + + addi $t0, $zero, 111 + sb $t0, 9($v0) # internal_1[1] = 'o' + + addi $t0, $zero, 117 + sb $t0, 10($v0) # internal_1[2] = 'u' + + addi $t0, $zero, 108 + sb $t0, 11($v0) # internal_1[3] = 'l' + + addi $t0, $zero, 100 + sb $t0, 12($v0) # internal_1[4] = 'd' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_1[5] = ' ' + + addi $t0, $zero, 121 + sb $t0, 14($v0) # internal_1[6] = 'y' + + addi $t0, $zero, 111 + sb $t0, 15($v0) # internal_1[7] = 'o' + + addi $t0, $zero, 117 + sb $t0, 16($v0) # internal_1[8] = 'u' + + addi $t0, $zero, 32 + sb $t0, 17($v0) # internal_1[9] = ' ' + + addi $t0, $zero, 108 + sb $t0, 18($v0) # internal_1[10] = 'l' + + addi $t0, $zero, 105 + sb $t0, 19($v0) # internal_1[11] = 'i' + + addi $t0, $zero, 107 + sb $t0, 20($v0) # internal_1[12] = 'k' + + addi $t0, $zero, 101 + sb $t0, 21($v0) # internal_1[13] = 'e' + + addi $t0, $zero, 32 + sb $t0, 22($v0) # internal_1[14] = ' ' + + addi $t0, $zero, 116 + sb $t0, 23($v0) # internal_1[15] = 't' + + addi $t0, $zero, 111 + sb $t0, 24($v0) # internal_1[16] = 'o' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_1[17] = ' ' + + addi $t0, $zero, 99 + sb $t0, 26($v0) # internal_1[18] = 'c' + + addi $t0, $zero, 111 + sb $t0, 27($v0) # internal_1[19] = 'o' + + addi $t0, $zero, 110 + sb $t0, 28($v0) # internal_1[20] = 'n' + + addi $t0, $zero, 116 + sb $t0, 29($v0) # internal_1[21] = 't' + + addi $t0, $zero, 105 + sb $t0, 30($v0) # internal_1[22] = 'i' + + addi $t0, $zero, 110 + sb $t0, 31($v0) # internal_1[23] = 'n' + + addi $t0, $zero, 117 + sb $t0, 32($v0) # internal_1[24] = 'u' + + addi $t0, $zero, 101 + sb $t0, 33($v0) # internal_1[25] = 'e' + + addi $t0, $zero, 32 + sb $t0, 34($v0) # internal_1[26] = ' ' + + addi $t0, $zero, 119 + sb $t0, 35($v0) # internal_1[27] = 'w' + + addi $t0, $zero, 105 + sb $t0, 36($v0) # internal_1[28] = 'i' + + addi $t0, $zero, 116 + sb $t0, 37($v0) # internal_1[29] = 't' + + addi $t0, $zero, 104 + sb $t0, 38($v0) # internal_1[30] = 'h' + + addi $t0, $zero, 32 + sb $t0, 39($v0) # internal_1[31] = ' ' + + addi $t0, $zero, 116 + sb $t0, 40($v0) # internal_1[32] = 't' + + addi $t0, $zero, 104 + sb $t0, 41($v0) # internal_1[33] = 'h' + + addi $t0, $zero, 101 + sb $t0, 42($v0) # internal_1[34] = 'e' + + addi $t0, $zero, 32 + sb $t0, 43($v0) # internal_1[35] = ' ' + + addi $t0, $zero, 110 + sb $t0, 44($v0) # internal_1[36] = 'n' + + addi $t0, $zero, 101 + sb $t0, 45($v0) # internal_1[37] = 'e' + + addi $t0, $zero, 120 + sb $t0, 46($v0) # internal_1[38] = 'x' + + addi $t0, $zero, 116 + sb $t0, 47($v0) # internal_1[39] = 't' + + addi $t0, $zero, 32 + sb $t0, 48($v0) # internal_1[40] = ' ' + + addi $t0, $zero, 103 + sb $t0, 49($v0) # internal_1[41] = 'g' + + addi $t0, $zero, 101 + sb $t0, 50($v0) # internal_1[42] = 'e' + + addi $t0, $zero, 110 + sb $t0, 51($v0) # internal_1[43] = 'n' + + addi $t0, $zero, 101 + sb $t0, 52($v0) # internal_1[44] = 'e' + + addi $t0, $zero, 114 + sb $t0, 53($v0) # internal_1[45] = 'r' + + addi $t0, $zero, 97 + sb $t0, 54($v0) # internal_1[46] = 'a' + + addi $t0, $zero, 116 + sb $t0, 55($v0) # internal_1[47] = 't' + + addi $t0, $zero, 105 + sb $t0, 56($v0) # internal_1[48] = 'i' + + addi $t0, $zero, 111 + sb $t0, 57($v0) # internal_1[49] = 'o' + + addi $t0, $zero, 110 + sb $t0, 58($v0) # internal_1[50] = 'n' + + addi $t0, $zero, 63 + sb $t0, 59($v0) # internal_1[51] = '?' + + addi $t0, $zero, 32 + sb $t0, 60($v0) # internal_1[52] = ' ' + + addi $t0, $zero, 10 + sb $t0, 61($v0) # internal_1[53] = '\n' + + sb $zero, 62($v0) # Null-terminator at the end of the string + + sw $v0, 80($sp) # internal_1 = "Would you like to continue with the next generation? \n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 72($sp) # internal_3 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 88($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 72($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 68($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 100($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_1 + lw $t0, 92($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function internal_4 + lw $t0, 80($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 88($sp) # internal_2 = result of internal_4 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 58 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 58 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 80 + sb $t0, 8($v0) # internal_5[0] = 'P' + + addi $t0, $zero, 108 + sb $t0, 9($v0) # internal_5[1] = 'l' + + addi $t0, $zero, 101 + sb $t0, 10($v0) # internal_5[2] = 'e' + + addi $t0, $zero, 97 + sb $t0, 11($v0) # internal_5[3] = 'a' + + addi $t0, $zero, 115 + sb $t0, 12($v0) # internal_5[4] = 's' + + addi $t0, $zero, 101 + sb $t0, 13($v0) # internal_5[5] = 'e' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_5[6] = ' ' + + addi $t0, $zero, 117 + sb $t0, 15($v0) # internal_5[7] = 'u' + + addi $t0, $zero, 115 + sb $t0, 16($v0) # internal_5[8] = 's' + + addi $t0, $zero, 101 + sb $t0, 17($v0) # internal_5[9] = 'e' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_5[10] = ' ' + + addi $t0, $zero, 108 + sb $t0, 19($v0) # internal_5[11] = 'l' + + addi $t0, $zero, 111 + sb $t0, 20($v0) # internal_5[12] = 'o' + + addi $t0, $zero, 119 + sb $t0, 21($v0) # internal_5[13] = 'w' + + addi $t0, $zero, 101 + sb $t0, 22($v0) # internal_5[14] = 'e' + + addi $t0, $zero, 114 + sb $t0, 23($v0) # internal_5[15] = 'r' + + addi $t0, $zero, 99 + sb $t0, 24($v0) # internal_5[16] = 'c' + + addi $t0, $zero, 97 + sb $t0, 25($v0) # internal_5[17] = 'a' + + addi $t0, $zero, 115 + sb $t0, 26($v0) # internal_5[18] = 's' + + addi $t0, $zero, 101 + sb $t0, 27($v0) # internal_5[19] = 'e' + + addi $t0, $zero, 32 + sb $t0, 28($v0) # internal_5[20] = ' ' + + addi $t0, $zero, 121 + sb $t0, 29($v0) # internal_5[21] = 'y' + + addi $t0, $zero, 32 + sb $t0, 30($v0) # internal_5[22] = ' ' + + addi $t0, $zero, 111 + sb $t0, 31($v0) # internal_5[23] = 'o' + + addi $t0, $zero, 114 + sb $t0, 32($v0) # internal_5[24] = 'r' + + addi $t0, $zero, 32 + sb $t0, 33($v0) # internal_5[25] = ' ' + + addi $t0, $zero, 110 + sb $t0, 34($v0) # internal_5[26] = 'n' + + addi $t0, $zero, 32 + sb $t0, 35($v0) # internal_5[27] = ' ' + + addi $t0, $zero, 102 + sb $t0, 36($v0) # internal_5[28] = 'f' + + addi $t0, $zero, 111 + sb $t0, 37($v0) # internal_5[29] = 'o' + + addi $t0, $zero, 114 + sb $t0, 38($v0) # internal_5[30] = 'r' + + addi $t0, $zero, 32 + sb $t0, 39($v0) # internal_5[31] = ' ' + + addi $t0, $zero, 121 + sb $t0, 40($v0) # internal_5[32] = 'y' + + addi $t0, $zero, 111 + sb $t0, 41($v0) # internal_5[33] = 'o' + + addi $t0, $zero, 117 + sb $t0, 42($v0) # internal_5[34] = 'u' + + addi $t0, $zero, 114 + sb $t0, 43($v0) # internal_5[35] = 'r' + + addi $t0, $zero, 32 + sb $t0, 44($v0) # internal_5[36] = ' ' + + addi $t0, $zero, 97 + sb $t0, 45($v0) # internal_5[37] = 'a' + + addi $t0, $zero, 110 + sb $t0, 46($v0) # internal_5[38] = 'n' + + addi $t0, $zero, 115 + sb $t0, 47($v0) # internal_5[39] = 's' + + addi $t0, $zero, 119 + sb $t0, 48($v0) # internal_5[40] = 'w' + + addi $t0, $zero, 101 + sb $t0, 49($v0) # internal_5[41] = 'e' + + addi $t0, $zero, 114 + sb $t0, 50($v0) # internal_5[42] = 'r' + + addi $t0, $zero, 32 + sb $t0, 51($v0) # internal_5[43] = ' ' + + addi $t0, $zero, 91 + sb $t0, 52($v0) # internal_5[44] = '[' + + addi $t0, $zero, 121 + sb $t0, 53($v0) # internal_5[45] = 'y' + + addi $t0, $zero, 93 + sb $t0, 54($v0) # internal_5[46] = ']' + + addi $t0, $zero, 58 + sb $t0, 55($v0) # internal_5[47] = ':' + + addi $t0, $zero, 32 + sb $t0, 56($v0) # internal_5[48] = ' ' + + sb $zero, 57($v0) # Null-terminator at the end of the string + + sw $v0, 64($sp) # internal_5 = "Please use lowercase y or n for your answer [y]: " + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 56($sp) # internal_7 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 88($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 56($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 52($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 100($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_5 + lw $t0, 76($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function internal_8 + lw $t0, 64($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 72($sp) # internal_6 = result of internal_8 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_10 = address of allocated object Int + + # Get method in_string of CellularAutomaton + lw $t0, 88($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 44($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 40($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 96($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_11 + lw $t0, 48($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 56($sp) # internal_9 = result of internal_11 + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument ans + lw $t0, 96($sp) + sw $t0, 4($sp) # Storing ans + + # Argument internal_9 + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 96($sp) # ans = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_12[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 36($sp) # internal_12 = "\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_14 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 88($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 28($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 24($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 100($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_12 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_12 + + # Calling function internal_15 + lw $t0, 36($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 44($sp) # internal_13 = result of internal_15 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_17 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 110 + sb $t0, 8($v0) # internal_18[0] = 'n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_18 = "n" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument ans + lw $t0, 96($sp) + sw $t0, 4($sp) # Storing ans + + # Argument internal_18 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_18 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_19 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_17 = internal_19 + lw $t0, 8($sp) + sw $t0, 16($sp) + + # If internal_17 then goto then_8737379857324 + lw $t0, 16($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8737379857324 + + # Jumping to else_8737379857324 + j else_8737379857324 + + then_8737379857324: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_20 = address of allocated object Int + + # internal_16 = internal_20 + lw $t0, 4($sp) + sw $t0, 20($sp) + + # Jumping to endif_8737379857324 + j endif_8737379857324 + + else_8737379857324: + + # Allocating Bool 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_21 = address of allocated object Int + + # internal_16 = internal_21 + lw $t0, 0($sp) + sw $t0, 20($sp) + + # Jumping to endif_8737379857324 + j endif_8737379857324 + + endif_8737379857324: + + # Loading return value in $v1 + lw $v1, 20($sp) + + # Freeing space for local variables + addi $sp, $sp, 88 + + jr $ra + + function_prompt2_at_CellularAutomaton: + # Function parameters + # $ra = 92($sp) + # self = 88($sp) + + # Reserving space for local variables + addi $sp, $sp, -88 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 9 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 9 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + sb $zero, 8($v0) # Null-terminator at the end of the string + + sw $v0, 84($sp) # ans = "" + + # Allocating String + li $v0, 9 + addi $a0, $zero, 11 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 11 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_1[0] = '\n' + + addi $t0, $zero, 10 + sb $t0, 9($v0) # internal_1[1] = '\n' + + sb $zero, 10($v0) # Null-terminator at the end of the string + + sw $v0, 80($sp) # internal_1 = "\n\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 72($sp) # internal_3 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 88($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 72($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 68($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 100($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_1 + lw $t0, 92($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function internal_4 + lw $t0, 80($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 88($sp) # internal_2 = result of internal_4 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 57 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 57 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 87 + sb $t0, 8($v0) # internal_5[0] = 'W' + + addi $t0, $zero, 111 + sb $t0, 9($v0) # internal_5[1] = 'o' + + addi $t0, $zero, 117 + sb $t0, 10($v0) # internal_5[2] = 'u' + + addi $t0, $zero, 108 + sb $t0, 11($v0) # internal_5[3] = 'l' + + addi $t0, $zero, 100 + sb $t0, 12($v0) # internal_5[4] = 'd' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_5[5] = ' ' + + addi $t0, $zero, 121 + sb $t0, 14($v0) # internal_5[6] = 'y' + + addi $t0, $zero, 111 + sb $t0, 15($v0) # internal_5[7] = 'o' + + addi $t0, $zero, 117 + sb $t0, 16($v0) # internal_5[8] = 'u' + + addi $t0, $zero, 32 + sb $t0, 17($v0) # internal_5[9] = ' ' + + addi $t0, $zero, 108 + sb $t0, 18($v0) # internal_5[10] = 'l' + + addi $t0, $zero, 105 + sb $t0, 19($v0) # internal_5[11] = 'i' + + addi $t0, $zero, 107 + sb $t0, 20($v0) # internal_5[12] = 'k' + + addi $t0, $zero, 101 + sb $t0, 21($v0) # internal_5[13] = 'e' + + addi $t0, $zero, 32 + sb $t0, 22($v0) # internal_5[14] = ' ' + + addi $t0, $zero, 116 + sb $t0, 23($v0) # internal_5[15] = 't' + + addi $t0, $zero, 111 + sb $t0, 24($v0) # internal_5[16] = 'o' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_5[17] = ' ' + + addi $t0, $zero, 99 + sb $t0, 26($v0) # internal_5[18] = 'c' + + addi $t0, $zero, 104 + sb $t0, 27($v0) # internal_5[19] = 'h' + + addi $t0, $zero, 111 + sb $t0, 28($v0) # internal_5[20] = 'o' + + addi $t0, $zero, 111 + sb $t0, 29($v0) # internal_5[21] = 'o' + + addi $t0, $zero, 115 + sb $t0, 30($v0) # internal_5[22] = 's' + + addi $t0, $zero, 101 + sb $t0, 31($v0) # internal_5[23] = 'e' + + addi $t0, $zero, 32 + sb $t0, 32($v0) # internal_5[24] = ' ' + + addi $t0, $zero, 97 + sb $t0, 33($v0) # internal_5[25] = 'a' + + addi $t0, $zero, 32 + sb $t0, 34($v0) # internal_5[26] = ' ' + + addi $t0, $zero, 98 + sb $t0, 35($v0) # internal_5[27] = 'b' + + addi $t0, $zero, 97 + sb $t0, 36($v0) # internal_5[28] = 'a' + + addi $t0, $zero, 99 + sb $t0, 37($v0) # internal_5[29] = 'c' + + addi $t0, $zero, 107 + sb $t0, 38($v0) # internal_5[30] = 'k' + + addi $t0, $zero, 103 + sb $t0, 39($v0) # internal_5[31] = 'g' + + addi $t0, $zero, 114 + sb $t0, 40($v0) # internal_5[32] = 'r' + + addi $t0, $zero, 111 + sb $t0, 41($v0) # internal_5[33] = 'o' + + addi $t0, $zero, 117 + sb $t0, 42($v0) # internal_5[34] = 'u' + + addi $t0, $zero, 110 + sb $t0, 43($v0) # internal_5[35] = 'n' + + addi $t0, $zero, 100 + sb $t0, 44($v0) # internal_5[36] = 'd' + + addi $t0, $zero, 32 + sb $t0, 45($v0) # internal_5[37] = ' ' + + addi $t0, $zero, 112 + sb $t0, 46($v0) # internal_5[38] = 'p' + + addi $t0, $zero, 97 + sb $t0, 47($v0) # internal_5[39] = 'a' + + addi $t0, $zero, 116 + sb $t0, 48($v0) # internal_5[40] = 't' + + addi $t0, $zero, 116 + sb $t0, 49($v0) # internal_5[41] = 't' + + addi $t0, $zero, 101 + sb $t0, 50($v0) # internal_5[42] = 'e' + + addi $t0, $zero, 114 + sb $t0, 51($v0) # internal_5[43] = 'r' + + addi $t0, $zero, 110 + sb $t0, 52($v0) # internal_5[44] = 'n' + + addi $t0, $zero, 63 + sb $t0, 53($v0) # internal_5[45] = '?' + + addi $t0, $zero, 32 + sb $t0, 54($v0) # internal_5[46] = ' ' + + addi $t0, $zero, 10 + sb $t0, 55($v0) # internal_5[47] = '\n' + + sb $zero, 56($v0) # Null-terminator at the end of the string + + sw $v0, 64($sp) # internal_5 = "Would you like to choose a background pattern? \n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 56($sp) # internal_7 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 88($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 56($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 52($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 100($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_5 + lw $t0, 76($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function internal_8 + lw $t0, 64($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 72($sp) # internal_6 = result of internal_8 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 58 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 58 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 80 + sb $t0, 8($v0) # internal_9[0] = 'P' + + addi $t0, $zero, 108 + sb $t0, 9($v0) # internal_9[1] = 'l' + + addi $t0, $zero, 101 + sb $t0, 10($v0) # internal_9[2] = 'e' + + addi $t0, $zero, 97 + sb $t0, 11($v0) # internal_9[3] = 'a' + + addi $t0, $zero, 115 + sb $t0, 12($v0) # internal_9[4] = 's' + + addi $t0, $zero, 101 + sb $t0, 13($v0) # internal_9[5] = 'e' + + addi $t0, $zero, 32 + sb $t0, 14($v0) # internal_9[6] = ' ' + + addi $t0, $zero, 117 + sb $t0, 15($v0) # internal_9[7] = 'u' + + addi $t0, $zero, 115 + sb $t0, 16($v0) # internal_9[8] = 's' + + addi $t0, $zero, 101 + sb $t0, 17($v0) # internal_9[9] = 'e' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_9[10] = ' ' + + addi $t0, $zero, 108 + sb $t0, 19($v0) # internal_9[11] = 'l' + + addi $t0, $zero, 111 + sb $t0, 20($v0) # internal_9[12] = 'o' + + addi $t0, $zero, 119 + sb $t0, 21($v0) # internal_9[13] = 'w' + + addi $t0, $zero, 101 + sb $t0, 22($v0) # internal_9[14] = 'e' + + addi $t0, $zero, 114 + sb $t0, 23($v0) # internal_9[15] = 'r' + + addi $t0, $zero, 99 + sb $t0, 24($v0) # internal_9[16] = 'c' + + addi $t0, $zero, 97 + sb $t0, 25($v0) # internal_9[17] = 'a' + + addi $t0, $zero, 115 + sb $t0, 26($v0) # internal_9[18] = 's' + + addi $t0, $zero, 101 + sb $t0, 27($v0) # internal_9[19] = 'e' + + addi $t0, $zero, 32 + sb $t0, 28($v0) # internal_9[20] = ' ' + + addi $t0, $zero, 121 + sb $t0, 29($v0) # internal_9[21] = 'y' + + addi $t0, $zero, 32 + sb $t0, 30($v0) # internal_9[22] = ' ' + + addi $t0, $zero, 111 + sb $t0, 31($v0) # internal_9[23] = 'o' + + addi $t0, $zero, 114 + sb $t0, 32($v0) # internal_9[24] = 'r' + + addi $t0, $zero, 32 + sb $t0, 33($v0) # internal_9[25] = ' ' + + addi $t0, $zero, 110 + sb $t0, 34($v0) # internal_9[26] = 'n' + + addi $t0, $zero, 32 + sb $t0, 35($v0) # internal_9[27] = ' ' + + addi $t0, $zero, 102 + sb $t0, 36($v0) # internal_9[28] = 'f' + + addi $t0, $zero, 111 + sb $t0, 37($v0) # internal_9[29] = 'o' + + addi $t0, $zero, 114 + sb $t0, 38($v0) # internal_9[30] = 'r' + + addi $t0, $zero, 32 + sb $t0, 39($v0) # internal_9[31] = ' ' + + addi $t0, $zero, 121 + sb $t0, 40($v0) # internal_9[32] = 'y' + + addi $t0, $zero, 111 + sb $t0, 41($v0) # internal_9[33] = 'o' + + addi $t0, $zero, 117 + sb $t0, 42($v0) # internal_9[34] = 'u' + + addi $t0, $zero, 114 + sb $t0, 43($v0) # internal_9[35] = 'r' + + addi $t0, $zero, 32 + sb $t0, 44($v0) # internal_9[36] = ' ' + + addi $t0, $zero, 97 + sb $t0, 45($v0) # internal_9[37] = 'a' + + addi $t0, $zero, 110 + sb $t0, 46($v0) # internal_9[38] = 'n' + + addi $t0, $zero, 115 + sb $t0, 47($v0) # internal_9[39] = 's' + + addi $t0, $zero, 119 + sb $t0, 48($v0) # internal_9[40] = 'w' + + addi $t0, $zero, 101 + sb $t0, 49($v0) # internal_9[41] = 'e' + + addi $t0, $zero, 114 + sb $t0, 50($v0) # internal_9[42] = 'r' + + addi $t0, $zero, 32 + sb $t0, 51($v0) # internal_9[43] = ' ' + + addi $t0, $zero, 91 + sb $t0, 52($v0) # internal_9[44] = '[' + + addi $t0, $zero, 110 + sb $t0, 53($v0) # internal_9[45] = 'n' + + addi $t0, $zero, 93 + sb $t0, 54($v0) # internal_9[46] = ']' + + addi $t0, $zero, 58 + sb $t0, 55($v0) # internal_9[47] = ':' + + addi $t0, $zero, 32 + sb $t0, 56($v0) # internal_9[48] = ' ' + + sb $zero, 57($v0) # Null-terminator at the end of the string + + sw $v0, 48($sp) # internal_9 = "Please use lowercase y or n for your answer [n]: " + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_11 = address of allocated object Int + + # Get method out_string of CellularAutomaton + lw $t0, 88($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 40($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 36($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 100($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_9 + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function internal_12 + lw $t0, 48($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 56($sp) # internal_10 = result of internal_12 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_14 = address of allocated object Int + + # Get method in_string of CellularAutomaton + lw $t0, 88($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 28($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 24($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 96($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_15 + lw $t0, 32($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 40($sp) # internal_13 = result of internal_15 + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument ans + lw $t0, 96($sp) + sw $t0, 4($sp) # Storing ans + + # Argument internal_13 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_13 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 96($sp) # ans = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_17 = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 121 + sb $t0, 8($v0) # internal_18[0] = 'y' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_18 = "y" + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument ans + lw $t0, 96($sp) + sw $t0, 4($sp) # Storing ans + + # Argument internal_18 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_18 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_19 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_17 = internal_19 + lw $t0, 8($sp) + sw $t0, 16($sp) + + # If internal_17 then goto then_8737379857680 + lw $t0, 16($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8737379857680 + + # Jumping to else_8737379857680 + j else_8737379857680 + + then_8737379857680: + + # Allocating Bool 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_20 = address of allocated object Int + + # internal_16 = internal_20 + lw $t0, 4($sp) + sw $t0, 20($sp) + + # Jumping to endif_8737379857680 + j endif_8737379857680 + + else_8737379857680: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_21 = address of allocated object Int + + # internal_16 = internal_21 + lw $t0, 0($sp) + sw $t0, 20($sp) + + # Jumping to endif_8737379857680 + j endif_8737379857680 + + endif_8737379857680: + + # Loading return value in $v1 + lw $v1, 20($sp) + + # Freeing space for local variables + addi $sp, $sp, 88 + + jr $ra + + function___init___at_Main: + # Function parameters + # $ra = 24($sp) + # self = 20($sp) + + # Reserving space for local variables + addi $sp, $sp, -20 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_0 = address of allocated object Int + + # Set attribute rows of self + lw $t0, 20($sp) # $t0 = self + lw $t1, 16($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8737379851650 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8737379851650 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8737379851650 + j object_set_attribute_8737379851650 + int_set_attribute_8737379851650: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.rows = internal_0 + j end_set_attribute_8737379851650 + bool_set_attribute_8737379851650: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.rows = internal_0 + j end_set_attribute_8737379851650 + object_set_attribute_8737379851650: + sw $t1, 8($t0) # self.rows = internal_0 + end_set_attribute_8737379851650: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 12($sp) # internal_1 = address of allocated object Int + + # Set attribute columns of self + lw $t0, 20($sp) # $t0 = self + lw $t1, 12($sp) # $t1 = internal_1 + beq $t1, $zero, object_set_attribute_8737379852418 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8737379852418 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8737379852418 + j object_set_attribute_8737379852418 + int_set_attribute_8737379852418: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.columns = internal_1 + j end_set_attribute_8737379852418 + bool_set_attribute_8737379852418: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.columns = internal_1 + j end_set_attribute_8737379852418 + object_set_attribute_8737379852418: + sw $t1, 12($t0) # self.columns = internal_1 + end_set_attribute_8737379852418: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_2 = address of allocated object Int + + # Set attribute board_size of self + lw $t0, 20($sp) # $t0 = self + lw $t1, 8($sp) # $t1 = internal_2 + beq $t1, $zero, object_set_attribute_8737379852352 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8737379852352 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8737379852352 + j object_set_attribute_8737379852352 + int_set_attribute_8737379852352: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.board_size = internal_2 + j end_set_attribute_8737379852352 + bool_set_attribute_8737379852352: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.board_size = internal_2 + j end_set_attribute_8737379852352 + object_set_attribute_8737379852352: + sw $t1, 16($t0) # self.board_size = internal_2 + end_set_attribute_8737379852352: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 9 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 9 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + sb $zero, 8($v0) # Null-terminator at the end of the string + + sw $v0, 4($sp) # internal_3 = "" + + # Set attribute population_map of self + lw $t0, 20($sp) # $t0 = self + lw $t1, 4($sp) # $t1 = internal_3 + beq $t1, $zero, object_set_attribute_8737379832989 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8737379832989 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8737379832989 + j object_set_attribute_8737379832989 + int_set_attribute_8737379832989: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($t0) # self.population_map = internal_3 + j end_set_attribute_8737379832989 + bool_set_attribute_8737379832989: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($t0) # self.population_map = internal_3 + j end_set_attribute_8737379832989 + object_set_attribute_8737379832989: + sw $t1, 20($t0) # self.population_map = internal_3 + end_set_attribute_8737379832989: + + # Allocating NUll to internal_4 + sw $zero, 0($sp) # internal_4 = 0 + + # Set attribute cells of self + lw $t0, 20($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_4 + beq $t1, $zero, object_set_attribute_8737379832857 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8737379832857 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8737379832857 + j object_set_attribute_8737379832857 + int_set_attribute_8737379832857: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 24($t0) # self.cells = internal_4 + j end_set_attribute_8737379832857 + bool_set_attribute_8737379832857: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 24($t0) # self.cells = internal_4 + j end_set_attribute_8737379832857 + object_set_attribute_8737379832857: + sw $t1, 24($t0) # self.cells = internal_4 + end_set_attribute_8737379832857: + + # Loading return value in $v1 + lw $v1, 20($sp) + + # Freeing space for local variables + addi $sp, $sp, 20 + + jr $ra + + function_main_at_Main: + # Function parameters + # $ra = 168($sp) + # self = 164($sp) + + # Reserving space for local variables + addi $sp, $sp, -164 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 160($sp) # continue = address of allocated object Int + + # Allocating String + li $v0, 9 + addi $a0, $zero, 9 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 9 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + sb $zero, 8($v0) # Null-terminator at the end of the string + + sw $v0, 156($sp) # choice = "" + + # Allocating String + li $v0, 9 + addi $a0, $zero, 38 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 38 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 87 + sb $t0, 8($v0) # internal_2[0] = 'W' + + addi $t0, $zero, 101 + sb $t0, 9($v0) # internal_2[1] = 'e' + + addi $t0, $zero, 108 + sb $t0, 10($v0) # internal_2[2] = 'l' + + addi $t0, $zero, 99 + sb $t0, 11($v0) # internal_2[3] = 'c' + + addi $t0, $zero, 111 + sb $t0, 12($v0) # internal_2[4] = 'o' + + addi $t0, $zero, 109 + sb $t0, 13($v0) # internal_2[5] = 'm' + + addi $t0, $zero, 101 + sb $t0, 14($v0) # internal_2[6] = 'e' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_2[7] = ' ' + + addi $t0, $zero, 116 + sb $t0, 16($v0) # internal_2[8] = 't' + + addi $t0, $zero, 111 + sb $t0, 17($v0) # internal_2[9] = 'o' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_2[10] = ' ' + + addi $t0, $zero, 116 + sb $t0, 19($v0) # internal_2[11] = 't' + + addi $t0, $zero, 104 + sb $t0, 20($v0) # internal_2[12] = 'h' + + addi $t0, $zero, 101 + sb $t0, 21($v0) # internal_2[13] = 'e' + + addi $t0, $zero, 32 + sb $t0, 22($v0) # internal_2[14] = ' ' + + addi $t0, $zero, 71 + sb $t0, 23($v0) # internal_2[15] = 'G' + + addi $t0, $zero, 97 + sb $t0, 24($v0) # internal_2[16] = 'a' + + addi $t0, $zero, 109 + sb $t0, 25($v0) # internal_2[17] = 'm' + + addi $t0, $zero, 101 + sb $t0, 26($v0) # internal_2[18] = 'e' + + addi $t0, $zero, 32 + sb $t0, 27($v0) # internal_2[19] = ' ' + + addi $t0, $zero, 111 + sb $t0, 28($v0) # internal_2[20] = 'o' + + addi $t0, $zero, 102 + sb $t0, 29($v0) # internal_2[21] = 'f' + + addi $t0, $zero, 32 + sb $t0, 30($v0) # internal_2[22] = ' ' + + addi $t0, $zero, 76 + sb $t0, 31($v0) # internal_2[23] = 'L' + + addi $t0, $zero, 105 + sb $t0, 32($v0) # internal_2[24] = 'i' + + addi $t0, $zero, 102 + sb $t0, 33($v0) # internal_2[25] = 'f' + + addi $t0, $zero, 101 + sb $t0, 34($v0) # internal_2[26] = 'e' + + addi $t0, $zero, 46 + sb $t0, 35($v0) # internal_2[27] = '.' + + addi $t0, $zero, 10 + sb $t0, 36($v0) # internal_2[28] = '\n' + + sb $zero, 37($v0) # Null-terminator at the end of the string + + sw $v0, 152($sp) # internal_2 = "Welcome to the Game of Life.\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 144($sp) # internal_4 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 164($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 144($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 140($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 176($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_2 + lw $t0, 164($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function internal_5 + lw $t0, 152($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 160($sp) # internal_3 = result of internal_5 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 56 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 56 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 84 + sb $t0, 8($v0) # internal_6[0] = 'T' + + addi $t0, $zero, 104 + sb $t0, 9($v0) # internal_6[1] = 'h' + + addi $t0, $zero, 101 + sb $t0, 10($v0) # internal_6[2] = 'e' + + addi $t0, $zero, 114 + sb $t0, 11($v0) # internal_6[3] = 'r' + + addi $t0, $zero, 101 + sb $t0, 12($v0) # internal_6[4] = 'e' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_6[5] = ' ' + + addi $t0, $zero, 97 + sb $t0, 14($v0) # internal_6[6] = 'a' + + addi $t0, $zero, 114 + sb $t0, 15($v0) # internal_6[7] = 'r' + + addi $t0, $zero, 101 + sb $t0, 16($v0) # internal_6[8] = 'e' + + addi $t0, $zero, 32 + sb $t0, 17($v0) # internal_6[9] = ' ' + + addi $t0, $zero, 109 + sb $t0, 18($v0) # internal_6[10] = 'm' + + addi $t0, $zero, 97 + sb $t0, 19($v0) # internal_6[11] = 'a' + + addi $t0, $zero, 110 + sb $t0, 20($v0) # internal_6[12] = 'n' + + addi $t0, $zero, 121 + sb $t0, 21($v0) # internal_6[13] = 'y' + + addi $t0, $zero, 32 + sb $t0, 22($v0) # internal_6[14] = ' ' + + addi $t0, $zero, 105 + sb $t0, 23($v0) # internal_6[15] = 'i' + + addi $t0, $zero, 110 + sb $t0, 24($v0) # internal_6[16] = 'n' + + addi $t0, $zero, 105 + sb $t0, 25($v0) # internal_6[17] = 'i' + + addi $t0, $zero, 116 + sb $t0, 26($v0) # internal_6[18] = 't' + + addi $t0, $zero, 105 + sb $t0, 27($v0) # internal_6[19] = 'i' + + addi $t0, $zero, 97 + sb $t0, 28($v0) # internal_6[20] = 'a' + + addi $t0, $zero, 108 + sb $t0, 29($v0) # internal_6[21] = 'l' + + addi $t0, $zero, 32 + sb $t0, 30($v0) # internal_6[22] = ' ' + + addi $t0, $zero, 115 + sb $t0, 31($v0) # internal_6[23] = 's' + + addi $t0, $zero, 116 + sb $t0, 32($v0) # internal_6[24] = 't' + + addi $t0, $zero, 97 + sb $t0, 33($v0) # internal_6[25] = 'a' + + addi $t0, $zero, 116 + sb $t0, 34($v0) # internal_6[26] = 't' + + addi $t0, $zero, 101 + sb $t0, 35($v0) # internal_6[27] = 'e' + + addi $t0, $zero, 115 + sb $t0, 36($v0) # internal_6[28] = 's' + + addi $t0, $zero, 32 + sb $t0, 37($v0) # internal_6[29] = ' ' + + addi $t0, $zero, 116 + sb $t0, 38($v0) # internal_6[30] = 't' + + addi $t0, $zero, 111 + sb $t0, 39($v0) # internal_6[31] = 'o' + + addi $t0, $zero, 32 + sb $t0, 40($v0) # internal_6[32] = ' ' + + addi $t0, $zero, 99 + sb $t0, 41($v0) # internal_6[33] = 'c' + + addi $t0, $zero, 104 + sb $t0, 42($v0) # internal_6[34] = 'h' + + addi $t0, $zero, 111 + sb $t0, 43($v0) # internal_6[35] = 'o' + + addi $t0, $zero, 111 + sb $t0, 44($v0) # internal_6[36] = 'o' + + addi $t0, $zero, 115 + sb $t0, 45($v0) # internal_6[37] = 's' + + addi $t0, $zero, 101 + sb $t0, 46($v0) # internal_6[38] = 'e' + + addi $t0, $zero, 32 + sb $t0, 47($v0) # internal_6[39] = ' ' + + addi $t0, $zero, 102 + sb $t0, 48($v0) # internal_6[40] = 'f' + + addi $t0, $zero, 114 + sb $t0, 49($v0) # internal_6[41] = 'r' + + addi $t0, $zero, 111 + sb $t0, 50($v0) # internal_6[42] = 'o' + + addi $t0, $zero, 109 + sb $t0, 51($v0) # internal_6[43] = 'm' + + addi $t0, $zero, 46 + sb $t0, 52($v0) # internal_6[44] = '.' + + addi $t0, $zero, 32 + sb $t0, 53($v0) # internal_6[45] = ' ' + + addi $t0, $zero, 10 + sb $t0, 54($v0) # internal_6[46] = '\n' + + sb $zero, 55($v0) # Null-terminator at the end of the string + + sw $v0, 136($sp) # internal_6 = "There are many initial states to choose from. \n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 128($sp) # internal_8 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 164($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 128($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 124($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 176($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_6 + lw $t0, 148($sp) + sw $t0, 0($sp) # Storing internal_6 + + # Calling function internal_9 + lw $t0, 136($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 144($sp) # internal_7 = result of internal_9 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating NUll to internal_10 + sw $zero, 120($sp) # internal_10 = 0 + + while_start_8737379857851: + + # Allocating Int 27 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 27 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 112($sp) # internal_12 = address of allocated object Int + + # Get method prompt2 of Main + lw $t0, 164($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 112($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 108($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 172($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_13 + lw $t0, 116($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 124($sp) # internal_11 = result of internal_13 + addi $sp, $sp, 8 # Freeing space for arguments + + # If internal_11 then goto while_body_8737379857851 + lw $t0, 116($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_body_8737379857851 + + # Jumping to while_end_8737379857851 + j while_end_8737379857851 + + while_body_8737379857851: + + # Allocating Bool 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 104($sp) # internal_14 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument continue + lw $t0, 172($sp) + sw $t0, 4($sp) # Storing continue + + # Argument internal_14 + lw $t0, 116($sp) + sw $t0, 0($sp) # Storing internal_14 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 172($sp) # continue = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 25 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 25 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 96($sp) # internal_16 = address of allocated object Int + + # Get method option of Main + lw $t0, 164($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 96($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 92($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 172($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_17 + lw $t0, 100($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 108($sp) # internal_15 = result of internal_17 + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument choice + lw $t0, 168($sp) + sw $t0, 4($sp) # Storing choice + + # Argument internal_15 + lw $t0, 112($sp) + sw $t0, 0($sp) # Storing internal_15 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 168($sp) # choice = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating CellularAutomaton + li $v0, 9 + lw $a0, type_CellularAutomaton + syscall + la $t0, type_CellularAutomaton # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 88($sp) # internal_18 = address of allocated object CellularAutomaton + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_18 + lw $t0, 96($sp) + sw $t0, 0($sp) # Storing internal_18 + + # Calling function function___init___at_CellularAutomaton + jal function___init___at_CellularAutomaton + lw $ra, 4($sp) + sw $v1, 96($sp) # internal_18 = result of function___init___at_CellularAutomaton + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 10 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 10 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 80($sp) # internal_20 = address of allocated object Int + + # Get method init of CellularAutomaton + lw $t0, 88($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 80($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 76($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_18 + lw $t0, 100($sp) + sw $t0, 4($sp) # Storing internal_18 + + # Argument choice + lw $t0, 168($sp) + sw $t0, 0($sp) # Storing choice + + # Calling function internal_21 + lw $t0, 88($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 96($sp) # internal_19 = result of internal_21 + addi $sp, $sp, 12 # Freeing space for arguments + + # Set attribute cells of self + lw $t0, 164($sp) # $t0 = self + lw $t1, 84($sp) # $t1 = internal_19 + beq $t1, $zero, object_set_attribute_8737379784638 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8737379784638 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8737379784638 + j object_set_attribute_8737379784638 + int_set_attribute_8737379784638: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 24($t0) # self.cells = internal_19 + j end_set_attribute_8737379784638 + bool_set_attribute_8737379784638: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 24($t0) # self.cells = internal_19 + j end_set_attribute_8737379784638 + object_set_attribute_8737379784638: + sw $t1, 24($t0) # self.cells = internal_19 + end_set_attribute_8737379784638: + + # Get attribute cells of self + lw $t0, 164($sp) # Get the address of self + lw $t1, 24($t0) # Get the attribute 'cells' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8737379785247 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8737379785247 + j object_get_attribute_8737379785247 + int_get_attribute_8737379785247: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 72($sp) # internal_22 = self.cells + j end_get_attribute_8737379785247 + bool_get_attribute_8737379785247: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 72($sp) # internal_22 = self.cells + j end_get_attribute_8737379785247 + object_get_attribute_8737379785247: + sw $t1, 72($sp) # internal_22 = self.cells + end_get_attribute_8737379785247: + + # Allocating Int 11 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 11 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 64($sp) # internal_24 = address of allocated object Int + + # Get method print of CellularAutomaton + lw $t0, 72($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 64($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 60($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_22 + lw $t0, 80($sp) + sw $t0, 0($sp) # Storing internal_22 + + # Calling function internal_25 + lw $t0, 68($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 76($sp) # internal_23 = result of internal_25 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating NUll to internal_26 + sw $zero, 56($sp) # internal_26 = 0 + + while_start_8737379857839: + + # If continue then goto while_body_8737379857839 + lw $t0, 160($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_body_8737379857839 + + # Jumping to while_end_8737379857839 + j while_end_8737379857839 + + while_body_8737379857839: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 48($sp) # internal_28 = address of allocated object Int + + # Allocating Int 26 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 26 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_30 = address of allocated object Int + + # Get method prompt of Main + lw $t0, 164($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 40($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 36($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 172($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_31 + lw $t0, 44($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 52($sp) # internal_29 = result of internal_31 + addi $sp, $sp, 8 # Freeing space for arguments + + # internal_28 = internal_29 + lw $t0, 44($sp) + sw $t0, 48($sp) + + # If internal_28 then goto then_8737379857833 + lw $t0, 48($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8737379857833 + + # Jumping to else_8737379857833 + j else_8737379857833 + + then_8737379857833: + + # Get attribute cells of self + lw $t0, 164($sp) # Get the address of self + lw $t1, 24($t0) # Get the attribute 'cells' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8737379785741 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8737379785741 + j object_get_attribute_8737379785741 + int_get_attribute_8737379785741: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 32($sp) # internal_32 = self.cells + j end_get_attribute_8737379785741 + bool_get_attribute_8737379785741: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 32($sp) # internal_32 = self.cells + j end_get_attribute_8737379785741 + object_get_attribute_8737379785741: + sw $t1, 32($sp) # internal_32 = self.cells + end_get_attribute_8737379785741: + + # Allocating Int 24 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 24 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 24($sp) # internal_34 = address of allocated object Int + + # Get method evolve of CellularAutomaton + lw $t0, 32($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 24($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 20($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_32 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_32 + + # Calling function internal_35 + lw $t0, 28($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 36($sp) # internal_33 = result of internal_35 + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute cells of self + lw $t0, 164($sp) # Get the address of self + lw $t1, 24($t0) # Get the attribute 'cells' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8737379785795 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8737379785795 + j object_get_attribute_8737379785795 + int_get_attribute_8737379785795: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($sp) # internal_36 = self.cells + j end_get_attribute_8737379785795 + bool_get_attribute_8737379785795: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($sp) # internal_36 = self.cells + j end_get_attribute_8737379785795 + object_get_attribute_8737379785795: + sw $t1, 16($sp) # internal_36 = self.cells + end_get_attribute_8737379785795: + + # Allocating Int 11 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 11 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_38 = address of allocated object Int + + # Get method print of CellularAutomaton + lw $t0, 16($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 8($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 4($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_36 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_36 + + # Calling function internal_39 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_37 = result of internal_39 + addi $sp, $sp, 8 # Freeing space for arguments + + # internal_27 = internal_37 + lw $t0, 12($sp) + sw $t0, 52($sp) + + # Jumping to endif_8737379857833 + j endif_8737379857833 + + else_8737379857833: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_40 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument continue + lw $t0, 172($sp) + sw $t0, 4($sp) # Storing continue + + # Argument internal_40 + lw $t0, 12($sp) + sw $t0, 0($sp) # Storing internal_40 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 172($sp) # continue = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_27 = continue + lw $t0, 160($sp) + sw $t0, 52($sp) + + # Jumping to endif_8737379857833 + j endif_8737379857833 + + endif_8737379857833: + + # Jumping to while_start_8737379857839 + j while_start_8737379857839 + + while_end_8737379857839: + + # Jumping to while_start_8737379857851 + j while_start_8737379857851 + + while_end_8737379857851: + + # Loading return value in $v1 + lw $v1, 164($sp) + + # Freeing space for local variables + addi $sp, $sp, 164 + + jr $ra + + main: + # Reserving space for local variables + addi $sp, $sp, -16 + + # Allocating Main + li $v0, 9 + lw $a0, type_Main + syscall + la $t0, type_Main # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 12($sp) # internal_0 = address of allocated object Main + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_Main + jal function___init___at_Main + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_0 = result of function___init___at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 28 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 28 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_2 = address of allocated object Int + + # Get method main of Main + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function internal_3 + lw $t0, 8($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_1 = result of internal_3 + addi $sp, $sp, 8 # Freeing space for arguments + + # Exit program + li $v0, 10 + syscall + + \ No newline at end of file diff --git a/tests/codegen/life_input.txt b/tests/codegen/life_input.txt index 07e016726..1dfbde620 100644 --- a/tests/codegen/life_input.txt +++ b/tests/codegen/life_input.txt @@ -1,66 +1,66 @@ -y -1 -n -y -2 -n -y -3 -n -y -4 -n -y -5 -n -y -6 -n -y -7 -n -y -8 -n -y -9 -n -y -10 -n -y -11 -n -y -12 -n -y -13 -n -y -14 -n -y -15 -n -y -16 -n -y -17 -n -y -18 -n -y -19 -n -y -20 -n -y -21 -y -y -n +y +1 +n +y +2 +n +y +3 +n +y +4 +n +y +5 +n +y +6 +n +y +7 +n +y +8 +n +y +9 +n +y +10 +n +y +11 +n +y +12 +n +y +13 +n +y +14 +n +y +15 +n +y +16 +n +y +17 +n +y +18 +n +y +19 +n +y +20 +n +y +21 +y +y +n n \ No newline at end of file diff --git a/tests/codegen/life_output.txt b/tests/codegen/life_output.txt index 5a9b9f73d..e804b2382 100644 --- a/tests/codegen/life_output.txt +++ b/tests/codegen/life_output.txt @@ -1,778 +1,778 @@ -Welcome to the Game of Life. -There are many initial states to choose from. - - -Would you like to choose a background pattern? -Please use lowercase y or n for your answer [n]: -Please chose a number: - 1: A cross - 2: A slash from the upper left to lower right - 3: A slash from the upper right to lower left - 4: An X - 5: A greater than sign - 6: A less than sign - 7: Two greater than signs - 8: Two less than signs - 9: A 'V' - 10: An inverse 'V' - 11: Numbers 9 and 10 combined - 12: A full grid - 13: A 'T' - 14: A plus '+' - 15: A 'W' - 16: An 'M' - 17: An 'E' - 18: A '3' - 19: An 'O' - 20: An '8' - 21: An 'S' -Your choice => - - XX -XXXX -XXXX - XX - -Would you like to continue with the next generation? -Please use lowercase y or n for your answer [y]: - - -Would you like to choose a background pattern? -Please use lowercase y or n for your answer [n]: -Please chose a number: - 1: A cross - 2: A slash from the upper left to lower right - 3: A slash from the upper right to lower left - 4: An X - 5: A greater than sign - 6: A less than sign - 7: Two greater than signs - 8: Two less than signs - 9: A 'V' - 10: An inverse 'V' - 11: Numbers 9 and 10 combined - 12: A full grid - 13: A 'T' - 14: A plus '+' - 15: A 'W' - 16: An 'M' - 17: An 'E' - 18: A '3' - 19: An 'O' - 20: An '8' - 21: An 'S' -Your choice => - - X - X - X - X -X - -Would you like to continue with the next generation? -Please use lowercase y or n for your answer [y]: - - -Would you like to choose a background pattern? -Please use lowercase y or n for your answer [n]: -Please chose a number: - 1: A cross - 2: A slash from the upper left to lower right - 3: A slash from the upper right to lower left - 4: An X - 5: A greater than sign - 6: A less than sign - 7: Two greater than signs - 8: Two less than signs - 9: A 'V' - 10: An inverse 'V' - 11: Numbers 9 and 10 combined - 12: A full grid - 13: A 'T' - 14: A plus '+' - 15: A 'W' - 16: An 'M' - 17: An 'E' - 18: A '3' - 19: An 'O' - 20: An '8' - 21: An 'S' -Your choice => - -X - X - X - X - X - -Would you like to continue with the next generation? -Please use lowercase y or n for your answer [y]: - - -Would you like to choose a background pattern? -Please use lowercase y or n for your answer [n]: -Please chose a number: - 1: A cross - 2: A slash from the upper left to lower right - 3: A slash from the upper right to lower left - 4: An X - 5: A greater than sign - 6: A less than sign - 7: Two greater than signs - 8: Two less than signs - 9: A 'V' - 10: An inverse 'V' - 11: Numbers 9 and 10 combined - 12: A full grid - 13: A 'T' - 14: A plus '+' - 15: A 'W' - 16: An 'M' - 17: An 'E' - 18: A '3' - 19: An 'O' - 20: An '8' - 21: An 'S' -Your choice => - -X X - X X - X - X X -X X - -Would you like to continue with the next generation? -Please use lowercase y or n for your answer [y]: - - -Would you like to choose a background pattern? -Please use lowercase y or n for your answer [n]: -Please chose a number: - 1: A cross - 2: A slash from the upper left to lower right - 3: A slash from the upper right to lower left - 4: An X - 5: A greater than sign - 6: A less than sign - 7: Two greater than signs - 8: Two less than signs - 9: A 'V' - 10: An inverse 'V' - 11: Numbers 9 and 10 combined - 12: A full grid - 13: A 'T' - 14: A plus '+' - 15: A 'W' - 16: An 'M' - 17: An 'E' - 18: A '3' - 19: An 'O' - 20: An '8' - 21: An 'S' -Your choice => - -X - X - X - X -X - -Would you like to continue with the next generation? -Please use lowercase y or n for your answer [y]: - - -Would you like to choose a background pattern? -Please use lowercase y or n for your answer [n]: -Please chose a number: - 1: A cross - 2: A slash from the upper left to lower right - 3: A slash from the upper right to lower left - 4: An X - 5: A greater than sign - 6: A less than sign - 7: Two greater than signs - 8: Two less than signs - 9: A 'V' - 10: An inverse 'V' - 11: Numbers 9 and 10 combined - 12: A full grid - 13: A 'T' - 14: A plus '+' - 15: A 'W' - 16: An 'M' - 17: An 'E' - 18: A '3' - 19: An 'O' - 20: An '8' - 21: An 'S' -Your choice => - - X - X - X - X - X - -Would you like to continue with the next generation? -Please use lowercase y or n for your answer [y]: - - -Would you like to choose a background pattern? -Please use lowercase y or n for your answer [n]: -Please chose a number: - 1: A cross - 2: A slash from the upper left to lower right - 3: A slash from the upper right to lower left - 4: An X - 5: A greater than sign - 6: A less than sign - 7: Two greater than signs - 8: Two less than signs - 9: A 'V' - 10: An inverse 'V' - 11: Numbers 9 and 10 combined - 12: A full grid - 13: A 'T' - 14: A plus '+' - 15: A 'W' - 16: An 'M' - 17: An 'E' - 18: A '3' - 19: An 'O' - 20: An '8' - 21: An 'S' -Your choice => - -X X - X X -X X - - -Would you like to continue with the next generation? -Please use lowercase y or n for your answer [y]: - - -Would you like to choose a background pattern? -Please use lowercase y or n for your answer [n]: -Please chose a number: - 1: A cross - 2: A slash from the upper left to lower right - 3: A slash from the upper right to lower left - 4: An X - 5: A greater than sign - 6: A less than sign - 7: Two greater than signs - 8: Two less than signs - 9: A 'V' - 10: An inverse 'V' - 11: Numbers 9 and 10 combined - 12: A full grid - 13: A 'T' - 14: A plus '+' - 15: A 'W' - 16: An 'M' - 17: An 'E' - 18: A '3' - 19: An 'O' - 20: An '8' - 21: An 'S' -Your choice => - - X X -X X - X X - - -Would you like to continue with the next generation? -Please use lowercase y or n for your answer [y]: - - -Would you like to choose a background pattern? -Please use lowercase y or n for your answer [n]: -Please chose a number: - 1: A cross - 2: A slash from the upper left to lower right - 3: A slash from the upper right to lower left - 4: An X - 5: A greater than sign - 6: A less than sign - 7: Two greater than signs - 8: Two less than signs - 9: A 'V' - 10: An inverse 'V' - 11: Numbers 9 and 10 combined - 12: A full grid - 13: A 'T' - 14: A plus '+' - 15: A 'W' - 16: An 'M' - 17: An 'E' - 18: A '3' - 19: An 'O' - 20: An '8' - 21: An 'S' -Your choice => - -X X - X X - X - -Would you like to continue with the next generation? -Please use lowercase y or n for your answer [y]: - - -Would you like to choose a background pattern? -Please use lowercase y or n for your answer [n]: -Please chose a number: - 1: A cross - 2: A slash from the upper left to lower right - 3: A slash from the upper right to lower left - 4: An X - 5: A greater than sign - 6: A less than sign - 7: Two greater than signs - 8: Two less than signs - 9: A 'V' - 10: An inverse 'V' - 11: Numbers 9 and 10 combined - 12: A full grid - 13: A 'T' - 14: A plus '+' - 15: A 'W' - 16: An 'M' - 17: An 'E' - 18: A '3' - 19: An 'O' - 20: An '8' - 21: An 'S' -Your choice => - - X - X X -X X - -Would you like to continue with the next generation? -Please use lowercase y or n for your answer [y]: - - -Would you like to choose a background pattern? -Please use lowercase y or n for your answer [n]: -Please chose a number: - 1: A cross - 2: A slash from the upper left to lower right - 3: A slash from the upper right to lower left - 4: An X - 5: A greater than sign - 6: A less than sign - 7: Two greater than signs - 8: Two less than signs - 9: A 'V' - 10: An inverse 'V' - 11: Numbers 9 and 10 combined - 12: A full grid - 13: A 'T' - 14: A plus '+' - 15: A 'W' - 16: An 'M' - 17: An 'E' - 18: A '3' - 19: An 'O' - 20: An '8' - 21: An 'S' -Your choice => - -X X X - X X -X X X - -Would you like to continue with the next generation? -Please use lowercase y or n for your answer [y]: - - -Would you like to choose a background pattern? -Please use lowercase y or n for your answer [n]: -Please chose a number: - 1: A cross - 2: A slash from the upper left to lower right - 3: A slash from the upper right to lower left - 4: An X - 5: A greater than sign - 6: A less than sign - 7: Two greater than signs - 8: Two less than signs - 9: A 'V' - 10: An inverse 'V' - 11: Numbers 9 and 10 combined - 12: A full grid - 13: A 'T' - 14: A plus '+' - 15: A 'W' - 16: An 'M' - 17: An 'E' - 18: A '3' - 19: An 'O' - 20: An '8' - 21: An 'S' -Your choice => - -XXXXX -XXXXX -XXXXX -XXXXX -XXXXX - -Would you like to continue with the next generation? -Please use lowercase y or n for your answer [y]: - - -Would you like to choose a background pattern? -Please use lowercase y or n for your answer [n]: -Please chose a number: - 1: A cross - 2: A slash from the upper left to lower right - 3: A slash from the upper right to lower left - 4: An X - 5: A greater than sign - 6: A less than sign - 7: Two greater than signs - 8: Two less than signs - 9: A 'V' - 10: An inverse 'V' - 11: Numbers 9 and 10 combined - 12: A full grid - 13: A 'T' - 14: A plus '+' - 15: A 'W' - 16: An 'M' - 17: An 'E' - 18: A '3' - 19: An 'O' - 20: An '8' - 21: An 'S' -Your choice => - -XXXXX - X - X - X - X - -Would you like to continue with the next generation? -Please use lowercase y or n for your answer [y]: - - -Would you like to choose a background pattern? -Please use lowercase y or n for your answer [n]: -Please chose a number: - 1: A cross - 2: A slash from the upper left to lower right - 3: A slash from the upper right to lower left - 4: An X - 5: A greater than sign - 6: A less than sign - 7: Two greater than signs - 8: Two less than signs - 9: A 'V' - 10: An inverse 'V' - 11: Numbers 9 and 10 combined - 12: A full grid - 13: A 'T' - 14: A plus '+' - 15: A 'W' - 16: An 'M' - 17: An 'E' - 18: A '3' - 19: An 'O' - 20: An '8' - 21: An 'S' -Your choice => - - X - X -XXXXX - X - X - -Would you like to continue with the next generation? -Please use lowercase y or n for your answer [y]: - - -Would you like to choose a background pattern? -Please use lowercase y or n for your answer [n]: -Please chose a number: - 1: A cross - 2: A slash from the upper left to lower right - 3: A slash from the upper right to lower left - 4: An X - 5: A greater than sign - 6: A less than sign - 7: Two greater than signs - 8: Two less than signs - 9: A 'V' - 10: An inverse 'V' - 11: Numbers 9 and 10 combined - 12: A full grid - 13: A 'T' - 14: A plus '+' - 15: A 'W' - 16: An 'M' - 17: An 'E' - 18: A '3' - 19: An 'O' - 20: An '8' - 21: An 'S' -Your choice => - -X X - X X X - X X - -Would you like to continue with the next generation? -Please use lowercase y or n for your answer [y]: - - -Would you like to choose a background pattern? -Please use lowercase y or n for your answer [n]: -Please chose a number: - 1: A cross - 2: A slash from the upper left to lower right - 3: A slash from the upper right to lower left - 4: An X - 5: A greater than sign - 6: A less than sign - 7: Two greater than signs - 8: Two less than signs - 9: A 'V' - 10: An inverse 'V' - 11: Numbers 9 and 10 combined - 12: A full grid - 13: A 'T' - 14: A plus '+' - 15: A 'W' - 16: An 'M' - 17: An 'E' - 18: A '3' - 19: An 'O' - 20: An '8' - 21: An 'S' -Your choice => - - X X - X X X -X X - -Would you like to continue with the next generation? -Please use lowercase y or n for your answer [y]: - - -Would you like to choose a background pattern? -Please use lowercase y or n for your answer [n]: -Please chose a number: - 1: A cross - 2: A slash from the upper left to lower right - 3: A slash from the upper right to lower left - 4: An X - 5: A greater than sign - 6: A less than sign - 7: Two greater than signs - 8: Two less than signs - 9: A 'V' - 10: An inverse 'V' - 11: Numbers 9 and 10 combined - 12: A full grid - 13: A 'T' - 14: A plus '+' - 15: A 'W' - 16: An 'M' - 17: An 'E' - 18: A '3' - 19: An 'O' - 20: An '8' - 21: An 'S' -Your choice => - -XXXX -X -X -XXXX -X -X -XXXX - -Would you like to continue with the next generation? -Please use lowercase y or n for your answer [y]: - - -Would you like to choose a background pattern? -Please use lowercase y or n for your answer [n]: -Please chose a number: - 1: A cross - 2: A slash from the upper left to lower right - 3: A slash from the upper right to lower left - 4: An X - 5: A greater than sign - 6: A less than sign - 7: Two greater than signs - 8: Two less than signs - 9: A 'V' - 10: An inverse 'V' - 11: Numbers 9 and 10 combined - 12: A full grid - 13: A 'T' - 14: A plus '+' - 15: A 'W' - 16: An 'M' - 17: An 'E' - 18: A '3' - 19: An 'O' - 20: An '8' - 21: An 'S' -Your choice => - -XXX - X - X - X - X - X -XXX - -Would you like to continue with the next generation? -Please use lowercase y or n for your answer [y]: - - -Would you like to choose a background pattern? -Please use lowercase y or n for your answer [n]: -Please chose a number: - 1: A cross - 2: A slash from the upper left to lower right - 3: A slash from the upper right to lower left - 4: An X - 5: A greater than sign - 6: A less than sign - 7: Two greater than signs - 8: Two less than signs - 9: A 'V' - 10: An inverse 'V' - 11: Numbers 9 and 10 combined - 12: A full grid - 13: A 'T' - 14: A plus '+' - 15: A 'W' - 16: An 'M' - 17: An 'E' - 18: A '3' - 19: An 'O' - 20: An '8' - 21: An 'S' -Your choice => - - XX -X X -X X - XX - -Would you like to continue with the next generation? -Please use lowercase y or n for your answer [y]: - - -Would you like to choose a background pattern? -Please use lowercase y or n for your answer [n]: -Please chose a number: - 1: A cross - 2: A slash from the upper left to lower right - 3: A slash from the upper right to lower left - 4: An X - 5: A greater than sign - 6: A less than sign - 7: Two greater than signs - 8: Two less than signs - 9: A 'V' - 10: An inverse 'V' - 11: Numbers 9 and 10 combined - 12: A full grid - 13: A 'T' - 14: A plus '+' - 15: A 'W' - 16: An 'M' - 17: An 'E' - 18: A '3' - 19: An 'O' - 20: An '8' - 21: An 'S' -Your choice => - - XX -X X -X X - XX -X X -X X - XX - -Would you like to continue with the next generation? -Please use lowercase y or n for your answer [y]: - - -Would you like to choose a background pattern? -Please use lowercase y or n for your answer [n]: -Please chose a number: - 1: A cross - 2: A slash from the upper left to lower right - 3: A slash from the upper right to lower left - 4: An X - 5: A greater than sign - 6: A less than sign - 7: Two greater than signs - 8: Two less than signs - 9: A 'V' - 10: An inverse 'V' - 11: Numbers 9 and 10 combined - 12: A full grid - 13: A 'T' - 14: A plus '+' - 15: A 'W' - 16: An 'M' - 17: An 'E' - 18: A '3' - 19: An 'O' - 20: An '8' - 21: An 'S' -Your choice => - - XXX -X -X - XX - X - X -XXX - -Would you like to continue with the next generation? -Please use lowercase y or n for your answer [y]: - --XX- -X-X- -X--- --XX- ----X --X-X --XX- - -Would you like to continue with the next generation? -Please use lowercase y or n for your answer [y]: - --XX- -X-X- -X-X- --XX- --X-X --X-X --XX- - -Would you like to continue with the next generation? -Please use lowercase y or n for your answer [y]: - - -Would you like to choose a background pattern? +Welcome to the Game of Life. +There are many initial states to choose from. + + +Would you like to choose a background pattern? +Please use lowercase y or n for your answer [n]: +Please chose a number: + 1: A cross + 2: A slash from the upper left to lower right + 3: A slash from the upper right to lower left + 4: An X + 5: A greater than sign + 6: A less than sign + 7: Two greater than signs + 8: Two less than signs + 9: A 'V' + 10: An inverse 'V' + 11: Numbers 9 and 10 combined + 12: A full grid + 13: A 'T' + 14: A plus '+' + 15: A 'W' + 16: An 'M' + 17: An 'E' + 18: A '3' + 19: An 'O' + 20: An '8' + 21: An 'S' +Your choice => + + XX +XXXX +XXXX + XX + +Would you like to continue with the next generation? +Please use lowercase y or n for your answer [y]: + + +Would you like to choose a background pattern? +Please use lowercase y or n for your answer [n]: +Please chose a number: + 1: A cross + 2: A slash from the upper left to lower right + 3: A slash from the upper right to lower left + 4: An X + 5: A greater than sign + 6: A less than sign + 7: Two greater than signs + 8: Two less than signs + 9: A 'V' + 10: An inverse 'V' + 11: Numbers 9 and 10 combined + 12: A full grid + 13: A 'T' + 14: A plus '+' + 15: A 'W' + 16: An 'M' + 17: An 'E' + 18: A '3' + 19: An 'O' + 20: An '8' + 21: An 'S' +Your choice => + + X + X + X + X +X + +Would you like to continue with the next generation? +Please use lowercase y or n for your answer [y]: + + +Would you like to choose a background pattern? +Please use lowercase y or n for your answer [n]: +Please chose a number: + 1: A cross + 2: A slash from the upper left to lower right + 3: A slash from the upper right to lower left + 4: An X + 5: A greater than sign + 6: A less than sign + 7: Two greater than signs + 8: Two less than signs + 9: A 'V' + 10: An inverse 'V' + 11: Numbers 9 and 10 combined + 12: A full grid + 13: A 'T' + 14: A plus '+' + 15: A 'W' + 16: An 'M' + 17: An 'E' + 18: A '3' + 19: An 'O' + 20: An '8' + 21: An 'S' +Your choice => + +X + X + X + X + X + +Would you like to continue with the next generation? +Please use lowercase y or n for your answer [y]: + + +Would you like to choose a background pattern? +Please use lowercase y or n for your answer [n]: +Please chose a number: + 1: A cross + 2: A slash from the upper left to lower right + 3: A slash from the upper right to lower left + 4: An X + 5: A greater than sign + 6: A less than sign + 7: Two greater than signs + 8: Two less than signs + 9: A 'V' + 10: An inverse 'V' + 11: Numbers 9 and 10 combined + 12: A full grid + 13: A 'T' + 14: A plus '+' + 15: A 'W' + 16: An 'M' + 17: An 'E' + 18: A '3' + 19: An 'O' + 20: An '8' + 21: An 'S' +Your choice => + +X X + X X + X + X X +X X + +Would you like to continue with the next generation? +Please use lowercase y or n for your answer [y]: + + +Would you like to choose a background pattern? +Please use lowercase y or n for your answer [n]: +Please chose a number: + 1: A cross + 2: A slash from the upper left to lower right + 3: A slash from the upper right to lower left + 4: An X + 5: A greater than sign + 6: A less than sign + 7: Two greater than signs + 8: Two less than signs + 9: A 'V' + 10: An inverse 'V' + 11: Numbers 9 and 10 combined + 12: A full grid + 13: A 'T' + 14: A plus '+' + 15: A 'W' + 16: An 'M' + 17: An 'E' + 18: A '3' + 19: An 'O' + 20: An '8' + 21: An 'S' +Your choice => + +X + X + X + X +X + +Would you like to continue with the next generation? +Please use lowercase y or n for your answer [y]: + + +Would you like to choose a background pattern? +Please use lowercase y or n for your answer [n]: +Please chose a number: + 1: A cross + 2: A slash from the upper left to lower right + 3: A slash from the upper right to lower left + 4: An X + 5: A greater than sign + 6: A less than sign + 7: Two greater than signs + 8: Two less than signs + 9: A 'V' + 10: An inverse 'V' + 11: Numbers 9 and 10 combined + 12: A full grid + 13: A 'T' + 14: A plus '+' + 15: A 'W' + 16: An 'M' + 17: An 'E' + 18: A '3' + 19: An 'O' + 20: An '8' + 21: An 'S' +Your choice => + + X + X + X + X + X + +Would you like to continue with the next generation? +Please use lowercase y or n for your answer [y]: + + +Would you like to choose a background pattern? +Please use lowercase y or n for your answer [n]: +Please chose a number: + 1: A cross + 2: A slash from the upper left to lower right + 3: A slash from the upper right to lower left + 4: An X + 5: A greater than sign + 6: A less than sign + 7: Two greater than signs + 8: Two less than signs + 9: A 'V' + 10: An inverse 'V' + 11: Numbers 9 and 10 combined + 12: A full grid + 13: A 'T' + 14: A plus '+' + 15: A 'W' + 16: An 'M' + 17: An 'E' + 18: A '3' + 19: An 'O' + 20: An '8' + 21: An 'S' +Your choice => + +X X + X X +X X + + +Would you like to continue with the next generation? +Please use lowercase y or n for your answer [y]: + + +Would you like to choose a background pattern? +Please use lowercase y or n for your answer [n]: +Please chose a number: + 1: A cross + 2: A slash from the upper left to lower right + 3: A slash from the upper right to lower left + 4: An X + 5: A greater than sign + 6: A less than sign + 7: Two greater than signs + 8: Two less than signs + 9: A 'V' + 10: An inverse 'V' + 11: Numbers 9 and 10 combined + 12: A full grid + 13: A 'T' + 14: A plus '+' + 15: A 'W' + 16: An 'M' + 17: An 'E' + 18: A '3' + 19: An 'O' + 20: An '8' + 21: An 'S' +Your choice => + + X X +X X + X X + + +Would you like to continue with the next generation? +Please use lowercase y or n for your answer [y]: + + +Would you like to choose a background pattern? +Please use lowercase y or n for your answer [n]: +Please chose a number: + 1: A cross + 2: A slash from the upper left to lower right + 3: A slash from the upper right to lower left + 4: An X + 5: A greater than sign + 6: A less than sign + 7: Two greater than signs + 8: Two less than signs + 9: A 'V' + 10: An inverse 'V' + 11: Numbers 9 and 10 combined + 12: A full grid + 13: A 'T' + 14: A plus '+' + 15: A 'W' + 16: An 'M' + 17: An 'E' + 18: A '3' + 19: An 'O' + 20: An '8' + 21: An 'S' +Your choice => + +X X + X X + X + +Would you like to continue with the next generation? +Please use lowercase y or n for your answer [y]: + + +Would you like to choose a background pattern? +Please use lowercase y or n for your answer [n]: +Please chose a number: + 1: A cross + 2: A slash from the upper left to lower right + 3: A slash from the upper right to lower left + 4: An X + 5: A greater than sign + 6: A less than sign + 7: Two greater than signs + 8: Two less than signs + 9: A 'V' + 10: An inverse 'V' + 11: Numbers 9 and 10 combined + 12: A full grid + 13: A 'T' + 14: A plus '+' + 15: A 'W' + 16: An 'M' + 17: An 'E' + 18: A '3' + 19: An 'O' + 20: An '8' + 21: An 'S' +Your choice => + + X + X X +X X + +Would you like to continue with the next generation? +Please use lowercase y or n for your answer [y]: + + +Would you like to choose a background pattern? +Please use lowercase y or n for your answer [n]: +Please chose a number: + 1: A cross + 2: A slash from the upper left to lower right + 3: A slash from the upper right to lower left + 4: An X + 5: A greater than sign + 6: A less than sign + 7: Two greater than signs + 8: Two less than signs + 9: A 'V' + 10: An inverse 'V' + 11: Numbers 9 and 10 combined + 12: A full grid + 13: A 'T' + 14: A plus '+' + 15: A 'W' + 16: An 'M' + 17: An 'E' + 18: A '3' + 19: An 'O' + 20: An '8' + 21: An 'S' +Your choice => + +X X X + X X +X X X + +Would you like to continue with the next generation? +Please use lowercase y or n for your answer [y]: + + +Would you like to choose a background pattern? +Please use lowercase y or n for your answer [n]: +Please chose a number: + 1: A cross + 2: A slash from the upper left to lower right + 3: A slash from the upper right to lower left + 4: An X + 5: A greater than sign + 6: A less than sign + 7: Two greater than signs + 8: Two less than signs + 9: A 'V' + 10: An inverse 'V' + 11: Numbers 9 and 10 combined + 12: A full grid + 13: A 'T' + 14: A plus '+' + 15: A 'W' + 16: An 'M' + 17: An 'E' + 18: A '3' + 19: An 'O' + 20: An '8' + 21: An 'S' +Your choice => + +XXXXX +XXXXX +XXXXX +XXXXX +XXXXX + +Would you like to continue with the next generation? +Please use lowercase y or n for your answer [y]: + + +Would you like to choose a background pattern? +Please use lowercase y or n for your answer [n]: +Please chose a number: + 1: A cross + 2: A slash from the upper left to lower right + 3: A slash from the upper right to lower left + 4: An X + 5: A greater than sign + 6: A less than sign + 7: Two greater than signs + 8: Two less than signs + 9: A 'V' + 10: An inverse 'V' + 11: Numbers 9 and 10 combined + 12: A full grid + 13: A 'T' + 14: A plus '+' + 15: A 'W' + 16: An 'M' + 17: An 'E' + 18: A '3' + 19: An 'O' + 20: An '8' + 21: An 'S' +Your choice => + +XXXXX + X + X + X + X + +Would you like to continue with the next generation? +Please use lowercase y or n for your answer [y]: + + +Would you like to choose a background pattern? +Please use lowercase y or n for your answer [n]: +Please chose a number: + 1: A cross + 2: A slash from the upper left to lower right + 3: A slash from the upper right to lower left + 4: An X + 5: A greater than sign + 6: A less than sign + 7: Two greater than signs + 8: Two less than signs + 9: A 'V' + 10: An inverse 'V' + 11: Numbers 9 and 10 combined + 12: A full grid + 13: A 'T' + 14: A plus '+' + 15: A 'W' + 16: An 'M' + 17: An 'E' + 18: A '3' + 19: An 'O' + 20: An '8' + 21: An 'S' +Your choice => + + X + X +XXXXX + X + X + +Would you like to continue with the next generation? +Please use lowercase y or n for your answer [y]: + + +Would you like to choose a background pattern? +Please use lowercase y or n for your answer [n]: +Please chose a number: + 1: A cross + 2: A slash from the upper left to lower right + 3: A slash from the upper right to lower left + 4: An X + 5: A greater than sign + 6: A less than sign + 7: Two greater than signs + 8: Two less than signs + 9: A 'V' + 10: An inverse 'V' + 11: Numbers 9 and 10 combined + 12: A full grid + 13: A 'T' + 14: A plus '+' + 15: A 'W' + 16: An 'M' + 17: An 'E' + 18: A '3' + 19: An 'O' + 20: An '8' + 21: An 'S' +Your choice => + +X X + X X X + X X + +Would you like to continue with the next generation? +Please use lowercase y or n for your answer [y]: + + +Would you like to choose a background pattern? +Please use lowercase y or n for your answer [n]: +Please chose a number: + 1: A cross + 2: A slash from the upper left to lower right + 3: A slash from the upper right to lower left + 4: An X + 5: A greater than sign + 6: A less than sign + 7: Two greater than signs + 8: Two less than signs + 9: A 'V' + 10: An inverse 'V' + 11: Numbers 9 and 10 combined + 12: A full grid + 13: A 'T' + 14: A plus '+' + 15: A 'W' + 16: An 'M' + 17: An 'E' + 18: A '3' + 19: An 'O' + 20: An '8' + 21: An 'S' +Your choice => + + X X + X X X +X X + +Would you like to continue with the next generation? +Please use lowercase y or n for your answer [y]: + + +Would you like to choose a background pattern? +Please use lowercase y or n for your answer [n]: +Please chose a number: + 1: A cross + 2: A slash from the upper left to lower right + 3: A slash from the upper right to lower left + 4: An X + 5: A greater than sign + 6: A less than sign + 7: Two greater than signs + 8: Two less than signs + 9: A 'V' + 10: An inverse 'V' + 11: Numbers 9 and 10 combined + 12: A full grid + 13: A 'T' + 14: A plus '+' + 15: A 'W' + 16: An 'M' + 17: An 'E' + 18: A '3' + 19: An 'O' + 20: An '8' + 21: An 'S' +Your choice => + +XXXX +X +X +XXXX +X +X +XXXX + +Would you like to continue with the next generation? +Please use lowercase y or n for your answer [y]: + + +Would you like to choose a background pattern? +Please use lowercase y or n for your answer [n]: +Please chose a number: + 1: A cross + 2: A slash from the upper left to lower right + 3: A slash from the upper right to lower left + 4: An X + 5: A greater than sign + 6: A less than sign + 7: Two greater than signs + 8: Two less than signs + 9: A 'V' + 10: An inverse 'V' + 11: Numbers 9 and 10 combined + 12: A full grid + 13: A 'T' + 14: A plus '+' + 15: A 'W' + 16: An 'M' + 17: An 'E' + 18: A '3' + 19: An 'O' + 20: An '8' + 21: An 'S' +Your choice => + +XXX + X + X + X + X + X +XXX + +Would you like to continue with the next generation? +Please use lowercase y or n for your answer [y]: + + +Would you like to choose a background pattern? +Please use lowercase y or n for your answer [n]: +Please chose a number: + 1: A cross + 2: A slash from the upper left to lower right + 3: A slash from the upper right to lower left + 4: An X + 5: A greater than sign + 6: A less than sign + 7: Two greater than signs + 8: Two less than signs + 9: A 'V' + 10: An inverse 'V' + 11: Numbers 9 and 10 combined + 12: A full grid + 13: A 'T' + 14: A plus '+' + 15: A 'W' + 16: An 'M' + 17: An 'E' + 18: A '3' + 19: An 'O' + 20: An '8' + 21: An 'S' +Your choice => + + XX +X X +X X + XX + +Would you like to continue with the next generation? +Please use lowercase y or n for your answer [y]: + + +Would you like to choose a background pattern? +Please use lowercase y or n for your answer [n]: +Please chose a number: + 1: A cross + 2: A slash from the upper left to lower right + 3: A slash from the upper right to lower left + 4: An X + 5: A greater than sign + 6: A less than sign + 7: Two greater than signs + 8: Two less than signs + 9: A 'V' + 10: An inverse 'V' + 11: Numbers 9 and 10 combined + 12: A full grid + 13: A 'T' + 14: A plus '+' + 15: A 'W' + 16: An 'M' + 17: An 'E' + 18: A '3' + 19: An 'O' + 20: An '8' + 21: An 'S' +Your choice => + + XX +X X +X X + XX +X X +X X + XX + +Would you like to continue with the next generation? +Please use lowercase y or n for your answer [y]: + + +Would you like to choose a background pattern? +Please use lowercase y or n for your answer [n]: +Please chose a number: + 1: A cross + 2: A slash from the upper left to lower right + 3: A slash from the upper right to lower left + 4: An X + 5: A greater than sign + 6: A less than sign + 7: Two greater than signs + 8: Two less than signs + 9: A 'V' + 10: An inverse 'V' + 11: Numbers 9 and 10 combined + 12: A full grid + 13: A 'T' + 14: A plus '+' + 15: A 'W' + 16: An 'M' + 17: An 'E' + 18: A '3' + 19: An 'O' + 20: An '8' + 21: An 'S' +Your choice => + + XXX +X +X + XX + X + X +XXX + +Would you like to continue with the next generation? +Please use lowercase y or n for your answer [y]: + +-XX- +X-X- +X--- +-XX- +---X +-X-X +-XX- + +Would you like to continue with the next generation? +Please use lowercase y or n for your answer [y]: + +-XX- +X-X- +X-X- +-XX- +-X-X +-X-X +-XX- + +Would you like to continue with the next generation? +Please use lowercase y or n for your answer [y]: + + +Would you like to choose a background pattern? Please use lowercase y or n for your answer [n]: \ No newline at end of file diff --git a/tests/codegen/list.mips b/tests/codegen/list.mips new file mode 100644 index 000000000..6ab00bdea --- /dev/null +++ b/tests/codegen/list.mips @@ -0,0 +1,3200 @@ +.data + type_Object: .word 24 + type_Object_inherits_from: .word 0 + type_Object_name_address: .word type_Object_name_size + type_Object___init__: .word function___init___at_Object + type_Object_abort: .word function_abort_at_Object + type_Object_type_name: .word function_type_name_at_Object + type_Object_copy: .word function_copy_at_Object + + type_IO: .word 40 + type_IO_inherits_from: .word type_Object + type_IO_name_address: .word type_IO_name_size + type_IO___init__: .word function___init___at_IO + type_IO_abort: .word function_abort_at_Object + type_IO_type_name: .word function_type_name_at_Object + type_IO_copy: .word function_copy_at_Object + type_IO_out_string: .word function_out_string_at_IO + type_IO_out_int: .word function_out_int_at_IO + type_IO_in_string: .word function_in_string_at_IO + type_IO_in_int: .word function_in_int_at_IO + + type_String: .word 36 + type_String_inherits_from: .word type_Object + type_String_name_address: .word type_String_name_size + type_String___init__: .word function___init___at_String + type_String_abort: .word function_abort_at_Object + type_String_type_name: .word function_type_name_at_Object + type_String_copy: .word function_copy_at_Object + type_String_length: .word function_length_at_String + type_String_concat: .word function_concat_at_String + type_String_substr: .word function_substr_at_String + + type_Int: .word 24 + type_Int_inherits_from: .word type_Object + type_Int_name_address: .word type_Int_name_size + type_Int___init__: .word function___init___at_Int + type_Int_abort: .word function_abort_at_Object + type_Int_type_name: .word function_type_name_at_Object + type_Int_copy: .word function_copy_at_Object + + type_Bool: .word 24 + type_Bool_inherits_from: .word type_Object + type_Bool_name_address: .word type_Bool_name_size + type_Bool___init__: .word function___init___at_Bool + type_Bool_abort: .word function_abort_at_Object + type_Bool_type_name: .word function_type_name_at_Object + type_Bool_copy: .word function_copy_at_Object + + type_List: .word 40 + type_List_inherits_from: .word type_Object + type_List_name_address: .word type_List_name_size + type_List___init__: .word function___init___at_List + type_List_abort: .word function_abort_at_Object + type_List_type_name: .word function_type_name_at_Object + type_List_copy: .word function_copy_at_Object + type_List_isNil: .word function_isNil_at_List + type_List_head: .word function_head_at_List + type_List_tail: .word function_tail_at_List + type_List_cons: .word function_cons_at_List + + type_Cons: .word 52 + type_Cons_inherits_from: .word type_List + type_Cons_name_address: .word type_Cons_name_size + type_Cons___init__: .word function___init___at_Cons + type_Cons_abort: .word function_abort_at_Object + type_Cons_type_name: .word function_type_name_at_Object + type_Cons_copy: .word function_copy_at_Object + type_Cons_isNil: .word function_isNil_at_Cons + type_Cons_head: .word function_head_at_Cons + type_Cons_tail: .word function_tail_at_Cons + type_Cons_cons: .word function_cons_at_List + type_Cons_init: .word function_init_at_Cons + + type_Main: .word 52 + type_Main_inherits_from: .word type_IO + type_Main_name_address: .word type_Main_name_size + type_Main___init__: .word function___init___at_Main + type_Main_abort: .word function_abort_at_Object + type_Main_type_name: .word function_type_name_at_Object + type_Main_copy: .word function_copy_at_Object + type_Main_out_string: .word function_out_string_at_IO + type_Main_out_int: .word function_out_int_at_IO + type_Main_in_string: .word function_in_string_at_IO + type_Main_in_int: .word function_in_int_at_IO + type_Main_print_list: .word function_print_list_at_Main + type_Main_main: .word function_main_at_Main + + type_Object_name_size: .word 6 + type_Object_name: .asciiz "Object" + + type_IO_name_size: .word 2 + type_IO_name: .asciiz "IO" + + type_String_name_size: .word 6 + type_String_name: .asciiz "String" + + type_Int_name_size: .word 3 + type_Int_name: .asciiz "Int" + + type_Bool_name_size: .word 4 + type_Bool_name: .asciiz "Bool" + + type_List_name_size: .word 4 + type_List_name: .asciiz "List" + + type_Cons_name_size: .word 4 + type_Cons_name: .asciiz "Cons" + + type_Main_name_size: .word 4 + type_Main_name: .asciiz "Main" + + buffer_input: .space 1024 + debug_log: .asciiz "debug_log\n" + +.text + function_add: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Addition operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + add $t2, $t0, $t1 # $t2 = $t0 + $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_sub: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Subtraction operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sub $t2, $t0, $t1 # $t2 = $t0 - $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_mult: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Multiplication operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + mult $t0, $t1 # $t2 = $t0 * $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_div: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Division operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + div $t0, $t1 # $t2 = $t0 / $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_xor: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Xor operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than_or_equal: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sle $t2, $t0, $t1 # $t2 = $t0 <= $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_equal: + # Function parameters + # $ra = 48($sp) + # a = 44($sp) + # b = 40($sp) + + # Reserving space for local variables + addi $sp, $sp, -40 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_0 = address of allocated object Int + + # Allocating NUll to internal_1 + sw $zero, 32($sp) # internal_1 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_2 = address of allocated object Int + + # internal_2 = EqualAddress(a, internal_1) + lw $t0, 44($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # internal_2 = EqualAddress(b, internal_1) + lw $t0, 40($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # If internal_2 then goto a_is_type_object + lw $t0, 28($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_object + + # internal_3 = typeof a that is the first word of the object + lw $t0, 44($sp) + lw $t0, 0($t0) + sw $t0, 24($sp) + + # internal_4 = direction of Int + la $t0, type_Int + sw $t0, 20($sp) + + # internal_5 = direction of Bool + la $t0, type_Bool + sw $t0, 16($sp) + + # internal_6 = direction of String + la $t0, type_String + sw $t0, 12($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_7 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_8 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_9 = address of allocated object Int + + # internal_7 = EqualAddress(internal_3, internal_4) + lw $t0, 24($sp) + lw $t1, 20($sp) + seq $t2, $t0, $t1 + lw $t0, 8($sp) + sw $t2, 8($t0) + + # internal_8 = EqualAddress(internal_3, internal_5) + lw $t0, 24($sp) + lw $t1, 16($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_9 = EqualAddress(internal_3, internal_6) + lw $t0, 24($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_7 then goto a_is_type_int_or_bool + lw $t0, 8($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_8 then goto a_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_9 then goto a_is_type_string + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_string + + # Jumping to a_is_type_object + j a_is_type_object + + a_is_type_int_or_bool: + + # internal_0 = EqualInt(a, b) + lw $t0, 44($sp) + lw $t0, 8($t0) + lw $t1, 40($sp) + lw $t1, 8($t1) + seq $t2, $t0, $t1 + lw $t0, 36($sp) + sw $t2, 8($t0) + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_string: + + # internal_0 = EqualStr(a, b) + lw $t0, 44($sp) + lw $t1, 40($sp) + addi $t0, $t0, 8 + addi $t1, $t1, 8 + + # By default we assume the strings are equals + addi $t4, $zero, 1 + lw $t5, 36($sp) + sw $t4, 8($t5) + + while_compare_strings_start: + lb $t2, 0($t0) + lb $t3, 0($t1) + beq $t2, $t3, while_compare_strings_update + + # The strings are no equals + lw $t5, 36($sp) + sw $zero, 8($t5) + j while_compare_strings_end + + while_compare_strings_update: + addi $t0, $t0, 1 + addi $t1, $t1, 1 + beq $t2, $zero, while_compare_strings_end + beq $t3, $zero, while_compare_strings_end + j while_compare_strings_start + while_compare_strings_end: + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_object: + + # Equal operation + lw $t0, 44($sp) # Save in $t0 the left operand address + lw $t1, 40($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 36($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Jumping to end_of_equal + j end_of_equal + + end_of_equal: + + # Loading return value in $v1 + lw $v1, 36($sp) + + # Freeing space for local variables + addi $sp, $sp, 40 + + jr $ra + + function_assign: + # Function parameters + # $ra = 36($sp) + # dest = 32($sp) + # source = 28($sp) + + # Reserving space for local variables + addi $sp, $sp, -28 + + # Allocating NUll to internal_0 + sw $zero, 24($sp) # internal_0 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_1 = address of allocated object Int + + # internal_1 = EqualAddress(source, internal_0) + lw $t0, 28($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # internal_1 = EqualAddress(dest, internal_0) + lw $t0, 32($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # If internal_1 then goto source_is_type_object + lw $t0, 20($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_object + + # internal_2 = typeof source that is the first word of the object + lw $t0, 28($sp) + lw $t0, 0($t0) + sw $t0, 16($sp) + + # internal_3 = direction of Int + la $t0, type_Int + sw $t0, 12($sp) + + # internal_4 = direction of Bool + la $t0, type_Bool + sw $t0, 8($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_5 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_6 = address of allocated object Int + + # internal_5 = EqualAddress(internal_2, internal_3) + lw $t0, 16($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_6 = EqualAddress(internal_2, internal_4) + lw $t0, 16($sp) + lw $t1, 8($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_5 then goto source_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # If internal_6 then goto source_is_type_int_or_bool + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # Jumping to source_is_type_object + j source_is_type_object + + source_is_type_int_or_bool: + + # dest = source where source is an integer + li $v0, 9 + addi $a0, $zero, 12 + syscall + lw $t0, 28($sp) # Pointer to source + lw $t1, 0($t0) # $t1 = type of source + lw $t2, 8($t0) # $t2 = value of source + sw $t1, 0($v0) # Save type of dest + sw $a0, 4($v0) # Save size of dest + sw $t2, 8($v0) # Save value of dest + sw $v0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_is_type_object: + + # dest = source + lw $t0, 28($sp) + sw $t0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_end_of_equal: + + # Loading return value in $v1 + lw $v1, 32($sp) + + # Freeing space for local variables + addi $sp, $sp, 28 + + jr $ra + + function___init___at_Object: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_abort_at_Object: + # Function parameters + # $ra = 28($sp) + # self = 24($sp) + + # Reserving space for local variables + addi $sp, $sp, -24 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 33 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 33 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 65 + sb $t0, 8($v0) # internal_0[0] = 'A' + + addi $t0, $zero, 98 + sb $t0, 9($v0) # internal_0[1] = 'b' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_0[2] = 'o' + + addi $t0, $zero, 114 + sb $t0, 11($v0) # internal_0[3] = 'r' + + addi $t0, $zero, 116 + sb $t0, 12($v0) # internal_0[4] = 't' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_0[5] = ' ' + + addi $t0, $zero, 99 + sb $t0, 14($v0) # internal_0[6] = 'c' + + addi $t0, $zero, 97 + sb $t0, 15($v0) # internal_0[7] = 'a' + + addi $t0, $zero, 108 + sb $t0, 16($v0) # internal_0[8] = 'l' + + addi $t0, $zero, 108 + sb $t0, 17($v0) # internal_0[9] = 'l' + + addi $t0, $zero, 101 + sb $t0, 18($v0) # internal_0[10] = 'e' + + addi $t0, $zero, 100 + sb $t0, 19($v0) # internal_0[11] = 'd' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_0[12] = ' ' + + addi $t0, $zero, 102 + sb $t0, 21($v0) # internal_0[13] = 'f' + + addi $t0, $zero, 114 + sb $t0, 22($v0) # internal_0[14] = 'r' + + addi $t0, $zero, 111 + sb $t0, 23($v0) # internal_0[15] = 'o' + + addi $t0, $zero, 109 + sb $t0, 24($v0) # internal_0[16] = 'm' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_0[17] = ' ' + + addi $t0, $zero, 99 + sb $t0, 26($v0) # internal_0[18] = 'c' + + addi $t0, $zero, 108 + sb $t0, 27($v0) # internal_0[19] = 'l' + + addi $t0, $zero, 97 + sb $t0, 28($v0) # internal_0[20] = 'a' + + addi $t0, $zero, 115 + sb $t0, 29($v0) # internal_0[21] = 's' + + addi $t0, $zero, 115 + sb $t0, 30($v0) # internal_0[22] = 's' + + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_0[23] = ' ' + + sb $zero, 32($v0) # Null-terminator at the end of the string + + sw $v0, 20($sp) # internal_0 = "Abort called from class " + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_3[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 8($sp) # internal_3 = "\n" + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method type_name of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_5 + lw $t0, 8($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 24($sp) # internal_1 = result of internal_5 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_1 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_2 = result of internal_5 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_3 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_2 = result of internal_5 + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 12($sp) # $t0 = internal_2 + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the String internal_2 + li $v0, 4 + move $a0, $t0 + syscall + + # Exit program + li $v0, 10 + syscall + + # Loading return value in $v1 + lw $v1, 24($sp) + + # Freeing space for local variables + addi $sp, $sp, 24 + + jr $ra + + function_type_name_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = name of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 8($t1) # $t2 = direction of the type name + la $t3, 4($t2) # $t3 = address of the name + lw $t2, 0($t2) # $t2 = length of the name + + addi $t2, $t2, 9 # Setting space for the type, the size and the null byte + li $v0, 9 + move $a0, $t2 + syscall + addi $t2, $t2, -9 # Restoring space for the type, the size and the null byte + + la $t4, type_String + sw $t4, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t4, $v0, 0 # $t4 = direction of the new string + addi $t4, $t4, 8 # Pointer to the first character of the string + xor $t5, $t5, $t5 # Initializing counter + while_copy_name_start: + beq $t5, $t2, while_copy_name_end + lb $t6, 0($t3) # Loading the character + sb $t6, 0($t4) + addi $t4, $t4, 1 # Incrementing the pointer to the new string + addi $t3, $t3, 1 # Incrementing the pointer to the string in self + addi $t5, $t5, 1 # Incrementing counter + j while_copy_name_start + while_copy_name_end: + + sb $zero, 0($t4) # Setting the null byte + + sw $v0, 0($sp) # Storing the new string in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_copy_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = copy of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 4($t0) # $t2 = length of self in bytes + + # Allocating space for the new object + li $v0, 9 + move $a0, $t2 + syscall + move $t3, $v0 # $t3 = direction of the new object + sw $t1, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + # Initializing the variable of the loop + addi $t0, $t0, 8 # Pointer to the first character of the object + addi $t3, $t3, 8 # Pointer to the first character of the object + addi $t2, $2, -8 # Decrementing in 8 the length of the object + xor $t4, $t4, $t4 # Initializing counter + + # Loop copying the object + while_copy_start: + beq $t4, $t2, while_copy_end + lb $t5, 0($t0) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t0, $t0, 1 # Incrementing the pointer to the object + addi $t3, $t3, 1 # Incrementing the pointer to the new object + addi $t4, $t4, 1 # Incrementing counter + j while_copy_start + while_copy_end: + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_IO: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_out_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + lw $t0, 0($sp) # $t0 = x + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the String x + li $v0, 4 + move $a0, $t0 + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_out_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + # Printing the Int x + li $v0, 1 + lw $a0, 0($sp) + lw $a0, 8($a0) + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_in_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + li $v0, 8 + la $a0, buffer_input + li $a1, 1024 + syscall + + xor $t0, $t0, $t0 # Initializing counter + while_read_start: + lb $t1, buffer_input($t0) # Loading the byte + addi $t2, $zero, 10 + beq $t1, $t2, while_read_end + addi $t2, $zero, 13 + beq $t1, $t2, while_read_end + addi $t0, $t0, 1 # Incrementing counter + j while_read_start + while_read_end: + + addi $t0, $t0, 9 # Adding space for the type, the size and the null byte + li $v0, 9 + move $a0, $t0 + syscall + addi $t0, $t0, -9 # Adding space for the type, the size and the null byte + la $t2, type_String + sw $t2, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t3, $v0, 8 # Pointer to the first character of the string + xor $t4, $t4, $t4 # Initializing counter + + while_copy_from_buffer_start: + beq $t4, $t0, while_copy_from_buffer_end + lb $t5, buffer_input($t4) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t3, $t3, 1 # Imcremeenting pointer + addi $t4, $t4, 1 # Incrementing counter + j while_copy_from_buffer_start + while_copy_from_buffer_end: + + sb $zero, 0($t3) # Storing the null byte + + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_in_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + li $v0, 5 + syscall + lw $t0, 0($sp) + sw $v0, 8($t0) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_String: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_length_at_String: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # internal_0 = length of self + lw $t0, 4($sp) + lw $t1, 4($t0) + addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator + lw $t0, 0($sp) + sw $t1, 8($t0) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_concat_at_String: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + # s = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self + s + lw $t0, 8($sp) + lw $t1, 4($sp) + lw $t2, 4($t0) # $t2 = length of str1 + lw $t3, 4($t1) # $t3 = length of str2 + addi $t2, $t2, -9 + addi $t3, $t3, -9 + add $t4, $t2, $t3 # $t4 = length of str1 + str2 + addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) + + li $v0, 9 + move $a0, $t4 + syscall + addi $t4, $t4, -9 # Restoring $t4 = length of str1 + str2 + add $t5, $zero, $v0 # $t5 = address of the new string object + addi $t5, $t5, 8 # $t5 = address of the first byte of the new string + + la $t8, type_String + sw $t8, 0($v0) # Setting type in the first word of th object + + sw $a0, 4($v0) # Setting length of the string in the second word of the object + + # Copying str1 to the new string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_str1_start: + beq $t6, $t2, while_copy_str1_end + lb $t7, 8($t0) + sb $t7, 0($t5) + add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str1_start + while_copy_str1_end: + + # Copying str2 to the new string + while_copy_str2_start: + beq $t6, $t4, while_copy_str2_end + lb $t7, 8($t1) + sb $t7, 0($t5) + add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str2_start + while_copy_str2_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self + s + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_substr_at_String: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + # i = 8($sp) + # l = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self[i:i + l] + lw $t0, 12($sp) # $t0 = address of the string + lw $t1, 4($t0) # $t1 = length of the string + addi $t1, $t1, -9 # $t1 = length of the string + 9 + lw $t2, 8($sp) # $t2 = start of the substring + lw $t2, 8($t2) + lw $t3, 4($sp) # $t3 = length of the substring + lw $t3, 8($t3) + add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring + + bgt $t4, $t1, substring_out_of_bounds + + addi $t3, $t3, 9 + li $v0, 9 + move $a0, $t3 + syscall + addi $t3, $t3, -9 + + la $t5, type_String + sw $t5, 0($v0) # Setting type in the first word of the object + + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t0, $t0, 8 # pointing to the first byte of the string + add $t0, $t0, $t2 # pointing to the first byte of the substring + move $t5, $v0 # $t5 = address of the new string + add $t5, $t5, 8 # pointing to the first byte of the string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_substr_start: + beq $t6, $t3, while_copy_substr_end + lb $t7, 0($t0) + sb $t7, 0($t5) + addi $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of the string + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_substr_start + while_copy_substr_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self[i:i + l] + j substring_not_out_of_bounds + + substring_out_of_bounds: + li $v0, 17 + addi $a0, $zero, 1 + syscall + + substring_not_out_of_bounds: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_Int: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function___init___at_Bool: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function___init___at_List: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_isNil_at_List: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_head_at_List: + # Function parameters + # $ra = 20($sp) + # self = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_1 = address of allocated object Int + + # Get method abort of List + lw $t0, 16($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 8($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 4($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_2 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_0 = result of internal_2 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_3 = address of allocated object Int + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 + + jr $ra + + function_tail_at_List: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + + # Reserving space for local variables + addi $sp, $sp, -12 + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_1 = address of allocated object Int + + # Get method abort of List + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_2 + lw $t0, 8($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_0 = result of internal_2 + addi $sp, $sp, 8 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 12($sp) + + # Freeing space for local variables + addi $sp, $sp, 12 + + jr $ra + + function_cons_at_List: + # Function parameters + # $ra = 24($sp) + # self = 20($sp) + # i = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Allocating Cons + li $v0, 9 + lw $a0, type_Cons + syscall + la $t0, type_Cons # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 12($sp) # internal_0 = address of allocated object Cons + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_Cons + jal function___init___at_Cons + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_0 = result of function___init___at_Cons + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_2 = address of allocated object Int + + # Get method init of Cons + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument internal_0 + lw $t0, 28($sp) + sw $t0, 8($sp) # Storing internal_0 + + # Argument i + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing i + + # Argument self + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_3 + lw $t0, 16($sp) + jalr $t0 + lw $ra, 12($sp) + sw $v1, 24($sp) # internal_1 = result of internal_3 + addi $sp, $sp, 16 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 + + jr $ra + + function___init___at_Cons: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + + # Reserving space for local variables + addi $sp, $sp, -8 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_0 = address of allocated object Int + + # Set attribute car of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 4($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8747373028931 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8747373028931 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8747373028931 + j object_set_attribute_8747373028931 + int_set_attribute_8747373028931: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.car = internal_0 + j end_set_attribute_8747373028931 + bool_set_attribute_8747373028931: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.car = internal_0 + j end_set_attribute_8747373028931 + object_set_attribute_8747373028931: + sw $t1, 8($t0) # self.car = internal_0 + end_set_attribute_8747373028931: + + # Allocating NUll to internal_1 + sw $zero, 0($sp) # internal_1 = 0 + + # Set attribute cdr of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_1 + beq $t1, $zero, object_set_attribute_8747373028952 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8747373028952 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8747373028952 + j object_set_attribute_8747373028952 + int_set_attribute_8747373028952: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.cdr = internal_1 + j end_set_attribute_8747373028952 + bool_set_attribute_8747373028952: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.cdr = internal_1 + j end_set_attribute_8747373028952 + object_set_attribute_8747373028952: + sw $t1, 12($t0) # self.cdr = internal_1 + end_set_attribute_8747373028952: + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 8 + + jr $ra + + function_isNil_at_Cons: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_head_at_Cons: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Get attribute car of self + lw $t0, 4($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'car' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8747373029006 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8747373029006 + j object_get_attribute_8747373029006 + int_get_attribute_8747373029006: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_0 = self.car + j end_get_attribute_8747373029006 + bool_get_attribute_8747373029006: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_0 = self.car + j end_get_attribute_8747373029006 + object_get_attribute_8747373029006: + sw $t1, 0($sp) # internal_0 = self.car + end_get_attribute_8747373029006: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_tail_at_Cons: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Get attribute cdr of self + lw $t0, 4($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'cdr' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8747373029036 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8747373029036 + j object_get_attribute_8747373029036 + int_get_attribute_8747373029036: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_0 = self.cdr + j end_get_attribute_8747373029036 + bool_get_attribute_8747373029036: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_0 = self.cdr + j end_get_attribute_8747373029036 + object_get_attribute_8747373029036: + sw $t1, 0($sp) # internal_0 = self.cdr + end_get_attribute_8747373029036: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_init_at_Cons: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + # i = 4($sp) + # rest = 0($sp) + + # Set attribute car of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 4($sp) # $t1 = i + beq $t1, $zero, object_set_attribute_8747373029093 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8747373029093 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8747373029093 + j object_set_attribute_8747373029093 + int_set_attribute_8747373029093: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.car = i + j end_set_attribute_8747373029093 + bool_set_attribute_8747373029093: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.car = i + j end_set_attribute_8747373029093 + object_set_attribute_8747373029093: + sw $t1, 8($t0) # self.car = i + end_set_attribute_8747373029093: + + # Set attribute cdr of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = rest + beq $t1, $zero, object_set_attribute_8747373029102 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8747373029102 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8747373029102 + j object_set_attribute_8747373029102 + int_set_attribute_8747373029102: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.cdr = rest + j end_set_attribute_8747373029102 + bool_set_attribute_8747373029102: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.cdr = rest + j end_set_attribute_8747373029102 + object_set_attribute_8747373029102: + sw $t1, 12($t0) # self.cdr = rest + end_set_attribute_8747373029102: + + # Loading return value in $v1 + lw $v1, 8($sp) + + jr $ra + + function___init___at_Main: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating NUll to internal_0 + sw $zero, 0($sp) # internal_0 = 0 + + # Set attribute mylist of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8747373029907 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8747373029907 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8747373029907 + j object_set_attribute_8747373029907 + int_set_attribute_8747373029907: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.mylist = internal_0 + j end_set_attribute_8747373029907 + bool_set_attribute_8747373029907: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.mylist = internal_0 + j end_set_attribute_8747373029907 + object_set_attribute_8747373029907: + sw $t1, 8($t0) # self.mylist = internal_0 + end_set_attribute_8747373029907: + + # Loading return value in $v1 + lw $v1, 4($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_print_list_at_Main: + # Function parameters + # $ra = 108($sp) + # self = 104($sp) + # l = 100($sp) + + # Reserving space for local variables + addi $sp, $sp, -100 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 92($sp) # internal_1 = address of allocated object Int + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 84($sp) # internal_3 = address of allocated object Int + + # Get method isNil of List + lw $t0, 100($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 84($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 80($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument l + lw $t0, 108($sp) + sw $t0, 0($sp) # Storing l + + # Calling function internal_4 + lw $t0, 88($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 96($sp) # internal_2 = result of internal_4 + addi $sp, $sp, 8 # Freeing space for arguments + + # internal_1 = internal_2 + lw $t0, 88($sp) + sw $t0, 92($sp) + + # If internal_1 then goto then_8747373045164 + lw $t0, 92($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8747373045164 + + # Jumping to else_8747373045164 + j else_8747373045164 + + then_8747373045164: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_5[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 76($sp) # internal_5 = "\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 68($sp) # internal_7 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 104($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 68($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 64($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 116($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_5 + lw $t0, 88($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function internal_8 + lw $t0, 76($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 84($sp) # internal_6 = result of internal_8 + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_0 = internal_6 + lw $t0, 72($sp) + sw $t0, 96($sp) + + # Jumping to endif_8747373045164 + j endif_8747373045164 + + else_8747373045164: + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 56($sp) # internal_10 = address of allocated object Int + + # Get method head of List + lw $t0, 100($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 56($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 52($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument l + lw $t0, 108($sp) + sw $t0, 0($sp) # Storing l + + # Calling function internal_11 + lw $t0, 60($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 68($sp) # internal_9 = result of internal_11 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_13 = address of allocated object Int + + # Get method out_int of Main + lw $t0, 104($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 44($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 40($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 116($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_9 + lw $t0, 72($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function internal_14 + lw $t0, 52($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 60($sp) # internal_12 = result of internal_14 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_15[0] = ' ' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 36($sp) # internal_15 = " " + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_17 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 104($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 28($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 24($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 116($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_15 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_15 + + # Calling function internal_18 + lw $t0, 36($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 44($sp) # internal_16 = result of internal_18 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_20 = address of allocated object Int + + # Get method tail of List + lw $t0, 100($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 16($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 12($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument l + lw $t0, 108($sp) + sw $t0, 0($sp) # Storing l + + # Calling function internal_21 + lw $t0, 20($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 28($sp) # internal_19 = result of internal_21 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_23 = address of allocated object Int + + # Get method print_list of Main + lw $t0, 104($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 116($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_19 + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing internal_19 + + # Calling function internal_24 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_22 = result of internal_24 + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_0 = internal_22 + lw $t0, 8($sp) + sw $t0, 96($sp) + + # Jumping to endif_8747373045164 + j endif_8747373045164 + + endif_8747373045164: + + # Loading return value in $v1 + lw $v1, 96($sp) + + # Freeing space for local variables + addi $sp, $sp, 100 + + jr $ra + + function_main_at_Main: + # Function parameters + # $ra = 148($sp) + # self = 144($sp) + + # Reserving space for local variables + addi $sp, $sp, -144 + + # Allocating List + li $v0, 9 + lw $a0, type_List + syscall + la $t0, type_List # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 140($sp) # internal_0 = address of allocated object List + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 148($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_List + jal function___init___at_List + lw $ra, 4($sp) + sw $v1, 148($sp) # internal_0 = result of function___init___at_List + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 136($sp) # internal_1 = address of allocated object Int + + # Allocating Int 7 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 7 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 128($sp) # internal_3 = address of allocated object Int + + # Get method cons of List + lw $t0, 140($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 128($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 124($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 152($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_1 + lw $t0, 148($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function internal_4 + lw $t0, 136($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 144($sp) # internal_2 = result of internal_4 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 120($sp) # internal_5 = address of allocated object Int + + # Allocating Int 7 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 7 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 112($sp) # internal_7 = address of allocated object Int + + # Get method cons of List + lw $t0, 132($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 112($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 108($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 144($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_5 + lw $t0, 132($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function internal_8 + lw $t0, 120($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 128($sp) # internal_6 = result of internal_8 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 104($sp) # internal_9 = address of allocated object Int + + # Allocating Int 7 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 7 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 96($sp) # internal_11 = address of allocated object Int + + # Get method cons of List + lw $t0, 116($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 96($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 92($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_6 + lw $t0, 128($sp) + sw $t0, 4($sp) # Storing internal_6 + + # Argument internal_9 + lw $t0, 116($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function internal_12 + lw $t0, 104($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 112($sp) # internal_10 = result of internal_12 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 88($sp) # internal_13 = address of allocated object Int + + # Allocating Int 7 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 7 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 80($sp) # internal_15 = address of allocated object Int + + # Get method cons of List + lw $t0, 100($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 80($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 76($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_10 + lw $t0, 112($sp) + sw $t0, 4($sp) # Storing internal_10 + + # Argument internal_13 + lw $t0, 100($sp) + sw $t0, 0($sp) # Storing internal_13 + + # Calling function internal_16 + lw $t0, 88($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 96($sp) # internal_14 = result of internal_16 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 72($sp) # internal_17 = address of allocated object Int + + # Allocating Int 7 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 7 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 64($sp) # internal_19 = address of allocated object Int + + # Get method cons of List + lw $t0, 84($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 64($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 60($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_14 + lw $t0, 96($sp) + sw $t0, 4($sp) # Storing internal_14 + + # Argument internal_17 + lw $t0, 84($sp) + sw $t0, 0($sp) # Storing internal_17 + + # Calling function internal_20 + lw $t0, 72($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 80($sp) # internal_18 = result of internal_20 + addi $sp, $sp, 12 # Freeing space for arguments + + # Set attribute mylist of self + lw $t0, 144($sp) # $t0 = self + lw $t1, 68($sp) # $t1 = internal_18 + beq $t1, $zero, object_set_attribute_8747373031181 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8747373031181 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8747373031181 + j object_set_attribute_8747373031181 + int_set_attribute_8747373031181: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.mylist = internal_18 + j end_set_attribute_8747373031181 + bool_set_attribute_8747373031181: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.mylist = internal_18 + j end_set_attribute_8747373031181 + object_set_attribute_8747373031181: + sw $t1, 8($t0) # self.mylist = internal_18 + end_set_attribute_8747373031181: + + # Allocating NUll to internal_21 + sw $zero, 56($sp) # internal_21 = 0 + + while_start_8747373046303: + + # Get attribute mylist of self + lw $t0, 144($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'mylist' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8747373031837 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8747373031837 + j object_get_attribute_8747373031837 + int_get_attribute_8747373031837: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 52($sp) # internal_22 = self.mylist + j end_get_attribute_8747373031837 + bool_get_attribute_8747373031837: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 52($sp) # internal_22 = self.mylist + j end_get_attribute_8747373031837 + object_get_attribute_8747373031837: + sw $t1, 52($sp) # internal_22 = self.mylist + end_get_attribute_8747373031837: + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_24 = address of allocated object Int + + # Get method isNil of List + lw $t0, 52($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 44($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 40($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_22 + lw $t0, 60($sp) + sw $t0, 0($sp) # Storing internal_22 + + # Calling function internal_25 + lw $t0, 48($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 56($sp) # internal_23 = result of internal_25 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_26 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_27 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_23 + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing internal_23 + + # Argument internal_26 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_26 + + # Calling function function_xor + jal function_xor + lw $ra, 8($sp) + sw $v1, 44($sp) # internal_27 = result of function_xor + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_27 then goto while_body_8747373046303 + lw $t0, 32($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_body_8747373046303 + + # Jumping to while_end_8747373046303 + j while_end_8747373046303 + + while_body_8747373046303: + + # Get attribute mylist of self + lw $t0, 144($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'mylist' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8747373032220 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8747373032220 + j object_get_attribute_8747373032220 + int_get_attribute_8747373032220: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 28($sp) # internal_28 = self.mylist + j end_get_attribute_8747373032220 + bool_get_attribute_8747373032220: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 28($sp) # internal_28 = self.mylist + j end_get_attribute_8747373032220 + object_get_attribute_8747373032220: + sw $t1, 28($sp) # internal_28 = self.mylist + end_get_attribute_8747373032220: + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_30 = address of allocated object Int + + # Get method print_list of Main + lw $t0, 144($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 20($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 16($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 156($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_28 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_28 + + # Calling function internal_31 + lw $t0, 28($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_29 = result of internal_31 + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute mylist of self + lw $t0, 144($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'mylist' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8747373032289 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8747373032289 + j object_get_attribute_8747373032289 + int_get_attribute_8747373032289: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_32 = self.mylist + j end_get_attribute_8747373032289 + bool_get_attribute_8747373032289: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_32 = self.mylist + j end_get_attribute_8747373032289 + object_get_attribute_8747373032289: + sw $t1, 12($sp) # internal_32 = self.mylist + end_get_attribute_8747373032289: + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_34 = address of allocated object Int + + # Get method tail of List + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_32 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_32 + + # Calling function internal_35 + lw $t0, 8($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_33 = result of internal_35 + addi $sp, $sp, 8 # Freeing space for arguments + + # Set attribute mylist of self + lw $t0, 144($sp) # $t0 = self + lw $t1, 8($sp) # $t1 = internal_33 + beq $t1, $zero, object_set_attribute_8747373032265 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8747373032265 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8747373032265 + j object_set_attribute_8747373032265 + int_set_attribute_8747373032265: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.mylist = internal_33 + j end_set_attribute_8747373032265 + bool_set_attribute_8747373032265: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.mylist = internal_33 + j end_set_attribute_8747373032265 + object_set_attribute_8747373032265: + sw $t1, 8($t0) # self.mylist = internal_33 + end_set_attribute_8747373032265: + + # Jumping to while_start_8747373046303 + j while_start_8747373046303 + + while_end_8747373046303: + + # Loading return value in $v1 + lw $v1, 56($sp) + + # Freeing space for local variables + addi $sp, $sp, 144 + + jr $ra + + main: + # Reserving space for local variables + addi $sp, $sp, -16 + + # Allocating Main + li $v0, 9 + lw $a0, type_Main + syscall + la $t0, type_Main # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 12($sp) # internal_0 = address of allocated object Main + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_Main + jal function___init___at_Main + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_0 = result of function___init___at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_2 = address of allocated object Int + + # Get method main of Main + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function internal_3 + lw $t0, 8($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_1 = result of internal_3 + addi $sp, $sp, 8 # Freeing space for arguments + + # Exit program + li $v0, 10 + syscall + + \ No newline at end of file diff --git a/tests/codegen/list_output.txt b/tests/codegen/list_output.txt index fca724903..00d68ed23 100644 --- a/tests/codegen/list_output.txt +++ b/tests/codegen/list_output.txt @@ -1,5 +1,5 @@ -5 4 3 2 1 -4 3 2 1 -3 2 1 -2 1 -1 +5 4 3 2 1 +4 3 2 1 +3 2 1 +2 1 +1 diff --git a/tests/codegen/new_complex.cl b/tests/codegen/new_complex.cl index a4fe714ce..ad7035b56 100755 --- a/tests/codegen/new_complex.cl +++ b/tests/codegen/new_complex.cl @@ -1,79 +1,79 @@ -class Main inherits IO { - main() : IO { - (let c : Complex <- (new Complex).init(1, 1) in - { - -- trivially equal (see CoolAid) - if c.reflect_X() = c.reflect_0() - then out_string("=)\n") - else out_string("=(\n") - fi; - -- equal - if c.reflect_X().reflect_Y().equal(c.reflect_0()) - then out_string("=)\n") - else out_string("=(\n") - fi; - } - ) - }; -}; - -class Complex inherits IO { - x : Int; - y : Int; - - init(a : Int, b : Int) : Complex { - { - x = a; - y = b; - self; - } - }; - - print() : Object { - if y = 0 - then out_int(x) - else out_int(x).out_string("+").out_int(y).out_string("I") - fi - }; - - reflect_0() : Complex { - { - x = ~x; - y = ~y; - self; - } - }; - - reflect_X() : Complex { - { - y = ~y; - self; - } - }; - - reflect_Y() : Complex { - { - x = ~x; - self; - } - }; - - equal(d : Complex) : Bool { - if x = d.x_value() - then - if y = d.y_value() - then true - else false - fi - else false - fi - }; - - x_value() : Int { - x - }; - - y_value() : Int { - y - }; -}; +class Main inherits IO { + main() : IO { + (let c : Complex <- (new Complex).init(1, 1) in + { + -- trivially equal (see CoolAid) + if c.reflect_X() = c.reflect_0() + then out_string("=)\n") + else out_string("=(\n") + fi; + -- equal + if c.reflect_X().reflect_Y().equal(c.reflect_0()) + then out_string("=)\n") + else out_string("=(\n") + fi; + } + ) + }; +}; + +class Complex inherits IO { + x : Int; + y : Int; + + init(a : Int, b : Int) : Complex { + { + x = a; + y = b; + self; + } + }; + + print() : Object { + if y = 0 + then out_int(x) + else out_int(x).out_string("+").out_int(y).out_string("I") + fi + }; + + reflect_0() : Complex { + { + x = ~x; + y = ~y; + self; + } + }; + + reflect_X() : Complex { + { + y = ~y; + self; + } + }; + + reflect_Y() : Complex { + { + x = ~x; + self; + } + }; + + equal(d : Complex) : Bool { + if x = d.x_value() + then + if y = d.y_value() + then true + else false + fi + else false + fi + }; + + x_value() : Int { + x + }; + + y_value() : Int { + y + }; +}; diff --git a/tests/codegen/new_complex.mips b/tests/codegen/new_complex.mips new file mode 100644 index 000000000..c83ae4ed1 --- /dev/null +++ b/tests/codegen/new_complex.mips @@ -0,0 +1,4105 @@ +.data + type_Object: .word 24 + type_Object_inherits_from: .word 0 + type_Object_name_address: .word type_Object_name_size + type_Object___init__: .word function___init___at_Object + type_Object_abort: .word function_abort_at_Object + type_Object_type_name: .word function_type_name_at_Object + type_Object_copy: .word function_copy_at_Object + + type_IO: .word 40 + type_IO_inherits_from: .word type_Object + type_IO_name_address: .word type_IO_name_size + type_IO___init__: .word function___init___at_IO + type_IO_abort: .word function_abort_at_Object + type_IO_type_name: .word function_type_name_at_Object + type_IO_copy: .word function_copy_at_Object + type_IO_out_string: .word function_out_string_at_IO + type_IO_out_int: .word function_out_int_at_IO + type_IO_in_string: .word function_in_string_at_IO + type_IO_in_int: .word function_in_int_at_IO + + type_String: .word 36 + type_String_inherits_from: .word type_Object + type_String_name_address: .word type_String_name_size + type_String___init__: .word function___init___at_String + type_String_abort: .word function_abort_at_Object + type_String_type_name: .word function_type_name_at_Object + type_String_copy: .word function_copy_at_Object + type_String_length: .word function_length_at_String + type_String_concat: .word function_concat_at_String + type_String_substr: .word function_substr_at_String + + type_Int: .word 24 + type_Int_inherits_from: .word type_Object + type_Int_name_address: .word type_Int_name_size + type_Int___init__: .word function___init___at_Int + type_Int_abort: .word function_abort_at_Object + type_Int_type_name: .word function_type_name_at_Object + type_Int_copy: .word function_copy_at_Object + + type_Bool: .word 24 + type_Bool_inherits_from: .word type_Object + type_Bool_name_address: .word type_Bool_name_size + type_Bool___init__: .word function___init___at_Bool + type_Bool_abort: .word function_abort_at_Object + type_Bool_type_name: .word function_type_name_at_Object + type_Bool_copy: .word function_copy_at_Object + + type_Main: .word 44 + type_Main_inherits_from: .word type_IO + type_Main_name_address: .word type_Main_name_size + type_Main___init__: .word function___init___at_Main + type_Main_abort: .word function_abort_at_Object + type_Main_type_name: .word function_type_name_at_Object + type_Main_copy: .word function_copy_at_Object + type_Main_out_string: .word function_out_string_at_IO + type_Main_out_int: .word function_out_int_at_IO + type_Main_in_string: .word function_in_string_at_IO + type_Main_in_int: .word function_in_int_at_IO + type_Main_main: .word function_main_at_Main + + type_Complex: .word 80 + type_Complex_inherits_from: .word type_IO + type_Complex_name_address: .word type_Complex_name_size + type_Complex___init__: .word function___init___at_Complex + type_Complex_abort: .word function_abort_at_Object + type_Complex_type_name: .word function_type_name_at_Object + type_Complex_copy: .word function_copy_at_Object + type_Complex_out_string: .word function_out_string_at_IO + type_Complex_out_int: .word function_out_int_at_IO + type_Complex_in_string: .word function_in_string_at_IO + type_Complex_in_int: .word function_in_int_at_IO + type_Complex_init: .word function_init_at_Complex + type_Complex_print: .word function_print_at_Complex + type_Complex_reflect_0: .word function_reflect_0_at_Complex + type_Complex_reflect_X: .word function_reflect_X_at_Complex + type_Complex_reflect_Y: .word function_reflect_Y_at_Complex + type_Complex_equal: .word function_equal_at_Complex + type_Complex_x_value: .word function_x_value_at_Complex + type_Complex_y_value: .word function_y_value_at_Complex + + type_Object_name_size: .word 6 + type_Object_name: .asciiz "Object" + + type_IO_name_size: .word 2 + type_IO_name: .asciiz "IO" + + type_String_name_size: .word 6 + type_String_name: .asciiz "String" + + type_Int_name_size: .word 3 + type_Int_name: .asciiz "Int" + + type_Bool_name_size: .word 4 + type_Bool_name: .asciiz "Bool" + + type_Main_name_size: .word 4 + type_Main_name: .asciiz "Main" + + type_Complex_name_size: .word 7 + type_Complex_name: .asciiz "Complex" + + buffer_input: .space 1024 + debug_log: .asciiz "debug_log\n" + +.text + function_add: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Addition operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + add $t2, $t0, $t1 # $t2 = $t0 + $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_sub: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Subtraction operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sub $t2, $t0, $t1 # $t2 = $t0 - $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_mult: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Multiplication operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + mult $t0, $t1 # $t2 = $t0 * $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_div: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Division operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + div $t0, $t1 # $t2 = $t0 / $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_xor: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Xor operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than_or_equal: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sle $t2, $t0, $t1 # $t2 = $t0 <= $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_equal: + # Function parameters + # $ra = 48($sp) + # a = 44($sp) + # b = 40($sp) + + # Reserving space for local variables + addi $sp, $sp, -40 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_0 = address of allocated object Int + + # Allocating NUll to internal_1 + sw $zero, 32($sp) # internal_1 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_2 = address of allocated object Int + + # internal_2 = EqualAddress(a, internal_1) + lw $t0, 44($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # internal_2 = EqualAddress(b, internal_1) + lw $t0, 40($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # If internal_2 then goto a_is_type_object + lw $t0, 28($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_object + + # internal_3 = typeof a that is the first word of the object + lw $t0, 44($sp) + lw $t0, 0($t0) + sw $t0, 24($sp) + + # internal_4 = direction of Int + la $t0, type_Int + sw $t0, 20($sp) + + # internal_5 = direction of Bool + la $t0, type_Bool + sw $t0, 16($sp) + + # internal_6 = direction of String + la $t0, type_String + sw $t0, 12($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_7 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_8 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_9 = address of allocated object Int + + # internal_7 = EqualAddress(internal_3, internal_4) + lw $t0, 24($sp) + lw $t1, 20($sp) + seq $t2, $t0, $t1 + lw $t0, 8($sp) + sw $t2, 8($t0) + + # internal_8 = EqualAddress(internal_3, internal_5) + lw $t0, 24($sp) + lw $t1, 16($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_9 = EqualAddress(internal_3, internal_6) + lw $t0, 24($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_7 then goto a_is_type_int_or_bool + lw $t0, 8($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_8 then goto a_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_9 then goto a_is_type_string + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_string + + # Jumping to a_is_type_object + j a_is_type_object + + a_is_type_int_or_bool: + + # internal_0 = EqualInt(a, b) + lw $t0, 44($sp) + lw $t0, 8($t0) + lw $t1, 40($sp) + lw $t1, 8($t1) + seq $t2, $t0, $t1 + lw $t0, 36($sp) + sw $t2, 8($t0) + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_string: + + # internal_0 = EqualStr(a, b) + lw $t0, 44($sp) + lw $t1, 40($sp) + addi $t0, $t0, 8 + addi $t1, $t1, 8 + + # By default we assume the strings are equals + addi $t4, $zero, 1 + lw $t5, 36($sp) + sw $t4, 8($t5) + + while_compare_strings_start: + lb $t2, 0($t0) + lb $t3, 0($t1) + beq $t2, $t3, while_compare_strings_update + + # The strings are no equals + lw $t5, 36($sp) + sw $zero, 8($t5) + j while_compare_strings_end + + while_compare_strings_update: + addi $t0, $t0, 1 + addi $t1, $t1, 1 + beq $t2, $zero, while_compare_strings_end + beq $t3, $zero, while_compare_strings_end + j while_compare_strings_start + while_compare_strings_end: + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_object: + + # Equal operation + lw $t0, 44($sp) # Save in $t0 the left operand address + lw $t1, 40($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 36($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Jumping to end_of_equal + j end_of_equal + + end_of_equal: + + # Loading return value in $v1 + lw $v1, 36($sp) + + # Freeing space for local variables + addi $sp, $sp, 40 + + jr $ra + + function_assign: + # Function parameters + # $ra = 36($sp) + # dest = 32($sp) + # source = 28($sp) + + # Reserving space for local variables + addi $sp, $sp, -28 + + # Allocating NUll to internal_0 + sw $zero, 24($sp) # internal_0 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_1 = address of allocated object Int + + # internal_1 = EqualAddress(source, internal_0) + lw $t0, 28($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # internal_1 = EqualAddress(dest, internal_0) + lw $t0, 32($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # If internal_1 then goto source_is_type_object + lw $t0, 20($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_object + + # internal_2 = typeof source that is the first word of the object + lw $t0, 28($sp) + lw $t0, 0($t0) + sw $t0, 16($sp) + + # internal_3 = direction of Int + la $t0, type_Int + sw $t0, 12($sp) + + # internal_4 = direction of Bool + la $t0, type_Bool + sw $t0, 8($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_5 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_6 = address of allocated object Int + + # internal_5 = EqualAddress(internal_2, internal_3) + lw $t0, 16($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_6 = EqualAddress(internal_2, internal_4) + lw $t0, 16($sp) + lw $t1, 8($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_5 then goto source_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # If internal_6 then goto source_is_type_int_or_bool + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # Jumping to source_is_type_object + j source_is_type_object + + source_is_type_int_or_bool: + + # dest = source where source is an integer + li $v0, 9 + addi $a0, $zero, 12 + syscall + lw $t0, 28($sp) # Pointer to source + lw $t1, 0($t0) # $t1 = type of source + lw $t2, 8($t0) # $t2 = value of source + sw $t1, 0($v0) # Save type of dest + sw $a0, 4($v0) # Save size of dest + sw $t2, 8($v0) # Save value of dest + sw $v0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_is_type_object: + + # dest = source + lw $t0, 28($sp) + sw $t0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_end_of_equal: + + # Loading return value in $v1 + lw $v1, 32($sp) + + # Freeing space for local variables + addi $sp, $sp, 28 + + jr $ra + + function___init___at_Object: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_abort_at_Object: + # Function parameters + # $ra = 28($sp) + # self = 24($sp) + + # Reserving space for local variables + addi $sp, $sp, -24 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 33 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 33 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 65 + sb $t0, 8($v0) # internal_0[0] = 'A' + + addi $t0, $zero, 98 + sb $t0, 9($v0) # internal_0[1] = 'b' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_0[2] = 'o' + + addi $t0, $zero, 114 + sb $t0, 11($v0) # internal_0[3] = 'r' + + addi $t0, $zero, 116 + sb $t0, 12($v0) # internal_0[4] = 't' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_0[5] = ' ' + + addi $t0, $zero, 99 + sb $t0, 14($v0) # internal_0[6] = 'c' + + addi $t0, $zero, 97 + sb $t0, 15($v0) # internal_0[7] = 'a' + + addi $t0, $zero, 108 + sb $t0, 16($v0) # internal_0[8] = 'l' + + addi $t0, $zero, 108 + sb $t0, 17($v0) # internal_0[9] = 'l' + + addi $t0, $zero, 101 + sb $t0, 18($v0) # internal_0[10] = 'e' + + addi $t0, $zero, 100 + sb $t0, 19($v0) # internal_0[11] = 'd' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_0[12] = ' ' + + addi $t0, $zero, 102 + sb $t0, 21($v0) # internal_0[13] = 'f' + + addi $t0, $zero, 114 + sb $t0, 22($v0) # internal_0[14] = 'r' + + addi $t0, $zero, 111 + sb $t0, 23($v0) # internal_0[15] = 'o' + + addi $t0, $zero, 109 + sb $t0, 24($v0) # internal_0[16] = 'm' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_0[17] = ' ' + + addi $t0, $zero, 99 + sb $t0, 26($v0) # internal_0[18] = 'c' + + addi $t0, $zero, 108 + sb $t0, 27($v0) # internal_0[19] = 'l' + + addi $t0, $zero, 97 + sb $t0, 28($v0) # internal_0[20] = 'a' + + addi $t0, $zero, 115 + sb $t0, 29($v0) # internal_0[21] = 's' + + addi $t0, $zero, 115 + sb $t0, 30($v0) # internal_0[22] = 's' + + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_0[23] = ' ' + + sb $zero, 32($v0) # Null-terminator at the end of the string + + sw $v0, 20($sp) # internal_0 = "Abort called from class " + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_3[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 8($sp) # internal_3 = "\n" + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method type_name of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_5 + lw $t0, 8($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 24($sp) # internal_1 = result of internal_5 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_1 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_2 = result of internal_5 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_3 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_2 = result of internal_5 + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 12($sp) # $t0 = internal_2 + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the String internal_2 + li $v0, 4 + move $a0, $t0 + syscall + + # Exit program + li $v0, 10 + syscall + + # Loading return value in $v1 + lw $v1, 24($sp) + + # Freeing space for local variables + addi $sp, $sp, 24 + + jr $ra + + function_type_name_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = name of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 8($t1) # $t2 = direction of the type name + la $t3, 4($t2) # $t3 = address of the name + lw $t2, 0($t2) # $t2 = length of the name + + addi $t2, $t2, 9 # Setting space for the type, the size and the null byte + li $v0, 9 + move $a0, $t2 + syscall + addi $t2, $t2, -9 # Restoring space for the type, the size and the null byte + + la $t4, type_String + sw $t4, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t4, $v0, 0 # $t4 = direction of the new string + addi $t4, $t4, 8 # Pointer to the first character of the string + xor $t5, $t5, $t5 # Initializing counter + while_copy_name_start: + beq $t5, $t2, while_copy_name_end + lb $t6, 0($t3) # Loading the character + sb $t6, 0($t4) + addi $t4, $t4, 1 # Incrementing the pointer to the new string + addi $t3, $t3, 1 # Incrementing the pointer to the string in self + addi $t5, $t5, 1 # Incrementing counter + j while_copy_name_start + while_copy_name_end: + + sb $zero, 0($t4) # Setting the null byte + + sw $v0, 0($sp) # Storing the new string in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_copy_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = copy of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 4($t0) # $t2 = length of self in bytes + + # Allocating space for the new object + li $v0, 9 + move $a0, $t2 + syscall + move $t3, $v0 # $t3 = direction of the new object + sw $t1, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + # Initializing the variable of the loop + addi $t0, $t0, 8 # Pointer to the first character of the object + addi $t3, $t3, 8 # Pointer to the first character of the object + addi $t2, $2, -8 # Decrementing in 8 the length of the object + xor $t4, $t4, $t4 # Initializing counter + + # Loop copying the object + while_copy_start: + beq $t4, $t2, while_copy_end + lb $t5, 0($t0) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t0, $t0, 1 # Incrementing the pointer to the object + addi $t3, $t3, 1 # Incrementing the pointer to the new object + addi $t4, $t4, 1 # Incrementing counter + j while_copy_start + while_copy_end: + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_IO: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_out_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + lw $t0, 0($sp) # $t0 = x + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the String x + li $v0, 4 + move $a0, $t0 + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_out_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + # Printing the Int x + li $v0, 1 + lw $a0, 0($sp) + lw $a0, 8($a0) + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_in_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + li $v0, 8 + la $a0, buffer_input + li $a1, 1024 + syscall + + xor $t0, $t0, $t0 # Initializing counter + while_read_start: + lb $t1, buffer_input($t0) # Loading the byte + addi $t2, $zero, 10 + beq $t1, $t2, while_read_end + addi $t2, $zero, 13 + beq $t1, $t2, while_read_end + addi $t0, $t0, 1 # Incrementing counter + j while_read_start + while_read_end: + + addi $t0, $t0, 9 # Adding space for the type, the size and the null byte + li $v0, 9 + move $a0, $t0 + syscall + addi $t0, $t0, -9 # Adding space for the type, the size and the null byte + la $t2, type_String + sw $t2, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t3, $v0, 8 # Pointer to the first character of the string + xor $t4, $t4, $t4 # Initializing counter + + while_copy_from_buffer_start: + beq $t4, $t0, while_copy_from_buffer_end + lb $t5, buffer_input($t4) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t3, $t3, 1 # Imcremeenting pointer + addi $t4, $t4, 1 # Incrementing counter + j while_copy_from_buffer_start + while_copy_from_buffer_end: + + sb $zero, 0($t3) # Storing the null byte + + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_in_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + li $v0, 5 + syscall + lw $t0, 0($sp) + sw $v0, 8($t0) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_String: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_length_at_String: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # internal_0 = length of self + lw $t0, 4($sp) + lw $t1, 4($t0) + addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator + lw $t0, 0($sp) + sw $t1, 8($t0) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_concat_at_String: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + # s = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self + s + lw $t0, 8($sp) + lw $t1, 4($sp) + lw $t2, 4($t0) # $t2 = length of str1 + lw $t3, 4($t1) # $t3 = length of str2 + addi $t2, $t2, -9 + addi $t3, $t3, -9 + add $t4, $t2, $t3 # $t4 = length of str1 + str2 + addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) + + li $v0, 9 + move $a0, $t4 + syscall + addi $t4, $t4, -9 # Restoring $t4 = length of str1 + str2 + add $t5, $zero, $v0 # $t5 = address of the new string object + addi $t5, $t5, 8 # $t5 = address of the first byte of the new string + + la $t8, type_String + sw $t8, 0($v0) # Setting type in the first word of th object + + sw $a0, 4($v0) # Setting length of the string in the second word of the object + + # Copying str1 to the new string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_str1_start: + beq $t6, $t2, while_copy_str1_end + lb $t7, 8($t0) + sb $t7, 0($t5) + add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str1_start + while_copy_str1_end: + + # Copying str2 to the new string + while_copy_str2_start: + beq $t6, $t4, while_copy_str2_end + lb $t7, 8($t1) + sb $t7, 0($t5) + add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str2_start + while_copy_str2_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self + s + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_substr_at_String: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + # i = 8($sp) + # l = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self[i:i + l] + lw $t0, 12($sp) # $t0 = address of the string + lw $t1, 4($t0) # $t1 = length of the string + addi $t1, $t1, -9 # $t1 = length of the string + 9 + lw $t2, 8($sp) # $t2 = start of the substring + lw $t2, 8($t2) + lw $t3, 4($sp) # $t3 = length of the substring + lw $t3, 8($t3) + add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring + + bgt $t4, $t1, substring_out_of_bounds + + addi $t3, $t3, 9 + li $v0, 9 + move $a0, $t3 + syscall + addi $t3, $t3, -9 + + la $t5, type_String + sw $t5, 0($v0) # Setting type in the first word of the object + + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t0, $t0, 8 # pointing to the first byte of the string + add $t0, $t0, $t2 # pointing to the first byte of the substring + move $t5, $v0 # $t5 = address of the new string + add $t5, $t5, 8 # pointing to the first byte of the string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_substr_start: + beq $t6, $t3, while_copy_substr_end + lb $t7, 0($t0) + sb $t7, 0($t5) + addi $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of the string + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_substr_start + while_copy_substr_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self[i:i + l] + j substring_not_out_of_bounds + + substring_out_of_bounds: + li $v0, 17 + addi $a0, $zero, 1 + syscall + + substring_not_out_of_bounds: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_Int: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function___init___at_Bool: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function___init___at_Main: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_main_at_Main: + # Function parameters + # $ra = 188($sp) + # self = 184($sp) + + # Reserving space for local variables + addi $sp, $sp, -184 + + # Allocating Complex + li $v0, 9 + lw $a0, type_Complex + syscall + la $t0, type_Complex # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 176($sp) # internal_1 = address of allocated object Complex + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_1 + lw $t0, 184($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function___init___at_Complex + jal function___init___at_Complex + lw $ra, 4($sp) + sw $v1, 184($sp) # internal_1 = result of function___init___at_Complex + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 172($sp) # internal_2 = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 168($sp) # internal_3 = address of allocated object Int + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 160($sp) # internal_5 = address of allocated object Int + + # Get method init of Complex + lw $t0, 176($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 160($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 156($sp) + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument internal_1 + lw $t0, 192($sp) + sw $t0, 8($sp) # Storing internal_1 + + # Argument internal_2 + lw $t0, 188($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_3 + lw $t0, 184($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function internal_6 + lw $t0, 172($sp) + jalr $t0 + lw $ra, 12($sp) + sw $v1, 180($sp) # internal_4 = result of internal_6 + addi $sp, $sp, 16 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument c + lw $t0, 192($sp) + sw $t0, 4($sp) # Storing c + + # Argument internal_4 + lw $t0, 176($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 192($sp) # c = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 148($sp) # internal_8 = address of allocated object Int + + # Allocating Int 11 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 11 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 140($sp) # internal_10 = address of allocated object Int + + # Get method reflect_X of Complex + lw $t0, 180($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 140($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 136($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument c + lw $t0, 188($sp) + sw $t0, 0($sp) # Storing c + + # Calling function internal_11 + lw $t0, 144($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 152($sp) # internal_9 = result of internal_11 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 10 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 10 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 128($sp) # internal_13 = address of allocated object Int + + # Get method reflect_0 of Complex + lw $t0, 180($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 128($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 124($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument c + lw $t0, 188($sp) + sw $t0, 0($sp) # Storing c + + # Calling function internal_14 + lw $t0, 132($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 140($sp) # internal_12 = result of internal_14 + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_9 + lw $t0, 156($sp) + sw $t0, 4($sp) # Storing internal_9 + + # Argument internal_12 + lw $t0, 144($sp) + sw $t0, 0($sp) # Storing internal_12 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 132($sp) # internal_15 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_8 = internal_15 + lw $t0, 120($sp) + sw $t0, 148($sp) + + # If internal_8 then goto then_8753583571026 + lw $t0, 148($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8753583571026 + + # Jumping to else_8753583571026 + j else_8753583571026 + + then_8753583571026: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 12 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 12 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 61 + sb $t0, 8($v0) # internal_16[0] = '=' + + addi $t0, $zero, 41 + sb $t0, 9($v0) # internal_16[1] = ')' + + addi $t0, $zero, 10 + sb $t0, 10($v0) # internal_16[2] = '\n' + + sb $zero, 11($v0) # Null-terminator at the end of the string + + sw $v0, 116($sp) # internal_16 = "=)\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 108($sp) # internal_18 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 184($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 108($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 104($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 196($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_16 + lw $t0, 128($sp) + sw $t0, 0($sp) # Storing internal_16 + + # Calling function internal_19 + lw $t0, 116($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 124($sp) # internal_17 = result of internal_19 + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_7 = internal_17 + lw $t0, 112($sp) + sw $t0, 152($sp) + + # Jumping to endif_8753583571026 + j endif_8753583571026 + + else_8753583571026: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 12 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 12 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 61 + sb $t0, 8($v0) # internal_20[0] = '=' + + addi $t0, $zero, 40 + sb $t0, 9($v0) # internal_20[1] = '(' + + addi $t0, $zero, 10 + sb $t0, 10($v0) # internal_20[2] = '\n' + + sb $zero, 11($v0) # Null-terminator at the end of the string + + sw $v0, 100($sp) # internal_20 = "=(\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 92($sp) # internal_22 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 184($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 92($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 88($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 196($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_20 + lw $t0, 112($sp) + sw $t0, 0($sp) # Storing internal_20 + + # Calling function internal_23 + lw $t0, 100($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 108($sp) # internal_21 = result of internal_23 + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_7 = internal_21 + lw $t0, 96($sp) + sw $t0, 152($sp) + + # Jumping to endif_8753583571026 + j endif_8753583571026 + + endif_8753583571026: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 80($sp) # internal_25 = address of allocated object Int + + # Allocating Int 11 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 11 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 72($sp) # internal_27 = address of allocated object Int + + # Get method reflect_X of Complex + lw $t0, 180($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 72($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 68($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument c + lw $t0, 188($sp) + sw $t0, 0($sp) # Storing c + + # Calling function internal_28 + lw $t0, 76($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 84($sp) # internal_26 = result of internal_28 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 12 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 12 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 60($sp) # internal_30 = address of allocated object Int + + # Get method reflect_Y of Complex + lw $t0, 76($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 60($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 56($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_26 + lw $t0, 84($sp) + sw $t0, 0($sp) # Storing internal_26 + + # Calling function internal_31 + lw $t0, 64($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 72($sp) # internal_29 = result of internal_31 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 10 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 10 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 48($sp) # internal_33 = address of allocated object Int + + # Get method reflect_0 of Complex + lw $t0, 180($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 48($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 44($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument c + lw $t0, 188($sp) + sw $t0, 0($sp) # Storing c + + # Calling function internal_34 + lw $t0, 52($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 60($sp) # internal_32 = result of internal_34 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 13 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 13 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_36 = address of allocated object Int + + # Get method equal of Complex + lw $t0, 64($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 36($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 32($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_29 + lw $t0, 76($sp) + sw $t0, 4($sp) # Storing internal_29 + + # Argument internal_32 + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing internal_32 + + # Calling function internal_37 + lw $t0, 44($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 52($sp) # internal_35 = result of internal_37 + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_25 = internal_35 + lw $t0, 40($sp) + sw $t0, 80($sp) + + # If internal_25 then goto then_8753583571074 + lw $t0, 80($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8753583571074 + + # Jumping to else_8753583571074 + j else_8753583571074 + + then_8753583571074: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 12 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 12 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 61 + sb $t0, 8($v0) # internal_38[0] = '=' + + addi $t0, $zero, 41 + sb $t0, 9($v0) # internal_38[1] = ')' + + addi $t0, $zero, 10 + sb $t0, 10($v0) # internal_38[2] = '\n' + + sb $zero, 11($v0) # Null-terminator at the end of the string + + sw $v0, 28($sp) # internal_38 = "=)\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_40 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 184($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 20($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 16($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 196($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_38 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_38 + + # Calling function internal_41 + lw $t0, 28($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_39 = result of internal_41 + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_24 = internal_39 + lw $t0, 24($sp) + sw $t0, 84($sp) + + # Jumping to endif_8753583571074 + j endif_8753583571074 + + else_8753583571074: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 12 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 12 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 61 + sb $t0, 8($v0) # internal_42[0] = '=' + + addi $t0, $zero, 40 + sb $t0, 9($v0) # internal_42[1] = '(' + + addi $t0, $zero, 10 + sb $t0, 10($v0) # internal_42[2] = '\n' + + sb $zero, 11($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_42 = "=(\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_44 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 184($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 196($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_42 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_42 + + # Calling function internal_45 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_43 = result of internal_45 + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_24 = internal_43 + lw $t0, 8($sp) + sw $t0, 84($sp) + + # Jumping to endif_8753583571074 + j endif_8753583571074 + + endif_8753583571074: + + # Loading return value in $v1 + lw $v1, 84($sp) + + # Freeing space for local variables + addi $sp, $sp, 184 + + jr $ra + + function___init___at_Complex: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + + # Reserving space for local variables + addi $sp, $sp, -8 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_0 = address of allocated object Int + + # Set attribute x of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 4($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8753583564794 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8753583564794 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8753583564794 + j object_set_attribute_8753583564794 + int_set_attribute_8753583564794: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.x = internal_0 + j end_set_attribute_8753583564794 + bool_set_attribute_8753583564794: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.x = internal_0 + j end_set_attribute_8753583564794 + object_set_attribute_8753583564794: + sw $t1, 8($t0) # self.x = internal_0 + end_set_attribute_8753583564794: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_1 = address of allocated object Int + + # Set attribute y of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_1 + beq $t1, $zero, object_set_attribute_8753583565590 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8753583565590 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8753583565590 + j object_set_attribute_8753583565590 + int_set_attribute_8753583565590: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.y = internal_1 + j end_set_attribute_8753583565590 + bool_set_attribute_8753583565590: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.y = internal_1 + j end_set_attribute_8753583565590 + object_set_attribute_8753583565590: + sw $t1, 12($t0) # self.y = internal_1 + end_set_attribute_8753583565590: + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 8 + + jr $ra + + function_init_at_Complex: + # Function parameters + # $ra = 28($sp) + # self = 24($sp) + # a = 20($sp) + # b = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Get attribute x of self + lw $t0, 24($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'x' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8753583565653 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8753583565653 + j object_get_attribute_8753583565653 + int_get_attribute_8753583565653: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_0 = self.x + j end_get_attribute_8753583565653 + bool_get_attribute_8753583565653: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_0 = self.x + j end_get_attribute_8753583565653 + object_get_attribute_8753583565653: + sw $t1, 12($sp) # internal_0 = self.x + end_get_attribute_8753583565653: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument a + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing a + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_1 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute y of self + lw $t0, 24($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'y' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8753583565692 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8753583565692 + j object_get_attribute_8753583565692 + int_get_attribute_8753583565692: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 4($sp) # internal_2 = self.y + j end_get_attribute_8753583565692 + bool_get_attribute_8753583565692: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 4($sp) # internal_2 = self.y + j end_get_attribute_8753583565692 + object_get_attribute_8753583565692: + sw $t1, 4($sp) # internal_2 = self.y + end_get_attribute_8753583565692: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 16($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument b + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing b + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_3 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 24($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 + + jr $ra + + function_print_at_Complex: + # Function parameters + # $ra = 104($sp) + # self = 100($sp) + + # Reserving space for local variables + addi $sp, $sp, -100 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 92($sp) # internal_1 = address of allocated object Int + + # Get attribute y of self + lw $t0, 100($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'y' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8753583565770 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8753583565770 + j object_get_attribute_8753583565770 + int_get_attribute_8753583565770: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 88($sp) # internal_2 = self.y + j end_get_attribute_8753583565770 + bool_get_attribute_8753583565770: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 88($sp) # internal_2 = self.y + j end_get_attribute_8753583565770 + object_get_attribute_8753583565770: + sw $t1, 88($sp) # internal_2 = self.y + end_get_attribute_8753583565770: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 84($sp) # internal_3 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 100($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_3 + lw $t0, 96($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 92($sp) # internal_4 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_1 = internal_4 + lw $t0, 80($sp) + sw $t0, 92($sp) + + # If internal_1 then goto then_8753583580956 + lw $t0, 92($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8753583580956 + + # Jumping to else_8753583580956 + j else_8753583580956 + + then_8753583580956: + + # Get attribute x of self + lw $t0, 100($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'x' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8753583566111 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8753583566111 + j object_get_attribute_8753583566111 + int_get_attribute_8753583566111: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 76($sp) # internal_5 = self.x + j end_get_attribute_8753583566111 + bool_get_attribute_8753583566111: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 76($sp) # internal_5 = self.x + j end_get_attribute_8753583566111 + object_get_attribute_8753583566111: + sw $t1, 76($sp) # internal_5 = self.x + end_get_attribute_8753583566111: + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 68($sp) # internal_7 = address of allocated object Int + + # Get method out_int of Complex + lw $t0, 100($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 68($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 64($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 112($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_5 + lw $t0, 88($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function internal_8 + lw $t0, 76($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 84($sp) # internal_6 = result of internal_8 + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_0 = internal_6 + lw $t0, 72($sp) + sw $t0, 96($sp) + + # Jumping to endif_8753583580956 + j endif_8753583580956 + + else_8753583580956: + + # Get attribute x of self + lw $t0, 100($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'x' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8753583566228 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8753583566228 + j object_get_attribute_8753583566228 + int_get_attribute_8753583566228: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 60($sp) # internal_9 = self.x + j end_get_attribute_8753583566228 + bool_get_attribute_8753583566228: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 60($sp) # internal_9 = self.x + j end_get_attribute_8753583566228 + object_get_attribute_8753583566228: + sw $t1, 60($sp) # internal_9 = self.x + end_get_attribute_8753583566228: + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 52($sp) # internal_11 = address of allocated object Int + + # Get method out_int of Complex + lw $t0, 100($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 52($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 48($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 112($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_9 + lw $t0, 72($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function internal_12 + lw $t0, 60($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 68($sp) # internal_10 = result of internal_12 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 43 + sb $t0, 8($v0) # internal_13[0] = '+' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 44($sp) # internal_13 = "+" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_15 = address of allocated object Int + + # Get method out_string of Complex + lw $t0, 56($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 36($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 32($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_10 + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing internal_10 + + # Argument internal_13 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_13 + + # Calling function internal_16 + lw $t0, 44($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 52($sp) # internal_14 = result of internal_16 + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute y of self + lw $t0, 100($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'y' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8753583566324 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8753583566324 + j object_get_attribute_8753583566324 + int_get_attribute_8753583566324: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 28($sp) # internal_17 = self.y + j end_get_attribute_8753583566324 + bool_get_attribute_8753583566324: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 28($sp) # internal_17 = self.y + j end_get_attribute_8753583566324 + object_get_attribute_8753583566324: + sw $t1, 28($sp) # internal_17 = self.y + end_get_attribute_8753583566324: + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_19 = address of allocated object Int + + # Get method out_int of Complex + lw $t0, 40($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 20($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 16($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_14 + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing internal_14 + + # Argument internal_17 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_17 + + # Calling function internal_20 + lw $t0, 28($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_18 = result of internal_20 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 73 + sb $t0, 8($v0) # internal_21[0] = 'I' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_21 = "I" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_23 = address of allocated object Int + + # Get method out_string of Complex + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_18 + lw $t0, 36($sp) + sw $t0, 4($sp) # Storing internal_18 + + # Argument internal_21 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_21 + + # Calling function internal_24 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_22 = result of internal_24 + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_0 = internal_22 + lw $t0, 8($sp) + sw $t0, 96($sp) + + # Jumping to endif_8753583580956 + j endif_8753583580956 + + endif_8753583580956: + + # Loading return value in $v1 + lw $v1, 96($sp) + + # Freeing space for local variables + addi $sp, $sp, 100 + + jr $ra + + function_reflect_0_at_Complex: + # Function parameters + # $ra = 52($sp) + # self = 48($sp) + + # Reserving space for local variables + addi $sp, $sp, -48 + + # Get attribute x of self + lw $t0, 48($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'x' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8753583566731 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8753583566731 + j object_get_attribute_8753583566731 + int_get_attribute_8753583566731: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 44($sp) # internal_0 = self.x + j end_get_attribute_8753583566731 + bool_get_attribute_8753583566731: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 44($sp) # internal_0 = self.x + j end_get_attribute_8753583566731 + object_get_attribute_8753583566731: + sw $t1, 44($sp) # internal_0 = self.x + end_get_attribute_8753583566731: + + # Get attribute x of self + lw $t0, 48($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'x' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8753583566755 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8753583566755 + j object_get_attribute_8753583566755 + int_get_attribute_8753583566755: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 40($sp) # internal_1 = self.x + j end_get_attribute_8753583566755 + bool_get_attribute_8753583566755: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 40($sp) # internal_1 = self.x + j end_get_attribute_8753583566755 + object_get_attribute_8753583566755: + sw $t1, 40($sp) # internal_1 = self.x + end_get_attribute_8753583566755: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_2 = address of allocated object Int + + # Allocating Int 4294967295 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4294967295 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_3 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_4 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_1 + lw $t0, 52($sp) + sw $t0, 4($sp) # Storing internal_1 + + # Argument internal_3 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_xor + jal function_xor + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_4 = result of function_xor + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_4 + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing internal_4 + + # Argument internal_2 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_4 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_4 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_5 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute y of self + lw $t0, 48($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'y' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8753583567370 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8753583567370 + j object_get_attribute_8753583567370 + int_get_attribute_8753583567370: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($sp) # internal_6 = self.y + j end_get_attribute_8753583567370 + bool_get_attribute_8753583567370: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($sp) # internal_6 = self.y + j end_get_attribute_8753583567370 + object_get_attribute_8753583567370: + sw $t1, 20($sp) # internal_6 = self.y + end_get_attribute_8753583567370: + + # Get attribute y of self + lw $t0, 48($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'y' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8753583567394 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8753583567394 + j object_get_attribute_8753583567394 + int_get_attribute_8753583567394: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($sp) # internal_7 = self.y + j end_get_attribute_8753583567394 + bool_get_attribute_8753583567394: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($sp) # internal_7 = self.y + j end_get_attribute_8753583567394 + object_get_attribute_8753583567394: + sw $t1, 16($sp) # internal_7 = self.y + end_get_attribute_8753583567394: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 12($sp) # internal_8 = address of allocated object Int + + # Allocating Int 4294967295 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4294967295 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_9 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_10 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_7 + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing internal_7 + + # Argument internal_9 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_9 + + # Calling function function_xor + jal function_xor + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_10 = result of function_xor + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_10 + lw $t0, 16($sp) + sw $t0, 4($sp) # Storing internal_10 + + # Argument internal_8 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_8 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_10 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_6 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_6 + + # Argument internal_10 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_10 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_11 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 48($sp) + + # Freeing space for local variables + addi $sp, $sp, 48 + + jr $ra + + function_reflect_X_at_Complex: + # Function parameters + # $ra = 28($sp) + # self = 24($sp) + + # Reserving space for local variables + addi $sp, $sp, -24 + + # Get attribute y of self + lw $t0, 24($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'y' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8753583567511 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8753583567511 + j object_get_attribute_8753583567511 + int_get_attribute_8753583567511: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($sp) # internal_0 = self.y + j end_get_attribute_8753583567511 + bool_get_attribute_8753583567511: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($sp) # internal_0 = self.y + j end_get_attribute_8753583567511 + object_get_attribute_8753583567511: + sw $t1, 20($sp) # internal_0 = self.y + end_get_attribute_8753583567511: + + # Get attribute y of self + lw $t0, 24($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'y' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8753583567535 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8753583567535 + j object_get_attribute_8753583567535 + int_get_attribute_8753583567535: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($sp) # internal_1 = self.y + j end_get_attribute_8753583567535 + bool_get_attribute_8753583567535: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($sp) # internal_1 = self.y + j end_get_attribute_8753583567535 + object_get_attribute_8753583567535: + sw $t1, 16($sp) # internal_1 = self.y + end_get_attribute_8753583567535: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 12($sp) # internal_2 = address of allocated object Int + + # Allocating Int 4294967295 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4294967295 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_3 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_1 + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing internal_1 + + # Argument internal_3 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_xor + jal function_xor + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_4 = result of function_xor + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_4 + lw $t0, 16($sp) + sw $t0, 4($sp) # Storing internal_4 + + # Argument internal_2 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_4 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_4 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_5 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 24($sp) + + # Freeing space for local variables + addi $sp, $sp, 24 + + jr $ra + + function_reflect_Y_at_Complex: + # Function parameters + # $ra = 28($sp) + # self = 24($sp) + + # Reserving space for local variables + addi $sp, $sp, -24 + + # Get attribute x of self + lw $t0, 24($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'x' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8753583568168 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8753583568168 + j object_get_attribute_8753583568168 + int_get_attribute_8753583568168: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($sp) # internal_0 = self.x + j end_get_attribute_8753583568168 + bool_get_attribute_8753583568168: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($sp) # internal_0 = self.x + j end_get_attribute_8753583568168 + object_get_attribute_8753583568168: + sw $t1, 20($sp) # internal_0 = self.x + end_get_attribute_8753583568168: + + # Get attribute x of self + lw $t0, 24($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'x' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8753583568192 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8753583568192 + j object_get_attribute_8753583568192 + int_get_attribute_8753583568192: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($sp) # internal_1 = self.x + j end_get_attribute_8753583568192 + bool_get_attribute_8753583568192: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($sp) # internal_1 = self.x + j end_get_attribute_8753583568192 + object_get_attribute_8753583568192: + sw $t1, 16($sp) # internal_1 = self.x + end_get_attribute_8753583568192: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 12($sp) # internal_2 = address of allocated object Int + + # Allocating Int 4294967295 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4294967295 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_3 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_1 + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing internal_1 + + # Argument internal_3 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_xor + jal function_xor + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_4 = result of function_xor + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_4 + lw $t0, 16($sp) + sw $t0, 4($sp) # Storing internal_4 + + # Argument internal_2 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_4 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_4 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 12($sp) # internal_5 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 24($sp) + + # Freeing space for local variables + addi $sp, $sp, 24 + + jr $ra + + function_equal_at_Complex: + # Function parameters + # $ra = 76($sp) + # self = 72($sp) + # d = 68($sp) + + # Reserving space for local variables + addi $sp, $sp, -68 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 60($sp) # internal_1 = address of allocated object Int + + # Get attribute x of self + lw $t0, 72($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'x' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8753583568336 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8753583568336 + j object_get_attribute_8753583568336 + int_get_attribute_8753583568336: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 56($sp) # internal_2 = self.x + j end_get_attribute_8753583568336 + bool_get_attribute_8753583568336: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 56($sp) # internal_2 = self.x + j end_get_attribute_8753583568336 + object_get_attribute_8753583568336: + sw $t1, 56($sp) # internal_2 = self.x + end_get_attribute_8753583568336: + + # Allocating Int 14 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 14 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 48($sp) # internal_4 = address of allocated object Int + + # Get method x_value of Complex + lw $t0, 68($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 48($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 44($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument d + lw $t0, 76($sp) + sw $t0, 0($sp) # Storing d + + # Calling function internal_5 + lw $t0, 52($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 60($sp) # internal_3 = result of internal_5 + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 68($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_3 + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 52($sp) # internal_6 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_1 = internal_6 + lw $t0, 40($sp) + sw $t0, 60($sp) + + # If internal_1 then goto then_8753583581175 + lw $t0, 60($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8753583581175 + + # Jumping to else_8753583581175 + j else_8753583581175 + + then_8753583581175: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_8 = address of allocated object Int + + # Get attribute y of self + lw $t0, 72($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'y' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8753583568740 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8753583568740 + j object_get_attribute_8753583568740 + int_get_attribute_8753583568740: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 28($sp) # internal_9 = self.y + j end_get_attribute_8753583568740 + bool_get_attribute_8753583568740: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 28($sp) # internal_9 = self.y + j end_get_attribute_8753583568740 + object_get_attribute_8753583568740: + sw $t1, 28($sp) # internal_9 = self.y + end_get_attribute_8753583568740: + + # Allocating Int 15 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 15 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_11 = address of allocated object Int + + # Get method y_value of Complex + lw $t0, 68($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 20($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 16($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument d + lw $t0, 76($sp) + sw $t0, 0($sp) # Storing d + + # Calling function internal_12 + lw $t0, 24($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 32($sp) # internal_10 = result of internal_12 + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_9 + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing internal_9 + + # Argument internal_10 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_10 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_13 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_8 = internal_13 + lw $t0, 12($sp) + sw $t0, 32($sp) + + # If internal_8 then goto then_8753583581163 + lw $t0, 32($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8753583581163 + + # Jumping to else_8753583581163 + j else_8753583581163 + + then_8753583581163: + + # Allocating Bool 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_14 = address of allocated object Int + + # internal_7 = internal_14 + lw $t0, 8($sp) + sw $t0, 36($sp) + + # Jumping to endif_8753583581163 + j endif_8753583581163 + + else_8753583581163: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_15 = address of allocated object Int + + # internal_7 = internal_15 + lw $t0, 4($sp) + sw $t0, 36($sp) + + # Jumping to endif_8753583581163 + j endif_8753583581163 + + endif_8753583581163: + + # internal_0 = internal_7 + lw $t0, 36($sp) + sw $t0, 64($sp) + + # Jumping to endif_8753583581175 + j endif_8753583581175 + + else_8753583581175: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_16 = address of allocated object Int + + # internal_0 = internal_16 + lw $t0, 0($sp) + sw $t0, 64($sp) + + # Jumping to endif_8753583581175 + j endif_8753583581175 + + endif_8753583581175: + + # Loading return value in $v1 + lw $v1, 64($sp) + + # Freeing space for local variables + addi $sp, $sp, 68 + + jr $ra + + function_x_value_at_Complex: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Get attribute x of self + lw $t0, 4($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'x' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8753583569210 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8753583569210 + j object_get_attribute_8753583569210 + int_get_attribute_8753583569210: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_0 = self.x + j end_get_attribute_8753583569210 + bool_get_attribute_8753583569210: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_0 = self.x + j end_get_attribute_8753583569210 + object_get_attribute_8753583569210: + sw $t1, 0($sp) # internal_0 = self.x + end_get_attribute_8753583569210: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_y_value_at_Complex: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Get attribute y of self + lw $t0, 4($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'y' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8753583569240 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8753583569240 + j object_get_attribute_8753583569240 + int_get_attribute_8753583569240: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_0 = self.y + j end_get_attribute_8753583569240 + bool_get_attribute_8753583569240: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_0 = self.y + j end_get_attribute_8753583569240 + object_get_attribute_8753583569240: + sw $t1, 0($sp) # internal_0 = self.y + end_get_attribute_8753583569240: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + main: + # Reserving space for local variables + addi $sp, $sp, -16 + + # Allocating Main + li $v0, 9 + lw $a0, type_Main + syscall + la $t0, type_Main # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 12($sp) # internal_0 = address of allocated object Main + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_Main + jal function___init___at_Main + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_0 = result of function___init___at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_2 = address of allocated object Int + + # Get method main of Main + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function internal_3 + lw $t0, 8($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_1 = result of internal_3 + addi $sp, $sp, 8 # Freeing space for arguments + + # Exit program + li $v0, 10 + syscall + + \ No newline at end of file diff --git a/tests/codegen/new_complex_output.txt b/tests/codegen/new_complex_output.txt index 0e8da112c..831c23af4 100644 --- a/tests/codegen/new_complex_output.txt +++ b/tests/codegen/new_complex_output.txt @@ -1,2 +1,2 @@ -=) -=) +=) +=) diff --git a/tests/codegen/palindrome.cl b/tests/codegen/palindrome.cl index 7f24789f9..6acbeb731 100755 --- a/tests/codegen/palindrome.cl +++ b/tests/codegen/palindrome.cl @@ -1,25 +1,25 @@ -class Main inherits IO { - pal(s : String) : Bool { - if s.length() = 0 - then true - else if s.length() = 1 - then true - else if s.substr(0, 1) = s.substr(s.length() - 1, 1) - then pal(s.substr(1, s.length() -2)) - else false - fi fi fi - }; - - i : Int; - - main() : IO { - { - i <- ~1; - out_string("enter a string\n"); - if pal(in_string()) - then out_string("that was a palindrome\n") - else out_string("that was not a palindrome\n") - fi; - } - }; -}; +class Main inherits IO { + pal(s : String) : Bool { + if s.length() = 0 + then true + else if s.length() = 1 + then true + else if s.substr(0, 1) = s.substr(s.length() - 1, 1) + then pal(s.substr(1, s.length() -2)) + else false + fi fi fi + }; + + i : Int; + + main() : IO { + { + i <- ~1; + out_string("enter a string\n"); + if pal(in_string()) + then out_string("that was a palindrome\n") + else out_string("that was not a palindrome\n") + fi; + } + }; +}; diff --git a/tests/codegen/palindrome.mips b/tests/codegen/palindrome.mips new file mode 100644 index 000000000..7dae1e29d --- /dev/null +++ b/tests/codegen/palindrome.mips @@ -0,0 +1,2887 @@ +.data + type_Object: .word 24 + type_Object_inherits_from: .word 0 + type_Object_name_address: .word type_Object_name_size + type_Object___init__: .word function___init___at_Object + type_Object_abort: .word function_abort_at_Object + type_Object_type_name: .word function_type_name_at_Object + type_Object_copy: .word function_copy_at_Object + + type_IO: .word 40 + type_IO_inherits_from: .word type_Object + type_IO_name_address: .word type_IO_name_size + type_IO___init__: .word function___init___at_IO + type_IO_abort: .word function_abort_at_Object + type_IO_type_name: .word function_type_name_at_Object + type_IO_copy: .word function_copy_at_Object + type_IO_out_string: .word function_out_string_at_IO + type_IO_out_int: .word function_out_int_at_IO + type_IO_in_string: .word function_in_string_at_IO + type_IO_in_int: .word function_in_int_at_IO + + type_String: .word 36 + type_String_inherits_from: .word type_Object + type_String_name_address: .word type_String_name_size + type_String___init__: .word function___init___at_String + type_String_abort: .word function_abort_at_Object + type_String_type_name: .word function_type_name_at_Object + type_String_copy: .word function_copy_at_Object + type_String_length: .word function_length_at_String + type_String_concat: .word function_concat_at_String + type_String_substr: .word function_substr_at_String + + type_Int: .word 24 + type_Int_inherits_from: .word type_Object + type_Int_name_address: .word type_Int_name_size + type_Int___init__: .word function___init___at_Int + type_Int_abort: .word function_abort_at_Object + type_Int_type_name: .word function_type_name_at_Object + type_Int_copy: .word function_copy_at_Object + + type_Bool: .word 24 + type_Bool_inherits_from: .word type_Object + type_Bool_name_address: .word type_Bool_name_size + type_Bool___init__: .word function___init___at_Bool + type_Bool_abort: .word function_abort_at_Object + type_Bool_type_name: .word function_type_name_at_Object + type_Bool_copy: .word function_copy_at_Object + + type_Main: .word 52 + type_Main_inherits_from: .word type_IO + type_Main_name_address: .word type_Main_name_size + type_Main___init__: .word function___init___at_Main + type_Main_abort: .word function_abort_at_Object + type_Main_type_name: .word function_type_name_at_Object + type_Main_copy: .word function_copy_at_Object + type_Main_out_string: .word function_out_string_at_IO + type_Main_out_int: .word function_out_int_at_IO + type_Main_in_string: .word function_in_string_at_IO + type_Main_in_int: .word function_in_int_at_IO + type_Main_pal: .word function_pal_at_Main + type_Main_main: .word function_main_at_Main + + type_Object_name_size: .word 6 + type_Object_name: .asciiz "Object" + + type_IO_name_size: .word 2 + type_IO_name: .asciiz "IO" + + type_String_name_size: .word 6 + type_String_name: .asciiz "String" + + type_Int_name_size: .word 3 + type_Int_name: .asciiz "Int" + + type_Bool_name_size: .word 4 + type_Bool_name: .asciiz "Bool" + + type_Main_name_size: .word 4 + type_Main_name: .asciiz "Main" + + buffer_input: .space 1024 + debug_log: .asciiz "debug_log\n" + +.text + function_add: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Addition operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + add $t2, $t0, $t1 # $t2 = $t0 + $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_sub: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Subtraction operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sub $t2, $t0, $t1 # $t2 = $t0 - $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_mult: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Multiplication operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + mult $t0, $t1 # $t2 = $t0 * $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_div: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Division operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + div $t0, $t1 # $t2 = $t0 / $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_xor: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Xor operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than_or_equal: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sle $t2, $t0, $t1 # $t2 = $t0 <= $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_equal: + # Function parameters + # $ra = 48($sp) + # a = 44($sp) + # b = 40($sp) + + # Reserving space for local variables + addi $sp, $sp, -40 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_0 = address of allocated object Int + + # Allocating NUll to internal_1 + sw $zero, 32($sp) # internal_1 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_2 = address of allocated object Int + + # internal_2 = EqualAddress(a, internal_1) + lw $t0, 44($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # internal_2 = EqualAddress(b, internal_1) + lw $t0, 40($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # If internal_2 then goto a_is_type_object + lw $t0, 28($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_object + + # internal_3 = typeof a that is the first word of the object + lw $t0, 44($sp) + lw $t0, 0($t0) + sw $t0, 24($sp) + + # internal_4 = direction of Int + la $t0, type_Int + sw $t0, 20($sp) + + # internal_5 = direction of Bool + la $t0, type_Bool + sw $t0, 16($sp) + + # internal_6 = direction of String + la $t0, type_String + sw $t0, 12($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_7 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_8 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_9 = address of allocated object Int + + # internal_7 = EqualAddress(internal_3, internal_4) + lw $t0, 24($sp) + lw $t1, 20($sp) + seq $t2, $t0, $t1 + lw $t0, 8($sp) + sw $t2, 8($t0) + + # internal_8 = EqualAddress(internal_3, internal_5) + lw $t0, 24($sp) + lw $t1, 16($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_9 = EqualAddress(internal_3, internal_6) + lw $t0, 24($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_7 then goto a_is_type_int_or_bool + lw $t0, 8($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_8 then goto a_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_9 then goto a_is_type_string + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_string + + # Jumping to a_is_type_object + j a_is_type_object + + a_is_type_int_or_bool: + + # internal_0 = EqualInt(a, b) + lw $t0, 44($sp) + lw $t0, 8($t0) + lw $t1, 40($sp) + lw $t1, 8($t1) + seq $t2, $t0, $t1 + lw $t0, 36($sp) + sw $t2, 8($t0) + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_string: + + # internal_0 = EqualStr(a, b) + lw $t0, 44($sp) + lw $t1, 40($sp) + addi $t0, $t0, 8 + addi $t1, $t1, 8 + + # By default we assume the strings are equals + addi $t4, $zero, 1 + lw $t5, 36($sp) + sw $t4, 8($t5) + + while_compare_strings_start: + lb $t2, 0($t0) + lb $t3, 0($t1) + beq $t2, $t3, while_compare_strings_update + + # The strings are no equals + lw $t5, 36($sp) + sw $zero, 8($t5) + j while_compare_strings_end + + while_compare_strings_update: + addi $t0, $t0, 1 + addi $t1, $t1, 1 + beq $t2, $zero, while_compare_strings_end + beq $t3, $zero, while_compare_strings_end + j while_compare_strings_start + while_compare_strings_end: + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_object: + + # Equal operation + lw $t0, 44($sp) # Save in $t0 the left operand address + lw $t1, 40($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 36($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Jumping to end_of_equal + j end_of_equal + + end_of_equal: + + # Loading return value in $v1 + lw $v1, 36($sp) + + # Freeing space for local variables + addi $sp, $sp, 40 + + jr $ra + + function_assign: + # Function parameters + # $ra = 36($sp) + # dest = 32($sp) + # source = 28($sp) + + # Reserving space for local variables + addi $sp, $sp, -28 + + # Allocating NUll to internal_0 + sw $zero, 24($sp) # internal_0 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_1 = address of allocated object Int + + # internal_1 = EqualAddress(source, internal_0) + lw $t0, 28($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # internal_1 = EqualAddress(dest, internal_0) + lw $t0, 32($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # If internal_1 then goto source_is_type_object + lw $t0, 20($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_object + + # internal_2 = typeof source that is the first word of the object + lw $t0, 28($sp) + lw $t0, 0($t0) + sw $t0, 16($sp) + + # internal_3 = direction of Int + la $t0, type_Int + sw $t0, 12($sp) + + # internal_4 = direction of Bool + la $t0, type_Bool + sw $t0, 8($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_5 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_6 = address of allocated object Int + + # internal_5 = EqualAddress(internal_2, internal_3) + lw $t0, 16($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_6 = EqualAddress(internal_2, internal_4) + lw $t0, 16($sp) + lw $t1, 8($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_5 then goto source_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # If internal_6 then goto source_is_type_int_or_bool + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # Jumping to source_is_type_object + j source_is_type_object + + source_is_type_int_or_bool: + + # dest = source where source is an integer + li $v0, 9 + addi $a0, $zero, 12 + syscall + lw $t0, 28($sp) # Pointer to source + lw $t1, 0($t0) # $t1 = type of source + lw $t2, 8($t0) # $t2 = value of source + sw $t1, 0($v0) # Save type of dest + sw $a0, 4($v0) # Save size of dest + sw $t2, 8($v0) # Save value of dest + sw $v0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_is_type_object: + + # dest = source + lw $t0, 28($sp) + sw $t0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_end_of_equal: + + # Loading return value in $v1 + lw $v1, 32($sp) + + # Freeing space for local variables + addi $sp, $sp, 28 + + jr $ra + + function___init___at_Object: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_abort_at_Object: + # Function parameters + # $ra = 28($sp) + # self = 24($sp) + + # Reserving space for local variables + addi $sp, $sp, -24 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 33 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 33 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 65 + sb $t0, 8($v0) # internal_0[0] = 'A' + + addi $t0, $zero, 98 + sb $t0, 9($v0) # internal_0[1] = 'b' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_0[2] = 'o' + + addi $t0, $zero, 114 + sb $t0, 11($v0) # internal_0[3] = 'r' + + addi $t0, $zero, 116 + sb $t0, 12($v0) # internal_0[4] = 't' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_0[5] = ' ' + + addi $t0, $zero, 99 + sb $t0, 14($v0) # internal_0[6] = 'c' + + addi $t0, $zero, 97 + sb $t0, 15($v0) # internal_0[7] = 'a' + + addi $t0, $zero, 108 + sb $t0, 16($v0) # internal_0[8] = 'l' + + addi $t0, $zero, 108 + sb $t0, 17($v0) # internal_0[9] = 'l' + + addi $t0, $zero, 101 + sb $t0, 18($v0) # internal_0[10] = 'e' + + addi $t0, $zero, 100 + sb $t0, 19($v0) # internal_0[11] = 'd' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_0[12] = ' ' + + addi $t0, $zero, 102 + sb $t0, 21($v0) # internal_0[13] = 'f' + + addi $t0, $zero, 114 + sb $t0, 22($v0) # internal_0[14] = 'r' + + addi $t0, $zero, 111 + sb $t0, 23($v0) # internal_0[15] = 'o' + + addi $t0, $zero, 109 + sb $t0, 24($v0) # internal_0[16] = 'm' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_0[17] = ' ' + + addi $t0, $zero, 99 + sb $t0, 26($v0) # internal_0[18] = 'c' + + addi $t0, $zero, 108 + sb $t0, 27($v0) # internal_0[19] = 'l' + + addi $t0, $zero, 97 + sb $t0, 28($v0) # internal_0[20] = 'a' + + addi $t0, $zero, 115 + sb $t0, 29($v0) # internal_0[21] = 's' + + addi $t0, $zero, 115 + sb $t0, 30($v0) # internal_0[22] = 's' + + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_0[23] = ' ' + + sb $zero, 32($v0) # Null-terminator at the end of the string + + sw $v0, 20($sp) # internal_0 = "Abort called from class " + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_3[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 8($sp) # internal_3 = "\n" + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method type_name of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_5 + lw $t0, 8($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 24($sp) # internal_1 = result of internal_5 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_1 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_2 = result of internal_5 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_3 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_2 = result of internal_5 + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 12($sp) # $t0 = internal_2 + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the String internal_2 + li $v0, 4 + move $a0, $t0 + syscall + + # Exit program + li $v0, 10 + syscall + + # Loading return value in $v1 + lw $v1, 24($sp) + + # Freeing space for local variables + addi $sp, $sp, 24 + + jr $ra + + function_type_name_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = name of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 8($t1) # $t2 = direction of the type name + la $t3, 4($t2) # $t3 = address of the name + lw $t2, 0($t2) # $t2 = length of the name + + addi $t2, $t2, 9 # Setting space for the type, the size and the null byte + li $v0, 9 + move $a0, $t2 + syscall + addi $t2, $t2, -9 # Restoring space for the type, the size and the null byte + + la $t4, type_String + sw $t4, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t4, $v0, 0 # $t4 = direction of the new string + addi $t4, $t4, 8 # Pointer to the first character of the string + xor $t5, $t5, $t5 # Initializing counter + while_copy_name_start: + beq $t5, $t2, while_copy_name_end + lb $t6, 0($t3) # Loading the character + sb $t6, 0($t4) + addi $t4, $t4, 1 # Incrementing the pointer to the new string + addi $t3, $t3, 1 # Incrementing the pointer to the string in self + addi $t5, $t5, 1 # Incrementing counter + j while_copy_name_start + while_copy_name_end: + + sb $zero, 0($t4) # Setting the null byte + + sw $v0, 0($sp) # Storing the new string in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_copy_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = copy of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 4($t0) # $t2 = length of self in bytes + + # Allocating space for the new object + li $v0, 9 + move $a0, $t2 + syscall + move $t3, $v0 # $t3 = direction of the new object + sw $t1, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + # Initializing the variable of the loop + addi $t0, $t0, 8 # Pointer to the first character of the object + addi $t3, $t3, 8 # Pointer to the first character of the object + addi $t2, $2, -8 # Decrementing in 8 the length of the object + xor $t4, $t4, $t4 # Initializing counter + + # Loop copying the object + while_copy_start: + beq $t4, $t2, while_copy_end + lb $t5, 0($t0) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t0, $t0, 1 # Incrementing the pointer to the object + addi $t3, $t3, 1 # Incrementing the pointer to the new object + addi $t4, $t4, 1 # Incrementing counter + j while_copy_start + while_copy_end: + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_IO: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_out_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + lw $t0, 0($sp) # $t0 = x + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the String x + li $v0, 4 + move $a0, $t0 + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_out_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + # Printing the Int x + li $v0, 1 + lw $a0, 0($sp) + lw $a0, 8($a0) + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_in_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + li $v0, 8 + la $a0, buffer_input + li $a1, 1024 + syscall + + xor $t0, $t0, $t0 # Initializing counter + while_read_start: + lb $t1, buffer_input($t0) # Loading the byte + addi $t2, $zero, 10 + beq $t1, $t2, while_read_end + addi $t2, $zero, 13 + beq $t1, $t2, while_read_end + addi $t0, $t0, 1 # Incrementing counter + j while_read_start + while_read_end: + + addi $t0, $t0, 9 # Adding space for the type, the size and the null byte + li $v0, 9 + move $a0, $t0 + syscall + addi $t0, $t0, -9 # Adding space for the type, the size and the null byte + la $t2, type_String + sw $t2, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t3, $v0, 8 # Pointer to the first character of the string + xor $t4, $t4, $t4 # Initializing counter + + while_copy_from_buffer_start: + beq $t4, $t0, while_copy_from_buffer_end + lb $t5, buffer_input($t4) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t3, $t3, 1 # Imcremeenting pointer + addi $t4, $t4, 1 # Incrementing counter + j while_copy_from_buffer_start + while_copy_from_buffer_end: + + sb $zero, 0($t3) # Storing the null byte + + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_in_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + li $v0, 5 + syscall + lw $t0, 0($sp) + sw $v0, 8($t0) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_String: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_length_at_String: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # internal_0 = length of self + lw $t0, 4($sp) + lw $t1, 4($t0) + addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator + lw $t0, 0($sp) + sw $t1, 8($t0) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_concat_at_String: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + # s = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self + s + lw $t0, 8($sp) + lw $t1, 4($sp) + lw $t2, 4($t0) # $t2 = length of str1 + lw $t3, 4($t1) # $t3 = length of str2 + addi $t2, $t2, -9 + addi $t3, $t3, -9 + add $t4, $t2, $t3 # $t4 = length of str1 + str2 + addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) + + li $v0, 9 + move $a0, $t4 + syscall + addi $t4, $t4, -9 # Restoring $t4 = length of str1 + str2 + add $t5, $zero, $v0 # $t5 = address of the new string object + addi $t5, $t5, 8 # $t5 = address of the first byte of the new string + + la $t8, type_String + sw $t8, 0($v0) # Setting type in the first word of th object + + sw $a0, 4($v0) # Setting length of the string in the second word of the object + + # Copying str1 to the new string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_str1_start: + beq $t6, $t2, while_copy_str1_end + lb $t7, 8($t0) + sb $t7, 0($t5) + add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str1_start + while_copy_str1_end: + + # Copying str2 to the new string + while_copy_str2_start: + beq $t6, $t4, while_copy_str2_end + lb $t7, 8($t1) + sb $t7, 0($t5) + add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str2_start + while_copy_str2_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self + s + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_substr_at_String: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + # i = 8($sp) + # l = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self[i:i + l] + lw $t0, 12($sp) # $t0 = address of the string + lw $t1, 4($t0) # $t1 = length of the string + addi $t1, $t1, -9 # $t1 = length of the string + 9 + lw $t2, 8($sp) # $t2 = start of the substring + lw $t2, 8($t2) + lw $t3, 4($sp) # $t3 = length of the substring + lw $t3, 8($t3) + add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring + + bgt $t4, $t1, substring_out_of_bounds + + addi $t3, $t3, 9 + li $v0, 9 + move $a0, $t3 + syscall + addi $t3, $t3, -9 + + la $t5, type_String + sw $t5, 0($v0) # Setting type in the first word of the object + + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t0, $t0, 8 # pointing to the first byte of the string + add $t0, $t0, $t2 # pointing to the first byte of the substring + move $t5, $v0 # $t5 = address of the new string + add $t5, $t5, 8 # pointing to the first byte of the string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_substr_start: + beq $t6, $t3, while_copy_substr_end + lb $t7, 0($t0) + sb $t7, 0($t5) + addi $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of the string + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_substr_start + while_copy_substr_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self[i:i + l] + j substring_not_out_of_bounds + + substring_out_of_bounds: + li $v0, 17 + addi $a0, $zero, 1 + syscall + + substring_not_out_of_bounds: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_Int: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function___init___at_Bool: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function___init___at_Main: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Set attribute i of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8768235507348 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8768235507348 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8768235507348 + j object_set_attribute_8768235507348 + int_set_attribute_8768235507348: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.i = internal_0 + j end_set_attribute_8768235507348 + bool_set_attribute_8768235507348: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.i = internal_0 + j end_set_attribute_8768235507348 + object_set_attribute_8768235507348: + sw $t1, 8($t0) # self.i = internal_0 + end_set_attribute_8768235507348: + + # Loading return value in $v1 + lw $v1, 4($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_pal_at_Main: + # Function parameters + # $ra = 192($sp) + # self = 188($sp) + # s = 184($sp) + + # Reserving space for local variables + addi $sp, $sp, -184 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 176($sp) # internal_1 = address of allocated object Int + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 168($sp) # internal_3 = address of allocated object Int + + # Get method length of String + lw $t0, 184($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 168($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 164($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument s + lw $t0, 192($sp) + sw $t0, 0($sp) # Storing s + + # Calling function internal_4 + lw $t0, 172($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 180($sp) # internal_2 = result of internal_4 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 160($sp) # internal_5 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 184($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_5 + lw $t0, 172($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 168($sp) # internal_6 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_1 = internal_6 + lw $t0, 156($sp) + sw $t0, 176($sp) + + # If internal_1 then goto then_8768235527467 + lw $t0, 176($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8768235527467 + + # Jumping to else_8768235527467 + j else_8768235527467 + + then_8768235527467: + + # Allocating Bool 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 152($sp) # internal_7 = address of allocated object Int + + # internal_0 = internal_7 + lw $t0, 152($sp) + sw $t0, 180($sp) + + # Jumping to endif_8768235527467 + j endif_8768235527467 + + else_8768235527467: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 144($sp) # internal_9 = address of allocated object Int + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 136($sp) # internal_11 = address of allocated object Int + + # Get method length of String + lw $t0, 184($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 136($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 132($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument s + lw $t0, 192($sp) + sw $t0, 0($sp) # Storing s + + # Calling function internal_12 + lw $t0, 140($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 148($sp) # internal_10 = result of internal_12 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 128($sp) # internal_13 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_10 + lw $t0, 152($sp) + sw $t0, 4($sp) # Storing internal_10 + + # Argument internal_13 + lw $t0, 140($sp) + sw $t0, 0($sp) # Storing internal_13 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 136($sp) # internal_14 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_9 = internal_14 + lw $t0, 124($sp) + sw $t0, 144($sp) + + # If internal_9 then goto then_8768235527449 + lw $t0, 144($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8768235527449 + + # Jumping to else_8768235527449 + j else_8768235527449 + + then_8768235527449: + + # Allocating Bool 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 120($sp) # internal_15 = address of allocated object Int + + # internal_8 = internal_15 + lw $t0, 120($sp) + sw $t0, 148($sp) + + # Jumping to endif_8768235527449 + j endif_8768235527449 + + else_8768235527449: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 112($sp) # internal_17 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 108($sp) # internal_18 = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 104($sp) # internal_19 = address of allocated object Int + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 96($sp) # internal_21 = address of allocated object Int + + # Get method substr of String + lw $t0, 184($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 96($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 92($sp) + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument s + lw $t0, 200($sp) + sw $t0, 8($sp) # Storing s + + # Argument internal_18 + lw $t0, 124($sp) + sw $t0, 4($sp) # Storing internal_18 + + # Argument internal_19 + lw $t0, 120($sp) + sw $t0, 0($sp) # Storing internal_19 + + # Calling function internal_22 + lw $t0, 108($sp) + jalr $t0 + lw $ra, 12($sp) + sw $v1, 116($sp) # internal_20 = result of internal_22 + addi $sp, $sp, 16 # Freeing space for arguments + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 84($sp) # internal_24 = address of allocated object Int + + # Get method length of String + lw $t0, 184($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 84($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 80($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument s + lw $t0, 192($sp) + sw $t0, 0($sp) # Storing s + + # Calling function internal_25 + lw $t0, 88($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 96($sp) # internal_23 = result of internal_25 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 76($sp) # internal_26 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_23 + lw $t0, 100($sp) + sw $t0, 4($sp) # Storing internal_23 + + # Argument internal_26 + lw $t0, 88($sp) + sw $t0, 0($sp) # Storing internal_26 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 84($sp) # internal_27 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 68($sp) # internal_28 = address of allocated object Int + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 60($sp) # internal_30 = address of allocated object Int + + # Get method substr of String + lw $t0, 184($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 60($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 56($sp) + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument s + lw $t0, 200($sp) + sw $t0, 8($sp) # Storing s + + # Argument internal_27 + lw $t0, 88($sp) + sw $t0, 4($sp) # Storing internal_27 + + # Argument internal_28 + lw $t0, 84($sp) + sw $t0, 0($sp) # Storing internal_28 + + # Calling function internal_31 + lw $t0, 72($sp) + jalr $t0 + lw $ra, 12($sp) + sw $v1, 80($sp) # internal_29 = result of internal_31 + addi $sp, $sp, 16 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_20 + lw $t0, 112($sp) + sw $t0, 4($sp) # Storing internal_20 + + # Argument internal_29 + lw $t0, 76($sp) + sw $t0, 0($sp) # Storing internal_29 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 64($sp) # internal_32 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_17 = internal_32 + lw $t0, 52($sp) + sw $t0, 112($sp) + + # If internal_17 then goto then_8768235527452 + lw $t0, 112($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8768235527452 + + # Jumping to else_8768235527452 + j else_8768235527452 + + then_8768235527452: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 48($sp) # internal_33 = address of allocated object Int + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_35 = address of allocated object Int + + # Get method length of String + lw $t0, 184($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 40($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 36($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument s + lw $t0, 192($sp) + sw $t0, 0($sp) # Storing s + + # Calling function internal_36 + lw $t0, 44($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 52($sp) # internal_34 = result of internal_36 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_37 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_34 + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing internal_34 + + # Argument internal_37 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_37 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 40($sp) # internal_38 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_40 = address of allocated object Int + + # Get method substr of String + lw $t0, 184($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 20($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 16($sp) + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument s + lw $t0, 200($sp) + sw $t0, 8($sp) # Storing s + + # Argument internal_33 + lw $t0, 64($sp) + sw $t0, 4($sp) # Storing internal_33 + + # Argument internal_38 + lw $t0, 44($sp) + sw $t0, 0($sp) # Storing internal_38 + + # Calling function internal_41 + lw $t0, 32($sp) + jalr $t0 + lw $ra, 12($sp) + sw $v1, 40($sp) # internal_39 = result of internal_41 + addi $sp, $sp, 16 # Freeing space for arguments + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_43 = address of allocated object Int + + # Get method pal of Main + lw $t0, 188($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 8($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 4($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 200($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_39 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_39 + + # Calling function internal_44 + lw $t0, 16($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_42 = result of internal_44 + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_16 = internal_42 + lw $t0, 12($sp) + sw $t0, 116($sp) + + # Jumping to endif_8768235527452 + j endif_8768235527452 + + else_8768235527452: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_45 = address of allocated object Int + + # internal_16 = internal_45 + lw $t0, 0($sp) + sw $t0, 116($sp) + + # Jumping to endif_8768235527452 + j endif_8768235527452 + + endif_8768235527452: + + # internal_8 = internal_16 + lw $t0, 116($sp) + sw $t0, 148($sp) + + # Jumping to endif_8768235527449 + j endif_8768235527449 + + endif_8768235527449: + + # internal_0 = internal_8 + lw $t0, 148($sp) + sw $t0, 180($sp) + + # Jumping to endif_8768235527467 + j endif_8768235527467 + + endif_8768235527467: + + # Loading return value in $v1 + lw $v1, 180($sp) + + # Freeing space for local variables + addi $sp, $sp, 184 + + jr $ra + + function_main_at_Main: + # Function parameters + # $ra = 100($sp) + # self = 96($sp) + + # Reserving space for local variables + addi $sp, $sp, -96 + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 92($sp) # internal_0 = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 88($sp) # internal_1 = address of allocated object Int + + # Allocating Int 4294967295 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4294967295 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 84($sp) # internal_2 = address of allocated object Int + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 80($sp) # internal_3 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 104($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_2 + lw $t0, 96($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_xor + jal function_xor + lw $ra, 8($sp) + sw $v1, 92($sp) # internal_3 = result of function_xor + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_3 + lw $t0, 92($sp) + sw $t0, 4($sp) # Storing internal_3 + + # Argument internal_1 + lw $t0, 100($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 92($sp) # internal_3 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Set attribute i of self + lw $t0, 96($sp) # $t0 = self + lw $t1, 80($sp) # $t1 = internal_3 + beq $t1, $zero, object_set_attribute_8768235510655 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8768235510655 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8768235510655 + j object_set_attribute_8768235510655 + int_set_attribute_8768235510655: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.i = internal_3 + j end_set_attribute_8768235510655 + bool_set_attribute_8768235510655: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.i = internal_3 + j end_set_attribute_8768235510655 + object_set_attribute_8768235510655: + sw $t1, 8($t0) # self.i = internal_3 + end_set_attribute_8768235510655: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 24 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 24 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 101 + sb $t0, 8($v0) # internal_4[0] = 'e' + + addi $t0, $zero, 110 + sb $t0, 9($v0) # internal_4[1] = 'n' + + addi $t0, $zero, 116 + sb $t0, 10($v0) # internal_4[2] = 't' + + addi $t0, $zero, 101 + sb $t0, 11($v0) # internal_4[3] = 'e' + + addi $t0, $zero, 114 + sb $t0, 12($v0) # internal_4[4] = 'r' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_4[5] = ' ' + + addi $t0, $zero, 97 + sb $t0, 14($v0) # internal_4[6] = 'a' + + addi $t0, $zero, 32 + sb $t0, 15($v0) # internal_4[7] = ' ' + + addi $t0, $zero, 115 + sb $t0, 16($v0) # internal_4[8] = 's' + + addi $t0, $zero, 116 + sb $t0, 17($v0) # internal_4[9] = 't' + + addi $t0, $zero, 114 + sb $t0, 18($v0) # internal_4[10] = 'r' + + addi $t0, $zero, 105 + sb $t0, 19($v0) # internal_4[11] = 'i' + + addi $t0, $zero, 110 + sb $t0, 20($v0) # internal_4[12] = 'n' + + addi $t0, $zero, 103 + sb $t0, 21($v0) # internal_4[13] = 'g' + + addi $t0, $zero, 10 + sb $t0, 22($v0) # internal_4[14] = '\n' + + sb $zero, 23($v0) # Null-terminator at the end of the string + + sw $v0, 76($sp) # internal_4 = "enter a string\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 68($sp) # internal_6 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 96($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 68($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 64($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 108($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_4 + lw $t0, 88($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function internal_7 + lw $t0, 76($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 84($sp) # internal_5 = result of internal_7 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 56($sp) # internal_9 = address of allocated object Int + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 48($sp) # internal_11 = address of allocated object Int + + # Get method in_string of Main + lw $t0, 96($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 48($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 44($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 104($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_12 + lw $t0, 52($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 60($sp) # internal_10 = result of internal_12 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_14 = address of allocated object Int + + # Get method pal of Main + lw $t0, 96($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 36($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 32($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 108($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_10 + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing internal_10 + + # Calling function internal_15 + lw $t0, 44($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 52($sp) # internal_13 = result of internal_15 + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_9 = internal_13 + lw $t0, 40($sp) + sw $t0, 56($sp) + + # If internal_9 then goto then_8768235527533 + lw $t0, 56($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8768235527533 + + # Jumping to else_8768235527533 + j else_8768235527533 + + then_8768235527533: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 31 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 31 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 116 + sb $t0, 8($v0) # internal_16[0] = 't' + + addi $t0, $zero, 104 + sb $t0, 9($v0) # internal_16[1] = 'h' + + addi $t0, $zero, 97 + sb $t0, 10($v0) # internal_16[2] = 'a' + + addi $t0, $zero, 116 + sb $t0, 11($v0) # internal_16[3] = 't' + + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_16[4] = ' ' + + addi $t0, $zero, 119 + sb $t0, 13($v0) # internal_16[5] = 'w' + + addi $t0, $zero, 97 + sb $t0, 14($v0) # internal_16[6] = 'a' + + addi $t0, $zero, 115 + sb $t0, 15($v0) # internal_16[7] = 's' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_16[8] = ' ' + + addi $t0, $zero, 97 + sb $t0, 17($v0) # internal_16[9] = 'a' + + addi $t0, $zero, 32 + sb $t0, 18($v0) # internal_16[10] = ' ' + + addi $t0, $zero, 112 + sb $t0, 19($v0) # internal_16[11] = 'p' + + addi $t0, $zero, 97 + sb $t0, 20($v0) # internal_16[12] = 'a' + + addi $t0, $zero, 108 + sb $t0, 21($v0) # internal_16[13] = 'l' + + addi $t0, $zero, 105 + sb $t0, 22($v0) # internal_16[14] = 'i' + + addi $t0, $zero, 110 + sb $t0, 23($v0) # internal_16[15] = 'n' + + addi $t0, $zero, 100 + sb $t0, 24($v0) # internal_16[16] = 'd' + + addi $t0, $zero, 114 + sb $t0, 25($v0) # internal_16[17] = 'r' + + addi $t0, $zero, 111 + sb $t0, 26($v0) # internal_16[18] = 'o' + + addi $t0, $zero, 109 + sb $t0, 27($v0) # internal_16[19] = 'm' + + addi $t0, $zero, 101 + sb $t0, 28($v0) # internal_16[20] = 'e' + + addi $t0, $zero, 10 + sb $t0, 29($v0) # internal_16[21] = '\n' + + sb $zero, 30($v0) # Null-terminator at the end of the string + + sw $v0, 28($sp) # internal_16 = "that was a palindrome\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_18 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 96($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 20($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 16($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 108($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_16 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_16 + + # Calling function internal_19 + lw $t0, 28($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_17 = result of internal_19 + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_8 = internal_17 + lw $t0, 24($sp) + sw $t0, 60($sp) + + # Jumping to endif_8768235527533 + j endif_8768235527533 + + else_8768235527533: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 35 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 35 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 116 + sb $t0, 8($v0) # internal_20[0] = 't' + + addi $t0, $zero, 104 + sb $t0, 9($v0) # internal_20[1] = 'h' + + addi $t0, $zero, 97 + sb $t0, 10($v0) # internal_20[2] = 'a' + + addi $t0, $zero, 116 + sb $t0, 11($v0) # internal_20[3] = 't' + + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_20[4] = ' ' + + addi $t0, $zero, 119 + sb $t0, 13($v0) # internal_20[5] = 'w' + + addi $t0, $zero, 97 + sb $t0, 14($v0) # internal_20[6] = 'a' + + addi $t0, $zero, 115 + sb $t0, 15($v0) # internal_20[7] = 's' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_20[8] = ' ' + + addi $t0, $zero, 110 + sb $t0, 17($v0) # internal_20[9] = 'n' + + addi $t0, $zero, 111 + sb $t0, 18($v0) # internal_20[10] = 'o' + + addi $t0, $zero, 116 + sb $t0, 19($v0) # internal_20[11] = 't' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_20[12] = ' ' + + addi $t0, $zero, 97 + sb $t0, 21($v0) # internal_20[13] = 'a' + + addi $t0, $zero, 32 + sb $t0, 22($v0) # internal_20[14] = ' ' + + addi $t0, $zero, 112 + sb $t0, 23($v0) # internal_20[15] = 'p' + + addi $t0, $zero, 97 + sb $t0, 24($v0) # internal_20[16] = 'a' + + addi $t0, $zero, 108 + sb $t0, 25($v0) # internal_20[17] = 'l' + + addi $t0, $zero, 105 + sb $t0, 26($v0) # internal_20[18] = 'i' + + addi $t0, $zero, 110 + sb $t0, 27($v0) # internal_20[19] = 'n' + + addi $t0, $zero, 100 + sb $t0, 28($v0) # internal_20[20] = 'd' + + addi $t0, $zero, 114 + sb $t0, 29($v0) # internal_20[21] = 'r' + + addi $t0, $zero, 111 + sb $t0, 30($v0) # internal_20[22] = 'o' + + addi $t0, $zero, 109 + sb $t0, 31($v0) # internal_20[23] = 'm' + + addi $t0, $zero, 101 + sb $t0, 32($v0) # internal_20[24] = 'e' + + addi $t0, $zero, 10 + sb $t0, 33($v0) # internal_20[25] = '\n' + + sb $zero, 34($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_20 = "that was not a palindrome\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_22 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 96($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 108($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_20 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_20 + + # Calling function internal_23 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_21 = result of internal_23 + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_8 = internal_21 + lw $t0, 8($sp) + sw $t0, 60($sp) + + # Jumping to endif_8768235527533 + j endif_8768235527533 + + endif_8768235527533: + + # Loading return value in $v1 + lw $v1, 60($sp) + + # Freeing space for local variables + addi $sp, $sp, 96 + + jr $ra + + main: + # Reserving space for local variables + addi $sp, $sp, -16 + + # Allocating Main + li $v0, 9 + lw $a0, type_Main + syscall + la $t0, type_Main # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 12($sp) # internal_0 = address of allocated object Main + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_Main + jal function___init___at_Main + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_0 = result of function___init___at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_2 = address of allocated object Int + + # Get method main of Main + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function internal_3 + lw $t0, 8($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_1 = result of internal_3 + addi $sp, $sp, 8 # Freeing space for arguments + + # Exit program + li $v0, 10 + syscall + + \ No newline at end of file diff --git a/tests/codegen/palindrome_input.txt b/tests/codegen/palindrome_input.txt index 8e1b64142..c49a0114c 100644 --- a/tests/codegen/palindrome_input.txt +++ b/tests/codegen/palindrome_input.txt @@ -1 +1 @@ -anitalabalatina +anitalabalatina diff --git a/tests/codegen/palindrome_output.txt b/tests/codegen/palindrome_output.txt index 7a0095959..e93d36585 100644 --- a/tests/codegen/palindrome_output.txt +++ b/tests/codegen/palindrome_output.txt @@ -1,2 +1,2 @@ -enter a string -that was a palindrome +enter a string +that was a palindrome diff --git a/tests/codegen/primes.mips b/tests/codegen/primes.mips new file mode 100644 index 000000000..29fb03b3c --- /dev/null +++ b/tests/codegen/primes.mips @@ -0,0 +1,3405 @@ +.data + type_Object: .word 24 + type_Object_inherits_from: .word 0 + type_Object_name_address: .word type_Object_name_size + type_Object___init__: .word function___init___at_Object + type_Object_abort: .word function_abort_at_Object + type_Object_type_name: .word function_type_name_at_Object + type_Object_copy: .word function_copy_at_Object + + type_IO: .word 40 + type_IO_inherits_from: .word type_Object + type_IO_name_address: .word type_IO_name_size + type_IO___init__: .word function___init___at_IO + type_IO_abort: .word function_abort_at_Object + type_IO_type_name: .word function_type_name_at_Object + type_IO_copy: .word function_copy_at_Object + type_IO_out_string: .word function_out_string_at_IO + type_IO_out_int: .word function_out_int_at_IO + type_IO_in_string: .word function_in_string_at_IO + type_IO_in_int: .word function_in_int_at_IO + + type_String: .word 36 + type_String_inherits_from: .word type_Object + type_String_name_address: .word type_String_name_size + type_String___init__: .word function___init___at_String + type_String_abort: .word function_abort_at_Object + type_String_type_name: .word function_type_name_at_Object + type_String_copy: .word function_copy_at_Object + type_String_length: .word function_length_at_String + type_String_concat: .word function_concat_at_String + type_String_substr: .word function_substr_at_String + + type_Int: .word 24 + type_Int_inherits_from: .word type_Object + type_Int_name_address: .word type_Int_name_size + type_Int___init__: .word function___init___at_Int + type_Int_abort: .word function_abort_at_Object + type_Int_type_name: .word function_type_name_at_Object + type_Int_copy: .word function_copy_at_Object + + type_Bool: .word 24 + type_Bool_inherits_from: .word type_Object + type_Bool_name_address: .word type_Bool_name_size + type_Bool___init__: .word function___init___at_Bool + type_Bool_abort: .word function_abort_at_Object + type_Bool_type_name: .word function_type_name_at_Object + type_Bool_copy: .word function_copy_at_Object + + type_Main: .word 64 + type_Main_inherits_from: .word type_IO + type_Main_name_address: .word type_Main_name_size + type_Main___init__: .word function___init___at_Main + type_Main_abort: .word function_abort_at_Object + type_Main_type_name: .word function_type_name_at_Object + type_Main_copy: .word function_copy_at_Object + type_Main_out_string: .word function_out_string_at_IO + type_Main_out_int: .word function_out_int_at_IO + type_Main_in_string: .word function_in_string_at_IO + type_Main_in_int: .word function_in_int_at_IO + type_Main_main: .word function_main_at_Main + + type_Object_name_size: .word 6 + type_Object_name: .asciiz "Object" + + type_IO_name_size: .word 2 + type_IO_name: .asciiz "IO" + + type_String_name_size: .word 6 + type_String_name: .asciiz "String" + + type_Int_name_size: .word 3 + type_Int_name: .asciiz "Int" + + type_Bool_name_size: .word 4 + type_Bool_name: .asciiz "Bool" + + type_Main_name_size: .word 4 + type_Main_name: .asciiz "Main" + + buffer_input: .space 1024 + debug_log: .asciiz "debug_log\n" + +.text + function_add: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Addition operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + add $t2, $t0, $t1 # $t2 = $t0 + $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_sub: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Subtraction operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sub $t2, $t0, $t1 # $t2 = $t0 - $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_mult: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Multiplication operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + mult $t0, $t1 # $t2 = $t0 * $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_div: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Division operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + div $t0, $t1 # $t2 = $t0 / $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_xor: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Xor operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than_or_equal: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sle $t2, $t0, $t1 # $t2 = $t0 <= $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_equal: + # Function parameters + # $ra = 48($sp) + # a = 44($sp) + # b = 40($sp) + + # Reserving space for local variables + addi $sp, $sp, -40 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_0 = address of allocated object Int + + # Allocating NUll to internal_1 + sw $zero, 32($sp) # internal_1 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_2 = address of allocated object Int + + # internal_2 = EqualAddress(a, internal_1) + lw $t0, 44($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # internal_2 = EqualAddress(b, internal_1) + lw $t0, 40($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # If internal_2 then goto a_is_type_object + lw $t0, 28($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_object + + # internal_3 = typeof a that is the first word of the object + lw $t0, 44($sp) + lw $t0, 0($t0) + sw $t0, 24($sp) + + # internal_4 = direction of Int + la $t0, type_Int + sw $t0, 20($sp) + + # internal_5 = direction of Bool + la $t0, type_Bool + sw $t0, 16($sp) + + # internal_6 = direction of String + la $t0, type_String + sw $t0, 12($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_7 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_8 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_9 = address of allocated object Int + + # internal_7 = EqualAddress(internal_3, internal_4) + lw $t0, 24($sp) + lw $t1, 20($sp) + seq $t2, $t0, $t1 + lw $t0, 8($sp) + sw $t2, 8($t0) + + # internal_8 = EqualAddress(internal_3, internal_5) + lw $t0, 24($sp) + lw $t1, 16($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_9 = EqualAddress(internal_3, internal_6) + lw $t0, 24($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_7 then goto a_is_type_int_or_bool + lw $t0, 8($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_8 then goto a_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_9 then goto a_is_type_string + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_string + + # Jumping to a_is_type_object + j a_is_type_object + + a_is_type_int_or_bool: + + # internal_0 = EqualInt(a, b) + lw $t0, 44($sp) + lw $t0, 8($t0) + lw $t1, 40($sp) + lw $t1, 8($t1) + seq $t2, $t0, $t1 + lw $t0, 36($sp) + sw $t2, 8($t0) + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_string: + + # internal_0 = EqualStr(a, b) + lw $t0, 44($sp) + lw $t1, 40($sp) + addi $t0, $t0, 8 + addi $t1, $t1, 8 + + # By default we assume the strings are equals + addi $t4, $zero, 1 + lw $t5, 36($sp) + sw $t4, 8($t5) + + while_compare_strings_start: + lb $t2, 0($t0) + lb $t3, 0($t1) + beq $t2, $t3, while_compare_strings_update + + # The strings are no equals + lw $t5, 36($sp) + sw $zero, 8($t5) + j while_compare_strings_end + + while_compare_strings_update: + addi $t0, $t0, 1 + addi $t1, $t1, 1 + beq $t2, $zero, while_compare_strings_end + beq $t3, $zero, while_compare_strings_end + j while_compare_strings_start + while_compare_strings_end: + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_object: + + # Equal operation + lw $t0, 44($sp) # Save in $t0 the left operand address + lw $t1, 40($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 36($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Jumping to end_of_equal + j end_of_equal + + end_of_equal: + + # Loading return value in $v1 + lw $v1, 36($sp) + + # Freeing space for local variables + addi $sp, $sp, 40 + + jr $ra + + function_assign: + # Function parameters + # $ra = 36($sp) + # dest = 32($sp) + # source = 28($sp) + + # Reserving space for local variables + addi $sp, $sp, -28 + + # Allocating NUll to internal_0 + sw $zero, 24($sp) # internal_0 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_1 = address of allocated object Int + + # internal_1 = EqualAddress(source, internal_0) + lw $t0, 28($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # internal_1 = EqualAddress(dest, internal_0) + lw $t0, 32($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # If internal_1 then goto source_is_type_object + lw $t0, 20($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_object + + # internal_2 = typeof source that is the first word of the object + lw $t0, 28($sp) + lw $t0, 0($t0) + sw $t0, 16($sp) + + # internal_3 = direction of Int + la $t0, type_Int + sw $t0, 12($sp) + + # internal_4 = direction of Bool + la $t0, type_Bool + sw $t0, 8($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_5 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_6 = address of allocated object Int + + # internal_5 = EqualAddress(internal_2, internal_3) + lw $t0, 16($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_6 = EqualAddress(internal_2, internal_4) + lw $t0, 16($sp) + lw $t1, 8($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_5 then goto source_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # If internal_6 then goto source_is_type_int_or_bool + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # Jumping to source_is_type_object + j source_is_type_object + + source_is_type_int_or_bool: + + # dest = source where source is an integer + li $v0, 9 + addi $a0, $zero, 12 + syscall + lw $t0, 28($sp) # Pointer to source + lw $t1, 0($t0) # $t1 = type of source + lw $t2, 8($t0) # $t2 = value of source + sw $t1, 0($v0) # Save type of dest + sw $a0, 4($v0) # Save size of dest + sw $t2, 8($v0) # Save value of dest + sw $v0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_is_type_object: + + # dest = source + lw $t0, 28($sp) + sw $t0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_end_of_equal: + + # Loading return value in $v1 + lw $v1, 32($sp) + + # Freeing space for local variables + addi $sp, $sp, 28 + + jr $ra + + function___init___at_Object: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_abort_at_Object: + # Function parameters + # $ra = 28($sp) + # self = 24($sp) + + # Reserving space for local variables + addi $sp, $sp, -24 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 33 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 33 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 65 + sb $t0, 8($v0) # internal_0[0] = 'A' + + addi $t0, $zero, 98 + sb $t0, 9($v0) # internal_0[1] = 'b' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_0[2] = 'o' + + addi $t0, $zero, 114 + sb $t0, 11($v0) # internal_0[3] = 'r' + + addi $t0, $zero, 116 + sb $t0, 12($v0) # internal_0[4] = 't' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_0[5] = ' ' + + addi $t0, $zero, 99 + sb $t0, 14($v0) # internal_0[6] = 'c' + + addi $t0, $zero, 97 + sb $t0, 15($v0) # internal_0[7] = 'a' + + addi $t0, $zero, 108 + sb $t0, 16($v0) # internal_0[8] = 'l' + + addi $t0, $zero, 108 + sb $t0, 17($v0) # internal_0[9] = 'l' + + addi $t0, $zero, 101 + sb $t0, 18($v0) # internal_0[10] = 'e' + + addi $t0, $zero, 100 + sb $t0, 19($v0) # internal_0[11] = 'd' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_0[12] = ' ' + + addi $t0, $zero, 102 + sb $t0, 21($v0) # internal_0[13] = 'f' + + addi $t0, $zero, 114 + sb $t0, 22($v0) # internal_0[14] = 'r' + + addi $t0, $zero, 111 + sb $t0, 23($v0) # internal_0[15] = 'o' + + addi $t0, $zero, 109 + sb $t0, 24($v0) # internal_0[16] = 'm' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_0[17] = ' ' + + addi $t0, $zero, 99 + sb $t0, 26($v0) # internal_0[18] = 'c' + + addi $t0, $zero, 108 + sb $t0, 27($v0) # internal_0[19] = 'l' + + addi $t0, $zero, 97 + sb $t0, 28($v0) # internal_0[20] = 'a' + + addi $t0, $zero, 115 + sb $t0, 29($v0) # internal_0[21] = 's' + + addi $t0, $zero, 115 + sb $t0, 30($v0) # internal_0[22] = 's' + + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_0[23] = ' ' + + sb $zero, 32($v0) # Null-terminator at the end of the string + + sw $v0, 20($sp) # internal_0 = "Abort called from class " + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_3[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 8($sp) # internal_3 = "\n" + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method type_name of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_5 + lw $t0, 8($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 24($sp) # internal_1 = result of internal_5 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_1 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_2 = result of internal_5 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_3 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_2 = result of internal_5 + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 12($sp) # $t0 = internal_2 + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the String internal_2 + li $v0, 4 + move $a0, $t0 + syscall + + # Exit program + li $v0, 10 + syscall + + # Loading return value in $v1 + lw $v1, 24($sp) + + # Freeing space for local variables + addi $sp, $sp, 24 + + jr $ra + + function_type_name_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = name of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 8($t1) # $t2 = direction of the type name + la $t3, 4($t2) # $t3 = address of the name + lw $t2, 0($t2) # $t2 = length of the name + + addi $t2, $t2, 9 # Setting space for the type, the size and the null byte + li $v0, 9 + move $a0, $t2 + syscall + addi $t2, $t2, -9 # Restoring space for the type, the size and the null byte + + la $t4, type_String + sw $t4, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t4, $v0, 0 # $t4 = direction of the new string + addi $t4, $t4, 8 # Pointer to the first character of the string + xor $t5, $t5, $t5 # Initializing counter + while_copy_name_start: + beq $t5, $t2, while_copy_name_end + lb $t6, 0($t3) # Loading the character + sb $t6, 0($t4) + addi $t4, $t4, 1 # Incrementing the pointer to the new string + addi $t3, $t3, 1 # Incrementing the pointer to the string in self + addi $t5, $t5, 1 # Incrementing counter + j while_copy_name_start + while_copy_name_end: + + sb $zero, 0($t4) # Setting the null byte + + sw $v0, 0($sp) # Storing the new string in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_copy_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = copy of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 4($t0) # $t2 = length of self in bytes + + # Allocating space for the new object + li $v0, 9 + move $a0, $t2 + syscall + move $t3, $v0 # $t3 = direction of the new object + sw $t1, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + # Initializing the variable of the loop + addi $t0, $t0, 8 # Pointer to the first character of the object + addi $t3, $t3, 8 # Pointer to the first character of the object + addi $t2, $2, -8 # Decrementing in 8 the length of the object + xor $t4, $t4, $t4 # Initializing counter + + # Loop copying the object + while_copy_start: + beq $t4, $t2, while_copy_end + lb $t5, 0($t0) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t0, $t0, 1 # Incrementing the pointer to the object + addi $t3, $t3, 1 # Incrementing the pointer to the new object + addi $t4, $t4, 1 # Incrementing counter + j while_copy_start + while_copy_end: + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_IO: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_out_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + lw $t0, 0($sp) # $t0 = x + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the String x + li $v0, 4 + move $a0, $t0 + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_out_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + # Printing the Int x + li $v0, 1 + lw $a0, 0($sp) + lw $a0, 8($a0) + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_in_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + li $v0, 8 + la $a0, buffer_input + li $a1, 1024 + syscall + + xor $t0, $t0, $t0 # Initializing counter + while_read_start: + lb $t1, buffer_input($t0) # Loading the byte + addi $t2, $zero, 10 + beq $t1, $t2, while_read_end + addi $t2, $zero, 13 + beq $t1, $t2, while_read_end + addi $t0, $t0, 1 # Incrementing counter + j while_read_start + while_read_end: + + addi $t0, $t0, 9 # Adding space for the type, the size and the null byte + li $v0, 9 + move $a0, $t0 + syscall + addi $t0, $t0, -9 # Adding space for the type, the size and the null byte + la $t2, type_String + sw $t2, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t3, $v0, 8 # Pointer to the first character of the string + xor $t4, $t4, $t4 # Initializing counter + + while_copy_from_buffer_start: + beq $t4, $t0, while_copy_from_buffer_end + lb $t5, buffer_input($t4) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t3, $t3, 1 # Imcremeenting pointer + addi $t4, $t4, 1 # Incrementing counter + j while_copy_from_buffer_start + while_copy_from_buffer_end: + + sb $zero, 0($t3) # Storing the null byte + + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_in_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + li $v0, 5 + syscall + lw $t0, 0($sp) + sw $v0, 8($t0) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_String: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_length_at_String: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # internal_0 = length of self + lw $t0, 4($sp) + lw $t1, 4($t0) + addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator + lw $t0, 0($sp) + sw $t1, 8($t0) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_concat_at_String: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + # s = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self + s + lw $t0, 8($sp) + lw $t1, 4($sp) + lw $t2, 4($t0) # $t2 = length of str1 + lw $t3, 4($t1) # $t3 = length of str2 + addi $t2, $t2, -9 + addi $t3, $t3, -9 + add $t4, $t2, $t3 # $t4 = length of str1 + str2 + addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) + + li $v0, 9 + move $a0, $t4 + syscall + addi $t4, $t4, -9 # Restoring $t4 = length of str1 + str2 + add $t5, $zero, $v0 # $t5 = address of the new string object + addi $t5, $t5, 8 # $t5 = address of the first byte of the new string + + la $t8, type_String + sw $t8, 0($v0) # Setting type in the first word of th object + + sw $a0, 4($v0) # Setting length of the string in the second word of the object + + # Copying str1 to the new string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_str1_start: + beq $t6, $t2, while_copy_str1_end + lb $t7, 8($t0) + sb $t7, 0($t5) + add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str1_start + while_copy_str1_end: + + # Copying str2 to the new string + while_copy_str2_start: + beq $t6, $t4, while_copy_str2_end + lb $t7, 8($t1) + sb $t7, 0($t5) + add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str2_start + while_copy_str2_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self + s + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_substr_at_String: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + # i = 8($sp) + # l = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self[i:i + l] + lw $t0, 12($sp) # $t0 = address of the string + lw $t1, 4($t0) # $t1 = length of the string + addi $t1, $t1, -9 # $t1 = length of the string + 9 + lw $t2, 8($sp) # $t2 = start of the substring + lw $t2, 8($t2) + lw $t3, 4($sp) # $t3 = length of the substring + lw $t3, 8($t3) + add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring + + bgt $t4, $t1, substring_out_of_bounds + + addi $t3, $t3, 9 + li $v0, 9 + move $a0, $t3 + syscall + addi $t3, $t3, -9 + + la $t5, type_String + sw $t5, 0($v0) # Setting type in the first word of the object + + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t0, $t0, 8 # pointing to the first byte of the string + add $t0, $t0, $t2 # pointing to the first byte of the substring + move $t5, $v0 # $t5 = address of the new string + add $t5, $t5, 8 # pointing to the first byte of the string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_substr_start: + beq $t6, $t3, while_copy_substr_end + lb $t7, 0($t0) + sb $t7, 0($t5) + addi $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of the string + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_substr_start + while_copy_substr_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self[i:i + l] + j substring_not_out_of_bounds + + substring_out_of_bounds: + li $v0, 17 + addi $a0, $zero, 1 + syscall + + substring_not_out_of_bounds: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_Int: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function___init___at_Bool: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function___init___at_Main: + # Function parameters + # $ra = 268($sp) + # self = 264($sp) + + # Reserving space for local variables + addi $sp, $sp, -264 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 31 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 31 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 50 + sb $t0, 8($v0) # internal_0[0] = '2' + + addi $t0, $zero, 32 + sb $t0, 9($v0) # internal_0[1] = ' ' + + addi $t0, $zero, 105 + sb $t0, 10($v0) # internal_0[2] = 'i' + + addi $t0, $zero, 115 + sb $t0, 11($v0) # internal_0[3] = 's' + + addi $t0, $zero, 32 + sb $t0, 12($v0) # internal_0[4] = ' ' + + addi $t0, $zero, 116 + sb $t0, 13($v0) # internal_0[5] = 't' + + addi $t0, $zero, 114 + sb $t0, 14($v0) # internal_0[6] = 'r' + + addi $t0, $zero, 105 + sb $t0, 15($v0) # internal_0[7] = 'i' + + addi $t0, $zero, 118 + sb $t0, 16($v0) # internal_0[8] = 'v' + + addi $t0, $zero, 105 + sb $t0, 17($v0) # internal_0[9] = 'i' + + addi $t0, $zero, 97 + sb $t0, 18($v0) # internal_0[10] = 'a' + + addi $t0, $zero, 108 + sb $t0, 19($v0) # internal_0[11] = 'l' + + addi $t0, $zero, 108 + sb $t0, 20($v0) # internal_0[12] = 'l' + + addi $t0, $zero, 121 + sb $t0, 21($v0) # internal_0[13] = 'y' + + addi $t0, $zero, 32 + sb $t0, 22($v0) # internal_0[14] = ' ' + + addi $t0, $zero, 112 + sb $t0, 23($v0) # internal_0[15] = 'p' + + addi $t0, $zero, 114 + sb $t0, 24($v0) # internal_0[16] = 'r' + + addi $t0, $zero, 105 + sb $t0, 25($v0) # internal_0[17] = 'i' + + addi $t0, $zero, 109 + sb $t0, 26($v0) # internal_0[18] = 'm' + + addi $t0, $zero, 101 + sb $t0, 27($v0) # internal_0[19] = 'e' + + addi $t0, $zero, 46 + sb $t0, 28($v0) # internal_0[20] = '.' + + addi $t0, $zero, 10 + sb $t0, 29($v0) # internal_0[21] = '\n' + + sb $zero, 30($v0) # Null-terminator at the end of the string + + sw $v0, 260($sp) # internal_0 = "2 is trivially prime.\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 252($sp) # internal_2 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 264($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 252($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 248($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 276($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_0 + lw $t0, 272($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function internal_3 + lw $t0, 260($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 268($sp) # internal_1 = result of internal_3 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 244($sp) # internal_4 = address of allocated object Int + + # Set attribute out of self + lw $t0, 264($sp) # $t0 = self + lw $t1, 244($sp) # $t1 = internal_4 + beq $t1, $zero, object_set_attribute_8775727459699 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8775727459699 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8775727459699 + j object_set_attribute_8775727459699 + int_set_attribute_8775727459699: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.out = internal_4 + j end_set_attribute_8775727459699 + bool_set_attribute_8775727459699: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.out = internal_4 + j end_set_attribute_8775727459699 + object_set_attribute_8775727459699: + sw $t1, 8($t0) # self.out = internal_4 + end_set_attribute_8775727459699: + + # Get attribute out of self + lw $t0, 264($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'out' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8775727459792 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8775727459792 + j object_get_attribute_8775727459792 + int_get_attribute_8775727459792: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 240($sp) # internal_5 = self.out + j end_get_attribute_8775727459792 + bool_get_attribute_8775727459792: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 240($sp) # internal_5 = self.out + j end_get_attribute_8775727459792 + object_get_attribute_8775727459792: + sw $t1, 240($sp) # internal_5 = self.out + end_get_attribute_8775727459792: + + # Set attribute testee of self + lw $t0, 264($sp) # $t0 = self + lw $t1, 240($sp) # $t1 = internal_5 + beq $t1, $zero, object_set_attribute_8775727459708 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8775727459708 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8775727459708 + j object_set_attribute_8775727459708 + int_set_attribute_8775727459708: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.testee = internal_5 + j end_set_attribute_8775727459708 + bool_set_attribute_8775727459708: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.testee = internal_5 + j end_set_attribute_8775727459708 + object_set_attribute_8775727459708: + sw $t1, 12($t0) # self.testee = internal_5 + end_set_attribute_8775727459708: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 236($sp) # internal_6 = address of allocated object Int + + # Set attribute divisor of self + lw $t0, 264($sp) # $t0 = self + lw $t1, 236($sp) # $t1 = internal_6 + beq $t1, $zero, object_set_attribute_8775727459801 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8775727459801 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8775727459801 + j object_set_attribute_8775727459801 + int_set_attribute_8775727459801: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.divisor = internal_6 + j end_set_attribute_8775727459801 + bool_set_attribute_8775727459801: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.divisor = internal_6 + j end_set_attribute_8775727459801 + object_set_attribute_8775727459801: + sw $t1, 16($t0) # self.divisor = internal_6 + end_set_attribute_8775727459801: + + # Allocating Int 500 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 500 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 232($sp) # internal_7 = address of allocated object Int + + # Set attribute stop of self + lw $t0, 264($sp) # $t0 = self + lw $t1, 232($sp) # $t1 = internal_7 + beq $t1, $zero, object_set_attribute_8775727459822 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8775727459822 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8775727459822 + j object_set_attribute_8775727459822 + int_set_attribute_8775727459822: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($t0) # self.stop = internal_7 + j end_set_attribute_8775727459822 + bool_set_attribute_8775727459822: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 20($t0) # self.stop = internal_7 + j end_set_attribute_8775727459822 + object_set_attribute_8775727459822: + sw $t1, 20($t0) # self.stop = internal_7 + end_set_attribute_8775727459822: + + # Allocating NUll to internal_8 + sw $zero, 228($sp) # internal_8 = 0 + + while_start_8775727452179: + + # Allocating Bool 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 224($sp) # internal_9 = address of allocated object Int + + # If internal_9 then goto while_body_8775727452179 + lw $t0, 224($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_body_8775727452179 + + # Jumping to while_end_8775727452179 + j while_end_8775727452179 + + while_body_8775727452179: + + # Get attribute testee of self + lw $t0, 264($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'testee' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8775727461250 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8775727461250 + j object_get_attribute_8775727461250 + int_get_attribute_8775727461250: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 220($sp) # internal_10 = self.testee + j end_get_attribute_8775727461250 + bool_get_attribute_8775727461250: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 220($sp) # internal_10 = self.testee + j end_get_attribute_8775727461250 + object_get_attribute_8775727461250: + sw $t1, 220($sp) # internal_10 = self.testee + end_get_attribute_8775727461250: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 216($sp) # internal_11 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_10 + lw $t0, 232($sp) + sw $t0, 4($sp) # Storing internal_10 + + # Argument internal_11 + lw $t0, 228($sp) + sw $t0, 0($sp) # Storing internal_11 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 224($sp) # internal_12 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Set attribute testee of self + lw $t0, 264($sp) # $t0 = self + lw $t1, 212($sp) # $t1 = internal_12 + beq $t1, $zero, object_set_attribute_8775727461226 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8775727461226 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8775727461226 + j object_set_attribute_8775727461226 + int_set_attribute_8775727461226: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.testee = internal_12 + j end_set_attribute_8775727461226 + bool_set_attribute_8775727461226: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.testee = internal_12 + j end_set_attribute_8775727461226 + object_set_attribute_8775727461226: + sw $t1, 12($t0) # self.testee = internal_12 + end_set_attribute_8775727461226: + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 208($sp) # internal_13 = address of allocated object Int + + # Set attribute divisor of self + lw $t0, 264($sp) # $t0 = self + lw $t1, 208($sp) # $t1 = internal_13 + beq $t1, $zero, object_set_attribute_8775727461286 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8775727461286 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8775727461286 + j object_set_attribute_8775727461286 + int_set_attribute_8775727461286: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.divisor = internal_13 + j end_set_attribute_8775727461286 + bool_set_attribute_8775727461286: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.divisor = internal_13 + j end_set_attribute_8775727461286 + object_set_attribute_8775727461286: + sw $t1, 16($t0) # self.divisor = internal_13 + end_set_attribute_8775727461286: + + # Allocating NUll to internal_14 + sw $zero, 204($sp) # internal_14 = 0 + + while_start_8775727453447: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 196($sp) # internal_16 = address of allocated object Int + + # Get attribute testee of self + lw $t0, 264($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'testee' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8775727461654 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8775727461654 + j object_get_attribute_8775727461654 + int_get_attribute_8775727461654: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 192($sp) # internal_17 = self.testee + j end_get_attribute_8775727461654 + bool_get_attribute_8775727461654: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 192($sp) # internal_17 = self.testee + j end_get_attribute_8775727461654 + object_get_attribute_8775727461654: + sw $t1, 192($sp) # internal_17 = self.testee + end_get_attribute_8775727461654: + + # Get attribute divisor of self + lw $t0, 264($sp) # Get the address of self + lw $t1, 16($t0) # Get the attribute 'divisor' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8775727461678 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8775727461678 + j object_get_attribute_8775727461678 + int_get_attribute_8775727461678: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 188($sp) # internal_18 = self.divisor + j end_get_attribute_8775727461678 + bool_get_attribute_8775727461678: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 188($sp) # internal_18 = self.divisor + j end_get_attribute_8775727461678 + object_get_attribute_8775727461678: + sw $t1, 188($sp) # internal_18 = self.divisor + end_get_attribute_8775727461678: + + # Get attribute divisor of self + lw $t0, 264($sp) # Get the address of self + lw $t1, 16($t0) # Get the attribute 'divisor' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8775727461690 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8775727461690 + j object_get_attribute_8775727461690 + int_get_attribute_8775727461690: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 184($sp) # internal_19 = self.divisor + j end_get_attribute_8775727461690 + bool_get_attribute_8775727461690: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 184($sp) # internal_19 = self.divisor + j end_get_attribute_8775727461690 + object_get_attribute_8775727461690: + sw $t1, 184($sp) # internal_19 = self.divisor + end_get_attribute_8775727461690: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_18 + lw $t0, 200($sp) + sw $t0, 4($sp) # Storing internal_18 + + # Argument internal_19 + lw $t0, 196($sp) + sw $t0, 0($sp) # Storing internal_19 + + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 192($sp) # internal_20 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_17 + lw $t0, 204($sp) + sw $t0, 4($sp) # Storing internal_17 + + # Argument internal_20 + lw $t0, 192($sp) + sw $t0, 0($sp) # Storing internal_20 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 188($sp) # internal_21 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_16 = internal_21 + lw $t0, 176($sp) + sw $t0, 196($sp) + + # If internal_16 then goto then_8775727453459 + lw $t0, 196($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8775727453459 + + # Jumping to else_8775727453459 + j else_8775727453459 + + then_8775727453459: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 172($sp) # internal_22 = address of allocated object Int + + # internal_15 = internal_22 + lw $t0, 172($sp) + sw $t0, 200($sp) + + # Jumping to endif_8775727453459 + j endif_8775727453459 + + else_8775727453459: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 164($sp) # internal_24 = address of allocated object Int + + # Get attribute testee of self + lw $t0, 264($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'testee' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8775727461852 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8775727461852 + j object_get_attribute_8775727461852 + int_get_attribute_8775727461852: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 160($sp) # internal_25 = self.testee + j end_get_attribute_8775727461852 + bool_get_attribute_8775727461852: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 160($sp) # internal_25 = self.testee + j end_get_attribute_8775727461852 + object_get_attribute_8775727461852: + sw $t1, 160($sp) # internal_25 = self.testee + end_get_attribute_8775727461852: + + # Get attribute divisor of self + lw $t0, 264($sp) # Get the address of self + lw $t1, 16($t0) # Get the attribute 'divisor' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8775727461876 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8775727461876 + j object_get_attribute_8775727461876 + int_get_attribute_8775727461876: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 156($sp) # internal_26 = self.divisor + j end_get_attribute_8775727461876 + bool_get_attribute_8775727461876: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 156($sp) # internal_26 = self.divisor + j end_get_attribute_8775727461876 + object_get_attribute_8775727461876: + sw $t1, 156($sp) # internal_26 = self.divisor + end_get_attribute_8775727461876: + + # Get attribute testee of self + lw $t0, 264($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'testee' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8775727462672 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8775727462672 + j object_get_attribute_8775727462672 + int_get_attribute_8775727462672: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 152($sp) # internal_27 = self.testee + j end_get_attribute_8775727462672 + bool_get_attribute_8775727462672: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 152($sp) # internal_27 = self.testee + j end_get_attribute_8775727462672 + object_get_attribute_8775727462672: + sw $t1, 152($sp) # internal_27 = self.testee + end_get_attribute_8775727462672: + + # Get attribute divisor of self + lw $t0, 264($sp) # Get the address of self + lw $t1, 16($t0) # Get the attribute 'divisor' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8775727462684 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8775727462684 + j object_get_attribute_8775727462684 + int_get_attribute_8775727462684: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 148($sp) # internal_28 = self.divisor + j end_get_attribute_8775727462684 + bool_get_attribute_8775727462684: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 148($sp) # internal_28 = self.divisor + j end_get_attribute_8775727462684 + object_get_attribute_8775727462684: + sw $t1, 148($sp) # internal_28 = self.divisor + end_get_attribute_8775727462684: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_27 + lw $t0, 164($sp) + sw $t0, 4($sp) # Storing internal_27 + + # Argument internal_28 + lw $t0, 160($sp) + sw $t0, 0($sp) # Storing internal_28 + + # Calling function function_div + jal function_div + lw $ra, 8($sp) + sw $v1, 156($sp) # internal_29 = result of function_div + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_26 + lw $t0, 168($sp) + sw $t0, 4($sp) # Storing internal_26 + + # Argument internal_29 + lw $t0, 156($sp) + sw $t0, 0($sp) # Storing internal_29 + + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 152($sp) # internal_30 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_25 + lw $t0, 172($sp) + sw $t0, 4($sp) # Storing internal_25 + + # Argument internal_30 + lw $t0, 152($sp) + sw $t0, 0($sp) # Storing internal_30 + + # Calling function function_sub + jal function_sub + lw $ra, 8($sp) + sw $v1, 148($sp) # internal_31 = result of function_sub + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 132($sp) # internal_32 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_31 + lw $t0, 148($sp) + sw $t0, 4($sp) # Storing internal_31 + + # Argument internal_32 + lw $t0, 144($sp) + sw $t0, 0($sp) # Storing internal_32 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 140($sp) # internal_33 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_24 = internal_33 + lw $t0, 128($sp) + sw $t0, 164($sp) + + # If internal_24 then goto then_8775727453519 + lw $t0, 164($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8775727453519 + + # Jumping to else_8775727453519 + j else_8775727453519 + + then_8775727453519: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 124($sp) # internal_34 = address of allocated object Int + + # internal_23 = internal_34 + lw $t0, 124($sp) + sw $t0, 168($sp) + + # Jumping to endif_8775727453519 + j endif_8775727453519 + + else_8775727453519: + + # Allocating Bool 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 120($sp) # internal_35 = address of allocated object Int + + # internal_23 = internal_35 + lw $t0, 120($sp) + sw $t0, 168($sp) + + # Jumping to endif_8775727453519 + j endif_8775727453519 + + endif_8775727453519: + + # internal_15 = internal_23 + lw $t0, 168($sp) + sw $t0, 200($sp) + + # Jumping to endif_8775727453459 + j endif_8775727453459 + + endif_8775727453459: + + # If internal_15 then goto while_body_8775727453447 + lw $t0, 200($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_body_8775727453447 + + # Jumping to while_end_8775727453447 + j while_end_8775727453447 + + while_body_8775727453447: + + # Get attribute divisor of self + lw $t0, 264($sp) # Get the address of self + lw $t1, 16($t0) # Get the attribute 'divisor' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8775727462903 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8775727462903 + j object_get_attribute_8775727462903 + int_get_attribute_8775727462903: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 116($sp) # internal_36 = self.divisor + j end_get_attribute_8775727462903 + bool_get_attribute_8775727462903: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 116($sp) # internal_36 = self.divisor + j end_get_attribute_8775727462903 + object_get_attribute_8775727462903: + sw $t1, 116($sp) # internal_36 = self.divisor + end_get_attribute_8775727462903: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 112($sp) # internal_37 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_36 + lw $t0, 128($sp) + sw $t0, 4($sp) # Storing internal_36 + + # Argument internal_37 + lw $t0, 124($sp) + sw $t0, 0($sp) # Storing internal_37 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 120($sp) # internal_38 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Set attribute divisor of self + lw $t0, 264($sp) # $t0 = self + lw $t1, 108($sp) # $t1 = internal_38 + beq $t1, $zero, object_set_attribute_8775727462879 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8775727462879 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8775727462879 + j object_set_attribute_8775727462879 + int_set_attribute_8775727462879: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.divisor = internal_38 + j end_set_attribute_8775727462879 + bool_set_attribute_8775727462879: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 16($t0) # self.divisor = internal_38 + j end_set_attribute_8775727462879 + object_set_attribute_8775727462879: + sw $t1, 16($t0) # self.divisor = internal_38 + end_set_attribute_8775727462879: + + # Jumping to while_start_8775727453447 + j while_start_8775727453447 + + while_end_8775727453447: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 100($sp) # internal_40 = address of allocated object Int + + # Get attribute testee of self + lw $t0, 264($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'testee' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8775727463250 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8775727463250 + j object_get_attribute_8775727463250 + int_get_attribute_8775727463250: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 96($sp) # internal_41 = self.testee + j end_get_attribute_8775727463250 + bool_get_attribute_8775727463250: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 96($sp) # internal_41 = self.testee + j end_get_attribute_8775727463250 + object_get_attribute_8775727463250: + sw $t1, 96($sp) # internal_41 = self.testee + end_get_attribute_8775727463250: + + # Get attribute divisor of self + lw $t0, 264($sp) # Get the address of self + lw $t1, 16($t0) # Get the attribute 'divisor' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8775727463274 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8775727463274 + j object_get_attribute_8775727463274 + int_get_attribute_8775727463274: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 92($sp) # internal_42 = self.divisor + j end_get_attribute_8775727463274 + bool_get_attribute_8775727463274: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 92($sp) # internal_42 = self.divisor + j end_get_attribute_8775727463274 + object_get_attribute_8775727463274: + sw $t1, 92($sp) # internal_42 = self.divisor + end_get_attribute_8775727463274: + + # Get attribute divisor of self + lw $t0, 264($sp) # Get the address of self + lw $t1, 16($t0) # Get the attribute 'divisor' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8775727463286 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8775727463286 + j object_get_attribute_8775727463286 + int_get_attribute_8775727463286: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 88($sp) # internal_43 = self.divisor + j end_get_attribute_8775727463286 + bool_get_attribute_8775727463286: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 88($sp) # internal_43 = self.divisor + j end_get_attribute_8775727463286 + object_get_attribute_8775727463286: + sw $t1, 88($sp) # internal_43 = self.divisor + end_get_attribute_8775727463286: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_42 + lw $t0, 104($sp) + sw $t0, 4($sp) # Storing internal_42 + + # Argument internal_43 + lw $t0, 100($sp) + sw $t0, 0($sp) # Storing internal_43 + + # Calling function function_mult + jal function_mult + lw $ra, 8($sp) + sw $v1, 96($sp) # internal_44 = result of function_mult + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_41 + lw $t0, 108($sp) + sw $t0, 4($sp) # Storing internal_41 + + # Argument internal_44 + lw $t0, 96($sp) + sw $t0, 0($sp) # Storing internal_44 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 92($sp) # internal_45 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_40 = internal_45 + lw $t0, 80($sp) + sw $t0, 100($sp) + + # If internal_40 then goto then_8775727453525 + lw $t0, 100($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8775727453525 + + # Jumping to else_8775727453525 + j else_8775727453525 + + then_8775727453525: + + # Get attribute testee of self + lw $t0, 264($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'testee' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8775727463382 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8775727463382 + j object_get_attribute_8775727463382 + int_get_attribute_8775727463382: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 76($sp) # internal_46 = self.testee + j end_get_attribute_8775727463382 + bool_get_attribute_8775727463382: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 76($sp) # internal_46 = self.testee + j end_get_attribute_8775727463382 + object_get_attribute_8775727463382: + sw $t1, 76($sp) # internal_46 = self.testee + end_get_attribute_8775727463382: + + # Set attribute out of self + lw $t0, 264($sp) # $t0 = self + lw $t1, 76($sp) # $t1 = internal_46 + beq $t1, $zero, object_set_attribute_8775727463370 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8775727463370 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8775727463370 + j object_set_attribute_8775727463370 + int_set_attribute_8775727463370: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.out = internal_46 + j end_set_attribute_8775727463370 + bool_set_attribute_8775727463370: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.out = internal_46 + j end_set_attribute_8775727463370 + object_set_attribute_8775727463370: + sw $t1, 8($t0) # self.out = internal_46 + end_set_attribute_8775727463370: + + # Get attribute out of self + lw $t0, 264($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'out' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8775727463406 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8775727463406 + j object_get_attribute_8775727463406 + int_get_attribute_8775727463406: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 72($sp) # internal_47 = self.out + j end_get_attribute_8775727463406 + bool_get_attribute_8775727463406: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 72($sp) # internal_47 = self.out + j end_get_attribute_8775727463406 + object_get_attribute_8775727463406: + sw $t1, 72($sp) # internal_47 = self.out + end_get_attribute_8775727463406: + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 64($sp) # internal_49 = address of allocated object Int + + # Get method out_int of Main + lw $t0, 264($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 64($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 60($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 276($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_47 + lw $t0, 84($sp) + sw $t0, 0($sp) # Storing internal_47 + + # Calling function internal_50 + lw $t0, 72($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 80($sp) # internal_48 = result of internal_50 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 20 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 20 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 32 + sb $t0, 8($v0) # internal_51[0] = ' ' + + addi $t0, $zero, 105 + sb $t0, 9($v0) # internal_51[1] = 'i' + + addi $t0, $zero, 115 + sb $t0, 10($v0) # internal_51[2] = 's' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_51[3] = ' ' + + addi $t0, $zero, 112 + sb $t0, 12($v0) # internal_51[4] = 'p' + + addi $t0, $zero, 114 + sb $t0, 13($v0) # internal_51[5] = 'r' + + addi $t0, $zero, 105 + sb $t0, 14($v0) # internal_51[6] = 'i' + + addi $t0, $zero, 109 + sb $t0, 15($v0) # internal_51[7] = 'm' + + addi $t0, $zero, 101 + sb $t0, 16($v0) # internal_51[8] = 'e' + + addi $t0, $zero, 46 + sb $t0, 17($v0) # internal_51[9] = '.' + + addi $t0, $zero, 10 + sb $t0, 18($v0) # internal_51[10] = '\n' + + sb $zero, 19($v0) # Null-terminator at the end of the string + + sw $v0, 56($sp) # internal_51 = " is prime.\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 48($sp) # internal_53 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 264($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 48($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 44($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 276($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_51 + lw $t0, 68($sp) + sw $t0, 0($sp) # Storing internal_51 + + # Calling function internal_54 + lw $t0, 56($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 64($sp) # internal_52 = result of internal_54 + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_39 = internal_52 + lw $t0, 52($sp) + sw $t0, 104($sp) + + # Jumping to endif_8775727453525 + j endif_8775727453525 + + else_8775727453525: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_55 = address of allocated object Int + + # internal_39 = internal_55 + lw $t0, 40($sp) + sw $t0, 104($sp) + + # Jumping to endif_8775727453525 + j endif_8775727453525 + + endif_8775727453525: + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_57 = address of allocated object Int + + # Get attribute stop of self + lw $t0, 264($sp) # Get the address of self + lw $t1, 20($t0) # Get the attribute 'stop' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8775727460518 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8775727460518 + j object_get_attribute_8775727460518 + int_get_attribute_8775727460518: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 28($sp) # internal_58 = self.stop + j end_get_attribute_8775727460518 + bool_get_attribute_8775727460518: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 28($sp) # internal_58 = self.stop + j end_get_attribute_8775727460518 + object_get_attribute_8775727460518: + sw $t1, 28($sp) # internal_58 = self.stop + end_get_attribute_8775727460518: + + # Get attribute testee of self + lw $t0, 264($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'testee' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8775727460530 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8775727460530 + j object_get_attribute_8775727460530 + int_get_attribute_8775727460530: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 24($sp) # internal_59 = self.testee + j end_get_attribute_8775727460530 + bool_get_attribute_8775727460530: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 24($sp) # internal_59 = self.testee + j end_get_attribute_8775727460530 + object_get_attribute_8775727460530: + sw $t1, 24($sp) # internal_59 = self.testee + end_get_attribute_8775727460530: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_58 + lw $t0, 40($sp) + sw $t0, 4($sp) # Storing internal_58 + + # Argument internal_59 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_59 + + # Calling function function_less_than_or_equal + jal function_less_than_or_equal + lw $ra, 8($sp) + sw $v1, 32($sp) # internal_60 = result of function_less_than_or_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_57 = internal_60 + lw $t0, 20($sp) + sw $t0, 32($sp) + + # If internal_57 then goto then_8775727453621 + lw $t0, 32($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8775727453621 + + # Jumping to else_8775727453621 + j else_8775727453621 + + then_8775727453621: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 13 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 13 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 104 + sb $t0, 8($v0) # internal_61[0] = 'h' + + addi $t0, $zero, 97 + sb $t0, 9($v0) # internal_61[1] = 'a' + + addi $t0, $zero, 108 + sb $t0, 10($v0) # internal_61[2] = 'l' + + addi $t0, $zero, 116 + sb $t0, 11($v0) # internal_61[3] = 't' + + sb $zero, 12($v0) # Null-terminator at the end of the string + + sw $v0, 16($sp) # internal_61 = "halt" + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_63 = address of allocated object Int + + # Get method abort of String + lw $t0, 16($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 8($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 4($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_61 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_61 + + # Calling function internal_64 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_62 = result of internal_64 + addi $sp, $sp, 8 # Freeing space for arguments + + # internal_56 = internal_62 + lw $t0, 12($sp) + sw $t0, 36($sp) + + # Jumping to endif_8775727453621 + j endif_8775727453621 + + else_8775727453621: + + # Allocating String + li $v0, 9 + addi $a0, $zero, 17 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 17 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 99 + sb $t0, 8($v0) # internal_65[0] = 'c' + + addi $t0, $zero, 111 + sb $t0, 9($v0) # internal_65[1] = 'o' + + addi $t0, $zero, 110 + sb $t0, 10($v0) # internal_65[2] = 'n' + + addi $t0, $zero, 116 + sb $t0, 11($v0) # internal_65[3] = 't' + + addi $t0, $zero, 105 + sb $t0, 12($v0) # internal_65[4] = 'i' + + addi $t0, $zero, 110 + sb $t0, 13($v0) # internal_65[5] = 'n' + + addi $t0, $zero, 117 + sb $t0, 14($v0) # internal_65[6] = 'u' + + addi $t0, $zero, 101 + sb $t0, 15($v0) # internal_65[7] = 'e' + + sb $zero, 16($v0) # Null-terminator at the end of the string + + sw $v0, 0($sp) # internal_65 = "continue" + + # internal_56 = internal_65 + lw $t0, 0($sp) + sw $t0, 36($sp) + + # Jumping to endif_8775727453621 + j endif_8775727453621 + + endif_8775727453621: + + # Jumping to while_start_8775727452179 + j while_start_8775727452179 + + while_end_8775727452179: + + # Set attribute m of self + lw $t0, 264($sp) # $t0 = self + lw $t1, 228($sp) # $t1 = internal_8 + beq $t1, $zero, object_set_attribute_8775727461130 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8775727461130 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8775727461130 + j object_set_attribute_8775727461130 + int_set_attribute_8775727461130: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 24($t0) # self.m = internal_8 + j end_set_attribute_8775727461130 + bool_set_attribute_8775727461130: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 24($t0) # self.m = internal_8 + j end_set_attribute_8775727461130 + object_set_attribute_8775727461130: + sw $t1, 24($t0) # self.m = internal_8 + end_set_attribute_8775727461130: + + # Loading return value in $v1 + lw $v1, 264($sp) + + # Freeing space for local variables + addi $sp, $sp, 264 + + jr $ra + + function_main_at_Main: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + main: + # Reserving space for local variables + addi $sp, $sp, -16 + + # Allocating Main + li $v0, 9 + lw $a0, type_Main + syscall + la $t0, type_Main # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 12($sp) # internal_0 = address of allocated object Main + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_Main + jal function___init___at_Main + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_0 = result of function___init___at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_2 = address of allocated object Int + + # Get method main of Main + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function internal_3 + lw $t0, 8($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_1 = result of internal_3 + addi $sp, $sp, 8 # Freeing space for arguments + + # Exit program + li $v0, 10 + syscall + + \ No newline at end of file diff --git a/tests/codegen/primes_output.txt b/tests/codegen/primes_output.txt index a4d0fcb3f..cf5d78d49 100644 --- a/tests/codegen/primes_output.txt +++ b/tests/codegen/primes_output.txt @@ -1,96 +1,96 @@ -2 is trivially prime. -3 is prime. -5 is prime. -7 is prime. -11 is prime. -13 is prime. -17 is prime. -19 is prime. -23 is prime. -29 is prime. -31 is prime. -37 is prime. -41 is prime. -43 is prime. -47 is prime. -53 is prime. -59 is prime. -61 is prime. -67 is prime. -71 is prime. -73 is prime. -79 is prime. -83 is prime. -89 is prime. -97 is prime. -101 is prime. -103 is prime. -107 is prime. -109 is prime. -113 is prime. -127 is prime. -131 is prime. -137 is prime. -139 is prime. -149 is prime. -151 is prime. -157 is prime. -163 is prime. -167 is prime. -173 is prime. -179 is prime. -181 is prime. -191 is prime. -193 is prime. -197 is prime. -199 is prime. -211 is prime. -223 is prime. -227 is prime. -229 is prime. -233 is prime. -239 is prime. -241 is prime. -251 is prime. -257 is prime. -263 is prime. -269 is prime. -271 is prime. -277 is prime. -281 is prime. -283 is prime. -293 is prime. -307 is prime. -311 is prime. -313 is prime. -317 is prime. -331 is prime. -337 is prime. -347 is prime. -349 is prime. -353 is prime. -359 is prime. -367 is prime. -373 is prime. -379 is prime. -383 is prime. -389 is prime. -397 is prime. -401 is prime. -409 is prime. -419 is prime. -421 is prime. -431 is prime. -433 is prime. -439 is prime. -443 is prime. -449 is prime. -457 is prime. -461 is prime. -463 is prime. -467 is prime. -479 is prime. -487 is prime. -491 is prime. -499 is prime. -Abort called from class String +2 is trivially prime. +3 is prime. +5 is prime. +7 is prime. +11 is prime. +13 is prime. +17 is prime. +19 is prime. +23 is prime. +29 is prime. +31 is prime. +37 is prime. +41 is prime. +43 is prime. +47 is prime. +53 is prime. +59 is prime. +61 is prime. +67 is prime. +71 is prime. +73 is prime. +79 is prime. +83 is prime. +89 is prime. +97 is prime. +101 is prime. +103 is prime. +107 is prime. +109 is prime. +113 is prime. +127 is prime. +131 is prime. +137 is prime. +139 is prime. +149 is prime. +151 is prime. +157 is prime. +163 is prime. +167 is prime. +173 is prime. +179 is prime. +181 is prime. +191 is prime. +193 is prime. +197 is prime. +199 is prime. +211 is prime. +223 is prime. +227 is prime. +229 is prime. +233 is prime. +239 is prime. +241 is prime. +251 is prime. +257 is prime. +263 is prime. +269 is prime. +271 is prime. +277 is prime. +281 is prime. +283 is prime. +293 is prime. +307 is prime. +311 is prime. +313 is prime. +317 is prime. +331 is prime. +337 is prime. +347 is prime. +349 is prime. +353 is prime. +359 is prime. +367 is prime. +373 is prime. +379 is prime. +383 is prime. +389 is prime. +397 is prime. +401 is prime. +409 is prime. +419 is prime. +421 is prime. +431 is prime. +433 is prime. +439 is prime. +443 is prime. +449 is prime. +457 is prime. +461 is prime. +463 is prime. +467 is prime. +479 is prime. +487 is prime. +491 is prime. +499 is prime. +Abort called from class String diff --git a/tests/codegen/print-cool.mips b/tests/codegen/print-cool.mips new file mode 100644 index 000000000..065321163 --- /dev/null +++ b/tests/codegen/print-cool.mips @@ -0,0 +1,1935 @@ +.data + type_Object: .word 24 + type_Object_inherits_from: .word 0 + type_Object_name_address: .word type_Object_name_size + type_Object___init__: .word function___init___at_Object + type_Object_abort: .word function_abort_at_Object + type_Object_type_name: .word function_type_name_at_Object + type_Object_copy: .word function_copy_at_Object + + type_IO: .word 40 + type_IO_inherits_from: .word type_Object + type_IO_name_address: .word type_IO_name_size + type_IO___init__: .word function___init___at_IO + type_IO_abort: .word function_abort_at_Object + type_IO_type_name: .word function_type_name_at_Object + type_IO_copy: .word function_copy_at_Object + type_IO_out_string: .word function_out_string_at_IO + type_IO_out_int: .word function_out_int_at_IO + type_IO_in_string: .word function_in_string_at_IO + type_IO_in_int: .word function_in_int_at_IO + + type_String: .word 36 + type_String_inherits_from: .word type_Object + type_String_name_address: .word type_String_name_size + type_String___init__: .word function___init___at_String + type_String_abort: .word function_abort_at_Object + type_String_type_name: .word function_type_name_at_Object + type_String_copy: .word function_copy_at_Object + type_String_length: .word function_length_at_String + type_String_concat: .word function_concat_at_String + type_String_substr: .word function_substr_at_String + + type_Int: .word 24 + type_Int_inherits_from: .word type_Object + type_Int_name_address: .word type_Int_name_size + type_Int___init__: .word function___init___at_Int + type_Int_abort: .word function_abort_at_Object + type_Int_type_name: .word function_type_name_at_Object + type_Int_copy: .word function_copy_at_Object + + type_Bool: .word 24 + type_Bool_inherits_from: .word type_Object + type_Bool_name_address: .word type_Bool_name_size + type_Bool___init__: .word function___init___at_Bool + type_Bool_abort: .word function_abort_at_Object + type_Bool_type_name: .word function_type_name_at_Object + type_Bool_copy: .word function_copy_at_Object + + type_Main: .word 44 + type_Main_inherits_from: .word type_IO + type_Main_name_address: .word type_Main_name_size + type_Main___init__: .word function___init___at_Main + type_Main_abort: .word function_abort_at_Object + type_Main_type_name: .word function_type_name_at_Object + type_Main_copy: .word function_copy_at_Object + type_Main_out_string: .word function_out_string_at_IO + type_Main_out_int: .word function_out_int_at_IO + type_Main_in_string: .word function_in_string_at_IO + type_Main_in_int: .word function_in_int_at_IO + type_Main_main: .word function_main_at_Main + + type_Object_name_size: .word 6 + type_Object_name: .asciiz "Object" + + type_IO_name_size: .word 2 + type_IO_name: .asciiz "IO" + + type_String_name_size: .word 6 + type_String_name: .asciiz "String" + + type_Int_name_size: .word 3 + type_Int_name: .asciiz "Int" + + type_Bool_name_size: .word 4 + type_Bool_name: .asciiz "Bool" + + type_Main_name_size: .word 4 + type_Main_name: .asciiz "Main" + + buffer_input: .space 1024 + debug_log: .asciiz "debug_log\n" + +.text + function_add: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Addition operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + add $t2, $t0, $t1 # $t2 = $t0 + $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_sub: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Subtraction operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sub $t2, $t0, $t1 # $t2 = $t0 - $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_mult: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Multiplication operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + mult $t0, $t1 # $t2 = $t0 * $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_div: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Division operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + div $t0, $t1 # $t2 = $t0 / $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_xor: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Xor operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than_or_equal: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sle $t2, $t0, $t1 # $t2 = $t0 <= $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_equal: + # Function parameters + # $ra = 48($sp) + # a = 44($sp) + # b = 40($sp) + + # Reserving space for local variables + addi $sp, $sp, -40 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_0 = address of allocated object Int + + # Allocating NUll to internal_1 + sw $zero, 32($sp) # internal_1 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_2 = address of allocated object Int + + # internal_2 = EqualAddress(a, internal_1) + lw $t0, 44($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # internal_2 = EqualAddress(b, internal_1) + lw $t0, 40($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # If internal_2 then goto a_is_type_object + lw $t0, 28($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_object + + # internal_3 = typeof a that is the first word of the object + lw $t0, 44($sp) + lw $t0, 0($t0) + sw $t0, 24($sp) + + # internal_4 = direction of Int + la $t0, type_Int + sw $t0, 20($sp) + + # internal_5 = direction of Bool + la $t0, type_Bool + sw $t0, 16($sp) + + # internal_6 = direction of String + la $t0, type_String + sw $t0, 12($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_7 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_8 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_9 = address of allocated object Int + + # internal_7 = EqualAddress(internal_3, internal_4) + lw $t0, 24($sp) + lw $t1, 20($sp) + seq $t2, $t0, $t1 + lw $t0, 8($sp) + sw $t2, 8($t0) + + # internal_8 = EqualAddress(internal_3, internal_5) + lw $t0, 24($sp) + lw $t1, 16($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_9 = EqualAddress(internal_3, internal_6) + lw $t0, 24($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_7 then goto a_is_type_int_or_bool + lw $t0, 8($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_8 then goto a_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_9 then goto a_is_type_string + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_string + + # Jumping to a_is_type_object + j a_is_type_object + + a_is_type_int_or_bool: + + # internal_0 = EqualInt(a, b) + lw $t0, 44($sp) + lw $t0, 8($t0) + lw $t1, 40($sp) + lw $t1, 8($t1) + seq $t2, $t0, $t1 + lw $t0, 36($sp) + sw $t2, 8($t0) + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_string: + + # internal_0 = EqualStr(a, b) + lw $t0, 44($sp) + lw $t1, 40($sp) + addi $t0, $t0, 8 + addi $t1, $t1, 8 + + # By default we assume the strings are equals + addi $t4, $zero, 1 + lw $t5, 36($sp) + sw $t4, 8($t5) + + while_compare_strings_start: + lb $t2, 0($t0) + lb $t3, 0($t1) + beq $t2, $t3, while_compare_strings_update + + # The strings are no equals + lw $t5, 36($sp) + sw $zero, 8($t5) + j while_compare_strings_end + + while_compare_strings_update: + addi $t0, $t0, 1 + addi $t1, $t1, 1 + beq $t2, $zero, while_compare_strings_end + beq $t3, $zero, while_compare_strings_end + j while_compare_strings_start + while_compare_strings_end: + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_object: + + # Equal operation + lw $t0, 44($sp) # Save in $t0 the left operand address + lw $t1, 40($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 36($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Jumping to end_of_equal + j end_of_equal + + end_of_equal: + + # Loading return value in $v1 + lw $v1, 36($sp) + + # Freeing space for local variables + addi $sp, $sp, 40 + + jr $ra + + function_assign: + # Function parameters + # $ra = 36($sp) + # dest = 32($sp) + # source = 28($sp) + + # Reserving space for local variables + addi $sp, $sp, -28 + + # Allocating NUll to internal_0 + sw $zero, 24($sp) # internal_0 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_1 = address of allocated object Int + + # internal_1 = EqualAddress(source, internal_0) + lw $t0, 28($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # internal_1 = EqualAddress(dest, internal_0) + lw $t0, 32($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # If internal_1 then goto source_is_type_object + lw $t0, 20($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_object + + # internal_2 = typeof source that is the first word of the object + lw $t0, 28($sp) + lw $t0, 0($t0) + sw $t0, 16($sp) + + # internal_3 = direction of Int + la $t0, type_Int + sw $t0, 12($sp) + + # internal_4 = direction of Bool + la $t0, type_Bool + sw $t0, 8($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_5 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_6 = address of allocated object Int + + # internal_5 = EqualAddress(internal_2, internal_3) + lw $t0, 16($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_6 = EqualAddress(internal_2, internal_4) + lw $t0, 16($sp) + lw $t1, 8($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_5 then goto source_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # If internal_6 then goto source_is_type_int_or_bool + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # Jumping to source_is_type_object + j source_is_type_object + + source_is_type_int_or_bool: + + # dest = source where source is an integer + li $v0, 9 + addi $a0, $zero, 12 + syscall + lw $t0, 28($sp) # Pointer to source + lw $t1, 0($t0) # $t1 = type of source + lw $t2, 8($t0) # $t2 = value of source + sw $t1, 0($v0) # Save type of dest + sw $a0, 4($v0) # Save size of dest + sw $t2, 8($v0) # Save value of dest + sw $v0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_is_type_object: + + # dest = source + lw $t0, 28($sp) + sw $t0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_end_of_equal: + + # Loading return value in $v1 + lw $v1, 32($sp) + + # Freeing space for local variables + addi $sp, $sp, 28 + + jr $ra + + function___init___at_Object: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_abort_at_Object: + # Function parameters + # $ra = 28($sp) + # self = 24($sp) + + # Reserving space for local variables + addi $sp, $sp, -24 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 33 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 33 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 65 + sb $t0, 8($v0) # internal_0[0] = 'A' + + addi $t0, $zero, 98 + sb $t0, 9($v0) # internal_0[1] = 'b' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_0[2] = 'o' + + addi $t0, $zero, 114 + sb $t0, 11($v0) # internal_0[3] = 'r' + + addi $t0, $zero, 116 + sb $t0, 12($v0) # internal_0[4] = 't' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_0[5] = ' ' + + addi $t0, $zero, 99 + sb $t0, 14($v0) # internal_0[6] = 'c' + + addi $t0, $zero, 97 + sb $t0, 15($v0) # internal_0[7] = 'a' + + addi $t0, $zero, 108 + sb $t0, 16($v0) # internal_0[8] = 'l' + + addi $t0, $zero, 108 + sb $t0, 17($v0) # internal_0[9] = 'l' + + addi $t0, $zero, 101 + sb $t0, 18($v0) # internal_0[10] = 'e' + + addi $t0, $zero, 100 + sb $t0, 19($v0) # internal_0[11] = 'd' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_0[12] = ' ' + + addi $t0, $zero, 102 + sb $t0, 21($v0) # internal_0[13] = 'f' + + addi $t0, $zero, 114 + sb $t0, 22($v0) # internal_0[14] = 'r' + + addi $t0, $zero, 111 + sb $t0, 23($v0) # internal_0[15] = 'o' + + addi $t0, $zero, 109 + sb $t0, 24($v0) # internal_0[16] = 'm' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_0[17] = ' ' + + addi $t0, $zero, 99 + sb $t0, 26($v0) # internal_0[18] = 'c' + + addi $t0, $zero, 108 + sb $t0, 27($v0) # internal_0[19] = 'l' + + addi $t0, $zero, 97 + sb $t0, 28($v0) # internal_0[20] = 'a' + + addi $t0, $zero, 115 + sb $t0, 29($v0) # internal_0[21] = 's' + + addi $t0, $zero, 115 + sb $t0, 30($v0) # internal_0[22] = 's' + + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_0[23] = ' ' + + sb $zero, 32($v0) # Null-terminator at the end of the string + + sw $v0, 20($sp) # internal_0 = "Abort called from class " + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_3[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 8($sp) # internal_3 = "\n" + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method type_name of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_5 + lw $t0, 8($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 24($sp) # internal_1 = result of internal_5 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_1 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_2 = result of internal_5 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_3 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_2 = result of internal_5 + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 12($sp) # $t0 = internal_2 + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the String internal_2 + li $v0, 4 + move $a0, $t0 + syscall + + # Exit program + li $v0, 10 + syscall + + # Loading return value in $v1 + lw $v1, 24($sp) + + # Freeing space for local variables + addi $sp, $sp, 24 + + jr $ra + + function_type_name_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = name of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 8($t1) # $t2 = direction of the type name + la $t3, 4($t2) # $t3 = address of the name + lw $t2, 0($t2) # $t2 = length of the name + + addi $t2, $t2, 9 # Setting space for the type, the size and the null byte + li $v0, 9 + move $a0, $t2 + syscall + addi $t2, $t2, -9 # Restoring space for the type, the size and the null byte + + la $t4, type_String + sw $t4, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t4, $v0, 0 # $t4 = direction of the new string + addi $t4, $t4, 8 # Pointer to the first character of the string + xor $t5, $t5, $t5 # Initializing counter + while_copy_name_start: + beq $t5, $t2, while_copy_name_end + lb $t6, 0($t3) # Loading the character + sb $t6, 0($t4) + addi $t4, $t4, 1 # Incrementing the pointer to the new string + addi $t3, $t3, 1 # Incrementing the pointer to the string in self + addi $t5, $t5, 1 # Incrementing counter + j while_copy_name_start + while_copy_name_end: + + sb $zero, 0($t4) # Setting the null byte + + sw $v0, 0($sp) # Storing the new string in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_copy_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = copy of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 4($t0) # $t2 = length of self in bytes + + # Allocating space for the new object + li $v0, 9 + move $a0, $t2 + syscall + move $t3, $v0 # $t3 = direction of the new object + sw $t1, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + # Initializing the variable of the loop + addi $t0, $t0, 8 # Pointer to the first character of the object + addi $t3, $t3, 8 # Pointer to the first character of the object + addi $t2, $2, -8 # Decrementing in 8 the length of the object + xor $t4, $t4, $t4 # Initializing counter + + # Loop copying the object + while_copy_start: + beq $t4, $t2, while_copy_end + lb $t5, 0($t0) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t0, $t0, 1 # Incrementing the pointer to the object + addi $t3, $t3, 1 # Incrementing the pointer to the new object + addi $t4, $t4, 1 # Incrementing counter + j while_copy_start + while_copy_end: + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_IO: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_out_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + lw $t0, 0($sp) # $t0 = x + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the String x + li $v0, 4 + move $a0, $t0 + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_out_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + # Printing the Int x + li $v0, 1 + lw $a0, 0($sp) + lw $a0, 8($a0) + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_in_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + li $v0, 8 + la $a0, buffer_input + li $a1, 1024 + syscall + + xor $t0, $t0, $t0 # Initializing counter + while_read_start: + lb $t1, buffer_input($t0) # Loading the byte + addi $t2, $zero, 10 + beq $t1, $t2, while_read_end + addi $t2, $zero, 13 + beq $t1, $t2, while_read_end + addi $t0, $t0, 1 # Incrementing counter + j while_read_start + while_read_end: + + addi $t0, $t0, 9 # Adding space for the type, the size and the null byte + li $v0, 9 + move $a0, $t0 + syscall + addi $t0, $t0, -9 # Adding space for the type, the size and the null byte + la $t2, type_String + sw $t2, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t3, $v0, 8 # Pointer to the first character of the string + xor $t4, $t4, $t4 # Initializing counter + + while_copy_from_buffer_start: + beq $t4, $t0, while_copy_from_buffer_end + lb $t5, buffer_input($t4) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t3, $t3, 1 # Imcremeenting pointer + addi $t4, $t4, 1 # Incrementing counter + j while_copy_from_buffer_start + while_copy_from_buffer_end: + + sb $zero, 0($t3) # Storing the null byte + + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_in_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + li $v0, 5 + syscall + lw $t0, 0($sp) + sw $v0, 8($t0) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_String: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_length_at_String: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # internal_0 = length of self + lw $t0, 4($sp) + lw $t1, 4($t0) + addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator + lw $t0, 0($sp) + sw $t1, 8($t0) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_concat_at_String: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + # s = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self + s + lw $t0, 8($sp) + lw $t1, 4($sp) + lw $t2, 4($t0) # $t2 = length of str1 + lw $t3, 4($t1) # $t3 = length of str2 + addi $t2, $t2, -9 + addi $t3, $t3, -9 + add $t4, $t2, $t3 # $t4 = length of str1 + str2 + addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) + + li $v0, 9 + move $a0, $t4 + syscall + addi $t4, $t4, -9 # Restoring $t4 = length of str1 + str2 + add $t5, $zero, $v0 # $t5 = address of the new string object + addi $t5, $t5, 8 # $t5 = address of the first byte of the new string + + la $t8, type_String + sw $t8, 0($v0) # Setting type in the first word of th object + + sw $a0, 4($v0) # Setting length of the string in the second word of the object + + # Copying str1 to the new string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_str1_start: + beq $t6, $t2, while_copy_str1_end + lb $t7, 8($t0) + sb $t7, 0($t5) + add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str1_start + while_copy_str1_end: + + # Copying str2 to the new string + while_copy_str2_start: + beq $t6, $t4, while_copy_str2_end + lb $t7, 8($t1) + sb $t7, 0($t5) + add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str2_start + while_copy_str2_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self + s + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_substr_at_String: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + # i = 8($sp) + # l = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self[i:i + l] + lw $t0, 12($sp) # $t0 = address of the string + lw $t1, 4($t0) # $t1 = length of the string + addi $t1, $t1, -9 # $t1 = length of the string + 9 + lw $t2, 8($sp) # $t2 = start of the substring + lw $t2, 8($t2) + lw $t3, 4($sp) # $t3 = length of the substring + lw $t3, 8($t3) + add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring + + bgt $t4, $t1, substring_out_of_bounds + + addi $t3, $t3, 9 + li $v0, 9 + move $a0, $t3 + syscall + addi $t3, $t3, -9 + + la $t5, type_String + sw $t5, 0($v0) # Setting type in the first word of the object + + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t0, $t0, 8 # pointing to the first byte of the string + add $t0, $t0, $t2 # pointing to the first byte of the substring + move $t5, $v0 # $t5 = address of the new string + add $t5, $t5, 8 # pointing to the first byte of the string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_substr_start: + beq $t6, $t3, while_copy_substr_end + lb $t7, 0($t0) + sb $t7, 0($t5) + addi $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of the string + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_substr_start + while_copy_substr_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self[i:i + l] + j substring_not_out_of_bounds + + substring_out_of_bounds: + li $v0, 17 + addi $a0, $zero, 1 + syscall + + substring_not_out_of_bounds: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_Int: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function___init___at_Bool: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function___init___at_Main: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_main_at_Main: + # Function parameters + # $ra = 120($sp) + # self = 116($sp) + + # Reserving space for local variables + addi $sp, $sp, -116 + + # Allocating Object + li $v0, 9 + lw $a0, type_Object + syscall + la $t0, type_Object # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 112($sp) # internal_0 = address of allocated object Object + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 120($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_Object + jal function___init___at_Object + lw $ra, 4($sp) + sw $v1, 120($sp) # internal_0 = result of function___init___at_Object + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 104($sp) # internal_2 = address of allocated object Int + + # Get method type_name of Object + lw $t0, 112($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 104($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 100($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 120($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function internal_3 + lw $t0, 108($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 116($sp) # internal_1 = result of internal_3 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 96($sp) # internal_4 = address of allocated object Int + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 92($sp) # internal_5 = address of allocated object Int + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 84($sp) # internal_7 = address of allocated object Int + + # Get method substr of String + lw $t0, 108($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 84($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 80($sp) + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument internal_1 + lw $t0, 124($sp) + sw $t0, 8($sp) # Storing internal_1 + + # Argument internal_4 + lw $t0, 112($sp) + sw $t0, 4($sp) # Storing internal_4 + + # Argument internal_5 + lw $t0, 108($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function internal_8 + lw $t0, 96($sp) + jalr $t0 + lw $ra, 12($sp) + sw $v1, 104($sp) # internal_6 = result of internal_8 + addi $sp, $sp, 16 # Freeing space for arguments + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 72($sp) # internal_10 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 116($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 72($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 68($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 128($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_6 + lw $t0, 100($sp) + sw $t0, 0($sp) # Storing internal_6 + + # Calling function internal_11 + lw $t0, 80($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 88($sp) # internal_9 = result of internal_11 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 60($sp) # internal_13 = address of allocated object Int + + # Allocating NUll to internal_12 + sw $zero, 64($sp) # internal_12 = 0 + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 128($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_12 + lw $t0, 76($sp) + sw $t0, 0($sp) # Storing internal_12 + + # Calling function function_equal + jal function_equal + lw $ra, 8($sp) + sw $v1, 72($sp) # internal_13 = result of function_equal + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 52($sp) # internal_15 = address of allocated object Int + + # Get method type_name of Bool + lw $t0, 60($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 52($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 48($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_13 + lw $t0, 68($sp) + sw $t0, 0($sp) # Storing internal_13 + + # Calling function internal_16 + lw $t0, 56($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 64($sp) # internal_14 = result of internal_16 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 44($sp) # internal_17 = address of allocated object Int + + # Allocating Int 3 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 3 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_18 = address of allocated object Int + + # Allocating Int 6 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 6 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 32($sp) # internal_20 = address of allocated object Int + + # Get method substr of String + lw $t0, 56($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 32($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 28($sp) + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument internal_14 + lw $t0, 72($sp) + sw $t0, 8($sp) # Storing internal_14 + + # Argument internal_17 + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing internal_17 + + # Argument internal_18 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_18 + + # Calling function internal_21 + lw $t0, 44($sp) + jalr $t0 + lw $ra, 12($sp) + sw $v1, 52($sp) # internal_19 = result of internal_21 + addi $sp, $sp, 16 # Freeing space for arguments + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_23 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 76($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 20($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 16($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_9 + lw $t0, 88($sp) + sw $t0, 4($sp) # Storing internal_9 + + # Argument internal_19 + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing internal_19 + + # Calling function internal_24 + lw $t0, 28($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_22 = result of internal_24 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_25[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 12($sp) # internal_25 = "\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_27 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 116($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 128($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_25 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_25 + + # Calling function internal_28 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_26 = result of internal_28 + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 116 + + jr $ra + + main: + # Reserving space for local variables + addi $sp, $sp, -16 + + # Allocating Main + li $v0, 9 + lw $a0, type_Main + syscall + la $t0, type_Main # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 12($sp) # internal_0 = address of allocated object Main + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_Main + jal function___init___at_Main + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_0 = result of function___init___at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_2 = address of allocated object Int + + # Get method main of Main + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function internal_3 + lw $t0, 8($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_1 = result of internal_3 + addi $sp, $sp, 8 # Freeing space for arguments + + # Exit program + li $v0, 10 + syscall + + \ No newline at end of file diff --git a/tests/codegen/print-cool_output.txt b/tests/codegen/print-cool_output.txt index 2b58f8985..3c8cd620c 100644 --- a/tests/codegen/print-cool_output.txt +++ b/tests/codegen/print-cool_output.txt @@ -1 +1 @@ -cool +cool diff --git a/tests/codegen/sort-list.mips b/tests/codegen/sort-list.mips new file mode 100644 index 000000000..5f6e839af --- /dev/null +++ b/tests/codegen/sort-list.mips @@ -0,0 +1,4632 @@ +.data + type_Object: .word 24 + type_Object_inherits_from: .word 0 + type_Object_name_address: .word type_Object_name_size + type_Object___init__: .word function___init___at_Object + type_Object_abort: .word function_abort_at_Object + type_Object_type_name: .word function_type_name_at_Object + type_Object_copy: .word function_copy_at_Object + + type_IO: .word 40 + type_IO_inherits_from: .word type_Object + type_IO_name_address: .word type_IO_name_size + type_IO___init__: .word function___init___at_IO + type_IO_abort: .word function_abort_at_Object + type_IO_type_name: .word function_type_name_at_Object + type_IO_copy: .word function_copy_at_Object + type_IO_out_string: .word function_out_string_at_IO + type_IO_out_int: .word function_out_int_at_IO + type_IO_in_string: .word function_in_string_at_IO + type_IO_in_int: .word function_in_int_at_IO + + type_String: .word 36 + type_String_inherits_from: .word type_Object + type_String_name_address: .word type_String_name_size + type_String___init__: .word function___init___at_String + type_String_abort: .word function_abort_at_Object + type_String_type_name: .word function_type_name_at_Object + type_String_copy: .word function_copy_at_Object + type_String_length: .word function_length_at_String + type_String_concat: .word function_concat_at_String + type_String_substr: .word function_substr_at_String + + type_Int: .word 24 + type_Int_inherits_from: .word type_Object + type_Int_name_address: .word type_Int_name_size + type_Int___init__: .word function___init___at_Int + type_Int_abort: .word function_abort_at_Object + type_Int_type_name: .word function_type_name_at_Object + type_Int_copy: .word function_copy_at_Object + + type_Bool: .word 24 + type_Bool_inherits_from: .word type_Object + type_Bool_name_address: .word type_Bool_name_size + type_Bool___init__: .word function___init___at_Bool + type_Bool_abort: .word function_abort_at_Object + type_Bool_type_name: .word function_type_name_at_Object + type_Bool_copy: .word function_copy_at_Object + + type_List: .word 76 + type_List_inherits_from: .word type_IO + type_List_name_address: .word type_List_name_size + type_List___init__: .word function___init___at_List + type_List_abort: .word function_abort_at_Object + type_List_type_name: .word function_type_name_at_Object + type_List_copy: .word function_copy_at_Object + type_List_out_string: .word function_out_string_at_IO + type_List_out_int: .word function_out_int_at_IO + type_List_in_string: .word function_in_string_at_IO + type_List_in_int: .word function_in_int_at_IO + type_List_isNil: .word function_isNil_at_List + type_List_cons: .word function_cons_at_List + type_List_car: .word function_car_at_List + type_List_cdr: .word function_cdr_at_List + type_List_rev: .word function_rev_at_List + type_List_sort: .word function_sort_at_List + type_List_insert: .word function_insert_at_List + type_List_rcons: .word function_rcons_at_List + type_List_print_list: .word function_print_list_at_List + + type_Cons: .word 88 + type_Cons_inherits_from: .word type_List + type_Cons_name_address: .word type_Cons_name_size + type_Cons___init__: .word function___init___at_Cons + type_Cons_abort: .word function_abort_at_Object + type_Cons_type_name: .word function_type_name_at_Object + type_Cons_copy: .word function_copy_at_Object + type_Cons_out_string: .word function_out_string_at_IO + type_Cons_out_int: .word function_out_int_at_IO + type_Cons_in_string: .word function_in_string_at_IO + type_Cons_in_int: .word function_in_int_at_IO + type_Cons_isNil: .word function_isNil_at_Cons + type_Cons_cons: .word function_cons_at_List + type_Cons_car: .word function_car_at_Cons + type_Cons_cdr: .word function_cdr_at_Cons + type_Cons_rev: .word function_rev_at_Cons + type_Cons_sort: .word function_sort_at_Cons + type_Cons_insert: .word function_insert_at_Cons + type_Cons_rcons: .word function_rcons_at_Cons + type_Cons_print_list: .word function_print_list_at_Cons + type_Cons_init: .word function_init_at_Cons + + type_Nil: .word 76 + type_Nil_inherits_from: .word type_List + type_Nil_name_address: .word type_Nil_name_size + type_Nil___init__: .word function___init___at_Nil + type_Nil_abort: .word function_abort_at_Object + type_Nil_type_name: .word function_type_name_at_Object + type_Nil_copy: .word function_copy_at_Object + type_Nil_out_string: .word function_out_string_at_IO + type_Nil_out_int: .word function_out_int_at_IO + type_Nil_in_string: .word function_in_string_at_IO + type_Nil_in_int: .word function_in_int_at_IO + type_Nil_isNil: .word function_isNil_at_Nil + type_Nil_cons: .word function_cons_at_List + type_Nil_car: .word function_car_at_List + type_Nil_cdr: .word function_cdr_at_List + type_Nil_rev: .word function_rev_at_Nil + type_Nil_sort: .word function_sort_at_Nil + type_Nil_insert: .word function_insert_at_Nil + type_Nil_rcons: .word function_rcons_at_Nil + type_Nil_print_list: .word function_print_list_at_Nil + + type_Main: .word 52 + type_Main_inherits_from: .word type_IO + type_Main_name_address: .word type_Main_name_size + type_Main___init__: .word function___init___at_Main + type_Main_abort: .word function_abort_at_Object + type_Main_type_name: .word function_type_name_at_Object + type_Main_copy: .word function_copy_at_Object + type_Main_out_string: .word function_out_string_at_IO + type_Main_out_int: .word function_out_int_at_IO + type_Main_in_string: .word function_in_string_at_IO + type_Main_in_int: .word function_in_int_at_IO + type_Main_iota: .word function_iota_at_Main + type_Main_main: .word function_main_at_Main + + type_Object_name_size: .word 6 + type_Object_name: .asciiz "Object" + + type_IO_name_size: .word 2 + type_IO_name: .asciiz "IO" + + type_String_name_size: .word 6 + type_String_name: .asciiz "String" + + type_Int_name_size: .word 3 + type_Int_name: .asciiz "Int" + + type_Bool_name_size: .word 4 + type_Bool_name: .asciiz "Bool" + + type_List_name_size: .word 4 + type_List_name: .asciiz "List" + + type_Cons_name_size: .word 4 + type_Cons_name: .asciiz "Cons" + + type_Nil_name_size: .word 3 + type_Nil_name: .asciiz "Nil" + + type_Main_name_size: .word 4 + type_Main_name: .asciiz "Main" + + buffer_input: .space 1024 + debug_log: .asciiz "debug_log\n" + +.text + function_add: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Addition operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + add $t2, $t0, $t1 # $t2 = $t0 + $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_sub: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Subtraction operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sub $t2, $t0, $t1 # $t2 = $t0 - $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_mult: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Multiplication operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + mult $t0, $t1 # $t2 = $t0 * $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_div: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Division operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + div $t0, $t1 # $t2 = $t0 / $t1 + mflo $t2 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_xor: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Xor operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + xor $t2, $t0, $t1 # $t0 = $t0 ^ $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Int object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + slt $t2, $t0, $t1 # $t2 = $t0 < $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_less_than_or_equal: + # Function parameters + # $ra = 12($sp) + # a = 8($sp) + # b = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Less than operation + lw $t0, 8($sp) # Save in $t0 the left operand address + lw $t0, 8($t0) # Save in $t0 the left operand value + lw $t1, 4($sp) # Save in $t1 the right operand address + lw $t1, 8($t1) # Save in $t1 the rigth operand value + sle $t2, $t0, $t1 # $t2 = $t0 <= $t1 + + lw $t0, 0($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_equal: + # Function parameters + # $ra = 48($sp) + # a = 44($sp) + # b = 40($sp) + + # Reserving space for local variables + addi $sp, $sp, -40 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_0 = address of allocated object Int + + # Allocating NUll to internal_1 + sw $zero, 32($sp) # internal_1 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_2 = address of allocated object Int + + # internal_2 = EqualAddress(a, internal_1) + lw $t0, 44($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # internal_2 = EqualAddress(b, internal_1) + lw $t0, 40($sp) + lw $t1, 32($sp) + seq $t2, $t0, $t1 + lw $t0, 28($sp) + sw $t2, 8($t0) + + # If internal_2 then goto a_is_type_object + lw $t0, 28($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_object + + # internal_3 = typeof a that is the first word of the object + lw $t0, 44($sp) + lw $t0, 0($t0) + sw $t0, 24($sp) + + # internal_4 = direction of Int + la $t0, type_Int + sw $t0, 20($sp) + + # internal_5 = direction of Bool + la $t0, type_Bool + sw $t0, 16($sp) + + # internal_6 = direction of String + la $t0, type_String + sw $t0, 12($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_7 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_8 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_9 = address of allocated object Int + + # internal_7 = EqualAddress(internal_3, internal_4) + lw $t0, 24($sp) + lw $t1, 20($sp) + seq $t2, $t0, $t1 + lw $t0, 8($sp) + sw $t2, 8($t0) + + # internal_8 = EqualAddress(internal_3, internal_5) + lw $t0, 24($sp) + lw $t1, 16($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_9 = EqualAddress(internal_3, internal_6) + lw $t0, 24($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_7 then goto a_is_type_int_or_bool + lw $t0, 8($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_8 then goto a_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_int_or_bool + + # If internal_9 then goto a_is_type_string + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, a_is_type_string + + # Jumping to a_is_type_object + j a_is_type_object + + a_is_type_int_or_bool: + + # internal_0 = EqualInt(a, b) + lw $t0, 44($sp) + lw $t0, 8($t0) + lw $t1, 40($sp) + lw $t1, 8($t1) + seq $t2, $t0, $t1 + lw $t0, 36($sp) + sw $t2, 8($t0) + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_string: + + # internal_0 = EqualStr(a, b) + lw $t0, 44($sp) + lw $t1, 40($sp) + addi $t0, $t0, 8 + addi $t1, $t1, 8 + + # By default we assume the strings are equals + addi $t4, $zero, 1 + lw $t5, 36($sp) + sw $t4, 8($t5) + + while_compare_strings_start: + lb $t2, 0($t0) + lb $t3, 0($t1) + beq $t2, $t3, while_compare_strings_update + + # The strings are no equals + lw $t5, 36($sp) + sw $zero, 8($t5) + j while_compare_strings_end + + while_compare_strings_update: + addi $t0, $t0, 1 + addi $t1, $t1, 1 + beq $t2, $zero, while_compare_strings_end + beq $t3, $zero, while_compare_strings_end + j while_compare_strings_start + while_compare_strings_end: + + # Jumping to end_of_equal + j end_of_equal + + a_is_type_object: + + # Equal operation + lw $t0, 44($sp) # Save in $t0 the left operand address + lw $t1, 40($sp) # Save in $t1 the right operand address + seq $t2, $t0, $t1 # $t2 = $t0 == $t1 + + lw $t0, 36($sp) # $t0 = internal_0 + sw $t2, 8($t0) # Setting value in the third word of the Bool object + + # Jumping to end_of_equal + j end_of_equal + + end_of_equal: + + # Loading return value in $v1 + lw $v1, 36($sp) + + # Freeing space for local variables + addi $sp, $sp, 40 + + jr $ra + + function_assign: + # Function parameters + # $ra = 36($sp) + # dest = 32($sp) + # source = 28($sp) + + # Reserving space for local variables + addi $sp, $sp, -28 + + # Allocating NUll to internal_0 + sw $zero, 24($sp) # internal_0 = 0 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_1 = address of allocated object Int + + # internal_1 = EqualAddress(source, internal_0) + lw $t0, 28($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # internal_1 = EqualAddress(dest, internal_0) + lw $t0, 32($sp) + lw $t1, 24($sp) + seq $t2, $t0, $t1 + lw $t0, 20($sp) + sw $t2, 8($t0) + + # If internal_1 then goto source_is_type_object + lw $t0, 20($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_object + + # internal_2 = typeof source that is the first word of the object + lw $t0, 28($sp) + lw $t0, 0($t0) + sw $t0, 16($sp) + + # internal_3 = direction of Int + la $t0, type_Int + sw $t0, 12($sp) + + # internal_4 = direction of Bool + la $t0, type_Bool + sw $t0, 8($sp) + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_5 = address of allocated object Int + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_6 = address of allocated object Int + + # internal_5 = EqualAddress(internal_2, internal_3) + lw $t0, 16($sp) + lw $t1, 12($sp) + seq $t2, $t0, $t1 + lw $t0, 4($sp) + sw $t2, 8($t0) + + # internal_6 = EqualAddress(internal_2, internal_4) + lw $t0, 16($sp) + lw $t1, 8($sp) + seq $t2, $t0, $t1 + lw $t0, 0($sp) + sw $t2, 8($t0) + + # If internal_5 then goto source_is_type_int_or_bool + lw $t0, 4($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # If internal_6 then goto source_is_type_int_or_bool + lw $t0, 0($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, source_is_type_int_or_bool + + # Jumping to source_is_type_object + j source_is_type_object + + source_is_type_int_or_bool: + + # dest = source where source is an integer + li $v0, 9 + addi $a0, $zero, 12 + syscall + lw $t0, 28($sp) # Pointer to source + lw $t1, 0($t0) # $t1 = type of source + lw $t2, 8($t0) # $t2 = value of source + sw $t1, 0($v0) # Save type of dest + sw $a0, 4($v0) # Save size of dest + sw $t2, 8($v0) # Save value of dest + sw $v0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_is_type_object: + + # dest = source + lw $t0, 28($sp) + sw $t0, 32($sp) + + # Jumping to source_end_of_equal + j source_end_of_equal + + source_end_of_equal: + + # Loading return value in $v1 + lw $v1, 32($sp) + + # Freeing space for local variables + addi $sp, $sp, 28 + + jr $ra + + function___init___at_Object: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_abort_at_Object: + # Function parameters + # $ra = 28($sp) + # self = 24($sp) + + # Reserving space for local variables + addi $sp, $sp, -24 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 33 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 33 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 65 + sb $t0, 8($v0) # internal_0[0] = 'A' + + addi $t0, $zero, 98 + sb $t0, 9($v0) # internal_0[1] = 'b' + + addi $t0, $zero, 111 + sb $t0, 10($v0) # internal_0[2] = 'o' + + addi $t0, $zero, 114 + sb $t0, 11($v0) # internal_0[3] = 'r' + + addi $t0, $zero, 116 + sb $t0, 12($v0) # internal_0[4] = 't' + + addi $t0, $zero, 32 + sb $t0, 13($v0) # internal_0[5] = ' ' + + addi $t0, $zero, 99 + sb $t0, 14($v0) # internal_0[6] = 'c' + + addi $t0, $zero, 97 + sb $t0, 15($v0) # internal_0[7] = 'a' + + addi $t0, $zero, 108 + sb $t0, 16($v0) # internal_0[8] = 'l' + + addi $t0, $zero, 108 + sb $t0, 17($v0) # internal_0[9] = 'l' + + addi $t0, $zero, 101 + sb $t0, 18($v0) # internal_0[10] = 'e' + + addi $t0, $zero, 100 + sb $t0, 19($v0) # internal_0[11] = 'd' + + addi $t0, $zero, 32 + sb $t0, 20($v0) # internal_0[12] = ' ' + + addi $t0, $zero, 102 + sb $t0, 21($v0) # internal_0[13] = 'f' + + addi $t0, $zero, 114 + sb $t0, 22($v0) # internal_0[14] = 'r' + + addi $t0, $zero, 111 + sb $t0, 23($v0) # internal_0[15] = 'o' + + addi $t0, $zero, 109 + sb $t0, 24($v0) # internal_0[16] = 'm' + + addi $t0, $zero, 32 + sb $t0, 25($v0) # internal_0[17] = ' ' + + addi $t0, $zero, 99 + sb $t0, 26($v0) # internal_0[18] = 'c' + + addi $t0, $zero, 108 + sb $t0, 27($v0) # internal_0[19] = 'l' + + addi $t0, $zero, 97 + sb $t0, 28($v0) # internal_0[20] = 'a' + + addi $t0, $zero, 115 + sb $t0, 29($v0) # internal_0[21] = 's' + + addi $t0, $zero, 115 + sb $t0, 30($v0) # internal_0[22] = 's' + + addi $t0, $zero, 32 + sb $t0, 31($v0) # internal_0[23] = ' ' + + sb $zero, 32($v0) # Null-terminator at the end of the string + + sw $v0, 20($sp) # internal_0 = "Abort called from class " + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_3[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 8($sp) # internal_3 = "\n" + + # Allocating Int 2 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 2 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method type_name of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 32($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_5 + lw $t0, 8($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 24($sp) # internal_1 = result of internal_5 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_0 + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing internal_0 + + # Argument internal_1 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_2 = result of internal_5 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_4 = address of allocated object Int + + # Get method concat of String + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 24($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument internal_3 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function internal_5 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 24($sp) # internal_2 = result of internal_5 + addi $sp, $sp, 12 # Freeing space for arguments + + lw $t0, 12($sp) # $t0 = internal_2 + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the String internal_2 + li $v0, 4 + move $a0, $t0 + syscall + + # Exit program + li $v0, 10 + syscall + + # Loading return value in $v1 + lw $v1, 24($sp) + + # Freeing space for local variables + addi $sp, $sp, 24 + + jr $ra + + function_type_name_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = name of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 8($t1) # $t2 = direction of the type name + la $t3, 4($t2) # $t3 = address of the name + lw $t2, 0($t2) # $t2 = length of the name + + addi $t2, $t2, 9 # Setting space for the type, the size and the null byte + li $v0, 9 + move $a0, $t2 + syscall + addi $t2, $t2, -9 # Restoring space for the type, the size and the null byte + + la $t4, type_String + sw $t4, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t4, $v0, 0 # $t4 = direction of the new string + addi $t4, $t4, 8 # Pointer to the first character of the string + xor $t5, $t5, $t5 # Initializing counter + while_copy_name_start: + beq $t5, $t2, while_copy_name_end + lb $t6, 0($t3) # Loading the character + sb $t6, 0($t4) + addi $t4, $t4, 1 # Incrementing the pointer to the new string + addi $t3, $t3, 1 # Incrementing the pointer to the string in self + addi $t5, $t5, 1 # Incrementing counter + j while_copy_name_start + while_copy_name_end: + + sb $zero, 0($t4) # Setting the null byte + + sw $v0, 0($sp) # Storing the new string in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_copy_at_Object: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = copy of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($t0) # $t1 = type of self + lw $t2, 4($t0) # $t2 = length of self in bytes + + # Allocating space for the new object + li $v0, 9 + move $a0, $t2 + syscall + move $t3, $v0 # $t3 = direction of the new object + sw $t1, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + # Initializing the variable of the loop + addi $t0, $t0, 8 # Pointer to the first character of the object + addi $t3, $t3, 8 # Pointer to the first character of the object + addi $t2, $2, -8 # Decrementing in 8 the length of the object + xor $t4, $t4, $t4 # Initializing counter + + # Loop copying the object + while_copy_start: + beq $t4, $t2, while_copy_end + lb $t5, 0($t0) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t0, $t0, 1 # Incrementing the pointer to the object + addi $t3, $t3, 1 # Incrementing the pointer to the new object + addi $t4, $t4, 1 # Incrementing counter + j while_copy_start + while_copy_end: + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_IO: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_out_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + lw $t0, 0($sp) # $t0 = x + addi $t0, $t0, 8 # Pointer to the first character of the string + + # Printing the String x + li $v0, 4 + move $a0, $t0 + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_out_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + # x = 0($sp) + + # Printing the Int x + li $v0, 1 + lw $a0, 0($sp) + lw $a0, 8($a0) + syscall + + # Loading return value in $v1 + lw $v1, 4($sp) + + jr $ra + + function_in_string_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + li $v0, 8 + la $a0, buffer_input + li $a1, 1024 + syscall + + xor $t0, $t0, $t0 # Initializing counter + while_read_start: + lb $t1, buffer_input($t0) # Loading the byte + addi $t2, $zero, 10 + beq $t1, $t2, while_read_end + addi $t2, $zero, 13 + beq $t1, $t2, while_read_end + addi $t0, $t0, 1 # Incrementing counter + j while_read_start + while_read_end: + + addi $t0, $t0, 9 # Adding space for the type, the size and the null byte + li $v0, 9 + move $a0, $t0 + syscall + addi $t0, $t0, -9 # Adding space for the type, the size and the null byte + la $t2, type_String + sw $t2, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t3, $v0, 8 # Pointer to the first character of the string + xor $t4, $t4, $t4 # Initializing counter + + while_copy_from_buffer_start: + beq $t4, $t0, while_copy_from_buffer_end + lb $t5, buffer_input($t4) # Loading the byte + sb $t5, 0($t3) # Storing the byte + addi $t3, $t3, 1 # Imcremeenting pointer + addi $t4, $t4, 1 # Incrementing counter + j while_copy_from_buffer_start + while_copy_from_buffer_end: + + sb $zero, 0($t3) # Storing the null byte + + sw $v0, 0($sp) # Storing the new object in internal_0 + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_in_int_at_IO: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + li $v0, 5 + syscall + lw $t0, 0($sp) + sw $v0, 8($t0) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_String: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_length_at_String: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # internal_0 = length of self + lw $t0, 4($sp) + lw $t1, 4($t0) + addi $t1, $t1, -9 # Subtracting 9 for the type, length, and null-terminator + lw $t0, 0($sp) + sw $t1, 8($t0) + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_concat_at_String: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + # s = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self + s + lw $t0, 8($sp) + lw $t1, 4($sp) + lw $t2, 4($t0) # $t2 = length of str1 + lw $t3, 4($t1) # $t3 = length of str2 + addi $t2, $t2, -9 + addi $t3, $t3, -9 + add $t4, $t2, $t3 # $t4 = length of str1 + str2 + addi $t4, $t4, 9 # Adding the space for the type (4bytes), the length(4bytes) and the null-terminator(1byte) + + li $v0, 9 + move $a0, $t4 + syscall + addi $t4, $t4, -9 # Restoring $t4 = length of str1 + str2 + add $t5, $zero, $v0 # $t5 = address of the new string object + addi $t5, $t5, 8 # $t5 = address of the first byte of the new string + + la $t8, type_String + sw $t8, 0($v0) # Setting type in the first word of th object + + sw $a0, 4($v0) # Setting length of the string in the second word of the object + + # Copying str1 to the new string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_str1_start: + beq $t6, $t2, while_copy_str1_end + lb $t7, 8($t0) + sb $t7, 0($t5) + add $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str1_start + while_copy_str1_end: + + # Copying str2 to the new string + while_copy_str2_start: + beq $t6, $t4, while_copy_str2_end + lb $t7, 8($t1) + sb $t7, 0($t5) + add $t1, $t1, 1 # $t0 = $t0 + 1 Incrementing the address of str1 + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_str2_start + while_copy_str2_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self + s + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_substr_at_String: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + # i = 8($sp) + # l = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # internal_0 = self[i:i + l] + lw $t0, 12($sp) # $t0 = address of the string + lw $t1, 4($t0) # $t1 = length of the string + addi $t1, $t1, -9 # $t1 = length of the string + 9 + lw $t2, 8($sp) # $t2 = start of the substring + lw $t2, 8($t2) + lw $t3, 4($sp) # $t3 = length of the substring + lw $t3, 8($t3) + add $t4, $t2, $t3 # $t4 = start of the substring + length of the substring + + bgt $t4, $t1, substring_out_of_bounds + + addi $t3, $t3, 9 + li $v0, 9 + move $a0, $t3 + syscall + addi $t3, $t3, -9 + + la $t5, type_String + sw $t5, 0($v0) # Setting type in the first word of the object + + sw $a0, 4($v0) # Setting length in the second word of the object + + addi $t0, $t0, 8 # pointing to the first byte of the string + add $t0, $t0, $t2 # pointing to the first byte of the substring + move $t5, $v0 # $t5 = address of the new string + add $t5, $t5, 8 # pointing to the first byte of the string + xor $t6, $t6, $t6 # $t6 = 0 Initializing counter + while_copy_substr_start: + beq $t6, $t3, while_copy_substr_end + lb $t7, 0($t0) + sb $t7, 0($t5) + addi $t0, $t0, 1 # $t0 = $t0 + 1 Incrementing the address of the string + add $t5, $t5, 1 # $t5 = $t5 + 1 Incrementing the address of the new string + addi $t6, $t6, 1 # $t6 = $t6 + 1 Incrementing counter + j while_copy_substr_start + while_copy_substr_end: + + sb $zero, 0($t5) # Setting the null-terminator + + sw $v0, 0($sp) # internal_0 = self[i:i + l] + j substring_not_out_of_bounds + + substring_out_of_bounds: + li $v0, 17 + addi $a0, $zero, 1 + syscall + + substring_not_out_of_bounds: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_Int: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function___init___at_Bool: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function___init___at_List: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_isNil_at_List: + # Function parameters + # $ra = 20($sp) + # self = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_1 = address of allocated object Int + + # Get method abort of List + lw $t0, 16($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 8($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 4($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_2 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_0 = result of internal_2 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Bool 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_3 = address of allocated object Int + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 + + jr $ra + + function_cons_at_List: + # Function parameters + # $ra = 28($sp) + # self = 24($sp) + # hd = 20($sp) + + # Reserving space for local variables + addi $sp, $sp, -20 + + # Allocating Cons + li $v0, 9 + lw $a0, type_Cons + syscall + la $t0, type_Cons # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 12($sp) # internal_1 = address of allocated object Cons + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_1 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function___init___at_Cons + jal function___init___at_Cons + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_1 = result of function___init___at_Cons + addi $sp, $sp, 8 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument new_cell + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing new_cell + + # Argument internal_1 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_1 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 28($sp) # new_cell = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 17 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 17 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_3 = address of allocated object Int + + # Get method init of Cons + lw $t0, 16($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument new_cell + lw $t0, 32($sp) + sw $t0, 8($sp) # Storing new_cell + + # Argument hd + lw $t0, 36($sp) + sw $t0, 4($sp) # Storing hd + + # Argument self + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_4 + lw $t0, 16($sp) + jalr $t0 + lw $ra, 12($sp) + sw $v1, 24($sp) # internal_2 = result of internal_4 + addi $sp, $sp, 16 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 20 + + jr $ra + + function_car_at_List: + # Function parameters + # $ra = 20($sp) + # self = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_1 = address of allocated object Int + + # Get method abort of List + lw $t0, 16($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 8($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 4($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_2 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_0 = result of internal_2 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int + li $v0, 9 + lw $a0, type_Int + syscall + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 0($sp) # internal_3 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_3 + lw $t0, 8($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function___init___at_Int + jal function___init___at_Int + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_3 = result of function___init___at_Int + addi $sp, $sp, 8 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 + + jr $ra + + function_cdr_at_List: + # Function parameters + # $ra = 20($sp) + # self = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_1 = address of allocated object Int + + # Get method abort of List + lw $t0, 16($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 8($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 4($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_2 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_0 = result of internal_2 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating List + li $v0, 9 + lw $a0, type_List + syscall + la $t0, type_List # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 0($sp) # internal_3 = address of allocated object List + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_3 + lw $t0, 8($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function function___init___at_List + jal function___init___at_List + lw $ra, 4($sp) + sw $v1, 8($sp) # internal_3 = result of function___init___at_List + addi $sp, $sp, 8 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 + + jr $ra + + function_rev_at_List: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + + # Reserving space for local variables + addi $sp, $sp, -12 + + # Allocating Int 11 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 11 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_1 = address of allocated object Int + + # Get method cdr of List + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_2 + lw $t0, 8($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_0 = result of internal_2 + addi $sp, $sp, 8 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 12 + + jr $ra + + function_sort_at_List: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + + # Reserving space for local variables + addi $sp, $sp, -12 + + # Allocating Int 11 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 11 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_1 = address of allocated object Int + + # Get method cdr of List + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_2 + lw $t0, 8($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_0 = result of internal_2 + addi $sp, $sp, 8 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 12 + + jr $ra + + function_insert_at_List: + # Function parameters + # $ra = 20($sp) + # self = 16($sp) + # i = 12($sp) + + # Reserving space for local variables + addi $sp, $sp, -12 + + # Allocating Int 11 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 11 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_1 = address of allocated object Int + + # Get method cdr of List + lw $t0, 16($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_2 + lw $t0, 8($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_0 = result of internal_2 + addi $sp, $sp, 8 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 12 + + jr $ra + + function_rcons_at_List: + # Function parameters + # $ra = 20($sp) + # self = 16($sp) + # i = 12($sp) + + # Reserving space for local variables + addi $sp, $sp, -12 + + # Allocating Int 11 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 11 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_1 = address of allocated object Int + + # Get method cdr of List + lw $t0, 16($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_2 + lw $t0, 8($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_0 = result of internal_2 + addi $sp, $sp, 8 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 12 + + jr $ra + + function_print_list_at_List: + # Function parameters + # $ra = 16($sp) + # self = 12($sp) + + # Reserving space for local variables + addi $sp, $sp, -12 + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_1 = address of allocated object Int + + # Get method abort of List + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_2 + lw $t0, 8($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_0 = result of internal_2 + addi $sp, $sp, 8 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 12 + + jr $ra + + function___init___at_Cons: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + + # Reserving space for local variables + addi $sp, $sp, -8 + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_0 = address of allocated object Int + + # Set attribute xcar of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 4($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8776576596306 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8776576596306 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8776576596306 + j object_set_attribute_8776576596306 + int_set_attribute_8776576596306: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.xcar = internal_0 + j end_set_attribute_8776576596306 + bool_set_attribute_8776576596306: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.xcar = internal_0 + j end_set_attribute_8776576596306 + object_set_attribute_8776576596306: + sw $t1, 8($t0) # self.xcar = internal_0 + end_set_attribute_8776576596306: + + # Allocating NUll to internal_1 + sw $zero, 0($sp) # internal_1 = 0 + + # Set attribute xcdr of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_1 + beq $t1, $zero, object_set_attribute_8776576596234 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8776576596234 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8776576596234 + j object_set_attribute_8776576596234 + int_set_attribute_8776576596234: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.xcdr = internal_1 + j end_set_attribute_8776576596234 + bool_set_attribute_8776576596234: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.xcdr = internal_1 + j end_set_attribute_8776576596234 + object_set_attribute_8776576596234: + sw $t1, 12($t0) # self.xcdr = internal_1 + end_set_attribute_8776576596234: + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 8 + + jr $ra + + function_isNil_at_Cons: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_init_at_Cons: + # Function parameters + # $ra = 12($sp) + # self = 8($sp) + # hd = 4($sp) + # tl = 0($sp) + + # Set attribute xcar of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 4($sp) # $t1 = hd + beq $t1, $zero, object_set_attribute_8776576595607 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8776576595607 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8776576595607 + j object_set_attribute_8776576595607 + int_set_attribute_8776576595607: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.xcar = hd + j end_set_attribute_8776576595607 + bool_set_attribute_8776576595607: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.xcar = hd + j end_set_attribute_8776576595607 + object_set_attribute_8776576595607: + sw $t1, 8($t0) # self.xcar = hd + end_set_attribute_8776576595607: + + # Set attribute xcdr of self + lw $t0, 8($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = tl + beq $t1, $zero, object_set_attribute_8776576595502 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8776576595502 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8776576595502 + j object_set_attribute_8776576595502 + int_set_attribute_8776576595502: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.xcdr = tl + j end_set_attribute_8776576595502 + bool_set_attribute_8776576595502: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($t0) # self.xcdr = tl + j end_set_attribute_8776576595502 + object_set_attribute_8776576595502: + sw $t1, 12($t0) # self.xcdr = tl + end_set_attribute_8776576595502: + + # Loading return value in $v1 + lw $v1, 8($sp) + + jr $ra + + function_car_at_Cons: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Get attribute xcar of self + lw $t0, 4($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'xcar' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8776576595523 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8776576595523 + j object_get_attribute_8776576595523 + int_get_attribute_8776576595523: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_0 = self.xcar + j end_get_attribute_8776576595523 + bool_get_attribute_8776576595523: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_0 = self.xcar + j end_get_attribute_8776576595523 + object_get_attribute_8776576595523: + sw $t1, 0($sp) # internal_0 = self.xcar + end_get_attribute_8776576595523: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_cdr_at_Cons: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Get attribute xcdr of self + lw $t0, 4($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'xcdr' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8776576595565 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8776576595565 + j object_get_attribute_8776576595565 + int_get_attribute_8776576595565: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_0 = self.xcdr + j end_get_attribute_8776576595565 + bool_get_attribute_8776576595565: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_0 = self.xcdr + j end_get_attribute_8776576595565 + object_get_attribute_8776576595565: + sw $t1, 0($sp) # internal_0 = self.xcdr + end_get_attribute_8776576595565: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_rev_at_Cons: + # Function parameters + # $ra = 36($sp) + # self = 32($sp) + + # Reserving space for local variables + addi $sp, $sp, -32 + + # Get attribute xcdr of self + lw $t0, 32($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'xcdr' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8776576593830 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8776576593830 + j object_get_attribute_8776576593830 + int_get_attribute_8776576593830: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 28($sp) # internal_0 = self.xcdr + j end_get_attribute_8776576593830 + bool_get_attribute_8776576593830: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 28($sp) # internal_0 = self.xcdr + j end_get_attribute_8776576593830 + object_get_attribute_8776576593830: + sw $t1, 28($sp) # internal_0 = self.xcdr + end_get_attribute_8776576593830: + + # Allocating Int 12 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 12 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_2 = address of allocated object Int + + # Get method rev of List + lw $t0, 28($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 20($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 16($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function internal_3 + lw $t0, 24($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 32($sp) # internal_1 = result of internal_3 + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute xcar of self + lw $t0, 32($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'xcar' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8776576593896 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8776576593896 + j object_get_attribute_8776576593896 + int_get_attribute_8776576593896: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_4 = self.xcar + j end_get_attribute_8776576593896 + bool_get_attribute_8776576593896: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_4 = self.xcar + j end_get_attribute_8776576593896 + object_get_attribute_8776576593896: + sw $t1, 12($sp) # internal_4 = self.xcar + end_get_attribute_8776576593896: + + # Allocating Int 15 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 15 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_6 = address of allocated object Int + + # Get method rcons of List + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_1 + lw $t0, 36($sp) + sw $t0, 4($sp) # Storing internal_1 + + # Argument internal_4 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function internal_7 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_5 = result of internal_7 + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 32 + + jr $ra + + function_sort_at_Cons: + # Function parameters + # $ra = 36($sp) + # self = 32($sp) + + # Reserving space for local variables + addi $sp, $sp, -32 + + # Get attribute xcdr of self + lw $t0, 32($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'xcdr' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8776576576431 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8776576576431 + j object_get_attribute_8776576576431 + int_get_attribute_8776576576431: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 28($sp) # internal_0 = self.xcdr + j end_get_attribute_8776576576431 + bool_get_attribute_8776576576431: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 28($sp) # internal_0 = self.xcdr + j end_get_attribute_8776576576431 + object_get_attribute_8776576576431: + sw $t1, 28($sp) # internal_0 = self.xcdr + end_get_attribute_8776576576431: + + # Allocating Int 13 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 13 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_2 = address of allocated object Int + + # Get method sort of List + lw $t0, 28($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 20($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 16($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function internal_3 + lw $t0, 24($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 32($sp) # internal_1 = result of internal_3 + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute xcar of self + lw $t0, 32($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'xcar' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8776576576476 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8776576576476 + j object_get_attribute_8776576576476 + int_get_attribute_8776576576476: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_4 = self.xcar + j end_get_attribute_8776576576476 + bool_get_attribute_8776576576476: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_4 = self.xcar + j end_get_attribute_8776576576476 + object_get_attribute_8776576576476: + sw $t1, 12($sp) # internal_4 = self.xcar + end_get_attribute_8776576576476: + + # Allocating Int 14 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 14 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_6 = address of allocated object Int + + # Get method insert of List + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_1 + lw $t0, 36($sp) + sw $t0, 4($sp) # Storing internal_1 + + # Argument internal_4 + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function internal_7 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_5 = result of internal_7 + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 32 + + jr $ra + + function_insert_at_Cons: + # Function parameters + # $ra = 76($sp) + # self = 72($sp) + # i = 68($sp) + + # Reserving space for local variables + addi $sp, $sp, -68 + + # Allocating Bool 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 60($sp) # internal_1 = address of allocated object Int + + # Get attribute xcar of self + lw $t0, 72($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'xcar' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8776576575829 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8776576575829 + j object_get_attribute_8776576575829 + int_get_attribute_8776576575829: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 56($sp) # internal_2 = self.xcar + j end_get_attribute_8776576575829 + bool_get_attribute_8776576575829: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 56($sp) # internal_2 = self.xcar + j end_get_attribute_8776576575829 + object_get_attribute_8776576575829: + sw $t1, 56($sp) # internal_2 = self.xcar + end_get_attribute_8776576575829: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument i + lw $t0, 80($sp) + sw $t0, 4($sp) # Storing i + + # Argument internal_2 + lw $t0, 68($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 64($sp) # internal_3 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # internal_1 = internal_3 + lw $t0, 52($sp) + sw $t0, 60($sp) + + # If internal_1 then goto then_8776576620171 + lw $t0, 60($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, then_8776576620171 + + # Jumping to else_8776576620171 + j else_8776576620171 + + then_8776576620171: + + # Allocating Cons + li $v0, 9 + lw $a0, type_Cons + syscall + la $t0, type_Cons # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 48($sp) # internal_4 = address of allocated object Cons + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_4 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function function___init___at_Cons + jal function___init___at_Cons + lw $ra, 4($sp) + sw $v1, 56($sp) # internal_4 = result of function___init___at_Cons + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 17 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 17 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_6 = address of allocated object Int + + # Get method init of Cons + lw $t0, 48($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 40($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 36($sp) + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument internal_4 + lw $t0, 64($sp) + sw $t0, 8($sp) # Storing internal_4 + + # Argument i + lw $t0, 84($sp) + sw $t0, 4($sp) # Storing i + + # Argument self + lw $t0, 88($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_7 + lw $t0, 52($sp) + jalr $t0 + lw $ra, 12($sp) + sw $v1, 60($sp) # internal_5 = result of internal_7 + addi $sp, $sp, 16 # Freeing space for arguments + + # internal_0 = internal_5 + lw $t0, 44($sp) + sw $t0, 64($sp) + + # Jumping to endif_8776576620171 + j endif_8776576620171 + + else_8776576620171: + + # Allocating Cons + li $v0, 9 + lw $a0, type_Cons + syscall + la $t0, type_Cons # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 32($sp) # internal_8 = address of allocated object Cons + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_8 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_8 + + # Calling function function___init___at_Cons + jal function___init___at_Cons + lw $ra, 4($sp) + sw $v1, 40($sp) # internal_8 = result of function___init___at_Cons + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute xcar of self + lw $t0, 72($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'xcar' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8776576577817 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8776576577817 + j object_get_attribute_8776576577817 + int_get_attribute_8776576577817: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 28($sp) # internal_9 = self.xcar + j end_get_attribute_8776576577817 + bool_get_attribute_8776576577817: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 28($sp) # internal_9 = self.xcar + j end_get_attribute_8776576577817 + object_get_attribute_8776576577817: + sw $t1, 28($sp) # internal_9 = self.xcar + end_get_attribute_8776576577817: + + # Get attribute xcdr of self + lw $t0, 72($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'xcdr' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8776576577841 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8776576577841 + j object_get_attribute_8776576577841 + int_get_attribute_8776576577841: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 24($sp) # internal_10 = self.xcdr + j end_get_attribute_8776576577841 + bool_get_attribute_8776576577841: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 24($sp) # internal_10 = self.xcdr + j end_get_attribute_8776576577841 + object_get_attribute_8776576577841: + sw $t1, 24($sp) # internal_10 = self.xcdr + end_get_attribute_8776576577841: + + # Allocating Int 14 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 14 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_12 = address of allocated object Int + + # Get method insert of List + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 16($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 12($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_10 + lw $t0, 36($sp) + sw $t0, 4($sp) # Storing internal_10 + + # Argument i + lw $t0, 80($sp) + sw $t0, 0($sp) # Storing i + + # Calling function internal_13 + lw $t0, 24($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 32($sp) # internal_11 = result of internal_13 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 17 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 17 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_15 = address of allocated object Int + + # Get method init of Cons + lw $t0, 32($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument internal_8 + lw $t0, 48($sp) + sw $t0, 8($sp) # Storing internal_8 + + # Argument internal_9 + lw $t0, 44($sp) + sw $t0, 4($sp) # Storing internal_9 + + # Argument internal_11 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_11 + + # Calling function internal_16 + lw $t0, 16($sp) + jalr $t0 + lw $ra, 12($sp) + sw $v1, 24($sp) # internal_14 = result of internal_16 + addi $sp, $sp, 16 # Freeing space for arguments + + # internal_0 = internal_14 + lw $t0, 8($sp) + sw $t0, 64($sp) + + # Jumping to endif_8776576620171 + j endif_8776576620171 + + endif_8776576620171: + + # Loading return value in $v1 + lw $v1, 64($sp) + + # Freeing space for local variables + addi $sp, $sp, 68 + + jr $ra + + function_rcons_at_Cons: + # Function parameters + # $ra = 44($sp) + # self = 40($sp) + # i = 36($sp) + + # Reserving space for local variables + addi $sp, $sp, -36 + + # Allocating Cons + li $v0, 9 + lw $a0, type_Cons + syscall + la $t0, type_Cons # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 32($sp) # internal_0 = address of allocated object Cons + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_Cons + jal function___init___at_Cons + lw $ra, 4($sp) + sw $v1, 40($sp) # internal_0 = result of function___init___at_Cons + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute xcar of self + lw $t0, 40($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'xcar' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8776576578000 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8776576578000 + j object_get_attribute_8776576578000 + int_get_attribute_8776576578000: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 28($sp) # internal_1 = self.xcar + j end_get_attribute_8776576578000 + bool_get_attribute_8776576578000: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 28($sp) # internal_1 = self.xcar + j end_get_attribute_8776576578000 + object_get_attribute_8776576578000: + sw $t1, 28($sp) # internal_1 = self.xcar + end_get_attribute_8776576578000: + + # Get attribute xcdr of self + lw $t0, 40($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'xcdr' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8776576578024 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8776576578024 + j object_get_attribute_8776576578024 + int_get_attribute_8776576578024: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 24($sp) # internal_2 = self.xcdr + j end_get_attribute_8776576578024 + bool_get_attribute_8776576578024: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 24($sp) # internal_2 = self.xcdr + j end_get_attribute_8776576578024 + object_get_attribute_8776576578024: + sw $t1, 24($sp) # internal_2 = self.xcdr + end_get_attribute_8776576578024: + + # Allocating Int 15 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 15 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_4 = address of allocated object Int + + # Get method rcons of List + lw $t0, 24($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 16($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 12($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument internal_2 + lw $t0, 36($sp) + sw $t0, 4($sp) # Storing internal_2 + + # Argument i + lw $t0, 48($sp) + sw $t0, 0($sp) # Storing i + + # Calling function internal_5 + lw $t0, 24($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 32($sp) # internal_3 = result of internal_5 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 17 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 17 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_7 = address of allocated object Int + + # Get method init of Cons + lw $t0, 32($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument internal_0 + lw $t0, 48($sp) + sw $t0, 8($sp) # Storing internal_0 + + # Argument internal_1 + lw $t0, 44($sp) + sw $t0, 4($sp) # Storing internal_1 + + # Argument internal_3 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_3 + + # Calling function internal_8 + lw $t0, 16($sp) + jalr $t0 + lw $ra, 12($sp) + sw $v1, 24($sp) # internal_6 = result of internal_8 + addi $sp, $sp, 16 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 36 + + jr $ra + + function_print_list_at_Cons: + # Function parameters + # $ra = 52($sp) + # self = 48($sp) + + # Reserving space for local variables + addi $sp, $sp, -48 + + # Get attribute xcar of self + lw $t0, 48($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'xcar' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8776576578419 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8776576578419 + j object_get_attribute_8776576578419 + int_get_attribute_8776576578419: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 44($sp) # internal_0 = self.xcar + j end_get_attribute_8776576578419 + bool_get_attribute_8776576578419: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 44($sp) # internal_0 = self.xcar + j end_get_attribute_8776576578419 + object_get_attribute_8776576578419: + sw $t1, 44($sp) # internal_0 = self.xcar + end_get_attribute_8776576578419: + + # Allocating Int 5 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 5 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 36($sp) # internal_2 = address of allocated object Int + + # Get method out_int of Cons + lw $t0, 48($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 36($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 32($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_0 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function internal_3 + lw $t0, 44($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 52($sp) # internal_1 = result of internal_3 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating String + li $v0, 9 + addi $a0, $zero, 10 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 10 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 10 + sb $t0, 8($v0) # internal_4[0] = '\n' + + sb $zero, 9($v0) # Null-terminator at the end of the string + + sw $v0, 28($sp) # internal_4 = "\n" + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 20($sp) # internal_6 = address of allocated object Int + + # Get method out_string of Cons + lw $t0, 48($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 20($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 16($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_4 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function internal_7 + lw $t0, 28($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 36($sp) # internal_5 = result of internal_7 + addi $sp, $sp, 12 # Freeing space for arguments + + # Get attribute xcdr of self + lw $t0, 48($sp) # Get the address of self + lw $t1, 12($t0) # Get the attribute 'xcdr' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8776576578536 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8776576578536 + j object_get_attribute_8776576578536 + int_get_attribute_8776576578536: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_8 = self.xcdr + j end_get_attribute_8776576578536 + bool_get_attribute_8776576578536: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 12($sp) # internal_8 = self.xcdr + j end_get_attribute_8776576578536 + object_get_attribute_8776576578536: + sw $t1, 12($sp) # internal_8 = self.xcdr + end_get_attribute_8776576578536: + + # Allocating Int 16 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 16 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_10 = address of allocated object Int + + # Get method print_list of List + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_8 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_8 + + # Calling function internal_11 + lw $t0, 8($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_9 = result of internal_11 + addi $sp, $sp, 8 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 48 + + jr $ra + + function___init___at_Nil: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_isNil_at_Nil: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_rev_at_Nil: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_sort_at_Nil: + # Function parameters + # $ra = 4($sp) + # self = 0($sp) + + # Loading return value in $v1 + lw $v1, 0($sp) + + jr $ra + + function_insert_at_Nil: + # Function parameters + # $ra = 20($sp) + # self = 16($sp) + # i = 12($sp) + + # Reserving space for local variables + addi $sp, $sp, -12 + + # Allocating Int 15 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 15 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_1 = address of allocated object Int + + # Get method rcons of Nil + lw $t0, 16($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 28($sp) + sw $t0, 4($sp) # Storing self + + # Argument i + lw $t0, 24($sp) + sw $t0, 0($sp) # Storing i + + # Calling function internal_2 + lw $t0, 12($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 20($sp) # internal_0 = result of internal_2 + addi $sp, $sp, 12 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 12 + + jr $ra + + function_rcons_at_Nil: + # Function parameters + # $ra = 24($sp) + # self = 20($sp) + # i = 16($sp) + + # Reserving space for local variables + addi $sp, $sp, -16 + + # Allocating Cons + li $v0, 9 + lw $a0, type_Cons + syscall + la $t0, type_Cons # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 12($sp) # internal_0 = address of allocated object Cons + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_Cons + jal function___init___at_Cons + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_0 = result of function___init___at_Cons + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 17 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 17 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_2 = address of allocated object Int + + # Get method init of Cons + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument internal_0 + lw $t0, 28($sp) + sw $t0, 8($sp) # Storing internal_0 + + # Argument i + lw $t0, 32($sp) + sw $t0, 4($sp) # Storing i + + # Argument self + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_3 + lw $t0, 16($sp) + jalr $t0 + lw $ra, 12($sp) + sw $v1, 24($sp) # internal_1 = result of internal_3 + addi $sp, $sp, 16 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 16 + + jr $ra + + function_print_list_at_Nil: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating Bool 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Bool # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 0($sp) # internal_0 = address of allocated object Int + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function___init___at_Main: + # Function parameters + # $ra = 8($sp) + # self = 4($sp) + + # Reserving space for local variables + addi $sp, $sp, -4 + + # Allocating NUll to internal_0 + sw $zero, 0($sp) # internal_0 = 0 + + # Set attribute l of self + lw $t0, 4($sp) # $t0 = self + lw $t1, 0($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8776576580184 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8776576580184 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8776576580184 + j object_set_attribute_8776576580184 + int_set_attribute_8776576580184: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.l = internal_0 + j end_set_attribute_8776576580184 + bool_set_attribute_8776576580184: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.l = internal_0 + j end_set_attribute_8776576580184 + object_set_attribute_8776576580184: + sw $t1, 8($t0) # self.l = internal_0 + end_set_attribute_8776576580184: + + # Loading return value in $v1 + lw $v1, 4($sp) + + # Freeing space for local variables + addi $sp, $sp, 4 + + jr $ra + + function_iota_at_Main: + # Function parameters + # $ra = 60($sp) + # self = 56($sp) + # i = 52($sp) + + # Reserving space for local variables + addi $sp, $sp, -52 + + # Allocating Nil + li $v0, 9 + lw $a0, type_Nil + syscall + la $t0, type_Nil # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 48($sp) # internal_0 = address of allocated object Nil + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 56($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_Nil + jal function___init___at_Nil + lw $ra, 4($sp) + sw $v1, 56($sp) # internal_0 = result of function___init___at_Nil + addi $sp, $sp, 8 # Freeing space for arguments + + # Set attribute l of self + lw $t0, 56($sp) # $t0 = self + lw $t1, 48($sp) # $t1 = internal_0 + beq $t1, $zero, object_set_attribute_8776576580229 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8776576580229 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8776576580229 + j object_set_attribute_8776576580229 + int_set_attribute_8776576580229: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.l = internal_0 + j end_set_attribute_8776576580229 + bool_set_attribute_8776576580229: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.l = internal_0 + j end_set_attribute_8776576580229 + object_set_attribute_8776576580229: + sw $t1, 8($t0) # self.l = internal_0 + end_set_attribute_8776576580229: + + # Allocating Int 0 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 0 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_2 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument j + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing j + + # Argument internal_2 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_2 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 56($sp) # j = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating NUll to internal_3 + sw $zero, 36($sp) # internal_3 = 0 + + while_start_8776576620948: + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument j + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing j + + # Argument i + lw $t0, 64($sp) + sw $t0, 0($sp) # Storing i + + # Calling function function_less_than + jal function_less_than + lw $ra, 8($sp) + sw $v1, 44($sp) # internal_4 = result of function_less_than + addi $sp, $sp, 12 # Freeing space for arguments + + # If internal_4 then goto while_body_8776576620948 + lw $t0, 32($sp) # Loading the address of the condition + lw $t0, 8($t0) # Loading the value of the condition + addi $t1, $zero, 1 # Setting the value to 1 for comparison + beq $t0, $t1, while_body_8776576620948 + + # Jumping to while_end_8776576620948 + j while_end_8776576620948 + + while_body_8776576620948: + + # Allocating Cons + li $v0, 9 + lw $a0, type_Cons + syscall + la $t0, type_Cons # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 28($sp) # internal_5 = address of allocated object Cons + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_5 + lw $t0, 36($sp) + sw $t0, 0($sp) # Storing internal_5 + + # Calling function function___init___at_Cons + jal function___init___at_Cons + lw $ra, 4($sp) + sw $v1, 36($sp) # internal_5 = result of function___init___at_Cons + addi $sp, $sp, 8 # Freeing space for arguments + + # Get attribute l of self + lw $t0, 56($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'l' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8776576580988 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8776576580988 + j object_get_attribute_8776576580988 + int_get_attribute_8776576580988: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 24($sp) # internal_6 = self.l + j end_get_attribute_8776576580988 + bool_get_attribute_8776576580988: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 24($sp) # internal_6 = self.l + j end_get_attribute_8776576580988 + object_get_attribute_8776576580988: + sw $t1, 24($sp) # internal_6 = self.l + end_get_attribute_8776576580988: + + # Allocating Int 17 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 17 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_8 = address of allocated object Int + + # Get method init of Cons + lw $t0, 28($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 16($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 12($sp) + + # Passing function arguments + addi $sp, $sp, -16 # Reserving space for arguments + sw $ra, 12($sp) # Storing return address + + # Argument internal_5 + lw $t0, 44($sp) + sw $t0, 8($sp) # Storing internal_5 + + # Argument j + lw $t0, 60($sp) + sw $t0, 4($sp) # Storing j + + # Argument internal_6 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_6 + + # Calling function internal_9 + lw $t0, 28($sp) + jalr $t0 + lw $ra, 12($sp) + sw $v1, 36($sp) # internal_7 = result of internal_9 + addi $sp, $sp, 16 # Freeing space for arguments + + # Set attribute l of self + lw $t0, 56($sp) # $t0 = self + lw $t1, 20($sp) # $t1 = internal_7 + beq $t1, $zero, object_set_attribute_8776576580937 + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_set_attribute_8776576580937 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_set_attribute_8776576580937 + j object_set_attribute_8776576580937 + int_set_attribute_8776576580937: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.l = internal_7 + j end_set_attribute_8776576580937 + bool_set_attribute_8776576580937: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 8($t0) # self.l = internal_7 + j end_set_attribute_8776576580937 + object_set_attribute_8776576580937: + sw $t1, 8($t0) # self.l = internal_7 + end_set_attribute_8776576580937: + + # Allocating Int 1 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 1 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 8($sp) # internal_10 = address of allocated object Int + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument j + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing j + + # Argument internal_10 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_10 + + # Calling function function_add + jal function_add + lw $ra, 8($sp) + sw $v1, 16($sp) # internal_11 = result of function_add + addi $sp, $sp, 12 # Freeing space for arguments + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument j + lw $t0, 56($sp) + sw $t0, 4($sp) # Storing j + + # Argument internal_11 + lw $t0, 16($sp) + sw $t0, 0($sp) # Storing internal_11 + + # Calling function function_assign + jal function_assign + lw $ra, 8($sp) + sw $v1, 56($sp) # j = result of function_assign + addi $sp, $sp, 12 # Freeing space for arguments + + # Jumping to while_start_8776576620948 + j while_start_8776576620948 + + while_end_8776576620948: + + # Get attribute l of self + lw $t0, 56($sp) # Get the address of self + lw $t1, 8($t0) # Get the attribute 'l' from the self + lw $t2, 0($t1) + la $t3, type_Int + la $t4, type_Bool + addi $t5, $zero, 1 + seq $t6, $t2, $t3 + beq $t6, $t5, int_get_attribute_8776576580304 + seq $t6, $t2, $t4 + beq $t6, $t5, bool_get_attribute_8776576580304 + j object_get_attribute_8776576580304 + int_get_attribute_8776576580304: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t3, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_12 = self.l + j end_get_attribute_8776576580304 + bool_get_attribute_8776576580304: + li $v0, 9 + addi $a0, $zero, 12 + syscall + sw $t4, 0($v0) + sw $a0, 4($v0) + lw $t5, 8($t1) + sw $t5, 8($v0) + sw $v0, 0($sp) # internal_12 = self.l + j end_get_attribute_8776576580304 + object_get_attribute_8776576580304: + sw $t1, 0($sp) # internal_12 = self.l + end_get_attribute_8776576580304: + + # Loading return value in $v1 + lw $v1, 0($sp) + + # Freeing space for local variables + addi $sp, $sp, 52 + + jr $ra + + function_main_at_Main: + # Function parameters + # $ra = 80($sp) + # self = 76($sp) + + # Reserving space for local variables + addi $sp, $sp, -76 + + # Allocating String + li $v0, 9 + addi $a0, $zero, 35 # $a0 = length of string + 9 for 4 bytes for the type, 4 bytes for the length of the string and 1 byte for null-terminator + syscall + + la $t0, type_String + sw $t0, 0($v0) # Setting type in the first word of the object + + addi $t0, $zero, 35 + sw $t0, 4($v0) # Setting length of the string in the second word of the object + + addi $t0, $zero, 72 + sb $t0, 8($v0) # internal_0[0] = 'H' + + addi $t0, $zero, 111 + sb $t0, 9($v0) # internal_0[1] = 'o' + + addi $t0, $zero, 119 + sb $t0, 10($v0) # internal_0[2] = 'w' + + addi $t0, $zero, 32 + sb $t0, 11($v0) # internal_0[3] = ' ' + + addi $t0, $zero, 109 + sb $t0, 12($v0) # internal_0[4] = 'm' + + addi $t0, $zero, 97 + sb $t0, 13($v0) # internal_0[5] = 'a' + + addi $t0, $zero, 110 + sb $t0, 14($v0) # internal_0[6] = 'n' + + addi $t0, $zero, 121 + sb $t0, 15($v0) # internal_0[7] = 'y' + + addi $t0, $zero, 32 + sb $t0, 16($v0) # internal_0[8] = ' ' + + addi $t0, $zero, 110 + sb $t0, 17($v0) # internal_0[9] = 'n' + + addi $t0, $zero, 117 + sb $t0, 18($v0) # internal_0[10] = 'u' + + addi $t0, $zero, 109 + sb $t0, 19($v0) # internal_0[11] = 'm' + + addi $t0, $zero, 98 + sb $t0, 20($v0) # internal_0[12] = 'b' + + addi $t0, $zero, 101 + sb $t0, 21($v0) # internal_0[13] = 'e' + + addi $t0, $zero, 114 + sb $t0, 22($v0) # internal_0[14] = 'r' + + addi $t0, $zero, 115 + sb $t0, 23($v0) # internal_0[15] = 's' + + addi $t0, $zero, 32 + sb $t0, 24($v0) # internal_0[16] = ' ' + + addi $t0, $zero, 116 + sb $t0, 25($v0) # internal_0[17] = 't' + + addi $t0, $zero, 111 + sb $t0, 26($v0) # internal_0[18] = 'o' + + addi $t0, $zero, 32 + sb $t0, 27($v0) # internal_0[19] = ' ' + + addi $t0, $zero, 115 + sb $t0, 28($v0) # internal_0[20] = 's' + + addi $t0, $zero, 111 + sb $t0, 29($v0) # internal_0[21] = 'o' + + addi $t0, $zero, 114 + sb $t0, 30($v0) # internal_0[22] = 'r' + + addi $t0, $zero, 116 + sb $t0, 31($v0) # internal_0[23] = 't' + + addi $t0, $zero, 63 + sb $t0, 32($v0) # internal_0[24] = '?' + + addi $t0, $zero, 32 + sb $t0, 33($v0) # internal_0[25] = ' ' + + sb $zero, 34($v0) # Null-terminator at the end of the string + + sw $v0, 72($sp) # internal_0 = "How many numbers to sort? " + + # Allocating Int 4 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 4 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 64($sp) # internal_2 = address of allocated object Int + + # Get method out_string of Main + lw $t0, 76($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 64($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 60($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 88($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_0 + lw $t0, 84($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function internal_3 + lw $t0, 72($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 80($sp) # internal_1 = result of internal_3 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 7 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 7 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 52($sp) # internal_5 = address of allocated object Int + + # Get method in_int of Main + lw $t0, 76($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 52($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 48($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument self + lw $t0, 84($sp) + sw $t0, 0($sp) # Storing self + + # Calling function internal_6 + lw $t0, 56($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 64($sp) # internal_4 = result of internal_6 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 8 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 8 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 40($sp) # internal_8 = address of allocated object Int + + # Get method iota of Main + lw $t0, 76($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 40($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 36($sp) + + # Passing function arguments + addi $sp, $sp, -12 # Reserving space for arguments + sw $ra, 8($sp) # Storing return address + + # Argument self + lw $t0, 88($sp) + sw $t0, 4($sp) # Storing self + + # Argument internal_4 + lw $t0, 68($sp) + sw $t0, 0($sp) # Storing internal_4 + + # Calling function internal_9 + lw $t0, 48($sp) + jalr $t0 + lw $ra, 8($sp) + sw $v1, 56($sp) # internal_7 = result of internal_9 + addi $sp, $sp, 12 # Freeing space for arguments + + # Allocating Int 12 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 12 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 28($sp) # internal_11 = address of allocated object Int + + # Get method rev of List + lw $t0, 44($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 28($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 24($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_7 + lw $t0, 52($sp) + sw $t0, 0($sp) # Storing internal_7 + + # Calling function internal_12 + lw $t0, 32($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 40($sp) # internal_10 = result of internal_12 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 13 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 13 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 16($sp) # internal_14 = address of allocated object Int + + # Get method sort of List + lw $t0, 32($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 16($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 12($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_10 + lw $t0, 40($sp) + sw $t0, 0($sp) # Storing internal_10 + + # Calling function internal_15 + lw $t0, 20($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 28($sp) # internal_13 = result of internal_15 + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 16 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 16 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_17 = address of allocated object Int + + # Get method print_list of List + lw $t0, 20($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_13 + lw $t0, 28($sp) + sw $t0, 0($sp) # Storing internal_13 + + # Calling function internal_18 + lw $t0, 8($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_16 = result of internal_18 + addi $sp, $sp, 8 # Freeing space for arguments + + # Loading return value in $v1 + lw $v1, 8($sp) + + # Freeing space for local variables + addi $sp, $sp, 76 + + jr $ra + + main: + # Reserving space for local variables + addi $sp, $sp, -16 + + # Allocating Main + li $v0, 9 + lw $a0, type_Main + syscall + la $t0, type_Main # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of th object + sw $a0, 4($v0) # Setting size in the second word of th object + sw $v0, 12($sp) # internal_0 = address of allocated object Main + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function function___init___at_Main + jal function___init___at_Main + lw $ra, 4($sp) + sw $v1, 20($sp) # internal_0 = result of function___init___at_Main + addi $sp, $sp, 8 # Freeing space for arguments + + # Allocating Int 9 + li $v0, 9 + addi $a0, $zero, 12 + syscall + + la $t0, type_Int # $t0 = address of the type + sw $t0, 0($v0) # Setting type in the first word of the object + sw $a0, 4($v0) # Setting size in the second word of the object + addi $t0, $zero, 9 + sw $t0, 8($v0) # Setting value in the third word of the object + sw $v0, 4($sp) # internal_2 = address of allocated object Int + + # Get method main of Main + lw $t0, 12($sp) + lw $t0, 0($t0) + addi $t0, $t0, 12 + lw $t1, 4($sp) + lw $t1, 8($t1) + sll $t1, $t1, 2 + add $t0, $t0, $t1 + lw $t0, 0($t0) + sw $t0, 0($sp) + + # Passing function arguments + addi $sp, $sp, -8 # Reserving space for arguments + sw $ra, 4($sp) # Storing return address + + # Argument internal_0 + lw $t0, 20($sp) + sw $t0, 0($sp) # Storing internal_0 + + # Calling function internal_3 + lw $t0, 8($sp) + jalr $t0 + lw $ra, 4($sp) + sw $v1, 16($sp) # internal_1 = result of internal_3 + addi $sp, $sp, 8 # Freeing space for arguments + + # Exit program + li $v0, 10 + syscall + + \ No newline at end of file diff --git a/tests/codegen/sort-list_input.txt b/tests/codegen/sort-list_input.txt index f599e28b8..d43401489 100644 --- a/tests/codegen/sort-list_input.txt +++ b/tests/codegen/sort-list_input.txt @@ -1 +1 @@ -10 +10 diff --git a/tests/codegen/sort-list_output.txt b/tests/codegen/sort-list_output.txt index 9878d57ea..7b1d40452 100644 --- a/tests/codegen/sort-list_output.txt +++ b/tests/codegen/sort-list_output.txt @@ -1,10 +1,10 @@ -How many numbers to sort? 0 -1 -2 -3 -4 -5 -6 -7 -8 -9 +How many numbers to sort? 0 +1 +2 +3 +4 +5 +6 +7 +8 +9 diff --git a/tests/codegen_test.py b/tests/codegen_test.py index 48df768ff..299bc9eb6 100644 --- a/tests/codegen_test.py +++ b/tests/codegen_test.py @@ -1,17 +1,24 @@ -import pytest -import os -from utils import compare_outputs - -tests_dir = __file__.rpartition('/')[0] + '/codegen/' -tests = [(file) for file in os.listdir(tests_dir) if file.endswith('.cl')] - -# @pytest.mark.lexer -# @pytest.mark.parser -# @pytest.mark.semantic -@pytest.mark.codegen -@pytest.mark.ok -@pytest.mark.run(order=4) -@pytest.mark.parametrize("cool_file", tests) -def test_codegen(compiler_path, cool_file): - compare_outputs(compiler_path, tests_dir + cool_file, tests_dir + cool_file[:-3] + '_input.txt',\ - tests_dir + cool_file[:-3] + '_output.txt') \ No newline at end of file +import os +import pathlib + +import pytest + +from .utils import compare_outputs + +tests_dir = str(pathlib.Path(__file__).parent / "codegen") +tests = [(file) for file in os.listdir(tests_dir) if file.endswith(".cl")] + +# @pytest.mark.lexer +# @pytest.mark.parser +# @pytest.mark.semantic +@pytest.mark.codegen +@pytest.mark.ok +@pytest.mark.run(order=4) +@pytest.mark.parametrize("cool_file", tests) +def test_codegen(compiler_path, cool_file): + compare_outputs( + compiler_path, + str(os.path.join(tests_dir, cool_file)), + str(os.path.join(tests_dir, cool_file[:-3] + "_input.txt")), + str(os.path.join(tests_dir, cool_file[:-3] + "_output.txt")), + ) diff --git a/tests/conftest.py b/tests/conftest.py index 1f44eeb72..66f97fe6a 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,6 +1,14 @@ -import pytest -import os - -@pytest.fixture -def compiler_path(): - return os.path.abspath('./coolc.sh') \ No newline at end of file +import pytest +import os +import platform + + +@pytest.fixture +def compiler_path(): + extension = "sh" if platform.system() != "Windows" else "py" + + if os.getcwd().endswith("src"): + return os.path.abspath(f"./coolc.{extension}") + + # For local test using the testing system of visual studio code + return os.path.abspath(os.path.join("src", f"coolc.{extension}")) diff --git a/tests/lexer/comment1.cl b/tests/lexer/comment1.cl index 69533f23c..1b63af3c7 100644 --- a/tests/lexer/comment1.cl +++ b/tests/lexer/comment1.cl @@ -1,55 +1,55 @@ ---Any characters between two dashes “--” and the next newline ---(or EOF, if there is no next newline) are treated as comments - -(*(*(* -Comments may also be written by enclosing -text in (∗ . . . ∗). The latter form of comment may be nested. -Comments cannot cross file boundaries. -*)*)*) - -class Error() { - - (* There was once a comment, - that was quite long. - But, the reader soon discovered that - the comment was indeed longer than - previously assumed. Now, the reader - was in a real dilemma; is the comment - ever gonna end? If I stop reading, will - it end? - He started imagining all sorts of things. - He thought about heisenberg's cat and how - how that relates to the end of the sentence. - He thought to himself "I'm gonna stop reading". - "If I keep reading this comment, I'm gonna know - the fate of this sentence; That will be disastorous." - He knew that such a comment was gonna extend to - another file. It was too awesome to be contained in - a single file. And he would have kept reading too... - if only... - cool wasn't a super-duper-fab-awesomest language; - but cool is that language; - "This comment shall go not cross this file" said cool. - Alas! The reader could read no more. - There was once a comment, - that was quite long. - But, the reader soon discovered that - the comment was indeed longer than - previously assumed. Now, the reader - was in a real dilemma; is the comment - ever gonna end? If I stop reading, will - it end? - He started imagining all sorts of things. - He thought about heisenberg's cat and how - how that relates to the end of the sentence. - He thought to himself "I'm gonna stop reading". - "If I keep reading this comment, I'm gonna know - the fate of this sentence; That will be disastorous." - He knew that such a comment was gonna extend to - another file. It was too awesome to be contained in - a single file. And he would have kept reading too... - if only... - cool wasn't a super-duper-fab-awesomest language; - but cool is that language; - "This comment shall go not cross this file" said cool. +--Any characters between two dashes “--” and the next newline +--(or EOF, if there is no next newline) are treated as comments + +(*(*(* +Comments may also be written by enclosing +text in (∗ . . . ∗). The latter form of comment may be nested. +Comments cannot cross file boundaries. +*)*)*) + +class Error() { + + (* There was once a comment, + that was quite long. + But, the reader soon discovered that + the comment was indeed longer than + previously assumed. Now, the reader + was in a real dilemma; is the comment + ever gonna end? If I stop reading, will + it end? + He started imagining all sorts of things. + He thought about heisenberg's cat and how + how that relates to the end of the sentence. + He thought to himself "I'm gonna stop reading". + "If I keep reading this comment, I'm gonna know + the fate of this sentence; That will be disastorous." + He knew that such a comment was gonna extend to + another file. It was too awesome to be contained in + a single file. And he would have kept reading too... + if only... + cool wasn't a super-duper-fab-awesomest language; + but cool is that language; + "This comment shall go not cross this file" said cool. + Alas! The reader could read no more. + There was once a comment, + that was quite long. + But, the reader soon discovered that + the comment was indeed longer than + previously assumed. Now, the reader + was in a real dilemma; is the comment + ever gonna end? If I stop reading, will + it end? + He started imagining all sorts of things. + He thought about heisenberg's cat and how + how that relates to the end of the sentence. + He thought to himself "I'm gonna stop reading". + "If I keep reading this comment, I'm gonna know + the fate of this sentence; That will be disastorous." + He knew that such a comment was gonna extend to + another file. It was too awesome to be contained in + a single file. And he would have kept reading too... + if only... + cool wasn't a super-duper-fab-awesomest language; + but cool is that language; + "This comment shall go not cross this file" said cool. Alas! The reader could read no more. \ No newline at end of file diff --git a/tests/lexer/comment1_error.txt b/tests/lexer/comment1_error.txt index 9fd7b8d67..710483ee9 100644 --- a/tests/lexer/comment1_error.txt +++ b/tests/lexer/comment1_error.txt @@ -1 +1 @@ -(55, 46) - LexicographicError: EOF in comment +(55, 46) - LexicographicError: EOF in comment diff --git a/tests/lexer/iis1.cl b/tests/lexer/iis1.cl index 12cb52beb..ca6b68ac3 100644 --- a/tests/lexer/iis1.cl +++ b/tests/lexer/iis1.cl @@ -1,111 +1,111 @@ -(* Integers, Identifiers, and Special Notation *) - -0007 123 +1 -1 +90 -09 +11113 -4r *a *self* c++ -5! = 120, 2 + 2 = 5 or E = mc2; p + 1 @ p = 1: for x in range(len(b)) -new / <- <<==> {( Int: Objet, Bool; String.string SELF_TYPE isvoid }) -class Class if then else fi testing Testing ~007agent_bond james_007B0N3SS___ -loop pool while tRuE or noT faLsE let in case of ESAC - -(* -#3 INT_CONST 0007 -#3 INT_CONST 123 -#3 '+' -#3 INT_CONST 1 -#3 '-' -#3 INT_CONST 1 -#3 '+' -#3 INT_CONST 90 -#3 '-' -#3 INT_CONST 09 -#3 '+' -#3 INT_CONST 11113 -#3 '-' -#3 INT_CONST 4 -#3 OBJECTID r -#3 '*' -#3 OBJECTID a -#3 '*' -#3 OBJECTID self -#3 '*' -#3 OBJECTID c -#3 '+' -#3 '+' -#4 INT_CONST 5 -#4 ERROR "!" -#4 '=' -#4 INT_CONST 120 -#4 ',' -#4 INT_CONST 2 -#4 '+' -#4 INT_CONST 2 -#4 '=' -#4 INT_CONST 5 -#4 OBJECTID or -#4 TYPEID E -#4 '=' -#4 OBJECTID mc2 -#4 ';' -#4 OBJECTID p -#4 '+' -#4 INT_CONST 1 -#4 '@' -#4 OBJECTID p -#4 '=' -#4 INT_CONST 1 -#4 ':' -#4 OBJECTID for -#4 OBJECTID x -#4 IN -#4 OBJECTID range -#4 '(' -#4 OBJECTID len -#4 '(' -#4 OBJECTID b -#4 ')' -#4 ')' -#5 NEW -#5 '/' -#5 ASSIGN -#5 '<' -#5 LE -#5 DARROW -#5 '{' -#5 '(' -#5 TYPEID Int -#5 ':' -#5 TYPEID Objet -#5 ',' -#5 TYPEID Bool -#5 ';' -#5 TYPEID String -#5 '.' -#5 OBJECTID string -#5 TYPEID SELF_TYPE -#5 ISVOID -#5 '}' -#5 ')' -#6 CLASS -#6 CLASS -#6 IF -#6 THEN -#6 ELSE -#6 FI -#6 OBJECTID testing -#6 TYPEID Testing -#6 '~' -#6 INT_CONST 007 -#6 OBJECTID agent_bond -#6 OBJECTID james_007B0N3SS___ -#7 LOOP -#7 POOL -#7 WHILE -#7 BOOL_CONST true -#7 OBJECTID or -#7 NOT -#7 BOOL_CONST false -#7 LET -#7 IN -#7 CASE -#7 OF -#7 ESAC +(* Integers, Identifiers, and Special Notation *) + +0007 123 +1 -1 +90 -09 +11113 -4r *a *self* c++ +5! = 120, 2 + 2 = 5 or E = mc2; p + 1 @ p = 1: for x in range(len(b)) +new / <- <<==> {( Int: Objet, Bool; String.string SELF_TYPE isvoid }) +class Class if then else fi testing Testing ~007agent_bond james_007B0N3SS___ +loop pool while tRuE or noT faLsE let in case of ESAC + +(* +#3 INT_CONST 0007 +#3 INT_CONST 123 +#3 '+' +#3 INT_CONST 1 +#3 '-' +#3 INT_CONST 1 +#3 '+' +#3 INT_CONST 90 +#3 '-' +#3 INT_CONST 09 +#3 '+' +#3 INT_CONST 11113 +#3 '-' +#3 INT_CONST 4 +#3 OBJECTID r +#3 '*' +#3 OBJECTID a +#3 '*' +#3 OBJECTID self +#3 '*' +#3 OBJECTID c +#3 '+' +#3 '+' +#4 INT_CONST 5 +#4 ERROR "!" +#4 '=' +#4 INT_CONST 120 +#4 ',' +#4 INT_CONST 2 +#4 '+' +#4 INT_CONST 2 +#4 '=' +#4 INT_CONST 5 +#4 OBJECTID or +#4 TYPEID E +#4 '=' +#4 OBJECTID mc2 +#4 ';' +#4 OBJECTID p +#4 '+' +#4 INT_CONST 1 +#4 '@' +#4 OBJECTID p +#4 '=' +#4 INT_CONST 1 +#4 ':' +#4 OBJECTID for +#4 OBJECTID x +#4 IN +#4 OBJECTID range +#4 '(' +#4 OBJECTID len +#4 '(' +#4 OBJECTID b +#4 ')' +#4 ')' +#5 NEW +#5 '/' +#5 ASSIGN +#5 '<' +#5 LE +#5 DARROW +#5 '{' +#5 '(' +#5 TYPEID Int +#5 ':' +#5 TYPEID Objet +#5 ',' +#5 TYPEID Bool +#5 ';' +#5 TYPEID String +#5 '.' +#5 OBJECTID string +#5 TYPEID SELF_TYPE +#5 ISVOID +#5 '}' +#5 ')' +#6 CLASS +#6 CLASS +#6 IF +#6 THEN +#6 ELSE +#6 FI +#6 OBJECTID testing +#6 TYPEID Testing +#6 '~' +#6 INT_CONST 007 +#6 OBJECTID agent_bond +#6 OBJECTID james_007B0N3SS___ +#7 LOOP +#7 POOL +#7 WHILE +#7 BOOL_CONST true +#7 OBJECTID or +#7 NOT +#7 BOOL_CONST false +#7 LET +#7 IN +#7 CASE +#7 OF +#7 ESAC *) \ No newline at end of file diff --git a/tests/lexer/iis1_error.txt b/tests/lexer/iis1_error.txt index 9e6d66cac..12f62f1ba 100644 --- a/tests/lexer/iis1_error.txt +++ b/tests/lexer/iis1_error.txt @@ -1 +1 @@ -(4, 2) - LexicographicError: ERROR "!" +(4, 2) - LexicographicError: ERROR "!" diff --git a/tests/lexer/iis2.cl b/tests/lexer/iis2.cl index 9b25715d4..d42552494 100644 --- a/tests/lexer/iis2.cl +++ b/tests/lexer/iis2.cl @@ -1,120 +1,120 @@ -(* Integers, Identifiers, and Special Notation *) - -0007 123 +1 -1 +90 -09 +11113 -4r *a *self* c++ -class Class if then else fi testing Testing ~007agent_bond james_007bones___ - - -new / <- <<==> {( Int: Objet, Bool; String.string SELF_TYPE isvoid }) -loop pool while tRuE or noT faLsE let in case of ESAC - -factorial(5) = 120, 2 + 2 = 5? or E = mc2; p + 1 resto p = 1: (@ for x in range(len(b))) - -(* -#3 INT_CONST 0007 -#3 INT_CONST 123 -#3 '+' -#3 INT_CONST 1 -#3 '-' -#3 INT_CONST 1 -#3 '+' -#3 INT_CONST 90 -#3 '-' -#3 INT_CONST 09 -#3 '+' -#3 INT_CONST 11113 -#3 '-' -#3 INT_CONST 4 -#3 OBJECTID r -#3 '*' -#3 OBJECTID a -#3 '*' -#3 OBJECTID self -#3 '*' -#3 OBJECTID c -#3 '+' -#3 '+' -#4 CLASS -#4 CLASS -#4 IF -#4 THEN -#4 ELSE -#4 FI -#4 OBJECTID testing -#4 TYPEID Testing -#4 '~' -#4 INT_CONST 007 -#4 OBJECTID agent_bond -#4 OBJECTID james_007bones___ -#7 NEW -#7 '/' -#7 ASSIGN -#7 '<' -#7 LE -#7 DARROW -#7 '{' -#7 '(' -#7 TYPEID Int -#7 ':' -#7 TYPEID Objet -#7 ',' -#7 TYPEID Bool -#7 ';' -#7 TYPEID String -#7 '.' -#7 OBJECTID string -#7 TYPEID SELF_TYPE -#7 ISVOID -#7 '}' -#7 ')' -#8 LOOP -#8 POOL -#8 WHILE -#8 BOOL_CONST true -#8 OBJECTID or -#8 NOT -#8 BOOL_CONST false -#8 LET -#8 IN -#8 CASE -#8 OF -#8 ESAC -#10 OBJECTID factorial -#10 '(' -#10 INT_CONST 5 -#10 ')' -#10 '=' -#10 INT_CONST 120 -#10 ',' -#10 INT_CONST 2 -#10 '+' -#10 INT_CONST 2 -#10 '=' -#10 INT_CONST 5 -#10 ERROR "?" -#10 OBJECTID or -#10 TYPEID E -#10 '=' -#10 OBJECTID mc2 -#10 ';' -#10 OBJECTID p -#10 '+' -#10 INT_CONST 1 -#10 OBJECTID resto -#10 OBJECTID p -#10 '=' -#10 INT_CONST 1 -#10 ':' -#10 '(' -#10 '@' -#10 OBJECTID for -#10 OBJECTID x -#10 IN -#10 OBJECTID range -#10 '(' -#10 OBJECTID len -#10 '(' -#10 OBJECTID b -#10 ')' -#10 ')' -#10 ')' +(* Integers, Identifiers, and Special Notation *) + +0007 123 +1 -1 +90 -09 +11113 -4r *a *self* c++ +class Class if then else fi testing Testing ~007agent_bond james_007bones___ + + +new / <- <<==> {( Int: Objet, Bool; String.string SELF_TYPE isvoid }) +loop pool while tRuE or noT faLsE let in case of ESAC + +factorial(5) = 120, 2 + 2 = 5? or E = mc2; p + 1 resto p = 1: (@ for x in range(len(b))) + +(* +#3 INT_CONST 0007 +#3 INT_CONST 123 +#3 '+' +#3 INT_CONST 1 +#3 '-' +#3 INT_CONST 1 +#3 '+' +#3 INT_CONST 90 +#3 '-' +#3 INT_CONST 09 +#3 '+' +#3 INT_CONST 11113 +#3 '-' +#3 INT_CONST 4 +#3 OBJECTID r +#3 '*' +#3 OBJECTID a +#3 '*' +#3 OBJECTID self +#3 '*' +#3 OBJECTID c +#3 '+' +#3 '+' +#4 CLASS +#4 CLASS +#4 IF +#4 THEN +#4 ELSE +#4 FI +#4 OBJECTID testing +#4 TYPEID Testing +#4 '~' +#4 INT_CONST 007 +#4 OBJECTID agent_bond +#4 OBJECTID james_007bones___ +#7 NEW +#7 '/' +#7 ASSIGN +#7 '<' +#7 LE +#7 DARROW +#7 '{' +#7 '(' +#7 TYPEID Int +#7 ':' +#7 TYPEID Objet +#7 ',' +#7 TYPEID Bool +#7 ';' +#7 TYPEID String +#7 '.' +#7 OBJECTID string +#7 TYPEID SELF_TYPE +#7 ISVOID +#7 '}' +#7 ')' +#8 LOOP +#8 POOL +#8 WHILE +#8 BOOL_CONST true +#8 OBJECTID or +#8 NOT +#8 BOOL_CONST false +#8 LET +#8 IN +#8 CASE +#8 OF +#8 ESAC +#10 OBJECTID factorial +#10 '(' +#10 INT_CONST 5 +#10 ')' +#10 '=' +#10 INT_CONST 120 +#10 ',' +#10 INT_CONST 2 +#10 '+' +#10 INT_CONST 2 +#10 '=' +#10 INT_CONST 5 +#10 ERROR "?" +#10 OBJECTID or +#10 TYPEID E +#10 '=' +#10 OBJECTID mc2 +#10 ';' +#10 OBJECTID p +#10 '+' +#10 INT_CONST 1 +#10 OBJECTID resto +#10 OBJECTID p +#10 '=' +#10 INT_CONST 1 +#10 ':' +#10 '(' +#10 '@' +#10 OBJECTID for +#10 OBJECTID x +#10 IN +#10 OBJECTID range +#10 '(' +#10 OBJECTID len +#10 '(' +#10 OBJECTID b +#10 ')' +#10 ')' +#10 ')' *) \ No newline at end of file diff --git a/tests/lexer/iis2_error.txt b/tests/lexer/iis2_error.txt index 922391a9d..988d0286e 100644 --- a/tests/lexer/iis2_error.txt +++ b/tests/lexer/iis2_error.txt @@ -1 +1 @@ -(10, 30) - LexicographicError: ERROR "?" +(10, 30) - LexicographicError: ERROR "?" diff --git a/tests/lexer/iis3.cl b/tests/lexer/iis3.cl index 0b965ddea..dcd85f960 100644 --- a/tests/lexer/iis3.cl +++ b/tests/lexer/iis3.cl @@ -1,121 +1,121 @@ -(* Integers, Identifiers, and Special Notation *) - -factorial(5) = 120, 2 + 2 = 5 or E = mc^2; p + 1 @ p = 1: z for x in range(len(b))) - -loop pool while tRuE or noT faLsE let in case of ESAC - -new / <- <<==> {( Int: Objet, Bool; String.string SELF_TYPE isvoid }) - - -0007 123 +1 -1 +90 -09 +11113 -4r *a *self* c++ -class Class if then else fi testing Testing ~007agent_bond james_007bones___ - -(* -#3 OBJECTID factorial -#3 '(' -#3 INT_CONST 5 -#3 ')' -#3 '=' -#3 INT_CONST 120 -#3 ',' -#3 INT_CONST 2 -#3 '+' -#3 INT_CONST 2 -#3 '=' -#3 INT_CONST 5 -#3 OBJECTID or -#3 TYPEID E -#3 '=' -#3 OBJECTID mc -#3 ERROR "^" -#3 INT_CONST 2 -#3 ';' -#3 OBJECTID p -#3 '+' -#3 INT_CONST 1 -#3 '@' -#3 OBJECTID p -#3 '=' -#3 INT_CONST 1 -#3 ':' -#3 OBJECTID z -#3 OBJECTID for -#3 OBJECTID x -#3 IN -#3 OBJECTID range -#3 '(' -#3 OBJECTID len -#3 '(' -#3 OBJECTID b -#3 ')' -#3 ')' -#3 ')' -#5 LOOP -#5 POOL -#5 WHILE -#5 BOOL_CONST true -#5 OBJECTID or -#5 NOT -#5 BOOL_CONST false -#5 LET -#5 IN -#5 CASE -#5 OF -#5 ESAC -#7 NEW -#7 '/' -#7 ASSIGN -#7 '<' -#7 LE -#7 DARROW -#7 '{' -#7 '(' -#7 TYPEID Int -#7 ':' -#7 TYPEID Objet -#7 ',' -#7 TYPEID Bool -#7 ';' -#7 TYPEID String -#7 '.' -#7 OBJECTID string -#7 TYPEID SELF_TYPE -#7 ISVOID -#7 '}' -#7 ')' -#10 INT_CONST 0007 -#10 INT_CONST 123 -#10 '+' -#10 INT_CONST 1 -#10 '-' -#10 INT_CONST 1 -#10 '+' -#10 INT_CONST 90 -#10 '-' -#10 INT_CONST 09 -#10 '+' -#10 INT_CONST 11113 -#10 '-' -#10 INT_CONST 4 -#10 OBJECTID r -#10 '*' -#10 OBJECTID a -#10 '*' -#10 OBJECTID self -#10 '*' -#10 OBJECTID c -#10 '+' -#10 '+' -#11 CLASS -#11 CLASS -#11 IF -#11 THEN -#11 ELSE -#11 FI -#11 OBJECTID testing -#11 TYPEID Testing -#11 '~' -#11 INT_CONST 007 -#11 OBJECTID agent_bond -#11 OBJECTID james_007bones___ +(* Integers, Identifiers, and Special Notation *) + +factorial(5) = 120, 2 + 2 = 5 or E = mc^2; p + 1 @ p = 1: z for x in range(len(b))) + +loop pool while tRuE or noT faLsE let in case of ESAC + +new / <- <<==> {( Int: Objet, Bool; String.string SELF_TYPE isvoid }) + + +0007 123 +1 -1 +90 -09 +11113 -4r *a *self* c++ +class Class if then else fi testing Testing ~007agent_bond james_007bones___ + +(* +#3 OBJECTID factorial +#3 '(' +#3 INT_CONST 5 +#3 ')' +#3 '=' +#3 INT_CONST 120 +#3 ',' +#3 INT_CONST 2 +#3 '+' +#3 INT_CONST 2 +#3 '=' +#3 INT_CONST 5 +#3 OBJECTID or +#3 TYPEID E +#3 '=' +#3 OBJECTID mc +#3 ERROR "^" +#3 INT_CONST 2 +#3 ';' +#3 OBJECTID p +#3 '+' +#3 INT_CONST 1 +#3 '@' +#3 OBJECTID p +#3 '=' +#3 INT_CONST 1 +#3 ':' +#3 OBJECTID z +#3 OBJECTID for +#3 OBJECTID x +#3 IN +#3 OBJECTID range +#3 '(' +#3 OBJECTID len +#3 '(' +#3 OBJECTID b +#3 ')' +#3 ')' +#3 ')' +#5 LOOP +#5 POOL +#5 WHILE +#5 BOOL_CONST true +#5 OBJECTID or +#5 NOT +#5 BOOL_CONST false +#5 LET +#5 IN +#5 CASE +#5 OF +#5 ESAC +#7 NEW +#7 '/' +#7 ASSIGN +#7 '<' +#7 LE +#7 DARROW +#7 '{' +#7 '(' +#7 TYPEID Int +#7 ':' +#7 TYPEID Objet +#7 ',' +#7 TYPEID Bool +#7 ';' +#7 TYPEID String +#7 '.' +#7 OBJECTID string +#7 TYPEID SELF_TYPE +#7 ISVOID +#7 '}' +#7 ')' +#10 INT_CONST 0007 +#10 INT_CONST 123 +#10 '+' +#10 INT_CONST 1 +#10 '-' +#10 INT_CONST 1 +#10 '+' +#10 INT_CONST 90 +#10 '-' +#10 INT_CONST 09 +#10 '+' +#10 INT_CONST 11113 +#10 '-' +#10 INT_CONST 4 +#10 OBJECTID r +#10 '*' +#10 OBJECTID a +#10 '*' +#10 OBJECTID self +#10 '*' +#10 OBJECTID c +#10 '+' +#10 '+' +#11 CLASS +#11 CLASS +#11 IF +#11 THEN +#11 ELSE +#11 FI +#11 OBJECTID testing +#11 TYPEID Testing +#11 '~' +#11 INT_CONST 007 +#11 OBJECTID agent_bond +#11 OBJECTID james_007bones___ *) \ No newline at end of file diff --git a/tests/lexer/iis3_error.txt b/tests/lexer/iis3_error.txt index b001b6a71..3abc2b556 100644 --- a/tests/lexer/iis3_error.txt +++ b/tests/lexer/iis3_error.txt @@ -1 +1 @@ -(3, 40) - LexicographicError: ERROR "^" +(3, 40) - LexicographicError: ERROR "^" diff --git a/tests/lexer/iis4.cl b/tests/lexer/iis4.cl index 9e7a9cb62..5357ab734 100644 --- a/tests/lexer/iis4.cl +++ b/tests/lexer/iis4.cl @@ -1,120 +1,120 @@ -(* Integers, Identifiers, and Special Notation *) - -new / <- <<==> {( Int: Objet, Bool; String.string SELF_TYPE isvoid }) -0007 123 +1 -1 +90 -09 +11113 -4r *a *self* c++ - -factorial(5) = 120, 2 + 2 = 5 or E = mc2; p + 1 % p = 1: @.@ for x in range(len(b))~ - - -loop pool while tRuE or noT faLsE let in case of ESAC -class Class if then else fi testing Testing ~007agent_bond james_007bones___ - -(* -#3 NEW -#3 '/' -#3 ASSIGN -#3 '<' -#3 LE -#3 DARROW -#3 '{' -#3 '(' -#3 TYPEID Int -#3 ':' -#3 TYPEID Objet -#3 ',' -#3 TYPEID Bool -#3 ';' -#3 TYPEID String -#3 '.' -#3 OBJECTID string -#3 TYPEID SELF_TYPE -#3 ISVOID -#3 '}' -#3 ')' -#4 INT_CONST 0007 -#4 INT_CONST 123 -#4 '+' -#4 INT_CONST 1 -#4 '-' -#4 INT_CONST 1 -#4 '+' -#4 INT_CONST 90 -#4 '-' -#4 INT_CONST 09 -#4 '+' -#4 INT_CONST 11113 -#4 '-' -#4 INT_CONST 4 -#4 OBJECTID r -#4 '*' -#4 OBJECTID a -#4 '*' -#4 OBJECTID self -#4 '*' -#4 OBJECTID c -#4 '+' -#4 '+' -#6 OBJECTID factorial -#6 '(' -#6 INT_CONST 5 -#6 ')' -#6 '=' -#6 INT_CONST 120 -#6 ',' -#6 INT_CONST 2 -#6 '+' -#6 INT_CONST 2 -#6 '=' -#6 INT_CONST 5 -#6 OBJECTID or -#6 TYPEID E -#6 '=' -#6 OBJECTID mc2 -#6 ';' -#6 OBJECTID p -#6 '+' -#6 INT_CONST 1 -#6 ERROR "%" -#6 OBJECTID p -#6 '=' -#6 INT_CONST 1 -#6 ':' -#6 '@' -#6 '.' -#6 '@' -#6 OBJECTID for -#6 OBJECTID x -#6 IN -#6 OBJECTID range -#6 '(' -#6 OBJECTID len -#6 '(' -#6 OBJECTID b -#6 ')' -#6 ')' -#6 '~' -#9 LOOP -#9 POOL -#9 WHILE -#9 BOOL_CONST true -#9 OBJECTID or -#9 NOT -#9 BOOL_CONST false -#9 LET -#9 IN -#9 CASE -#9 OF -#9 ESAC -#10 CLASS -#10 CLASS -#10 IF -#10 THEN -#10 ELSE -#10 FI -#10 OBJECTID testing -#10 TYPEID Testing -#10 '~' -#10 INT_CONST 007 -#10 OBJECTID agent_bond -#10 OBJECTID james_007bones___ +(* Integers, Identifiers, and Special Notation *) + +new / <- <<==> {( Int: Objet, Bool; String.string SELF_TYPE isvoid }) +0007 123 +1 -1 +90 -09 +11113 -4r *a *self* c++ + +factorial(5) = 120, 2 + 2 = 5 or E = mc2; p + 1 % p = 1: @.@ for x in range(len(b))~ + + +loop pool while tRuE or noT faLsE let in case of ESAC +class Class if then else fi testing Testing ~007agent_bond james_007bones___ + +(* +#3 NEW +#3 '/' +#3 ASSIGN +#3 '<' +#3 LE +#3 DARROW +#3 '{' +#3 '(' +#3 TYPEID Int +#3 ':' +#3 TYPEID Objet +#3 ',' +#3 TYPEID Bool +#3 ';' +#3 TYPEID String +#3 '.' +#3 OBJECTID string +#3 TYPEID SELF_TYPE +#3 ISVOID +#3 '}' +#3 ')' +#4 INT_CONST 0007 +#4 INT_CONST 123 +#4 '+' +#4 INT_CONST 1 +#4 '-' +#4 INT_CONST 1 +#4 '+' +#4 INT_CONST 90 +#4 '-' +#4 INT_CONST 09 +#4 '+' +#4 INT_CONST 11113 +#4 '-' +#4 INT_CONST 4 +#4 OBJECTID r +#4 '*' +#4 OBJECTID a +#4 '*' +#4 OBJECTID self +#4 '*' +#4 OBJECTID c +#4 '+' +#4 '+' +#6 OBJECTID factorial +#6 '(' +#6 INT_CONST 5 +#6 ')' +#6 '=' +#6 INT_CONST 120 +#6 ',' +#6 INT_CONST 2 +#6 '+' +#6 INT_CONST 2 +#6 '=' +#6 INT_CONST 5 +#6 OBJECTID or +#6 TYPEID E +#6 '=' +#6 OBJECTID mc2 +#6 ';' +#6 OBJECTID p +#6 '+' +#6 INT_CONST 1 +#6 ERROR "%" +#6 OBJECTID p +#6 '=' +#6 INT_CONST 1 +#6 ':' +#6 '@' +#6 '.' +#6 '@' +#6 OBJECTID for +#6 OBJECTID x +#6 IN +#6 OBJECTID range +#6 '(' +#6 OBJECTID len +#6 '(' +#6 OBJECTID b +#6 ')' +#6 ')' +#6 '~' +#9 LOOP +#9 POOL +#9 WHILE +#9 BOOL_CONST true +#9 OBJECTID or +#9 NOT +#9 BOOL_CONST false +#9 LET +#9 IN +#9 CASE +#9 OF +#9 ESAC +#10 CLASS +#10 CLASS +#10 IF +#10 THEN +#10 ELSE +#10 FI +#10 OBJECTID testing +#10 TYPEID Testing +#10 '~' +#10 INT_CONST 007 +#10 OBJECTID agent_bond +#10 OBJECTID james_007bones___ *) \ No newline at end of file diff --git a/tests/lexer/iis4_error.txt b/tests/lexer/iis4_error.txt index f24076a8c..aab8f39c1 100644 --- a/tests/lexer/iis4_error.txt +++ b/tests/lexer/iis4_error.txt @@ -1 +1 @@ -(6, 49) - LexicographicError: ERROR "!" +(6, 49) - LexicographicError: ERROR "!" diff --git a/tests/lexer/iis5.cl b/tests/lexer/iis5.cl index d146c0547..f602488b9 100644 --- a/tests/lexer/iis5.cl +++ b/tests/lexer/iis5.cl @@ -1,121 +1,121 @@ -(* Integers, Identifiers, and Special Notation *) - - -loop pool while tRuE or noT faLsE let in case of ESAC -new / <- <<==> {( Int: Objet, Bool; String.string SELF_TYPE isvoid }) -class Class if then else fi testing Testing ~007agent_bond james_007bones___ - -factorial(5) = 120, 2 + 2 = 5 or E = mc2; p + 1 resto p = 1: [@.@ for x in range(len(b))] - -0007 123 +1 -1 +90 -09 +11113 -4r *a *self* c++ - -(* -#4 LOOP -#4 POOL -#4 WHILE -#4 BOOL_CONST true -#4 OBJECTID or -#4 NOT -#4 BOOL_CONST false -#4 LET -#4 IN -#4 CASE -#4 OF -#4 ESAC -#5 NEW -#5 '/' -#5 ASSIGN -#5 '<' -#5 LE -#5 DARROW -#5 '{' -#5 '(' -#5 TYPEID Int -#5 ':' -#5 TYPEID Objet -#5 ',' -#5 TYPEID Bool -#5 ';' -#5 TYPEID String -#5 '.' -#5 OBJECTID string -#5 TYPEID SELF_TYPE -#5 ISVOID -#5 '}' -#5 ')' -#6 CLASS -#6 CLASS -#6 IF -#6 THEN -#6 ELSE -#6 FI -#6 OBJECTID testing -#6 TYPEID Testing -#6 '~' -#6 INT_CONST 007 -#6 OBJECTID agent_bond -#6 OBJECTID james_007bones___ -#8 OBJECTID factorial -#8 '(' -#8 INT_CONST 5 -#8 ')' -#8 '=' -#8 INT_CONST 120 -#8 ',' -#8 INT_CONST 2 -#8 '+' -#8 INT_CONST 2 -#8 '=' -#8 INT_CONST 5 -#8 OBJECTID or -#8 TYPEID E -#8 '=' -#8 OBJECTID mc2 -#8 ';' -#8 OBJECTID p -#8 '+' -#8 INT_CONST 1 -#8 OBJECTID resto -#8 OBJECTID p -#8 '=' -#8 INT_CONST 1 -#8 ':' -#8 ERROR "[" -#8 '@' -#8 '.' -#8 '@' -#8 OBJECTID for -#8 OBJECTID x -#8 IN -#8 OBJECTID range -#8 '(' -#8 OBJECTID len -#8 '(' -#8 OBJECTID b -#8 ')' -#8 ')' -#8 ERROR "]" -#10 INT_CONST 0007 -#10 INT_CONST 123 -#10 '+' -#10 INT_CONST 1 -#10 '-' -#10 INT_CONST 1 -#10 '+' -#10 INT_CONST 90 -#10 '-' -#10 INT_CONST 09 -#10 '+' -#10 INT_CONST 11113 -#10 '-' -#10 INT_CONST 4 -#10 OBJECTID r -#10 '*' -#10 OBJECTID a -#10 '*' -#10 OBJECTID self -#10 '*' -#10 OBJECTID c -#10 '+' -#10 '+' -*) +(* Integers, Identifiers, and Special Notation *) + + +loop pool while tRuE or noT faLsE let in case of ESAC +new / <- <<==> {( Int: Objet, Bool; String.string SELF_TYPE isvoid }) +class Class if then else fi testing Testing ~007agent_bond james_007bones___ + +factorial(5) = 120, 2 + 2 = 5 or E = mc2; p + 1 resto p = 1: [@.@ for x in range(len(b))] + +0007 123 +1 -1 +90 -09 +11113 -4r *a *self* c++ + +(* +#4 LOOP +#4 POOL +#4 WHILE +#4 BOOL_CONST true +#4 OBJECTID or +#4 NOT +#4 BOOL_CONST false +#4 LET +#4 IN +#4 CASE +#4 OF +#4 ESAC +#5 NEW +#5 '/' +#5 ASSIGN +#5 '<' +#5 LE +#5 DARROW +#5 '{' +#5 '(' +#5 TYPEID Int +#5 ':' +#5 TYPEID Objet +#5 ',' +#5 TYPEID Bool +#5 ';' +#5 TYPEID String +#5 '.' +#5 OBJECTID string +#5 TYPEID SELF_TYPE +#5 ISVOID +#5 '}' +#5 ')' +#6 CLASS +#6 CLASS +#6 IF +#6 THEN +#6 ELSE +#6 FI +#6 OBJECTID testing +#6 TYPEID Testing +#6 '~' +#6 INT_CONST 007 +#6 OBJECTID agent_bond +#6 OBJECTID james_007bones___ +#8 OBJECTID factorial +#8 '(' +#8 INT_CONST 5 +#8 ')' +#8 '=' +#8 INT_CONST 120 +#8 ',' +#8 INT_CONST 2 +#8 '+' +#8 INT_CONST 2 +#8 '=' +#8 INT_CONST 5 +#8 OBJECTID or +#8 TYPEID E +#8 '=' +#8 OBJECTID mc2 +#8 ';' +#8 OBJECTID p +#8 '+' +#8 INT_CONST 1 +#8 OBJECTID resto +#8 OBJECTID p +#8 '=' +#8 INT_CONST 1 +#8 ':' +#8 ERROR "[" +#8 '@' +#8 '.' +#8 '@' +#8 OBJECTID for +#8 OBJECTID x +#8 IN +#8 OBJECTID range +#8 '(' +#8 OBJECTID len +#8 '(' +#8 OBJECTID b +#8 ')' +#8 ')' +#8 ERROR "]" +#10 INT_CONST 0007 +#10 INT_CONST 123 +#10 '+' +#10 INT_CONST 1 +#10 '-' +#10 INT_CONST 1 +#10 '+' +#10 INT_CONST 90 +#10 '-' +#10 INT_CONST 09 +#10 '+' +#10 INT_CONST 11113 +#10 '-' +#10 INT_CONST 4 +#10 OBJECTID r +#10 '*' +#10 OBJECTID a +#10 '*' +#10 OBJECTID self +#10 '*' +#10 OBJECTID c +#10 '+' +#10 '+' +*) diff --git a/tests/lexer/iis5_error.txt b/tests/lexer/iis5_error.txt index b3dbadcb6..9d6e1a738 100644 --- a/tests/lexer/iis5_error.txt +++ b/tests/lexer/iis5_error.txt @@ -1,2 +1,2 @@ -(8, 62) - LexicographicError: ERROR "[" -(8, 89) - LexicographicError: ERROR "]" +(8, 62) - LexicographicError: ERROR "[" +(8, 89) - LexicographicError: ERROR "]" diff --git a/tests/lexer/iis6.cl b/tests/lexer/iis6.cl index 1042f132b..ba93b19d9 100644 --- a/tests/lexer/iis6.cl +++ b/tests/lexer/iis6.cl @@ -1,125 +1,125 @@ -(* Integers, Identifiers, and Special Notation *) - -factorial(5) = 120, 2 + 2 = 5 or E = mc2; p + 1 resto p = 1: {@.@ for x in range(len(b))} - -new / <- <<==> {( Int: Objet, Bool; String.string SELF_TYPE isvoid }) - - -class Class if then else fi testing Testing ~007agent_bond _james_007bones___ - - - -0007 123 +1 -1 +90 -09 +11113 -4r *a *self* c++ -loop pool while tRuE or noT faLsE let in case of ESAC - -(* -#3 OBJECTID factorial -#3 '(' -#3 INT_CONST 5 -#3 ')' -#3 '=' -#3 INT_CONST 120 -#3 ',' -#3 INT_CONST 2 -#3 '+' -#3 INT_CONST 2 -#3 '=' -#3 INT_CONST 5 -#3 OBJECTID or -#3 TYPEID E -#3 '=' -#3 OBJECTID mc2 -#3 ';' -#3 OBJECTID p -#3 '+' -#3 INT_CONST 1 -#3 OBJECTID resto -#3 OBJECTID p -#3 '=' -#3 INT_CONST 1 -#3 ':' -#3 '{' -#3 '@' -#3 '.' -#3 '@' -#3 OBJECTID for -#3 OBJECTID x -#3 IN -#3 OBJECTID range -#3 '(' -#3 OBJECTID len -#3 '(' -#3 OBJECTID b -#3 ')' -#3 ')' -#3 '}' -#5 NEW -#5 '/' -#5 ASSIGN -#5 '<' -#5 LE -#5 DARROW -#5 '{' -#5 '(' -#5 TYPEID Int -#5 ':' -#5 TYPEID Objet -#5 ',' -#5 TYPEID Bool -#5 ';' -#5 TYPEID String -#5 '.' -#5 OBJECTID string -#5 TYPEID SELF_TYPE -#5 ISVOID -#5 '}' -#5 ')' -#8 CLASS -#8 CLASS -#8 IF -#8 THEN -#8 ELSE -#8 FI -#8 OBJECTID testing -#8 TYPEID Testing -#8 '~' -#8 INT_CONST 007 -#8 OBJECTID agent_bond -#8 ERROR "_" -#8 OBJECTID james_007bones___ -#12 INT_CONST 0007 -#12 INT_CONST 123 -#12 '+' -#12 INT_CONST 1 -#12 '-' -#12 INT_CONST 1 -#12 '+' -#12 INT_CONST 90 -#12 '-' -#12 INT_CONST 09 -#12 '+' -#12 INT_CONST 11113 -#12 '-' -#12 INT_CONST 4 -#12 OBJECTID r -#12 '*' -#12 OBJECTID a -#12 '*' -#12 OBJECTID self -#12 '*' -#12 OBJECTID c -#12 '+' -#12 '+' -#13 LOOP -#13 POOL -#13 WHILE -#13 BOOL_CONST true -#13 OBJECTID or -#13 NOT -#13 BOOL_CONST false -#13 LET -#13 IN -#13 CASE -#13 OF -#13 ESAC +(* Integers, Identifiers, and Special Notation *) + +factorial(5) = 120, 2 + 2 = 5 or E = mc2; p + 1 resto p = 1: {@.@ for x in range(len(b))} + +new / <- <<==> {( Int: Objet, Bool; String.string SELF_TYPE isvoid }) + + +class Class if then else fi testing Testing ~007agent_bond _james_007bones___ + + + +0007 123 +1 -1 +90 -09 +11113 -4r *a *self* c++ +loop pool while tRuE or noT faLsE let in case of ESAC + +(* +#3 OBJECTID factorial +#3 '(' +#3 INT_CONST 5 +#3 ')' +#3 '=' +#3 INT_CONST 120 +#3 ',' +#3 INT_CONST 2 +#3 '+' +#3 INT_CONST 2 +#3 '=' +#3 INT_CONST 5 +#3 OBJECTID or +#3 TYPEID E +#3 '=' +#3 OBJECTID mc2 +#3 ';' +#3 OBJECTID p +#3 '+' +#3 INT_CONST 1 +#3 OBJECTID resto +#3 OBJECTID p +#3 '=' +#3 INT_CONST 1 +#3 ':' +#3 '{' +#3 '@' +#3 '.' +#3 '@' +#3 OBJECTID for +#3 OBJECTID x +#3 IN +#3 OBJECTID range +#3 '(' +#3 OBJECTID len +#3 '(' +#3 OBJECTID b +#3 ')' +#3 ')' +#3 '}' +#5 NEW +#5 '/' +#5 ASSIGN +#5 '<' +#5 LE +#5 DARROW +#5 '{' +#5 '(' +#5 TYPEID Int +#5 ':' +#5 TYPEID Objet +#5 ',' +#5 TYPEID Bool +#5 ';' +#5 TYPEID String +#5 '.' +#5 OBJECTID string +#5 TYPEID SELF_TYPE +#5 ISVOID +#5 '}' +#5 ')' +#8 CLASS +#8 CLASS +#8 IF +#8 THEN +#8 ELSE +#8 FI +#8 OBJECTID testing +#8 TYPEID Testing +#8 '~' +#8 INT_CONST 007 +#8 OBJECTID agent_bond +#8 ERROR "_" +#8 OBJECTID james_007bones___ +#12 INT_CONST 0007 +#12 INT_CONST 123 +#12 '+' +#12 INT_CONST 1 +#12 '-' +#12 INT_CONST 1 +#12 '+' +#12 INT_CONST 90 +#12 '-' +#12 INT_CONST 09 +#12 '+' +#12 INT_CONST 11113 +#12 '-' +#12 INT_CONST 4 +#12 OBJECTID r +#12 '*' +#12 OBJECTID a +#12 '*' +#12 OBJECTID self +#12 '*' +#12 OBJECTID c +#12 '+' +#12 '+' +#13 LOOP +#13 POOL +#13 WHILE +#13 BOOL_CONST true +#13 OBJECTID or +#13 NOT +#13 BOOL_CONST false +#13 LET +#13 IN +#13 CASE +#13 OF +#13 ESAC *) \ No newline at end of file diff --git a/tests/lexer/iis6_error.txt b/tests/lexer/iis6_error.txt index d7fad9c79..79a9d5aee 100644 --- a/tests/lexer/iis6_error.txt +++ b/tests/lexer/iis6_error.txt @@ -1 +1 @@ -(8, 60) - LexicographicError: ERROR "_" +(8, 60) - LexicographicError: ERROR "_" diff --git a/tests/lexer/mixed1.cl b/tests/lexer/mixed1.cl index 803d58ef5..d3e520a10 100644 --- a/tests/lexer/mixed1.cl +++ b/tests/lexer/mixed1.cl @@ -1,14 +1,14 @@ -"lkjdsafkljdsalfj\u0000dsafdsaf\u0000djafslkjdsalf\nsdajf\" lkjfdsasdkjfl"123 -adsfasklj# -LKldsajf iNhERITS -"lkdsajf" - -(* -#1 STR_CONST "lkjdsafkljdsalfju0000dsafdsafu0000djafslkjdsalf\nsdajf\" lkjfdsasdkjfl" -#1 INT_CONST 123 -#2 OBJECTID adsfasklj -#2 ERROR "#" -#3 TYPEID LKldsajf -#3 INHERITS -#4 STR_CONST "lkdsajf" +"lkjdsafkljdsalfj\u0000dsafdsaf\u0000djafslkjdsalf\nsdajf\" lkjfdsasdkjfl"123 +adsfasklj# +LKldsajf iNhERITS +"lkdsajf" + +(* +#1 STR_CONST "lkjdsafkljdsalfju0000dsafdsafu0000djafslkjdsalf\nsdajf\" lkjfdsasdkjfl" +#1 INT_CONST 123 +#2 OBJECTID adsfasklj +#2 ERROR "#" +#3 TYPEID LKldsajf +#3 INHERITS +#4 STR_CONST "lkdsajf" *) \ No newline at end of file diff --git a/tests/lexer/mixed1_error.txt b/tests/lexer/mixed1_error.txt index 99af5fbdc..a142c2edd 100644 --- a/tests/lexer/mixed1_error.txt +++ b/tests/lexer/mixed1_error.txt @@ -1 +1 @@ -(2, 10) - LexicographicError: ERROR "#" +(2, 10) - LexicographicError: ERROR "#" diff --git a/tests/lexer/mixed2.cl b/tests/lexer/mixed2.cl index 12039e123..759bf9523 100644 --- a/tests/lexer/mixed2.cl +++ b/tests/lexer/mixed2.cl @@ -1,20 +1,20 @@ -"kjas\"lnnsdj\nfljrdsaf" -@.$.@ -@*%*@ -"alkjfldajf""dasfadsf - -(* -#1 STR_CONST "kjas\"lnnsdj\nfljrdsaf" -#2 '@' -#2 '.' -#2 ERROR "$" -#2 '.' -#2 '@' -#3 '@' -#3 '*' -#3 ERROR "%" -#3 '*' -#3 '@' -#4 STR_CONST "alkjfldajf" -#4 ERROR "Unterminated string constant" +"kjas\"lnnsdj\nfljrdsaf" +@.$.@ +@*%*@ +"alkjfldajf""dasfadsf + +(* +#1 STR_CONST "kjas\"lnnsdj\nfljrdsaf" +#2 '@' +#2 '.' +#2 ERROR "$" +#2 '.' +#2 '@' +#3 '@' +#3 '*' +#3 ERROR "%" +#3 '*' +#3 '@' +#4 STR_CONST "alkjfldajf" +#4 ERROR "Unterminated string constant" *) \ No newline at end of file diff --git a/tests/lexer/mixed2_error.txt b/tests/lexer/mixed2_error.txt index 097dc2a07..37cb73ac2 100644 --- a/tests/lexer/mixed2_error.txt +++ b/tests/lexer/mixed2_error.txt @@ -1,3 +1,3 @@ -(2, 3) - LexicographicError: ERROR "$" -(3, 3) - LexicographicError: ERROR "%" -(4, 22) - LexicographicError: Unterminated string constant +(2, 3) - LexicographicError: ERROR "$" +(3, 3) - LexicographicError: ERROR "%" +(4, 22) - LexicographicError: Unterminated string constant diff --git a/tests/lexer/string1.cl b/tests/lexer/string1.cl index 6c3c00833..f0a5bd873 100644 --- a/tests/lexer/string1.cl +++ b/tests/lexer/string1.cl @@ -1,6 +1,6 @@ -(* A non-escaped newline character may not appear in a string *) - -"This \ -is OK" -"This is not +(* A non-escaped newline character may not appear in a string *) + +"This \ +is OK" +"This is not OK" \ No newline at end of file diff --git a/tests/lexer/string1_error.txt b/tests/lexer/string1_error.txt index 078c12bbb..1dd4d70d9 100644 --- a/tests/lexer/string1_error.txt +++ b/tests/lexer/string1_error.txt @@ -1,2 +1,2 @@ -(5, 13) - LexicographicError: Unterminated string constant +(5, 13) - LexicographicError: Unterminated string constant (6, 4) - LexicographicError: EOF in string constant \ No newline at end of file diff --git a/tests/lexer/string2.cl b/tests/lexer/string2.cl index 3704b6ae7..cb3024180 100644 --- a/tests/lexer/string2.cl +++ b/tests/lexer/string2.cl @@ -1,19 +1,19 @@ -(* A string may not contain EOF *) - -" May the Triforce \ - 0 \ - 0v0 \ - 0vvv0 \ - 0vvvvv0 \ - 0vvvvvvv0 \ - 0vvvvvvvvv0 \ - 0vvvvvvvvvvv0 \ - 000000000000000 \ - 0v0 0v0 \ - 0vvv0 0vvv0 \ - 0vvvvv0 0vvvvv0 \ - 0vvvvvvv0 0vvvvvvv0 \ - 0vvvvvvvvv0 0vvvvvvvvv0 \ - 0vvvvvvvvvvv0 0vvvvvvvvvvv0 \ - 00000000000000000000000000000 \ +(* A string may not contain EOF *) + +" May the Triforce \ + 0 \ + 0v0 \ + 0vvv0 \ + 0vvvvv0 \ + 0vvvvvvv0 \ + 0vvvvvvvvv0 \ + 0vvvvvvvvvvv0 \ + 000000000000000 \ + 0v0 0v0 \ + 0vvv0 0vvv0 \ + 0vvvvv0 0vvvvv0 \ + 0vvvvvvv0 0vvvvvvv0 \ + 0vvvvvvvvv0 0vvvvvvvvv0 \ + 0vvvvvvvvvvv0 0vvvvvvvvvvv0 \ + 00000000000000000000000000000 \ be with you! \ No newline at end of file diff --git a/tests/lexer/string4.cl b/tests/lexer/string4.cl index f4d39c027..7ca4eb42b 100644 --- a/tests/lexer/string4.cl +++ b/tests/lexer/string4.cl @@ -1,38 +1,38 @@ -class Main { - str <- "The big brown fox - jumped over the fence"; - main() : Object { - { - out_string("Yay! This is the newest shites ); - } - }; -}; - -(* -#1 CLASS -#1 TYPEID Main -#1 '{' -#2 OBJECTID str -#2 ASSIGN -#3 ERROR "Unterminated string constant" -#3 OBJECTID jumped -#3 OBJECTID over -#3 OBJECTID the -#3 OBJECTID fence -#4 ERROR "Unterminated string constant" -#4 OBJECTID main -#4 '(' -#4 ')' -#4 ':' -#4 TYPEID Object -#4 '{' -#5 '{' -#6 OBJECTID out_string -#6 '(' -#7 ERROR "Unterminated string constant" -#7 '}' -#8 '}' -#8 ';' -#9 '}' -#9 ';' +class Main { + str <- "The big brown fox + jumped over the fence"; + main() : Object { + { + out_string("Yay! This is the newest shites ); + } + }; +}; + +(* +#1 CLASS +#1 TYPEID Main +#1 '{' +#2 OBJECTID str +#2 ASSIGN +#3 ERROR "Unterminated string constant" +#3 OBJECTID jumped +#3 OBJECTID over +#3 OBJECTID the +#3 OBJECTID fence +#4 ERROR "Unterminated string constant" +#4 OBJECTID main +#4 '(' +#4 ')' +#4 ':' +#4 TYPEID Object +#4 '{' +#5 '{' +#6 OBJECTID out_string +#6 '(' +#7 ERROR "Unterminated string constant" +#7 '}' +#8 '}' +#8 ';' +#9 '}' +#9 ';' *) \ No newline at end of file diff --git a/tests/lexer/string4_error.txt b/tests/lexer/string4_error.txt index 5ab0ea847..bf420217c 100644 --- a/tests/lexer/string4_error.txt +++ b/tests/lexer/string4_error.txt @@ -1,3 +1,3 @@ -(2, 30) - LexicographicError: Unterminated string constant -(3, 36) - LexicographicError: Unterminated string constant +(2, 30) - LexicographicError: Unterminated string constant +(3, 36) - LexicographicError: Unterminated string constant (6, 58) - LexicographicError: Unterminated string constant \ No newline at end of file diff --git a/tests/lexer_test.py b/tests/lexer_test.py index 2a27223d3..30170bdd3 100644 --- a/tests/lexer_test.py +++ b/tests/lexer_test.py @@ -1,13 +1,21 @@ -import pytest -import os -from utils import compare_errors - -tests_dir = __file__.rpartition('/')[0] + '/lexer/' -tests = [(file) for file in os.listdir(tests_dir) if file.endswith('.cl')] - -@pytest.mark.lexer -@pytest.mark.error -@pytest.mark.run(order=1) -@pytest.mark.parametrize("cool_file", tests) -def test_lexer_errors(compiler_path, cool_file): - compare_errors(compiler_path, tests_dir + cool_file, tests_dir + cool_file[:-3] + '_error.txt') \ No newline at end of file +import os +import pathlib + +import pytest + +from .utils import compare_errors + +tests_dir = str(pathlib.Path(__file__).parent / "lexer") +tests = [(file) for file in os.listdir(tests_dir) if file.endswith(".cl")] + + +@pytest.mark.lexer +@pytest.mark.error +@pytest.mark.run(order=1) +@pytest.mark.parametrize("cool_file", tests) +def test_lexer_errors(compiler_path, cool_file): + compare_errors( + compiler_path, + str(os.path.join(tests_dir, cool_file)), + str(os.path.join(tests_dir, cool_file[:-3] + "_error.txt")), + ) diff --git a/tests/parser/assignment1.cl b/tests/parser/assignment1.cl index 75b4c5bbd..7587ffb45 100644 --- a/tests/parser/assignment1.cl +++ b/tests/parser/assignment1.cl @@ -1,37 +1,37 @@ -(* An assignment has the form <- *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(): String { - Test1 <- "Hello World" -- Identifiers begin with a lower case letter - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file +(* An assignment has the form <- *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(): String { + Test1 <- "Hello World" -- Identifiers begin with a lower case letter + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/assignment2.cl b/tests/parser/assignment2.cl index 4efb96487..dd2267c1e 100644 --- a/tests/parser/assignment2.cl +++ b/tests/parser/assignment2.cl @@ -1,37 +1,37 @@ -(* An assignment has the form <- *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 - 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(): Int { - test1 <-- ~(1 + 2 + 3 + 4 + 5) -- The left side must be an expression - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file +(* An assignment has the form <- *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 - 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(): Int { + test1 <-- ~(1 + 2 + 3 + 4 + 5) -- The left side must be an expression + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/assignment3.cl b/tests/parser/assignment3.cl index ff633f331..56f35bc01 100644 --- a/tests/parser/assignment3.cl +++ b/tests/parser/assignment3.cl @@ -1,37 +1,37 @@ -(* An assignment has the form <- *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(): Bool { - test1 <- true++ -- The left side must be an expression - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file +(* An assignment has the form <- *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(): Bool { + test1 <- true++ -- The left side must be an expression + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/assignment3_error.txt b/tests/parser/assignment3_error.txt index a69ac3a81..fb0df23dc 100644 --- a/tests/parser/assignment3_error.txt +++ b/tests/parser/assignment3_error.txt @@ -1 +1 @@ -(29, 23) - SyntacticError: ERROR at or near "+" \ No newline at end of file +(29, 23) - SyntacticError: ERROR at or near "+" diff --git a/tests/parser/attribute1.cl b/tests/parser/attribute1.cl index 063a02c02..1259398af 100644 --- a/tests/parser/attribute1.cl +++ b/tests/parser/attribute1.cl @@ -1,34 +1,34 @@ -(* An attribute of class A specifies a variable that is part of the state of objects of class A *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - -- Attributes names must begin with lowercase letters - Test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file +(* An attribute of class A specifies a variable that is part of the state of objects of class A *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + -- Attributes names must begin with lowercase letters + Test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/attribute2.cl b/tests/parser/attribute2.cl index c05211483..43d7ff86e 100644 --- a/tests/parser/attribute2.cl +++ b/tests/parser/attribute2.cl @@ -1,34 +1,34 @@ -(* An attribute of class A specifies a variable that is part of the state of objects of class A *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - -- Type names must begin with uppercase letters - test3: string <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file +(* An attribute of class A specifies a variable that is part of the state of objects of class A *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + -- Type names must begin with uppercase letters + test3: string <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/attribute2_error.txt b/tests/parser/attribute2_error.txt index b02a52ee1..15f919e33 100644 --- a/tests/parser/attribute2_error.txt +++ b/tests/parser/attribute2_error.txt @@ -1 +1 @@ -(19, 12) - SyntacticError: ERROR at or near "string" \ No newline at end of file +(19, 12) - SyntacticError: ERROR at or near "string" diff --git a/tests/parser/attribute3.cl b/tests/parser/attribute3.cl index d858ae47c..86cb1871c 100644 --- a/tests/parser/attribute3.cl +++ b/tests/parser/attribute3.cl @@ -1,34 +1,34 @@ -(* An attribute of class A specifies a variable that is part of the state of objects of class A *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - -- Expected '<-' not '<=' - test3: String <= "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file +(* An attribute of class A specifies a variable that is part of the state of objects of class A *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + -- Expected '<-' not '<=' + test3: String <= "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/attribute3_error.txt b/tests/parser/attribute3_error.txt index 71f5bc0b7..fe70914f8 100644 --- a/tests/parser/attribute3_error.txt +++ b/tests/parser/attribute3_error.txt @@ -1 +1 @@ -(19, 19) - SyntacticError: ERROR at or near "<=" \ No newline at end of file +(19, 19) - SyntacticError: ERROR at or near "<=" diff --git a/tests/parser/block1.cl b/tests/parser/block1.cl index 3613d9268..ac18b6c56 100644 --- a/tests/parser/block1.cl +++ b/tests/parser/block1.cl @@ -1,87 +1,87 @@ -(* A block has the form { ; ... ; } *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - pow: Int <- 1; - count: Int <- 0; - - testing6(a: Int): IO { - { - count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2 -- Missing ";" - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file +(* A block has the form { ; ... ; } *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + pow: Int <- 1; + count: Int <- 0; + + testing6(a: Int): IO { + { + count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2 -- Missing ";" + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/block1_error.txt b/tests/parser/block1_error.txt index c78fb0b96..042ee982a 100644 --- a/tests/parser/block1_error.txt +++ b/tests/parser/block1_error.txt @@ -1 +1 @@ -(56, 17) - SyntacticError: ERROR at or near "}" \ No newline at end of file +(56, 17) - SyntacticError: ERROR at or near "}" diff --git a/tests/parser/block2.cl b/tests/parser/block2.cl index f485dd0b1..d06c9671e 100644 --- a/tests/parser/block2.cl +++ b/tests/parser/block2.cl @@ -1,87 +1,87 @@ -(* A block has the form { ; ... ; } *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - pow: Int <- 1; - count: Int <- 0; - - testing6(a: Int): IO { - -- Missing "{" - count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file +(* A block has the form { ; ... ; } *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + pow: Int <- 1; + count: Int <- 0; + + testing6(a: Int): IO { + -- Missing "{" + count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/block2_error.txt b/tests/parser/block2_error.txt index f85f4303c..7674c9402 100644 --- a/tests/parser/block2_error.txt +++ b/tests/parser/block2_error.txt @@ -1 +1 @@ -(49, 23) - SyntacticError: ERROR at or near ";" \ No newline at end of file +(49, 23) - SyntacticError: ERROR at or near ";" diff --git a/tests/parser/block3.cl b/tests/parser/block3.cl index ae1598c3b..a2f8cd9bc 100644 --- a/tests/parser/block3.cl +++ b/tests/parser/block3.cl @@ -1,87 +1,87 @@ -(* A block has the form { ; ... ; } *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - pow: Int <- 1; - count: Int <- 0; - - testing6(a: Int): IO { - { - count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - -- Missing "}" - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file +(* A block has the form { ; ... ; } *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + pow: Int <- 1; + count: Int <- 0; + + testing6(a: Int): IO { + { + count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + -- Missing "}" + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/block3_error.txt b/tests/parser/block3_error.txt index cda9949a2..35dc5f31a 100644 --- a/tests/parser/block3_error.txt +++ b/tests/parser/block3_error.txt @@ -1 +1 @@ -(57, 13) - SyntacticError: ERROR at or near "pool" \ No newline at end of file +(57, 13) - SyntacticError: ERROR at or near "pool" diff --git a/tests/parser/block4.cl b/tests/parser/block4.cl index 8fd883d02..13b8a4445 100644 --- a/tests/parser/block4.cl +++ b/tests/parser/block4.cl @@ -1,88 +1,88 @@ -(* A block has the form { ; ... ; } *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - pow: Int <- 1; - count: Int <- 0; - - testing6(a: Int): IO { - { - count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - true++; -- Only expressions - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file +(* A block has the form { ; ... ; } *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + pow: Int <- 1; + count: Int <- 0; + + testing6(a: Int): IO { + { + count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + true++; -- Only expressions + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/block4_error.txt b/tests/parser/block4_error.txt index ddbeb32ef..cb0f89f85 100644 --- a/tests/parser/block4_error.txt +++ b/tests/parser/block4_error.txt @@ -1 +1 @@ -(56, 26) - SyntacticError: ERROR at or near "+" \ No newline at end of file +(56, 26) - SyntacticError: ERROR at or near "+" diff --git a/tests/parser/case1.cl b/tests/parser/case1.cl index c2f508809..54b2e4fc6 100644 --- a/tests/parser/case1.cl +++ b/tests/parser/case1.cl @@ -1,91 +1,91 @@ -(* Case expressions provide runtime type tests on objects *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int <- 0, pow: Int - in { - -- count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; - - testing7(): Object { - case 2 + 2 of - -- Every case expression must have at least one branch - esac - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file +(* Case expressions provide runtime type tests on objects *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int + in { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; + + testing7(): Object { + case 2 + 2 of + -- Every case expression must have at least one branch + esac + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/case1_error.txt b/tests/parser/case1_error.txt index 61fca14f7..568c35796 100644 --- a/tests/parser/case1_error.txt +++ b/tests/parser/case1_error.txt @@ -1 +1 @@ -(63, 9) - SyntacticError: ERROR at or near ESAC \ No newline at end of file +(63, 9) - SyntacticError: ERROR at or near ESAC diff --git a/tests/parser/case2.cl b/tests/parser/case2.cl index f9162e49f..7f5208a00 100644 --- a/tests/parser/case2.cl +++ b/tests/parser/case2.cl @@ -1,93 +1,93 @@ -(* Case expressions provide runtime type tests on objects *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int <- 0, pow: Int - in { - -- count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; - - testing7(): Object { - case "2 + 2" of - x: Int => new IO.out_string("Es un entero!") -- Missing ";" - y: String => new IO.out_string("Es una cadena!"); - z: Bool => new IO.out_string("Es un booleano!"); - esac - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file +(* Case expressions provide runtime type tests on objects *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int + in { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; + + testing7(): Object { + case "2 + 2" of + x: Int => new IO.out_string("Es un entero!") -- Missing ";" + y: String => new IO.out_string("Es una cadena!"); + z: Bool => new IO.out_string("Es un booleano!"); + esac + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/case2_error.txt b/tests/parser/case2_error.txt index 40b030dd9..98606a6f5 100644 --- a/tests/parser/case2_error.txt +++ b/tests/parser/case2_error.txt @@ -1 +1 @@ -(63, 13) - SyntacticError: ERROR at or near "y" \ No newline at end of file +(63, 13) - SyntacticError: ERROR at or near "y" diff --git a/tests/parser/case3.cl b/tests/parser/case3.cl index a7eedc18b..ac5bf4e6a 100644 --- a/tests/parser/case3.cl +++ b/tests/parser/case3.cl @@ -1,93 +1,93 @@ -(* Case expressions provide runtime type tests on objects *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int <- 0, pow: Int - in { - -- count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; - - testing7(): Object { - case 2 + false of - x: Int => new IO.out_string("Es un entero!"); - y: string => new IO.out_string("Es una cadena!"); -- Type identifiers starts with a uppercase letter - z: Bool => new IO.out_string("Es un booleano!"); - esac - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file +(* Case expressions provide runtime type tests on objects *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int + in { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; + + testing7(): Object { + case 2 + false of + x: Int => new IO.out_string("Es un entero!"); + y: string => new IO.out_string("Es una cadena!"); -- Type identifiers starts with a uppercase letter + z: Bool => new IO.out_string("Es un booleano!"); + esac + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/case3_error.txt b/tests/parser/case3_error.txt index f25c5c563..9eefecd04 100644 --- a/tests/parser/case3_error.txt +++ b/tests/parser/case3_error.txt @@ -1 +1 @@ -(63, 16) - SyntacticError: ERROR at or near "string" \ No newline at end of file +(63, 16) - SyntacticError: ERROR at or near "string" diff --git a/tests/parser/case4.cl b/tests/parser/case4.cl index 25ca3858f..eb52d872a 100644 --- a/tests/parser/case4.cl +++ b/tests/parser/case4.cl @@ -1,93 +1,93 @@ -(* Case expressions provide runtime type tests on objects *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int <- 0, pow: Int - in { - -- count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; - - testing7(): Object { - case true of - x: Int => new IO.out_string("Es un entero!"); - y: String => new IO.out_string("Es una cadena!"); - Mazinger_Z: Bool => new IO.out_string("Es un booleano!"); -- Identifiers starts with a lowercase letter - esac - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file +(* Case expressions provide runtime type tests on objects *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int + in { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; + + testing7(): Object { + case true of + x: Int => new IO.out_string("Es un entero!"); + y: String => new IO.out_string("Es una cadena!"); + Mazinger_Z: Bool => new IO.out_string("Es un booleano!"); -- Identifiers starts with a lowercase letter + esac + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/case4_error.txt b/tests/parser/case4_error.txt index c5a16ddec..91d4504bf 100644 --- a/tests/parser/case4_error.txt +++ b/tests/parser/case4_error.txt @@ -1 +1 @@ -(64, 13) - SyntacticError: ERROR at or near "Mazinger_Z" \ No newline at end of file +(64, 13) - SyntacticError: ERROR at or near "Mazinger_Z" diff --git a/tests/parser/case5.cl b/tests/parser/case5.cl index b36c663e1..1e4c9831d 100644 --- a/tests/parser/case5.cl +++ b/tests/parser/case5.cl @@ -1,93 +1,93 @@ -(* Case expressions provide runtime type tests on objects *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int <- 0, pow: Int - in { - -- count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; - - testing7(): Object { - case test2 of - x: Int <- new IO.out_string("Es un entero!"); -- Must be '=>' not '<-'; - y: String => new IO.out_string("Es una cadena!"); - z: Bool => new IO.out_string("Es un booleano!"); - esac - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file +(* Case expressions provide runtime type tests on objects *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int + in { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; + + testing7(): Object { + case test2 of + x: Int <- new IO.out_string("Es un entero!"); -- Must be '=>' not '<-'; + y: String => new IO.out_string("Es una cadena!"); + z: Bool => new IO.out_string("Es un booleano!"); + esac + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/case5_error.txt b/tests/parser/case5_error.txt index fc6ec0eda..c8da7ab5e 100644 --- a/tests/parser/case5_error.txt +++ b/tests/parser/case5_error.txt @@ -1 +1 @@ -(62, 20) - SyntacticError: ERROR at or near ASSIGN \ No newline at end of file +(62, 20) - SyntacticError: ERROR at or near ASSIGN diff --git a/tests/parser/case6.cl b/tests/parser/case6.cl index 66e7df2ab..4d1c5e1ad 100644 --- a/tests/parser/case6.cl +++ b/tests/parser/case6.cl @@ -1,93 +1,93 @@ -(* Case expressions provide runtime type tests on objects *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int <- 0, pow: Int - in { - -- count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; - - testing7(): Object { - case 2 + 2 -- Missing "of" - x: Int => new IO.out_string("Es un entero!"); - y: String => new IO.out_string("Es una cadena!"); - z: Bool => new IO.out_string("Es un booleano!"); - esac - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file +(* Case expressions provide runtime type tests on objects *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int + in { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; + + testing7(): Object { + case 2 + 2 -- Missing "of" + x: Int => new IO.out_string("Es un entero!"); + y: String => new IO.out_string("Es una cadena!"); + z: Bool => new IO.out_string("Es un booleano!"); + esac + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/class1.cl b/tests/parser/class1.cl index f4815e3f4..1c0641a94 100644 --- a/tests/parser/class1.cl +++ b/tests/parser/class1.cl @@ -1,20 +1,20 @@ -(* A class is a list of features *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - testing(): Int { - 2 + 2 - }; -}; - --- Class names must begin with uppercase letters -class alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* A class is a list of features *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + testing(): Int { + 2 + 2 + }; +}; + +-- Class names must begin with uppercase letters +class alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/class2.cl b/tests/parser/class2.cl index f363b032a..baf290822 100644 --- a/tests/parser/class2.cl +++ b/tests/parser/class2.cl @@ -1,20 +1,20 @@ -(* A class is a list of features *) - -CLaSS Main { - main(): Object { - (new Alpha).print() - }; -}; - -CLaSS Test { - testing(): Int { - 2 + 2 - }; -}; - --- Type names must begin with uppercase letters -CLaSS Alpha iNHeRiTS iO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* A class is a list of features *) + +CLaSS Main { + main(): Object { + (new Alpha).print() + }; +}; + +CLaSS Test { + testing(): Int { + 2 + 2 + }; +}; + +-- Type names must begin with uppercase letters +CLaSS Alpha iNHeRiTS iO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/class2_error.txt b/tests/parser/class2_error.txt index 59d065913..6242b16d9 100644 --- a/tests/parser/class2_error.txt +++ b/tests/parser/class2_error.txt @@ -1 +1 @@ -(16, 22) - SyntacticError: ERROR at or near "iO" \ No newline at end of file +(16, 22) - SyntacticError: ERROR at or near "iO" diff --git a/tests/parser/class3.cl b/tests/parser/class3.cl index 0c801372a..5c89c5eb8 100644 --- a/tests/parser/class3.cl +++ b/tests/parser/class3.cl @@ -1,34 +1,34 @@ -(* A class is a list of features *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - -- Missing semicolon - testing2(a: Alpha, b: Int): Int { - 2 + 2 - } - - testing3(): String { - "2 + 2" - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* A class is a list of features *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + -- Missing semicolon + testing2(a: Alpha, b: Int): Int { + 2 + 2 + } + + testing3(): String { + "2 + 2" + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/class3_error.txt b/tests/parser/class3_error.txt index bc2f946b2..44380e3f5 100644 --- a/tests/parser/class3_error.txt +++ b/tests/parser/class3_error.txt @@ -1 +1 @@ -(25, 5) - SyntacticError: ERROR at or near "testing3" \ No newline at end of file +(25, 5) - SyntacticError: ERROR at or near "testing3" diff --git a/tests/parser/class4.cl b/tests/parser/class4.cl index 5c286b5e6..cdfbc313c 100644 --- a/tests/parser/class4.cl +++ b/tests/parser/class4.cl @@ -1,36 +1,36 @@ -(* A class is a list of features *) - -CLaSS Main { - main(): Object { - (new Alpha).print() - }; -}; - -CLaSS Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - -- Only features - 2 + 2; - - testing3(): String { - "2 + 2" - }; -}; - -CLaSS Alpha iNHeRiTS IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* A class is a list of features *) + +CLaSS Main { + main(): Object { + (new Alpha).print() + }; +}; + +CLaSS Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + -- Only features + 2 + 2; + + testing3(): String { + "2 + 2" + }; +}; + +CLaSS Alpha iNHeRiTS IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/class4_error.txt b/tests/parser/class4_error.txt index 1007f033d..7d2241976 100644 --- a/tests/parser/class4_error.txt +++ b/tests/parser/class4_error.txt @@ -1 +1 @@ -(25, 5) - SyntacticError: ERROR at or near "2" \ No newline at end of file +(25, 5) - SyntacticError: ERROR at or near "2" diff --git a/tests/parser/class5.cl b/tests/parser/class5.cl index 3f40c36eb..d6b5c5fda 100644 --- a/tests/parser/class5.cl +++ b/tests/parser/class5.cl @@ -1,34 +1,34 @@ -(* A class is a list of features *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - --- Missing '{' -class Test - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* A class is a list of features *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +-- Missing '{' +class Test + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/class5_error.txt b/tests/parser/class5_error.txt index 400e4d614..307928c02 100644 --- a/tests/parser/class5_error.txt +++ b/tests/parser/class5_error.txt @@ -1 +1 @@ -(11, 5) - SyntacticError: ERROR at or near "test1" \ No newline at end of file +(11, 5) - SyntacticError: ERROR at or near "test1" diff --git a/tests/parser/class6.cl b/tests/parser/class6.cl index 8501d2593..af9ecbf15 100644 --- a/tests/parser/class6.cl +++ b/tests/parser/class6.cl @@ -1,34 +1,34 @@ -(* A class is a list of features *) - -CLaSS Main { - main(): Object { - (new Alpha).print() - }; -}; - --- Missing '}' -CLaSS Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; -; - -CLaSS Alpha iNHeRiTS IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* A class is a list of features *) + +CLaSS Main { + main(): Object { + (new Alpha).print() + }; +}; + +-- Missing '}' +CLaSS Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; +; + +CLaSS Alpha iNHeRiTS IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/class6_error.txt b/tests/parser/class6_error.txt index 73574c94c..a2a4d3359 100644 --- a/tests/parser/class6_error.txt +++ b/tests/parser/class6_error.txt @@ -1 +1 @@ -(28, 1) - SyntacticError: ERROR at or near ";" \ No newline at end of file +(28, 1) - SyntacticError: ERROR at or near ";" diff --git a/tests/parser/conditional1.cl b/tests/parser/conditional1.cl index 4d546fc44..f7b5c8750 100644 --- a/tests/parser/conditional1.cl +++ b/tests/parser/conditional1.cl @@ -1,69 +1,69 @@ -(* A conditional has the form if then else fi *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - if a.length() < b.length() -- Mising "then" - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - else - if a.length() = b.length() then - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - else - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fi - fi - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file +(* A conditional has the form if then else fi *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + if a.length() < b.length() -- Mising "then" + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + else + if a.length() = b.length() then + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + else + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fi + fi + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/conditional1_error.txt b/tests/parser/conditional1_error.txt index ee533fd84..8f9691f82 100644 --- a/tests/parser/conditional1_error.txt +++ b/tests/parser/conditional1_error.txt @@ -1 +1 @@ -(34, 13) - SyntacticError: ERROR at or near NEW \ No newline at end of file +(34, 13) - SyntacticError: ERROR at or near NEW diff --git a/tests/parser/conditional2.cl b/tests/parser/conditional2.cl index 4f10c2957..257b28084 100644 --- a/tests/parser/conditional2.cl +++ b/tests/parser/conditional2.cl @@ -1,69 +1,69 @@ -(* A conditional has the form if then else fi *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - if a.length() < b.length() then - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - else - if a.length() = b.length() then - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - else - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - -- Missing "fi" - fi - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file +(* A conditional has the form if then else fi *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + if a.length() < b.length() then + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + else + if a.length() = b.length() then + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + else + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + -- Missing "fi" + fi + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/conditional3.cl b/tests/parser/conditional3.cl index 67e991ade..965d7be11 100644 --- a/tests/parser/conditional3.cl +++ b/tests/parser/conditional3.cl @@ -1,69 +1,69 @@ -(* A conditional has the form if then else fi *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - iF a.length() < b.length() tHen - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - elsE - if a.length() = b.length() then - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - eLseif -- elseif isn't a keyword - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file +(* A conditional has the form if then else fi *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + iF a.length() < b.length() tHen + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + elsE + if a.length() = b.length() then + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + eLseif -- elseif isn't a keyword + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/conditional3_error.txt b/tests/parser/conditional3_error.txt index ad95552b5..53794e443 100644 --- a/tests/parser/conditional3_error.txt +++ b/tests/parser/conditional3_error.txt @@ -1 +1 @@ -(38, 13) - SyntacticError: ERROR at or near "eLseif" \ No newline at end of file +(38, 13) - SyntacticError: ERROR at or near "eLseif" diff --git a/tests/parser/conditional4.cl b/tests/parser/conditional4.cl index 0792fdc85..187ff2e87 100644 --- a/tests/parser/conditional4.cl +++ b/tests/parser/conditional4.cl @@ -1,73 +1,73 @@ -(* A conditional has the form if then else fi *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(): Int { - if true++ then 1 else 0 -- Condition must be an expression - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file +(* A conditional has the form if then else fi *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(): Int { + if true++ then 1 else 0 -- Condition must be an expression + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/conditional4_error.txt b/tests/parser/conditional4_error.txt index f5511445b..3c6702ed2 100644 --- a/tests/parser/conditional4_error.txt +++ b/tests/parser/conditional4_error.txt @@ -1 +1 @@ -(45, 17) - SyntacticError: ERROR at or near "+" \ No newline at end of file +(45, 17) - SyntacticError: ERROR at or near "+" diff --git a/tests/parser/conditional5.cl b/tests/parser/conditional5.cl index 0c1e1aad0..c0d107049 100644 --- a/tests/parser/conditional5.cl +++ b/tests/parser/conditional5.cl @@ -1,73 +1,73 @@ -(* A conditional has the form if then else fi *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(): Int { - if true then true++ else 0 -- If branch must be an expression - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file +(* A conditional has the form if then else fi *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(): Int { + if true then true++ else 0 -- If branch must be an expression + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/conditional5_error.txt b/tests/parser/conditional5_error.txt index b3214010d..81c60bdf7 100644 --- a/tests/parser/conditional5_error.txt +++ b/tests/parser/conditional5_error.txt @@ -1 +1 @@ -(45, 27) - SyntacticError: ERROR at or near "+" \ No newline at end of file +(45, 27) - SyntacticError: ERROR at or near "+" diff --git a/tests/parser/conditional6.cl b/tests/parser/conditional6.cl index 02310404a..967716fd0 100644 --- a/tests/parser/conditional6.cl +++ b/tests/parser/conditional6.cl @@ -1,73 +1,73 @@ -(* A conditional has the form if then else fi *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(): Int { - if true then 1 else false++ -- Else branch must be an expression - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file +(* A conditional has the form if then else fi *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(): Int { + if true then 1 else false++ -- Else branch must be an expression + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/conditional6_error.txt b/tests/parser/conditional6_error.txt index 968b78ad9..62c050d02 100644 --- a/tests/parser/conditional6_error.txt +++ b/tests/parser/conditional6_error.txt @@ -1 +1 @@ -(45, 35) - SyntacticError: ERROR at or near "+" \ No newline at end of file +(45, 35) - SyntacticError: ERROR at or near "+" diff --git a/tests/parser/dispatch1.cl b/tests/parser/dispatch1.cl index 2ca394716..332e89f16 100644 --- a/tests/parser/dispatch1.cl +++ b/tests/parser/dispatch1.cl @@ -1,45 +1,45 @@ -(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - Test1.testing4(1, 2).testing4(3, 4).testing4(5, 6) -- Objet identifiers begin with a lower case letter - }; -} - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file +(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + Test1.testing4(1, 2).testing4(3, 4).testing4(5, 6) -- Objet identifiers begin with a lower case letter + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/dispatch2.cl b/tests/parser/dispatch2.cl index 0b57467a1..9e096c4e4 100644 --- a/tests/parser/dispatch2.cl +++ b/tests/parser/dispatch2.cl @@ -1,45 +1,45 @@ -(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13,) -- Extra comma - }; -} - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file +(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13,) -- Extra comma + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/dispatch2_error.txt b/tests/parser/dispatch2_error.txt index 134e266b2..9d2f85ed2 100644 --- a/tests/parser/dispatch2_error.txt +++ b/tests/parser/dispatch2_error.txt @@ -1 +1 @@ -(37, 84) - SyntacticError: ERROR at or near ")" \ No newline at end of file +(37, 84) - SyntacticError: ERROR at or near ")" diff --git a/tests/parser/dispatch3.cl b/tests/parser/dispatch3.cl index 9f1a5afff..0d88f5c23 100644 --- a/tests/parser/dispatch3.cl +++ b/tests/parser/dispatch3.cl @@ -1,45 +1,45 @@ -(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).Testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) -- Identifiers begin with a lower case letter - }; -} - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; +(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).Testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) -- Identifiers begin with a lower case letter + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; }; \ No newline at end of file diff --git a/tests/parser/dispatch4.cl b/tests/parser/dispatch4.cl index d1efc469d..92def488d 100644 --- a/tests/parser/dispatch4.cl +++ b/tests/parser/dispatch4.cl @@ -1,53 +1,53 @@ -(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - self.testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true++) -- Arguments must be expressions - }; -} - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file +(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + self.testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true++) -- Arguments must be expressions + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/dispatch4_error.txt b/tests/parser/dispatch4_error.txt index d03bb4c53..22f0cce1d 100644 --- a/tests/parser/dispatch4_error.txt +++ b/tests/parser/dispatch4_error.txt @@ -1 +1 @@ -(45, 81) - SyntacticError: ERROR at or near "+" \ No newline at end of file +(45, 81) - SyntacticError: ERROR at or near "+" diff --git a/tests/parser/dispatch5.cl b/tests/parser/dispatch5.cl index 63a5afa79..7d57f8f92 100644 --- a/tests/parser/dispatch5.cl +++ b/tests/parser/dispatch5.cl @@ -1,53 +1,53 @@ -(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, ,true + fALSE) -- Extra comma - }; -} - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file +(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, ,true + fALSE) -- Extra comma + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/dispatch6.cl b/tests/parser/dispatch6.cl index 0a953e2e6..4a4737d8a 100644 --- a/tests/parser/dispatch6.cl +++ b/tests/parser/dispatch6.cl @@ -1,57 +1,57 @@ -(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@object.copy() -- Type identifiers begin with a upper case letter - }; -} - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file +(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@object.copy() -- Type identifiers begin with a upper case letter + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/dispatch6_error.txt b/tests/parser/dispatch6_error.txt index 543f3a38c..7e7022c1a 100644 --- a/tests/parser/dispatch6_error.txt +++ b/tests/parser/dispatch6_error.txt @@ -1 +1 @@ -(49, 15) - SyntacticError: ERROR at or near "object" \ No newline at end of file +(49, 15) - SyntacticError: ERROR at or near "object" diff --git a/tests/parser/dispatch7.cl b/tests/parser/dispatch7.cl index 3ecac4d0f..21de69850 100644 --- a/tests/parser/dispatch7.cl +++ b/tests/parser/dispatch7.cl @@ -1,57 +1,57 @@ -(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.Copy() -- Identifiers begin with a lower case letter - }; -} - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file +(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.Copy() -- Identifiers begin with a lower case letter + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/dispatch7_error.txt b/tests/parser/dispatch7_error.txt index 27235d118..3740868cc 100644 --- a/tests/parser/dispatch7_error.txt +++ b/tests/parser/dispatch7_error.txt @@ -1 +1 @@ -(49, 22) - SyntacticError: ERROR at or near "Copy" \ No newline at end of file +(49, 22) - SyntacticError: ERROR at or near "Copy" diff --git a/tests/parser/dispatch8.cl b/tests/parser/dispatch8.cl index eef0455ef..ce525176c 100644 --- a/tests/parser/dispatch8.cl +++ b/tests/parser/dispatch8.cl @@ -1,57 +1,57 @@ -(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy(,) -- Extra comma - }; -} - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file +(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy(,) -- Extra comma + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/dispatch9.cl b/tests/parser/dispatch9.cl index 5fdef22d6..9f9e03b72 100644 --- a/tests/parser/dispatch9.cl +++ b/tests/parser/dispatch9.cl @@ -1,61 +1,61 @@ -(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; - - testing5(): Object { - test1:Object.copy() -- Must be '@' not ':' - }; -} - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file +(* There are three forms of dispatch (i.e. method call) in Cool. The three forms differ only in how the called method is selected *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; + + testing5(): Object { + test1:Object.copy() -- Must be '@' not ':' + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/let1.cl b/tests/parser/let1.cl index 576ae383c..a15d703da 100644 --- a/tests/parser/let1.cl +++ b/tests/parser/let1.cl @@ -1,85 +1,85 @@ -(* A let expression has the form let : [ <- ], ..., : [ <- ] in *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let Count: Int <- 0, pow: Int <- 1 -- Object identifiers starts with a lowercase letter - in { - -- count <- 0; - -- pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file +(* A let expression has the form let : [ <- ], ..., : [ <- ] in *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let Count: Int <- 0, pow: Int <- 1 -- Object identifiers starts with a lowercase letter + in { + -- count <- 0; + -- pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/let2.cl b/tests/parser/let2.cl index 4cfaef0f8..3c60fd726 100644 --- a/tests/parser/let2.cl +++ b/tests/parser/let2.cl @@ -1,85 +1,85 @@ -(* A let expression has the form let : [ <- ], ..., : [ <- ] in *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int, pow: int <- 1 -- Type identifiers starts with a uppercase letter - in { - count <- 0; - -- pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file +(* A let expression has the form let : [ <- ], ..., : [ <- ] in *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int, pow: int <- 1 -- Type identifiers starts with a uppercase letter + in { + count <- 0; + -- pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/let2_error.txt b/tests/parser/let2_error.txt index 6fb3f8e9c..d673ef17e 100644 --- a/tests/parser/let2_error.txt +++ b/tests/parser/let2_error.txt @@ -1 +1 @@ -(45, 30) - SyntacticError: ERROR at or near "int" \ No newline at end of file +(45, 30) - SyntacticError: ERROR at or near "int" diff --git a/tests/parser/let3.cl b/tests/parser/let3.cl index 91e567fd8..9d788f15e 100644 --- a/tests/parser/let3.cl +++ b/tests/parser/let3.cl @@ -1,85 +1,85 @@ -(* A let expression has the form let : [ <- ], ..., : [ <- ] in *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int, pow: Int, -- Extra comma - in { - count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file +(* A let expression has the form let : [ <- ], ..., : [ <- ] in *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int, pow: Int, -- Extra comma + in { + count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/let3_error.txt b/tests/parser/let3_error.txt index 71fa08812..e89206ca9 100644 --- a/tests/parser/let3_error.txt +++ b/tests/parser/let3_error.txt @@ -1 +1 @@ -(46, 9) - SyntacticError: ERROR at or near IN \ No newline at end of file +(46, 9) - SyntacticError: ERROR at or near IN diff --git a/tests/parser/let4.cl b/tests/parser/let4.cl index a716c332d..d87fe60f5 100644 --- a/tests/parser/let4.cl +++ b/tests/parser/let4.cl @@ -1,85 +1,85 @@ -(* A let expression has the form let : [ <- ], ..., : [ <- ] in *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int <- true++, pow: Int <- 1 -- Initialization must be an expression - in { - count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file +(* A let expression has the form let : [ <- ], ..., : [ <- ] in *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- true++, pow: Int <- 1 -- Initialization must be an expression + in { + count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/let4_error.txt b/tests/parser/let4_error.txt index e12c7478c..3eed8a78c 100644 --- a/tests/parser/let4_error.txt +++ b/tests/parser/let4_error.txt @@ -1 +1 @@ -(45, 32) - SyntacticError: ERROR at or near "+" \ No newline at end of file +(45, 32) - SyntacticError: ERROR at or near "+" diff --git a/tests/parser/let5.cl b/tests/parser/let5.cl index d974cc138..c9b4277b3 100644 --- a/tests/parser/let5.cl +++ b/tests/parser/let5.cl @@ -1,85 +1,85 @@ -(* A let expression has the form let : [ <- ], ..., : [ <- ] in *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int = 0, pow: Int -- Must be '<-' not '=' - in { - -- count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file +(* A let expression has the form let : [ <- ], ..., : [ <- ] in *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int = 0, pow: Int -- Must be '<-' not '=' + in { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/let6.cl b/tests/parser/let6.cl index b6e51d7e1..451b91acb 100644 --- a/tests/parser/let6.cl +++ b/tests/parser/let6.cl @@ -1,74 +1,74 @@ -(* A let expression has the form let : [ <- ], ..., : [ <- ] in *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int <- 0, pow: Int <- 1 - in false++ -- Let body must be an expression - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file +(* A let expression has the form let : [ <- ], ..., : [ <- ] in *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int <- 1 + in false++ -- Let body must be an expression + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/let6_error.txt b/tests/parser/let6_error.txt index 7a77928b9..e2c241cb7 100644 --- a/tests/parser/let6_error.txt +++ b/tests/parser/let6_error.txt @@ -1 +1 @@ -(46, 18) - SyntacticError: ERROR at or near "+" \ No newline at end of file +(46, 18) - SyntacticError: ERROR at or near "+" diff --git a/tests/parser/let7.cl b/tests/parser/let7.cl index 6fd63e6a7..8a0e4a747 100644 --- a/tests/parser/let7.cl +++ b/tests/parser/let7.cl @@ -1,85 +1,85 @@ -(* A let expression has the form let : [ <- ], ..., : [ <- ] in *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int <- 0, pow: Int - (* Missing "in" *) { - -- count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file +(* A let expression has the form let : [ <- ], ..., : [ <- ] in *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int + (* Missing "in" *) { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/let7_error.txt b/tests/parser/let7_error.txt index 654b1ce60..0c426beeb 100644 --- a/tests/parser/let7_error.txt +++ b/tests/parser/let7_error.txt @@ -1 +1 @@ -(46, 28) - SyntacticError: ERROR at or near "{" \ No newline at end of file +(46, 28) - SyntacticError: ERROR at or near "{" diff --git a/tests/parser/loop1.cl b/tests/parser/loop1.cl index 7d0d7688f..e83a39675 100644 --- a/tests/parser/loop1.cl +++ b/tests/parser/loop1.cl @@ -1,78 +1,78 @@ -(* A loop has the form while loop pool *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - count: Int <- 1; - - testing6(): Object { - while count < 1024*1024 - -- Missing "loop" - count <- count * 2 - pool - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file +(* A loop has the form while loop pool *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + count: Int <- 1; + + testing6(): Object { + while count < 1024*1024 + -- Missing "loop" + count <- count * 2 + pool + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/loop2.cl b/tests/parser/loop2.cl index a9613c487..f2c2b7007 100644 --- a/tests/parser/loop2.cl +++ b/tests/parser/loop2.cl @@ -1,78 +1,78 @@ -(* A loop has the form while loop pool *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - count: Int <- 1; - - testing6(): Object { - while count < 1024*1024 - loop - count <- count * 2 - -- Missing "pool" - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file +(* A loop has the form while loop pool *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + count: Int <- 1; + + testing6(): Object { + while count < 1024*1024 + loop + count <- count * 2 + -- Missing "pool" + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/loop3.cl b/tests/parser/loop3.cl index 860adb4d1..36181b636 100644 --- a/tests/parser/loop3.cl +++ b/tests/parser/loop3.cl @@ -1,78 +1,78 @@ -(* A loop has the form while loop pool *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - count: Int <- 1; - - testing6(): Object { - while count => 1024*1024 -- Condition must be an expression - loop - count <- count * 2 - pool - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file +(* A loop has the form while loop pool *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + count: Int <- 1; + + testing6(): Object { + while count => 1024*1024 -- Condition must be an expression + loop + count <- count * 2 + pool + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/loop3_error.txt b/tests/parser/loop3_error.txt index 3da8bcde0..bace8617b 100644 --- a/tests/parser/loop3_error.txt +++ b/tests/parser/loop3_error.txt @@ -1 +1 @@ -(47, 21) - SyntacticError: ERROR at or near DARROW \ No newline at end of file +(47, 21) - SyntacticError: ERROR at or near DARROW diff --git a/tests/parser/loop4.cl b/tests/parser/loop4.cl index 0a1194e82..5c71f923e 100644 --- a/tests/parser/loop4.cl +++ b/tests/parser/loop4.cl @@ -1,78 +1,78 @@ -(* A loop has the form while loop pool *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - count: Int <- 1; - - testing6(): Object { - while count < 1024*1024 - loop - count <- true++ -- While body must be an expression - pool - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file +(* A loop has the form while loop pool *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + count: Int <- 1; + + testing6(): Object { + while count < 1024*1024 + loop + count <- true++ -- While body must be an expression + pool + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/loop4_error.txt b/tests/parser/loop4_error.txt index c39f35fe1..e0eadab3a 100644 --- a/tests/parser/loop4_error.txt +++ b/tests/parser/loop4_error.txt @@ -1 +1 @@ -(49, 27) - SyntacticError: ERROR at or near "+" \ No newline at end of file +(49, 27) - SyntacticError: ERROR at or near "+" diff --git a/tests/parser/method1.cl b/tests/parser/method1.cl index fcfbbcd30..d9f8532be 100644 --- a/tests/parser/method1.cl +++ b/tests/parser/method1.cl @@ -1,34 +1,34 @@ -(* A method of class A is a procedure that may manipulate the variables and objects of class A *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - -- Method names must begin with lowercase letters - Testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file +(* A method of class A is a procedure that may manipulate the variables and objects of class A *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + -- Method names must begin with lowercase letters + Testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/method1_error.txt b/tests/parser/method1_error.txt index 0eff41999..d24075c33 100644 --- a/tests/parser/method1_error.txt +++ b/tests/parser/method1_error.txt @@ -1 +1 @@ -(21, 5) - SyntacticError: ERROR at or near "Testing2" \ No newline at end of file +(21, 5) - SyntacticError: ERROR at or near "Testing2" diff --git a/tests/parser/method2.cl b/tests/parser/method2.cl index d5bdfd85c..9729ba749 100644 --- a/tests/parser/method2.cl +++ b/tests/parser/method2.cl @@ -1,34 +1,34 @@ -(* A method of class A is a procedure that may manipulate the variables and objects of class A *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - -- Parameter names must begin with lowercase letters - testing2(a: Alpha, B: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file +(* A method of class A is a procedure that may manipulate the variables and objects of class A *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + -- Parameter names must begin with lowercase letters + testing2(a: Alpha, B: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/method2_error.txt b/tests/parser/method2_error.txt index 1843fb7b4..4d9d6b672 100644 --- a/tests/parser/method2_error.txt +++ b/tests/parser/method2_error.txt @@ -1 +1 @@ -(21, 24) - SyntacticError: ERROR at or near "B" \ No newline at end of file +(21, 24) - SyntacticError: ERROR at or near "B" diff --git a/tests/parser/method3.cl b/tests/parser/method3.cl index 1e5c9eb53..67d083c73 100644 --- a/tests/parser/method3.cl +++ b/tests/parser/method3.cl @@ -1,34 +1,34 @@ -(* A method of class A is a procedure that may manipulate the variables and objects of class A *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - -- Type names must begin with uppercase letters - testing2(a: Alpha, b: int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file +(* A method of class A is a procedure that may manipulate the variables and objects of class A *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + -- Type names must begin with uppercase letters + testing2(a: Alpha, b: int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/method3_error.txt b/tests/parser/method3_error.txt index dbecf552e..6fb5d2f09 100644 --- a/tests/parser/method3_error.txt +++ b/tests/parser/method3_error.txt @@ -1 +1 @@ -(21, 27) - SyntacticError: ERROR at or near "int" \ No newline at end of file +(21, 27) - SyntacticError: ERROR at or near "int" diff --git a/tests/parser/method4.cl b/tests/parser/method4.cl index 019ada276..6c0a02bc5 100644 --- a/tests/parser/method4.cl +++ b/tests/parser/method4.cl @@ -1,34 +1,34 @@ -(* A method of class A is a procedure that may manipulate the variables and objects of class A *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - -- Missing paremeter - testing3(x: Int,): String { - "2 + 2" - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file +(* A method of class A is a procedure that may manipulate the variables and objects of class A *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + -- Missing paremeter + testing3(x: Int,): String { + "2 + 2" + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/method4_error.txt b/tests/parser/method4_error.txt index 6421cee2b..13315a2b5 100644 --- a/tests/parser/method4_error.txt +++ b/tests/parser/method4_error.txt @@ -1 +1 @@ -(25, 21) - SyntacticError: ERROR at or near ")" \ No newline at end of file +(25, 21) - SyntacticError: ERROR at or near ")" diff --git a/tests/parser/method5.cl b/tests/parser/method5.cl index 13127f664..f5e2c2a86 100644 --- a/tests/parser/method5.cl +++ b/tests/parser/method5.cl @@ -1,34 +1,34 @@ -(* A method of class A is a procedure that may manipulate the variables and objects of class A *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - -- Type names must begin with uppercase letters - testing3(): string { - "2 + 2" - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file +(* A method of class A is a procedure that may manipulate the variables and objects of class A *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + -- Type names must begin with uppercase letters + testing3(): string { + "2 + 2" + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/method5_error.txt b/tests/parser/method5_error.txt index 9bda07041..9bd898c48 100644 --- a/tests/parser/method5_error.txt +++ b/tests/parser/method5_error.txt @@ -1 +1 @@ -(25, 17) - SyntacticError: ERROR at or near "string" \ No newline at end of file +(25, 17) - SyntacticError: ERROR at or near "string" diff --git a/tests/parser/method6.cl b/tests/parser/method6.cl index d48cd1293..fc5389082 100644 --- a/tests/parser/method6.cl +++ b/tests/parser/method6.cl @@ -1,33 +1,33 @@ -(* A method of class A is a procedure that may manipulate the variables and objects of class A *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - -- Body can't be empty - testing2(a: Alpha, b: Int): Int { - }; - - testing3(): String { - "2 + 2" - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file +(* A method of class A is a procedure that may manipulate the variables and objects of class A *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + -- Body can't be empty + testing2(a: Alpha, b: Int): Int { + }; + + testing3(): String { + "2 + 2" + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/method6_error.txt b/tests/parser/method6_error.txt index e7d5de400..ef6413b71 100644 --- a/tests/parser/method6_error.txt +++ b/tests/parser/method6_error.txt @@ -1 +1 @@ -(22, 5) - SyntacticError: ERROR at or near "}" \ No newline at end of file +(22, 5) - SyntacticError: ERROR at or near "}" diff --git a/tests/parser/mixed1.cl b/tests/parser/mixed1.cl index a27879513..b13e679da 100644 --- a/tests/parser/mixed1.cl +++ b/tests/parser/mixed1.cl @@ -1,100 +1,100 @@ -(* Cool has four binary arithmetic operations: +, -, *, /. *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int <- 0, pow: Int - in { - -- count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; - - testing7(): Object { - case 2 + 2 of - x: Int => new IO.out_string("Es un entero!"); - y: String => new IO.out_string("Es una cadena!"); - z: Bool => new IO.out_string("Es un booleano!"); - esac - }; - - a: Int <- 1; - - testing8(x: Int, y: Int): Bool { - let z: Int <- 3, w: Int <- 4 - in isvoid (3 + a * (x / w + new Int) - y - (((if tRue = not faLSe then ~z else 3 <= 4 + "hey".length() fi + a))/(0)*(((4 * 4))))) - }; -}-- Mising ";" - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; +(* Cool has four binary arithmetic operations: +, -, *, /. *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int + in { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; + + testing7(): Object { + case 2 + 2 of + x: Int => new IO.out_string("Es un entero!"); + y: String => new IO.out_string("Es una cadena!"); + z: Bool => new IO.out_string("Es un booleano!"); + esac + }; + + a: Int <- 1; + + testing8(x: Int, y: Int): Bool { + let z: Int <- 3, w: Int <- 4 + in isvoid (3 + a * (x / w + new Int) - y - (((if tRue = not faLSe then ~z else 3 <= 4 + "hey".length() fi + a))/(0)*(((4 * 4))))) + }; +}-- Mising ";" + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; }; \ No newline at end of file diff --git a/tests/parser/mixed2.cl b/tests/parser/mixed2.cl index f5477e0bb..6776fcc12 100644 --- a/tests/parser/mixed2.cl +++ b/tests/parser/mixed2.cl @@ -1,14 +1,14 @@ -class Main { - main(): Object { - (new Alpha).print() - }; - -}; - -(* Class names must begin with uppercase letters *) -class alpha inherits IO { - print() : Object { - out_string("reached!!\n"); - }; -}; - +class Main { + main(): Object { + (new Alpha).print() + }; + +}; + +(* Class names must begin with uppercase letters *) +class alpha inherits IO { + print() : Object { + out_string("reached!!\n"); + }; +}; + diff --git a/tests/parser/mixed2_error.txt b/tests/parser/mixed2_error.txt index b5613c52a..9ee440d98 100644 --- a/tests/parser/mixed2_error.txt +++ b/tests/parser/mixed2_error.txt @@ -1 +1 @@ -(9, 7) - SyntacticError: ERROR at or near "alpha" \ No newline at end of file +(9, 7) - SyntacticError: ERROR at or near "alpha" diff --git a/tests/parser/mixed3.cl b/tests/parser/mixed3.cl index 1bdcad743..f5271eb3e 100644 --- a/tests/parser/mixed3.cl +++ b/tests/parser/mixed3.cl @@ -1,40 +1,40 @@ -class Main inherits IO { - main() : Object { - { - out_string("Enter a number to check if number is prime\n"); - let i : Int <- in_int() in { - if(i <= 1) then { - out_string("Invalid Input\n"); - abort(); - } else { - if (isPrime(i) = 1) then - out_string("Number is prime\n") - else - out_string("Number is composite\n") - fi; - } - fi; - }; - } - }; - - mod(i : Int, ) : Int { -- Formal list must be comma separated. A comma does not terminate a list of formals. - i - (i/k)*k - }; - - isPrime(i : Int) : Int { - { - let x : Int <- 2, - c : Int <- 1 in - { - while (not (x = i)) loop - if (mod(i, x) = 0) then { - c <- 0; - x <- i; - } else x <- x + 1 fi - pool; - c; - }; - } - }; -}; +class Main inherits IO { + main() : Object { + { + out_string("Enter a number to check if number is prime\n"); + let i : Int <- in_int() in { + if(i <= 1) then { + out_string("Invalid Input\n"); + abort(); + } else { + if (isPrime(i) = 1) then + out_string("Number is prime\n") + else + out_string("Number is composite\n") + fi; + } + fi; + }; + } + }; + + mod(i : Int, ) : Int { -- Formal list must be comma separated. A comma does not terminate a list of formals. + i - (i/k)*k + }; + + isPrime(i : Int) : Int { + { + let x : Int <- 2, + c : Int <- 1 in + { + while (not (x = i)) loop + if (mod(i, x) = 0) then { + c <- 0; + x <- i; + } else x <- x + 1 fi + pool; + c; + }; + } + }; +}; diff --git a/tests/parser/mixed3_error.txt b/tests/parser/mixed3_error.txt index 159bdca63..46af269e0 100644 --- a/tests/parser/mixed3_error.txt +++ b/tests/parser/mixed3_error.txt @@ -1 +1 @@ -(21, 18) - SyntacticError: ERROR at or near ")" \ No newline at end of file +(21, 18) - SyntacticError: ERROR at or near ")" diff --git a/tests/parser/mixed4.cl b/tests/parser/mixed4.cl index e752253be..47e6ea5e9 100644 --- a/tests/parser/mixed4.cl +++ b/tests/parser/mixed4.cl @@ -1,21 +1,21 @@ -class Main inherits IO { - main() : Object { - { - out_string("Enter number of numbers to multiply\n"); - out_int(prod(in_int())); - out_string("\n"); - } - }; - - prod(i : Int) : Int { - let y : Int <- 1 in { - while (not (i = 0) ) loop { - out_string("Enter Number: "); - y <- y * in_int(Main : Int); -- the parser correctly catches the error here - i <- i - 1; - } - pool; - y; - } - }; -}; +class Main inherits IO { + main() : Object { + { + out_string("Enter number of numbers to multiply\n"); + out_int(prod(in_int())); + out_string("\n"); + } + }; + + prod(i : Int) : Int { + let y : Int <- 1 in { + while (not (i = 0) ) loop { + out_string("Enter Number: "); + y <- y * in_int(Main : Int); -- the parser correctly catches the error here + i <- i - 1; + } + pool; + y; + } + }; +}; diff --git a/tests/parser/mixed5.cl b/tests/parser/mixed5.cl index c9176a890..d4ca68f44 100644 --- a/tests/parser/mixed5.cl +++ b/tests/parser/mixed5.cl @@ -1,20 +1,20 @@ -class Main inherits IO { - str <- "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."; - main() : Object { - { - out_string("Enter number of numbers to multiply\n"); - out_int(prod(in_int())); - out_string("\n"); - } - }; - prod(i : Int) : Int { - let y : Int <- 1 in { - while (not (i = 0) ) loop { - out_string("Enter Number: "); - y <- y * in_int(); - i <- i - 1; - } - y; - } - }; -} +class Main inherits IO { + str <- "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."; + main() : Object { + { + out_string("Enter number of numbers to multiply\n"); + out_int(prod(in_int())); + out_string("\n"); + } + }; + prod(i : Int) : Int { + let y : Int <- 1 in { + while (not (i = 0) ) loop { + out_string("Enter Number: "); + y <- y * in_int(); + i <- i - 1; + } + y; + } + }; +} diff --git a/tests/parser/mixed5_error.txt b/tests/parser/mixed5_error.txt index 443037eca..110601e2b 100644 --- a/tests/parser/mixed5_error.txt +++ b/tests/parser/mixed5_error.txt @@ -1 +1 @@ -(2, 9) - SyntacticError: ERROR at or near ASSIGN \ No newline at end of file +(2, 9) - SyntacticError: ERROR at or near ASSIGN diff --git a/tests/parser/mixed6.cl b/tests/parser/mixed6.cl index 5da80da31..0a51656c9 100644 --- a/tests/parser/mixed6.cl +++ b/tests/parser/mixed6.cl @@ -1,5 +1,5 @@ -classs Doom { - i : Int <- 0; - main() : Object { - if i = 0 then out_string("This is da real *h*t") - +classs Doom { + i : Int <- 0; + main() : Object { + if i = 0 then out_string("This is da real *h*t") + diff --git a/tests/parser/operation1.cl b/tests/parser/operation1.cl index d38eb72d0..cb9d5f706 100644 --- a/tests/parser/operation1.cl +++ b/tests/parser/operation1.cl @@ -1,101 +1,101 @@ -(* Cool has four binary arithmetic operations: +, -, *, /. *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int <- 0, pow: Int - in { - -- count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; - - testing7(): Object { - case 2 + 2 of - x: Int => new IO.out_string("Es un entero!"); - y: String => new IO.out_string("Es una cadena!"); - z: Bool => new IO.out_string("Es un booleano!"); - esac - }; - - a: Int <- 1; - - testing8(x: Int, y: Int): Bool { - let z: Int <- 3, w: Int <- 4 - -- Missing ')' - in isvoid (3 + a * (x / w + new Int) - y - (((if tRue = not faLSe then ~z else 3 <= 4 + "hey".length() fi + a)/(0)*(((4 * 4))))) - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file +(* Cool has four binary arithmetic operations: +, -, *, /. *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int + in { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; + + testing7(): Object { + case 2 + 2 of + x: Int => new IO.out_string("Es un entero!"); + y: String => new IO.out_string("Es una cadena!"); + z: Bool => new IO.out_string("Es un booleano!"); + esac + }; + + a: Int <- 1; + + testing8(x: Int, y: Int): Bool { + let z: Int <- 3, w: Int <- 4 + -- Missing ')' + in isvoid (3 + a * (x / w + new Int) - y - (((if tRue = not faLSe then ~z else 3 <= 4 + "hey".length() fi + a)/(0)*(((4 * 4))))) + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/operation1_error.txt b/tests/parser/operation1_error.txt index b30202399..db4601844 100644 --- a/tests/parser/operation1_error.txt +++ b/tests/parser/operation1_error.txt @@ -1 +1 @@ -(74, 5) - SyntacticError: ERROR at or near "}" \ No newline at end of file +(74, 5) - SyntacticError: ERROR at or near "}" diff --git a/tests/parser/operation2.cl b/tests/parser/operation2.cl index 2dc628359..0ee832b53 100644 --- a/tests/parser/operation2.cl +++ b/tests/parser/operation2.cl @@ -1,101 +1,101 @@ -(* Cool has four binary arithmetic operations: +, -, *, /. *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int <- 0, pow: Int - in { - -- count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; - - testing7(): Object { - case 2 + 2 of - x: Int => new IO.out_string("Es un entero!"); - y: String => new IO.out_string("Es una cadena!"); - z: Bool => new IO.out_string("Es un booleano!"); - esac - }; - - a: Int <- 1; - - testing8(x: Int, y: Int): Bool { - let z: Int <- 3, w: Int <- 4 - -- Type identifiers starts with a uppercase letter - in isvoid (3 + a * (x / w + new int) - y - (((if tRue = not faLSe then ~z else 3 <= 4 + "hey".length() fi + a))/(0)*(((4 * 4))))) - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file +(* Cool has four binary arithmetic operations: +, -, *, /. *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int + in { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; + + testing7(): Object { + case 2 + 2 of + x: Int => new IO.out_string("Es un entero!"); + y: String => new IO.out_string("Es una cadena!"); + z: Bool => new IO.out_string("Es un booleano!"); + esac + }; + + a: Int <- 1; + + testing8(x: Int, y: Int): Bool { + let z: Int <- 3, w: Int <- 4 + -- Type identifiers starts with a uppercase letter + in isvoid (3 + a * (x / w + new int) - y - (((if tRue = not faLSe then ~z else 3 <= 4 + "hey".length() fi + a))/(0)*(((4 * 4))))) + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/operation2_error.txt b/tests/parser/operation2_error.txt index 37b458f3a..4d016a25b 100644 --- a/tests/parser/operation2_error.txt +++ b/tests/parser/operation2_error.txt @@ -1 +1 @@ -(73, 41) - SyntacticError: ERROR at or near "int" \ No newline at end of file +(73, 41) - SyntacticError: ERROR at or near "int" diff --git a/tests/parser/operation3.cl b/tests/parser/operation3.cl index 61d6cbfa8..f12aa5684 100644 --- a/tests/parser/operation3.cl +++ b/tests/parser/operation3.cl @@ -1,101 +1,101 @@ -(* Cool has four binary arithmetic operations: +, -, *, /. *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int <- 0, pow: Int - in { - -- count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; - - testing7(): Object { - case 2 + 2 of - x: Int => new IO.out_string("Es un entero!"); - y: String => new IO.out_string("Es una cadena!"); - z: Bool => new IO.out_string("Es un booleano!"); - esac - }; - - a: Int <- 1; - - testing8(x: Int, y: Int): Bool { - let z: Int <- 3, w: Int <- 4 - -- Object identifiers starts with a lowercase letter - in isvoid (3 + a * (x / w + new Int) - y - (((if tRue = not faLSe then ~Mazinger_Z else 3 <= 4 + "hey".length() fi + a))/(0)*(((4 * 4))))) - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file +(* Cool has four binary arithmetic operations: +, -, *, /. *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int + in { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; + + testing7(): Object { + case 2 + 2 of + x: Int => new IO.out_string("Es un entero!"); + y: String => new IO.out_string("Es una cadena!"); + z: Bool => new IO.out_string("Es un booleano!"); + esac + }; + + a: Int <- 1; + + testing8(x: Int, y: Int): Bool { + let z: Int <- 3, w: Int <- 4 + -- Object identifiers starts with a lowercase letter + in isvoid (3 + a * (x / w + new Int) - y - (((if tRue = not faLSe then ~Mazinger_Z else 3 <= 4 + "hey".length() fi + a))/(0)*(((4 * 4))))) + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/operation3_error.txt b/tests/parser/operation3_error.txt index 6b266f3f3..8ac17fd80 100644 --- a/tests/parser/operation3_error.txt +++ b/tests/parser/operation3_error.txt @@ -1 +1 @@ -(73, 81) - SyntacticError: ERROR at or near "Mazinger_Z" \ No newline at end of file +(73, 81) - SyntacticError: ERROR at or near "Mazinger_Z" diff --git a/tests/parser/operation4.cl b/tests/parser/operation4.cl index bae7de5b5..2f203e879 100644 --- a/tests/parser/operation4.cl +++ b/tests/parser/operation4.cl @@ -1,101 +1,101 @@ -(* Cool has four binary arithmetic operations: +, -, *, /. *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - test1: Object; - - testing1(): Int { - 2 + 2 - }; - - test2: Int <- 1; - - test3: String <- "1"; - - testing2(a: Alpha, b: Int): Int { - 2 + 2 - }; - - testing3(): String { - "2 + 2" - }; - - testing4(x: Int, y: Int): Test { - self - }; - - testing5(a: String, b: String): IO { - If a.length() < b.length() THeN - new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) - eLSe - if a.length() = b.length() THeN - new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) - ElsE - new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) - fI - Fi - }; - - testing6(a: Int): IO { - let count: Int <- 0, pow: Int - in { - -- count <- 0; - pow <- 1; - while pow < a - loop - { - count <- count + 1; - pow <- pow * 2; - } - pool; - new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); - } - }; - - testing7(): Object { - case 2 + 2 of - x: Int => new IO.out_string("Es un entero!"); - y: String => new IO.out_string("Es una cadena!"); - z: Bool => new IO.out_string("Es un booleano!"); - esac - }; - - a: Int <- 1; - - testing8(x: Int, y: Int): Bool { - let z: Int <- 3, w: Int <- 4 - -- Double "+" - in isvoid (3 + a * (x / w++ new Int) - y - (((if tRue = not faLSe then ~z else 3 <= 4 + "hey".length() fi + a))/(0)*(((4 * 4))))) - }; -}; - -class Test2 { - test1: Test <- new Test; - - testing1(): Test { - test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) - }; - - testing2(x: Int, y: Int): Test2 { - self - }; - - testing3(): Test2 { - testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) - }; - - testing4(): Object { - test1@Object.copy() - }; -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; \ No newline at end of file +(* Cool has four binary arithmetic operations: +, -, *, /. *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + test1: Object; + + testing1(): Int { + 2 + 2 + }; + + test2: Int <- 1; + + test3: String <- "1"; + + testing2(a: Alpha, b: Int): Int { + 2 + 2 + }; + + testing3(): String { + "2 + 2" + }; + + testing4(x: Int, y: Int): Test { + self + }; + + testing5(a: String, b: String): IO { + If a.length() < b.length() THeN + new IO.out_string("La cadena \"".concat(b).concat("\" es mas larga que la cadena \"").concat(a).concat("\".")) + eLSe + if a.length() = b.length() THeN + new IO.out_string("La cadena \"".concat(a).concat("\" mide igual que la cadena \"").concat(b).concat("\".")) + ElsE + new IO.out_string("La cadena \"".concat(a).concat("\" es mas larga que la cadena \"").concat(b).concat("\".")) + fI + Fi + }; + + testing6(a: Int): IO { + let count: Int <- 0, pow: Int + in { + -- count <- 0; + pow <- 1; + while pow < a + loop + { + count <- count + 1; + pow <- pow * 2; + } + pool; + new IO.out_string("El logaritmo en base 2 de ").out_int(a).out_string(" es ").out_int(count); + } + }; + + testing7(): Object { + case 2 + 2 of + x: Int => new IO.out_string("Es un entero!"); + y: String => new IO.out_string("Es una cadena!"); + z: Bool => new IO.out_string("Es un booleano!"); + esac + }; + + a: Int <- 1; + + testing8(x: Int, y: Int): Bool { + let z: Int <- 3, w: Int <- 4 + -- Double "+" + in isvoid (3 + a * (x / w++ new Int) - y - (((if tRue = not faLSe then ~z else 3 <= 4 + "hey".length() fi + a))/(0)*(((4 * 4))))) + }; +}; + +class Test2 { + test1: Test <- new Test; + + testing1(): Test { + test1.testing4(1 + 1, 1 + 2).testing4(2 + 3, 3 + 5).testing4(5 + 8, 8 + 13) + }; + + testing2(x: Int, y: Int): Test2 { + self + }; + + testing3(): Test2 { + testing2(1 + 1, 1 + 2).testing2(2 + 3, 3 + 5).testing2(5 + 8, true + fALSE) + }; + + testing4(): Object { + test1@Object.copy() + }; +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/operation4_error.txt b/tests/parser/operation4_error.txt index e0ebb0985..a2c723e51 100644 --- a/tests/parser/operation4_error.txt +++ b/tests/parser/operation4_error.txt @@ -1 +1 @@ -(73, 35) - SyntacticError: ERROR at or near "+" \ No newline at end of file +(73, 35) - SyntacticError: ERROR at or near "+" diff --git a/tests/parser/program1_error.txt b/tests/parser/program1_error.txt index de00ac46b..100048787 100644 --- a/tests/parser/program1_error.txt +++ b/tests/parser/program1_error.txt @@ -1 +1 @@ -(0, 0) - SyntacticError: ERROR at or near EOF \ No newline at end of file +(0, 0) - SyntacticError: ERROR at or near EOF diff --git a/tests/parser/program2.cl b/tests/parser/program2.cl index f8b16779c..a281c6c14 100644 --- a/tests/parser/program2.cl +++ b/tests/parser/program2.cl @@ -1,20 +1,20 @@ -(* Cool programs are sets of classes *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - --- Missing semicolon -class Test { - testing(): Int { - 2 + 2 - }; -} - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* Cool programs are sets of classes *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +-- Missing semicolon +class Test { + testing(): Int { + 2 + 2 + }; +} + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser/program3.cl b/tests/parser/program3.cl index e27889c57..10d2dc71e 100644 --- a/tests/parser/program3.cl +++ b/tests/parser/program3.cl @@ -1,24 +1,24 @@ -(* Cool programs are sets of classes *) - -class Main { - main(): Object { - (new Alpha).print() - }; -}; - -class Test { - testing(): Int { - 2 + 2 - }; -}; - --- Only classes -suma(a: Int, b: Int) int { - a + b -}; - -class Alpha inherits IO { - print() : Object { - out_string("reached!!\n") - }; -}; +(* Cool programs are sets of classes *) + +class Main { + main(): Object { + (new Alpha).print() + }; +}; + +class Test { + testing(): Int { + 2 + 2 + }; +}; + +-- Only classes +suma(a: Int, b: Int) int { + a + b +}; + +class Alpha inherits IO { + print() : Object { + out_string("reached!!\n") + }; +}; diff --git a/tests/parser_test.py b/tests/parser_test.py index 129c0f20a..3793fabc0 100644 --- a/tests/parser_test.py +++ b/tests/parser_test.py @@ -1,13 +1,21 @@ -import pytest -import os -from utils import compare_errors - -tests_dir = __file__.rpartition('/')[0] + '/parser/' -tests = [(file) for file in os.listdir(tests_dir) if file.endswith('.cl')] - -@pytest.mark.parser -@pytest.mark.error -@pytest.mark.run(order=2) -@pytest.mark.parametrize("cool_file", tests) -def test_parser_errors(compiler_path, cool_file): - compare_errors(compiler_path, tests_dir + cool_file, tests_dir + cool_file[:-3] + '_error.txt') \ No newline at end of file +import os +import pathlib + +import pytest + +from .utils import compare_errors + +tests_dir = str(pathlib.Path(__file__).parent / "parser") +tests = [(file) for file in os.listdir(tests_dir) if file.endswith(".cl")] + + +@pytest.mark.parser +@pytest.mark.error +@pytest.mark.run(order=2) +@pytest.mark.parametrize("cool_file", tests) +def test_parser_errors(compiler_path, cool_file): + compare_errors( + compiler_path, + str(os.path.join(tests_dir, cool_file)), + str(os.path.join(tests_dir, cool_file[:-3] + "_error.txt")), + ) diff --git a/tests/semantic/arithmetic1.cl b/tests/semantic/arithmetic1.cl index bf94eb194..65719c064 100644 --- a/tests/semantic/arithmetic1.cl +++ b/tests/semantic/arithmetic1.cl @@ -1,11 +1,11 @@ ---The static types of the two sub-expressions must be Int. - -class A { }; -class B inherits A { }; -class C inherits B { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - test: Int <- let x: Int <- 1 * 2 / 3 - 4 + new A.type_name().concat(new B.type_name().concat(new C.type_name())).length() - in x <- x + new A.type_name().concat(new B.type_name().concat(new C.type_name())); +--The static types of the two sub-expressions must be Int. + +class A { }; +class B inherits A { }; +class C inherits B { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + test: Int <- let x: Int <- 1 * 2 / 3 - 4 + new A.type_name().concat(new B.type_name().concat(new C.type_name())).length() + in x <- x + new A.type_name().concat(new B.type_name().concat(new C.type_name())); }; \ No newline at end of file diff --git a/tests/semantic/arithmetic10.cl b/tests/semantic/arithmetic10.cl index bbfe6cdb3..b2488ad7f 100644 --- a/tests/semantic/arithmetic10.cl +++ b/tests/semantic/arithmetic10.cl @@ -1,15 +1,15 @@ -(* -The expression ~ is the integer -complement of . The expression must have static type Int and the entire expression -has static type Int. -*) - -class A { }; -class B inherits A { }; -class C inherits B { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - test: Bool <- let x: Bool <- 1 / 2 - 3 + 4 < new A.type_name().concat(new B.type_name().concat(new C.type_name())).length() - in ~new A.type_name().concat(new B.type_name().concat(new C.type_name())).length(); +(* +The expression ~ is the integer +complement of . The expression must have static type Int and the entire expression +has static type Int. +*) + +class A { }; +class B inherits A { }; +class C inherits B { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + test: Bool <- let x: Bool <- 1 / 2 - 3 + 4 < new A.type_name().concat(new B.type_name().concat(new C.type_name())).length() + in ~new A.type_name().concat(new B.type_name().concat(new C.type_name())).length(); }; \ No newline at end of file diff --git a/tests/semantic/arithmetic11.cl b/tests/semantic/arithmetic11.cl index fc067dc1a..05cec0465 100644 --- a/tests/semantic/arithmetic11.cl +++ b/tests/semantic/arithmetic11.cl @@ -1,14 +1,14 @@ -(* -The expression not is the boolean complement of . The expression - must have static type Bool and the entire expression has static type Bool. -*) - -class A { }; -class B inherits A { }; -class C inherits B { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - test: Bool <- let x: Bool <- 1 / 2 - 3 + 4 < new A.type_name().concat(new B.type_name().concat(new C.type_name())).length() - in not 1 + new A.type_name().concat(new B.type_name().concat(new C.type_name())).length(); +(* +The expression not is the boolean complement of . The expression + must have static type Bool and the entire expression has static type Bool. +*) + +class A { }; +class B inherits A { }; +class C inherits B { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + test: Bool <- let x: Bool <- 1 / 2 - 3 + 4 < new A.type_name().concat(new B.type_name().concat(new C.type_name())).length() + in not 1 + new A.type_name().concat(new B.type_name().concat(new C.type_name())).length(); }; \ No newline at end of file diff --git a/tests/semantic/arithmetic12.cl b/tests/semantic/arithmetic12.cl index 2e012fc41..05a2da918 100644 --- a/tests/semantic/arithmetic12.cl +++ b/tests/semantic/arithmetic12.cl @@ -1,14 +1,14 @@ -(* -The expression not is the boolean complement of . The expression - must have static type Bool and the entire expression has static type Bool. -*) - -class A { }; -class B inherits A { }; -class C inherits B { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - test: Int <- let x: Bool <- 1 / 2 - 3 + 4 < new A.type_name().concat(new B.type_name().concat(new C.type_name())).length() - in not 1 < new A.type_name().concat(new B.type_name().concat(new C.type_name())).length(); +(* +The expression not is the boolean complement of . The expression + must have static type Bool and the entire expression has static type Bool. +*) + +class A { }; +class B inherits A { }; +class C inherits B { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + test: Int <- let x: Bool <- 1 / 2 - 3 + 4 < new A.type_name().concat(new B.type_name().concat(new C.type_name())).length() + in not 1 < new A.type_name().concat(new B.type_name().concat(new C.type_name())).length(); }; \ No newline at end of file diff --git a/tests/semantic/arithmetic1_error.txt b/tests/semantic/arithmetic1_error.txt index a74ebf3da..59213724d 100644 --- a/tests/semantic/arithmetic1_error.txt +++ b/tests/semantic/arithmetic1_error.txt @@ -1 +1 @@ -(10, 27) - TypeError: non-Int arguments: Int + String +(10, 27) - TypeError: non-Int arguments: Int + String diff --git a/tests/semantic/arithmetic2.cl b/tests/semantic/arithmetic2.cl index 59532573d..f1f0935e2 100644 --- a/tests/semantic/arithmetic2.cl +++ b/tests/semantic/arithmetic2.cl @@ -1,11 +1,11 @@ ---The static types of the two sub-expressions must be Int. - -class A { }; -class B inherits A { }; -class C inherits B { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - test: Int <- let x: Int <- 1 + 2 * 3 / 4 - new A.type_name().concat(new B.type_name().concat(new C.type_name())).length() - in x <- x - new A.type_name().concat(new B.type_name().concat(new C.type_name())); +--The static types of the two sub-expressions must be Int. + +class A { }; +class B inherits A { }; +class C inherits B { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + test: Int <- let x: Int <- 1 + 2 * 3 / 4 - new A.type_name().concat(new B.type_name().concat(new C.type_name())).length() + in x <- x - new A.type_name().concat(new B.type_name().concat(new C.type_name())); }; \ No newline at end of file diff --git a/tests/semantic/arithmetic2_error.txt b/tests/semantic/arithmetic2_error.txt index 2c7952af8..aebc7aab9 100644 --- a/tests/semantic/arithmetic2_error.txt +++ b/tests/semantic/arithmetic2_error.txt @@ -1 +1 @@ -(10, 27) - TypeError: non-Int arguments: Int - String +(10, 27) - TypeError: non-Int arguments: Int - String diff --git a/tests/semantic/arithmetic3.cl b/tests/semantic/arithmetic3.cl index b208957f5..df64d8000 100644 --- a/tests/semantic/arithmetic3.cl +++ b/tests/semantic/arithmetic3.cl @@ -1,11 +1,11 @@ ---The static types of the two sub-expressions must be Int. - -class A { }; -class B inherits A { }; -class C inherits B { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - test: Int <- let x: Int <- 1 - 2 + 3 * 4 / new A.type_name().concat(new B.type_name().concat(new C.type_name())).length() - in x <- x / new A.type_name().concat(new B.type_name().concat(new C.type_name())); +--The static types of the two sub-expressions must be Int. + +class A { }; +class B inherits A { }; +class C inherits B { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + test: Int <- let x: Int <- 1 - 2 + 3 * 4 / new A.type_name().concat(new B.type_name().concat(new C.type_name())).length() + in x <- x / new A.type_name().concat(new B.type_name().concat(new C.type_name())); }; \ No newline at end of file diff --git a/tests/semantic/arithmetic3_error.txt b/tests/semantic/arithmetic3_error.txt index 81d88331a..d0af01bb5 100644 --- a/tests/semantic/arithmetic3_error.txt +++ b/tests/semantic/arithmetic3_error.txt @@ -1 +1 @@ -(10, 27) - TypeError: non-Int arguments: Int / String +(10, 27) - TypeError: non-Int arguments: Int / String diff --git a/tests/semantic/arithmetic4.cl b/tests/semantic/arithmetic4.cl index 2c7dd4fc9..68512ca44 100644 --- a/tests/semantic/arithmetic4.cl +++ b/tests/semantic/arithmetic4.cl @@ -1,11 +1,11 @@ ---The static types of the two sub-expressions must be Int. - -class A { }; -class B inherits A { }; -class C inherits B { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - test: Int <- let x: Int <- 1 / 2 - 3 + 4 * new A.type_name().concat(new B.type_name().concat(new C.type_name())).length() - in x <- x * new A.type_name().concat(new B.type_name().concat(new C.type_name())); +--The static types of the two sub-expressions must be Int. + +class A { }; +class B inherits A { }; +class C inherits B { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + test: Int <- let x: Int <- 1 / 2 - 3 + 4 * new A.type_name().concat(new B.type_name().concat(new C.type_name())).length() + in x <- x * new A.type_name().concat(new B.type_name().concat(new C.type_name())); }; \ No newline at end of file diff --git a/tests/semantic/arithmetic5.cl b/tests/semantic/arithmetic5.cl index bc08c6e82..fd77c7971 100644 --- a/tests/semantic/arithmetic5.cl +++ b/tests/semantic/arithmetic5.cl @@ -1,11 +1,11 @@ ---The static type of the expression is Int. - -class A { }; -class B inherits A { }; -class C inherits B { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - test: Bool <- let x: Int <- 1 / 2 - 3 + 4 * new A.type_name().concat(new B.type_name().concat(new C.type_name())).length() - in x <- x * new A.type_name().concat(new B.type_name().concat(new C.type_name())).length(); +--The static type of the expression is Int. + +class A { }; +class B inherits A { }; +class C inherits B { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + test: Bool <- let x: Int <- 1 / 2 - 3 + 4 * new A.type_name().concat(new B.type_name().concat(new C.type_name())).length() + in x <- x * new A.type_name().concat(new B.type_name().concat(new C.type_name())).length(); }; \ No newline at end of file diff --git a/tests/semantic/arithmetic5_error.txt b/tests/semantic/arithmetic5_error.txt index dd5346844..8c67c2f53 100644 --- a/tests/semantic/arithmetic5_error.txt +++ b/tests/semantic/arithmetic5_error.txt @@ -1 +1 @@ -(9, 19) - TypeError: Inferred type Int of initialization of attribute test does not conform to declared type Bool. +(9, 19) - TypeError: Inferred type Int of initialization of attribute test does not conform to declared type Bool. diff --git a/tests/semantic/arithmetic6.cl b/tests/semantic/arithmetic6.cl index a0c3d03ff..d4da66a73 100644 --- a/tests/semantic/arithmetic6.cl +++ b/tests/semantic/arithmetic6.cl @@ -1,11 +1,11 @@ - --The static types of the two sub-expressions must be Int. - -class A { }; -class B inherits A { }; -class C inherits B { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - test: Bool <- let x: Bool <- 1 / 2 - 3 + 4 <= new A.type_name().concat(new B.type_name().concat(new C.type_name())).length() - in 1 <= new A.type_name().concat(new B.type_name().concat(new C.type_name())); -}; + --The static types of the two sub-expressions must be Int. + +class A { }; +class B inherits A { }; +class C inherits B { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + test: Bool <- let x: Bool <- 1 / 2 - 3 + 4 <= new A.type_name().concat(new B.type_name().concat(new C.type_name())).length() + in 1 <= new A.type_name().concat(new B.type_name().concat(new C.type_name())); +}; diff --git a/tests/semantic/arithmetic6_error.txt b/tests/semantic/arithmetic6_error.txt index 2e43dfc17..a0d67cb48 100644 --- a/tests/semantic/arithmetic6_error.txt +++ b/tests/semantic/arithmetic6_error.txt @@ -1 +1 @@ -(10, 22) - TypeError: non-Int arguments: Int <= String +(10, 22) - TypeError: non-Int arguments: Int <= String diff --git a/tests/semantic/arithmetic7.cl b/tests/semantic/arithmetic7.cl index c00c75cde..b98a4b0e2 100644 --- a/tests/semantic/arithmetic7.cl +++ b/tests/semantic/arithmetic7.cl @@ -1,12 +1,12 @@ - --The static types of the two sub-expressions must be Int. - -class A { }; -class B inherits A { }; -class C inherits B { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - test: Bool <- let x: Bool <- 1 / 2 - 3 + 4 < new A.type_name().concat(new B.type_name().concat(new C.type_name())).length() - in 1 < new A.type_name().concat(new B.type_name().concat(new C.type_name())); -}; - + --The static types of the two sub-expressions must be Int. + +class A { }; +class B inherits A { }; +class C inherits B { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + test: Bool <- let x: Bool <- 1 / 2 - 3 + 4 < new A.type_name().concat(new B.type_name().concat(new C.type_name())).length() + in 1 < new A.type_name().concat(new B.type_name().concat(new C.type_name())); +}; + diff --git a/tests/semantic/arithmetic7_error.txt b/tests/semantic/arithmetic7_error.txt index 6f3537117..166bcc8ef 100644 --- a/tests/semantic/arithmetic7_error.txt +++ b/tests/semantic/arithmetic7_error.txt @@ -1 +1 @@ -(10, 22) - TypeError: non-Int arguments: Int < String +(10, 22) - TypeError: non-Int arguments: Int < String diff --git a/tests/semantic/arithmetic8.cl b/tests/semantic/arithmetic8.cl index 3210bdb8a..f3ad37ec4 100644 --- a/tests/semantic/arithmetic8.cl +++ b/tests/semantic/arithmetic8.cl @@ -1,13 +1,13 @@ - --The rules are exactly the same as for the binary arithmetic operations, except that the result is a Bool. - -class A { }; -class B inherits A { }; -class C inherits B { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - test: Int <- let x: Bool <- 1 / 2 - 3 + 4 < new A.type_name().concat(new B.type_name().concat(new C.type_name())).length() - in 1 < new A.type_name().concat(new B.type_name().concat(new C.type_name())).length(); -}; - - + --The rules are exactly the same as for the binary arithmetic operations, except that the result is a Bool. + +class A { }; +class B inherits A { }; +class C inherits B { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + test: Int <- let x: Bool <- 1 / 2 - 3 + 4 < new A.type_name().concat(new B.type_name().concat(new C.type_name())).length() + in 1 < new A.type_name().concat(new B.type_name().concat(new C.type_name())).length(); +}; + + diff --git a/tests/semantic/arithmetic8_error.txt b/tests/semantic/arithmetic8_error.txt index ebcaa3797..5a8814e1a 100644 --- a/tests/semantic/arithmetic8_error.txt +++ b/tests/semantic/arithmetic8_error.txt @@ -1 +1 @@ -(9, 18) - TypeError: Inferred type Bool of initialization of attribute test does not conform to declared type Int. +(9, 18) - TypeError: Inferred type Bool of initialization of attribute test does not conform to declared type Int. diff --git a/tests/semantic/arithmetic9.cl b/tests/semantic/arithmetic9.cl index 95579e134..b7b4d3645 100644 --- a/tests/semantic/arithmetic9.cl +++ b/tests/semantic/arithmetic9.cl @@ -1,15 +1,15 @@ -(* -The expression ~ is the integer -complement of . The expression must have static type Int and the entire expression -has static type Int. -*) - -class A { }; -class B inherits A { }; -class C inherits B { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - test: Int <- let x: Bool <- 1 / 2 - 3 + 4 < new A.type_name().concat(new B.type_name().concat(new C.type_name())).length() - in 1 + ~new A.type_name().concat(new B.type_name().concat(new C.type_name())); +(* +The expression ~ is the integer +complement of . The expression must have static type Int and the entire expression +has static type Int. +*) + +class A { }; +class B inherits A { }; +class C inherits B { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + test: Int <- let x: Bool <- 1 / 2 - 3 + 4 < new A.type_name().concat(new B.type_name().concat(new C.type_name())).length() + in 1 + ~new A.type_name().concat(new B.type_name().concat(new C.type_name())); }; \ No newline at end of file diff --git a/tests/semantic/assignment1.cl b/tests/semantic/assignment1.cl index 19ab70219..174f93e2b 100644 --- a/tests/semantic/assignment1.cl +++ b/tests/semantic/assignment1.cl @@ -1,7 +1,7 @@ ---The static type of the expression must conform to the declared type of the identifier - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - test: Int <- "String"; -}; +--The static type of the expression must conform to the declared type of the identifier + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + test: Int <- "String"; +}; diff --git a/tests/semantic/assignment1_error.txt b/tests/semantic/assignment1_error.txt index 6eb883012..9d05707aa 100644 --- a/tests/semantic/assignment1_error.txt +++ b/tests/semantic/assignment1_error.txt @@ -1 +1 @@ -(6, 18) - TypeError: Inferred type String of initialization of attribute test does not conform to declared type Int. +(6, 18) - TypeError: Inferred type String of initialization of attribute test does not conform to declared type Int. diff --git a/tests/semantic/assignment2.cl b/tests/semantic/assignment2.cl index cace221ae..c7f3d7873 100644 --- a/tests/semantic/assignment2.cl +++ b/tests/semantic/assignment2.cl @@ -1,13 +1,13 @@ ---The static type of an assignment is the static type of . - -class A { }; -class B inherits A { }; -class C inherits B { }; -class D inherits B { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - test(a: A): B { a <- new C }; - test2(a: A): D { a <- new C }; -}; +--The static type of an assignment is the static type of . + +class A { }; +class B inherits A { }; +class C inherits B { }; +class D inherits B { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + test(a: A): B { a <- new C }; + test2(a: A): D { a <- new C }; +}; diff --git a/tests/semantic/assignment2_error.txt b/tests/semantic/assignment2_error.txt index ed10b7f38..55f5aa214 100644 --- a/tests/semantic/assignment2_error.txt +++ b/tests/semantic/assignment2_error.txt @@ -1 +1 @@ -(12, 22) - TypeError: Inferred return type C of method test2 does not conform to declared return type D. +(12, 22) - TypeError: Inferred return type C of method test2 does not conform to declared return type D. diff --git a/tests/semantic/assignment3.cl b/tests/semantic/assignment3.cl index eba0d69e2..9d60a4b6c 100644 --- a/tests/semantic/assignment3.cl +++ b/tests/semantic/assignment3.cl @@ -1,14 +1,14 @@ ---The static type of an assignment is the static type of . - -class A { }; -class B inherits A { }; -class C inherits B { }; -class D inherits B { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - a: A; - b: B <- a <- new C; - d: D <- a <- new C; -}; +--The static type of an assignment is the static type of . + +class A { }; +class B inherits A { }; +class C inherits B { }; +class D inherits B { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + a: A; + b: B <- a <- new C; + d: D <- a <- new C; +}; diff --git a/tests/semantic/attributes1.cl b/tests/semantic/attributes1.cl index 3fa0440e4..d11ea7cdb 100644 --- a/tests/semantic/attributes1.cl +++ b/tests/semantic/attributes1.cl @@ -1,13 +1,13 @@ ---The static type of the expression must conform to the declared type of the attribute. - -class A { }; -class B inherits A { }; -class C inherits B { }; -class D inherits B { }; - -class Main inherits IO { - test1: IO <- new Main; - test2: B <- new A; - - main(): IO { out_string("Hello World!")}; +--The static type of the expression must conform to the declared type of the attribute. + +class A { }; +class B inherits A { }; +class C inherits B { }; +class D inherits B { }; + +class Main inherits IO { + test1: IO <- new Main; + test2: B <- new A; + + main(): IO { out_string("Hello World!")}; }; \ No newline at end of file diff --git a/tests/semantic/attributes1_error.txt b/tests/semantic/attributes1_error.txt index 9cb8460c9..22e45b837 100644 --- a/tests/semantic/attributes1_error.txt +++ b/tests/semantic/attributes1_error.txt @@ -1 +1 @@ -(10, 17) - TypeError: Inferred type A of initialization of attribute test2 does not conform to declared type B. +(10, 17) - TypeError: Inferred type A of initialization of attribute test2 does not conform to declared type B. diff --git a/tests/semantic/attributes2.cl b/tests/semantic/attributes2.cl index 7937c2cc8..85c791b5e 100644 --- a/tests/semantic/attributes2.cl +++ b/tests/semantic/attributes2.cl @@ -1,13 +1,13 @@ ---The static type of the expression must conform to the declared type of the attribute. - -class A { }; -class B inherits A { }; -class C inherits B { }; -class D inherits B { }; - -class Main inherits IO { - test1: IO <- new Main; - test2: C <- new D; - - main(): IO { out_string("Hello World!")}; +--The static type of the expression must conform to the declared type of the attribute. + +class A { }; +class B inherits A { }; +class C inherits B { }; +class D inherits B { }; + +class Main inherits IO { + test1: IO <- new Main; + test2: C <- new D; + + main(): IO { out_string("Hello World!")}; }; \ No newline at end of file diff --git a/tests/semantic/attributes2_error.txt b/tests/semantic/attributes2_error.txt index 6d601b7cd..d7694b0ad 100644 --- a/tests/semantic/attributes2_error.txt +++ b/tests/semantic/attributes2_error.txt @@ -1 +1 @@ -(10, 17) - TypeError: Inferred type D of initialization of attribute test2 does not conform to declared type C. +(10, 17) - TypeError: Inferred type D of initialization of attribute test2 does not conform to declared type C. diff --git a/tests/semantic/attributes3.cl b/tests/semantic/attributes3.cl index 8a67decd1..0c8294fa2 100644 --- a/tests/semantic/attributes3.cl +++ b/tests/semantic/attributes3.cl @@ -1,25 +1,25 @@ ---Attributes are local to the class in which they are defined or inherited. - -class A { - a: Int <- 5; - test(x1: Int, y1: Int): Int { - let x: Int <- x1, y: Int <-y1 in { - x <- x + a; - y <- y + a; - if b then x + y else x - y fi; - } - }; -}; -class B inherits A { - b: Bool <- true; -}; -class C inherits B { - c: String <- "C"; -}; -class D inherits B { - d: IO <- new Main.main(); -}; - -class Main inherits IO { - main(): IO { out_string("Hello World!") }; +--Attributes are local to the class in which they are defined or inherited. + +class A { + a: Int <- 5; + test(x1: Int, y1: Int): Int { + let x: Int <- x1, y: Int <-y1 in { + x <- x + a; + y <- y + a; + if b then x + y else x - y fi; + } + }; +}; +class B inherits A { + b: Bool <- true; +}; +class C inherits B { + c: String <- "C"; +}; +class D inherits B { + d: IO <- new Main.main(); +}; + +class Main inherits IO { + main(): IO { out_string("Hello World!") }; }; \ No newline at end of file diff --git a/tests/semantic/attributes3_error.txt b/tests/semantic/attributes3_error.txt index 6195c816c..68a2ba571 100644 --- a/tests/semantic/attributes3_error.txt +++ b/tests/semantic/attributes3_error.txt @@ -1 +1 @@ -(9, 16) - NameError: Undeclared identifier b. +(9, 16) - NameError: Undeclared identifier b. diff --git a/tests/semantic/attributes4.cl b/tests/semantic/attributes4.cl index a7f63adbd..307b185fd 100644 --- a/tests/semantic/attributes4.cl +++ b/tests/semantic/attributes4.cl @@ -1,39 +1,39 @@ ---Attributes are local to the class in which they are defined or inherited. - -class A { - a: Int <- 5; -}; -class B inherits A { - b: Bool <- true; - test(x1: Int, y1: Int): Int { - let x: Int <- x1, y: Int <-y1 in { - x <- x + a; - y <- y + a; - if b then x + y else x - y fi; - } - }; -}; -class D inherits B { - d: IO <- new Main.main(); - test3(x1: Int, y1: Int): IO { - let x: Int <- x1, y: Int <-y1, c: String <- "C" in { - x <- x + a; - y <- y + a; - if b then new IO.out_string(c) else d fi; - } - }; -}; -class C inherits B { - c: String <- "C"; - test2(x1: Int, y1: Int): IO { - let x: Int <- x1, y: Int <-y1 in { - x <- x + a; - y <- y + a; - if b then new IO.out_string(c) else d fi; - } - }; -}; - -class Main inherits IO { - main(): IO { out_string("Hello World!") }; +--Attributes are local to the class in which they are defined or inherited. + +class A { + a: Int <- 5; +}; +class B inherits A { + b: Bool <- true; + test(x1: Int, y1: Int): Int { + let x: Int <- x1, y: Int <-y1 in { + x <- x + a; + y <- y + a; + if b then x + y else x - y fi; + } + }; +}; +class D inherits B { + d: IO <- new Main.main(); + test3(x1: Int, y1: Int): IO { + let x: Int <- x1, y: Int <-y1, c: String <- "C" in { + x <- x + a; + y <- y + a; + if b then new IO.out_string(c) else d fi; + } + }; +}; +class C inherits B { + c: String <- "C"; + test2(x1: Int, y1: Int): IO { + let x: Int <- x1, y: Int <-y1 in { + x <- x + a; + y <- y + a; + if b then new IO.out_string(c) else d fi; + } + }; +}; + +class Main inherits IO { + main(): IO { out_string("Hello World!") }; }; \ No newline at end of file diff --git a/tests/semantic/basics1.cl b/tests/semantic/basics1.cl index 32ae16564..af84ca0c9 100644 --- a/tests/semantic/basics1.cl +++ b/tests/semantic/basics1.cl @@ -1,10 +1,10 @@ --- It is an error to redefine the IO class. - -class IO { - scan(): String { ":)" }; - print(s: String): IO { new IO }; -}; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; +-- It is an error to redefine the IO class. + +class IO { + scan(): String { ":)" }; + print(s: String): IO { new IO }; +}; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; }; \ No newline at end of file diff --git a/tests/semantic/basics1_error.txt b/tests/semantic/basics1_error.txt index 676f5049c..0db23a051 100644 --- a/tests/semantic/basics1_error.txt +++ b/tests/semantic/basics1_error.txt @@ -1 +1 @@ -(3, 7) - SemanticError: Redefinition of basic class IO. +(3, 7) - SemanticError: Redefinition of basic class IO. diff --git a/tests/semantic/basics2.cl b/tests/semantic/basics2.cl index cf2b1cd2f..61399a989 100644 --- a/tests/semantic/basics2.cl +++ b/tests/semantic/basics2.cl @@ -1,9 +1,9 @@ --- It is an error to inherit from or redefine Int. - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; -}; - -class A inherits Int { - is_prime(): Bool { false }; -}; +-- It is an error to inherit from or redefine Int. + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; +}; + +class A inherits Int { + is_prime(): Bool { false }; +}; diff --git a/tests/semantic/basics2_error.txt b/tests/semantic/basics2_error.txt index 69a3b6814..e2810833a 100644 --- a/tests/semantic/basics2_error.txt +++ b/tests/semantic/basics2_error.txt @@ -1 +1 @@ -(7, 18) - SemanticError: Class A cannot inherit class Int. +(7, 18) - SemanticError: Class A cannot inherit class Int. diff --git a/tests/semantic/basics3.cl b/tests/semantic/basics3.cl index fef017a8d..8c28b31e1 100644 --- a/tests/semantic/basics3.cl +++ b/tests/semantic/basics3.cl @@ -1,9 +1,9 @@ --- It is an error to inherit from or redefine Int. - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; -}; - -class Int { - is_prime(): Bool { false }; +-- It is an error to inherit from or redefine Int. + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; +}; + +class Int { + is_prime(): Bool { false }; }; \ No newline at end of file diff --git a/tests/semantic/basics3_error.txt b/tests/semantic/basics3_error.txt index d8f80cb12..ed382c8eb 100644 --- a/tests/semantic/basics3_error.txt +++ b/tests/semantic/basics3_error.txt @@ -1 +1 @@ -(7, 7) - SemanticError: Redefinition of basic class Int. +(7, 7) - SemanticError: Redefinition of basic class Int. diff --git a/tests/semantic/basics4.cl b/tests/semantic/basics4.cl index 9266ec79b..4475bc08f 100644 --- a/tests/semantic/basics4.cl +++ b/tests/semantic/basics4.cl @@ -1,9 +1,9 @@ --- It is an error to inherit from or redefine String. - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; -}; - -class A inherits String { - is_palindrome(): Bool { false }; +-- It is an error to inherit from or redefine String. + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; +}; + +class A inherits String { + is_palindrome(): Bool { false }; }; \ No newline at end of file diff --git a/tests/semantic/basics4_error.txt b/tests/semantic/basics4_error.txt index d5cd4c3db..bfe08a9a6 100644 --- a/tests/semantic/basics4_error.txt +++ b/tests/semantic/basics4_error.txt @@ -1 +1 @@ -(7, 18) - SemanticError: Class A cannot inherit class String. +(7, 18) - SemanticError: Class A cannot inherit class String. diff --git a/tests/semantic/basics5.cl b/tests/semantic/basics5.cl index bad5eff13..f0d4dafb3 100644 --- a/tests/semantic/basics5.cl +++ b/tests/semantic/basics5.cl @@ -1,9 +1,9 @@ --- It is an error to inherit from or redefine String. - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; -}; - -class String { - is_palindrome(): Bool { false }; +-- It is an error to inherit from or redefine String. + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; +}; + +class String { + is_palindrome(): Bool { false }; }; \ No newline at end of file diff --git a/tests/semantic/basics5_error.txt b/tests/semantic/basics5_error.txt index 8437accf7..47b247faa 100644 --- a/tests/semantic/basics5_error.txt +++ b/tests/semantic/basics5_error.txt @@ -1 +1 @@ -(7, 7) - SemanticError: Redefinition of basic class String. +(7, 7) - SemanticError: Redefinition of basic class String. diff --git a/tests/semantic/basics6.cl b/tests/semantic/basics6.cl index 47266ebed..c16572a31 100644 --- a/tests/semantic/basics6.cl +++ b/tests/semantic/basics6.cl @@ -1,9 +1,9 @@ --- It is an error to inherit from or redefine Bool. - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; -}; - -class A inherits Bool { - xor(b: Bool): Bool { false }; +-- It is an error to inherit from or redefine Bool. + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; +}; + +class A inherits Bool { + xor(b: Bool): Bool { false }; }; \ No newline at end of file diff --git a/tests/semantic/basics6_error.txt b/tests/semantic/basics6_error.txt index b4d22da13..9adf1d488 100644 --- a/tests/semantic/basics6_error.txt +++ b/tests/semantic/basics6_error.txt @@ -1 +1 @@ -(7, 18) - SemanticError: Class A cannot inherit class Bool. +(7, 18) - SemanticError: Class A cannot inherit class Bool. diff --git a/tests/semantic/basics7.cl b/tests/semantic/basics7.cl index 0f30aaec3..38f789245 100644 --- a/tests/semantic/basics7.cl +++ b/tests/semantic/basics7.cl @@ -1,9 +1,9 @@ --- It is an error to inherit from or redefine Bool. - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; -}; - -class Bool { - xor(b: Bool): Bool { false }; +-- It is an error to inherit from or redefine Bool. + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; +}; + +class Bool { + xor(b: Bool): Bool { false }; }; \ No newline at end of file diff --git a/tests/semantic/basics7_error.txt b/tests/semantic/basics7_error.txt index 92660ab9f..9f1347200 100644 --- a/tests/semantic/basics7_error.txt +++ b/tests/semantic/basics7_error.txt @@ -1 +1 @@ -(7, 7) - SemanticError: Redefinition of basic class Bool. +(7, 7) - SemanticError: Redefinition of basic class Bool. diff --git a/tests/semantic/basics8.cl b/tests/semantic/basics8.cl index 3b9697d4f..d45cd941d 100644 --- a/tests/semantic/basics8.cl +++ b/tests/semantic/basics8.cl @@ -1,9 +1,9 @@ --- It is an error redefine Object. - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; -}; - -class Object { - xor(b: Bool): Bool { false }; +-- It is an error redefine Object. + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; +}; + +class Object { + xor(b: Bool): Bool { false }; }; \ No newline at end of file diff --git a/tests/semantic/basics8_error.txt b/tests/semantic/basics8_error.txt index 652f47b30..45767c9c5 100644 --- a/tests/semantic/basics8_error.txt +++ b/tests/semantic/basics8_error.txt @@ -1 +1 @@ -(7, 7) - SemanticError: Redefinition of basic class Object. +(7, 7) - SemanticError: Redefinition of basic class Object. diff --git a/tests/semantic/blocks1.cl b/tests/semantic/blocks1.cl index 1e928908b..bad9093d7 100644 --- a/tests/semantic/blocks1.cl +++ b/tests/semantic/blocks1.cl @@ -1,31 +1,31 @@ ---The static type of a block is the static type of the last expression. - -class A { }; -class B inherits A { }; -class C inherits B { }; -class D inherits B { }; -class E inherits B { }; -class F inherits A { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - test: B <- { - new A; - { - new B; - { - new C; - { - new D; - { - new E; - { - new F; - }; - }; - }; - }; - }; - }; +--The static type of a block is the static type of the last expression. + +class A { }; +class B inherits A { }; +class C inherits B { }; +class D inherits B { }; +class E inherits B { }; +class F inherits A { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + test: B <- { + new A; + { + new B; + { + new C; + { + new D; + { + new E; + { + new F; + }; + }; + }; + }; + }; + }; }; \ No newline at end of file diff --git a/tests/semantic/blocks1_error.txt b/tests/semantic/blocks1_error.txt index 2f0e2caf3..6bd9d6118 100644 --- a/tests/semantic/blocks1_error.txt +++ b/tests/semantic/blocks1_error.txt @@ -1 +1 @@ -(13, 16) - TypeError: Inferred type F of initialization of attribute test does not conform to declared type B. +(13, 16) - TypeError: Inferred type F of initialization of attribute test does not conform to declared type B. diff --git a/tests/semantic/case1.cl b/tests/semantic/case1.cl index 82c6a4d61..af452f11c 100644 --- a/tests/semantic/case1.cl +++ b/tests/semantic/case1.cl @@ -1,23 +1,23 @@ ---For each branch, let Ti be the static type of . The static type of a case expression is Join 1≤i≤n Ti. - -class A { }; -class B inherits A { }; -class C inherits B { }; -class D inherits B { }; -class E inherits B { }; -class F inherits A { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - b: B <- case "true" of - i: Int => New C; - b: Bool => New D; - s: String => New E; - esac; - - test: B <- case 0 of - b: Bool => new F; - i: Int => new E; - esac; -}; +--For each branch, let Ti be the static type of . The static type of a case expression is Join 1≤i≤n Ti. + +class A { }; +class B inherits A { }; +class C inherits B { }; +class D inherits B { }; +class E inherits B { }; +class F inherits A { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + b: B <- case "true" of + i: Int => New C; + b: Bool => New D; + s: String => New E; + esac; + + test: B <- case 0 of + b: Bool => new F; + i: Int => new E; + esac; +}; diff --git a/tests/semantic/case1_error.txt b/tests/semantic/case1_error.txt index f05ce31b9..70c7d16ca 100644 --- a/tests/semantic/case1_error.txt +++ b/tests/semantic/case1_error.txt @@ -1 +1 @@ -(19, 16) - TypeError: Inferred type A of initialization of attribute test does not conform to declared type B. +(19, 16) - TypeError: Inferred type A of initialization of attribute test does not conform to declared type B. diff --git a/tests/semantic/case2.cl b/tests/semantic/case2.cl index ae97b41da..dbbe4148c 100644 --- a/tests/semantic/case2.cl +++ b/tests/semantic/case2.cl @@ -1,23 +1,23 @@ --- The variables declared on each branch of a case must all have distinct types. - -class A { }; -class B inherits A { }; -class C inherits B { }; -class D inherits B { }; -class E inherits B { }; -class F inherits A { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - b: B <- case "true" of - i: Int => New C; - b: Bool => New D; - s: String => New E; - esac; - - test: A <- case 0 of - b: Bool => new F; - i: Bool => new E; - esac; +-- The variables declared on each branch of a case must all have distinct types. + +class A { }; +class B inherits A { }; +class C inherits B { }; +class D inherits B { }; +class E inherits B { }; +class F inherits A { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + b: B <- case "true" of + i: Int => New C; + b: Bool => New D; + s: String => New E; + esac; + + test: A <- case 0 of + b: Bool => new F; + i: Bool => new E; + esac; }; \ No newline at end of file diff --git a/tests/semantic/case3.cl b/tests/semantic/case3.cl index da79bbfe6..9ff06336a 100644 --- a/tests/semantic/case3.cl +++ b/tests/semantic/case3.cl @@ -1,23 +1,23 @@ --- Missing type - -class A { }; -class B inherits A { }; -class C inherits B { }; -class D inherits B { }; -class E inherits B { }; -class F inherits A { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - b: B <- case "true" of - i: Int => New C; - b: Bool => New D; - s: String => New E; - esac; - - test: A <- case 0 of - b: Bool => new F; - i: Ball => new E; - esac; +-- Missing type + +class A { }; +class B inherits A { }; +class C inherits B { }; +class D inherits B { }; +class E inherits B { }; +class F inherits A { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + b: B <- case "true" of + i: Int => New C; + b: Bool => New D; + s: String => New E; + esac; + + test: A <- case 0 of + b: Bool => new F; + i: Ball => new E; + esac; }; \ No newline at end of file diff --git a/tests/semantic/class1.cl b/tests/semantic/class1.cl index ed83da9d1..576a3d0eb 100644 --- a/tests/semantic/class1.cl +++ b/tests/semantic/class1.cl @@ -1,9 +1,9 @@ --- Classes may not be redefined. - -class Repeat { - sum(a: Int, b: Int): Int { a + b }; -}; - -class Repeat { - mult(a: Int, b: Int): Int { a * b }; +-- Classes may not be redefined. + +class Repeat { + sum(a: Int, b: Int): Int { a + b }; +}; + +class Repeat { + mult(a: Int, b: Int): Int { a * b }; }; \ No newline at end of file diff --git a/tests/semantic/class1_error.txt b/tests/semantic/class1_error.txt index 19c507672..6337828d0 100644 --- a/tests/semantic/class1_error.txt +++ b/tests/semantic/class1_error.txt @@ -1,2 +1,2 @@ -(7, 5) - SemanticError: Classes may not be redefined - +(7, 5) - SemanticError: Classes may not be redefined + diff --git a/tests/semantic/conditionals1.cl b/tests/semantic/conditionals1.cl index 3446a8b0f..46af8cc73 100644 --- a/tests/semantic/conditionals1.cl +++ b/tests/semantic/conditionals1.cl @@ -1,14 +1,14 @@ ---The predicate must have static type Bool. - -class A { }; -class B inherits A { }; -class C inherits B { }; -class D inherits B { }; -class E inherits B { }; -class F inherits A { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - a: A <- if new F then new D else new C fi; +--The predicate must have static type Bool. + +class A { }; +class B inherits A { }; +class C inherits B { }; +class D inherits B { }; +class E inherits B { }; +class F inherits A { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + a: A <- if new F then new D else new C fi; }; \ No newline at end of file diff --git a/tests/semantic/conditionals1_error.txt b/tests/semantic/conditionals1_error.txt index b86345359..52db300b9 100644 --- a/tests/semantic/conditionals1_error.txt +++ b/tests/semantic/conditionals1_error.txt @@ -1 +1 @@ -(13, 16) - TypeError: Predicate of 'if' does not have type Bool. +(13, 16) - TypeError: Predicate of 'if' does not have type Bool. diff --git a/tests/semantic/conditionals2.cl b/tests/semantic/conditionals2.cl index 9d6313d75..8814177fc 100644 --- a/tests/semantic/conditionals2.cl +++ b/tests/semantic/conditionals2.cl @@ -1,24 +1,24 @@ -(* -Let T and F be the static types of the branches of the conditional. Then the static type of the -conditional is T t F. (think: Walk towards Object from each of T and F until the paths meet.) -*) - -class A { }; -class B inherits A { }; -class C inherits B { }; -class D inherits B { }; -class E inherits B { }; -class F inherits A { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - b: B <- if true then - new C - else - if false then new D - else new E fi - fi; - - test: B <- if not true then new F else new E fi; -}; +(* +Let T and F be the static types of the branches of the conditional. Then the static type of the +conditional is T t F. (think: Walk towards Object from each of T and F until the paths meet.) +*) + +class A { }; +class B inherits A { }; +class C inherits B { }; +class D inherits B { }; +class E inherits B { }; +class F inherits A { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + b: B <- if true then + new C + else + if false then new D + else new E fi + fi; + + test: B <- if not true then new F else new E fi; +}; diff --git a/tests/semantic/conditionals2_error.txt b/tests/semantic/conditionals2_error.txt index d6f5fc307..8f54d195e 100644 --- a/tests/semantic/conditionals2_error.txt +++ b/tests/semantic/conditionals2_error.txt @@ -1,2 +1,2 @@ -(23, 16) - TypeError: Inferred type A of initialization of attribute test does not conform to declared type B. - +(23, 16) - TypeError: Inferred type A of initialization of attribute test does not conform to declared type B. + diff --git a/tests/semantic/dispatch1.cl b/tests/semantic/dispatch1.cl index 1c0457fa3..bfd90f075 100644 --- a/tests/semantic/dispatch1.cl +++ b/tests/semantic/dispatch1.cl @@ -1,33 +1,33 @@ -(* -e0 .f(e1, . . . , en ) -Assume e0 has static type A. -Class A must have a method f -*) - -class A inherits IO { - f(x: Int, y: Int): Int { x + y }; - g(x: Int): Int { x + x }; -}; -class B inherits A { - f(a: Int, b: Int): Int { a - b }; -}; -class C inherits B { - ident(m: Int): Int { m }; - f(m: Int, n: Int): Int { m * n }; -}; -class D inherits B { - ident(v: String): IO { new IO.out_string(v) }; - f(v: Int, w: Int): Int { v / w }; - g(v: Int): Int { v + v + v }; - - back(s: String): B { { - out_string(s); - self; - } }; -}; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - test: B <- new D.back("Hello ").back("World!"); +(* +e0 .f(e1, . . . , en ) +Assume e0 has static type A. +Class A must have a method f +*) + +class A inherits IO { + f(x: Int, y: Int): Int { x + y }; + g(x: Int): Int { x + x }; +}; +class B inherits A { + f(a: Int, b: Int): Int { a - b }; +}; +class C inherits B { + ident(m: Int): Int { m }; + f(m: Int, n: Int): Int { m * n }; +}; +class D inherits B { + ident(v: String): IO { new IO.out_string(v) }; + f(v: Int, w: Int): Int { v / w }; + g(v: Int): Int { v + v + v }; + + back(s: String): B { { + out_string(s); + self; + } }; +}; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + test: B <- new D.back("Hello ").back("World!"); }; \ No newline at end of file diff --git a/tests/semantic/dispatch1_error.txt b/tests/semantic/dispatch1_error.txt index 7fb22edce..89fa22b77 100644 --- a/tests/semantic/dispatch1_error.txt +++ b/tests/semantic/dispatch1_error.txt @@ -1 +1 @@ -(32, 37) - AttributeError: Dispatch to undefined method back. +(32, 37) - AttributeError: Dispatch to undefined method back. diff --git a/tests/semantic/dispatch2.cl b/tests/semantic/dispatch2.cl index 5182912b8..ebca718ac 100644 --- a/tests/semantic/dispatch2.cl +++ b/tests/semantic/dispatch2.cl @@ -1,34 +1,34 @@ -(* -e0 .f(e1, . . . , en ) -Assume e0 has static type A. -Class A must have a method f -the dispatch and the definition of f must have the same number of arguments -*) - -class A inherits IO { - f(x: Int, y: Int): Int { x + y }; - g(x: Int): Int { x + x }; -}; -class B inherits A { - f(a: Int, b: Int): Int { a - b }; -}; -class C inherits B { - ident(m: Int): Int { m }; - f(m: Int, n: Int): Int { m * n }; -}; -class D inherits B { - ident(v: String): IO { new IO.out_string(v) }; - f(v: Int, w: Int): Int { v / w }; - g(v: Int): Int { v + v + v }; - - back(s: String): B { { - out_string(s); - self; - } }; -}; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - test: Int <- new D.back("Hello ").g(2, 2); +(* +e0 .f(e1, . . . , en ) +Assume e0 has static type A. +Class A must have a method f +the dispatch and the definition of f must have the same number of arguments +*) + +class A inherits IO { + f(x: Int, y: Int): Int { x + y }; + g(x: Int): Int { x + x }; +}; +class B inherits A { + f(a: Int, b: Int): Int { a - b }; +}; +class C inherits B { + ident(m: Int): Int { m }; + f(m: Int, n: Int): Int { m * n }; +}; +class D inherits B { + ident(v: String): IO { new IO.out_string(v) }; + f(v: Int, w: Int): Int { v / w }; + g(v: Int): Int { v + v + v }; + + back(s: String): B { { + out_string(s); + self; + } }; +}; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + test: Int <- new D.back("Hello ").g(2, 2); }; \ No newline at end of file diff --git a/tests/semantic/dispatch2_error.txt b/tests/semantic/dispatch2_error.txt index a86c35340..1530fb82c 100644 --- a/tests/semantic/dispatch2_error.txt +++ b/tests/semantic/dispatch2_error.txt @@ -1 +1 @@ -(33, 39) - SemanticError: Method g called with wrong number of arguments. +(33, 39) - SemanticError: Method g called with wrong number of arguments. diff --git a/tests/semantic/dispatch3.cl b/tests/semantic/dispatch3.cl index ecb1535db..98c19da77 100644 --- a/tests/semantic/dispatch3.cl +++ b/tests/semantic/dispatch3.cl @@ -1,36 +1,36 @@ -(* -e0 .f(e1, . . . , en ) -Assume e0 has static type A. -Class A must have a method f -the static type of the ith actual parameter must conform to the declared type of the ith formal parameter. -*) - -class A inherits IO { - f(x: Int, y: Int): Int { x + y }; - g(x: Int): Int { x + x }; -}; -class B inherits A { - f(a: Int, b: Int): Int { a - b }; -}; -class C inherits B { - ident(m: Int): Int { m }; - f(m: Int, n: Int): Int { m * n }; -}; -class D inherits B { - ident(v: String): IO { new IO.out_string(v) }; - f(v: Int, w: Int): Int { v / w }; - g(v: Int): Int { v + v + v }; - - back(s: String): B { { - out_string(s); - self; - } }; - - alphabet(a: A, b: B, c: C): D { self }; -}; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - test: B <- new D.alphabet(new D, new D, new D.back("Hello ")).back("World!"); +(* +e0 .f(e1, . . . , en ) +Assume e0 has static type A. +Class A must have a method f +the static type of the ith actual parameter must conform to the declared type of the ith formal parameter. +*) + +class A inherits IO { + f(x: Int, y: Int): Int { x + y }; + g(x: Int): Int { x + x }; +}; +class B inherits A { + f(a: Int, b: Int): Int { a - b }; +}; +class C inherits B { + ident(m: Int): Int { m }; + f(m: Int, n: Int): Int { m * n }; +}; +class D inherits B { + ident(v: String): IO { new IO.out_string(v) }; + f(v: Int, w: Int): Int { v / w }; + g(v: Int): Int { v + v + v }; + + back(s: String): B { { + out_string(s); + self; + } }; + + alphabet(a: A, b: B, c: C): D { self }; +}; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + test: B <- new D.alphabet(new D, new D, new D.back("Hello ")).back("World!"); }; \ No newline at end of file diff --git a/tests/semantic/dispatch3_error.txt b/tests/semantic/dispatch3_error.txt index 0def5cf03..77e81db72 100644 --- a/tests/semantic/dispatch3_error.txt +++ b/tests/semantic/dispatch3_error.txt @@ -1 +1 @@ -(35, 45) - TypeError: In call of method alphabet, type B of parameter c does not conform to declared type C. +(35, 45) - TypeError: In call of method alphabet, type B of parameter c does not conform to declared type C. diff --git a/tests/semantic/dispatch4.cl b/tests/semantic/dispatch4.cl index 9cadd8332..604e462a2 100644 --- a/tests/semantic/dispatch4.cl +++ b/tests/semantic/dispatch4.cl @@ -1,36 +1,36 @@ -(* -e0 .f(e1, . . . , en ) -Assume e0 has static type A. -Class A must have a method f -If f has return type B and B is a class name, then the static type of the dispatch is B. -*) - -class A inherits IO { - f(x: Int, y: Int): Int { x + y }; - g(x: Int): Int { x + x }; -}; -class B inherits A { - f(a: Int, b: Int): Int { a - b }; -}; -class C inherits B { - ident(m: Int): Int { m }; - f(m: Int, n: Int): Int { m * n }; -}; -class D inherits B { - ident(v: String): IO { new IO.out_string(v) }; - f(v: Int, w: Int): Int { v / w }; - g(v: Int): Int { v + v + v }; - - back(s: String): B { { - out_string(s); - self; - } }; - - alphabet(a: A, b: B, c: C): D { self }; -}; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - test: D <- new D.alphabet(new D, new D.back("Hello "), new C).back("World!"); +(* +e0 .f(e1, . . . , en ) +Assume e0 has static type A. +Class A must have a method f +If f has return type B and B is a class name, then the static type of the dispatch is B. +*) + +class A inherits IO { + f(x: Int, y: Int): Int { x + y }; + g(x: Int): Int { x + x }; +}; +class B inherits A { + f(a: Int, b: Int): Int { a - b }; +}; +class C inherits B { + ident(m: Int): Int { m }; + f(m: Int, n: Int): Int { m * n }; +}; +class D inherits B { + ident(v: String): IO { new IO.out_string(v) }; + f(v: Int, w: Int): Int { v / w }; + g(v: Int): Int { v + v + v }; + + back(s: String): B { { + out_string(s); + self; + } }; + + alphabet(a: A, b: B, c: C): D { self }; +}; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + test: D <- new D.alphabet(new D, new D.back("Hello "), new C).back("World!"); }; \ No newline at end of file diff --git a/tests/semantic/dispatch5.cl b/tests/semantic/dispatch5.cl index b4437b1b4..9820e5ee1 100644 --- a/tests/semantic/dispatch5.cl +++ b/tests/semantic/dispatch5.cl @@ -1,31 +1,31 @@ -(* -(,...,) is shorthand for self.(,...,). -*) - -class A inherits IO { - f(x: Int, y: Int): Int { x + y }; - g(x: Int): Int { x + x }; -}; -class B inherits A { - f(a: Int, b: Int): Int { a - b }; -}; -class C inherits B { - ident(m: Int): Int { m }; - f(m: Int, n: Int): Int { m * n }; - sum(m: Int, n: Int, p: Int): Int { m + n + p }; -}; -class D inherits B { - ident(v: String): IO { new IO.out_string(v) }; - f(v: Int, w: Int): Int { v / w }; - - back(s: String): B { { - out_string(s); - g(2); - sum(1, 2, 3); - self; - } }; -}; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; +(* +(,...,) is shorthand for self.(,...,). +*) + +class A inherits IO { + f(x: Int, y: Int): Int { x + y }; + g(x: Int): Int { x + x }; +}; +class B inherits A { + f(a: Int, b: Int): Int { a - b }; +}; +class C inherits B { + ident(m: Int): Int { m }; + f(m: Int, n: Int): Int { m * n }; + sum(m: Int, n: Int, p: Int): Int { m + n + p }; +}; +class D inherits B { + ident(v: String): IO { new IO.out_string(v) }; + f(v: Int, w: Int): Int { v / w }; + + back(s: String): B { { + out_string(s); + g(2); + sum(1, 2, 3); + self; + } }; +}; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; }; \ No newline at end of file diff --git a/tests/semantic/dispatch5_error.txt b/tests/semantic/dispatch5_error.txt index d26bf34a1..6a6922f32 100644 --- a/tests/semantic/dispatch5_error.txt +++ b/tests/semantic/dispatch5_error.txt @@ -1 +1 @@ -(24, 9) - AttributeError: Dispatch to undefined method sum. +(24, 9) - AttributeError: Dispatch to undefined method sum. diff --git a/tests/semantic/dispatch6.cl b/tests/semantic/dispatch6.cl index fcc033f2c..bbe58fbb1 100644 --- a/tests/semantic/dispatch6.cl +++ b/tests/semantic/dispatch6.cl @@ -1,32 +1,32 @@ -(* -e@B.f() invokes the method -f in class B on the object that is the value of e. For this form of dispatch, the static type to the left of -“@”must conform to the type specified to the right of “@”. -*) - -class A { - f(x: Int, y: Int): Int { x + y }; - g(x: Int): Int { x + x }; -}; -class B inherits A { - f(a: Int, b: Int): Int { a - b }; - sum(m: Int, n: Int, p: Int): Int { m + n + p }; -}; -class C inherits B { - ident(m: Int): Int { m }; - f(m: Int, n: Int): Int { m * n }; -}; -class D inherits B { - ident(v: String): IO { new IO.out_string(v) }; - f(v: Int, w: Int): Int { v / w }; - g(v: Int): Int { v + v + v }; - sum(v: Int, w: Int, z: Int): Int { v - w - z }; -}; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - a: A <- new D; - b: Int <- new D@B.sum(1, 2, 3); - test: Int <- a@B.sum(1, 2, 3); -}; +(* +e@B.f() invokes the method +f in class B on the object that is the value of e. For this form of dispatch, the static type to the left of +“@”must conform to the type specified to the right of “@”. +*) + +class A { + f(x: Int, y: Int): Int { x + y }; + g(x: Int): Int { x + x }; +}; +class B inherits A { + f(a: Int, b: Int): Int { a - b }; + sum(m: Int, n: Int, p: Int): Int { m + n + p }; +}; +class C inherits B { + ident(m: Int): Int { m }; + f(m: Int, n: Int): Int { m * n }; +}; +class D inherits B { + ident(v: String): IO { new IO.out_string(v) }; + f(v: Int, w: Int): Int { v / w }; + g(v: Int): Int { v + v + v }; + sum(v: Int, w: Int, z: Int): Int { v - w - z }; +}; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + a: A <- new D; + b: Int <- new D@B.sum(1, 2, 3); + test: Int <- a@B.sum(1, 2, 3); +}; diff --git a/tests/semantic/dispatch6_error.txt b/tests/semantic/dispatch6_error.txt index ae9184b2f..7d5ec3780 100644 --- a/tests/semantic/dispatch6_error.txt +++ b/tests/semantic/dispatch6_error.txt @@ -1 +1 @@ -(31, 18) - TypeError: Expression type A does not conform to declared static dispatch type B. +(31, 18) - TypeError: Expression type A does not conform to declared static dispatch type B. diff --git a/tests/semantic/eq1.cl b/tests/semantic/eq1.cl index 88f2a7ffe..dc8a0cd43 100644 --- a/tests/semantic/eq1.cl +++ b/tests/semantic/eq1.cl @@ -1,17 +1,17 @@ -(* -The comparison = is a special -case. If either or has static type Int, Bool, or String, then the other must have the -same static type. Any other types, including SELF TYPE, may be freely compared. -*) - -class A { }; -class B inherits A { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - x: Bool <- 1 = 2; - test: Bool <- 1 = new A; - y: Bool <- "1" = "2"; - z: Bool <- true = not false; +(* +The comparison = is a special +case. If either or has static type Int, Bool, or String, then the other must have the +same static type. Any other types, including SELF TYPE, may be freely compared. +*) + +class A { }; +class B inherits A { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + x: Bool <- 1 = 2; + test: Bool <- 1 = new A; + y: Bool <- "1" = "2"; + z: Bool <- true = not false; }; \ No newline at end of file diff --git a/tests/semantic/eq1_error.txt b/tests/semantic/eq1_error.txt index f81425683..0b85d2fa0 100644 --- a/tests/semantic/eq1_error.txt +++ b/tests/semantic/eq1_error.txt @@ -1 +1 @@ -(14, 21) - TypeError: Illegal comparison with a basic type. +(14, 21) - TypeError: Illegal comparison with a basic type. diff --git a/tests/semantic/eq2.cl b/tests/semantic/eq2.cl index d76852780..f4b2ffac7 100644 --- a/tests/semantic/eq2.cl +++ b/tests/semantic/eq2.cl @@ -1,17 +1,17 @@ -(* -The comparison = is a special -case. If either or has static type Int, Bool, or String, then the other must have the -same static type. Any other types, including SELF TYPE, may be freely compared. -*) - -class A { }; -class B inherits A { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - x: Bool <- 1 = 2; - y: Bool <- "1" = "2"; - test: Bool <- "1" = new B; - z: Bool <- true = not false; -}; +(* +The comparison = is a special +case. If either or has static type Int, Bool, or String, then the other must have the +same static type. Any other types, including SELF TYPE, may be freely compared. +*) + +class A { }; +class B inherits A { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + x: Bool <- 1 = 2; + y: Bool <- "1" = "2"; + test: Bool <- "1" = new B; + z: Bool <- true = not false; +}; diff --git a/tests/semantic/eq2_error.txt b/tests/semantic/eq2_error.txt index a44ab0d51..1bb29ca32 100644 --- a/tests/semantic/eq2_error.txt +++ b/tests/semantic/eq2_error.txt @@ -1 +1 @@ -(15, 23) - TypeError: Illegal comparison with a basic type. +(15, 23) - TypeError: Illegal comparison with a basic type. diff --git a/tests/semantic/eq3.cl b/tests/semantic/eq3.cl index 4dad693ee..b7ee462c5 100644 --- a/tests/semantic/eq3.cl +++ b/tests/semantic/eq3.cl @@ -1,17 +1,17 @@ -(* -The comparison = is a special -case. If either or has static type Int, Bool, or String, then the other must have the -same static type. Any other types, including SELF TYPE, may be freely compared. -*) - -class A { }; -class B inherits A { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - x: Bool <- 1 = 2; - y: Bool <- "1" = "2"; - z: Bool <- true = not false; - test: Bool <- "true" = not false; -}; +(* +The comparison = is a special +case. If either or has static type Int, Bool, or String, then the other must have the +same static type. Any other types, including SELF TYPE, may be freely compared. +*) + +class A { }; +class B inherits A { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + x: Bool <- 1 = 2; + y: Bool <- "1" = "2"; + z: Bool <- true = not false; + test: Bool <- "true" = not false; +}; diff --git a/tests/semantic/eq3_error.txt b/tests/semantic/eq3_error.txt index c4e27eb8a..d57841b95 100644 --- a/tests/semantic/eq3_error.txt +++ b/tests/semantic/eq3_error.txt @@ -1 +1 @@ -(16, 26) - TypeError: Illegal comparison with a basic type. +(16, 26) - TypeError: Illegal comparison with a basic type. diff --git a/tests/semantic/eq4.cl b/tests/semantic/eq4.cl index 11afc119f..63c1067f0 100644 --- a/tests/semantic/eq4.cl +++ b/tests/semantic/eq4.cl @@ -1,17 +1,17 @@ -(* -The comparison = is a special -case. If either or has static type Int, Bool, or String, then the other must have the -same static type. Any other types, including SELF TYPE, may be freely compared. The result is a Bool. -*) - -class A { }; -class B { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - x: Bool <- 1 = 2; - y: Bool <- "1" = "2"; - z: Bool <- new A = new B; - test: Int <- new A = new B; -}; +(* +The comparison = is a special +case. If either or has static type Int, Bool, or String, then the other must have the +same static type. Any other types, including SELF TYPE, may be freely compared. The result is a Bool. +*) + +class A { }; +class B { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + x: Bool <- 1 = 2; + y: Bool <- "1" = "2"; + z: Bool <- new A = new B; + test: Int <- new A = new B; +}; diff --git a/tests/semantic/eq4_error.txt b/tests/semantic/eq4_error.txt index 3ead21d0e..f075fecbe 100644 --- a/tests/semantic/eq4_error.txt +++ b/tests/semantic/eq4_error.txt @@ -1 +1 @@ -(16, 18) - TypeError: Inferred type Bool of initialization of attribute test does not conform to declared type Int. +(16, 18) - TypeError: Inferred type Bool of initialization of attribute test does not conform to declared type Int. diff --git a/tests/semantic/isvoid1.cl b/tests/semantic/isvoid1.cl index 072720d85..7c3a83a77 100644 --- a/tests/semantic/isvoid1.cl +++ b/tests/semantic/isvoid1.cl @@ -1,26 +1,26 @@ ---evaluates to true if expr is void and evaluates to false if expr is not void. - -class A { }; -class B inherits A { }; -class C inherits B { }; -class D inherits B { }; -class E inherits B { }; -class F inherits A { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - b: B <- if isvoid new F then - new C - else - if false then new D - else new E fi - fi; - - test: B <- isvoid if isvoid new F then - new C - else - if false then new D - else new E fi - fi; +--evaluates to true if expr is void and evaluates to false if expr is not void. + +class A { }; +class B inherits A { }; +class C inherits B { }; +class D inherits B { }; +class E inherits B { }; +class F inherits A { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + b: B <- if isvoid new F then + new C + else + if false then new D + else new E fi + fi; + + test: B <- isvoid if isvoid new F then + new C + else + if false then new D + else new E fi + fi; }; \ No newline at end of file diff --git a/tests/semantic/isvoid1_error.txt b/tests/semantic/isvoid1_error.txt index 0922de909..3fd0157b4 100644 --- a/tests/semantic/isvoid1_error.txt +++ b/tests/semantic/isvoid1_error.txt @@ -1 +1 @@ -(20, 16) - TypeError: Inferred type Bool of initialization of attribute test does not conform to declared type B. +(20, 16) - TypeError: Inferred type Bool of initialization of attribute test does not conform to declared type B. diff --git a/tests/semantic/let1.cl b/tests/semantic/let1.cl index 26ef63026..9220d3dbc 100644 --- a/tests/semantic/let1.cl +++ b/tests/semantic/let1.cl @@ -1,15 +1,15 @@ ---The type of an initialization expression must conform to the declared type of the identifier. - -class A { }; -class B inherits A { }; -class C inherits B { }; -class D inherits B { }; -class E inherits B { }; -class F inherits A { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - b: B <- let a: Bool, a: Int <- 5, a: String, a: A <- new F, b: B <- new E in b; - test: B <- let a: Bool, a: Int <- 5, a: String, a: A <- new F, b: C <- new E in b; +--The type of an initialization expression must conform to the declared type of the identifier. + +class A { }; +class B inherits A { }; +class C inherits B { }; +class D inherits B { }; +class E inherits B { }; +class F inherits A { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + b: B <- let a: Bool, a: Int <- 5, a: String, a: A <- new F, b: B <- new E in b; + test: B <- let a: Bool, a: Int <- 5, a: String, a: A <- new F, b: C <- new E in b; }; \ No newline at end of file diff --git a/tests/semantic/let1_error.txt b/tests/semantic/let1_error.txt index 16ecf780c..56547dae5 100644 --- a/tests/semantic/let1_error.txt +++ b/tests/semantic/let1_error.txt @@ -1 +1 @@ -(14, 76) - TypeError: Inferred type E of initialization of b does not conform to identifier's declared type C. +(14, 76) - TypeError: Inferred type E of initialization of b does not conform to identifier's declared type C. diff --git a/tests/semantic/let2.cl b/tests/semantic/let2.cl index c5956ead3..2949fb94d 100644 --- a/tests/semantic/let2.cl +++ b/tests/semantic/let2.cl @@ -1,15 +1,15 @@ ---The type of let is the type of the body. - -class A { }; -class B inherits A { }; -class C inherits B { }; -class D inherits B { }; -class E inherits B { }; -class F inherits A { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - b: B <- let a: Bool, a: Int <- 5, a: String, a: A <- new F, b: B <- new E in b; - test: B <- let a: Bool, a: Int <- 5, a: String, a: A <- new F, b: A <- new E in b; +--The type of let is the type of the body. + +class A { }; +class B inherits A { }; +class C inherits B { }; +class D inherits B { }; +class E inherits B { }; +class F inherits A { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + b: B <- let a: Bool, a: Int <- 5, a: String, a: A <- new F, b: B <- new E in b; + test: B <- let a: Bool, a: Int <- 5, a: String, a: A <- new F, b: A <- new E in b; }; \ No newline at end of file diff --git a/tests/semantic/let2_error.txt b/tests/semantic/let2_error.txt index b1e8a365d..3b7c669a3 100644 --- a/tests/semantic/let2_error.txt +++ b/tests/semantic/let2_error.txt @@ -1 +1 @@ -(14, 16) - TypeError: Inferred type A of initialization of attribute test does not conform to declared type B. +(14, 16) - TypeError: Inferred type A of initialization of attribute test does not conform to declared type B. diff --git a/tests/semantic/let3.cl b/tests/semantic/let3.cl index 8c0670ab8..0a4a9ceaf 100644 --- a/tests/semantic/let3.cl +++ b/tests/semantic/let3.cl @@ -1,15 +1,15 @@ --- Missing type - -class A { }; -class B inherits A { }; -class C inherits B { }; -class D inherits B { }; -class E inherits B { }; -class F inherits A { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - b: B <- let a: Bool, a: Int <- 5, a: String, a: A <- new F, b: B <- new E in b; - test: B <- let a: Bool, a: Int <- 5, a: String, a: A <- new F, b: Cadena in new B; +-- Missing type + +class A { }; +class B inherits A { }; +class C inherits B { }; +class D inherits B { }; +class E inherits B { }; +class F inherits A { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + b: B <- let a: Bool, a: Int <- 5, a: String, a: A <- new F, b: B <- new E in b; + test: B <- let a: Bool, a: Int <- 5, a: String, a: A <- new F, b: Cadena in new B; }; \ No newline at end of file diff --git a/tests/semantic/loops1.cl b/tests/semantic/loops1.cl index de3a624d2..6a0a81818 100644 --- a/tests/semantic/loops1.cl +++ b/tests/semantic/loops1.cl @@ -1,8 +1,8 @@ ---The predicate must have static type Bool. - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - i: Int <- 1; - test: Object <- while "true" loop i <- i + 1 pool; +--The predicate must have static type Bool. + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + i: Int <- 1; + test: Object <- while "true" loop i <- i + 1 pool; }; \ No newline at end of file diff --git a/tests/semantic/loops2.cl b/tests/semantic/loops2.cl index dea69fa14..d52169da7 100644 --- a/tests/semantic/loops2.cl +++ b/tests/semantic/loops2.cl @@ -1,9 +1,9 @@ ---The static type of a loop expression is Object. - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - i: Int <- 1; - test: Object <- while not false loop i <- i + 1 pool; - test2: Int <- while not false loop i <- i + 1 pool; -}; +--The static type of a loop expression is Object. + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + i: Int <- 1; + test: Object <- while not false loop i <- i + 1 pool; + test2: Int <- while not false loop i <- i + 1 pool; +}; diff --git a/tests/semantic/loops2_error.txt b/tests/semantic/loops2_error.txt index 9711cdf6a..ab79de8da 100644 --- a/tests/semantic/loops2_error.txt +++ b/tests/semantic/loops2_error.txt @@ -1 +1 @@ -(8, 19) - TypeError: Inferred type Object of initialization of attribute test2 does not conform to declared type Int. +(8, 19) - TypeError: Inferred type Object of initialization of attribute test2 does not conform to declared type Int. diff --git a/tests/semantic/methods1.cl b/tests/semantic/methods1.cl index d12031970..f4ff07bb0 100644 --- a/tests/semantic/methods1.cl +++ b/tests/semantic/methods1.cl @@ -1,12 +1,12 @@ ---The identifiers used in the formal parameter list must be distinct - -class A { }; -class B inherits A { }; -class C inherits B { }; -class D inherits B { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - test(a: A, a: B): Int { 4 }; +--The identifiers used in the formal parameter list must be distinct + +class A { }; +class B inherits A { }; +class C inherits B { }; +class D inherits B { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + test(a: A, a: B): Int { 4 }; }; \ No newline at end of file diff --git a/tests/semantic/methods1_error.txt b/tests/semantic/methods1_error.txt index 06ab88a92..809036803 100644 --- a/tests/semantic/methods1_error.txt +++ b/tests/semantic/methods1_error.txt @@ -1 +1 @@ -(11, 16) - SemanticError: Formal parameter a is multiply defined. +(11, 16) - SemanticError: Formal parameter a is multiply defined. diff --git a/tests/semantic/methods2.cl b/tests/semantic/methods2.cl index 3865f0e13..c010df01e 100644 --- a/tests/semantic/methods2.cl +++ b/tests/semantic/methods2.cl @@ -1,12 +1,12 @@ ---The type of the method body must conform to the declared return type. - -class A { }; -class B inherits A { }; -class C inherits B { }; -class D inherits B { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - test(a: A, b: B): C { new D }; +--The type of the method body must conform to the declared return type. + +class A { }; +class B inherits A { }; +class C inherits B { }; +class D inherits B { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + test(a: A, b: B): C { new D }; }; \ No newline at end of file diff --git a/tests/semantic/methods2_error.txt b/tests/semantic/methods2_error.txt index f7e4a330d..1a4baea17 100644 --- a/tests/semantic/methods2_error.txt +++ b/tests/semantic/methods2_error.txt @@ -1 +1 @@ -(11, 27) - TypeError: Inferred return type D of method test does not conform to declared return type C. +(11, 27) - TypeError: Inferred return type D of method test does not conform to declared return type C. diff --git a/tests/semantic/methods3.cl b/tests/semantic/methods3.cl index b92faeb97..9aff4d167 100644 --- a/tests/semantic/methods3.cl +++ b/tests/semantic/methods3.cl @@ -1,14 +1,14 @@ ---A formal parameter hides any definition of an attribute of the same name. - -class A { }; -class B inherits A { }; -class C inherits B { }; -class D inherits B { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - a: C <- new C; - test(a: D): D { a }; - test2(a: B): C { a }; +--A formal parameter hides any definition of an attribute of the same name. + +class A { }; +class B inherits A { }; +class C inherits B { }; +class D inherits B { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + a: C <- new C; + test(a: D): D { a }; + test2(a: B): C { a }; }; \ No newline at end of file diff --git a/tests/semantic/methods3_error.txt b/tests/semantic/methods3_error.txt index 1165b7595..a0f6d9db2 100644 --- a/tests/semantic/methods3_error.txt +++ b/tests/semantic/methods3_error.txt @@ -1 +1 @@ -(13, 22) - TypeError: Inferred return type B of method test2 does not conform to declared return type C. +(13, 22) - TypeError: Inferred return type B of method test2 does not conform to declared return type C. diff --git a/tests/semantic/methods4.cl b/tests/semantic/methods4.cl index be8fa36ef..e093bac1c 100644 --- a/tests/semantic/methods4.cl +++ b/tests/semantic/methods4.cl @@ -1,19 +1,19 @@ -(* -The rule is -simple: If a class C inherits a method f from an ancestor class P, then C may override the inherited -definition of f provided the number of arguments, the types of the formal parameters, and the return -type are exactly the same in both definitions. -*) - -class A { - f(x: Int, y: Int): Int { x + y }; -}; -class B inherits A { - f(x: Int, y: Object): Int { x }; -}; -class C inherits B { }; -class D inherits B { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; +(* +The rule is +simple: If a class C inherits a method f from an ancestor class P, then C may override the inherited +definition of f provided the number of arguments, the types of the formal parameters, and the return +type are exactly the same in both definitions. +*) + +class A { + f(x: Int, y: Int): Int { x + y }; +}; +class B inherits A { + f(x: Int, y: Object): Int { x }; +}; +class C inherits B { }; +class D inherits B { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; }; \ No newline at end of file diff --git a/tests/semantic/methods4_error.txt b/tests/semantic/methods4_error.txt index 9f1486dec..c9fc2d12a 100644 --- a/tests/semantic/methods4_error.txt +++ b/tests/semantic/methods4_error.txt @@ -1 +1 @@ -(12, 15) - SemanticError: In redefined method f, parameter type Object is different from original type Int. +(12, 15) - SemanticError: In redefined method f, parameter type Object is different from original type Int. diff --git a/tests/semantic/methods5.cl b/tests/semantic/methods5.cl index 3905dfdd6..732e4d408 100644 --- a/tests/semantic/methods5.cl +++ b/tests/semantic/methods5.cl @@ -1,20 +1,20 @@ -(* -The rule is -simple: If a class C inherits a method f from an ancestor class P, then C may override the inherited -definition of f provided the number of arguments, the types of the formal parameters, and the return -type are exactly the same in both definitions. -*) - -class A { - f(x: Int, y: Int): Int { x + y }; -}; -class B inherits A { - f(a: Int, b: Int): Object { a - b }; -}; -class C inherits B { }; -class D inherits B { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; -}; - +(* +The rule is +simple: If a class C inherits a method f from an ancestor class P, then C may override the inherited +definition of f provided the number of arguments, the types of the formal parameters, and the return +type are exactly the same in both definitions. +*) + +class A { + f(x: Int, y: Int): Int { x + y }; +}; +class B inherits A { + f(a: Int, b: Int): Object { a - b }; +}; +class C inherits B { }; +class D inherits B { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; +}; + diff --git a/tests/semantic/methods5_error.txt b/tests/semantic/methods5_error.txt index 8b6bdf36e..073eee8c5 100644 --- a/tests/semantic/methods5_error.txt +++ b/tests/semantic/methods5_error.txt @@ -1 +1 @@ -(12, 24) - SemanticError: In redefined method f, return type Object is different from original return type Int. +(12, 24) - SemanticError: In redefined method f, return type Object is different from original return type Int. diff --git a/tests/semantic/methods6.cl b/tests/semantic/methods6.cl index dd2b73da6..61a62b4b0 100644 --- a/tests/semantic/methods6.cl +++ b/tests/semantic/methods6.cl @@ -1,27 +1,27 @@ -(* -The rule is -simple: If a class C inherits a method f from an ancestor class P, then C may override the inherited -definition of f provided the number of arguments, the types of the formal parameters, and the return -type are exactly the same in both definitions. -*) - -class A { - f(x: Int, y: Int): Int { x + y }; - g(x: Int): Int { x + x }; -}; -class B inherits A { - f(a: Int, b: Int): Int { a - b }; -}; -class C inherits B { - ident(m: Int): Int { m }; - f(m: Int, n: Int): Int { m * n }; -}; -class D inherits B { - ident(v: String): IO { new IO.out_string(v) }; - f(v: Int, w: Int): Int { v / w }; - g(v: Int, w: Int, z: Int): Int { v + w + z }; -}; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; +(* +The rule is +simple: If a class C inherits a method f from an ancestor class P, then C may override the inherited +definition of f provided the number of arguments, the types of the formal parameters, and the return +type are exactly the same in both definitions. +*) + +class A { + f(x: Int, y: Int): Int { x + y }; + g(x: Int): Int { x + x }; +}; +class B inherits A { + f(a: Int, b: Int): Int { a - b }; +}; +class C inherits B { + ident(m: Int): Int { m }; + f(m: Int, n: Int): Int { m * n }; +}; +class D inherits B { + ident(v: String): IO { new IO.out_string(v) }; + f(v: Int, w: Int): Int { v / w }; + g(v: Int, w: Int, z: Int): Int { v + w + z }; +}; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; }; \ No newline at end of file diff --git a/tests/semantic/methods6_error.txt b/tests/semantic/methods6_error.txt index 8e32663b9..70ad02e32 100644 --- a/tests/semantic/methods6_error.txt +++ b/tests/semantic/methods6_error.txt @@ -1 +1 @@ -(22, 5) - SemanticError: Incompatible number of formal parameters in redefined method g. +(22, 5) - SemanticError: Incompatible number of formal parameters in redefined method g. diff --git a/tests/semantic/methods7.cl b/tests/semantic/methods7.cl index e5a01f682..21e8ca275 100644 --- a/tests/semantic/methods7.cl +++ b/tests/semantic/methods7.cl @@ -1,12 +1,12 @@ --- Missing type - -class A { }; -class B inherits A { }; -class C inherits B { }; -class D inherits B { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - test(a: A, b: Ball): Int { 4 }; +-- Missing type + +class A { }; +class B inherits A { }; +class C inherits B { }; +class D inherits B { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + test(a: A, b: Ball): Int { 4 }; }; \ No newline at end of file diff --git a/tests/semantic/methods8.cl b/tests/semantic/methods8.cl index 3fccab54c..121210748 100644 --- a/tests/semantic/methods8.cl +++ b/tests/semantic/methods8.cl @@ -1,12 +1,12 @@ --- Missing type - -class A { }; -class B inherits A { }; -class C inherits B { }; -class D inherits B { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - test(a: A, b: B): Integrer { 4 }; +-- Missing type + +class A { }; +class B inherits A { }; +class C inherits B { }; +class D inherits B { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + test(a: A, b: B): Integrer { 4 }; }; \ No newline at end of file diff --git a/tests/semantic/new1.cl b/tests/semantic/new1.cl index d007fc03d..40a8b9e9b 100644 --- a/tests/semantic/new1.cl +++ b/tests/semantic/new1.cl @@ -1,31 +1,31 @@ --- Missing type - -class A { }; -class B inherits A { }; -class C inherits B { }; -class D inherits B { }; -class E inherits B { }; -class F inherits A { }; - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - test: F <- { - new A; - { - new Ball; - { - new C; - { - new D; - { - new E; - { - new F; - }; - }; - }; - }; - }; - }; +-- Missing type + +class A { }; +class B inherits A { }; +class C inherits B { }; +class D inherits B { }; +class E inherits B { }; +class F inherits A { }; + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + test: F <- { + new A; + { + new Ball; + { + new C; + { + new D; + { + new E; + { + new F; + }; + }; + }; + }; + }; + }; }; \ No newline at end of file diff --git a/tests/semantic/self1.cl b/tests/semantic/self1.cl index 3387fd263..399f6ff06 100644 --- a/tests/semantic/self1.cl +++ b/tests/semantic/self1.cl @@ -1,11 +1,11 @@ -(* -But it is an error to assign to self or to bind self in a let, a -case, or as a formal parameter. It is also illegal to have attributes named self. -*) - - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - test(a: Main): IO { self <- a }; -}; +(* +But it is an error to assign to self or to bind self in a let, a +case, or as a formal parameter. It is also illegal to have attributes named self. +*) + + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + test(a: Main): IO { self <- a }; +}; diff --git a/tests/semantic/self1_error.txt b/tests/semantic/self1_error.txt index 6beb3cda2..f9f51b9b3 100644 --- a/tests/semantic/self1_error.txt +++ b/tests/semantic/self1_error.txt @@ -1 +1 @@ -(10, 30) - SemanticError: Cannot assign to 'self'. +(10, 30) - SemanticError: Cannot assign to 'self'. diff --git a/tests/semantic/self2.cl b/tests/semantic/self2.cl index 2e6921a92..6ef75e368 100644 --- a/tests/semantic/self2.cl +++ b/tests/semantic/self2.cl @@ -1,10 +1,10 @@ -(* -But it is an error to assign to self or to bind self in a let, a -case, or as a formal parameter. It is also illegal to have attributes named self. -*) - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - test(): IO { let self: Main <- new Main in self }; -}; +(* +But it is an error to assign to self or to bind self in a let, a +case, or as a formal parameter. It is also illegal to have attributes named self. +*) + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + test(): IO { let self: Main <- new Main in self }; +}; diff --git a/tests/semantic/self2_error.txt b/tests/semantic/self2_error.txt index 20c883c91..2e53bb210 100644 --- a/tests/semantic/self2_error.txt +++ b/tests/semantic/self2_error.txt @@ -1 +1 @@ -(9, 22) - SemanticError: 'self' cannot be bound in a 'let' expression. +(9, 22) - SemanticError: 'self' cannot be bound in a 'let' expression. diff --git a/tests/semantic/self3.cl b/tests/semantic/self3.cl index 81709b4b5..d314798a9 100644 --- a/tests/semantic/self3.cl +++ b/tests/semantic/self3.cl @@ -1,10 +1,10 @@ -(* -But it is an error to assign to self or to bind self in a let, a -case, or as a formal parameter. It is also illegal to have attributes named self. -*) - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - test(self: IO): IO { self }; -}; +(* +But it is an error to assign to self or to bind self in a let, a +case, or as a formal parameter. It is also illegal to have attributes named self. +*) + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + test(self: IO): IO { self }; +}; diff --git a/tests/semantic/self3_error.txt b/tests/semantic/self3_error.txt index 0ae382007..0015bbe0a 100644 --- a/tests/semantic/self3_error.txt +++ b/tests/semantic/self3_error.txt @@ -1 +1 @@ -(9, 10) - SemanticError: 'self' cannot be the name of a formal parameter. +(9, 10) - SemanticError: 'self' cannot be the name of a formal parameter. diff --git a/tests/semantic/self4.cl b/tests/semantic/self4.cl index 7c2b960cb..9185c8760 100644 --- a/tests/semantic/self4.cl +++ b/tests/semantic/self4.cl @@ -1,10 +1,10 @@ -(* -But it is an error to assign to self or to bind self in a let, a -case, or as a formal parameter. It is also illegal to have attributes named self. -*) - -class Main inherits IO { - main(): IO { out_string("Hello World!")}; - - self: IO <- self; +(* +But it is an error to assign to self or to bind self in a let, a +case, or as a formal parameter. It is also illegal to have attributes named self. +*) + +class Main inherits IO { + main(): IO { out_string("Hello World!")}; + + self: IO <- self; }; \ No newline at end of file diff --git a/tests/semantic/self4_error.txt b/tests/semantic/self4_error.txt index c19ca400f..bf8740604 100644 --- a/tests/semantic/self4_error.txt +++ b/tests/semantic/self4_error.txt @@ -1 +1 @@ -(9, 5) - SemanticError: 'self' cannot be the name of an attribute. +(9, 5) - SemanticError: 'self' cannot be the name of an attribute. diff --git a/tests/semantic_test.py b/tests/semantic_test.py index cac9cd78b..6dee3cfd3 100644 --- a/tests/semantic_test.py +++ b/tests/semantic_test.py @@ -1,14 +1,22 @@ -import pytest -import os -from utils import compare_errors, first_error_only_line - -tests_dir = __file__.rpartition('/')[0] + '/semantic/' -tests = [(file) for file in os.listdir(tests_dir) if file.endswith('.cl')] - -@pytest.mark.semantic -@pytest.mark.error -@pytest.mark.run(order=3) -@pytest.mark.parametrize("cool_file", tests) -def test_semantic_errors(compiler_path, cool_file): - compare_errors(compiler_path, tests_dir + cool_file, tests_dir + cool_file[:-3] + '_error.txt', \ - cmp=first_error_only_line) \ No newline at end of file +import os +import pathlib + +import pytest + +from .utils import compare_errors, first_error_only_line + +tests_dir = str(pathlib.Path(__file__).parent / "semantic") +tests = [(file) for file in os.listdir(tests_dir) if file.endswith(".cl")] + + +@pytest.mark.semantic +@pytest.mark.error +@pytest.mark.run(order=3) +@pytest.mark.parametrize("cool_file", tests) +def test_semantic_errors(compiler_path, cool_file): + compare_errors( + compiler_path, + str(os.path.join(tests_dir, cool_file)), + str(os.path.join(tests_dir, cool_file[:-3] + "_error.txt")), + cmp=first_error_only_line, + ) diff --git a/tests/utils/__init__.py b/tests/utils/__init__.py index 90f60fdd8..16281fe0b 100644 --- a/tests/utils/__init__.py +++ b/tests/utils/__init__.py @@ -1 +1 @@ -from .utils import * \ No newline at end of file +from .utils import * diff --git a/tests/utils/utils.py b/tests/utils/utils.py index 961cf7cbc..b52a8a7c0 100644 --- a/tests/utils/utils.py +++ b/tests/utils/utils.py @@ -1,91 +1,148 @@ -import subprocess -import re - - -COMPILER_TIMEOUT = 'El compilador tarda mucho en responder.' -SPIM_TIMEOUT = 'El spim tarda mucho en responder.' -TEST_MUST_FAIL = 'El test %s debe fallar al compilar' -TEST_MUST_COMPILE = 'El test %s debe compilar' -BAD_ERROR_FORMAT = '''El error no esta en formato: (,) - : - o no se encuentra en la 3ra linea\n\n%s''' -UNEXPECTED_ERROR = 'Se esperaba un %s en (%d, %d). Su error fue un %s en (%d, %d)' -UNEXPECTED_OUTPUT = 'La salida de %s no es la esperada:\n%s\nEsperada:\n%s' - -ERROR_FORMAT = r'^\s*\(\s*(\d+)\s*,\s*(\d+)\s*\)\s*-\s*(\w+)\s*:(.*)$' - -def parse_error(error: str): - merror = re.fullmatch(ERROR_FORMAT, error) - assert merror, BAD_ERROR_FORMAT % error - - return (t(x) for t, x in zip([int, int, str, str], merror.groups())) - - -def first_error(compiler_output: list, errors: list): - line, column, error_type, _ = parse_error(errors[0]) - - oline, ocolumn, oerror_type, _ = parse_error(compiler_output[0]) - - assert line == oline and column == ocolumn and error_type == oerror_type,\ - UNEXPECTED_ERROR % (error_type, line, column, oerror_type, oline, ocolumn) - -def first_error_only_line(compiler_output: list, errors: list): - line, column, error_type, _ = parse_error(errors[0]) - - oline, ocolumn, oerror_type, _ = parse_error(compiler_output[0]) - - assert line == oline and error_type == oerror_type,\ - UNEXPECTED_ERROR % (error_type, line, column, oerror_type, oline, ocolumn) - - -def get_file_name(path: str): - try: - return path[path.rindex('/') + 1:] - except ValueError: - return path - -def compare_errors(compiler_path: str, cool_file_path: str, error_file_path: str, cmp=first_error, timeout=100): - try: - sp = subprocess.run(['bash', compiler_path, cool_file_path], capture_output=True, timeout=timeout) - return_code, output = sp.returncode, sp.stdout.decode() - except subprocess.TimeoutExpired: - assert False, COMPILER_TIMEOUT - - assert return_code == 1, TEST_MUST_FAIL % get_file_name(cool_file_path) - - fd = open(error_file_path, 'r') - errors = fd.read().split('\n') - fd.close() - - # checking the errors of compiler - compiler_output = output.split('\n') - cmp(compiler_output[2:], errors) - -SPIM_HEADER = r'''^SPIM Version .+ of .+ -Copyright .+\, James R\. Larus\. -All Rights Reserved\. -See the file README for a full copyright notice\. -(?:Loaded: .+\n)*''' -def compare_outputs(compiler_path: str, cool_file_path: str, input_file_path: str, output_file_path: str, timeout=100): - try: - sp = subprocess.run(['bash', compiler_path, cool_file_path], capture_output=True, timeout=timeout) - assert sp.returncode == 0, TEST_MUST_COMPILE % get_file_name(cool_file_path) - except subprocess.TimeoutExpired: - assert False, COMPILER_TIMEOUT - - spim_file = cool_file_path[:-2] + 'mips' - - try: - fd = open(input_file_path, 'rb') - sp = subprocess.run(['spim', '-file', spim_file], input=fd.read(), capture_output=True, timeout=timeout) - fd.close() - mo = re.match(SPIM_HEADER, sp.stdout.decode()) - if mo: - output = mo.string[mo.end():] - except subprocess.TimeoutExpired: - assert False, SPIM_TIMEOUT - - fd = open(output_file_path, 'r') - eoutput = fd.read() - fd.close() - - assert output == eoutput, UNEXPECTED_OUTPUT % (spim_file, repr(output), repr(eoutput)) +import subprocess +import re +import platform + + +COMPILER_TIMEOUT = "El compilador tarda mucho en responder." +SPIM_TIMEOUT = "El spim tarda mucho en responder." +TEST_MUST_FAIL = "El test %s debe fallar al compilar" +TEST_MUST_COMPILE = "El test %s debe compilar" +BAD_ERROR_FORMAT = """El error no esta en formato: (,) - : + o no se encuentra en la 3ra linea\n\n%s""" +UNEXPECTED_ERROR = "Se esperaba un %s en (%d, %d). Su error fue un %s en (%d, %d)" +UNEXPECTED_OUTPUT = "La salida de %s no es la esperada:\n%s\nEsperada:\n%s" + +ERROR_FORMAT = r"^\s*\(\s*(\d+)\s*,\s*(\d+)\s*\)\s*-\s*(\w+)\s*:(.*)$" + + +def parse_error(error: str): + merror = re.fullmatch(ERROR_FORMAT, error) + assert merror, BAD_ERROR_FORMAT % error + + return (t(x) for t, x in zip([int, int, str, str], merror.groups())) + + +def first_error(compiler_output: list, errors: list): + line, column, error_type, _ = parse_error(errors[0]) + + oline, ocolumn, oerror_type, _ = parse_error(compiler_output[0]) + + assert ( + line == oline and column == ocolumn and error_type == oerror_type + ), UNEXPECTED_ERROR % (error_type, line, column, oerror_type, oline, ocolumn) + + +def first_error_only_line(compiler_output: list, errors: list): + line, column, error_type, _ = parse_error(errors[0]) + + oline, ocolumn, oerror_type, _ = parse_error(compiler_output[0]) + + assert line == oline and error_type == oerror_type, UNEXPECTED_ERROR % ( + error_type, + line, + column, + oerror_type, + oline, + ocolumn, + ) + + +def get_file_name(path: str): + try: + return path[path.rindex("/") + 1 :] + except ValueError: + return path + + +def compare_errors( + compiler_path: str, + cool_file_path: str, + error_file_path: str, + cmp=first_error, + timeout=100, +): + try: + if platform.system() == "Windows": + sp = subprocess.run( + ["python", compiler_path, cool_file_path], + capture_output=True, + timeout=timeout, + ) + else: + sp = subprocess.run( + ["bash", compiler_path, cool_file_path], + capture_output=True, + timeout=timeout, + ) + return_code, output = sp.returncode, sp.stdout.decode() + except subprocess.TimeoutExpired: + assert False, COMPILER_TIMEOUT + + assert return_code == 1, TEST_MUST_FAIL % get_file_name(cool_file_path) + + fd = open(error_file_path, "r") + errors = fd.read().split("\n") + fd.close() + + # checking the errors of compiler + compiler_output = output.split("\n") + cmp(compiler_output[2:], errors) + + +SPIM_HEADER = r"""^SPIM Version .+ of .+ +Copyright .+\, James R\. Larus\. +All Rights Reserved\. +See the file README for a full copyright notice\. +(?:Loaded: .+\n)*""" + + +def compare_outputs( + compiler_path: str, + cool_file_path: str, + input_file_path: str, + output_file_path: str, + timeout=100, +): + try: + if platform.system() == "Windows": + sp = subprocess.run( + ["python", compiler_path, cool_file_path], + capture_output=True, + timeout=timeout, + ) + else: + sp = subprocess.run( + ["bash", compiler_path, cool_file_path], + capture_output=True, + timeout=timeout, + ) + assert sp.returncode == 0, TEST_MUST_COMPILE % get_file_name(cool_file_path) + except subprocess.TimeoutExpired: + assert False, COMPILER_TIMEOUT + + spim_file = cool_file_path[:-2] + "mips" + + try: + fd = open(input_file_path, "rb") + sp = subprocess.run( + ["spim", "-file", spim_file], + input=fd.read(), + capture_output=True, + timeout=timeout, + ) + fd.close() + mo = re.match(SPIM_HEADER, sp.stdout.decode()) + if mo: + output = mo.string[mo.end() :] + except subprocess.TimeoutExpired: + assert False, SPIM_TIMEOUT + + fd = open(output_file_path, "r") + eoutput = fd.read() + fd.close() + + assert output == eoutput, UNEXPECTED_OUTPUT % ( + spim_file, + repr(output), + repr(eoutput), + )