diff --git a/.gitignore b/.gitignore index 4acafde1..94d6a526 100644 --- a/.gitignore +++ b/.gitignore @@ -408,3 +408,9 @@ dmypy.json # Custom rules (everything added below won't be overriden by 'Generate .gitignore File' if you use 'Update' option) +### Sublime Text Projects ### +*.sublime-project + +src/.builds + +src/testing.py \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..d15d2da2 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,12 @@ +{ + "python.pythonPath": "/bin/python", + "cmake.configureOnOpen": false, + "python.linting.enabled": false, + "python.linting.mypyEnabled": true, + "python.testing.pytestArgs": [ + "tests" + ], + "python.testing.unittestEnabled": false, + "python.testing.nosetestsEnabled": false, + "python.testing.pytestEnabled": true, +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 00000000..0252b4c2 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,17 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + "tasks": [ + { + "label": "test", + "type": "shell", + "command": "cd src && make test", + "problemMatcher": [], + "group": { + "kind": "build", + "isDefault": true + } + } + ] +} \ No newline at end of file diff --git a/Readme.md b/Readme.md index 5b1cbbce..55093d31 100644 --- a/Readme.md +++ b/Readme.md @@ -106,13 +106,13 @@ En este proyecto se realizarán entregas parciales a lo largo del curso. Para re ### 2. Asegúrese de tener la siguiente configuración antes de hacer click en **Create pull request**. - **base repository**: `matcom/cool-compiler-2020` (repositorio original) - - **branch**: `entrega-parser` + - **branch**: `entrega-final` - **head repository**: `/cool-compiler-2020` (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 `entrega-parser`. +> **NOTA**: Asegúrese que el _pull request_ se hace a la rama `entrega-final`. ![](img/img6.png) diff --git a/doc/Readme.md b/doc/Readme.md index 402477c8..9a65f094 100644 --- a/doc/Readme.md +++ b/doc/Readme.md @@ -4,9 +4,12 @@ **Nombre** | **Grupo** | **Github** --|--|-- -Nombre1 Apellido1 Apellido2 | C4xx | [@github_user](https://github.com/) -Nombre2 Apellido1 Apellido2 | C4xx | [@github_user](https://github.com/) -Nombre3 Apellido1 Apellido2 | C4xx | [@github_user](https://github.com/) + +Adrian Gonzalez Sanchez | C412 | [@adriangs1996](https://github.com/adriangs1996) + +Eliane Puerta Cabrera | C412 | [@NaniPuerta](https://github.com/NaniPuerta) + +Liset Alfaro | C411 | [@LisetAlfaro](https://github.com/LisetAlfaro) ## Readme diff --git a/doc/informe.pdf b/doc/informe.pdf new file mode 100644 index 00000000..306fda5b Binary files /dev/null and b/doc/informe.pdf differ diff --git a/doc/informe.tex b/doc/informe.tex new file mode 100644 index 00000000..c0f0f5b8 --- /dev/null +++ b/doc/informe.tex @@ -0,0 +1,265 @@ +\documentclass[a4paper, 12pt]{article} + % General Document formatting + \usepackage[margin=0.7in]{geometry} + \usepackage[parfill]{parskip} + \usepackage[utf8]{inputenc} + \usepackage{graphicx} + \usepackage{amsthm} + \usepackage{amsmath} + \usepackage{mathtools} + +\newtheorem{mydef}{Definici\'on} +\newtheorem{mytheo}{Teorema} + +\begin{document} +\title{Documentacion del Proyecto final de Complementos de Compilación} +\date{Curso 2019-2020} + +\author{ + Adrian Gonzalez Sánchez- C412 - [@adriangs1996]\\ + Eliane Puerta Cabrera- C412 - [@NaniPuerta]\\ + Liset Alfaro Gonzalez- C411 - [@LisetAlfaro]\\ + } + +\maketitle + +\section{Introducción} +\textit{COOL (Classroom Object-Oriented Language)} es un lenguaje pequeño, prácticamente de expresiones; pero que aun así, +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. +La gramatica de Cool utilizada es libre del contexto y es definida en nuestro proyecto como +una gram\'atica s-atributada, una definici\'on informal de la misma +puede encontrarse en el manual de Cool que aparece en la carpeta doc, precisamente donde se encuentra esta documentación.\\ +En este documento quedan reflejadas las principales ideas a seguir por el equipo para +la implementación de un compilador funcional de este lenguaje, +pasando por un lenguaje intermedio CIL que facilita su transición a Mips. + +\section{Requerimientos para ejecutar el compilador} +Lo primero que se debe hacer ejecutar el archivo Makefile que se encuentra en la carpeta src del proyecto utilizando el siguiente +comando: +\begin{verbatim} + $ make +\end{verbatim} + +una vez termine de ejecutarse, habr\'a ocurrido lo siguiente +\begin{itemize} + \item Se tendr\'a instalada la librería cloudpickle, requerida para cargar el Parser que posteriormente mencionaremos. + \item Se crear\'a la carpeta build donde habr\'a un m\'odulo que contiene el binario de nuestro Lexer y nuestro Parser. +\end{itemize} +\section{Arquitectura:} + +\subsection*{Módulos:} +\begin{itemize} + \item \textbf{Tokenizer}: \textit{src/tknizer.py} + \item \textbf{Parser}: El parser no es un m\'odulo, en vez de eso utilizamos nuestro + propio generador de parsers, el cual se encuentra en \textit{src/parserr/slr.py}. La tabla de parsing + devuelta es lo que se compila con cloudpickle. + \item \textbf{COOL AST}: \textit{src/abstract/tree.py} + \item \textbf{Visitors}: \textit{src/travels/*.py} + \item \textbf{CIL AST}: \textit{src/cil/nodes.py} + \item \textbf{MIPS Instruction Set}: \textit{src/mips/*.py} +\end{itemize} + +\subsection*{Fases en las que se divide el compilador:} +Para una mejor organización se divide el compilador en varias fases +\begin{itemize} +\item \textbf{Lexer}: En esta fase se realiza un preprocesamiento de la entrada. +Este preprocesamiento consiste en sustituir los comentarios ,que pueden ser anidados y +por tanto no admiten una expresi\'on regular para detectarlos, por el caracter $espacio$, +manteniendo los caracteres fin de línea en el archivo fuente +(Esto es necesario para detectar un errores en la línea y la columna exacta donde ocurren).\\ +El tokenizer que recibe este archivo fuente ya procesado tiene una tabla de expresiones regulares +donde se encuentran clasificados los tokens por prioridad, +esto nos permite, por ejemplo, no confundir palabras claves(keywords) con identificadores. +Este devuelve una lista de $tokens$ y pasamos a la segunda fase.\\ + +\item \textbf{Parser:} El generador del parser fue hecho por el equipo y la implementación +puede encontrarse en los archivos cuyo nombre corresponden con esta fase. +Este devuelve un parser $LALR$, que produce una derivaci\'on extrema derecha sobre una cadena de tokens y luego +esta se evalúa en una función llamada $evaluate$ que devuelve al \textit{AST de Cool}.\\ + +\item \textbf{Chequeo Sem\'antico:} En esta fase implementan varios recorridos sobre el AST de COOL, siguiendo +el patr\'on $visitor$. +Cada uno recolecta errores de índole sem\'antica y si uno de ellos encuentra un error lanza una excepción, +siendo este el comportamiento deseado: +\begin{itemize} + \item Recolector de Tipos(TypeCollector): Este recolecta los tipos y los define en el contexto. En este recorrido se + detecta si se redefinen las clases built-in, o si las clases son redefinidas. + + \item Constructor de Tipos(TypeBuilder): Este Visitor define en cada tipo las funciones y atributos, + y maneja la herencia y redefinición de funciones. + En este se detectan errores como dependencias circulares, los atributos definidos con tipos inexistentes, + se chequean la correctitud de las definiciones de los par\'ametros de los m\'etodos que se redefinen, etc.. + + \item Inferencia de tipos(Inferer): En este recorrido se realiza el chequeo de Tipos y + adem\'as incorporamos inferencia de tipos al lenguage, feature que no est\'a contemplado + en la definici\'on formal. Este recorrido visualiza el codigo de COOL como una gran expresi\'on + y realiza un an\'alisi Bottom-Up, partiendo de tipos bien definidos de las expresiones en las hojas + como enteros, strings, etc. Como paso extra, para inferir los tipos nos basamos en las mismas reglas + sem\'anticas de tipos, pero agregamos recorridos para resolver los problemas de dependencia que puedan surgir + entre los elementos a inferir. Tomemos como ejemplo el siguiente fragmento de c\'odigo, tomado en parte del + test \textbf{Complex.cl}: + + \begin{verbatim} +class Main inherits IO { + main() : AUTO_TYPE { + (let c : AUTO_TYPE <- (new Complex).init(4, 5) in + out_int(c.sum()) + ) + }; +}; + +class Complex inherits IO { + x : AUTO_TYPE; + y : AUTO_TYPE; + + init(a : AUTO_TYPE, b : AUTO_TYPE) : Complex { + { + x <- a; + y <- b; + self; + } + }; + + sum() : AUTO_TYPE { + x + y + }; +}; + \end{verbatim} + +\begin{verbatim} + $ python testing.py > testing.mips + $ spim -file testing.mips + SPIM Version 8.0 of January 8, 2010 + Copyright 1990-2010, James R. Larus. + All Rights Reserved. + See the file README for a full copyright notice. + Loaded: /usr/lib/spim/exceptions.s + 9% +\end{verbatim} +\paragraph{} +El compilador es perfectamente capaz de inferir los tipos de cada argumento y de cada +atributo en este caso, pero, c\'omo ??? +\paragraph{} +Es f\'acil resolver los tipos en este ejemplo a vista, ya que miramos primeramente el m\'etodo \textbf{sum} +en el cual los atributos son usados en una suma, y como en \textit{COOL} solo se pueden sumar enteros, +entonces los atributos deben ser enteros. Por otro lado, luego verificamos los argumentos de la funci\'on \textbf{init} +y vemos que est\'an siendo utilizados como asignaci\'on para los atributos, por lo que deben ser enteros tambi\'en. +La inferencia de los tipos de retorno de los m\'etodos \textbf{sum y main} es trivial, como lo es inferir el tipo de +la variable \textit{c}. Pero para el compilador, esta forma de "elegir" por donde comenzar a mirar, no es para nada trivial, ya que +las dependencias de los tipos de retorno forman un grafo que debe ser recorrido en orden topol\'ogico (de no existir dicho orden, o sea, no ser un DAG, +evidentemente existir\'ia una dependencia c\'iclica que no es posible resolver), pero definir este recorrido se ve complicado +por el scoping de los m\'etodos, y nuestra forma de tratar la inicializaci\'on de atributos, que terminan siendo m\'etodos "an\'onimos". +Dicho esto, nuestro enfoque es definir una relaci\'on de dependencia en profundidad, o sea, $d(x) = p$ si para +poder inferir el tipo de "$x$", es necesario inferir, como m\'aximo, $p$ elementos antes. Luego se hacen $p$ recorridos, sobre el AST +de COOL, en cada paso actualizando el contexto en el que existe cada elemento para poder utilizarlo en pasadas posteriores. As\'i +pudi\'eramos inferir en una primera pasada los tipos de retornos de los atributos, y luego en una segunda pasada, los argumentos. +En la pr\'actica, el \textbf{inferer} revisa primero los m\'etodos de inicializaci\'on de cada atributo, y luego +los m\'etodos en orden de definici\'on en el c\'odigo fuente, por lo que en este caso, se infieren primero los argumentos del m\'etodo, +pues son usados constantes enteras en su llamada a \textbf{init}, y de ah\'i se deduce el tipo de los atributos al ser asignados en la función. +Es f\'acil entonces ver que esta forma de inferencia est\'a limitada a la profundidad configurada por el compilador, la cual, por defecto + es $5$, ya que en la pr\'actica, un nivel de anidaci\'on de dependencias mayor es dificil de conseguir, aunque se puede modificar + pas\'andole como argumento la profundidad al compilador, de la siguiente manera: + + \begin{verbatim} + $ python pycoolc.py --deep=10 [] + \end{verbatim} + +\end{itemize} +\item \textbf{Generación de código:} En esta fase se pasa de Cool a CIL y luego de CIL a MIPS. +El conjunto de instrucciones de MIPS que se utiliza son del emulador de SPIM, o sea, utilizamos el conjunto +de instrucciones extendidas de MIPS, donde existen instrucciones como LW y MOVE que no son parte de la Arquitectura +original y que se traducen en dos o m\'as instrucciones en modo \textit{bare}. En esta fase primeramente traducimos +el AST de Cool a un AST de CIL (lenguaje intermedio), con el objetivo de facilitar el paso hacia MIPS. Este es un c\'odigo +de tres direcciones, compuesto por tres secciones principales \textbf{.DATA} \textbf{.CODE} \textbf{.TYPES}. +En la secci\'on .DATA almacenamos nuestros strings literales y lo que nosotros llamamos \textit{TDT}. En la secci\'on +de tipos va una representaci\'on de los tipos que luego se puedan convertir f\'acilmente a MIPS, aqu\'i ocurre el mangling +de los nombres de las funciones de modo que se puedan referenciar distintamente luego. Por \'ultimo en la secci\'on +.CODE van todas las funciones que nuestro programa necesite, incluidas las built-in que son bootstrapeadas al +inicio de este recorrido. Es interesante resaltar en CIL como manejamos los m\'etodos y atributos heredados, ya +que en los records que representan los tipos, cada m\'etodo y atributo heredado es agregado primero antes que los definidos +por el tipo en particular; lo que garantiza que para cualquier m\'etodo "$x$", el \'indice de $x$ en la lista de m\'etodos +de cualquier tipo que lo herede, es el mismo. Una vez que se termina el recorrido por el AST de COOL, hemos conformado +las tres secciones de CIL, y estas son pasadas al Generador de MIPS, que no es m\'as que otro recorrido sobre este nuevo +AST que hemos obtenido. + +\item \textbf{Generaci\'on de c\'odigo MIPS}: El primer reto para generar c\'odigo ensamblador es representar el +conjunto de instrucciones de la arquitectura. Para lograr esto definimos varias clases bases (branches, loads, stores, comparisson, etc) +que redefinen el m\'etodo \textbf{\_\_str\_\_}, de modo que utilizan el nombre de la clase para representarse, y agregan el s\'imbolo +\$ en dependencia de si ponemos una constante o un registro. De esta forma la generaci\'on de c\'odigo referente a un nodo de CIL +se realiza de manera natural, casi como si program\'aramos en ensamblador, como por ejemplo, en este caso: + +\begin{verbatim} + @visit.register + def _(self, node: cil.ArgNode): + # Pasar los argumentos en la pila. + self.add_source_line_comment(node) + src = self.visit(node.name) + reg = self.get_available_register() + assert src is not None and reg is not None + + if isinstance(src, int): + self.register_instruction(LI(reg, src)) + else: + self.register_instruction(LW(reg, src)) + + self.comment("Push arg into stack") + self.register_instruction(SUBU(sp, sp, 4, True)) + self.register_instruction(SW(reg, "0($sp)")) + + self.used_registers[reg] = False +\end{verbatim} + +Como se puede ver, registramos una instruccion, casi como si program\'aramos assembly. + +\paragraph{} +Otra aspecto significativo es la representaci\'on de los tipos en runtime. Al final, todo son solo n\'umeros, +por lo que tenemos que darles un formato que sea adecuado para poderlos referenciar y, que, adem\'as, permita +acceder a sus propiedades de manera eficiente. En este aspecto, usamos la siguiente estructura para los tipos: + +\begin{verbatim} + ################################# address + # TYPE_POINTER # + ################################# address + 4 + # VTABLE_POINTER # + ################################# address + 8 + # ATTRIBUTE_1 # + ################################# address + 12 + # ATTRIBUTE_2 # + ################################# + # ... # + # ... # + # ... # + ################################# +\end{verbatim} + +Esta estructura permite varias cosas: +\begin{itemize} + \item Acceso a atributos en $O(1)$. + \item Acceso al nombre del tipo que corresponda a una instancia en $O(1)$. + \item Dispatch din\'amico en $O(1)$. +\end{itemize} + +El mencionado puntero a la VTABLE, no es m\'as que el inicio de un array (Idea sacada de \textit{C++}) que en cada +tipo contiene los nombres manglados de sus funciones, y recordemos que anteriormente dijimos que en CIL, +garantiz\'abamos que el ind\'ice de cada m\'etodo es el mismo en cada tipo que lo herede, de ah\'i que +acceder a una funci\'on determinada sobre una instancia es tan f\'acil como cargar el puntero a la VTABLE +de la instancia, calcular el \'indice del m\'etodo que se quiere en tiempo de compilaci\'on y indexar en la +VTABLE en ese indice en runtime, para un dispatch en $O(1)$. + +Otro aspecto que le prestamos inter\'es en esta fase es el tema de los \textit{case}. Las expresiones "case" +requieren que la jerarqu\'ia de tipos sea mantenida de alguna forma en runtime. En vez de esto, calculamos +lo que llamamos una $TDT$ (Type Distance Table), que no es m\'as que una tabla donde para cada par de tipos +A y B se le asigna la distancia a la que se encuentran en la jerarqu\'ia, o $-1$ en caso de que no pertenezcan +a la misma rama. Para conformar esta tabla hacemos un preprocesamiento en $O(n^2)$ basado en los resultados +de los tiempos de descubrimiento de un recorrido DFS sobre la jerarqu\'ia de tipos, partiendo desde la ra\'iz, +Object. + +Importante tambi\'en son las convenciones que adoptamos al generar c\'odigo. Por ejemplo, cada funci\'on +de MIPS tiene un marco de pila que es creado con un m\'inimo de 32 bytes, porque es convenio entre programadores +de MIPS. Los par\'ametros a funciones se pasan en la pila, ya que aunque MIPS cuenta con 32 registros, no todos +son de prop\'osito general y complica mucho la implementaci\'on el hecho de llevar una cuenta de los registros +utilizados. + +\end{itemize} +\end{document} diff --git a/doc/mipsassemblytutorial.pdf b/doc/mipsassemblytutorial.pdf new file mode 100755 index 00000000..e00949c7 Binary files /dev/null and b/doc/mipsassemblytutorial.pdf differ diff --git a/requirements.txt b/requirements.txt index 9eb0cad1..02a7f1e0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,3 @@ pytest pytest-ordering +cloudpickle diff --git a/src/.builds b/src/.builds new file mode 100644 index 00000000..faf6fc65 --- /dev/null +++ b/src/.builds @@ -0,0 +1,219 @@ +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 diff --git a/src/abstract/__init__.py b/src/abstract/__init__.py new file mode 100755 index 00000000..e69de29b diff --git a/src/abstract/semantics.py b/src/abstract/semantics.py new file mode 100755 index 00000000..572da821 --- /dev/null +++ b/src/abstract/semantics.py @@ -0,0 +1,279 @@ +from __future__ import annotations +import itertools as itt +from typing import List, Dict, Optional + + +class SemanticError(Exception): + @property + def text(self): + return self.args[0] + + +class Type: + def __init__(self, name: str, line=0, column=0): + self.name = name + self.attributes: List[Attribute] = [] + self.methods: Dict[str, Method] = {} + self.parent: Optional[Type] = None + self.line = line + self.column = column - len(self.name) + + def set_parent(self, parent) -> None: + if self.parent is not None: + raise SemanticError(f'({self.line}, {self.column}) - SemanticError: Parent type is already set for {self.name}.') + self.parent = parent + + def get_attribute(self, name): + try: + return next(attr for attr in self.attributes if attr.name == name) + except StopIteration: + if self.parent is None: + raise SemanticError( + f'({self.line}, {self.column}) - SemanticError: Attribute "{name}" is not defined in {self.name}.') + try: + return self.parent.get_attribute(name) + except SemanticError: + raise SemanticError( + f'({self.line}, {self.column}) - SemanticError: Attribute "{name}" is not defined in {self.name}.') + + def define_attribute(self, name, typex, line, column): + try: + self.get_attribute(name) + except SemanticError: + attribute = Attribute(name, typex) + self.attributes.append(attribute) + return attribute + else: + raise SemanticError( + f'({line}, {column}) - SemanticError: Attribute "{name}" is already defined in {self.name}.') + + def get_method(self, name): + try: + return self.methods[name] + except KeyError: + if self.parent is None: + raise SemanticError( + f'({self.line}, {self.column}) - SemanticError: Method "{name}" is not defined in {self.name}.') + try: + return self.parent.get_method(name) + except SemanticError: + raise SemanticError( + f'({self.line}, {self.column}) - SemanticError: Method "{name}" is not defined in {self.name}.') + + def define_method(self, name, param_names, param_types, return_type, line, column): + if name in self.methods: + raise SemanticError( + f'({line}, {column}) - SemanticError: Method "{name}" already defined in {self.name}.') + + method = self.methods[name] = Method(name, param_names, param_types, + return_type) + return method + + def conforms_to(self, other) -> bool: + return other.bypass( + ) or self == other or self.parent is not None and self.parent.conforms_to( + other) + + def bypass(self) -> bool: + return False + + 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 else '' + output += '\n\t'.join(str(x) for x in self.methods.values()) + output += '\n' if self.methods else '' + output += '}\n' + return output + + def __repr__(self): + return str(self) + + def __eq__(self, other): + return isinstance(other, Type) and other.name == self.name + + def __hash__(self) -> int: + return hash(self.name) + + +class Method: + def __init__(self, name: str, param_names: List[str], + params_types: List[Type], return_type: Type): + self.name = name + self.param_names = param_names + self.param_types = params_types + self.return_type = return_type + self.vtable_index = 0 + + 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 other.param_types == self.param_types + + +class Attribute: + def __init__(self, name: str, typex: Type): + self.name: str = name + self.type: Type = typex + + def __str__(self): + return f'[attrib] {self.name} : {self.type.name};' + + def __eq__(self, o: Attribute) -> bool: + return o.name == self.name and o.type.name == self.type.name + + def __repr__(self): + return str(self) + + +class SelfType(Type): + def __init__(self) -> None: + super(SelfType, self).__init__('SELF_TYPE') + + +class VoidType(Type): + def __init__(self): + super(VoidType, self).__init__('Void') + + def __eq__(self, other): + return isinstance(other, VoidType) + + +class ObjectType(Type): + def __init__(self): + super(ObjectType, self).__init__('Object') + + def __eq__(self, other): + return isinstance(other, ObjectType) + + +class IntegerType(Type): + def __init__(self): + super(IntegerType, self).__init__('Int') + + def __eq__(self, other): + return isinstance(other, IntegerType) + + +class StringType(Type): + def __init__(self): + super(StringType, self).__init__('String') + + def __eq__(self, other): + return isinstance(other, StringType) + + +class BoolType(Type): + def __init__(self): + super(BoolType, self).__init__('Bool') + + def __eq__(self, other): + return isinstance(other, BoolType) + + +class AutoType(Type): + def __init__(self): + super(AutoType, self).__init__('AUTO_TYPE') + + def __eq__(self, other): + return isinstance(other, AutoType) + + def conforms_to(self, other: Type) -> bool: + return True + + +class IoType(Type): + def __init__(self) -> None: + super(IoType, self).__init__('IO') + + def __eq__(self, other): + return isinstance(other, IoType) + + +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'TypeError "{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) + + +class VariableInfo: + def __init__(self, name: str, vtype: Optional[Type] = None, location=None): + self.name = name + self.type = vtype + self.location = location + + +class Scope: + def __init__(self, parent=None): + self.locals: List[VariableInfo] = [] + self.parent: Optional[Scope] = parent + self.children: List[Scope] = [] + self.index: int = 0 if parent is None else len(parent) + + def __len__(self): + return len(self.locals) + + def create_child(self): + child: Scope = Scope(self) + self.children.append(child) + return child + + def define_variable(self, + vname: str, + vtype: Type, + location=None) -> VariableInfo: + info = VariableInfo(vname, vtype, location) + self.locals.append(info) + return info + + def find_variable(self, + vname: str, + index: int = None) -> Optional[VariableInfo]: + locals = self.locals if index is None else itt.islice( + self.locals, index) + try: + return next(x for x in locals if x.name == vname) + except StopIteration: + return self.parent.find_variable( + vname, self.index) if self.parent is not None else None + + def is_defined(self, vname: str) -> bool: + return self.find_variable(vname) is not None + + def is_local(self, vname: str) -> bool: + return any(True for x in self.locals if x.name == vname) + + def __str__(self): + s = ' Scope \n' + for v in self.locals: + s += f'{v.name} -> {v.type.name}\n' + if self.children: + for child in self.children: + s += str(child) + return s diff --git a/src/abstract/tree.py b/src/abstract/tree.py new file mode 100755 index 00000000..e666560c --- /dev/null +++ b/src/abstract/tree.py @@ -0,0 +1,345 @@ +from __future__ import annotations +from typing import List, Optional, Tuple, Union + +from abstract.semantics import SemanticError + + +class Node: + pass + + +class DeclarationNode(Node): + pass + + +class ExpressionNode(Node): + def __init__(self, line, column) -> None: + self.line = line + self.column = column + + +class ProgramNode(Node): + def __init__(self, class_list): + self.class_list: List[ClassDef] = class_list + + def check_semantics(self, deep=1): + from travels import typecollector, typebuilder, inference + + # recolectar los tipos + type_collector = typecollector.TypeCollector() + try: + type_collector.visit(self) + except SemanticError as e: + type_collector.errors.append(e.text) + + if type_collector.errors: + return type_collector.errors, type_collector.context, None + + # Construir los tipos detectados en el contexto + assert type_collector.context is not None + type_builder = typebuilder.TypeBuilder( + type_collector.context, type_collector.errors + ) + try: + type_builder.visit(self) + except SemanticError as e: + type_builder.errors.append(e.text) + + # Garantizar que exista un tipo Main que contenga un + # metodo main + context = type_builder.context + try: + context.get_type("Main") + context.get_type("Main").methods["main"] + except SemanticError as e: + type_builder.errors.append(str(e)) + except KeyError: + type_builder.errors.append(f"Main class must contain a main method.") + + errors = type_builder.errors + scope = None + if not errors: + try: + inferer = inference.TypeInferer(type_builder.context, errors=errors) + for d in range(1, deep + 1): + scope = inferer.visit(self, scope=scope, deep=d) + except SemanticError as e: + errors.append(e.text) + # reportar los errores + return errors, type_builder.context, scope + + +class Param(DeclarationNode): + def __init__(self, idx, typex, line, column): + self.id, self.type = idx, typex + self.line = line + self.column = column - len(idx) + + def __eq__(self, o: Param) -> bool: + return self.id == o.id + + +class MethodDef(DeclarationNode): + def __init__( + self, + idx: str, + param_list: List[Param], + return_type: str, + line, + column, + statements: ExpressionNode, + ret_col, + ): + self.idx: str = idx + self.param_list: List[Param] = param_list + self.return_type: str = return_type + self.statements: ExpressionNode = statements + self.line = line + self.column = column - len(self.idx) + self.ret_col = ret_col + + +class AttributeDef(DeclarationNode): + def __init__(self, idx: str, typex: str, line, column, default_value=None): + self.idx: str = idx + self.typex: str = typex + self.default_value: Optional[ExpressionNode] = default_value + self.line = line + self.column = column - len(idx) + + +class VariableDeclaration(ExpressionNode): + def __init__(self, var_list, line, column, block_statements=None): + self.var_list: List[ + Tuple[str, str, Optional[ExpressionNode], int, int] + ] = var_list + self.block_statements: Optional[ExpressionNode] = block_statements + self.line = line + self.column = column + + +class BinaryNode(ExpressionNode): + def __init__(self, left, right, line, column): + self.left: ExpressionNode = left + self.right: ExpressionNode = right + self.line = line + self.column = column + + +class AtomicNode(ExpressionNode): + def __init__(self, lex): + self.lex = lex + + +class IfThenElseNode(ExpressionNode): + def __init__(self, cond, expr1, expr2, line, column): + self.cond: ExpressionNode = cond + self.expr1: ExpressionNode = expr1 + self.expr2: ExpressionNode = expr2 + self.line = line + self.column = column + + +class PlusNode(BinaryNode): + def __init__(self, left, right, line, column): + super(PlusNode, self).__init__(left, right, line, column) + + +class DifNode(BinaryNode): + def __init__(self, left, right, line, column): + super(DifNode, self).__init__(left, right, line, column) + + +class MulNode(BinaryNode): + def __init__(self, left, right, line, column): + super(MulNode, self).__init__(left, right, line, column) + + +class DivNode(BinaryNode): + def __init__(self, left, right, line, column): + super(DivNode, self).__init__(left, right, line, column) + + +class FunCall(ExpressionNode): + def __init__(self, obj, idx, arg_list, line, column): + self.obj: Union[str, ExpressionNode] = obj + self.id: str = idx + self.args: List[ExpressionNode] = arg_list + self.line = line + self.column = column + + +class ParentFuncCall(ExpressionNode): + def __init__(self, obj, parent_type, idx, arg_list, line, column): + self.obj: ExpressionNode = obj + self.parent_type: str = parent_type + self.idx: str = idx + self.arg_list: List[ExpressionNode] = arg_list + self.line = line + self.column = column + + +class AssignNode(ExpressionNode): + def __init__(self, idx, expr, line, column): + self.idx: str = idx + self.expr: ExpressionNode = expr + self.line = line + self.column = column + + +class IntegerConstant(AtomicNode): + def __init__(self, lex): + super(IntegerConstant, self).__init__(int(lex)) + + +class StringConstant(AtomicNode): + def __init__(self, lex, line, column): + super(StringConstant, self).__init__(lex) + self.line = line + self.column = column + + +class TypeNode(AtomicNode): + def __init__(self, lex): + super(TypeNode, self).__init__(lex) + + +class BoleanNode(TypeNode): + def __init__(self, val): + self.val = True if val == "true" else False + + +class FalseConstant(AtomicNode): + def __init__(self): + super(FalseConstant, self).__init__("False") + + +class TrueConstant(AtomicNode): + def __init__(self): + super(TrueConstant, self).__init__("True") + + +class StringTypeNode(TypeNode): + def __init__(self): + super(StringTypeNode, self).__init__("String") + + +class IntegerTypeNode(TypeNode): + def __init__(self): + super(IntegerTypeNode, self).__init__("Int") + + +class ObjectTypeNode(TypeNode): + def __init__(self): + super(ObjectTypeNode, self).__init__("Object") + + +class VoidTypeNode(TypeNode): + def __init__(self): + super(VoidTypeNode, self).__init__("Void") + + +class ClassDef(DeclarationNode): + def __init__(self, idx, features, line, colum, parent="Object"): + self.idx: str = idx + self.features: List[Union[MethodDef, AttributeDef]] = features + self.parent: str = parent + self.line = line + self.column = colum - len(idx) + + +class VariableCall(ExpressionNode): + def __init__(self, idx, line, column): + self.idx: str = idx + self.line = line + self.column = column + + +class GreaterThanNode(BinaryNode): + def __init__(self, left, right, line, column): + super(GreaterThanNode, self).__init__(left, right, line, column) + + +class LowerThanNode(BinaryNode): + def __init__(self, left, right, line, column): + super(LowerThanNode, self).__init__(left, right, line, column) + + +class EqualToNode(BinaryNode): + def __init__(self, left, right, line, column): + super().__init__(left, right, line, column) + + +class LowerEqual(BinaryNode): + def __init__(self, left, right, line, column): + super().__init__(left, right, line, column) + + +class GreaterEqualNode(BinaryNode): + def __init__(self, left, right, line, column): + super().__init__(left, right, line, column) + + +class NotNode(AtomicNode): + def __init__(self, lex, line, column): + super().__init__(lex) + self.line = line + self.column = column + + +class NegNode(AtomicNode): + def __init__(self, lex, line, column): + super().__init__(lex) + self.line = line + self.column = column + + +class InstantiateClassNode(ExpressionNode): + def __init__(self, type_, line, column, args=None): + self.type_: str = type_ + self.args = args + self.line = line + self.column = column + + +class WhileBlockNode(ExpressionNode): + def __init__(self, cond, statements, line, column): + super().__init__(line, column) + self.cond: ExpressionNode = cond + self.statements: ExpressionNode = statements + + +class ActionNode(ExpressionNode): + def __init__(self, idx, typex, expresion, line, column): + self.actions: ExpressionNode = expresion + self.idx: str = idx + self.typex: str = typex + self.line = line + self.column = column + + +class CaseNode(ExpressionNode): + def __init__(self, expression, actions, line, column): + self.expression: ExpressionNode = expression + self.actions: List[ActionNode] = actions + self.line = line + self.column = column + + +class BlockNode(ExpressionNode): + def __init__(self, expressions, line, column): + self.expressions: List[ExpressionNode] = expressions + self.line = line + self.column = column + + +class IsVoidNode(ExpressionNode): + def __init__(self, expr, line, column): + super().__init__(line, column) + self.expr: ExpressionNode = expr + + +class SelfNode(ExpressionNode): + def __init__(self, line, column) -> None: + self.line = line + self.column = column \ No newline at end of file diff --git a/src/automatons/.ipynb_checkpoints/transformation-checkpoint.py b/src/automatons/.ipynb_checkpoints/transformation-checkpoint.py new file mode 100755 index 00000000..0f53b841 --- /dev/null +++ b/src/automatons/.ipynb_checkpoints/transformation-checkpoint.py @@ -0,0 +1,15 @@ +from deterministic import DFA +from nondeterministic import NFA +from tools.firsts import ContainerSet + +def compute_epsilon_closure(automaton: NFA, states): + pending = list(states) + closure = set(states) + + while pending: + state = pending.pop() + for nstate in automaton.epsilon_transitions(state): + closure.add(nstate) + pending.append(nstate) + + return closure diff --git a/src/automatons/__init__.py b/src/automatons/__init__.py new file mode 100755 index 00000000..70c8b193 --- /dev/null +++ b/src/automatons/__init__.py @@ -0,0 +1,9 @@ + +def setup(): + import os + from sys import path + BASE = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + path.append(BASE) + +if __name__ == '__main__': + setup() \ No newline at end of file diff --git a/src/automatons/deterministic.py b/src/automatons/deterministic.py new file mode 100755 index 00000000..e96549b3 --- /dev/null +++ b/src/automatons/deterministic.py @@ -0,0 +1,37 @@ +from automatons.nondeterministic import NFA + + +class DFA(NFA): + """ + Esta clase extiende la clase `NFA` para: + - Usar la función de transición propia de los autómatas finitos deterministas. + - Implementar un algoritmo de reconocimiento de cadenas. + """ + + def __init__(self, states, finals, transitions, start=0): + assert all(isinstance(value, int) for value in transitions.values()) + assert all(len(symbol) > 0 for origin, symbol in transitions) + + transitions = {key: [value] for key, value in transitions.items()} + NFA.__init__(self, states, finals, transitions, start) + self.current = start + + def epsilon_transitions(self): + raise TypeError() + + def _move(self, symbol): + try: + self.current = self.transitions[self.current][symbol][0] + return True + except KeyError: + return False + + def _reset(self): + self.current = self.start + + def recognize(self, string): + self.current = self.start + for c in string: + if not self._move(c): + return False + return self.current in self.finals diff --git a/src/automatons/nondeterministic.py b/src/automatons/nondeterministic.py new file mode 100755 index 00000000..144ba1c0 --- /dev/null +++ b/src/automatons/nondeterministic.py @@ -0,0 +1,42 @@ +class NFA: + """ + Un autómata finito (determinista o no determinista) es un quíntuplo $A = $ con + las siguientes características: + + -Q es un conjunto finito de estados Q = { q_0, .... , q_n }, de ahí el adjetivo de **finito**. + -q_0 in Q es el estado inicial. + -V es un conjunto finito de símbolos que pueden aparecer en la cinta. + -F Q es un subconjunto de estados que denominaremos *estados finales*. + -f es una *función de transición*, que determina, para cada par posible de estados y símbolos, + cuál es el estado de destino. En la forma de esta función radica justamente la diferencia entre + AF determinista y no determinista: + -f: Q * V -> Q denota un autómata **determinista** justamente porque en un estado particular, + para un símbolo particular, existe solamente un estado posible de destino (o ninguno), + por lo tanto, siempre existe una única decisión que tomar. + -f: Q *(V U e) -> 2^Q denota un autómata **no determinista** porque en un estado particular, + para un símbolo particular, existen potencialmente múltiples estados de destino (o ninguno). + Incluso permite realizar epsilon-transiciones (transiciones que no consumen símbolos de la cinta) + lo cual resalta aún más el carácter no determinista de estos autómatas. + """ + def __init__(self, states, finals, transitions, start=0): + self.states = states + self.start = start + self.finals = set(finals) + self.map = transitions + self.vocabulary = set() + self.transitions = {state: {} for state in range(states)} + + for (origin, symbol), destinations in transitions.items(): + assert hasattr(destinations, + '__iter__'), 'Invalid collection of states' + self.transitions[origin][symbol] = destinations + self.vocabulary.add(symbol) + + self.vocabulary.discard('') + + def epsilon_transitions(self, state): + assert state in self.transitions, 'Invalid state' + try: + return self.transitions[state][''] + except KeyError: + return () diff --git a/src/automatons/operations.py b/src/automatons/operations.py new file mode 100755 index 00000000..5b45f06f --- /dev/null +++ b/src/automatons/operations.py @@ -0,0 +1,89 @@ +from automatons.nondeterministic import NFA + + +def automata_union(a1: NFA, a2: NFA): + transitions = {} + start = 0 + d1 = 1 + d2 = a1.states + d1 + u = a2.states + d2 + + for src, d in a1.transitions.items(): + for symbol, dest in d.items(): + transitions[src + d1, symbol] = [state + d1 for state in dest] + + for src, d in a2.transitions.items(): + for symbol, dest in d.items(): + transitions[src + d2, symbol] = [state + d2 for state in dest] + + transitions[start, ''] = [a1.start + d1, a2.start + d2] + + for dx, S in zip([d1, d2], [a1.finals, a2.finals]): + for z in S: + try: + eps_trans = transitions[z + dx, ''] + except KeyError: + eps_trans = transitions[z + dx, ''] = [] + eps_trans.append(u) + + states = a1.states + a2.states + 2 + finals = {u} + return NFA(states, finals, transitions, start) + + +def automata_concatenation(a1, a2): + transitions = {} + start = 0 + d1 = 0 + d2 = a1.states + d1 + u = a2.states + d2 + + for src, d in a1.transitions.items(): + for symbol, dest in d.items(): + transitions[src + d1, symbol] = [state + d1 for state in dest] + + for src, d in a2.transitions.items(): + for symbol, dest in d.items(): + transitions[src + d2, symbol] = [state + d2 for state in dest] + + for z in a1.finals: + try: + eps_trans = transitions[z + d1, ''] + except KeyError: + eps_trans = transitions[z + d1, ''] = [] + eps_trans.append(a2.start + d2) + + for z in a2.finals: + try: + eps_trans = transitions[z + d2, ''] + except KeyError: + eps_trans = transitions[z + d2, ''] = [] + eps_trans.append(u) + + states = a1.states + a2.states + 2 + finals = {u} + return NFA(states, finals, transitions, start) + + +def automata_closure(a1): + transitions = {} + start = 0 + d1 = 1 + u = a1.states + d1 + + for A, d in a1.transitions.items(): + for b, O in d.items(): + transitions[A + d1, b] = [F + d1 for F in O] + transitions[start, ''] = [a1.start + d1, u] + + for z in a1.finals: + try: + X = transitions[z + d1, ''] + except KeyError: + X = transitions[z + d1, ''] = [] + X.append(u) + X.append(a1.start + d1) + + states = a1.states + 2 + finals = {u} + return NFA(states, finals, transitions, start) diff --git a/src/automatons/state.py b/src/automatons/state.py new file mode 100755 index 00000000..8fba8785 --- /dev/null +++ b/src/automatons/state.py @@ -0,0 +1,146 @@ +class State: + def __init__(self, state, final=False): + self.state = state + self.final = final + self.transitions = {} + self.epsilon_transitions = set() + self.tag = None + + def has_transition(self, symbol): + return symbol in self.transitions + + def add_transition(self, symbol, state): + try: + self.transitions[symbol].append(state) + except Exception: + self.transitions[symbol] = [state] + return self + + def add_epsilon_transition(self, state): + self.epsilon_transitions.add(state) + return self + + def recognize(self, string): + states = self.epsilon_closure + for symbol in string: + states = self.move_by_state(symbol, *states) + states = self.epsilon_closure_by_state(*states) + return any(s.final for s in states) + + def to_deterministic(self): + closure = self.epsilon_closure + start = State(tuple(closure), any(s.final for s in closure)) + + closures = [closure] + states = [start] + pending = [start] + + while pending: + state = pending.pop() + symbols = {symbol for s in state.state for symbol in s.transitions} + + for symbol in symbols: + move = self.move_by_state(symbol, *state.state) + closure = self.epsilon_closure_by_state(*move) + + if closure not in closures: + new_state = State(tuple(closure), + any(s.final for s in closure)) + closures.append(closure) + states.append(new_state) + pending.append(new_state) + else: + index = closures.index(closure) + new_state = states[index] + + state.add_transition(symbol, new_state) + + return start + + @staticmethod + def from_nfa(nfa, get_states=False): + states = [] + for n in range(nfa.states): + state = State(n, n in nfa.finals) + states.append(state) + + for origin, dest in nfa.transitions.items(): + for symbol, destinations in dest.items(): + src = states[origin] + src[symbol] = [states[d] for d in destinations] + + if get_states: + return states[nfa.start], states + return states[nfa.start] + + @staticmethod + def move_by_state(symbol, *states): + return { + s + for state in states if state.has_transition(symbol) + for s in state[symbol] + } + + @staticmethod + def epsilon_closure_by_state(*states): + closure = {state for state in states} + + l = 0 + while l != len(closure): + l = len(closure) + tmp = [s for s in closure] + for s in tmp: + for epsilon_state in s.epsilon_transitions: + closure.add(epsilon_state) + return closure + + @property + def epsilon_closure(self): + return self.epsilon_closure_by_state(self) + + @property + def name(self): + return str(self.state) if isinstance(self.state, int) else\ + '\n'.join([str(x) for x in self.state]) + + def __getitem__(self, symbol): + if symbol == '': + return self.epsilon_transitions + try: + return self.transitions[symbol] + except KeyError: + return None + + def __setitem__(self, symbol, value): + if symbol == '': + self.epsilon_transitions = value + else: + self.transitions[symbol] = value + + def __repr__(self): + return str(self) + + def __str__(self): + return str(self.state) + + def __hash__(self): + return hash(frozenset(self.state)) if not isinstance(self.state, int) else\ + hash(self.state) + + def __iter__(self): + yield from self._visit() + + def _visit(self, visited=None): + if visited is None: + visited = set() + elif self in visited: + return + + visited.add(self) + yield self + + for destinations in self.transitions.values(): + for node in destinations: + yield from node._visit(visited) + for node in self.epsilon_transitions: + yield from node._visit(visited) diff --git a/src/automatons/transformation.py b/src/automatons/transformation.py new file mode 100755 index 00000000..50de0b0c --- /dev/null +++ b/src/automatons/transformation.py @@ -0,0 +1,56 @@ +from automatons.deterministic import DFA +from automatons.nondeterministic import NFA +from tools.firsts import ContainerSet + + +def compute_epsilon_closure(automaton: NFA, states): + pending = list(states) + closure = set(states) + + while pending: + state = pending.pop() + for nstate in automaton.epsilon_transitions(state): + if nstate not in closure: + closure.add(nstate) + pending.append(nstate) + + return ContainerSet(*closure) + + +def nfa_to_deterministic(automaton: NFA): + transitions = {} + start = compute_epsilon_closure(automaton, [automaton.start]) + start.state = 0 + pending = [start] + aut_states = [start] + start.is_final = any(s in automaton.finals for s in start) + n = 1 + while pending: + state = pending.pop() + for symbol in automaton.vocabulary: + next_state = [] + for s in state: + next_state += [ + x + for x in automaton.transitions.get(s, {}).get(symbol, []) + ] + if next_state: + try: + transitions[state.state, symbol] + assert False, "Automato Finito Determinista Invalido" + except KeyError: + next_state = compute_epsilon_closure(automaton, next_state) + if next_state not in aut_states: + next_state.state = n + next_state.is_final = any(s in automaton.finals + for s in next_state) + pending.append(next_state) + aut_states.append(next_state) + n += 1 + else: + next_state = aut_states[aut_states.index(next_state)] + transitions[state.state, symbol] = next_state.state + + finals = [s.state for s in aut_states if s.is_final] + dfa = DFA(n, finals, transitions) + return dfa diff --git a/src/baseNodeTree/__init__.py b/src/baseNodeTree/__init__.py new file mode 100755 index 00000000..70c8b193 --- /dev/null +++ b/src/baseNodeTree/__init__.py @@ -0,0 +1,9 @@ + +def setup(): + import os + from sys import path + BASE = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + path.append(BASE) + +if __name__ == '__main__': + setup() \ No newline at end of file diff --git a/src/baseNodeTree/astprinter.py b/src/baseNodeTree/astprinter.py new file mode 100755 index 00000000..d904d4a1 --- /dev/null +++ b/src/baseNodeTree/astprinter.py @@ -0,0 +1,29 @@ +import tools.visitor as visitor + + +def get_printer(AtomicNode=(), UnaryNode=(), BinaryNode=(), ): + + class PrintVisitor(object): + @visitor.on('node') + def visit(self, node, tabs): + pass + + @visitor.when(UnaryNode) + def visit(self, node, tabs=0): + ans = '\t' * tabs + f'\\__ {node.__class__.__name__}' + child = self.visit(node.node, tabs + 1) + return f'{ans}\n{child}' + + @visitor.when(BinaryNode) + def visit(self, node, tabs=0): + ans = '\t' * 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(AtomicNode) + def visit(self, node, tabs=0): + return '\t' * tabs + f'\\__ {node.__class__.__name__}: {node.lex}' + + printer = PrintVisitor() + return (lambda ast: printer.visit(ast)) diff --git a/src/baseNodeTree/base.py b/src/baseNodeTree/base.py new file mode 100755 index 00000000..60b824ed --- /dev/null +++ b/src/baseNodeTree/base.py @@ -0,0 +1,36 @@ +class Node: + def evaluate(self): + raise NotImplementedError() + + +class AtomicNode(Node): + def __init__(self, lex): + self.lex = lex + + +class UnaryNode(Node): + def __init__(self, node): + self.node = node + + def evaluate(self): + value = self.node.evaluate() + return self.operate(value) + + @staticmethod + def operate(value): + raise NotImplementedError() + + +class BinaryNode(Node): + def __init__(self, left, right): + self.left = left + self.right = right + + def evaluate(self): + lvalue = self.left.evaluate() + rvalue = self.right.evaluate() + return self.operate(lvalue, rvalue) + + @staticmethod + def operate(lvalue, rvalue): + raise NotImplementedError() diff --git a/src/cil/__init__.py b/src/cil/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/src/cil/baseCilVisitor.py b/src/cil/baseCilVisitor.py new file mode 100644 index 00000000..7bfe9c98 --- /dev/null +++ b/src/cil/baseCilVisitor.py @@ -0,0 +1,415 @@ +import re +from typing import List, Optional, Any, Dict, Tuple +from abstract.tree import ClassDef +import cil.nodes as nodes +from abstract.semantics import Attribute, VariableInfo, Context, Type, Method +from cil.nodes import ( + AbortNode, AllocateIntNode, + AllocateStringNode, + ConcatString, + CopyNode, + GetAttributeNode, + PrintIntNode, + PrintNode, + ReadIntNode, + ReadNode, + ReturnNode, + SelfNode, + SubstringNode, + TypeName, + TypeNode, +) + +TDT = Dict[Tuple[str, str], int] + + +# Esta clase no debe ser utilizada directamente en el desarrollo del compilador. +# Solo esta pensada para dar soporte a un grafo que represente la jerarquia de +# clases de Cool, sobre la cual se construira una tabla LCA para poder consultar +# la jerarquia en runtime. InheritanceGraph representa grafos no dirigidos ya que +# las restricciones de Cool permiten hacer transformaciones al Grafo Dirigido que +# se obtiene de la jerarquia de clases para trabajar sobre arboles. +class InheritanceGraph: + def __init__(self): + # Lista de adyacencia del grafo + self._adytable: Dict[str, List[str]] = {} + + # Tabla LCA + self.tdt: TDT = {} + + self._discover: Dict[str, int] = {} + self._finalization: Dict[str, int] = {} + self.__time = 0 + self.root_distance: Dict[str, int] = {} + + def add_edge(self, parent: str, child: str) -> None: + # Agregar una arista a la lista de adyacencia. + try: + # Caso de que se hallan inicializado las listas de cada nodo. + self._adytable[parent].append(child) + except KeyError: + # Hay k inicializar las listas de cada nodo. + self._adytable[parent] = [child] + try: + self._adytable[child].append(parent) + except KeyError: + self._adytable[child] = [parent] + + def __ancestor(self, node_x: str, node_y: str) -> bool: + # Devuelve true si x es ancestro de y. + # Para realizar este calculo nos basamos en el arbol + # construido por el DFS, y tenemos en cuenta los tiempos + # de descubrimiento y finalizacion + return ( + self._discover[node_x] + < self._discover[node_y] + < self._finalization[node_y] + < self._finalization[node_x] + ) + + def __distance_from(self, node_x: str, node_y: str) -> int: + # Si x es ancestro de y, entonces la distancia entre ellos + # se calcula como d[y] - d[x], si x no es ancenstro de y, + # entonces podemos definir la distancia entre ellos como infinito + if self.__ancestor(node_x, node_y): + return self.root_distance[node_y] - self.root_distance[node_x] + else: + return -1 + + def __dfs(self, root: str, visited: Dict[str, bool], deep=0): + visited[root] = True + self._discover[root] = self.__time + self.root_distance[root] = deep + self.__time += 1 + + for v in self._adytable[root]: + if not visited[v]: + self.__dfs(v, visited, deep + 1) + self.__time += 1 + self._finalization[root] = self.__time + + def tp_sort(self, root: str, visited: Dict[str, bool], result): + visited[root] = True + for v in self._adytable[root]: + if not visited[v]: + self.tp_sort(v, visited, result) + result.append(root) + + def build_tdt(self): + # Construir una tabla de distancia para cada Nodo del arbol. + # En dicha tabla, tdt[x, y] = d donde d es la distancia entre + # el nodo x y el nodo y, si x es ancestro de y, entonces d >= 1, + # si x == y, d = 0 y d = -1 en otro caso + visited = {node: False for node in self._adytable} + + # Realizar un recorrido dfs para inicializar los array d y f + root = "Object" + self.__dfs(root, visited) + + # Construir la tabla + for nodex in self._adytable: + for nodey in self._adytable: + if nodey == nodex: + self.tdt[(nodex, nodey)] = 0 + else: + self.tdt[(nodex, nodey)] = self.__distance_from(nodex, nodey) + + +class BaseCoolToCilVisitor: + """ + Clase base para el visitor que transforma un AST de COOL en un AST de CIL. + """ + + def __init__(self, context: Context): + self.dot_types: List[nodes.TypeNode] = [] + self.dot_data: List[Any] = [] + self.dot_code: List[nodes.FunctionNode] = [] + self.context: Context = context + self.current_type: Optional[Type] = None + self.current_method: Optional[Method] = None + self.current_function: Optional[nodes.FunctionNode] = None + self.null = self.register_data('""') + self.abortion = self.register_data('"Abort called from class "') + self.newLine = self.register_data(r'"\n"') + self.__inheritance_graph = None + self.__labels_count: int = 0 + self.__build_CART() + self.build_builtins() + + def topological_sort_classDefs(self, classdef: List[ClassDef]): + visited = {x: False for x in self.__inheritance_graph._adytable} + result = [] + self.__inheritance_graph.tp_sort("Object", visited, result) + l = [x for x in result if x in [y.idx for y in classdef]] + l = [next(c for c in classdef if c.idx == x) for x in l] + return list(reversed(l)) + + @property + def params(self) -> List[nodes.ParamNode]: + # Obtener los parametros de la funcion que esta actualmente en construccion + assert self.current_function is not None + return self.current_function.params + + @property + def localvars(self) -> List[nodes.LocalNode]: + # Obtener las variables locales definidas en la funcion que esta actualmente en construccion + assert self.current_function is not None + return self.current_function.localvars + + @property + def instructions(self) -> List[nodes.InstructionNode]: + # Obtiene las instrucciones de la funcion que esta actualmente en construccion + assert self.current_function is not None + return self.current_function.instructions + + def register_params(self, vinfo: VariableInfo) -> nodes.ParamNode: + # Registra un parametro en la funcion en construccion y devuelve el nombre procesado del parametro + assert self.current_function is not None + name = f"param_{self.current_function.name[9:]}_{vinfo.name}_{len(self.params)}" + param_node: nodes.ParamNode = nodes.ParamNode(name) + self.params.append(param_node) + return param_node + + def register_local(self, vinfo: VariableInfo) -> nodes.LocalNode: + assert self.current_function is not None + name = ( + f"local_{self.current_function.name[9:]}_{vinfo.name}_{len(self.localvars)}" + ) + local_node = nodes.LocalNode(name) + self.localvars.append(local_node) + return local_node + + def define_internal_local(self) -> nodes.LocalNode: + vinfo = VariableInfo("internal") + return self.register_local(vinfo) + + def to_function_name(self, method_name: str, type_name: str) -> str: + return f"function_{method_name}_at_{type_name}" + + def register_instruction( + self, instruction: nodes.InstructionNode + ) -> nodes.InstructionNode: + self.instructions.append(instruction) + return instruction + + def register_function(self, function_name: str) -> nodes.FunctionNode: + function_node = nodes.FunctionNode(function_name, [], [], []) + self.dot_code.append(function_node) + return function_node + + def register_type(self, name: str) -> nodes.TypeNode: + type_node = nodes.TypeNode(name) + self.dot_types.append(type_node) + return type_node + + def register_data(self, value: Any) -> nodes.DataNode: + vname = f"data_{len(self.dot_data)}" + data_node = nodes.DataNode(vname, value) + self.dot_data.append(data_node) + return data_node + + def do_label(self, label: str) -> str: + self.__labels_count += 1 + return f"label_{label}_{self.__labels_count}" + + def __build_CART(self) -> None: + """ + CART: Context Aware Runtime Table.\ + Esta estructura almacena datos relacionados con la jerarquia de clases definida en el programa. CART se debe almacenar \ + en la seccion .DATA y sera usada por metodos relacionados con chequeo de tipos en tiempo de ejecucion. La estructura es una \ + TDT (type distance table), donde dadas dos clases A y B, CART[A, B] = d donde d es la distancia entre la clase A y \ + la clase B, si la clase A es ancestro de la clase B en la jerarquia de tipos, 0 si A = B y -1 en otro caso. + """ + + # Crear el grafo de herencia basado en el contexto que tenemos hasta el momento. + graph = InheritanceGraph() + for itype in self.context.types: + if self.context.types[itype].parent is not None: + graph.add_edge( + self.context.types[itype].parent.name, itype + ) # type: ignore + + # Crear la TDT + self.__inheritance_graph = graph + graph.build_tdt() + self.tdt_table = graph.tdt + + # Procesar la TDT para hacerla accesible en runtime. + self.tdt_data_node = self.register_data(self.tdt_table) + + def __implement_out_string(self): + # Registrar el parametro que espera la funcion + self.current_function = self.register_function("function_out_string_at_IO") + param = self.register_params( + VariableInfo("x", self.context.get_type("String"), "PARAM") + ) + self__ = self.define_internal_local() + # Esta funcion espera que se llame con un argumento que apunta + # a la direccion de memoria de un string, luego solo realiza + # los procedimientos necesarios para imprimir en consola + # dicho string. Creamos el nodo PrintNode y dejamos la + # implementacion y la llamada a sistema a MIPS + self.register_instruction(PrintNode(param)) + # retornar self + self.register_instruction(SelfNode(self__)) + self.register_instruction(ReturnNode(self__)) + self.current_function = None + + def __implement_out_int(self): + # Registrar el parametro que espera la funcion y la + # funcion como tal + self.current_function = self.register_function("function_out_int_at_IO") + param = self.register_params( + VariableInfo("x", self.context.get_type("Int"), "PARAM") + ) + self__ = self.define_internal_local() + + # Espera como unico parametro un entero. + self.register_instruction(PrintIntNode(param)) + # retornar self + self.register_instruction(SelfNode(self__)) + self.register_instruction(ReturnNode(self__)) + self.current_function = None + + def __implement_in_string(self): + # Registrar la funcion + self.current_function = self.register_function("function_in_string_at_IO") + # Declarar una variable para devolver el valor + return_vm_holder = self.define_internal_local() + # Registrar el nodo que realiza el trabajo en MIPS + self.register_instruction(ReadNode(return_vm_holder)) + self.register_instruction(ReturnNode(return_vm_holder)) + self.current_function = None + + def __implement_in_int(self): + # Registrar la funcion + self.current_function = self.register_function("function_in_int_at_IO") + # Declarar una variable para devolver el valor + return_vm_holder = self.define_internal_local() + self.register_instruction(ReadIntNode(return_vm_holder)) + self.register_instruction(ReturnNode(return_vm_holder)) + self.current_function = None + + def __implement_abort(self): + # la funcion abort no recibe ningun paramentro + # Simplemente llama trap y le pasa la causa "abortion" + self.current_function = self.register_function("function_abort_at_Object") + return_expr_vm_holder = self.define_internal_local() + self.register_instruction(TypeName(return_expr_vm_holder)) + self.register_instruction( + AbortNode(return_expr_vm_holder, self.abortion, self.newLine) + ) + self.current_function = None + + def __implement_copy(self): + # La funcion copy es llamada sore un objeto + # para obtener una copia superficial de la misma, + # o sea, que se copia el propio objeto, pero no + # recursivamente algun objeto que este pueda contener + self.current_function = self.register_function("function_copy_at_Object") + # Obtener una referencia al objeto que queremos clonar + self_vm_holder = self.define_internal_local() + clone_vm_holder = self.define_internal_local() + self.register_instruction(SelfNode(self_vm_holder)) + self.register_instruction(CopyNode(self_vm_holder, clone_vm_holder)) + self.register_instruction(ReturnNode(clone_vm_holder)) + self.current_function = None + + def __implement_type_name(self): + self.current_function = self.register_function("function_type_name_at_Object") + return_vm_holder = self.define_internal_local() + self.register_instruction(TypeName(return_vm_holder)) + self.register_instruction(ReturnNode(return_vm_holder)) + + def __implement_concat(self): + self.current_function = self.register_function("function_concat_at_String") + return_vm_holder = self.define_internal_local() + param = self.register_params( + VariableInfo("s", self.context.get_type("String"), "PARAM") + ) + self.register_instruction(ConcatString(return_vm_holder, param)) + self.register_instruction(ReturnNode(return_vm_holder)) + + def __implement_substr(self): + self.current_function = self.register_function("function_substr_at_String") + return_vm_holder = self.define_internal_local() + paraml = self.register_params( + VariableInfo("l", self.context.get_type("Int"), "PARAM") + ) + paramr = self.register_params( + VariableInfo("r", self.context.get_type("Int"), "PARAM") + ) + + self.register_instruction(SubstringNode(return_vm_holder, paraml, paramr)) + + # Declarar un string vacio y rellenar la instancia + self.register_instruction(ReturnNode(return_vm_holder)) + + def __implement_length(self): + str_ = self.context.get_type("String") + self.current_function = self.register_function("function_length_at_String") + return_vm_holder = self.define_internal_local() + int_const_vm_holder = self.define_internal_local() + self.register_instruction(GetAttributeNode(str_, "length", return_vm_holder)) + self.register_instruction(AllocateIntNode(int_const_vm_holder, return_vm_holder)) + self.register_instruction(ReturnNode(int_const_vm_holder)) + + def build_builtins(self): + + # Registrar el tipo IO como un tipo instanciable + io_typeNode = self.register_type("IO") + obj = self.register_type("Object") + str_ = self.register_type("String") + str__ = self.context.get_type("String") + + bool_ = self.register_type("Bool") + bool__ = self.context.get_type("Bool") + + int_ = self.register_type("Int") + + io_typeNode.methods.append(("abort", "function_abort_at_Object")) + io_typeNode.methods.append(("type_name", "function_type_name_at_Object")) + io_typeNode.methods.append(("copy", "function_copy_at_Object")) + io_typeNode.methods.append(("out_string", "function_out_string_at_IO")) + io_typeNode.methods.append(("out_int", "function_out_int_at_IO")) + io_typeNode.methods.append(("in_string", "function_in_string_at_IO")) + io_typeNode.methods.append(("in_int", "function_in_int_at_IO")) + + obj.methods.append(("abort", "function_abort_at_Object")) + obj.methods.append(("type_name", "function_type_name_at_Object")) + obj.methods.append(("copy", "function_copy_at_Object")) + + bool_.methods.append(("abort", "function_abort_at_Object")) + bool_.methods.append(("type_name", "function_type_name_at_Object")) + bool_.methods.append(("copy", "function_copy_at_Object")) + + str_.methods.append(("abort", "function_abort_at_Object")) + str_.methods.append(("type_name", "function_type_name_at_Object")) + str_.methods.append(("copy", "function_copy_at_Object")) + str_.methods.append(("concat", "function_concat_at_String")) + str_.methods.append(("substr", "function_substr_at_String")) + str_.methods.append(("length", "function_length_at_String")) + + int_.methods.append(("abort", "function_abort_at_Object")) + int_.methods.append(("type_name", "function_type_name_at_Object")) + int_.methods.append(("copy", "function_copy_at_Object")) + + str_.attributes.append(Attribute("value", str__)) + str_.attributes.append(Attribute("length", self.context.get_type("Int"))) + + bool__.attributes.append(Attribute("value", self.context.get_type("Int"))) + bool__.attributes.append(Attribute("value", self.context.get_type("Int"))) + + str__.attributes.append(Attribute("value", str__)) + str__.attributes.append(Attribute("length", self.context.get_type("Int"))) + + self.__implement_in_string() + self.__implement_out_int() + self.__implement_out_string() + self.__implement_in_int() + self.__implement_abort() + self.__implement_copy() + self.__implement_type_name() + self.__implement_concat() + self.__implement_substr() + self.__implement_length() diff --git a/src/cil/nodes.py b/src/cil/nodes.py new file mode 100644 index 00000000..cca5c166 --- /dev/null +++ b/src/cil/nodes.py @@ -0,0 +1,377 @@ +from __future__ import annotations +from typing import List, Tuple, Union +from abstract.semantics import Attribute, Method, Type +""" +Define a hierachy to represent each CIL instruction. +Every CIL Instruction would be a Node of an AST, and every\ +node would known how to generate its corresponding MIPS Code. +""" + + +class CilNode: + pass + + +class BuiltInNode(CilNode): + def __init__(self, dest: LocalNode) -> None: + self.dest = dest + + +class CilProgramNode(CilNode): + def __init__(self, dottypes, dotdata, dotcode): + self.dottypes: List[TypeNode] = dottypes + self.dotdata: List[DataNode] = dotdata + self.dotcode: List[FunctionNode] = dotcode + + +class TypeNode(CilNode): + def __init__(self, name: str): + self.name = name + self.attributes: List[Attribute] = [] + self.methods: List[Tuple[str, str]] = [] + + +class DataNode(CilNode): + def __init__(self, vname: str, value): + self.name = vname + self.value = value + + +class FunctionNode(CilNode): + def __init__(self, fname, params, lvars, instr): + self.name = fname + self.params: List[ParamNode] = params + self.localvars = lvars + self.instructions = instr + + +class ParamNode(CilNode): + def __init__(self, name): + self.name = name + + +class LocalNode(CilNode): + def __init__(self, name): + self.name = name + + +class InstructionNode(CilNode): + pass + + +class ArithmeticNode(InstructionNode): + def __init__(self, dest, left, right): + self.dest = dest + self.left = left + self.right = right + + +class AssignNode(InstructionNode): + def __init__(self, dest, source): + self.dest = dest + self.source = source + + +class PlusNode(ArithmeticNode): + pass + + +class MinusNode(ArithmeticNode): + def __init__(self, x: Union[LocalNode, int, ParamNode], + y: Union[LocalNode, int, ParamNode], dest: LocalNode): + self.x = x + self.y = y + self.dest = dest + + +class StarNode(ArithmeticNode): + def __init__(self, x: LocalNode, y: LocalNode, dest: LocalNode): + self.x = x + self.y = y + self.dest = dest + + +class DivNode(ArithmeticNode): + pass + + +class GetAttributeNode(InstructionNode): + def __init__(self, itype: Type, attrname: str, dest: LocalNode): + self.itype = itype + self.attrname = attrname + self.dest = dest + + +class SetAttributeNode(InstructionNode): + def __init__(self, itype: Type, attrname: str, source: LocalNode): + self.source = source + self.itype = itype + self.attrname = attrname + + +class GetIndexNode(InstructionNode): + pass + + +class SetIndexNode(InstructionNode): + pass + + +class AllocateNode(InstructionNode): + def __init__(self, itype: Type, dest: LocalNode): + self.itype = itype + self.dest = dest + + +class ArrayNode(InstructionNode): + pass + + +class TypeOffsetNode(InstructionNode): + def __init__(self, variable: Union[LocalNode, ParamNode], dest: LocalNode): + self.variable = variable + self.dest = dest + + +class LabelNode(InstructionNode): + def __init__(self, label: str): + self.label: str = label + + +class JumpIfGreaterThanZeroNode(InstructionNode): + def __init__(self, variable: LocalNode, label: str): + self.label = label + self.variable = variable + + +class IfZeroJump(InstructionNode): + def __init__(self, variable: LocalNode, label: str): + self.variable = variable + self.label = label + + +class NotZeroJump(InstructionNode): + def __init__(self, variable: LocalNode, label: str): + self.variable = variable + self.label = label + + +class UnconditionalJump(InstructionNode): + def __init__(self, label: str): + self.label: str = label + + +class StaticCallNode(InstructionNode): + def __init__(self, obj: LocalNode, type_: Type, function: str, dest: LocalNode): + self.function = function + self.dest = dest + self.obj = obj + self.type_ = type_ + + +class DynamicCallNode(InstructionNode): + def __init__(self, xtype: LocalNode, method: str, dest: LocalNode): + self.xtype = xtype + self.method = method + self.dest = dest + + +class ArgNode(InstructionNode): + def __init__(self, name): + self.name = name + + +class ReturnNode(InstructionNode): + def __init__(self, value=None): + self.value = value + + +class LoadNode(InstructionNode): + def __init__(self, dest: LocalNode, message: DataNode): + self.dest = dest + self.message = message + + +class InitSelfNode(InstructionNode): + def __init__(self, src: LocalNode) -> None: + self.src = src + + +class SubstringNode(InstructionNode): + def __init__(self, dest, l, r) -> None: + self.dest = dest + self.l = l + self.r = r + + +class ToStrNode(InstructionNode): + def __init__(self, dest, ivalue): + self.dest = dest + self.ivalue = ivalue + + +class ReadNode(InstructionNode): + def __init__(self, dest): + self.dest = dest + + +class ReadIntNode(InstructionNode): + def __init__(self, dest) -> None: + self.dest = dest + + +class PrintNode(InstructionNode): + def __init__(self, src) -> None: + self.src = src + + +class PrintIntNode(InstructionNode): + def __init__(self, src) -> None: + self.src = src + + +class TdtLookupNode(InstructionNode): + def __init__(self, index_varA: str, index_varB: LocalNode, + dest: LocalNode): + self.i = index_varA + self.j = index_varB + self.dest = dest + + +class GetTypeIndex(InstructionNode): + def __init__(self, itype: str, dest: str): + self.itype = itype + self.dest = dest + + +class SelfNode(InstructionNode): + def __init__(self, dest: LocalNode) -> None: + self.dest = dest + + +class NotNode(InstructionNode): + def __init__(self, src: LocalNode) -> None: + self.src = src + + +class CopyNode(InstructionNode): + def __init__(self, selfsrc: LocalNode, dest: LocalNode) -> None: + self.selfsrc = selfsrc + self.dest = dest + + +class TypeName(InstructionNode): + def __init__(self, dest: LocalNode) -> None: + self.dest = dest + + +class SaveSelf(InstructionNode): + pass + +class RestoreSelf(InstructionNode): + pass + + +class AllocateStringNode(InstructionNode): + def __init__(self, dest: LocalNode, value: DataNode, length: int) -> None: + self.dest = dest + self.value = value + self.length = length + + +class ConcatString(InstructionNode): + def __init__(self, dest: LocalNode, s: ParamNode) -> None: + self.dest = dest + self.s = s + + +class AbortNode(InstructionNode): + def __init__(self, calling, abortion, newLine) -> None: + self.src = calling + self.abortion = abortion + self.nl = newLine + + +class AllocateBoolNode(InstructionNode): + def __init__(self, dest: LocalNode, value: int) -> None: + self.dest = dest + self.value = value + + +class AllocateIntNode(InstructionNode): + def __init__(self, dest: LocalNode, value): + self.dest = dest + self.value = value + + +class JumpIfGreater(InstructionNode): + def __init__(self, src1: LocalNode, src2: LocalNode, label: str) -> None: + self.left = src1 + self.rigt = src2 + self.label = label + + +class BitwiseNotNode(InstructionNode): + def __init__(self, src, dest) -> None: + self.dest = dest + self.src = src + + +class EqualToCilNode(InstructionNode): + def __init__(self, left, right, dest) -> None: + self.left = left + self.right = right + self.dest = dest + + +class GetValue(InstructionNode): + def __init__(self, dest, src) -> None: + self.dest = dest + self.src = src + + +class CompareType(InstructionNode): + def __init__(self, dest, src, type_) -> None: + self.dest = dest + self.src = src + self.type = type_ + +class CompareSTRType(InstructionNode): + def __init__(self, dest, src) -> None: + self.dest = dest + self.src = src + + +class CompareStringLengthNode(InstructionNode): + def __init__(self, dest, left, rigth) -> None: + self.dest = dest + self.left = left + self.right = rigth + + +class ReferenceEqualNode(InstructionNode): + def __init__(self, left, right, dest): + self.dest = dest + self.right = right + self.left = left + +class CharToCharStringCompare(InstructionNode): + def __init__(self, dest, left, rigth, while_label, end_label) -> None: + self.dest = dest + self.left = left + self.right = rigth + self.while_label = while_label + self.end_label = end_label + + +class MinusNodeComp(InstructionNode): + def __init__(self, left, right, dest): + self.dest = dest + self.right = right + self.left = left + +class PureMinus(InstructionNode): + def __init__(self, left, right, dest): + self.dest = dest + self.right = right + self.left = left \ No newline at end of file diff --git a/src/comments.py b/src/comments.py new file mode 100644 index 00000000..40f9c7a6 --- /dev/null +++ b/src/comments.py @@ -0,0 +1,87 @@ +from typing import Any + +""" +Process a source file removing coments. +Because coments in COOL can be nested, there is +no regular expresion to represet them, so we have +to preprocess the file and strip them out. +""" + + +def find_comments(program: Any) -> str: + """ + This functions detects every comment in a Cool program\ + and replace it with empty lines. This is done in a way\ + so is posible for the other components of the\ + compiler to correctly detect errors on exact Line and\ + Column.\ + In Cool a comment can be of the form (*...*) or -- ending\ + with a newline. Comments can be nested, so there is no regular\ + expression to detect them. + """ + pairs = [] + stack = [] + line = 1 + column = 1 + program = list(program) + iter_char = iter(enumerate(program)) + while 1: + try: + i, char = next(iter_char) + column += 1 + if char == "\n": + line += 1 + column = 1 + elif char == "(": + i, char = next(iter_char) + column += 1 + if char == "*": + stack.append(i - 1) + elif char == "\n": + line += 1 + column = 1 + elif char == "*": + i, char = next(iter_char) + column += 1 + if char == ")": + first = stack.pop() + pairs.append((first, i)) + elif char == "\n": + line += 1 + column = 1 + except StopIteration: + break + assert not stack, "(%d, %d) - LexicographicError: EOF in comment" % (line, column) + + i = 0 + while i < len(program): + c = program[i] + if c =='-' and i > 0 and program[i - 1] != '<': + i += 1 + c = program[i] + if c == "-": + eol = "".join(program).find("\n", i) + for j in range(i - 1, eol): + program[j] = " " + i = eol + else: + i += 1 + elif c =='-' and i == 0: + i += 1 + c = program[i] + if c == "-": + eol = "".join(program).find("\n", i) + for j in range(i - 1, eol): + program[j] = " " + i = eol + else: + i += 1 + else: + i += 1 + + while pairs: + i, j = pairs.pop() + for k in range(i, j + 1): + if not program[k] == "\n": + program[k] = " " + return "".join(program) diff --git a/src/coolc.sh b/src/coolc.sh index 3088de4f..63ead30f 100755 --- a/src/coolc.sh +++ b/src/coolc.sh @@ -1,11 +1,13 @@ +#!/bin/bash # Incluya aquí las instrucciones necesarias para ejecutar su compilador INPUT_FILE=$1 OUTPUT_FILE=${INPUT_FILE:0: -2}mips +VERSION=0.2 # Release, Minor +BUILD=$(wc -l .builds | awk '{ print $1 }') # 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 - -# Llamar al compilador -echo "Compiling $INPUT_FILE into $OUTPUT_FILE" +echo "pycoolc: version $VERSION Developed by Eliane Puerta, Liset Alfaro, Adrian Gonzalez" +# echo "Build: $BUILD" +echo "Copyright (c) 2020 School of Math and Computer Science, University of Havana" +python pycoolc.py $INPUT_FILE diff --git a/src/coolgrammar/__init__.py b/src/coolgrammar/__init__.py new file mode 100755 index 00000000..e69de29b diff --git a/src/coolgrammar/grammar.py b/src/coolgrammar/grammar.py new file mode 100755 index 00000000..8dce1035 --- /dev/null +++ b/src/coolgrammar/grammar.py @@ -0,0 +1,471 @@ +""" +Contenedor para la funcion que construye la gramatica de cool. +""" +from grammar.grammar import Grammar +from abstract.tree import ( + ProgramNode, + ClassDef, + MethodDef, + AttributeDef, + Param, + SelfNode, + VariableDeclaration, +) +from abstract.tree import PlusNode, DivNode, MulNode, DifNode, IntegerConstant, FunCall +from abstract.tree import VariableCall, FalseConstant, StringConstant, TrueConstant +from abstract.tree import ( + GreaterEqualNode, + LowerThanNode, + LowerEqual, + AssignNode, + IfThenElseNode, +) +from abstract.tree import NotNode, WhileBlockNode, EqualToNode, InstantiateClassNode +from abstract.tree import ActionNode, CaseNode, ParentFuncCall, BlockNode, IsVoidNode +from abstract.tree import NegNode + +# from lexer.tokenizer import Lexer +from tknizer import Tokenizer + + +def build_cool_grammar(): + G = Grammar() + program = G.NonTerminal("", True) + + ( + class_list, + class_def, + empty_feature_list, + feature_list, + method_def, + ) = G.NonTerminals( + " " + ) + + attr_def, param_list, param, statement_list = G.NonTerminals( + " " + ) + + var_dec, args_list, instantiation = G.NonTerminals( + " " + ) + + exp, typex, term, factor, nested_lets, loop_statements = G.NonTerminals( + " " + ) + + arith, atom, actions, action, block, postfix = G.NonTerminals( + " " + ) + + args_list_empty, param_list_empty, case_statement, string_const = G.NonTerminals( + " " + ) + + class_keyword, def_keyword, in_keyword, self_ = G.Terminals("class def in self") + + ( + coma, + period, + dot_comma, + opar, + cpar, + obrack, + cbrack, + plus, + minus, + star, + div, + dd, + ) = G.Terminals(", . ; ( ) { } + - * / :") + + idx, let, intx, string, num, true, false, boolean, objectx, classid = G.Terminals( + "id let int string num true false bool object classid" + ) + + tilde_string_const, quoted_string_const, void, auto = G.Terminals( + "tilde_string_const quoted_string_const void AUTO_TYPE" + ) + + if_, then, else_, assign, new, case, of, esac = G.Terminals( + "if then else assign new case of esac" + ) + + gt, lt, ge, le, eq, not_, implies, isvoid, not_operator = G.Terminals( + "> < >= <= = ~ => isvoid not" + ) + + while_, do, inherits, arroba, fi, pool, loop = G.Terminals( + "while do inherits @ fi pool loop" + ) + + program %= class_list, lambda s: ProgramNode(s[1]) + + class_list %= class_def + dot_comma, lambda s: [s[1]] + class_list %= class_def + dot_comma + class_list, lambda s: [s[1]] + s[3] + + class_def %= ( + class_keyword + typex + obrack + empty_feature_list + cbrack, + lambda s: ClassDef(s[2].lex, s[4], s[2].token_line, s[2].token_column), + ) + + class_def %= ( + class_keyword + typex + inherits + typex + obrack + empty_feature_list + cbrack, + lambda s: ClassDef( + s[2].lex, s[6], s[2].token_line, s[2].token_column, s[4].lex + ), + ) + + feature_list %= method_def + dot_comma, lambda s: [s[1]] + + feature_list %= attr_def + dot_comma, lambda s: [s[1]] + + feature_list %= method_def + dot_comma + feature_list, lambda s: [s[1]] + s[3] + + feature_list %= attr_def + dot_comma + feature_list, lambda s: [s[1]] + s[3] + + empty_feature_list %= G.Epsilon, lambda s: [] + empty_feature_list %= feature_list, lambda s: s[1] + + method_def %= ( + idx + + opar + + param_list_empty + + cpar + + dd + + typex + + obrack + + statement_list + + cbrack, + lambda s: MethodDef( + s[1].lex, + s[3], + s[6].lex, + s[1].token_line, + s[1].token_column, + s[8], + s[7].token_column - (len(s[6].lex) + 2), + ), + ) + + attr_def %= idx + dd + typex, lambda s: AttributeDef( + s[1].lex, s[3].lex, s[1].token_line, s[1].token_column + ) + + attr_def %= idx + dd + typex + assign + exp, lambda s: AttributeDef( + s[1].lex, s[3].lex, s[1].token_line, s[1].token_column, s[5] + ) + + param_list_empty %= param_list, lambda s: s[1] + param_list_empty %= G.Epsilon, lambda s: [] + + param_list %= param, lambda s: [s[1]] + param_list %= param + coma + param_list, lambda s: [s[1]] + s[3] + + param %= idx + dd + typex, lambda s: Param( + s[1].lex, s[3].lex, s[1].token_line, s[1].token_column + ) + + statement_list %= exp, lambda s: s[1] + + # statement_list %= exp + dot_comma + statement_list, lambda s: [s[1]] + s[3] + + var_dec %= let + nested_lets + in_keyword + exp, lambda s: VariableDeclaration( + s[2], s[1].token_line, s[1].token_column - 3, s[4] + ) + + nested_lets %= idx + dd + typex, lambda s: [ + (s[1].lex, s[3].lex, None, s[3].token_line, s[3].token_column - len(s[3].lex)) + ] + + nested_lets %= ( + idx + dd + typex + coma + nested_lets, + lambda s: [ + ( + s[1].lex, + s[3].lex, + None, + s[3].token_line, + s[3].token_column - len(s[3].lex), + ) + ] + + s[5], + ) + + nested_lets %= idx + dd + typex + assign + exp, lambda s: [ + (s[1].lex, s[3].lex, s[5], s[3].token_line, s[3].token_column - len(s[3].lex)) + ] + + nested_lets %= ( + idx + dd + typex + assign + exp + coma + nested_lets, + lambda s: [ + ( + s[1].lex, + s[3].lex, + s[5], + s[3].token_line, + s[3].token_column - len(s[3].lex), + ) + ] + + s[7], + ) + + exp %= var_dec, lambda s: s[1] + + string_const %= quoted_string_const, lambda s: StringConstant( + s[1].lex, s[1].token_line, s[1].token_column - len(s[1].lex) + ) + + string_const %= tilde_string_const, lambda s: StringConstant( + s[1].lex, s[1].token_line, s[1].token_column - len(s[1].lex) + ) + + instantiation %= new + typex, lambda s: InstantiateClassNode( + s[2].lex, s[1].token_line, s[1].token_column - 3, [] + ) + + loop_statements %= exp + dot_comma, lambda s: [s[1]] + loop_statements %= exp + dot_comma + loop_statements, lambda s: [s[1]] + s[3] + + exp %= idx + assign + exp, lambda s: AssignNode( + s[1].lex, s[3], s[1].token_line, s[1].token_column + ) + + exp %= while_ + exp + loop + statement_list + pool, lambda s: WhileBlockNode( + s[2], s[4], s[1].token_line, s[1].token_column - 5 + ) + + exp %= atom, lambda s: s[1] + + # exp %= opar + atom + cpar, lambda s: s[2] + + # exp %= arith, lambda s: s[1] + + exp %= block, lambda s: s[1] + + exp %= case_statement, lambda s: s[1] + + exp %= isvoid + exp, lambda s: IsVoidNode( + s[2], s[1].token_line, s[1].token_column - 6 + ) + + block %= obrack + loop_statements + cbrack, lambda s: BlockNode( + s[2], s[1].token_line, s[1].token_column - 1 + ) + + arith %= arith + plus + term, lambda s: PlusNode( + s[1], s[3], s[2].token_line, s[2].token_column - 1 + ) + + arith %= arith + minus + term, lambda s: DifNode( + s[1], s[3], s[2].token_line, s[2].token_column - 1 + ) + + arith %= term, lambda s: s[1] + + term %= term + star + factor, lambda s: MulNode( + s[1], s[3], s[2].token_line, s[2].token_column - 1 + ) + + term %= term + div + factor, lambda s: DivNode( + s[1], s[3], s[2].token_line, s[2].token_column - 1 + ) + + term %= term + star + not_ + factor, lambda s: MulNode( + s[1], + NotNode(s[4], s[3].token_line, s[3].token_column), + s[2].token_line, + s[2].token_column - 1, + ) + + term %= term + div + not_ + factor, lambda s: DivNode( + s[1], + NotNode(s[4], s[3].token_line, s[3].token_column), + s[2].token_line, + s[2].token_column - 1, + ) + + term %= factor, lambda s: s[1] + + term %= not_ + factor, lambda s: NotNode(s[2], s[1].token_line, s[1].token_column) + + # term %= not_operator + factor, lambda s: NegNode(s[2], s[1].token_line, s[1].token_column + 1) + + factor %= if_ + exp + then + exp + else_ + exp + fi, lambda s: IfThenElseNode( + s[2], s[4], s[6], s[1].token_line, s[1].token_column - 2 + ) + + exp %= not_operator + exp, lambda s: NegNode( + s[2], s[1].token_line, s[1].token_column + 1 + ) + + postfix %= not_operator + atom, lambda s: NegNode( + s[2], s[1].token_line, s[1].token_column + 1 + ) + + factor %= opar + exp + cpar, lambda s: s[2] + + factor %= num, lambda s: IntegerConstant(s[1].lex) + + factor %= idx, lambda s: VariableCall( + s[1].lex, s[1].token_line, s[1].token_column - len(s[1].lex) + ) + + factor %= true, lambda s: TrueConstant() + + factor %= factor + period + idx + opar + args_list_empty + cpar, lambda s: FunCall( + s[1], s[3].lex, s[5], s[1].line, s[1].column + ) + + factor %= string_const, lambda s: s[1] + + factor %= idx + opar + args_list_empty + cpar, lambda s: FunCall( + SelfNode(s[1].token_line, s[1].token_column - len(s[1].lex)), + s[1].lex, + s[3], + s[1].token_line, + s[1].token_column, + ) + + factor %= ( + factor + arroba + typex + period + idx + opar + args_list_empty + cpar, + lambda s: ParentFuncCall( + s[1], s[3].lex, s[5].lex, s[7], s[1].line, s[1].column + ), + ) + + factor %= false, lambda s: FalseConstant() + + factor %= instantiation, lambda s: s[1] + + exp %= atom + lt + atom, lambda s: LowerThanNode( + s[1], s[3], s[2].token_line, s[2].token_column - 1 + ) + + exp %= atom + eq + atom, lambda s: EqualToNode( + s[1], s[3], s[2].token_line, s[2].token_column - 1 + ) + + exp %= atom + ge + atom, lambda s: GreaterEqualNode( + s[1], s[3], s[2].token_line, s[2].token_column - 2 + ) + + exp %= atom + le + atom, lambda s: LowerEqual( + s[1], s[3], s[2].token_line, s[2].token_column - 2 + ) + + exp %= atom + lt + postfix, lambda s: LowerThanNode( + s[1], s[3], s[2].token_line, s[2].token_column - 1 + ) + + exp %= atom + eq + postfix, lambda s: EqualToNode( + s[1], s[3], s[2].token_line, s[2].token_column - 1 + ) + + exp %= atom + ge + postfix, lambda s: GreaterEqualNode( + s[1], s[3], s[2].token_line, s[2].token_column - 2 + ) + + exp %= atom + le + postfix, lambda s: LowerEqual( + s[1], s[3], s[2].token_line, s[2].token_column - 2 + ) + + factor %= self_, lambda s: SelfNode( + s[1].token_line, s[1].token_column - len(s[1].lex) + ) + + atom %= arith, lambda s: s[1] + + typex %= intx, lambda s: s[1] + + typex %= boolean, lambda s: s[1] + + typex %= string, lambda s: s[1] + + typex %= objectx, lambda s: s[1] + + typex %= classid, lambda s: s[1] + + typex %= auto, lambda s: s[1] + + typex %= void, lambda s: s[1] + + args_list_empty %= args_list, lambda s: s[1] + + args_list_empty %= G.Epsilon, lambda s: [] + + args_list %= exp, lambda s: [s[1]] + + args_list %= exp + coma + args_list, lambda s: [s[1]] + s[3] + + actions %= action, lambda s: [s[1]] + + actions %= action + actions, lambda s: [s[1]] + s[2] + + action %= idx + dd + typex + implies + exp + dot_comma, lambda s: ActionNode( + s[1].lex, s[3].lex, s[5], s[3].token_line, s[3].token_column - len(s[3].lex) + ) + + case_statement %= case + exp + of + actions + esac, lambda s: CaseNode( + s[2], s[4], s[1].token_line, s[1].token_column - 4 + ) + + table = [ + (class_keyword, r"(?i)class"), + (self_, r"(?i)self"), + (def_keyword, r"(?i)def"), + (in_keyword, r"(?i)in"), + (intx, r"Int"), + (boolean, r"Bool"), + (objectx, r"Object"), + (string, r"String"), + (true, r"true"), + (false, r"false"), + (auto, r"AUTO_TYPE"), + (if_, r"(?i)if"), + (then, r"(?i)then"), + (else_, r"(?i)else"), + (new, r"(?i)new"), + (while_, r"(?i)while"), + (do, r"(?i)do"), + (esac, r"(?i)esac"), + (case, r"(?i)case"), + (of, r"(?i)of"), + (inherits, r"(?i)inherits"), + (coma, r","), + (period, r"\."), + (dd, r"\:"), + (dot_comma, r";"), + (arroba, r"@"), + (assign, r"<-"), + (not_operator, r"(?i)not"), + (lt, r"<"), + (gt, r">"), + (ge, r">="), + (le, r"<="), + (eq, r"="), + (not_, r"\~"), + (opar, r"\("), + (cpar, r"\)"), + (obrack, r"\{"), + (cbrack, r"\}"), + (plus, r"\+"), + (minus, r"\-"), + (implies, r"=>"), + (div, "/"), + (star, r"\*"), + (let, r"(?i)let"), + (fi, r"(?i)fi"), + (pool, r"(?i)pool"), + (loop, r"(?i)loop"), + (isvoid, r"(?i)isvoid"), + (idx, r"[a-z]\w*"), + (num, r"\d+"), + (tilde_string_const, r"('(?:[^'\\]|\\'|\\|\\\n)*')"), + (quoted_string_const, r'("(?:[^\n"\\]|\\"|\\|\\\n)*")'), + (classid, r"[A-Z]\w*"), + ("StringError", r'("(?:[^"\\]|\\|\\"|\\\n)*\n)'), + ("StringEOF", r'("(?:[^\n"\\]|\\\n|\\"|\\)*)'), + ] + lexer = Tokenizer(table, G.EOF) + return G, lexer diff --git a/src/grammar/.ipynb_checkpoints/grammar-checkpoint.py b/src/grammar/.ipynb_checkpoints/grammar-checkpoint.py new file mode 100755 index 00000000..08056b81 --- /dev/null +++ b/src/grammar/.ipynb_checkpoints/grammar-checkpoint.py @@ -0,0 +1,174 @@ +from grammar.symbols import (NonTerminal, Terminal, Sentence, + Epsilon, EOF, AttributeProduction) +import json + + +class Grammar(): + + def __init__(self): + + self.Productions = [] + self.nonTerminals = [] + self.terminals = [] + self.startSymbol = None + # production type + self.pType = None + self.Epsilon = Epsilon(self) + self.EOF = EOF(self) + + self.symbDict = {} + + def NonTerminal(self, name, startSymbol=False): + + name = name.strip() + if not name: + raise Exception("Empty name") + + term = NonTerminal(name, self) + + if startSymbol: + + if self.startSymbol is None: + self.startSymbol = term + else: + raise Exception("Cannot define more than one start symbol.") + + self.nonTerminals.append(term) + self.symbDict[name] = term + return term + + def NonTerminals(self, names): + + ans = tuple((self.NonTerminal(x) for x in names.strip().split())) + + return ans + + def Add_Production(self, production): + + if len(self.Productions) == 0: + self.pType = type(production) + + assert type( + production) == self.pType, "The Productions most be of only 1 type." + + production.Left.productions.append(production) + self.Productions.append(production) + + def Terminal(self, name): + + name = name.strip() + if not name: + raise Exception("Empty name") + + term = Terminal(name, self) + self.terminals.append(term) + self.symbDict[name] = term + return term + + def Terminals(self, names): + + ans = tuple((self.Terminal(x) for x in names.strip().split())) + + return ans + + def __str__(self): + + mul = '%s, ' + + ans = 'Non-Terminals:\n\t' + + nonterminals = mul * (len(self.nonTerminals) - 1) + '%s\n' + + ans += nonterminals % tuple(self.nonTerminals) + + ans += 'Terminals:\n\t' + + terminals = mul * (len(self.terminals) - 1) + '%s\n' + + ans += terminals % tuple(self.terminals) + + ans += 'Productions:\n\t' + + ans += str(self.Productions) + + return ans + + @property + def to_json(self): + + productions = [] + + for p in self.Productions: + head = p.Left.Name + + body = [] + + for s in p.Right: + body.append(s.Name) + + productions.append({'Head': head, 'Body': body}) + + d = {'NonTerminals': [symb.Name for symb in self.nonTerminals], 'Terminals': + [symb.Name for symb in self.terminals], + 'Productions': productions} + + return json.dumps(d) + + @staticmethod + def from_json(data): + data = json.loads(data) + + G = Grammar() + dic = {'epsilon': G.Epsilon} + + for term in data['Terminals']: + dic[term] = G.Terminal(term) + + for noTerm in data['NonTerminals']: + dic[noTerm] = G.NonTerminal(noTerm) + + for p in data['Productions']: + head = p['Head'] + dic[head] %= Sentence(*[dic[term] for term in p['Body']]) + + return G + + def copy(self): + G = Grammar() + G.Productions = self.Productions.copy() + G.nonTerminals = self.nonTerminals.copy() + G.terminals = self.terminals.copy() + G.pType = self.pType + G.startSymbol = self.startSymbol + G.Epsilon = self.Epsilon + G.EOF = self.EOF + G.symbDict = self.symbDict.copy() + + return G + + @property + def IsAugmentedGrammar(self): + augmented = 0 + for left, right in self.Productions: + if self.startSymbol == left: + augmented += 1 + if augmented <= 1: + return True + else: + return False + + def AugmentedGrammar(self): + if not self.IsAugmentedGrammar: + + G = self.copy() + S = G.startSymbol + G.startSymbol = None + SS = G.NonTerminal('S\'', True) + if G.pType is AttributeProduction: + SS %= S + G.Epsilon, lambda x: x + else: + SS %= S + G.Epsilon + + return G + else: + return self.copy() diff --git a/src/grammar/.ipynb_checkpoints/symbols-checkpoint.py b/src/grammar/.ipynb_checkpoints/symbols-checkpoint.py new file mode 100755 index 00000000..acb29eaa --- /dev/null +++ b/src/grammar/.ipynb_checkpoints/symbols-checkpoint.py @@ -0,0 +1,439 @@ + +class Symbol(object): + """ + Modelaremos los símbolos del lenguaje con la clase Symbol. + Esta clase funcionará como base para la definición de terminales y no terminales. + Entre las funcionalidades básicas de los símbolos tenemos que: + + -Pueden ser agrupados con el operador + para formar oraciones. + -Podemos conocer si representa la cadena especial epsilon a través de la propiedad IsEpsilon + que poseen todas las instancias. + -Podemos acceder a la gramática en la que se definió a través del campo Grammar de cada + instancia. + -Podemos consultar la notación del símbolo a través del campo Name de cada instancia. + + Los símbolos no deben ser instanciados directamente (ni sus descendiente) con la aplicación + de su constructor. + """ + + def __init__(self, name, grammar): + self.Name = name + self.Grammar = grammar + + def __str__(self): + return self.Name + + def __repr__(self): + return repr(self.Name) + + def __add__(self, other): + if isinstance(other, Symbol): + return Sentence(self, other) + + raise TypeError(other) + + def __or__(self, other): + + if isinstance(other, (Sentence)): + return SentenceList(Sentence(self), other) + + raise TypeError(other) + + @property + def IsEpsilon(self): + return False + + def __len__(self): + return 1 + + +class Terminal(Symbol): + """ + Los símbolos terminales los modelaremos con la clase Terminal. + Dicha clase extiende la clase Symbol para: + + -Incluir propiedades IsNonTerminal - IsTerminal que devolveran True - False respectivamente. + + Los terminales no deben ser instanciados directamente con la aplicación de su constructor. + """ + + def __init__(self, name, grammar): + super().__init__(name, grammar) + + @property + def IsTerminal(self): + return True + + @property + def IsNonTerminal(self): + return False + + @property + def IsEpsilon(self): + return False + + +class NonTerminal(Symbol): + """ + Los símbolos no terminales los modelaremos con la clase NonTerminal. + Dicha clase extiende la clase Symbol para: + + -Añadir noción de las producción que tiene al no terminal como cabecera. + Estas pueden ser conocidas a través del campo productions de cada instancia. + -Permitir añadir producciones para ese no terminal a través del operador %=. + -Incluir propiedades IsNonTerminal - IsTerminal que devolveran True - False respectivamente. + + Los no terminales no deben ser instanciados directamente con la aplicación de su constructor. + """ + + def __init__(self, name, grammar): + super().__init__(name, grammar) + self.productions = [] + + def __imod__(self, other): + + if isinstance(other, (Sentence)): + p = Production(self, other) + self.Grammar.Add_Production(p) + return self + + # if isinstance(other, tuple): + # assert len( + # other) == 2, "Tiene que ser una Tupla de 2 elementos (sentence, attribute)" + # + # if isinstance(other[0], Symbol): + # p = AttributeProduction(self, Sentence(other[0]), other[1]) + # elif isinstance(other[0], Sentence): + # p = AttributeProduction(self, other[0], other[1]) + # else: + # raise Exception("") + # + # self.Grammar.Add_Production(p) + # return self + + if isinstance(other, tuple): + assert len(other) > 1 + + if len(other) == 2: + other += (None,) * len(other[0]) + + assert len(other) == len(other[0]) + 2, "Debe definirse una, y solo una, regla por cada símbolo de la producción" + + if isinstance(other[0], Symbol) or isinstance(other[0], Sentence): + p = AttributeProduction(self, other[0], other[1:]) + else: + raise Exception("") + + self.Grammar.Add_Production(p) + return self + + if isinstance(other, Symbol): + p = Production(self, Sentence(other)) + self.Grammar.Add_Production(p) + return self + + if isinstance(other, SentenceList): + + for s in other: + p = Production(self, s) + self.Grammar.Add_Production(p) + + return self + + raise TypeError(other) + + @property + def IsTerminal(self): + return False + + @property + def IsNonTerminal(self): + return True + + @property + def IsEpsilon(self): + return False + + +class EOF(Terminal): + """ + Modelaremos el símbolo de fin de cadena con la clase EOF. + Dicha clase extiende la clases Terminal para heradar su comportamiento. + + La clase EOF no deberá ser instanciada directamente con la aplicación de su constructor. + En su lugar, una instancia concreta para determinada gramática G de Grammar se construirá + automáticamente y será accesible a través de G.EOF. + """ + + def __init__(self, Grammar): + super().__init__('$', Grammar) + + +class Sentence(object): + """ + Modelaremos los oraciones y formas oracionales del lenguaje con la clase Sentence. + Esta clase funcionará como una colección de terminales y no terminales. + Entre las funcionalidades básicas que provee tenemos que nos : + + -Permite acceder a los símbolos que componen la oración a través del campo _symbols de + cada instancia. + -Permite conocer si la oración es completamente vacía a través de la propiedad IsEpsilon. + -Permite obtener la concatenación con un símbolo u otra oración aplicando el operador +. + -Permite conocer la longitud de la oración (cantidad de símbolos que la componen) + utilizando la función build-in de python len(...). + + Las oraciones pueden ser agrupadas usando el operador |. + Esto nos será conveniente para definir las producciones tengan la misma cabecera + (no terminal en la parte izquierda) en una única sentencia. + El grupo de oraciones se maneja con la clase SentenceList. + + No se deben crear instancias de Sentence y SentenceList directamente + con la aplicación de los respectivos constructores. + En su lugar, usaremos el operador + entre símbolos para formar las oraciones, + y el operador | entre oraciones para agruparlas. + """ + + def __init__(self, *args): + self._symbols = tuple(x for x in args if not x.IsEpsilon) + self.hash = hash(self._symbols) + + def __len__(self): + return len(self._symbols) + + def __add__(self, other): + if isinstance(other, Symbol): + return Sentence(*(self._symbols + (other,))) + + if isinstance(other, Sentence): + return Sentence(*(self._symbols + other._symbols)) + + raise TypeError(other) + + def __or__(self, other): + if isinstance(other, Sentence): + return SentenceList(self, other) + + if isinstance(other, Symbol): + return SentenceList(self, Sentence(other)) + + raise TypeError(other) + + def __repr__(self): + return str(self) + + def __str__(self): + return ("%s " * len(self._symbols) % tuple(self._symbols)).strip() + + def __iter__(self): + return iter(self._symbols) + + def __getitem__(self, index): + return self._symbols[index] + + def __eq__(self, other): + return self._symbols == other._symbols + + def __hash__(self): + return self.hash + + @property + def IsEpsilon(self): + return False + +class SentenceList(object): + + def __init__(self, *args): + self._sentences = list(args) + + def Add(self, symbol): + if not symbol and (symbol is None or not symbol.IsEpsilon): + raise ValueError(symbol) + + self._sentences.append(symbol) + + def __iter__(self): + return iter(self._sentences) + + def __or__(self, other): + if isinstance(other, Sentence): + self.Add(other) + return self + + if isinstance(other, Symbol): + return self | Sentence(other) + +class Epsilon(Terminal, Sentence): + """ + Modelaremos tanto la cadena vacía como el símbolo que la representa: epsilon (ϵ), + en la misma clase: Epsilon. + Dicha clase extiende las clases Terminal y Sentence por lo que ser comporta como ambas. + Sobreescribe la implementación del método IsEpsilon para indicar que en efecto toda instancia + de la clase reprensenta epsilon. + + La clase Epsilon no deberá ser instanciada directamente con la aplicación de su constructor. + En su lugar, una instancia concreta para determinada gramática G de Grammar se construirá + automáticamente y será accesible a través de G.Epsilon. + """ + + def __init__(self, grammar): + super().__init__('epsilon', grammar) + + + def __str__(self): + return "e" + + def __repr__(self): + return 'epsilon' + + def __iter__(self): + yield self + + def __len__(self): + return 0 + + def __add__(self, other): + return other + + def __eq__(self, other): + return isinstance(other, (Epsilon,)) + + def __hash__(self): + return hash("") + + @property + def IsEpsilon(self): + return True + + +class Production(object): + """ + Modelaremos las producciones con la clase Production. Las funcionalidades básicas + con que contamos son: + + -Poder acceder la cabecera (parte izquierda) y cuerpo (parte derecha) de cada + producción a través de los campos Left y Right respectivamente. + -Consultar si la producción es de la forma X→ϵ a través de la propiedad IsEpsilon. + -Desempaquetar la producción en cabecera y cuerpo usando asignaciones: left, right = production. + + Las producciones no deben ser instanciadas directamente con la aplicación de su constructor. + En su lugar, se presentan las siguientes facilidades para formar producciones a partir + de una instancia G de Grammar y un grupo de terminales y no terminales: + + Para definir una producción de la forma E→E+T: + + E %= E + plus + T + + Para definir múltiples producciones de la misma cabecera en una única sentencia (E→E+T | E−T | T): + + E %= E + plus + T | E + minus + T | T + + Para usar epsilon en una producción (ejemplo S→aS | ϵ) haríamos: + + S %= S + a | G.Epsilon + """ + + def __init__(self, nonTerminal, sentence): + + self.Left = nonTerminal + self.Right = sentence + + def __str__(self): + + return '%s := %s' % (self.Left, self.Right) + + def __repr__(self): + + return '%s -> %s' % (self.Left, self.Right) + + def __iter__(self): + yield self.Left + yield self.Right + + def __eq__(self, other): + return isinstance(other, Production) and self.Left == other.Left and self.Right == other.Right + + + @property + def IsEpsilon(self): + return self.Right.IsEpsilon + +class AttributeProduction(Production): + """ + Con esta clase modelaremos las producciones de las gramáticas atributadas. + Cada una de estas producciones se compone por: + + Un no terminal como cabecera. Accesible a través del campo Left. + Una oración como cuerpo. Accesible a través del campo Right. + Un conjunto de reglas para evaluar los atributos. Accesible a través del campo atributes. + + Las producciones no deben ser instanciadas directamente con la aplicación de su constructor. + En su lugar, se presentan las siguientes facilidades para formar producciones a partir de una + instancia G de Grammar y un grupo de terminales y no terminales: + + Para definir una producción de la forma B0→B1B2...Bn que: + + -Asocia a B0 una regla λ0 para sintetizar sus atributos, y Asocia a B1…Bn las reglas λ1…λn + que hereden sus atributos respectivamentes. + + B0 %= B1 + B2 + ... + Bn, lambda0, lambda1, lambda2, ..., lambdaN + + Donde lambda0, lambda1, ..., lambdaN son funciones que reciben 2 parámetros. + + Como primer parámetro los atributos heredados que se han computado para cada instancia + de símbolo en la producción, durante la aplicación de esa instancia de producción específicamente. + Los valores se acceden desde una lista de n + 1 elementos. Los valores se ordenan según aparecen + los símbolos en la producción, comenzando por la cabecera. Nos referiremos a esta colección como inherited. + Como segundo parámetro los atributos sintetizados que se han computado para cada instancia de símbolo + en la producción, durante la aplicación de esa instancia de producción específicamente. + Sigue la misma estructura que el primer parámetro. Nos referiremos a esta colección como synteticed. + + La función lambda0 sintetiza los atributos de la cabecera. + La evaluación de dicha función produce el valor de synteticed[0]. + El resto de los atributos sintetizados de los símbolos de la producción se calcula de la siguiente forma: + + -En caso de que el símbolo sea un terminal, evalúa como su lexema. + -En caso de que el símbolo sea un no terminal, se obtiene de evaluar la función lambda0 en la + instancia de producción correspondiente. + + La función lambda_i, con i entre 1 y n, computa los atributos heredados de la i-ésima ocurrencia + de símbolo en la producción. La evaluación de dicha función produce el valor de inherited[i]. + El valor de inherited[0] se obtiene como el atributo que heredó la instancia concreta del símbolo + en la cabecera antes de comenzar a aplicar la producción. + + En caso de que no se vaya a sociar una regla a un símbolo se incluirá un None. + + E %= T X , lambda h,s: s[2] , None , lambda h,s: s[1] + # ___________ ________________ ________ ________________ + # producción | regla para E | sin regla | regla para X + + [0]: lambda h,s: s[2] al ser lambda0 sintetiza el valor de E. Lo hace en función del valor que + sintetiza X (accesible desde s[2]). + [1]: None al ser lambda1 indica que no se incluye regla para heredar valor a T. + [2]: lambda h,s: s[1] al ser lambda2 hereda un valor a X. Lo hace en función del valor que sintetiza T + accesible desde s[1]). + + No se deben definir múltiples producciones de la misma cabecera en una única sentencia. + + """ + + def __init__(self, nonTerminal, sentence, attributes): + if not isinstance(sentence, Sentence) and isinstance(sentence, Symbol): + sentence = Sentence(sentence) + super(AttributeProduction, self).__init__(nonTerminal, sentence) + + self.attributes = attributes + + def __str__(self): + return '%s := %s' % (self.Left, self.Right) + + def __repr__(self): + return '%s -> %s' % (self.Left, self.Right) + + def __iter__(self): + yield self.Left + yield self.Right + + + @property + def IsEpsilon(self): + return self.Right.IsEpsilon diff --git a/src/grammar/__init__.py b/src/grammar/__init__.py new file mode 100755 index 00000000..70c8b193 --- /dev/null +++ b/src/grammar/__init__.py @@ -0,0 +1,9 @@ + +def setup(): + import os + from sys import path + BASE = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + path.append(BASE) + +if __name__ == '__main__': + setup() \ No newline at end of file diff --git a/src/grammar/grammar.py b/src/grammar/grammar.py new file mode 100755 index 00000000..a1df17c6 --- /dev/null +++ b/src/grammar/grammar.py @@ -0,0 +1,181 @@ +from typing import Dict, List, Optional, Type, Union +from grammar.symbols import NonTerminal, Production, Symbol, Terminal, Sentence, Epsilon, EOF, AttributeProduction + + +class Grammar(): + def __init__(self): + + self.Productions: List[Union[AttributeProduction, Production]] = [] + self.nonTerminals: List[NonTerminal] = [] + self.terminals: List[Terminal] = [] + self.startSymbol: Optional[NonTerminal] = None + # production type + self.pType: Optional[Type] = None + self.Epsilon = Epsilon(self) + self.EOF = EOF(self) + + self.symbDict: Dict[str, Symbol] = {} + + def NonTerminal(self, name: str, startSymbol=False): + + name = name.strip() + if not name: + raise Exception("Empty name") + + term = NonTerminal(name, self) + + if startSymbol: + + if self.startSymbol is None: + self.startSymbol = term + else: + raise Exception("Cannot define more than one start symbol.") + + self.nonTerminals.append(term) + self.symbDict[name] = term + return term + + def NonTerminals(self, names: str): + + ans = tuple((self.NonTerminal(x) for x in names.strip().split())) + + return ans + + def Add_Production(self, production: Union[Production, + AttributeProduction]): + + if len(self.Productions) == 0: + self.pType = type(production) + + assert type(production + ) == self.pType, "The Productions most be of only 1 type." + + production.Left.productions.append(production) + self.Productions.append(production) + + def Terminal(self, name: str): + + name = name.strip() + if not name: + raise Exception("Empty name") + + term = Terminal(name, self) + self.terminals.append(term) + self.symbDict[name] = term + return term + + def Terminals(self, names: str): + + ans = tuple((self.Terminal(x) for x in names.strip().split())) + + return ans + + def __str__(self): + + mul = '%s, ' + + ans = 'Non-Terminals:\n\t' + + nonterminals = mul * (len(self.nonTerminals) - 1) + '%s\n' + + ans += nonterminals % tuple(self.nonTerminals) + + ans += 'Terminals:\n\t' + + terminals = mul * (len(self.terminals) - 1) + '%s\n' + + ans += terminals % tuple(self.terminals) + + ans += 'Productions:\n\t' + + ans += str(self.Productions) + + return ans + + # @property + # def to_json(self): + + # productions = [] + + # for p in self.Productions: + # head = p.Left.Name + + # body = [] + + # for s in p.Right: + # body.append(s.Name) + + # productions.append({'Head': head, 'Body': body}) + + # d = { + # 'NonTerminals': [ + # symb.Name for symb in self.nonTerminals + # if symb != self.startSymbol + # ], + # 'Terminals': [symb.Name for symb in self.terminals], + # 'Productions': + # productions + # } + # d['StartSymbol'] = self.startSymbol.Name + + # return json.dumps(d) + + # @staticmethod + # def from_json(data): + # data = json.loads(data) + + # G = Grammar() + # dic = {'epsilon': G.Epsilon} + # dic[data['StartSymbol']] = G.NonTerminal(data['StartSymbol'], True) + + # for term in data['Terminals']: + # dic[term] = G.Terminal(term) + + # for noTerm in data['NonTerminals']: + # dic[noTerm] = G.NonTerminal(noTerm) + + # for p in data['Productions']: + # head = p['Head'] + # dic[head] %= Sentence(*[dic[term] for term in p['Body']]) + + # return G + + def copy(self): + G = Grammar() + G.Productions = self.Productions.copy() + G.nonTerminals = self.nonTerminals.copy() + G.terminals = self.terminals.copy() + G.pType = self.pType + G.startSymbol = self.startSymbol + G.Epsilon = self.Epsilon + G.EOF = self.EOF + G.symbDict = self.symbDict.copy() + + return G + + @property + def IsAugmentedGrammar(self): + augmented = 0 + for left, right in self.Productions: + if self.startSymbol == left: + augmented += 1 + if augmented <= 1: + return True + else: + return False + + def AugmentedGrammar(self): + if not self.IsAugmentedGrammar: + + G = self.copy() + S = G.startSymbol + G.startSymbol = None + SS = G.NonTerminal('S\'', True) + if G.pType is AttributeProduction: + SS %= S + G.Epsilon, lambda x: x + else: + SS %= S + G.Epsilon + + return G + else: + return self.copy() diff --git a/src/grammar/items.py b/src/grammar/items.py new file mode 100755 index 00000000..d347ab28 --- /dev/null +++ b/src/grammar/items.py @@ -0,0 +1,78 @@ +from __future__ import annotations +from typing import Iterable, List, Optional, Union +from grammar.symbols import NonTerminal, Production, Symbol, Terminal + + +class Item: + """ + La clase Item representara los items LR. + Llamaremos item a una cadena de la forma X-> a.B donde: + + -a es lo que hemos visto + -B es lo que nos falta por leer + + Por cada produccion X-> w, tenemos |w| + 1 posibles items + """ + def __init__(self, + production: Production, + pos: int, + lookaheads: Iterable[Union[Terminal, NonTerminal]] = []): + self.production = production + self.pos = pos + self.lookaheads = frozenset(look for look in lookaheads) + + @property + def IsReduceItem(self): + return len(self.production.Right) == self.pos + + @property + def NextSymbol(self) -> Optional[Union[Terminal, NonTerminal]]: + if self.pos < len(self.production.Right): + return self.production.Right[self.pos] + else: + return None + + def next_item(self) -> Optional[Item]: + if self.pos < len(self.production.Right): + return Item(self.production, self.pos + 1, self.lookaheads) + else: + return None + + def __eq__(self, other: Item): + return ((self.pos == other.pos) + and (self.production == other.production) + and (self.lookaheads == other.lookaheads)) + + def __str__(self): + s = str(self.production.Left) + " -> " + if len(self.production.Right) > 0: + for i, c in enumerate(self.production.Right): + if i == self.pos: + s += "." + s += str(self.production.Right[i]) + if self.pos == len(self.production.Right): + s += "." + else: + s += "." + s += ", " + str(self.lookaheads) + return s + + def __repr__(self): + return str(self) + + def __hash__(self): + return hash((self.production, self.pos, frozenset(self.lookaheads))) + + def __iter__(self): + current = self + while not current.IsReduceItem: + yield current + current = current.next_item() + yield current + + def Preview(self, skip=1) -> List[Symbol]: + unseen = self.production.Right[self.pos + skip:] + return [unseen + (lookahead, ) for lookahead in self.lookaheads] + + def Center(self) -> Item: + return Item(self.production, self.pos) diff --git a/src/grammar/symbols.py b/src/grammar/symbols.py new file mode 100755 index 00000000..c374e1ef --- /dev/null +++ b/src/grammar/symbols.py @@ -0,0 +1,432 @@ +from __future__ import annotations +from typing import Any, Callable, List, Optional, Tuple, Union + + +class Symbol(object): + """ + Modelaremos los símbolos del lenguaje con la clase Symbol. + Esta clase funcionará como base para la definición de terminales y no terminales. + Entre las funcionalidades básicas de los símbolos tenemos que: + + -Pueden ser agrupados con el operador + para formar oraciones. + -Podemos conocer si representa la cadena especial epsilon a través de la propiedad IsEpsilon + que poseen todas las instancias. + -Podemos acceder a la gramática en la que se definió a través del campo Grammar de cada + instancia. + -Podemos consultar la notación del símbolo a través del campo Name de cada instancia. + + Los símbolos no deben ser instanciados directamente (ni sus descendiente) con la aplicación + de su constructor. + """ + def __init__(self, name: str, grammar): + self.Name: str = name + self.Grammar = grammar + + def __str__(self): + return self.Name + + def __repr__(self): + return repr(self.Name) + + def __add__(self, other): + if isinstance(other, Symbol): + return Sentence(self, other) + + raise TypeError(other) + + def __or__(self, other): + + if isinstance(other, (Sentence)): + return SentenceList(Sentence(self), other) + + raise TypeError(other) + + @property + def IsEpsilon(self): + return False + + def __len__(self): + return 1 + + def __gt__(self, other): + assert isinstance(other, Symbol) + return self.Name > other.Name + + +class Terminal(Symbol): + """ + Los símbolos terminales los modelaremos con la clase Terminal. + Dicha clase extiende la clase Symbol para: + + -Incluir propiedades IsNonTerminal - IsTerminal que devolveran True - False respectivamente. + + Los terminales no deben ser instanciados directamente con la aplicación de su constructor. + """ + def __init__(self, name: str, grammar): + super().__init__(name, grammar) + + @property + def IsTerminal(self): + return True + + @property + def IsNonTerminal(self): + return False + + @property + def IsEpsilon(self): + return False + + def __hash__(self): + return hash(self.Name) + + def __eq__(self, other): + return isinstance(other, Terminal) and other.Name == self.Name + + +class EOF(Terminal): + """ + Modelaremos el símbolo de fin de cadena con la clase EOF. + Dicha clase extiende la clases Terminal para heradar su comportamiento. + + La clase EOF no deberá ser instanciada directamente con la aplicación de su constructor. + En su lugar, una instancia concreta para determinada gramática G de Grammar se construirá + automáticamente y será accesible a través de G.EOF. + """ + def __init__(self, Grammar): + super().__init__('$', Grammar) + + +class Sentence(object): + """ + Modelaremos los oraciones y formas oracionales del lenguaje con la clase Sentence. + Esta clase funcionará como una colección de terminales y no terminales. + Entre las funcionalidades básicas que provee tenemos que nos : + + -Permite acceder a los símbolos que componen la oración a través del campo _symbols de + cada instancia. + -Permite conocer si la oración es completamente vacía a través de la propiedad IsEpsilon. + -Permite obtener la concatenación con un símbolo u otra oración aplicando el operador +. + -Permite conocer la longitud de la oración (cantidad de símbolos que la componen) + utilizando la función build-in de python len(...). + + Las oraciones pueden ser agrupadas usando el operador |. + Esto nos será conveniente para definir las producciones tengan la misma cabecera + (no terminal en la parte izquierda) en una única sentencia. + El grupo de oraciones se maneja con la clase SentenceList. + + No se deben crear instancias de Sentence y SentenceList directamente + con la aplicación de los respectivos constructores. + En su lugar, usaremos el operador + entre símbolos para formar las oraciones, + y el operador | entre oraciones para agruparlas. + """ + def __init__(self, *args): + self._symbols = tuple(x for x in args if not x.IsEpsilon) + self.hash = hash(self._symbols) + + def __len__(self): + return len(self._symbols) + + def __add__(self, other: Union[Symbol, Sentence]): + if isinstance(other, Symbol): + return Sentence(*(self._symbols + (other, ))) + + if isinstance(other, Sentence): + return Sentence(*(self._symbols + other._symbols)) + + raise TypeError(other) + + def __or__(self, other: Union[Symbol, Sentence]): + if isinstance(other, Sentence): + return SentenceList(self, other) + + if isinstance(other, Symbol): + return SentenceList(self, Sentence(other)) + + raise TypeError(other) + + def __repr__(self): + return str(self) + + def __str__(self): + return ("%s " * len(self._symbols) % tuple(self._symbols)).strip() + + def __iter__(self): + return iter(self._symbols) + + def __getitem__(self, index): + return self._symbols[index] + + def __eq__(self, other): + return self._symbols == other._symbols + + def __hash__(self): + return self.hash + + @property + def IsEpsilon(self): + return False + + +class SentenceList(object): + def __init__(self, *args: Sentence): + self._sentences = list(args) + + def Add(self, symbol: Optional[Sentence]): + if not symbol and (symbol is None or not symbol.IsEpsilon): + raise ValueError(symbol) + + self._sentences.append(symbol) + + def __iter__(self): + return iter(self._sentences) + + def __or__(self, other: Union[Sentence, Symbol]): + if isinstance(other, Sentence): + self.Add(other) + return self + + if isinstance(other, Symbol): + return self | Sentence(other) + + +class Epsilon(Terminal, Sentence): + """ + Modelaremos tanto la cadena vacía como el símbolo que la representa: epsilon (ϵ), + en la misma clase: Epsilon. + Dicha clase extiende las clases Terminal y Sentence por lo que ser comporta como ambas. + Sobreescribe la implementación del método IsEpsilon para indicar que en efecto toda instancia + de la clase reprensenta epsilon. + + La clase Epsilon no deberá ser instanciada directamente con la aplicación de su constructor. + En su lugar, una instancia concreta para determinada gramática G de Grammar se construirá + automáticamente y será accesible a través de G.Epsilon. + """ + def __init__(self, grammar): + super().__init__('epsilon', grammar) + + def __str__(self): + return "ϵ" + + def __repr__(self): + return 'epsilon' + + def __iter__(self): + yield self + + def __len__(self): + return 0 + + def __add__(self, other): + return other + + def __eq__(self, other): + return isinstance(other, (Epsilon, )) + + def __hash__(self): + return hash("") + + @property + def IsEpsilon(self): + return True + + +class Production(object): + """ + Modelaremos las producciones con la clase Production. Las funcionalidades básicas + con que contamos son: + + -Poder acceder la cabecera (parte izquierda) y cuerpo (parte derecha) de cada + producción a través de los campos Left y Right respectivamente. + -Consultar si la producción es de la forma X→ϵ a través de la propiedad IsEpsilon. + -Desempaquetar la producción en cabecera y cuerpo usando asignaciones: left, right = production. + + Las producciones no deben ser instanciadas directamente con la aplicación de su constructor. + En su lugar, se presentan las siguientes facilidades para formar producciones a partir + de una instancia G de Grammar y un grupo de terminales y no terminales: + + Para definir una producción de la forma E→E+T: + + E %= E + plus + T + + Para definir múltiples producciones de la misma cabecera en una única sentencia (E→E+T | E−T | T): + + E %= E + plus + T | E + minus + T | T + + Para usar epsilon en una producción (ejemplo S→aS | ϵ) haríamos: + + S %= S + a | G.Epsilon + """ + def __init__(self, nonTerminal: NonTerminal, sentence: Sentence): + self.Left = nonTerminal + self.Right = sentence + + def __str__(self): + return '%s -> %s' % (self.Left, self.Right) + + def __repr__(self): + return '%s -> %s' % (self.Left, self.Right) + + def __iter__(self): + yield self.Left + yield self.Right + + def __eq__(self, other: Production): + return isinstance( + other, Production + ) and self.Left == other.Left and self.Right == other.Right + + def __hash__(self): + return hash((self.Left, self.Right)) + + @property + def IsEpsilon(self): + return self.Right.IsEpsilon + + +class AttributeProduction(Production): + """ + Con esta clase modelaremos las producciones de las gramáticas atributadas. + Cada una de estas producciones se compone por: + + Un no terminal como cabecera. Accesible a través del campo Left. + Una oración como cuerpo. Accesible a través del campo Right. + Un conjunto de reglas para evaluar los atributos. Accesible a través del campo atributes. + + Las producciones no deben ser instanciadas directamente con la aplicación de su constructor. + En su lugar, se presentan las siguientes facilidades para formar producciones a partir de una + instancia G de Grammar y un grupo de terminales y no terminales: + + Para definir una producción de la forma B0→B1B2...Bn que: + + -Asocia a B0 una regla λ0 para sintetizar sus atributos, y Asocia a B1…Bn las reglas λ1…λn + que hereden sus atributos respectivamentes. + + B0 %= B1 + B2 + ... + Bn, lambda0, lambda1, lambda2, ..., lambdaN + + Donde lambda0, lambda1, ..., lambdaN son funciones que reciben 2 parámetros. + + Como primer parámetro los atributos heredados que se han computado para cada instancia + de símbolo en la producción, durante la aplicación de esa instancia de producción específicamente. + Los valores se acceden desde una lista de n + 1 elementos. Los valores se ordenan según aparecen + los símbolos en la producción, comenzando por la cabecera. Nos referiremos a esta colección como inherited. + Como segundo parámetro los atributos sintetizados que se han computado para cada instancia de símbolo + en la producción, durante la aplicación de esa instancia de producción específicamente. + Sigue la misma estructura que el primer parámetro. Nos referiremos a esta colección como synteticed. + + La función lambda0 sintetiza los atributos de la cabecera. + La evaluación de dicha función produce el valor de synteticed[0]. + El resto de los atributos sintetizados de los símbolos de la producción se calcula de la siguiente forma: + + -En caso de que el símbolo sea un terminal, evalúa como su lexema. + -En caso de que el símbolo sea un no terminal, se obtiene de evaluar la función lambda0 en la + instancia de producción correspondiente. + + La función lambda_i, con i entre 1 y n, computa los atributos heredados de la i-ésima ocurrencia + de símbolo en la producción. La evaluación de dicha función produce el valor de inherited[i]. + El valor de inherited[0] se obtiene como el atributo que heredó la instancia concreta del símbolo + en la cabecera antes de comenzar a aplicar la producción. + + En caso de que no se vaya a sociar una regla a un símbolo se incluirá un None. + + E %= T X , lambda h,s: s[2] , None , lambda h,s: s[1] + # ___________ ________________ ________ ________________ + # producción | regla para E | sin regla | regla para X + + [0]: lambda h,s: s[2] al ser lambda0 sintetiza el valor de E. Lo hace en función del valor que + sintetiza X (accesible desde s[2]). + [1]: None al ser lambda1 indica que no se incluye regla para heredar valor a T. + [2]: lambda h,s: s[1] al ser lambda2 hereda un valor a X. Lo hace en función del valor que sintetiza T + accesible desde s[1]). + + No se deben definir múltiples producciones de la misma cabecera en una única sentencia. + + """ + def __init__(self, nonTerminal: NonTerminal, + sentence: Union[Sentence, Symbol], attributes): + + if not isinstance(sentence, Sentence) and isinstance(sentence, Symbol): + sentence = Sentence(sentence) + super(AttributeProduction, self).__init__(nonTerminal, sentence) + + self.attributes = attributes + + def __str__(self): + return '%s := %s' % (self.Left, self.Right) + + def __repr__(self): + return '%s -> %s' % (self.Left, self.Right) + + def __iter__(self): + yield self.Left + yield self.Right + + @property + def IsEpsilon(self): + return self.Right.IsEpsilon + + +class NonTerminal(Symbol): + """ + Los símbolos no terminales los modelaremos con la clase NonTerminal. + Dicha clase extiende la clase Symbol para: + + -Añadir noción de las producción que tiene al no terminal como cabecera. + Estas pueden ser conocidas a través del campo productions de cada instancia. + -Permitir añadir producciones para ese no terminal a través del operador %=. + -Incluir propiedades IsNonTerminal - IsTerminal que devolveran True - False respectivamente. + + Los no terminales no deben ser instanciados directamente con la aplicación de su constructor. + """ + def __init__(self, name: str, grammar): + super().__init__(name, grammar) + self.productions = [] + + def __imod__(self, other: Union[Sentence, SentenceList, Tuple, Symbol]): + + if isinstance(other, Sentence): + p = Production(self, other) + self.Grammar.Add_Production(p) + return self + + if isinstance(other, SentenceList): + + for s in other: + p = Production(self, s) + self.Grammar.Add_Production(p) + + return self + + if isinstance(other, tuple): + assert len(other) > 1 + + if len(other) == 2: + other += (None, ) * len(other[0]) + assert len(other) == len(other[0]) + 2, "Reglas malformadas" + + if isinstance(other[0], Symbol) or isinstance(other[0], Sentence): + p = AttributeProduction(self, other[0], other[1:]) + else: + raise Exception("") + + self.Grammar.Add_Production(p) + return self + + if isinstance(other, Symbol): + p = Production(self, Sentence(other)) + self.Grammar.Add_Production(p) + return self + + raise TypeError(other) + + @property + def IsTerminal(self): + return False + + @property + def IsNonTerminal(self): + return True + + @property + def IsEpsilon(self): + return False \ No newline at end of file diff --git a/src/install.py b/src/install.py new file mode 100644 index 00000000..a313d994 --- /dev/null +++ b/src/install.py @@ -0,0 +1,26 @@ +import cloudpickle +from coolgrammar.grammar import build_cool_grammar +from parserr.lr import LALRParser +from argparse import ArgumentParser + + +def generate_py(f): + gram, lexer = build_cool_grammar() + parser = LALRParser(gram, verbose=True) + lexer_str = cloudpickle.dumps(lexer) + parser_str = cloudpickle.dumps(parser) + f.write(""" +import cloudpickle +import sys +sys.path.append('..') +PARSER = cloudpickle.loads(%s) +LEXER = cloudpickle.loads(%s) +""" % (parser_str, lexer_str)) + + +if __name__ == '__main__': + parser = ArgumentParser() + parser.add_argument('file', type=str) + arg = parser.parse_args() + with open(arg.file, "w+") as f: + generate_py(f) diff --git a/src/lexer/.ipynb_checkpoints/regexgenerator-checkpoint.py b/src/lexer/.ipynb_checkpoints/regexgenerator-checkpoint.py new file mode 100755 index 00000000..4faa966c --- /dev/null +++ b/src/lexer/.ipynb_checkpoints/regexgenerator-checkpoint.py @@ -0,0 +1,133 @@ +#%% +from baseNodeTree.base import Node, AtomicNode, UnaryNode, BinaryNode +from automatons.nondeterministic import NFA +from automatons.operations import automata_union, automata_concatenation, automata_closure +from automatons.transformation import nfa_to_deterministic +from grammar.grammar import Grammar +from lexer.tokens import Token +from parser.ll1 import build_ll1_parser +from tools.evaluate import evaluate_parse +#%% +class EpsilonNode(AtomicNode): + def evaluate(self): + automaton = NFA(states = 1, finals = [0],transitions = {} ) + return automaton + +class SymbolNode(AtomicNode): + def evaluate(self): + s = self.lex + automaton = NFA(states= 2, finals= [1], transitions={(0,s):[1]}) + return automaton + +class ClosureNode(UnaryNode): + @staticmethod + def operate(value): + automaton = value + for state in automaton.finals: + try: + automaton.transitions[state][''].append(automaton.start) + except KeyError: + automaton.transitions[state][''] = [automaton.start] + try: + automaton.transitions[automaton.start][''].append(state) + except KeyError: + automaton.transitions[automaton.start][''] = [state] + + return automaton + +class UnionNode(BinaryNode): + @staticmethod + def operate(lvalue, rvalue): + automata = automata_union(lvalue, rvalue) + return automata + +class ConcatNode(BinaryNode): + @staticmethod + def operate(lvalue, rvalue): + automata = automata_concatenation(lvalue, rvalue) + return automata + +class RangeNode(Node): + def __init__(self,iterable): + self.rang = iterable + + def evaluate(self): + it = iter(self.rang) + node = SymbolNode(next(it)) + while 1: + try: + node = UnionNode(node,SymbolNode(next(it))) + except StopIteration: + automata = node.evaluate() + return automata + +class PositiveClosureNode(UnaryNode): + @staticmethod + def operate(value): + return automata_concatenation(value,automata_closure(value)) + +class QuestionNode(UnaryNode): + @staticmethod + def operate(value): + return automata_union(value, SymbolNode('').evaluate()) + +class Regex(object): + + def __init__(self, regex, ignore_white_space = True): + self.regex = regex + self.G = Grammar() + opar, cpar ,star, pipe, question, plus, symbol, epsilon, obrack, cbrack, minus = self.G.Terminals('( ) * | ? + symbol ε [ ] -') + E, T, X, F, Y, S = self.G.NonTerminals('E T X F Y S') + + E %= T + X, lambda h,s: s[2], None, s[1] + X %= pipe + E, lambda h,s: UnionNode(h[0], s[2]) + X %= self.G.Epsilon, lambda h,s: h[0] + T %= F + Y, lambda h,s: s[2], None, s[1] + Y %= star, lambda h,s: ClosureNode(h[0]) + Y %= question, lambda h,s: QuestionNode(h[0]) + Y %= plus, lambda h,s: PositiveClosureNode(h[0]) + Y %= self.G.Epsilon, lambda h,s: h[0] + F %= S + F, lambda h,s: ConcatNode(s[1],s[2]), None, s[1] + F %= self.G.Epsilon, lambda h,s: h[0] + S %= symbol, lambda h,s: SymbolNode(s[1]) + S %= epsilon, lambda h,s: EpsilonNode(s[1]) + S %= opar + E + cpar, lambda h,s : s[2] + S %= obrack + symbol + minus + symbol + cbrack, lambda h,s: RangeNode(range(s[2],s[4])) + + self.automaton = self._build_automaton(regex, ignore_white_space) + + def _build_automaton(self,regex, ignore_white_space): + + def regex_tokenizer(regex, ignore_white_space): + if ignore_white_space: + regex = regex.split(sep = ' ') + d = {term.name: term for term in self.G.terminals} + tokens = [] + symbol_term = [term for term in self.G.terminals if term.name == 'symbol'][0] + fixed_tokens = {tok.name:Token(tok.name,tok) for tok in [d['|'],d['*'],d['+'],d['?'],d['('],d[')'], + d['['],d[']'],d['-'],d['ε']]} + + for c in regex: + try: + token = fixed_tokens[c] + except KeyError: + token = Token(c, symbol_term) + tokens.append(token) + tokens.append(Token('$',self.G.EOF)) + return tokens + + toks = regex_tokenizer(regex, ignore_white_space) + parser = build_ll1_parser(self.G) + left_parse = parser(toks) + tree = evaluate_parse(left_parse, toks) + automatom = tree.evaluate() + automaton = nfa_to_deterministic(automatom) + return automaton + + def __call__(self, w:str): + return self.automaton.recognize(w) + + +#%% +reg = Regex('a*(a|b)*cd | ε') +reg('bbbbbcd') diff --git a/src/lexer/.ipynb_checkpoints/tokenizer-checkpoint.py b/src/lexer/.ipynb_checkpoints/tokenizer-checkpoint.py new file mode 100755 index 00000000..b72db4d1 --- /dev/null +++ b/src/lexer/.ipynb_checkpoints/tokenizer-checkpoint.py @@ -0,0 +1,10 @@ +from ast.base import Node, AtomicNode, UnaryNode, BinaryNode + +class EpsilonNode(AtomicNode): + def evaluate(self): + automaton = NFA(states = 1, finals = [0],transitions = {} ) + return automaton + +#%% +EPSILON = 'ε' +EpsilonNode(EPSILON).evaluate() diff --git a/src/lexer/__init__.py b/src/lexer/__init__.py new file mode 100755 index 00000000..70c8b193 --- /dev/null +++ b/src/lexer/__init__.py @@ -0,0 +1,9 @@ + +def setup(): + import os + from sys import path + BASE = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + path.append(BASE) + +if __name__ == '__main__': + setup() \ No newline at end of file diff --git a/src/lexer/regexgenerator.py b/src/lexer/regexgenerator.py new file mode 100755 index 00000000..c31a36d4 --- /dev/null +++ b/src/lexer/regexgenerator.py @@ -0,0 +1,147 @@ +from baseNodeTree.base import Node, AtomicNode, UnaryNode, BinaryNode +from automatons.nondeterministic import NFA +from automatons.operations import (automata_union, automata_concatenation, + automata_closure) +from automatons.transformation import nfa_to_deterministic +from grammar.grammar import Grammar +from lexer.tokens import Token +from parserr.ll1 import build_ll1_parser +from tools.evaluate import evaluate_parse + + +class EpsilonNode(AtomicNode): + def evaluate(self): + automaton = NFA(states=1, finals=[0], transitions={}) + return automaton + + +class SymbolNode(AtomicNode): + def evaluate(self): + s = self.lex + automaton = NFA(states=2, finals=[1], transitions={(0, s): [1]}) + return automaton + + +class ClosureNode(UnaryNode): + @staticmethod + def operate(value): + automaton = value + for state in automaton.finals: + try: + automaton.transitions[state][''].append(automaton.start) + except KeyError: + automaton.transitions[state][''] = [automaton.start] + try: + automaton.transitions[automaton.start][''].append(state) + except KeyError: + automaton.transitions[automaton.start][''] = [state] + + return automaton + + +class UnionNode(BinaryNode): + @staticmethod + def operate(lvalue, rvalue): + automata = automata_union(lvalue, rvalue) + return automata + + +class ConcatNode(BinaryNode): + @staticmethod + def operate(lvalue, rvalue): + automata = automata_concatenation(lvalue, rvalue) + return automata + + +class RangeNode(Node): + def __init__(self, iterable): + self.rang = iterable + + def evaluate(self): + it = iter(self.rang) + node = SymbolNode(next(it)) + while 1: + try: + node = UnionNode(node, SymbolNode(next(it))) + except StopIteration: + automata = node.evaluate() + return automata + + +class PositiveClosureNode(UnaryNode): + @staticmethod + def operate(value): + return automata_concatenation(value, automata_closure(value)) + + +class QuestionNode(UnaryNode): + @staticmethod + def operate(value): + return automata_union(value, EpsilonNode('').evaluate()) + + +class Regex(object): + def __init__(self, regex, ignore_white_space=True): + self.regex = regex + self.G = Grammar() + E = self.G.NonTerminal('E', True) + T, F, A, X, Y, Z = self.G.NonTerminals('T F A X Y Z') + pipe, star, opar, cpar, symbol, epsilon, plus, minus, obrack, cbrack, question = self.G.Terminals( + '| * ( ) symbol ε + - [ ] ?') + + E %= T + X, lambda h, s: s[2], None, lambda h, s: s[1] + X %= pipe + E, lambda h, s: UnionNode(h[0], s[2]) + X %= self.G.Epsilon, lambda h, s: h[0] + T %= F + Y, lambda h, s: s[2], None, lambda h, s: s[1] + Y %= T, lambda h, s: ConcatNode(h[0], s[1]) + Y %= self.G.Epsilon, lambda h, s: h[0] + F %= A + Z, lambda h, s: s[2], None, lambda h, s: s[1] + Z %= star, lambda h, s: ClosureNode(h[0]) + Z %= plus, lambda h, s: PositiveClosureNode(h[0]) + Z %= question, lambda h, s: QuestionNode(h[0]) + Z %= self.G.Epsilon, lambda h, s: h[0] + A %= symbol, lambda h, s: SymbolNode(s[1]) + A %= epsilon, lambda h, s: EpsilonNode(s[1]) + A %= opar + E + cpar, lambda h, s: s[2] + + self.automaton = self._build_automaton(regex, ignore_white_space) + + def _build_automaton(self, regex, ignore_white_space): + def regex_tokenizer(regex, ignore_white_space): + d = {term.Name: term for term in self.G.terminals} + tokens = [] + symbol_term = [ + term for term in self.G.terminals if term.Name == 'symbol' + ][0] + fixed_tokens = { + tok.Name: Token(tok.Name, tok) + for tok in [ + d['|'], d['*'], d['+'], d['?'], d['('], d[')'], d['['], + d[']'], d['-'], d['ε'] + ] + } + + for i, c in enumerate(regex): + if c == "!" or \ + (ignore_white_space and c.isspace()): + continue + try: + token = fixed_tokens[c] + if regex[i - 1] == '!': + raise KeyError + except KeyError: + token = Token(c, symbol_term) + tokens.append(token) + tokens.append(Token('$', self.G.EOF)) + return tokens + + toks = regex_tokenizer(regex, ignore_white_space) + parser = build_ll1_parser(self.G) + left_parse = parser(toks) + tree = evaluate_parse(left_parse, toks) + automatom = tree.evaluate() + automaton = nfa_to_deterministic(automatom) + return automaton + + def __call__(self, w: str): + return self.automaton.recognize(w) diff --git a/src/lexer/tokenizer.py b/src/lexer/tokenizer.py new file mode 100755 index 00000000..77915191 --- /dev/null +++ b/src/lexer/tokenizer.py @@ -0,0 +1,165 @@ +from automatons.state import State +from lexer.regexgenerator import Regex +from lexer.tokens import Token +from grammar.grammar import Terminal + + +class TokenLine(Token): + ''' + Clase para representar el token constante de cambio de Linea + ''' + def __init__(self): + super().__init__('\n', 'Line') + + +class Lexer: + """ + El generador de lexer se basa en un conjunto de expresiones regulares. + Cada una de ellas está asociada a un tipo de token. + El lexer termina siendo un autómata finito determinista con ciertas peculiaridades: + - Resulta de transformar el autómata unión entre todas las expresiones regulares del lenguaje, + y convertirlo a determinista. + - Cada estado final almacena los tipos de tokens que se reconocen al alcanzarlo. + Se establece una prioridad entre ellos para poder desambiaguar. + - Para tokenizar, la cadena de entrada viaja repetidas veces por el autómata. + - Cada vez, se comienza por el estado inicial, pero se continúa a partir de la última sección de la + cadena que fue reconocida. + - Cuando el autómata se "traba" durante el reconocimiento de una cadena, se reporta la ocurrencia de un token. + Su lexema está formado por la concatenación de los símbolos que fueron consumidos desde el inicio y hasta pasar + por el último estado final antes de trabarse. Su tipo de token es el de mayor relevancia entre los anotados en el + estado final. + - Al finalizar de consumir toda la cadena, se reporta el token de fin de cadena. + """ + def __init__(self, table, eof, ignore_white_space=False): + self.eof = eof + self.regexs = self._build_regexs(table, ignore_white_space) + self.automaton = self._build_automaton() + self.ignore_white_space = ignore_white_space + self.line = 1 + self.column = 1 + + def _build_regexs(self, table, ignore_white_space): + regexs = [] + # fixed blank tokens + fixed_line_token = Regex('\n', ignore_white_space=False) + fixed_space_token = Regex(' ', ignore_white_space=False) + + for n, (token_type, regex) in enumerate(table): + + regex = Regex(regex, ignore_white_space) + + start = State.from_nfa(regex.automaton) + + for state in start: + if state.final: + state.tag = (n, token_type) + regexs.append(start) + + line_automaton = State.from_nfa(fixed_line_token.automaton) + space_automaton = State.from_nfa(fixed_space_token.automaton) + + for state in line_automaton: + if state.final: + state.tag = (len(table) + 1, 'Line') + + for state in space_automaton: + if state.final: + state.tag = (len(table) + 2, 'Space') + + regexs.append(line_automaton) + regexs.append(space_automaton) + return regexs + + def _build_automaton(self): + start = State('start') + + for regex in self.regexs: + start.add_epsilon_transition(regex) + return start.to_deterministic() + + def _walk(self, string): + state = self.automaton + final = state if state.final else None + lex = '' + suffix = '' + continues = 0 + + for i, symbol in enumerate(string): + # handle special character for regex !: + if symbol == '!' and suffix and suffix[0] == '"': + suffix += symbol + self.column += 1 + continue + if symbol == '\\': + if suffix and suffix[0] == '"' and i < len( + string) - 1 and string[i + 1] not in ('n', '"'): + self.column += 1 + continues += 1 + continue + # Handle spcial case with a newline in a string + if symbol == '\n' and suffix and suffix[0] == '"': + if string[i - 1] == '\\': + self.column = 1 + self.line += 1 + continues += 1 + continue + next_state = state.transitions.get(symbol, None) + if next_state: + suffix += symbol + self.column += 1 + state = next_state[0] + if state.final: + lex += suffix + suffix = '' + final = state + else: + break + + return final, lex, suffix, continues + + def _tokenize(self, text): + while text: + string = text + final, lex, suffix, continues = self._walk(string) + if final: + n = 2**64 + token_type = None + for state in final.state: + try: + priority, tt = state.tag + if priority < n: + n = priority + token_type = tt + except TypeError: + pass + # suffix contains characters that didnt match + # so they would be count twice. We must substract + # them from column + self.column -= (len(suffix) + continues) + yield lex, token_type + text = string[len(lex) + continues:] + else: + if len(text) == len(suffix) + continues and suffix[0] == '"': + raise SyntaxError( + f'({self.line},{self.column}) - LexicographicError: String contains EOF' + ) + raise SyntaxError( + f'({self.line},{self.column}) - LexicographicError: ERROR "%r"' + % text[len(suffix) + continues]) + + yield '$', self.eof + + def __call__(self, text: str): + tokens = [] + for lex, ttype in self._tokenize(text): + if isinstance(ttype, str) and ttype == 'Line': + self.line += 1 + self.column = 1 + elif isinstance(ttype, str) and ttype == 'Space': + # IGNORE WHITE SPACE + pass + else: + tok = Token(lex, ttype, self.column, self.line) + tokens.append(tok) + + return tokens diff --git a/src/lexer/tokens.py b/src/lexer/tokens.py new file mode 100755 index 00000000..0e8be8f6 --- /dev/null +++ b/src/lexer/tokens.py @@ -0,0 +1,29 @@ +from grammar.symbols import Terminal + + +class Token: + """ + Basic token class. + + Parameters + ---------- + lex : str + Token's lexeme. + token_type : Enum + Token's type. + """ + def __init__(self, + lex: str, + token_type: Terminal, + token_column=None, + token_line=None): + self.lex = lex + self.token_type = token_type + self.token_column = token_column + self.token_line = token_line + + def __str__(self): + return f'{(self.token_line, self.token_column)} - {self.token_type}: {self.lex}' + + def __repr__(self): + return str(self) diff --git a/src/makefile b/src/makefile index 30df993f..62cc382f 100644 --- a/src/makefile +++ b/src/makefile @@ -1,12 +1,36 @@ .PHONY: clean +#define some macros +COMPSTRUCTFILE=compiler_struct.py + +# This is intended for setting a local compiler for testing. main: - # Compiling the compiler :) + @echo "[*] Compiling Cool Lexical structures" + @mkdir build + @touch build/$(COMPSTRUCTFILE) + @python install.py build/$(COMPSTRUCTFILE) + @touch build/__init__.py + @echo 1 >> .builds clean: - rm -rf build/* + rm -rf build rm -rf ../tests/*/*.mips test: pytest ../tests -v --tb=short -m=${TAG} +# install a user wide cool compiler +install: + @echo "[*] Installing python dependencies." + @$(PIP) install --user $(PIPREQUIREMENTS) + @echo "[*] Compiling Cool Lexical structures." + @$(PYTHON) install.py build/$(COMPSTRUCTFILE) + @touch build/__init__.py + @echo "[*] Generating binary." + @pyinstaller $(PYFLAGS) pycoolc.py + @echo "[*] Setting config folder." + @mkdir $(COOLCIMPORTS) + @echo "[*] Copying require modules for compiler imports." + @cp -r $(MODULES) $(COOLCIMPORTS) + @echo "[*] Making binary accesible from user current path." + @cp dist/pycoolc /usr/bin/ diff --git a/src/mips/__init__.py b/src/mips/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/src/mips/arithmetic.py b/src/mips/arithmetic.py new file mode 100644 index 00000000..85439398 --- /dev/null +++ b/src/mips/arithmetic.py @@ -0,0 +1,186 @@ +from mips.instruction import ArithmeticNode, BinaryNode + + +class ADD(ArithmeticNode): + """ + dest = src1 + src2 (Con signo). + """ + pass + + +class ADDU(ArithmeticNode): + """ + dest = src1 + src2 (Sin signo). + """ + pass + + +class AND(ArithmeticNode): + """ + dest = src1 AND src2 bit a bit. + """ + pass + + +class DIV(ArithmeticNode): + """ + dest = src1 / src2. + El resto que almacenado en el registro hi. + Esta operacion es con signo. + """ + pass + + +class DIVU(ArithmeticNode): + """ + dest = src1 / src2. Sin signo. + """ + pass + + +class ABS(BinaryNode): + """ + dest almacena el valor absoluto de src1. + """ + pass + + +class MUL(ArithmeticNode): + """ + dest = src1 * src2. + """ + pass + + +class MULO(ArithmeticNode): + """ + dest = src1 * src2 con overflow. + """ + pass + + +class MULT(BinaryNode): + """ + Multiplica $dest y $src1 dejando los primeros 4 bytes en registro lo + y el resto en hi. Operacion con signo. + """ + pass + + +class MULTU(BinaryNode): + """ + Multiplica $dest y $src1 dejando los primeros 4 bytes en registro lo + y el resto en hi. Operacion sin signo. + """ + pass + + +class NEG(BinaryNode): + """ + $dest almacena el negativo de $src1. + """ + pass + + +class NEGU(BinaryNode): + """ + Almacena el negativo sin signo de $src1 en $dest + """ + pass + + +class NOR(ArithmeticNode): + """ + Almacena en $dest el resultado de aplicar la operacion logica NOR bit a bit entre $src1 y $src2 + """ + pass + + +class NOT(BinaryNode): + """ + Almacena en $dest la negacion logica de $src1. + """ + pass + + +class OR(ArithmeticNode): + """ + Almacena en $dest el resultado de hacer OR bit a bit entre $src1 y $src2. + """ + pass + + +class REM(ArithmeticNode): + """ + Almacena en $dest el resto de dividir $src1 entre $src2. + Operacion con signo. + """ + pass + + +class REMU(ArithmeticNode): + """ + Almacena en $dest el resti de dividir $src1 entre $src2. + Operacion sin signo. + """ + pass + + +class ROL(ArithmeticNode): + """ + Almacena en $dest el resultado de rotar a la izquierda el contenido de $src1 por + $src2 bits. + """ + pass + + +class ROR(ArithmeticNode): + """ + Almacena en $dest el resultado de rotar a la derecha el contenido de $src1 por + $src2 bits. + """ + pass + + +class SLL(ArithmeticNode): + """ + Almacena en $dest lo que halla en $src1 shifteado a la izquierda $src2 bits. + """ + pass + + +class SRA(ArithmeticNode): + """ + Right Shift aritmetico. + """ + pass + + +class SRL(ArithmeticNode): + """ + Right Shift logico. + """ + pass + + +class SUB(ArithmeticNode): + """ + $dest = src1 - src2. + Operacion con signo. + """ + pass + + +class SUBU(ArithmeticNode): + """ + $dest = $src1 - $src2. + Operacion sin signo. + """ + pass + + +class XOR(ArithmeticNode): + """ + $dest = $src1 XOR $src2 bit a bit. + """ + pass diff --git a/src/mips/baseMipsVisitor.py b/src/mips/baseMipsVisitor.py new file mode 100644 index 00000000..fa3efa99 --- /dev/null +++ b/src/mips/baseMipsVisitor.py @@ -0,0 +1,448 @@ +from abstract.semantics import Attribute +from abstract.semantics import Type as SemanticType +from cil.nodes import TypeNode +from cil.nodes import CilNode, FunctionNode +from mips import load_store +from mips.arithmetic import ADDU, SUBU +from mips.branch import JAL, JALR +import mips.instruction as instrNodes +import mips.arithmetic as arithNodes +from mips.instruction import ( + FixedData, + LineComment, + MOVE, + REG_TO_STR, + a0, + fp, + ra, + sp, + v0, +) +import mips.load_store as lsNodes +from typing import List, Optional, Type, Union +import time +import cil.nodes as cil +from mips.load_store import LA, LI, LW, SW +from travels.ctcill import CilDisplayFormatter + + +class AbstractDirective(instrNodes.MipsNode): + def __init__(self, addr: str = None): + self.addr = addr + + def __str__(self): + raise NotImplementedError() + + +class DotDataDirective(AbstractDirective): + def __str__(self): + return ".data" if self.addr is None else f".data {self.addr}" + + +class DotTextDirective(AbstractDirective): + def __str__(self): + return ".text" if self.addr is None else f".text {self.addr}" + + +class DotGlobalDirective(AbstractDirective): + def __str__(self): + assert self.addr is not None + return f".global {self.addr}" + + +class BaseCilToMipsVisitor: + """ + Clase base para un visitor que transforma un AST de CIL en un AST de MIPS, a partir del cual se obtendra + luego el programa mips que se guardara en el archivo de salida. + + Un programa de mips contiene varias directivas: + + .data + Esta seccion son ensamblados en la seccion de datos del programa. Por defecto, + comienza en la proxima direccion disponible en el segmento de datos. Si el argumento + addr esta presente, entonces comienza en addr. + + .text + Los elementos de esta seccion son ensamblados en el segmento de texto. Por defecto, comienza en la proxima + direccion disponible en el segmento de texto, a menos que el argumento opcional este presente, en cuyo + caso, la proxima direccion es addr. (En SPIM, lo unico que se puede ensamblar en la seccion de texto son + instrucciones y palabras, por medio de la directiva .word). + + .kdata + Es igual a la seccion .data, pero solo es usado por el Sistema Operativo. + + .ktext + Es igual a la seccion .text, pero solo es usado por el Sistema Operativo. + + .extern sym size + Declara el label sym como global y declara que tiene size bytes de longitud (esta informacion es util para + el assembler). + + .globl sym + Declara el label sym como global. + """ + + def __init__(self): + # Un programa de MIPS es una lista de Instrucciones de MIPS. + self.program: List[instrNodes.MipsNode] = [] + # Necesitamos saber si estamos construyendo un tipo, para poder acceder + # a nombres de funciones, atributos, etc. + self.current_type: Optional[cil.TypeNode] = None + + # Necesitamos acceso a las variables locales y parametros de la funcion que estamos + # construyendo + self.current_function: Optional[cil.FunctionNode] = None + + # Llevar un record de los registros que hemos utilizado en la funcion actual + # Cada funcion es libre de usar los registros t0 -- t9 (temporales, estos registros) + # no guardan valores de retornos ni son utilizados como confiables, solo se usan para + # almacenar valores intermedios y valores de variables, para evitar accesos a memoria. + self.used_registers = [False] * 32 + + # Necesitamos acceso a los tipos del programa + self.types: List[TypeNode] = [] + + # Tipos accesibles en el codigo + self.mips_types: List[str] = [] + + # Construir el header del programa. + self.__program_header() + + self.__cil_display_formatter = CilDisplayFormatter() + + # Metodos Publicos + def register_instruction(self, node: instrNodes.MipsNode): + self.program.append(node) + return node + + # Metodos Privados + def __program_header(self): + date = time.asctime() + coolc = "Code generated by PyCoolc." + ad = "Adrian Gonzalez" + ep = "Eliane Puerta" + la = "Liset Alfaro" + institution = "School of Math and Computer Science, University of Havana" + self.comment(coolc) + self.comment(f"{ep}, {la}, {ad} --- {date}") + self.comment(institution) + self.comment("\n") + + # Funcion de ayuda para obtener la direccion de memoria de un parametro o una variable + def get_location_address(self, node: Union[cil.ParamNode, cil.LocalNode]) -> str: + """ + Devuelve el offset del parametro o variable local que estamos buscando, accediendo a este en el stack. Offset es positivo si se trata de un parametro, negativo en caso de una variable local. + """ + assert self.current_function is not None + index = -1 + params = self.current_function.params + if isinstance(node, cil.ParamNode): + # Buscar el indice del parametro al que corresponde + index = next( + i for i, param in enumerate(params, 1) if param.name == node.name + ) + + assert index > -1 + + return f"{len(params) * 4 - index * 4}($fp)" + else: + # Buscar el indice de la variable local + index = next( + i + for i, local_var in enumerate(self.current_function.localvars) + if local_var.name == node.name + ) + + assert index > -1 + index += 1 + return f"-{index * 4}($fp)" + + def get_available_register(self) -> Optional[int]: + """ + Obtiene un registro disponible. + """ + for register in instrNodes.TEMP_REGISTERS: + if not self.used_registers[register]: + self.used_registers[register] = True + return register + return None + + def add_source_line_comment(self, source: CilNode): + """ + Muestra en el archivo mips un comentario con la linea que se esta transcribiendo. + """ + self.register_instruction( + instrNodes.LineComment(self.__cil_display_formatter.visit(source)) + ) + + def cil_func_signature(self, func: FunctionNode): + """ + Genera un comentario en el archivo mips que indica la signatura de la funcion que se esta creando. + """ + self.register_instruction( + instrNodes.LineComment(f"{func.name} implementation.") + ) + self.register_instruction(instrNodes.LineComment("@Params:")) + for i, param in enumerate(func.params): + self.register_instruction( + instrNodes.LineComment(f"\t{i * 4}($fp) = {param.name}") + ) + + def operate(self, dest, left, right, operand: Type): + """ + Realiza la operacion indicada por operand entre left y right + y la guarda en dest. + """ + # left es una direccion de memoria + reg = self.get_available_register() + reg2 = self.get_available_register() + right_reg = self.get_available_register() + + assert reg is not None + assert reg2 is not None + assert right_reg is not None + + self.register_instruction(lsNodes.LW(reg2, left)) + # Load integer value + self.register_instruction(lsNodes.LW(reg, f"12(${REG_TO_STR[reg2]})")) + # right no es una constante + self.register_instruction(lsNodes.LW(reg2, right)) + # Cargar el valor + self.register_instruction(lsNodes.LW(right_reg, f"12(${REG_TO_STR[reg2]})")) + self.register_instruction(operand(reg, reg, right_reg)) + + # Crear la nueva instancia de Int + + size = 20 + + # Reservar memoria para el tipo + self.allocate_memory(size) + + self.comment("Allocating string for type Int") + + # Inicializar la instancia + self.register_instruction(LA(reg2, "String")) + self.register_instruction(SW(reg2, "0($v0)")) + + self.register_instruction(LA(reg2, "String_start")) + self.register_instruction(SW(reg2, "4($v0)")) + + # Cargar el offset del tipo + self.comment("Load type offset") + offset = next(i for i, t in enumerate(self.mips_types) if t == "String") * 4 + self.register_instruction(LI(reg2, offset)) + self.register_instruction(SW(reg2, "8($v0)")) + + self.register_instruction(LA(reg2, "Int")) + self.register_instruction(SW(reg2, "12($v0)")) + + self.register_instruction(LI(reg2, 3)) + self.register_instruction(SW(reg2, "16($v0)")) + + # devolver la instancia + self.register_instruction(MOVE(reg2, v0)) + + size = 16 + + self.allocate_memory(size) + + # Almacenar el string al tipo Int + self.register_instruction(SW(reg2, f"0($v0)")) + + self.register_instruction(LA(reg2, "Int_start")) + self.register_instruction(SW(reg2, "4($v0)")) + + # Cargar el offset del tipo + self.comment("Load type offset") + offset = next(i for i, t in enumerate(self.mips_types) if t == "Int") * 4 + self.register_instruction(LI(reg2, offset)) + self.register_instruction(SW(reg2, "8($v0)")) + + self.register_instruction(SW(reg, "12($v0)")) + + # devolver la instancia + self.register_instruction(SW(v0, dest)) + + self.used_registers[reg] = False + self.used_registers[right_reg] = False + self.used_registers[reg2] = False + + def create_type_array(self, types: List[TypeNode]): + """ + Crea en la seccion .data una secuencia de labels que referencian + los distintos tipos del programa, de modo que se puedan referenciar en + mips como mismo se referenciarian en una lista. + """ + # Generar por cada tipo, un label que lo identifique, en el mismo orden que aparecen + # en la lista de tipos. + for t in types: + self.mips_types.append(t.name) + self.register_instruction(FixedData(t.name, f'"{t.name}"', "asciiz")) + self.comment("Function END") + + def allocate_memory(self, bytes_num: int): + """ + Reserva @bytes_num bytes en heap y devuelve la direccion de memoria asignada + en $v0. + """ + self.register_instruction( + instrNodes.LineComment(f"Allocating {bytes_num} bytes of memory") + ) + + # Cargar la cantidad de bytes en el registro $a0 + self.register_instruction(load_store.LI(a0, bytes_num)) + + # $v0 = 9 (syscall 9 = sbrk) + self.register_instruction(load_store.LI(v0, 9)) + + # syscall + self.register_instruction(instrNodes.SYSCALL()) + # la direccion del espacio en memoria esta ahora en v0 + + def conditional_jump(self, node, condition, value=0, const=True): + """ + Realiza un salto condicional en dependencia de la condicion especificada + en @condition y toma por valor de comparacion @value. @const indica si @value + debe tomarse como una constante o como un registro. + """ + addr = self.get_location_address(node.variable) + reg = self.get_available_register() + + assert reg is not None, "Out of registers" + + self.add_source_line_comment(node) + + self.register_instruction(lsNodes.LW(reg, addr)) + # Comparar y saltar + self.register_instruction(condition(reg, value, node.label, const)) + + self.used_registers[reg] = False + + def allocate_stack_frame(self, node: FunctionNode): + """ + Crea el marco de pila necesario para ejecutar la funcion representada por @node. + """ + # Crear el marco de pila para la funcion + locals_count = len(node.localvars) + self.register_instruction( + instrNodes.LineComment(f"Allocate stack frame for function {node.name}.") + ) + + # Salvar primero espacio para las variables locales + if locals_count * 4 < 24: # MIPS fuerza a un minimo de 32 bytes por stack frame + self.register_instruction(arithNodes.SUBU(sp, sp, 32, True)) + ret = 32 + else: + self.register_instruction( + arithNodes.SUBU(sp, sp, locals_count * 4 + 8, True) + ) + ret = locals_count * 4 + 8 + + # Salvar ra y fp + self.register_instruction(lsNodes.SW(ra, "4($sp)")) + self.register_instruction(lsNodes.SW(fp, "0($sp)")) + + # mover fp al inicio del frame + self.register_instruction(arithNodes.ADDU(fp, sp, ret, True)) + + def deallocate_stack_frame(self, node: FunctionNode): + """ + Deshace el marco de pila creado por un llamado a @allocate_stack_frame anterior. + Esta funcion solo es un espejo de lo que realiza @allocate_stack_frame. + """ + locals_count = len(node.localvars) + self.register_instruction( + instrNodes.LineComment(f"Deallocate stack frame for function {node.name}.") + ) + + # Calcular cuantos bytes fueron reservados + if locals_count * 4 < 24: # MIPS fuerza a un minimo de 32 bytes por stack frame + ret = 32 + else: + ret = locals_count * 4 + 8 + + # restaurar ra y fp + self.comment("Restore $ra") + self.register_instruction(lsNodes.LW(ra, "4($sp)")) + self.comment("Restore $fp") + self.register_instruction(lsNodes.LW(fp, "0($sp)")) + + # restaurar el Stack Pointer + self.comment("Restore Stack pointer $sp") + self.register_instruction(arithNodes.ADDU(sp, sp, ret, True)) + + def get_method_index(self, method: str): + """ + Devuelve el indice de un metodo en las tablas virtuales. + Los metodos, ocupan el mismo indice en todas las vtables que aparezcan. + """ + for typ in self.types: + for i, (methodName, _) in enumerate(typ.methods): + if methodName == method: + return i + return 0 + + def comment(self, message: str): + self.register_instruction(instrNodes.LineComment(message)) + + def deallocate_args(self, func: FunctionNode): + args = len(func.params) + if args > 0: + self.register_instruction(LineComment("Deallocate function args")) + self.register_instruction(arithNodes.ADDU(sp, sp, 4 * args, True)) + + def define_entry_point(self): + self.register_instruction(instrNodes.Label("main")) + # Realizar un jump a entry + self.register_instruction(JAL("entry")) + # registrar instrucciones para terminar la ejecucion + self.comment("syscall code 10 is for exit") + self.register_instruction(lsNodes.LI(v0, 10)) + self.register_instruction(instrNodes.SYSCALL()) + self.comment("Function END\n") + + def locate_attribute(self, attrname: str, attributes: List[Attribute]): + # Para ubicar el atributo que vamos a manejar + # buscamos el offset del atributo en el tipo + # y luego apuntamos a ese offset en el registro + # que contiene el objeto self. Recordar que en + # COOL los atributos solo pueden ser accedidos + # directamente desde el interior de la clase. + + # Hallar el offset del atributo en el tipo que se + # esta ejecutando + offset: int = 12 + for i, attribute in enumerate(attributes): + if attribute.name == attrname: + offset += i * 4 + break + return offset + + def push_register(self, reg): + """ + Equivalente a push en x86 + """ + self.comment(f"Push register {REG_TO_STR[reg]} into stack") + self.register_instruction(SUBU(sp, sp, 4, True)) + self.register_instruction(SW(reg, "0($sp)")) + + def pop_register(self, reg): + """ + Equivalente a pop en x86 + """ + self.comment(f"Pop 4 bytes from stack into register {REG_TO_STR[reg]}") + self.register_instruction(LW(reg, "0($sp)")) + self.register_instruction(ADDU(sp, sp, 4, True)) + + +def locate_attribute_in_type_hierarchy(attribute: Attribute, base_type: SemanticType): + # El atributo se define por primera vez en el primer tipo que lo contiene + # por lo que vamos subiendo por la jerarquia de tipos hasta encontrar + # un tipo que no contenga dicho atributo. Este proceso siempre + # termina porque la raiz de la jerarquia es Object que no tiene + # ningun atributo + last = base_type + while 1: + if attribute not in last.parent.attributes: + return last.name + last = last.parent \ No newline at end of file diff --git a/src/mips/branch.py b/src/mips/branch.py new file mode 100644 index 00000000..a7f929e2 --- /dev/null +++ b/src/mips/branch.py @@ -0,0 +1,176 @@ +from mips.instruction import UnconditionalJumpNode, UnaryJumpNode, BinaryJumpNode, UnconditionalJumpRegisterNode + + +class B(UnconditionalJumpNode): + """ + Mueve el flujo de ejecucion hacia LABEL, incondicionalmente. + """ + pass + + +class J(UnconditionalJumpNode): + """ + Salta hacia label. + """ + pass + + +class JAL(UnconditionalJumpNode): + """ + Salta hacia label y almacena la direccion de la proxima instruccion en $ra. + """ + pass + + +class JR(UnconditionalJumpRegisterNode): + """ + Salta a la ubicacion apuntada por $src1. + """ + pass + + +class JALR(UnconditionalJumpRegisterNode): + """ + Salta a la ubicacion apuntada por $src1 y almacena la direccion de la proxima instruccion en $ra. + """ + + +class BEQ(BinaryJumpNode): + """ + Salta hacia label si $src1 es identico a $src2. + """ + pass + + +class BNE(BinaryJumpNode): + """ + Salta hacia label si $src1 != $src2. + """ + pass + + +class BGE(BinaryJumpNode): + """ + Salta hacia label si $src1 >= $src2. + Operacion con signo. + """ + pass + + +class BGEU(BinaryJumpNode): + """ + Salta hacia label si $src1 >= $src2. + Operacion sin signo. + """ + pass + + +class BGT(BinaryJumpNode): + """ + Salta hacia label si $src1 > $src2. + Operacion con signo. + """ + pass + + +class BGTU(BinaryJumpNode): + """ + Salta hacia label si $src1 > $src2. + Operacion sin signo. + """ + pass + + +class BLE(BinaryJumpNode): + """ + Salta hacia label si $src1 <= $src2. + Operacion con signo. + """ + pass + + +class BLEU(BinaryJumpNode): + """ + Salta hacia label si $src1 <= $src2. + Operacion sin signo. + """ + pass + + +class BLT(BinaryJumpNode): + """ + Salta hacia label si $src1 < $src2. + Operacion con signo. + """ + pass + + +class BLTU(BinaryJumpNode): + """ + Salta hacia label si $src1 < $src2. + Operacion sin signo. + """ + pass + + +class BEQZ(UnaryJumpNode): + """ + Saltar hacia label si $src1 = 0. + """ + pass + + +class BNEZ(UnaryJumpNode): + """ + Saltar hacia label si $src1 != 0. + """ + pass + + +class BGEZ(UnaryJumpNode): + """ + Saltar hacia label si $src1 >= 0. + """ + pass + + +class BGTZ(UnaryJumpNode): + """ + Saltar hacia label si $src1 > 0. + """ + pass + + +class BLEZ(UnaryJumpNode): + """ + Saltar hacia label si $src1 <= 0. + """ + pass + + +class BLTZ(UnaryJumpNode): + """ + Saltar hacia label si $src1 < 0. + """ + pass + + +class BGEZAL(UnaryJumpNode): + """ + Si $src1 >= 0 entonces pone la direccion de la proxima instruccion en $ra y salta a label. + """ + pass + + +class BGTZAL(UnaryJumpNode): + """ + Si $src1 > 0 entonces pone la direccion de la proxima instruccion en $ra y salta a label. + """ + pass + + +class BLTZAL(UnaryJumpNode): + """ + Si $src1 < 0 entonces pone la direccion de la proxima instruccion en $ra y salta a label. + """ + pass \ No newline at end of file diff --git a/src/mips/comparison.py b/src/mips/comparison.py new file mode 100644 index 00000000..677238c5 --- /dev/null +++ b/src/mips/comparison.py @@ -0,0 +1,79 @@ +from mips.instruction import ComparisonNode + + +class SEQ(ComparisonNode): + """ + $dest <-- 1 si $src1 = $src2, 0 en otro caso. + """ + pass + + +class SNE(ComparisonNode): + """ + $dest <-- 1 si $src1 != $src2, 0 en otro caso. + """ + pass + + +class SGE(ComparisonNode): + """ + $dest <-- 1 si $src1 >= $src2, 0 en otro caso. + Operacion con signo. + """ + pass + + +class SGEU(ComparisonNode): + """ + $dest <-- 1 si $src1 >= $src2, 0 en otro caso. + Operacion sin signo. + """ + pass + + +class SGT(ComparisonNode): + """ + $dest <-- 1 si $src1 > $src2, 0 en otro caso. + Operacion con signo. + """ + pass + + +class SGTU(ComparisonNode): + """ + $dest <-- 1 si $src1 > $src2, 0 en otro caso. + Operacion sin signo. + """ + pass + + +class SLE(ComparisonNode): + """ + $dest <-- 1 si $src1 <= $src2, 0 en otro caso. + Operacion con signo. + """ + pass + + +class SLEU(ComparisonNode): + """ + $dest <-- 1 si $src1 <= $src2, 0 en otro caso. + Operacion sin signo. + """ + pass + + +class SLT(ComparisonNode): + """ + $dest <-- 1 si $src1 < $src2, 0 en otro caso. + Operacion con signo. + """ + pass + + +class SLTU(ComparisonNode): + """ + $dest <-- 1 si $src1 < $src2, 0 en otro caso. + Operacion sin signo. + """ + pass diff --git a/src/mips/instruction.py b/src/mips/instruction.py new file mode 100644 index 00000000..11feb257 --- /dev/null +++ b/src/mips/instruction.py @@ -0,0 +1,274 @@ +""" +Este modulo ofrece wrappers a las instrucciones de mips de modo que se puedan +parametrizar y sea facil su uso a la hora de escribir en ensamblador. +""" + +# ********************** REGISTROS ********************************* + +zero = 0 # Siempre almacena la constante 0. +at = 1 # Reservado para el assembler. + +# Registros para almacenar resultados +v0 = 2 +v1 = 3 + +# Registros para almacenar argumentos +a0 = 4 +a1 = 5 +a2 = 6 +a3 = 7 + +# Registros temporales +t0 = 8 +t1 = 9 +t2 = 10 +t3 = 11 +t4 = 12 +t5 = 13 +t6 = 14 +t7 = 15 +t8 = 24 +t9 = 25 + +# Saved Registers +s0 = 16 +s1 = 17 +s2 = 18 +s3 = 19 +s4 = 20 +s5 = 21 +s6 = 22 +s7 = 23 + +# Registros del kernel +k0 = 26 +k1 = 27 + +# Global Data Pointer +gp = 28 + +# Stack Pointer +sp = 29 + +# Frame Pointer +fp = 30 + +# Direccion de retorno +ra = 31 + +TEMP_REGISTERS = (t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, s2, s3, s4, s5, s6, s7, v1) +ARGS_REGISTERS = (a0, a1, a2, a3) + +REG_TO_STR = { + zero: "zero", + v0: "v0", + v1: "v1", + s0: "s0", + s1: "s1", + s2: "s2", + s3: "s3", + s4: "s4", + s5: "s5", + s6: "s6", + s7: "s7", + sp: "sp", + fp: "fp", + ra: "ra", + gp: "gp", + t0: "t0", + t1: "t1", + t2: "t2", + t3: "t3", + t4: "t4", + t5: "t5", + t6: "t6", + t7: "t7", + t8: "t8", + t9: "t9", + a0: "a0", + a1: "a1", + a2: "a2", + a3: "a3", + at: "at" +} + + +class MipsNode: + pass + + +# ********************** INSTRUCCIONES ARITMETICAS ***************************** +class ArithmeticNode(MipsNode): + def __init__(self, dest: int, src1: int, src2: int, const_src2=False): + self.dest = dest + self.src1 = src1 + self.src2 = src2 + self.action = self.__class__.__name__.lower() + self.const_src2 = const_src2 + if '_' in self.action: + self.action = self.action.replace('_', "") + + def __str__(self): + if self.const_src2: + return f'{self.action} ${REG_TO_STR[self.dest]}, ${REG_TO_STR[self.src1]}, {self.src2}' + return f'{self.action} ${REG_TO_STR[self.dest]}, ${REG_TO_STR[self.src1]}, ${REG_TO_STR[self.src2]}' + + +class BinaryNode(MipsNode): + def __init__(self, dest: int, src1: int): + self.dest = dest + self.src1 = src1 + self.action = self.__class__.__name__.lower().replace('_', "") + + def __str__(self): + return f'{self.action} ${REG_TO_STR[self.dest]}, ${REG_TO_STR[self.src1]}' + + +# ************************* INSTRUCCIONES DE COMPARACION ****************** +class ComparisonNode(MipsNode): + def __init__(self, dest: int, src1: int, src2: int, const_src2=False): + self.dest = dest + self.src1 = src1 + self.src2 = src2 + self.action = self.__class__.__name__.lower() + self.const_src2 = const_src2 + + def __str__(self): + if self.const_src2: + return f'{self.action} ${REG_TO_STR[self.dest]}, ${REG_TO_STR[self.src1]}, {self.src2}' + return f'{self.action} ${REG_TO_STR[self.dest]}, ${REG_TO_STR[self.src1]}, ${REG_TO_STR[self.src2]}' + + +# ************************ INSTRUCCIONES DE SALTO ********************* +class UnconditionalJumpNode(MipsNode): + def __init__(self, label: str): + self.label = label + self.action = self.__class__.__name__.lower() + + def __str__(self): + return f'{self.action} {self.label}' + + +class UnconditionalJumpRegisterNode(MipsNode): + def __init__(self, src1: int): + self.src1 = src1 + self.action = self.__class__.__name__.lower() + + def __str__(self): + return f'{self.action} ${REG_TO_STR[self.src1]}' + + +class UnaryJumpNode(MipsNode): + def __init__(self, src1: int, label: str): + self.src1 = src1 + self.label = label + self.action = self.__class__.__name__.lower() + + def __str__(self): + return f'{self.action} ${REG_TO_STR[self.src1]}, {self.label}' + + +class BinaryJumpNode(MipsNode): + def __init__(self, src1: int, src2: int, label: str, const_src2=False): + self.src1 = src1 + self.src2 = src2 + self.label = label + self.const_src2 = const_src2 + self.action = self.__class__.__name__.lower() + + def __str__(self): + if self.const_src2: + return f'{self.action} ${REG_TO_STR[self.src1]}, {self.src2}, {self.label}' + return f'{self.action} ${REG_TO_STR[self.src1]}, ${REG_TO_STR[self.src2]}, {self.label}' + + +# ******************** INSTRUCCIONES PARA ALMACENAR Y CARGAR DATOS EN REGISTROS ************ +class AbstractLoadNode(MipsNode): + def __init__(self, dest: int, src): + self.dest = dest + self.src = src + self.action = self.__class__.__name__.lower() + + def __str__(self): + return f'{self.action} ${REG_TO_STR[self.dest]}, {self.src}' + + +class MOVE(BinaryNode): + """ + Copia el contenido de $src1 en $dest. + """ + pass + + +# ******************** MANEJO DE EXCEPCIONES ************************* +class RFE(MipsNode): + """ + Retorna de una excepcion. + """ + def __str__(self): + return "rfe" + + +class SYSCALL(MipsNode): + """ + Realiza una llamada a sistema. + """ + def __str__(self): + return "syscall" + + +class BREAK(MipsNode): + """ + Usado por el debugger. + """ + def __init__(self, const: int): + self.const = const + + def __str__(self): + return f'break {self.const}' + + +class NOP(MipsNode): + """ + Instruccion que no hace nada, salvo consumir un ciclo del reloj. + """ + def __str__(self): + return "nop" + + +class LineComment(MipsNode): + """ + Representa un comentario en una linea + """ + def __init__(self, string: str): + self.text = string + + def __str__(self): + return f'# {self.text}' + + +class Label(MipsNode): + """ + Representa un label. (almacena una direccion de memoria a la cual se puede referenciar) + """ + def __init__(self, label: str): + self.label = label + + def __str__(self): + return f"{self.label}: " + + +class FixedData(MipsNode): + """ + Representa un dato en la seccion .data. + Por ejemplo: + msg: .asciiz "Hello World!\n" + """ + def __init__(self, name: str, value, type_="word"): + assert type_ in ("word", "asciiz", "byte", "space") + self.name = name + self.value = value + self.type = type_ + + def __str__(self): + return f"{self.name}: .{self.type} {self.value}" \ No newline at end of file diff --git a/src/mips/load_store.py b/src/mips/load_store.py new file mode 100644 index 00000000..78e9d863 --- /dev/null +++ b/src/mips/load_store.py @@ -0,0 +1,104 @@ +from mips.instruction import AbstractLoadNode + + +class LA(AbstractLoadNode): + """ + Carga la direccion de un label (indicado por src). + """ + pass + + +class LB(AbstractLoadNode): + """ + Carga el byte desde src en $dest. + Operacion con signo. + """ + pass + + +class LBU(AbstractLoadNode): + """ + Carga el byte desde src en $dest. + Operacion sin signo. + """ + pass + + +class LH(AbstractLoadNode): + """ + Carga media palabra (2 bytes) desde src en $dest. + Operacion con signo. + """ + pass + + +class LHU(AbstractLoadNode): + """ + Carga media palabra (2 bytes) desde src en $dest. + Operacion sin signo. + """ + pass + + +class LI(AbstractLoadNode): + """ + Carga la constante src en $dest. + """ + pass + + +class LUI(AbstractLoadNode): + """ + Carga la constante src en los dos bytes superiores de $dest, y setea los 2 bytes inferiores + a 0. + """ + pass + + +class LW(AbstractLoadNode): + """ + Carga los 4 bytes a partir de src en $dest. + """ + pass + + +class ULH(AbstractLoadNode): + """ + Carga 2 bytes empezando en src en $dest + """ + pass + + +class SB(AbstractLoadNode): + """ + Almacena el primer byte del registro $dest en addr. + """ + pass + + +class SH(AbstractLoadNode): + """ + Almacena los primeros dos bytes del registro $dest en addr. + """ + pass + + +class SW(AbstractLoadNode): + """ + Almacena los 4 bytes del registro $dest en addr. + """ + pass + + +class SWL(AbstractLoadNode): + """ + Almacena los ultimos dos bytes del registro $dest en addr (esta direccion esta probablemente desalineada). + """ + pass + + +class USW(AbstractLoadNode): + """ + Almacena los 4 bytes del registro $dest en addr (esta direccion esta probablemente desalineada). + """ + pass \ No newline at end of file diff --git a/src/parserr/__init__.py b/src/parserr/__init__.py new file mode 100755 index 00000000..4ab414f6 --- /dev/null +++ b/src/parserr/__init__.py @@ -0,0 +1,9 @@ + +def setup(): + import os + from sys import path + BASE = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + path.append(BASE) + +if __name__ == '__main__': + setup() diff --git a/src/parserr/ll1.py b/src/parserr/ll1.py new file mode 100755 index 00000000..8add2c56 --- /dev/null +++ b/src/parserr/ll1.py @@ -0,0 +1,67 @@ +from typing import Dict, List, Tuple, Union, Optional +from lexer.tokens import Token +from tools.firsts import compute_firsts +from tools.follows import compute_follows +from grammar.grammar import Grammar, NonTerminal, Terminal +from grammar.symbols import AttributeProduction, Production, Sentence, Symbol + +TableEntry = Tuple[NonTerminal, Terminal] +ProductionType = Union[Production, AttributeProduction] +Symb = Union[Terminal, NonTerminal] + + +def build_ll1_parsing_table(G: Grammar, firsts: Dict, follows: Dict): + table: Dict[TableEntry, ProductionType] = {} + + for production in G.Productions: + x, alpha = production.Left, production.Right + + for t in firsts[alpha]: + # si la tabla contiene entradas repetidas entonces la gramatica + # no es LL(1) + assert not table.get((x, t), None), "La gramatica no es LL(1)" + table[(x, t)] = production + + if firsts[alpha].contains_epsilon: + for t in follows[x]: + assert not table.get((x, t), None), "La gramatica no es LL(1)" + table[(x, t)] = production + return table + + +def build_ll1_parser(G: Grammar): + firsts = compute_firsts(G) + follows = compute_follows(G, firsts) + table = build_ll1_parsing_table(G, firsts, follows) + + def parser(w: List[Token]): + # Asumimos que w termina en $ + stack = [G.startSymbol] + cursor = 0 + output = [] + + while stack: + sym = stack.pop() + assert isinstance(sym, Terminal) or isinstance(sym, NonTerminal) + if sym.IsTerminal: + assert sym == w[ + cursor].token_type, "La cadena no pertenece al lenguaje" + cursor += 1 + else: + assert isinstance(sym, NonTerminal) + try: + production = table[(sym, w[cursor].token_type)] + output.append(production) + try: + for symbol in production.Right[::-1]: + stack.append(symbol) + except AttributeError: + pass + except KeyError: + raise Exception('La cadena no pertenece al lenguaje') + + assert w[ + cursor].token_type == G.EOF, 'La cadena no pertenece al lenguaje' + return output + + return parser diff --git a/src/parserr/lr.py b/src/parserr/lr.py new file mode 100755 index 00000000..e6990c2f --- /dev/null +++ b/src/parserr/lr.py @@ -0,0 +1,236 @@ +from grammar.grammar import Grammar +from grammar.items import Item +from grammar.symbols import NonTerminal, Terminal +from tools.firsts import ContainerSet +from automatons.state import State +from parserr.shiftreduce import ShiftReduceParser +from tools.firsts import compute_firsts, compute_local_first +from typing import Dict, Iterable, Optional, List, Union, Set, FrozenSet + +Symb = Optional[Union[Terminal, NonTerminal]] + + +def expand(item: Item, firsts): + next_symbol = item.NextSymbol + if next_symbol is None or not next_symbol.IsNonTerminal: + return [] + + assert isinstance(next_symbol, NonTerminal) + lookaheads = ContainerSet() + + for remainder in item.Preview(): + for lookahead in compute_local_first(firsts=firsts, alpha=remainder): + lookaheads.update(ContainerSet(lookahead)) + + assert not lookaheads.contains_epsilon + expanded = [ + Item(production, 0, lookaheads) + for production in next_symbol.productions + ] + return expanded + + +def compress(items: Iterable[Item]) -> Set[Item]: + centers: Dict[Item, Set] = {} + + for item in items: + center = item.Center() + try: + lookaheads = centers[center] + except KeyError: + centers[center] = lookaheads = set() + lookaheads.update(item.lookaheads) + + return { + Item(x.production, x.pos, set(lookahead)) + for x, lookahead in centers.items() + } + + +def closure_lr1(items: Iterable[Item], firsts) -> Set[Item]: + closure = ContainerSet(*items) + + changed = True + while changed: + changed = False + + new_items = ContainerSet() + + for item in closure: + new_items.update(ContainerSet(*expand(item, firsts))) + + changed = closure.update(new_items) + + return compress(closure) + + +def goto_lr1(items, symbol: Symb, firsts=None, just_kernel=False): + assert just_kernel or firsts is not None, '`firsts` must be provided if `just_kernel=False`' + items = frozenset(item.next_item() for item in items + if item.NextSymbol == symbol and item) + return items if just_kernel else closure_lr1(items, firsts) + + +def build_LR1_automaton(G: Grammar): + assert len(G.startSymbol.productions) == 1, 'Grammar must be augmented' + + firsts = compute_firsts(G) + firsts[G.EOF] = ContainerSet(G.EOF) + + start_production = G.startSymbol.productions[0] + start_item = Item(start_production, 0, lookaheads=(G.EOF, )) + start = frozenset([start_item]) + + closure = closure_lr1(start, firsts) + automaton = State(frozenset(closure), True) + + pending = [start] + visited = {start: automaton} + + while pending: + current = pending.pop() + current_state = visited[current] + + for symbol in G.terminals + G.nonTerminals: + next_item = goto_lr1(current_state.state, symbol, just_kernel=True) + if next_item: + try: + next_state = visited[next_item] + except KeyError: + next_state = State( + frozenset(closure_lr1(next_item, firsts)), True) + visited[next_item] = next_state + pending += [next_item] + + current_state.add_transition(symbol.Name, next_state) + + return automaton + + +def build_lalr_automaton(G): + def centers(items: Iterable[Optional[Item]]): + return frozenset(item.Center() for item in items) + + def lookaheads(items: Iterable[Optional[Item]]): + return {item.Center(): item.lookaheads for item in items} + + def subset(items1, items2): + return all(items1[i] <= items2[i] for i in items1) + + assert len(G.startSymbol.productions) == 1, 'Grammar must be augmented' + firsts = compute_firsts(G) + firsts[G.EOF] = ContainerSet(G.EOF) + + start_production = G.startSymbol.productions[0] + start_item = Item(start_production, 0, (G.EOF, )) + + start = State((closure_lr1(start_item, firsts)), True) + + pending = [start_item] + visisted_centers = {centers(start.state): start} + visited = {start_item: start} + + while pending: + # if len(pending) > 124: + # print('ss') + current_state = visited[pending.pop()] + for symbol in G.terminals + G.nonTerminals: + next_item = frozenset(goto_lr1(current_state.state, symbol, + firsts)) + + if next_item: + # Caso en que pueda mezclar el nuevo item + try: + next_state = visisted_centers[centers(next_item)] + if not subset(lookaheads(next_item), + lookaheads(next_state.state)): + next_state.state = compress( + list(next_state.state) + list(next_item)) + pending.append(frozenset(next_state.state)) + visited[frozenset(next_state.state)] = next_state + except KeyError: + next_state = State(next_item, True) + pending += [next_item] + visisted_centers[centers(next_item)] = next_state + visited[next_item] = next_state + current_state.add_transition(symbol.Name, next_state) + + return start + + +class LR1Parser(ShiftReduceParser): + def _build_parsing_table(self): + # G = self.G.AugmentedGrammar() if not self.G.IsAugmentedGrammar else self.G + + automaton = build_LR1_automaton(self.G) + for i, node in enumerate(automaton): + node.idx = i + for node in automaton: + idx = node.idx + for item in node.state: + if item.IsReduceItem: + if item.production.Left == self.G.startSymbol: + self._register(self.action, (idx, self.G.EOF), + ('OK', item.production)) + else: + for lookahead in item.lookaheads: + self._register(self.action, (idx, lookahead), + ('REDUCE', item.production)) + else: + next_symbol = item.NextSymbol + try: + if next_symbol.IsNonTerminal: + next_state = node.transitions[next_symbol.Name][0] + self._register(self.goto, (idx, next_symbol), + next_state.idx) + else: + next_state = node.transitions[next_symbol.Name][0] + self._register(self.action, (idx, next_symbol), + ('SHIFT', next_state.idx)) + except KeyError: + pass + + @staticmethod + def _register(table, key, value): + # assert key not in table or table[key] == value, f'Shift-Reduce or Reduce-Reduce conflict!!!\n tried to put {value} in {key} already exist with value {table[key]}' + if not (key not in table or table[key] == value): + print( + f'Shift-Reduce or Reduce-Reduce conflict!!!\n tried to put {value} in {key} already exist with value {table[key]}' + ) + print(table) + assert False + table[key] = value + + +class LALRParser(ShiftReduceParser): + def _build_parsing_table(self): + register = LR1Parser._register + G = self.G.AugmentedGrammar() + automaton = build_lalr_automaton(G) + for i, node in enumerate(automaton): + node.idx = i + + for node in automaton: + idx = node.idx + for item in node.state: + if item.IsReduceItem: + if item.production.Left == G.startSymbol: + register(self.action, (idx, G.EOF), + ('OK', item.production)) + else: + for lookahead in item.lookaheads: + register(self.action, (idx, lookahead), + ('REDUCE', item.production)) + else: + next_symbol = item.NextSymbol + try: + if next_symbol.IsNonTerminal: + next_state = node.transitions[next_symbol.Name][0] + register(self.goto, (idx, next_symbol), + next_state.idx) + else: + next_state = node.transitions[next_symbol.Name][0] + register(self.action, (idx, next_symbol), + ('SHIFT', next_state.idx)) + except KeyError: + pass diff --git a/src/parserr/shiftreduce.py b/src/parserr/shiftreduce.py new file mode 100755 index 00000000..7ed536a6 --- /dev/null +++ b/src/parserr/shiftreduce.py @@ -0,0 +1,112 @@ +""" +Este modulo contiene la declaracion de la clase ShiftReduceParser, la cual +sirve de base para los parsers SLR, LALR y LR +""" +from typing import Dict, List, Literal, Tuple, Union +from grammar.grammar import EOF, Grammar +from grammar.symbols import Production, Terminal +from lexer.tokens import Token + +Action = Union[Literal["SHIFT"], Literal["REDUCE"], Literal["OK"]] +Tag = Union[Production, int] +ActionTableEntry = Tuple[int, Terminal] + + +class ShiftReduceParser: + """ + Clase base para los parsers SLR(1), LALR(1) y LR(1). + No se debe instanciar directamente, en vez de eso, todo parser + cuyo funcionamiento se base en las acciones shift reduce deben heredar + de esta clase e implementar el metodo build_parsing_table. + """ + + SHIFT = "SHIFT" + REDUCE = "REDUCE" + OK = "OK" + + def __init__(self, G: Grammar, verbose: bool = False): + self.G = G + self.verbose = verbose + self.action: Dict[ActionTableEntry, Tuple[Action, Tag]] = {} + self.goto = {} + self._build_parsing_table() + + def _build_parsing_table(self): + raise NotImplementedError() + + def __call__(self, tokens: List[Token]): + stack = [0] + cursor = 0 + output = [] + + if isinstance(tokens[0].token_type, EOF): + raise SyntaxError("(0,0) - SyntacticError: Cool program must not be empty.") + + while True: + state = stack[-1] + lookahead = tokens[cursor].token_type + try: + action, tag = self.action[state, lookahead] + except KeyError: + col = tokens[cursor].token_column - len(tokens[cursor].lex) + if lookahead.Name == "self" or ( + lookahead.Name == "assign" + and tokens[cursor - 1].token_type.Name == "self" + ): + raise SyntaxError( + f"({tokens[cursor].token_line},{col}) - " + + f' SemanticError: ERROR "%s"' % tokens[cursor].lex + ) + raise SyntaxError( + f"({tokens[cursor].token_line},{col}) - " + + f' SyntacticError: ERROR "%s"' % tokens[cursor] + ) + + if action == self.SHIFT: + cursor += 1 + assert isinstance(tag, int) + stack.append(tag) + + elif action == self.REDUCE: + assert isinstance(tag, Production) + head, body = tag + + for _ in range(len(body)): + stack.pop() + + output.append(tag) + new_state = self.goto[stack[-1], head] + stack.append(new_state) + + elif action == self.OK: + output.append(tag) + return output[::-1] + + else: + raise Exception("La cadena no pertenece al lenguaje") + + def dumps_parser_state(self, file): + """ + Devuelve un formato objeto de tipo bytes (o string) + que sirve para guardar el estado del parser en un fichero + para cargarlo posteriormente con load. + """ + try: + import cloudpickle # type: ignore + except ImportError: + return False + + try: + cloudpickle.dump(self, file) + return True + except Exception: + return False + + @staticmethod + def load_parser_state(file): + try: + import cloudpickle as pickle + + return pickle.load(file) + except ImportError: + return None diff --git a/src/parserr/slr.py b/src/parserr/slr.py new file mode 100755 index 00000000..bc18b5d7 --- /dev/null +++ b/src/parserr/slr.py @@ -0,0 +1,88 @@ +from tools.firsts import compute_firsts +from tools.follows import compute_follows +from automatons.state import State +from grammar.items import Item +from parserr.shiftreduce import ShiftReduceParser + + +class SLR1Parser(ShiftReduceParser): + def build_LR0_automaton(self, G): + assert len(G.startSymbol.productions) == 1, 'Grammar must be augmented' + + start_production = G.startSymbol.productions[0] + start_item = Item(start_production, 0) + + automaton = State(start_item, True) + + pending = [start_item] + visited = {start_item: automaton} + + while pending: + current_item = pending.pop() + if current_item.IsReduceItem: + continue + + current_state = visited[current_item] + symbol = current_item.NextSymbol + try: + next_state = visited[current_item.next_item()] + except KeyError: + next_state = State(current_item.next_item(), True) + visited[current_item.next_item()] = next_state + + current_state.add_transition(symbol.Name, next_state) + pending.append(current_item.next_item()) + if symbol.IsNonTerminal: + for production in symbol.productions: + item = Item(production, 0) + try: + state = visited[item] + except KeyError: + state = State(item, True) + visited[item] = state + pending.append(item) + current_state.add_epsilon_transition(state) + + return automaton + + def _build_parsing_table(self): + G = self.G.AugmentedGrammar() + firsts = compute_firsts(G) + follows = compute_follows(G, firsts) + + automaton = self.build_LR0_automaton(G).to_deterministic() + for i, node in enumerate(automaton): + if self.verbose: print(i, node) + node.idx = i + + for node in automaton: + idx = node.idx + for state in node.state: + item = state.state + + if item.IsReduceItem: + head = item.production.Left + if head == G.startSymbol: + self._register(self.action, (idx, G.EOF), + ('OK', item.production)) + else: + for c in follows[head]: + self._register(self.action, (idx, c), + ('REDUCE', item.production)) + else: + symbol = item.NextSymbol + try: + trans_idx = node.transitions[symbol.Name][0].idx + if symbol.IsNonTerminal: + self._register(self.goto, (idx, symbol), trans_idx) + else: + self._register(self.action, (idx, symbol), + ('SHIFT', trans_idx)) + except KeyError: + pass + + @staticmethod + def _register(table, key, value): + assert key not in table or table[ + key] == value, 'Shift-Reduce or Reduce-Reduce conflict!!!' + table[key] = value diff --git a/src/pycoolc.py b/src/pycoolc.py new file mode 100644 index 00000000..f826ad20 --- /dev/null +++ b/src/pycoolc.py @@ -0,0 +1,75 @@ +from argparse import ArgumentParser +from build.compiler_struct import LEXER, PARSER +from cil.nodes import CilProgramNode +from travels.ciltomips import MipsCodeGenerator +from typecheck.evaluator import evaluate_right_parse +from comments import find_comments +from travels.ctcill import CilDisplayFormatter, CoolToCILVisitor +import sys + + +def report(errors: list): + for error in set(errors): + print(error) + + +def pipeline(program: str, deep: int, file_name) -> None: + try: + program = find_comments(program) + program = program.replace('\t', ' ' * 4) + except AssertionError as e: + print(e) + sys.exit(1) + + # Right now, program has no comments, so is safe to pass it to the LEXER + try: + tokens = LEXER(program) + except Exception as e: + print(e) + sys.exit(1) + + # Parse the tokens to obtain a derivation tree + try: + parse = PARSER(tokens) + except Exception as e: + print(e) + sys.exit(1) + # build the AST from the obtained parse + # try: + ast = evaluate_right_parse(parse, tokens[:-1]) + # except Exception as e: + # print(e) + # sys.exit(1) + ##################### + # Start the visitors # + ###################### + + # Run type checker visitor + errors, context, scope = ast.check_semantics(deep) + if errors: + report(errors) + sys.exit(1) + + cil_travel = CoolToCILVisitor(context) + cil_program_node = cil_travel.visit(ast, scope) + # formatter = CilDisplayFormatter() + # print(formatter(cil_program_node)) + + mips_gen = MipsCodeGenerator() + assert isinstance(cil_program_node, CilProgramNode) + source = mips_gen(cil_program_node) + + with open(f"{file_name[: len(file_name) - 3]}.mips", "w+") as f: + f.write(source) + + +if __name__ == "__main__": + parser = ArgumentParser() + parser.add_argument("file", type=str, help="Cool source file.") + parser.add_argument("--deep", type=int) + args = parser.parse_args() + deep = 1 if args.deep is None else args.deep + with open(args.file, "r") as f: + program = f.read() + pipeline(program, deep, args.file) + sys.exit(0) diff --git a/src/testing.mips b/src/testing.mips new file mode 100644 index 00000000..d09521d0 --- /dev/null +++ b/src/testing.mips @@ -0,0 +1,1138 @@ + +# Code generated by PyCoolc. +# Eliane Puerta, Liset Alfaro, Adrian Gonzalez --- Mon Dec 14 10:20:50 2020 +# School of Math and Computer Science, University of Havana +# + +.data +dummy: .word 0 +IO: .asciiz "IO" +# Function END +Object: .asciiz "Object" +# Function END +String: .asciiz "String" +# Function END +Bool: .asciiz "Bool" +# Function END +Int: .asciiz "Int" +# Function END +Complex: .asciiz "Complex" +# Function END +Main: .asciiz "Main" +# Function END +# + + +# **** VTABLE for type IO **** +IO_vtable: .word dummy, dummy, dummy, function_type_name_at_Object, dummy, function_abort_at_Object, function_out_int_at_IO, dummy, function_in_string_at_IO, dummy, function_copy_at_Object, function_in_int_at_IO, function_out_string_at_IO +# Function END +# + + +# **** Type RECORD for type IO **** +IO_start: + IO_vtable_pointer: .word IO_vtable + # Function END +IO_end: +# + + +# **** VTABLE for type Object **** +Object_vtable: .word dummy, dummy, dummy, function_type_name_at_Object, dummy, function_abort_at_Object, dummy, dummy, dummy, dummy, function_copy_at_Object, dummy, dummy +# Function END +# + + +# **** Type RECORD for type Object **** +Object_start: + Object_vtable_pointer: .word Object_vtable + # Function END +Object_end: +# + + +# **** VTABLE for type String **** +String_vtable: .word dummy, function_substr_at_String, function_length_at_String, function_type_name_at_Object, dummy, function_abort_at_Object, dummy, function_concat_at_String, dummy, dummy, function_copy_at_Object, dummy, dummy +# Function END +# + + +# **** Type RECORD for type String **** +String_start: + String_vtable_pointer: .word String_vtable + # Function END +String_end: +# + + +# **** VTABLE for type Bool **** +Bool_vtable: .word dummy, dummy, dummy, function_type_name_at_Object, dummy, function_abort_at_Object, dummy, dummy, dummy, dummy, function_copy_at_Object, dummy, dummy +# Function END +# + + +# **** Type RECORD for type Bool **** +Bool_start: + Bool_vtable_pointer: .word Bool_vtable + # Function END +Bool_end: +# + + +# **** VTABLE for type Int **** +Int_vtable: .word dummy, dummy, dummy, function_type_name_at_Object, dummy, function_abort_at_Object, dummy, dummy, dummy, dummy, function_copy_at_Object, dummy, dummy +# Function END +# + + +# **** Type RECORD for type Int **** +Int_start: + Int_vtable_pointer: .word Int_vtable + # Function END +Int_end: +# + + +# **** VTABLE for type Complex **** +Complex_vtable: .word dummy, dummy, dummy, function_type_name_at_Object, function_init_at_Complex, function_abort_at_Object, function_out_int_at_IO, dummy, function_in_string_at_IO, function_sum_at_Complex, function_copy_at_Object, function_in_int_at_IO, function_out_string_at_IO +# Function END +# + + +# **** Type RECORD for type Complex **** +Complex_start: + Complex_vtable_pointer: .word Complex_vtable + # Function END +Complex_end: +# + + +# **** VTABLE for type Main **** +Main_vtable: .word function_main_at_Main, dummy, dummy, function_type_name_at_Object, dummy, function_abort_at_Object, function_out_int_at_IO, dummy, function_in_string_at_IO, dummy, function_copy_at_Object, function_in_int_at_IO, function_out_string_at_IO +# Function END +# + + +# **** Type RECORD for type Main **** +Main_start: + Main_vtable_pointer: .word Main_vtable + # Function END +Main_end: +# + + +data_0: .asciiz "" +# + + +data_1: .asciiz "Abort called from class " +# + + +data_2: .asciiz "\n" +# + + +IO__TDT: .word 0, -1, -1, -1, -1, 1, 1 +Object__TDT: .word 1, 0, 1, 1, 1, 2, 2 +String__TDT: .word -1, -1, 0, -1, -1, -1, -1 +Bool__TDT: .word -1, -1, -1, 0, -1, -1, -1 +Int__TDT: .word -1, -1, -1, -1, 0, -1, -1 +Complex__TDT: .word -1, -1, -1, -1, -1, 0, -1 +Main__TDT: .word -1, -1, -1, -1, -1, -1, 0 +# + + +.text +main: + jal entry + # syscall code 10 is for exit + li $v0, 10 + syscall + # Function END + +# function_in_string_at_IO implementation. +# @Params: +function_in_string_at_IO: + # Allocate stack frame for function function_in_string_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_in_string_at_IO_internal_0 --> -4($fp) + # Allocating 1024 bytes of memory + li $a0, 1024 + li $v0, 9 + syscall + move $t0, $v0 + move $a0, $v0 + li $a1, 1024 + li $v0, 8 + syscall + move $t2, $zero + move $t3, $zero + move $t1, $t0 + lb $t3, 0($t1) + beqz $t3, end_loop + read_length_loop: + lb $t3, 0($t1) + beqz $t3, end_read_length_loop + addu $t1, $t1, 1 + addu $t2, $t2, 1 + j read_length_loop + end_read_length_loop: + subu $t1, $t1, 1 + sb $zero, 0($t1) + subu $t2, $t2, 1 + end_loop: + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $t2, 16($v0) + sw $v0, -4($fp) + # RETURN local_in_string_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_in_string_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_out_int_at_IO implementation. +# @Params: +# 0($fp) = param_out_int_at_IO_x_0 +function_out_int_at_IO: + # Allocate stack frame for function function_out_int_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # PRINT_INT param_out_int_at_IO_x_0 + # PARAM param_out_int_at_IO_x_0 --> 0($fp) + lw $v0, 0($fp) + lw $a0, 12($v0) + li $v0, 1 + syscall + # LOCAL local_out_int_at_IO_internal_0 --> -4($fp) + # local_out_int_at_IO_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_out_int_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_out_int_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_out_string_at_IO implementation. +# @Params: +# 0($fp) = param_out_string_at_IO_x_0 +function_out_string_at_IO: + # Allocate stack frame for function function_out_string_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # PARAM param_out_string_at_IO_x_0 --> 0($fp) + # PRINT_STR param_out_string_at_IO_x_0 + lw $v0, 0($fp) + lw $a0, 12($v0) + li $v0, 4 + syscall + # LOCAL local_out_string_at_IO_internal_0 --> -4($fp) + # local_out_string_at_IO_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_out_string_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_out_string_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_in_int_at_IO implementation. +# @Params: +function_in_int_at_IO: + # Allocate stack frame for function function_in_int_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_in_int_at_IO_internal_0 --> -4($fp) + # local_in_int_at_IO_internal_0 = READ_INT + li $v0, 5 + syscall + move $a2, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + sw $a2, 12($v0) + sw $v0, -4($fp) + # RETURN local_in_int_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_in_int_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_abort_at_Object implementation. +# @Params: +function_abort_at_Object: + # Allocate stack frame for function function_abort_at_Object. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_abort_at_Object_internal_0 --> -4($fp) + lw $t0, 0($s1) + sw $t0, -4($fp) + # LOCAL local_abort_at_Object_internal_0 --> -4($fp) + la $a0, data_1 + li $v0, 4 + syscall + lw $a0, -4($fp) + li $v0, 4 + syscall + la $a0, data_2 + li $v0, 4 + syscall + li $v0, 10 + syscall + # Function END + + +# function_copy_at_Object implementation. +# @Params: +function_copy_at_Object: + # Allocate stack frame for function function_copy_at_Object. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_copy_at_Object_internal_0 --> -4($fp) + # local_copy_at_Object_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_copy_at_Object_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function function_copy_at_Object. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_type_name_at_Object implementation. +# @Params: +function_type_name_at_Object: + # Allocate stack frame for function function_type_name_at_Object. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_type_name_at_Object_internal_0 --> -4($fp) + lw $t0, 0($s1) + sw $t0, -4($fp) + # RETURN local_type_name_at_Object_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_type_name_at_Object. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_concat_at_String implementation. +# @Params: +# 0($fp) = param_concat_at_String_s_0 +function_concat_at_String: + # Allocate stack frame for function function_concat_at_String. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_concat_at_String_internal_0 = self.CONCAT + # LOCAL local_concat_at_String_internal_0 --> -4($fp) + # PARAM param_concat_at_String_s_0 --> 0($fp) + # Get first string length from self + lw $t0, 16($s1) + # Get second string length from param + lw $v0, 0($fp) + lw $t1, 16($v0) + # Save new string length in a0 for memory allocation + addu $a0, $t0, $t1 + move $t3, $a0 + # Get first string from self + lw $t0, 12($s1) + # Get second string from param + lw $t1, 12($v0) + addu $a0, $a0, 4 + li $v0, 9 + syscall + move $t2, $v0 + move $t4, $zero + concat_loop1: + # Compare t0 with \0 + lb $t4, 0($t0) + beqz $t4, concat_loop1_end + # Copy 1 byte + sb $t4, 0($t2) + addu $t2, $t2, 1 + addu $t0, $t0, 1 + j concat_loop1 + concat_loop1_end: + # Copy second string + concat_loop2: + # Compare t1 with \0 + lb $t4, 0($t1) + beqz $t4, concat_loop2_end + # Copy 1 byte + sb $t4, 0($t2) + addu $t2, $t2, 1 + addu $t1, $t1, 1 + j concat_loop2 + concat_loop2_end: + sb $zero, 0($t2) + # v0 contains resulting string + move $t1, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + sw $t1, 12($v0) + sw $t3, 16($v0) + sw $v0, -4($fp) + # RETURN local_concat_at_String_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_concat_at_String. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_substr_at_String implementation. +# @Params: +# 0($fp) = param_substr_at_String_l_0 +# 4($fp) = param_substr_at_String_r_1 +function_substr_at_String: + # Allocate stack frame for function function_substr_at_String. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_substr_at_String_internal_0 --> -4($fp) + # PARAM param_substr_at_String_l_0 --> 4($fp) + # PARAM param_substr_at_String_r_1 --> 0($fp) + lw $t0, 12($s1) + lw $t2, 4($fp) + lw $t2, 12($t2) + addu $t0, $t0, $t2 + lw $a0, 0($fp) + lw $a0, 12($a0) + move $t3, $a0 + move $t1, $a0 + addu $a0, $a0, 1 + li $v0, 9 + syscall + move $t2, $v0 + substr_loop: + beqz $t1, substr_end + lb $a0, 0($t0) + sb $a0, 0($t2) + addu $t0, $t0, 1 + addu $t2, $t2, 1 + subu $t1, $t1, 1 + j substr_loop + substr_end: + sb $zero, 0($t2) + move $t1, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + sw $t1, 12($v0) + sw $t3, 16($v0) + sw $v0, -4($fp) + # RETURN local_substr_at_String_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_substr_at_String. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 8 + jr $ra + # Function END + + +# function_length_at_String implementation. +# @Params: +function_length_at_String: + # Allocate stack frame for function function_length_at_String. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_length_at_String_internal_0 = GETATTRIBUTE length String + # LOCAL local_length_at_String_internal_0 --> -4($fp) + lw $t0, 16($s1) + sw $t0, -4($fp) + # LOCAL local_length_at_String_internal_1 --> -8($fp) + # LOCAL local_length_at_String_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + lw $t0, -4($fp) + sw $t0, 12($v0) + sw $v0, -8($fp) + # RETURN local_length_at_String_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function function_length_at_String. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# entry implementation. +# @Params: +entry: + # Allocate stack frame for function entry. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local__internal_0 --> -4($fp) + # local__internal_0 = ALLOCATE Main + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Main + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 12 bytes of memory + li $a0, 12 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Main_start + sw $t0, 4($v0) + # Load type offset + li $t0, 24 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -4($fp) + # LOCAL local__internal_0 --> -4($fp) + lw $s1, -4($fp) + # local__internal_1 = CALL main + # LOCAL local__internal_1 --> -8($fp) + # LOCAL local__internal_0 --> -4($fp) + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type's VTABLE + la $t0, Main_vtable + # Get pointer to function address + lw $t1, 0($t0) + # Call function. Result is on $v0 + jalr $t1 + sw $v0, -8($fp) + # RETURN 0 + li $v0, 0 + # Deallocate stack frame for function entry. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# __Complex__attrib__x__init implementation. +# @Params: +__Complex__attrib__x__init: + # Allocate stack frame for function __Complex__attrib__x__init. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local___attrib__x__init_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -4($fp) + # RETURN local___attrib__x__init_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function __Complex__attrib__x__init. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# __Complex__attrib__y__init implementation. +# @Params: +__Complex__attrib__y__init: + # Allocate stack frame for function __Complex__attrib__y__init. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local___attrib__y__init_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -4($fp) + # RETURN local___attrib__y__init_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function __Complex__attrib__y__init. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_init_at_Complex implementation. +# @Params: +# 0($fp) = param_init_at_Complex_a_0 +# 4($fp) = param_init_at_Complex_b_1 +function_init_at_Complex: + # Allocate stack frame for function function_init_at_Complex. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # + # PARAM param_init_at_Complex_a_0 --> 4($fp) + lw $t0, 4($fp) + sw $t0, 12($s1) + # + # PARAM param_init_at_Complex_b_1 --> 0($fp) + lw $t0, 0($fp) + sw $t0, 16($s1) + # LOCAL local_init_at_Complex_internal_0 --> -4($fp) + # local_init_at_Complex_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_init_at_Complex_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_init_at_Complex. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 8 + jr $ra + # Function END + + +# function_sum_at_Complex implementation. +# @Params: +function_sum_at_Complex: + # Allocate stack frame for function function_sum_at_Complex. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_sum_at_Complex_internal_1 = GETATTRIBUTE x Complex + # LOCAL local_sum_at_Complex_internal_1 --> -8($fp) + lw $t0, 12($s1) + sw $t0, -8($fp) + # local_sum_at_Complex_internal_2 = GETATTRIBUTE y Complex + # LOCAL local_sum_at_Complex_internal_2 --> -12($fp) + lw $t0, 16($s1) + sw $t0, -12($fp) + # LOCAL local_sum_at_Complex_internal_0 --> -4($fp) + # LOCAL local_sum_at_Complex_internal_1 --> -8($fp) + # LOCAL local_sum_at_Complex_internal_2 --> -12($fp) + # local_sum_at_Complex_internal_0 = local_sum_at_Complex_internal_1 + local_sum_at_Complex_internal_2 + lw $t1, -8($fp) + lw $t0, 12($t1) + lw $t1, -12($fp) + lw $t2, 12($t1) + add $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -4($fp) + # RETURN local_sum_at_Complex_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_sum_at_Complex. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_main_at_Main implementation. +# @Params: +function_main_at_Main: + # Allocate stack frame for function function_main_at_Main. + subu $sp, $sp, 52 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 52 + # LOCAL local_main_at_Main_c_0 --> -4($fp) + # local_main_at_Main_c_0 = 0 + li $t0, 0 + sw $t0, -4($fp) + # LOCAL local_main_at_Main_internal_3 --> -16($fp) + # local_main_at_Main_internal_3 = ALLOCATE Complex + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Complex + sw $t0, 12($v0) + li $t0, 7 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Complex_start + sw $t0, 4($v0) + # Load type offset + li $t0, 20 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Complex__attrib__x__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 12($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Complex__attrib__y__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 16($t1) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -16($fp) + # LOCAL local_main_at_Main_internal_1 --> -8($fp) + # LOCAL local_main_at_Main_internal_3 --> -16($fp) + # local_main_at_Main_internal_1 = local_main_at_Main_internal_3 + lw $t0, -16($fp) + sw $t0, -8($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_4 --> -20($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 4 + sw $t0, 12($v0) + sw $v0, -20($fp) + # ARG local_main_at_Main_internal_4 + # LOCAL local_main_at_Main_internal_4 --> -20($fp) + lw $t0, -20($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_main_at_Main_internal_5 --> -24($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 5 + sw $t0, 12($v0) + sw $v0, -24($fp) + # ARG local_main_at_Main_internal_5 + # LOCAL local_main_at_Main_internal_5 --> -24($fp) + lw $t0, -24($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_main_at_Main_internal_1 --> -8($fp) + # LOCAL local_main_at_Main_internal_2 --> -12($fp) + # local_main_at_Main_internal_2 = VCALL local_main_at_Main_internal_1 init + # Save new self pointer in $s1 + lw $s1, -8($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 16($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -12($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_main_at_Main_c_0 --> -4($fp) + # LOCAL local_main_at_Main_internal_2 --> -12($fp) + # local_main_at_Main_c_0 = local_main_at_Main_internal_2 + lw $t0, -12($fp) + sw $t0, -4($fp) + # LOCAL local_main_at_Main_internal_8 --> -36($fp) + # local_main_at_Main_internal_8 = SELF + sw $s1, -36($fp) + # LOCAL local_main_at_Main_internal_6 --> -28($fp) + # LOCAL local_main_at_Main_internal_8 --> -36($fp) + # local_main_at_Main_internal_6 = local_main_at_Main_internal_8 + lw $t0, -36($fp) + sw $t0, -28($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_9 --> -40($fp) + # LOCAL local_main_at_Main_c_0 --> -4($fp) + # local_main_at_Main_internal_9 = local_main_at_Main_c_0 + lw $t0, -4($fp) + sw $t0, -40($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_9 --> -40($fp) + # LOCAL local_main_at_Main_internal_10 --> -44($fp) + # local_main_at_Main_internal_10 = VCALL local_main_at_Main_internal_9 sum + # Save new self pointer in $s1 + lw $s1, -40($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 36($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -44($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # ARG local_main_at_Main_internal_10 + # LOCAL local_main_at_Main_internal_10 --> -44($fp) + lw $t0, -44($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_main_at_Main_internal_6 --> -28($fp) + # LOCAL local_main_at_Main_internal_7 --> -32($fp) + # local_main_at_Main_internal_7 = VCALL local_main_at_Main_internal_6 out_int + # Save new self pointer in $s1 + lw $s1, -28($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 24($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -32($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # RETURN local_main_at_Main_internal_7 + lw $v0, -32($fp) + # Deallocate stack frame for function function_main_at_Main. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 52 + jr $ra + # Function END + + diff --git a/src/testing.py b/src/testing.py new file mode 100755 index 00000000..c3023c6f --- /dev/null +++ b/src/testing.py @@ -0,0 +1,90 @@ +from build.compiler_struct import LEXER, PARSER +from cil.nodes import CilProgramNode +from travels.ciltomips import MipsCodeGenerator +from typecheck.evaluator import evaluate_right_parse +from comments import find_comments +from travels.ctcill import CilDisplayFormatter, CoolToCILVisitor +import sys + + +def report(errors: list): + for error in set(errors): + print(error) + + +def pipeline(program: str, deep: int) -> None: + try: + program = find_comments(program) + program = program.replace('\t', ' ' * 4) + except AssertionError as e: + print(e) + sys.exit(1) + + # Right now, program has no comments, so is safe to pass it to the LEXER + try: + tokens = LEXER(program) + except Exception as e: + print(e) + sys.exit(1) + + # Parse the tokens to obtain a derivation tree + try: + parse = PARSER(tokens) + except Exception as e: + print(e) + sys.exit(1) + # build the AST from the obtained parse + # try: + ast = evaluate_right_parse(parse, tokens[:-1]) + # except Exception as e: + # print(e) + # sys.exit(1) + ##################### + # Start the visitors # + ###################### + + # Run type checker visitor + errors, context, scope = ast.check_semantics(deep) + if errors: + report(errors) + sys.exit(1) + + cil_travel = CoolToCILVisitor(context) + cil_program_node = cil_travel.visit(ast, scope) + # formatter = CilDisplayFormatter() + # print(formatter(cil_program_node)) + + mips_gen = MipsCodeGenerator() + assert isinstance(cil_program_node, CilProgramNode) + source = mips_gen(cil_program_node) + print(source) + + +text = r""" +class Main inherits IO { + main() : AUTO_TYPE { + (let c : AUTO_TYPE <- (new Complex).init(4, 5) in + out_int(c.sum()) + ) + }; +}; + +class Complex inherits IO { + x : AUTO_TYPE; + y : AUTO_TYPE; + + init(a : AUTO_TYPE, b : AUTO_TYPE) : Complex { + { + x <- a; + y <- b; + self; + } + }; + + sum() : AUTO_TYPE { + x + y + }; +}; + +""" +pipeline(text, 1) diff --git a/src/tknizer.py b/src/tknizer.py new file mode 100644 index 00000000..6568be9c --- /dev/null +++ b/src/tknizer.py @@ -0,0 +1,100 @@ +import re +from typing import List, Tuple, Union +from grammar.symbols import EOF +from lexer.tokens import Token +from grammar.grammar import Terminal + +RegexTypes = Tuple[Union[str, Terminal], str] + + +class Tokenizer: + def __init__(self, regex_table: List[RegexTypes], eof: EOF): + self.regexs = self._build_regexs(regex_table) + self.eof = eof + self.line = 1 + self.column = 1 + + def _build_regexs(self, regex_table): + regexs = regex_table + fixed_line_token = "\n" + fixed_space_token = " " + + regexs.append(("Line", fixed_line_token)) + regexs.append(("Space", fixed_space_token)) + return regexs + + def _walk(self, string: str): + matched_suffix = "" + tt = None + + for token_type, regex in self.regexs: + match = re.match(regex, string) + if match is not None: + msuffix = match.group() + if len(msuffix) > len(matched_suffix): + matched_suffix = msuffix + tt = token_type + + return matched_suffix, tt + + def _tokenize(self, text): + while text: + string = text + suffix, token_type = self._walk(string) + if token_type is None: + next_token = string.split()[0] + raise SyntaxError( + f"({self.line},{self.column}) - LexicographicError: Unexpected Token %s" + % next_token + ) + elif token_type in ("StringError", "StringEOF"): + newlines = re.split(r"\\\n|\n", suffix.strip()) + if len(newlines) > 1: + self.line += len(newlines) - 1 + self.column = len(newlines[-1]) + 1 + else: + self.column += len(newlines[0]) + raise SyntaxError( + f"({self.line},{self.column}) - LexicographicError: {token_type} {suffix}" + ) + elif token_type == "Line": + self.column = 1 + self.line += 1 + elif token_type == "Space": + self.column += 1 + elif isinstance(token_type, Terminal) and token_type.Name in ( + "quoted_string_const", + "tilde_string_const", + ): + if "\0" in suffix: + newlines = re.split(r"\\\n", suffix) + for line in newlines: + if "\0" in line: + self.column = line.index("\0") + 1 + raise SyntaxError( + f"({self.line},{self.column}) - LexicographicError: String contains null character" + ) + newlines += 1 + # Strings may have some troubles with rows and columns + newlines = re.split(r"\\\n", suffix) + # Now we have a list with every line of the string + # we need to sum every line to the lines and make + # columns equal to the length of the last line. + # Note that in case no scaped newline is found in + # string, then splits return a single element list + # with the full list, so next code should do + # the work. + self.line += len(newlines) - 1 + self.column += len(newlines[-1]) + else: + self.column += len(suffix) + yield suffix, token_type + text = text[len(suffix) :] + yield "$", self.eof + + def __call__(self, text): + tokens = [] + for lex, token_type in self._tokenize(text): + if token_type not in ("Line", "Space"): + tokens.append(Token(lex, token_type, self.column, self.line)) + return tokens diff --git a/src/tools/__init__.py b/src/tools/__init__.py new file mode 100755 index 00000000..4ab414f6 --- /dev/null +++ b/src/tools/__init__.py @@ -0,0 +1,9 @@ + +def setup(): + import os + from sys import path + BASE = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + path.append(BASE) + +if __name__ == '__main__': + setup() diff --git a/src/tools/dtbuilder.py b/src/tools/dtbuilder.py new file mode 100755 index 00000000..f97e2d0f --- /dev/null +++ b/src/tools/dtbuilder.py @@ -0,0 +1,101 @@ + + +class DerivationTreeNode(object): + + def __init__(self, value, parent=None, h=0): + self.value = value + self.children = [] + self.parent = parent + self._h = h + + # required property to do a pprint of the tree + @property + def Deep(self): + """ + Devuelve la distancia de este nodo al nodo raiz, o el + nivel en que se encuentra dicho nodo + """ + return self._h + + def add_node(self, body, count): + """ + Agrega el cuerpo de una producion a los hijos del nodo cabecera. + """ + for x in body: + count += 1 + self.children.append(DerivationTreeNode(x, parent=self, h=count)) + return count + + def graph(self): + # realizar un recorrido en bfs por el arbol para formar el grafo + import pydot + from queue import Queue + G = pydot.Dot(rankdir='TD', margin=0.1) + q = Queue() + q.put(self) + while not q.empty(): + node = q.get() + pydotNode = pydot.Node(id(node), label=str(node.value), shape='circle', style='bold') + G.add_node(pydotNode) + for child in node.children: + child_node = pydot.Node(id(child), label=str(child.value), shape='circle', style='bold') + G.add_node(child_node) + G.add_edge(pydot.Edge(pydotNode, child_node)) + q.put(child) + return G + + def _repr_svg_(self): + try: + return self.graph().create_svg().decode('utf8') + except: + pass + + +def build_derivation_tree(parse: list): + """ + Dado un conjunto de producciones que generan una cadena, + devuelve un arbol de derivacion correspondiente a dicho conjunto. + Este metodo construye el arbol para parsers que produzcan una derivacion extrema + izquierda, para parsers que producen derivaciones extremas derechas, utilizar + build_right_derivation_tree() + """ + count = 0 + q = [] + head = parse[0].Left + root = DerivationTreeNode(head) + q.append(root) + i = 0 + while q: + node: DerivationTreeNode = q.pop() + if node.value.IsNonTerminal: + _, body = parse[i] + i += 1 + count = node.add_node(body, count) + for child in node.children[::-1]: + q.append(child) + return root + + +def build_right_derivation_tree(parse: list): + """ + Dado un conjunto de producciones que generan una cadena, + devuelve un arbol de derivacion correspondiente a dicho conjunto. + Este metodo construye el arbol para parsers que produzcan una derivacion extrema + derecha, para parsers que producen derivaciones extremas izquierdas, utilizar + build_derivation_tree() + """ + count = 0 + q = [] + head = parse[0].Left + root = DerivationTreeNode(head) + q.append(root) + i = 0 + while q: + node: DerivationTreeNode = q.pop() + if node.value.IsNonTerminal: + _, body = parse[i] + i += 1 + count = node.add_node(body, count) + for child in node.children: + q.append(child) + return root diff --git a/src/tools/evaluate.py b/src/tools/evaluate.py new file mode 100755 index 00000000..622372bb --- /dev/null +++ b/src/tools/evaluate.py @@ -0,0 +1,54 @@ +def evaluate_parse(productions, tokens): + def evaluate_production(production, left_parse, tokens, inherited_value=None): + body = production.Right + attributes = production.attributes + + synteticed = [None] * (len(body) + 1) + inherited = [None] * (len(body) + 1) + inherited[0] = inherited_value + + for i, symbol in enumerate(body, 1): + if symbol.IsTerminal and not symbol.IsEpsilon: + assert not inherited[i] + synteticed[i] = next(tokens).lex + elif symbol.IsNonTerminal: + next_production = next(left_parse) + rule = attributes[i] + if rule: + inherited[i] = rule(inherited, synteticed) + synteticed[i] = evaluate_production( + next_production, left_parse, tokens, inherited[i]) + + rule = attributes[0] + return rule(inherited, synteticed) if rule else None + + tok = iter(tokens) + prod = iter(productions) + root = evaluate_production(next(prod), prod, tok) + + return root + + +def evaluate_right_parse(productions, tokens): + def evaluate_production(production, right_parse, tokens): + body = production.Right + size = len(body) + 1 + attributes = production.attributes + synteticed = [None] * size + + for i, symbol in enumerate(body, 1): + if symbol.IsTerminal and not symbol.IsEpsilon: + synteticed[size - i] = next(tokens).lex + elif symbol.IsNonTerminal: + next_production = next(right_parse) + synteticed[size - i] = evaluate_production( + next_production, right_parse, tokens) + + rule = attributes[0] + return rule([], synteticed) if rule else None + # Pasar los tokens en orden inverso y quitar el caracter de final de cadena de la lista de tokens + tok = iter(tokens[::-1][1::]) + prod = iter(productions) + root = evaluate_production(next(prod), prod, tok) + + return root diff --git a/src/tools/firsts.py b/src/tools/firsts.py new file mode 100755 index 00000000..d2a55140 --- /dev/null +++ b/src/tools/firsts.py @@ -0,0 +1,116 @@ + +class ContainerSet: + """ + Resulta conveniente manejar la pertenencia o no de epsilon a un conjunto como un caso extremo. + Para ello usaremos la clase ContainerSet implementada a continuación. + + La clase funciona como un conjunto de símbolos. + Permite consulta la pertenencia de epsilon al conjunto. + Las operaciones que modifican el conjunto devuelven si hubo cambio o no. + El conjunto puede ser actualizado con la adición de elementos individuales, add(...), + o a partir de otro conjunto,update(...) y hard_update(...). + La actualización sin epsilon (1), con epsilon (2) y de solo epsilon (3), + ocurre a través de update(...), hard_update(...) y epsilon_update(...) respectivamente. + """ + + def __init__(self, *values, contains_epsilon=False): + self.set = set(values) + self.contains_epsilon = contains_epsilon + + def add(self, value): + n = len(self.set) + self.set.add(value) + return n != len(self.set) + + def set_epsilon(self, value=True): + last = self.contains_epsilon + self.contains_epsilon = value + return last != self.contains_epsilon + + def update(self, other): + n = len(self.set) + self.set.update(other.set) + return n != len(self.set) + + def epsilon_update(self, other): + return self.set_epsilon(self.contains_epsilon | other.contains_epsilon) + + def hard_update(self, other): + return self.update(other) | self.epsilon_update(other) + + def __len__(self): + return len(self.set) + int(self.contains_epsilon) + + def __str__(self): + return '%s-%s' % (str(self.set), self.contains_epsilon) + + def __repr__(self): + return str(self) + + def __iter__(self): + return iter(self.set) + + def __eq__(self, other): + return isinstance(other, ContainerSet) and self.set == other.set and \ + self.contains_epsilon == other.contains_epsilon + + +def compute_local_first(firsts, alpha): + + first_alpha = ContainerSet() + + try: + alpha_is_epsilon = alpha.IsEpsilon + except: + alpha_is_epsilon = False + + if alpha_is_epsilon: + first_alpha.set_epsilon() + else: + i = 0 + while i < len(alpha): + sym = alpha[i] + if sym.IsTerminal: + first_alpha.add(sym) + break + else: + first_alpha.update(firsts[sym]) + if firsts[sym].contains_epsilon: + first_alpha.set_epsilon() + i += 1 + else: + break + + return first_alpha + + +def compute_firsts(grammar): + firsts = {} + change = True + + for terminal in grammar.terminals: + firsts[terminal] = ContainerSet(terminal) + + for nonterminal in grammar.nonTerminals: + firsts[nonterminal] = ContainerSet() + + while change: + change = False + + for production in grammar.Productions: + X = production.Left + alpha = production.Right + + first_X = firsts[X] + + try: + first_alpha = firsts[alpha] + except: + first_alpha = firsts[alpha] = ContainerSet() + + local_first = compute_local_first(firsts, alpha) + + change |= first_alpha.hard_update(local_first) + change |= first_X.hard_update(local_first) + + return firsts diff --git a/src/tools/follows.py b/src/tools/follows.py new file mode 100755 index 00000000..06605744 --- /dev/null +++ b/src/tools/follows.py @@ -0,0 +1,39 @@ +from tools.firsts import ContainerSet, compute_firsts, compute_local_first +from grammar.grammar import Grammar +from grammar.symbols import Sentence + + +def compute_follows(G: Grammar, firsts): + follows = {} + change = True + + for nonterminal in G.nonTerminals: + follows[nonterminal] = ContainerSet() + follows[G.startSymbol] = ContainerSet(G.EOF) + + while change: + change = False + + for production in G.Productions: + + X = production.Left + alpha = production.Right + + i = 0 + while i < len(alpha): + sym = alpha[i] + if sym.IsNonTerminal: + if i == len(alpha) - 1: + follows[sym].update(follows[X]) + else: + try: + local = firsts[alpha[i + 1 : :]] + except KeyError: + local = compute_local_first(firsts, alpha[i + 1 : :]) + + change |= follows[sym].update(local) + if local.contains_epsilon: + change |= follows[sym].update(follows[X]) + i += 1 + + return follows diff --git a/src/tools/visitor.py b/src/tools/visitor.py new file mode 100755 index 00000000..ce33b78a --- /dev/null +++ b/src/tools/visitor.py @@ -0,0 +1,58 @@ +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 + 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: + issub = issubclass + t = self.targets + ks = t.keys() + ans = [t[k](*args, **kw) for k in ks if issub(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) \ No newline at end of file diff --git a/src/travels/__init__.py b/src/travels/__init__.py new file mode 100755 index 00000000..e69de29b diff --git a/src/travels/ciltomips.py b/src/travels/ciltomips.py new file mode 100644 index 00000000..ba925d20 --- /dev/null +++ b/src/travels/ciltomips.py @@ -0,0 +1,1586 @@ + +from abstract.semantics import Type +from cil.nodes import ( + AbortNode, + AllocateBoolNode, + AllocateIntNode, + BitwiseNotNode, + CharToCharStringCompare, + CompareSTRType, + CompareStringLengthNode, + CompareType, + ConcatString, + EqualToCilNode, + GetValue, + JumpIfGreater, + LocalNode, + MinusNodeComp, + PureMinus, + ReferenceEqualNode, +) +from mips.arithmetic import ADD, ADDU, DIV, MUL, NOR, NOT, SUB, SUBU +from mips.baseMipsVisitor import ( + BaseCilToMipsVisitor, + DotDataDirective, + DotTextDirective, + locate_attribute_in_type_hierarchy, +) +import cil.nodes as cil +from mips.branch import BEQ, BEQZ, BGT, BGTU, J +from mips.instruction import ( + FixedData, + Label, + MOVE, + REG_TO_STR, + SYSCALL, + a0, + s0, + sp, + ra, + v0, + a1, + zero, + s1, + at, + v1, + a2, +) +import mips.branch as branchNodes +from functools import singledispatchmethod + +from mips.load_store import LA, LB, LI, LW, SB, SW + + +class CilToMipsVisitor(BaseCilToMipsVisitor): + @singledispatchmethod + def visit(self, node): + pass + + @visit.register + def _(self, node: cil.CilProgramNode): + # El programa de CIL se compone por las 3 secciones + # .TYPES, .DATA y .CODE + + self.types = node.dottypes + + # Los tipos los definiremos en la seccion .data + self.register_instruction(DotDataDirective()) + self.register_instruction(FixedData("dummy", 0)) + + # Generar los tipos + self.create_type_array(node.dottypes) + + self.comment("\n\n") + + # Visitar cada nodo de la seccion .TYPES + for type_node in node.dottypes: + self.visit(type_node) + self.comment("\n\n") + + # Visitar cada nodo de la seccion .DATA + for data_node in node.dotdata: + self.visit(data_node) + self.comment("\n\n") + + # El codigo referente a cada funcion debe ir en la seccion de texto. + self.register_instruction(DotTextDirective()) + + self.define_entry_point() + + # Visitar cada nodo de la seccion .CODE + for code_node in node.dotcode: + self.visit(code_node) + + @visit.register + def _(self, node: cil.TypeNode): # noqa: F811 + # registrar el tipo actual que estamos construyendo + self.current_type = node + + # Construir la VTABLE para este tipo. + self.comment(f" **** VTABLE for type {node.name} ****") + + # Los punteros a funciones estaran definidos en el orden en que aparecen declaradas en las clases + # de modo que la VTABLE sea indexable y podamos efectuar VCALL en O(1). + self.register_instruction( + FixedData(f"{node.name}_vtable", ", ".join(x[1] for x in node.methods)) + ) + self.comment("Function END") + + self.comment("\n\n") + + # FORMA DE UN TIPO EN ASSEMBLY + ##################################### Type address + # VTABLE_POINTER # + ##################################### Type address + 4 + # ATTRIBUTE_LIST # + # .......... # + # .......... # + ##################################### Type_end + + self.comment(f" **** Type RECORD for type {node.name} ****") + # Declarar la direccion de memoria donde comienza el tipo + self.register_instruction(Label(f"{node.name}_start")) + + # Registrar un puntero a la VTABLE del tipo. + self.register_instruction( + FixedData(f"{node.name}_vtable_pointer", f"{node.name}_vtable") + ) + self.comment("Function END") + + # Declarar los atributos: Si los atributos son de tipo string, guardarlos como asciiz + # de lo contrario son o numeros o punteros y se inicializan como .words + # for attrib in node.attributes: + # if attrib.type.name == "String": + # self.register_instruction( + # FixedData(f"{node.name}_attrib_{attrib.name}", r'""', "asciiz") + # ) + # else: + # self.register_instruction( + # FixedData(f"{node.name}_attrib_{attrib.name}", 0) + # ) + + # Registrar la direccion de memoria donde termina el tipo para calcular facilmente + # sizeof + self.register_instruction(Label(f"{node.name}_end")) + + self.current_type = None + + @visit.register + def _(self, node: cil.DataNode): + if isinstance(node.value, str): + self.register_instruction( + FixedData(node.name, f"{node.value}", type_="asciiz") + ) + elif isinstance(node.value, dict): + # Lo unico que puede ser un diccionario es la TDT. Me parece..... mehh !!?? + # La TDT contiene para cada par (typo1, tipo2), la distancia entre tipo1 y tipo2 + # en caso de que tipo1 sea ancestro de tipo2, -1 en otro caso. Para hacerla accesible en O(1) + # podemos representarlas como la concatenacion de los nombres de tipo1 y tipo2 (Al final en cada + # programa los tipos son unicos). + # for (type1, type2), distance in node.value.items(): + # self.register_instruction( + # FixedData(f"__{type1}_{type2}_tdt_entry__", distance) + # ) + for t1 in self.mips_types: + array = ", ".join( + str(x) for x in [node.value[t1, t] for t in self.mips_types] + ) + self.register_instruction(FixedData(f"{t1}__TDT", array)) + elif isinstance(node.value, int): + self.register_instruction(FixedData(node.name, node.value)) + + @visit.register + def _(self, node: cil.FunctionNode): + self.current_function = node + + # Documentar la signatura de la funcion (parametros que recibe, valor que devuelve) + self.cil_func_signature(node) + + # Direccion de memoria de la funcion. + self.register_instruction(Label(node.name)) + + # Crear el marco de pila de la funcion. + self.allocate_stack_frame(node) + + for instruction in node.instructions: + self.visit(instruction) + + self.current_function = None + + self.comment("Function END\n\n") + + @visit.register + def _(self, node: cil.InitSelfNode): + src = self.visit(node.src) + assert src is not None + + self.register_instruction(LW(s1, src)) + + @visit.register + def _(self, node: cil.LabelNode): + self.register_instruction(Label(node.label)) + + @visit.register + def _(self, node: cil.ParamNode): + label = self.get_location_address(node) + + # Agregar la linea que vamos a traducir. + self.comment(f"PARAM {node.name} --> {label}") + + return label + + @visit.register + def _(self, node: cil.LocalNode): + label = self.get_location_address(node) + + # Agregar la linea que vamos a traducir. + self.comment(f"LOCAL {node.name} --> {label}") + + return label + + @visit.register + def _(self, node: Type): + return node.name + + @visit.register + def _(self, node: cil.AssignNode): + assert self.current_function is not None + # Una asignacion simplemente consiste en mover un resultado de un lugar a otro + dest = self.visit(node.dest) + source = self.visit(node.source) + + # Agregar la linea que vamos a traducir. + self.add_source_line_comment(source=node) + + # Puede que se asigne una constante o lo que hay en alguna direccion de memoria + if isinstance(source, int): + reg = self.get_available_register() + if reg is not None: + # Si tenemos registro temporal disponible entonces movemos + # lo que hay en la direccion de memoria source a reg y luego + # asignamos el valor de reg a dest. + self.register_instruction(LI(reg, source)) + self.register_instruction(SW(reg, dest)) + self.used_registers[reg] = False + else: + # Si no hay registro temporal disponible entonces tenemos que hacer + # dos instrucciones mas pues hay que salvar el registro s0 + # utlizarlo para hacer la transaccion y luego restaurarlo. + self.register_instruction(SW(s0, "0($sp)")) + self.register_instruction(LI(s0, source)) + self.register_instruction(SW(s0, dest)) + self.register_instruction(LI(s0, "0($sp)")) + + elif isinstance(source, str): + # Source es una direccion de memoria (Puede ser un label, en caso de que sea un tipo) + reg1 = self.get_available_register() + assert reg1 is not None + self.register_instruction(LW(reg1, source)) + self.register_instruction(SW(reg1, dest)) + self.used_registers[reg1] = False + + @visit.register + def _(self, node: cil.PlusNode): + assert self.current_function is not None + dest = self.visit(node.dest) + left = self.visit(node.left) + right = self.visit(node.right) + + assert left is not None and right is not None + + # Agregar la linea que vamos a traducir. + self.add_source_line_comment(source=node) + + self.operate(dest, left, right, ADD) + + @visit.register + def _(self, node: cil.MinusNode): + assert self.current_function is not None + dest = self.visit(node.dest) + left = self.visit(node.x) + right = self.visit(node.y) + + assert left is not None and right is not None + + # Agregar la linea que vamos a traducir. + self.add_source_line_comment(source=node) + + self.operate(dest, left, right, SUB) + + @visit.register + def _(self, node: cil.StarNode): + assert self.current_function is not None + dest = self.visit(node.dest) + left = self.visit(node.x) + right = self.visit(node.y) + + assert left is not None and right is not None + + # Agregar la linea que vamos a traducir. + self.add_source_line_comment(source=node) + + self.operate(dest, left, right, MUL) + + @visit.register + def _(self, node: cil.DivNode): + assert self.current_function is not None + dest = self.visit(node.dest) + left = self.visit(node.left) + right = self.visit(node.right) + + assert left is not None and right is not None + + # Agregar la linea que vamos a traducir. + self.add_source_line_comment(source=node) + + self.operate(dest, left, right, DIV) + + @visit.register + def _(self, node: cil.GetAttributeNode): + # Registrar la linea que estamos traduciendo + self.add_source_line_comment(node) + + # Localizar el atributo + offset = self.locate_attribute(node.attrname, node.itype.attributes) + + dest = self.visit(node.dest) + reg = self.get_available_register() + assert reg is not None and dest is not None + + # Cargar el atributo en un registro temporal para + # luego moverlo hacia dest. El objeto self siempre + # esta en el registro s1 + self.register_instruction(LW(reg, f"{offset}($s1)")) + + self.register_instruction(SW(reg, dest)) + + self.used_registers[reg] = False + + @visit.register + def _(self, node: cil.SetAttributeNode): + # registrar la linea que estamos traduciendo + self.add_source_line_comment(node) + + # Localizar el atributo + offset = self.locate_attribute(node.attrname, node.itype.attributes) + + source = self.visit(node.source) + reg = self.get_available_register() + + assert reg is not None + assert source is not None + + # Cargar el valor de source en un registro temporal + # y luego moverlo a la direccion de memoria del + # atributo + if isinstance(source, int): + self.register_instruction(LI(reg, source)) + else: + self.register_instruction(LW(reg, source)) + self.register_instruction(SW(reg, f"{offset}($s1)")) + + self.used_registers[reg] = False + + @visit.register + def _(self, node: AllocateBoolNode): + dest = self.visit(node.dest) + assert dest is not None + + size = 20 + + # Reservar memoria para el tipo + self.allocate_memory(size) + reg = self.get_available_register() + + assert reg is not None + + self.comment("Allocating string for type Bool") + + # Inicializar la instancia + self.register_instruction(LA(reg, "String")) + self.register_instruction(SW(reg, "0($v0)")) + + self.register_instruction(LA(reg, "String_start")) + self.register_instruction(SW(reg, "4($v0)")) + + # Cargar el offset del tipo + self.comment("Load type offset") + offset = next(i for i, t in enumerate(self.mips_types) if t == "String") * 4 + self.register_instruction(LI(reg, offset)) + self.register_instruction(SW(reg, "8($v0)")) + + self.register_instruction(LA(reg, "Bool")) + self.register_instruction(SW(reg, "12($v0)")) + + self.register_instruction(LI(reg, 4)) + self.register_instruction(SW(reg, "16($v0)")) + + # devolver la instancia + self.register_instruction(MOVE(reg, v0)) + + size = 16 + + self.allocate_memory(size) + + # Almacenar el string al tipo BOOL + self.register_instruction(SW(reg, f"0($v0)")) + + self.register_instruction(LA(reg, "Bool_start")) + self.register_instruction(SW(reg, "4($v0)")) + + self.comment("Load type offset") + offset = next(i for i, t in enumerate(self.mips_types) if t == "Bool") * 4 + self.register_instruction(LI(reg, offset)) + self.register_instruction(SW(reg, "8($v0)")) + + self.register_instruction(LI(reg, node.value)) + self.register_instruction(SW(reg, "12($v0)")) + + # devolver la instancia + self.register_instruction(SW(v0, dest)) + + self.used_registers[reg] = False + + @visit.register + def _(self, node: AllocateIntNode): + dest = self.visit(node.dest) + value = self.visit(node.value) + assert dest is not None + + size = 20 + + # Reservar memoria para el tipo + self.allocate_memory(size) + reg = self.get_available_register() + + assert reg is not None + + self.comment("Allocating string for type Int") + + # Inicializar la instancia + self.register_instruction(LA(reg, "String")) + self.register_instruction(SW(reg, "0($v0)")) + + self.register_instruction(LA(reg, "String_start")) + self.register_instruction(SW(reg, "4($v0)")) + + # Cargar el offset del tipo + self.comment("Load type offset") + offset = next(i for i, t in enumerate(self.mips_types) if t == "String") * 4 + self.register_instruction(LI(reg, offset)) + self.register_instruction(SW(reg, "8($v0)")) + + self.register_instruction(LA(reg, "Int")) + self.register_instruction(SW(reg, "12($v0)")) + + self.register_instruction(LI(reg, 3)) + self.register_instruction(SW(reg, "16($v0)")) + + # devolver la instancia + self.register_instruction(MOVE(reg, v0)) + + size = 16 + + self.allocate_memory(size) + + # Almacenar el string al tipo BOOL + self.register_instruction(SW(reg, f"0($v0)")) + + self.register_instruction(LA(reg, "Int_start")) + self.register_instruction(SW(reg, "4($v0)")) + + self.comment("Load type offset") + offset = next(i for i, t in enumerate(self.mips_types) if t == "Int") * 4 + self.register_instruction(LI(reg, offset)) + self.register_instruction(SW(reg, "8($v0)")) + + if isinstance(node.value, int): + self.register_instruction(LI(reg, value)) + else: + self.register_instruction(LW(reg, value)) + self.register_instruction(SW(reg, "12($v0)")) + + # devolver la instancia + self.register_instruction(SW(v0, dest)) + + self.used_registers[reg] = False + + @visit.register + def _(self, node: cil.AllocateStringNode): + dest = self.visit(node.dest) + assert dest is not None + + size = 20 + + # Reservar memoria para el tipo + self.allocate_memory(size) + reg = self.get_available_register() + + assert reg is not None + + self.comment("Allocating string") + + # Inicializar la instancia + self.register_instruction(LA(reg, "String")) + self.register_instruction(SW(reg, "0($v0)")) + + self.register_instruction(LA(reg, "String_start")) + self.register_instruction(SW(reg, "4($v0)")) + + # Cargar el offset del tipo + self.comment("Load type offset") + offset = next(i for i, t in enumerate(self.mips_types) if t == "String") * 4 + self.register_instruction(LI(reg, offset)) + self.register_instruction(SW(reg, "8($v0)")) + + self.register_instruction(LA(reg, node.value.name)) + self.register_instruction(SW(reg, "12($v0)")) + + self.register_instruction(LI(reg, node.length)) + self.register_instruction(SW(reg, "16($v0)")) + + # devolver la instancia + self.register_instruction(SW(v0, dest)) + + self.used_registers[reg] = False + + @visit.register + def _(self, node: cil.AllocateNode): + # Cada instancia debe almacenar lo siguiente: + # - Un puntero a la vTable de su tipo + # - Espacio para cada atributo + # - Un puntero a su tipo en el array de tipos, de modo que sea facil calcular typeof + + ################################# address + # TYPE_POINTER # + ################################# address + 4 + # VTABLE_POINTER # + ################################# address + 8 + # ATTRIBUTE_1 # + ################################# address + 12 + # ATTRIBUTE_2 # + ################################# + # ... # + # ... # + # ... # + ################################# + + num_bytes = 12 # inicialmente necesita al menos 3 punteros + dest = self.visit(node.dest) + + instance_type = node.itype + + assert dest is not None + + self.add_source_line_comment(node) + + num_bytes += len(instance_type.attributes) * 4 + + reg = self.get_available_register() + temp = self.get_available_register() + assert reg is not None and temp is not None, "Out of registers." + + # Inicializar la instancia + + # Crear el string referente al nombre del tipo + length = len(instance_type.name) + + size = 20 + + # Reservar memoria para el tipo + self.allocate_memory(size) + self.comment("Allocating string for type name") + + # Inicializar la instancia + self.register_instruction(LA(reg, "String")) + self.register_instruction(SW(reg, "0($v0)")) + + self.register_instruction(LA(reg, "String_start")) + self.register_instruction(SW(reg, "4($v0)")) + + # Cargar el offset del tipo + self.comment("Load type offset") + offset = next(i for i, t in enumerate(self.mips_types) if t == "String") * 4 + self.register_instruction(LI(reg, offset)) + self.register_instruction(SW(reg, "8($v0)")) + + self.register_instruction(LA(reg, instance_type.name)) + self.register_instruction(SW(reg, "12($v0)")) + + self.register_instruction(LI(reg, length)) + self.register_instruction(SW(reg, "16($v0)")) + + self.register_instruction(MOVE(reg, v0)) + + # Reservar memoria para la instancia + self.allocate_memory(num_bytes) + + # Cargar el puntero al tipo de la instancia + self.register_instruction(SW(dest=reg, src="0($v0)")) + + # Cargar el puntero a la VTABLE + self.register_instruction(LA(dest=reg, src=f"{instance_type.name}_start")) + self.register_instruction(SW(dest=reg, src="4($v0)")) + + # Cargar el offset del tipo + self.comment("Load type offset") + offset = ( + next(i for i, t in enumerate(self.mips_types) if t == instance_type.name) + * 4 + ) + self.register_instruction(LI(reg, offset)) + self.register_instruction(SW(reg, "8($v0)")) + + self.register_instruction(MOVE(temp, v0)) + + # Cada atributo puede hacer referencia a atributos anteriormente + # definidos, o sea que tenemos que salvar self + self.push_register(s1) + self.register_instruction(MOVE(s1, v0)) + + # Los atributos comienzan en el indice 8($v0) + for i, attribute in enumerate(instance_type.attributes): + attrib_type_name = locate_attribute_in_type_hierarchy( + attribute, instance_type + ) + # llamar la funcion de inicializacion del atributo + # Salvar el registro temp + self.push_register(temp) + self.register_instruction( + branchNodes.JAL(f"__{attrib_type_name}__attrib__{attribute.name}__init") + ) + # Restaurar el valor del registro temp + self.pop_register(temp) + # El valor de retorno viene en v0 + self.register_instruction( + SW(dest=v0, src=f"{12 + i*4}(${REG_TO_STR[temp]})") + ) + + # Restaurar self + self.pop_register(s1) + + # mover la direccion que almacena la instancia hacia dest + self.register_instruction(SW(temp, dest)) + + self.used_registers[reg] = False + self.used_registers[temp] = False + + @visit.register + def _(self, node: cil.TypeOffsetNode): + local_addr = self.visit(node.variable) + return_addr = self.visit(node.dest) + reg = self.get_available_register() + reg2 = self.get_available_register() + + assert reg is not None, "Out of registers" + assert reg2 is not None, "Out of registers" + + self.add_source_line_comment(node) + + self.register_instruction(LW(reg, local_addr)) + self.comment("Load pointer to type offset") + self.register_instruction(LW(reg2, f"8(${REG_TO_STR[reg]})")) + self.register_instruction(SW(reg2, return_addr)) + + self.used_registers[reg] = False + self.used_registers[reg2] = False + + @visit.register + def _(self, node: JumpIfGreater): + left = self.visit(node.left) + right = self.visit(node.rigt) + reg1 = self.get_available_register() + reg2 = self.get_available_register() + + assert left is not None + assert right is not None + assert reg1 is not None + assert reg2 is not None + + self.comment(f"Update min if {reg1} < {reg2}") + self.register_instruction(LW(reg1, left)) + self.register_instruction(LW(reg2, right)) + self.register_instruction(BGTU(reg1, reg2, node.label)) + + self.used_registers[reg1] = False + self.used_registers[reg2] = False + + @visit.register + def _(self, node: cil.JumpIfGreaterThanZeroNode): + self.add_source_line_comment(node) + self.conditional_jump(node, branchNodes.BGT) + + @visit.register + def _(self, node: cil.IfZeroJump): + self.add_source_line_comment(node) + self.conditional_jump(node, branchNodes.BEQ) + + @visit.register + def _(self, node: cil.NotZeroJump): + self.add_source_line_comment(node) + self.conditional_jump(node, branchNodes.BNE) + + @visit.register + def _(self, node: cil.UnconditionalJump): + self.add_source_line_comment(node) + self.register_instruction(branchNodes.J(node.label)) + + @visit.register + def _(self, node: BitwiseNotNode): + dest = self.visit(node.dest) + src = self.visit(node.src) + + reg = self.get_available_register() + + assert reg is not None + assert src is not None + assert dest is not None + + self.register_instruction(LW(reg, src)) + # cargar el valor + self.register_instruction(LW(reg, f"12(${REG_TO_STR[reg]})")) + self.register_instruction(NOT(reg, reg)) + self.register_instruction(ADD(reg, reg, 1, True)) + self.register_instruction(SW(reg, dest)) + + self.used_registers[reg] = False + + @visit.register + def _(self, node: cil.NotNode): + self.add_source_line_comment(node) + # Hay que cambiar lo que hay en dest, si es 1 poner 0 + # y si es 0 poner 1 + dest = self.visit(node.src) + assert dest is not None + reg = self.get_available_register() + assert reg is not None + + self.comment("Load value in register") + self.register_instruction(LW(reg, dest)) + + # a nor 0 = not (a or 0) = not a + self.comment("a nor 0 = not (a or 0) = not a") + self.register_instruction(NOR(reg, reg, zero)) + + self.comment("Store negated value") + self.register_instruction(SW(reg, dest)) + + self.used_registers[reg] = False + + @visit.register + def _(self, node: cil.StaticCallNode): + + # Registrar un comentario con la linea fuente + self.add_source_line_comment(node) + dest = self.visit(node.dest) + self_ptr = self.visit(node.obj) + + assert dest is not None + assert self_ptr is not None + + # obtener el indice que le corresponde a la funcion que estamos llamando, + # Recordar que nuestra invariante garantiza que todo metodo con el mismo + # nombre ocupa el mismo indice en cada VTABLE + i = self.get_method_index(node.function) + + # Reservar registros para operaciones intermedias + reg2 = self.get_available_register() + reg3 = self.get_available_register() + assert reg2 is not None and reg3 is not None, "out of registers" + + # Actualizar el puntero a self en s1 + self.comment("Save new self pointer in $s1") + self.register_instruction(LW(s1, self_ptr)) + + # Cargar el puntero a la VTABLE del tipo referenciado en TYPE + self.comment("Get pointer to type's VTABLE") + self.register_instruction(LA(reg2, f"{node.type_.name}_vtable")) + + # Cargar el puntero a la funcion correspondiente en el tercer registro + self.comment("Get pointer to function address") + self.register_instruction(LW(reg3, f"{i * 4}(${REG_TO_STR[reg2]})")) + + # saltar hacia la direccion de memoria correspondiente a la funcion + self.comment("Call function. Result is on $v0") + self.register_instruction(branchNodes.JALR(reg3)) + + # El resultado viene en $v0 + self.register_instruction(SW(v0, dest)) + + self.used_registers[reg2] = False + self.used_registers[reg3] = False + + @visit.register + def _(self, node: cil.DynamicCallNode): + type_src = self.visit(node.xtype) + dest = self.visit(node.dest) + + assert type_src is not None and dest is not None + + # Generar el comentario de la linea fuente + self.add_source_line_comment(node) + + # obtener el indice que le corresponde a la funcion que estamos llamando + i = self.get_method_index(node.method) + + # Reservar registros para operaciones intermedias + reg1 = self.get_available_register() + assert reg1 is not None, "out of registers" + + # Actualizar el puntero a self en s1 + self.comment("Save new self pointer in $s1") + self.register_instruction(LW(s1, type_src)) + + # Cargar el puuntero al tipo en el primer registro + self.comment("Get pointer to type") + self.register_instruction(LW(reg1, f"4($s1)")) + + # Cargar el puntero a la VTABLE en el segundo registro + self.comment("Get pointer to type's VTABLE") + self.register_instruction(LW(reg1, f"0(${REG_TO_STR[reg1]})")) + + # Cargar el puntero a la funcion correspondiente en el tercer registro + self.comment("Get pointer to function address") + self.register_instruction(LW(reg1, f"{i * 4}(${REG_TO_STR[reg1]})")) + + # saltar hacia la direccion de memoria correspondiente a la funcion + self.comment("Call function. Result is on $v0") + self.register_instruction(branchNodes.JALR(reg1)) + + # El resultado viene en $v0 + self.register_instruction(SW(v0, dest)) + + self.used_registers[reg1] = False + + @visit.register + def _(self, node: cil.SaveSelf): + self.push_register(s1) + + @visit.register + def _(self, node: cil.RestoreSelf): + self.pop_register(s1) + + @visit.register + def _(self, node: cil.ArgNode): + # Pasar los argumentos en la pila. #TODO: Pasarlos en registros + self.add_source_line_comment(node) + src = self.visit(node.name) + reg = self.get_available_register() + assert src is not None and reg is not None + + if isinstance(src, int): + self.register_instruction(LI(reg, src)) + else: + self.register_instruction(LW(reg, src)) + + self.comment("Push arg into stack") + self.register_instruction(SUBU(sp, sp, 4, True)) + self.register_instruction(SW(reg, "0($sp)")) + + self.used_registers[reg] = False + + @visit.register + def _(self, node: cil.ReturnNode): + # Generar dos formas de codigo en dependencia de si se devuelve un valor o no + self.add_source_line_comment(node) + val = node.value + if val is not None: + if isinstance(val, LocalNode): + src = self.get_location_address(val) + # almacenar el resultado en $v0 + self.register_instruction(LW(v0, src)) + elif isinstance(val, int): + # val es una constante + self.register_instruction(LI(v0, val)) + else: + # val es un str que representa la direccion + # de un hardcoded string en la seccion .DATA + self.register_instruction(LW(v0, val)) + + # Liberar el marco de pila + assert self.current_function is not None + self.deallocate_stack_frame(self.current_function) + + # Liberar el espacio de los argumentos de la funcion + self.deallocate_args(self.current_function) + + # salir del llamado de la funcion + self.register_instruction(branchNodes.JR(ra)) + + @visit.register + def _(self, node: cil.LoadNode): + dest = self.visit(node.dest) + assert dest is not None + + # message es un string, asi que solo hay que cargar el puntero a dicho string + reg = self.get_available_register() + assert reg is not None, "Out of registers" + self.add_source_line_comment(node) + self.register_instruction(LA(reg, node.message.name)) + self.register_instruction(SW(reg, dest)) + + self.used_registers[reg] = False + + ## NODOS REFERENTES A OPERACIONES BUILT-IN DE COOL ## + + @visit.register + def _(self, node: cil.SubstringNode): + dest = self.visit(node.dest) + assert dest is not None + l = self.visit(node.l) + r = self.visit(node.r) + assert l is not None + assert r is not None + + reg = self.get_available_register() + reg2 = self.get_available_register() + temp = self.get_available_register() + size_reg = self.get_available_register() + assert reg is not None + assert reg2 is not None + assert temp is not None + assert size_reg is not None + + # Cargar el string sobre el que se llama substr + self.register_instruction(LW(reg, "12($s1)")) + + # Hacer que reg apunte al inicio del substr + if isinstance(l, int): + self.register_instruction(ADDU(reg, reg, l, True)) + else: + self.register_instruction(LW(temp, l)) + # Cargar el valor + self.register_instruction(LW(temp, f"12(${REG_TO_STR[temp]})")) + self.register_instruction(ADDU(reg, reg, temp)) + + if isinstance(r, int): + self.register_instruction(LI(a0, r)) + else: + self.register_instruction(LW(a0, r)) + # cargar el valor + self.register_instruction(LW(a0, f"12($a0)")) + + self.register_instruction(MOVE(size_reg, a0)) + self.register_instruction(MOVE(reg2, a0)) + # Agregar un byte mas para el fin de cadena + self.register_instruction(ADDU(a0, a0, 1, True)) + + # $v0 = 9 (syscall 9 = sbrk) + self.register_instruction(LI(v0, 9)) + self.register_instruction(SYSCALL()) + + self.register_instruction(MOVE(temp, v0)) + + # Mientras reg != reg2 : Copiar a v0 + self.register_instruction(Label("substr_loop")) + self.register_instruction(BEQZ(reg2, "substr_end")) + # Copiar un byte + self.register_instruction(LB(a0, f"0(${REG_TO_STR[reg]})")) + self.register_instruction(SB(a0, f"0(${REG_TO_STR[temp]})")) + # Mover el puntero temp y el puntero reg + self.register_instruction(ADDU(reg, reg, 1, True)) + self.register_instruction(ADDU(temp, temp, 1, True)) + # Restar del contador + self.register_instruction(SUBU(reg2, reg2, 1, True)) + # Saltar al ciclo while + self.register_instruction(J("substr_loop")) + # Salir del ciclo + self.register_instruction(Label("substr_end")) + # Agregar el null al final de la cadena + self.register_instruction(SB(zero, f"0(${REG_TO_STR[temp]})")) + + # v0 contiene el substr + self.register_instruction(MOVE(reg2, v0)) + # Crear la instancia de str + size = 20 + + # Reservar memoria para el tipo + self.allocate_memory(size) + + self.comment("Allocating string") + + # Inicializar la instancia + self.register_instruction(LA(reg, "String")) + self.register_instruction(SW(reg, "0($v0)")) + + self.register_instruction(LA(reg, "String_start")) + self.register_instruction(SW(reg, "4($v0)")) + + # Cargar el offset del tipo + self.comment("Load type offset") + offset = next(i for i, t in enumerate(self.mips_types) if t == "String") * 4 + self.register_instruction(LI(reg, offset)) + self.register_instruction(SW(reg, "8($v0)")) + + # Copiar el str en v0 al atributo value de la instancia + self.register_instruction(SW(reg2, "12($v0)")) + + self.register_instruction(SW(size_reg, "16($v0)")) + + # devolver la instancia + self.register_instruction(SW(v0, dest)) + + self.used_registers[reg] = False + self.used_registers[reg2] = False + self.used_registers[temp] = False + self.used_registers[size_reg] = False + + @visit.register + def _(self, node: ConcatString): + self.add_source_line_comment(node) + # Obtener los strings a concatenar + dest = self.visit(node.dest) + s = self.visit(node.s) + assert s is not None + assert dest is not None + + reg = self.get_available_register() + reg2 = self.get_available_register() + temp = self.get_available_register() + size_reg = self.get_available_register() + byte = self.get_available_register() + + assert ( + reg is not None + and reg2 is not None + and temp is not None + and size_reg is not None + and byte is not None + ) + + # Get Strings length + self.comment("Get first string length from self") + self.register_instruction(LW(reg, f"16($s1)")) + + # Obtener el segundo string + self.comment("Get second string length from param") + self.register_instruction(LW(v0, s)) + self.register_instruction(LW(reg2, "16($v0)")) + + self.comment("Save new string length in a0 for memory allocation") + self.register_instruction(ADDU(a0, reg, reg2)) + self.register_instruction(MOVE(size_reg, a0)) + + # Obtener el primer string desde self + self.comment("Get first string from self") + self.register_instruction(LW(reg, f"12($s1)")) + + # Obtener el segundo string + self.comment("Get second string from param") + self.register_instruction(LW(reg2, "12($v0)")) + + # Reservar memoria para el nuevo buffer + # $v0 = 9 (syscall 9 = sbrk) + self.register_instruction(ADDU(a0, a0, 4, True)) + self.register_instruction(LI(v0, 9)) + self.register_instruction(SYSCALL()) + + # mover v0 a un puntero temporal que podamos mover + self.register_instruction(MOVE(temp, v0)) + + # Hacer 0 el registro byte + self.register_instruction(MOVE(byte, zero)) + + # while [reg] != 0: copy to temp + self.register_instruction(Label("concat_loop1")) + self.comment(f"Compare {REG_TO_STR[reg]} with \\0") + self.register_instruction(LB(byte, f"0(${REG_TO_STR[reg]})")) + self.register_instruction(BEQZ(byte, "concat_loop1_end")) + # Copiar el byte hacia temp y aumentar en 1 + self.comment("Copy 1 byte") + self.register_instruction(SB(byte, f"0(${REG_TO_STR[temp]})")) + self.register_instruction(ADDU(temp, temp, 1, True)) + self.register_instruction(ADDU(reg, reg, 1, True)) + self.register_instruction(J("concat_loop1")) + + self.register_instruction(Label("concat_loop1_end")) + + # Copiar el segundo string + self.comment("Copy second string") + # while [reg2] != 0: copy to temp + self.register_instruction(Label("concat_loop2")) + self.comment(f"Compare {REG_TO_STR[reg2]} with \\0") + self.register_instruction(LB(byte, f"0(${REG_TO_STR[reg2]})")) + self.register_instruction(BEQZ(byte, "concat_loop2_end")) + # Copiar el byte hacia temp y aumentar en 1 + self.comment("Copy 1 byte") + self.register_instruction(SB(byte, f"0(${REG_TO_STR[temp]})")) + self.register_instruction(ADDU(temp, temp, 1, True)) + self.register_instruction(ADDU(reg2, reg2, 1, True)) + self.register_instruction(J("concat_loop2")) + + self.register_instruction(Label("concat_loop2_end")) + # Agregar el caracter null al final + self.register_instruction(SB(zero, f"0(${REG_TO_STR[temp]})")) + + # v0 contiene el string concatenado + self.comment("v0 contains resulting string") + self.register_instruction(MOVE(reg2, v0)) + + # Crear la instancia de str + size = 20 + + # Reservar memoria para el tipo + self.allocate_memory(size) + + self.comment("Allocating string") + + # Inicializar la instancia + self.register_instruction(LA(reg, "String")) + self.register_instruction(SW(reg, "0($v0)")) + + self.register_instruction(LA(reg, "String_start")) + self.register_instruction(SW(reg, "4($v0)")) + + # Cargar el offset del tipo + self.comment("Load type offset") + offset = next(i for i, t in enumerate(self.mips_types) if t == "String") * 4 + self.register_instruction(LI(reg, offset)) + self.register_instruction(SW(reg, "8($v0)")) + + # Copiar el str en v0 al atributo value de la instancia + self.register_instruction(SW(reg2, "12($v0)")) + + self.register_instruction(SW(size_reg, "16($v0)")) + + # devolver la instancia + self.register_instruction(SW(v0, dest)) + + self.used_registers[reg] = False + self.used_registers[reg2] = False + self.used_registers[temp] = False + self.used_registers[size_reg] = False + self.used_registers[byte] = False + + @visit.register + def _(self, node: AbortNode): + # Cargar el puntero al tipo de self + src = self.visit(node.src) + self.register_instruction(LA(a0, node.abortion.name)) + # Print abortion + self.register_instruction(LI(v0, 4)) + self.register_instruction(SYSCALL()) + + self.register_instruction(LW(a0, src)) + self.register_instruction(LI(v0, 4)) + self.register_instruction(SYSCALL()) + + self.register_instruction(LA(a0, node.nl.name)) + self.register_instruction(LI(v0, 4)) + self.register_instruction(SYSCALL()) + + self.register_instruction(LI(v0, 10)) + self.register_instruction(SYSCALL()) + + @visit.register + def _(self, node: cil.ReadNode): + dest = self.visit(node.dest) + + assert dest is not None + size = 1024 # Max string length in COOL + reg = self.get_available_register() + reg2 = self.get_available_register() + length = self.get_available_register() + temp = self.get_available_register() + assert reg is not None + assert length is not None + assert temp is not None + assert reg2 is not None + + # Declarar un buffer para el string + self.allocate_memory(size) + self.register_instruction(MOVE(reg, v0)) + + # Mover la direccion del buffer a0 + self.register_instruction(MOVE(a0, v0)) + # declarar el espacio disponible en el buffer + self.register_instruction(LI(a1, size)) + # syscall 8 = read_int + self.register_instruction(LI(v0, 8)) + self.register_instruction(SYSCALL()) + + # reg contiene el string. + # Crear la instancia del tipo string. + # Primero calcular el length del string + self.register_instruction(MOVE(length, zero)) + self.register_instruction(MOVE(temp, zero)) + self.register_instruction(MOVE(reg2, reg)) + + self.register_instruction(LB(temp, f"0(${REG_TO_STR[reg2]})")) + self.register_instruction(BEQZ(temp, "end_loop")) + + self.register_instruction(Label("read_length_loop")) + # while [reg2] != 0: length ++ + self.register_instruction(LB(temp, f"0(${REG_TO_STR[reg2]})")) + self.register_instruction(BEQZ(temp, "end_read_length_loop")) + self.register_instruction(ADDU(reg2, reg2, 1, True)) + self.register_instruction(ADDU(length, length, 1, True)) + self.register_instruction(J("read_length_loop")) + self.register_instruction(Label("end_read_length_loop")) + + # Remove new line + self.register_instruction(SUBU(reg2, reg2, 1, True)) + self.register_instruction(SB(zero, f"0(${REG_TO_STR[reg2]})")) + self.register_instruction(SUBU(length, length, 1, True)) + + self.register_instruction(Label("end_loop")) + + # length contiene el length del string + # Crear la instancia + + size = 20 + + # Reservar memoria para el tipo + self.allocate_memory(size) + + self.comment("Allocating string") + + # Inicializar la instancia + self.register_instruction(LA(reg2, "String")) + self.register_instruction(SW(reg2, "0($v0)")) + + self.register_instruction(LA(reg2, "String_start")) + self.register_instruction(SW(reg2, "4($v0)")) + + # Cargar el offset del tipo + self.comment("Load type offset") + offset = next(i for i, t in enumerate(self.mips_types) if t == "String") * 4 + self.register_instruction(LI(reg2, offset)) + self.register_instruction(SW(reg2, "8($v0)")) + + self.register_instruction(SW(reg, "12($v0)")) + + self.register_instruction(SW(length, "16($v0)")) + + # devolver la instancia + self.register_instruction(SW(v0, dest)) + + self.used_registers[reg] = False + self.used_registers[reg2] = False + self.used_registers[temp] = False + self.used_registers[length] = False + + @visit.register + def _(self, node: cil.TypeName): + dest = self.visit(node.dest) + assert dest is not None + + # Cargar el puntero al objeto que se esta llamando + reg = self.get_available_register() + assert reg is not None + + self.register_instruction(LW(reg, f"0($s1)")) + self.register_instruction(SW(reg, dest)) + + self.used_registers[reg] = False + + @visit.register + def _(self, node: cil.PrintIntNode): + # El valor a imprimir se encuentra en la direccion + # de memoria src + self.add_source_line_comment(node) + src = self.visit(node.src) + assert src is not None + + # En mips, syscall 1 se usa para imprimir el entero + # almacenado en $a0 + # Cargar el entero en $a0 + self.register_instruction(LW(v0, src)) + # Cargar el valor + self.register_instruction(LW(a0, f"12($v0)")) + # syscall 1 = print_int + self.register_instruction(LI(v0, 1)) + self.register_instruction(SYSCALL()) + + @visit.register + def _(self, node: cil.ReadIntNode): + dest = self.visit(node.dest) + assert dest is not None + + self.add_source_line_comment(node) + + # Cargar syscall read_int en $v0 + self.register_instruction(LI(v0, 5)) + self.register_instruction(SYSCALL()) + + # Crear la instancia a Int + self.register_instruction(MOVE(a2, v0)) + + size = 20 + + # Reservar memoria para el tipo + self.allocate_memory(size) + reg2 = self.get_available_register() + + assert reg2 is not None + + self.comment("Allocating string for type Int") + + # Inicializar la instancia + self.register_instruction(LA(reg2, "String")) + self.register_instruction(SW(reg2, "0($v0)")) + + self.register_instruction(LA(reg2, "String_start")) + self.register_instruction(SW(reg2, "4($v0)")) + + # Cargar el offset del tipo + self.comment("Load type offset") + offset = next(i for i, t in enumerate(self.mips_types) if t == "String") * 4 + self.register_instruction(LI(reg2, offset)) + self.register_instruction(SW(reg2, "8($v0)")) + + self.register_instruction(LA(reg2, "Int")) + self.register_instruction(SW(reg2, "12($v0)")) + + self.register_instruction(LI(reg2, 3)) + self.register_instruction(SW(reg2, "16($v0)")) + + # devolver la instancia + self.register_instruction(MOVE(reg2, v0)) + + size = 16 + + self.allocate_memory(size) + + # Almacenar el string al tipo Int + self.register_instruction(SW(reg2, f"0($v0)")) + + self.register_instruction(LA(reg2, "Int_start")) + self.register_instruction(SW(reg2, "4($v0)")) + + # Cargar el offset del tipo + self.comment("Load type offset") + offset = next(i for i, t in enumerate(self.mips_types) if t == "Int") * 4 + self.register_instruction(LI(reg2, offset)) + self.register_instruction(SW(reg2, "8($v0)")) + + self.register_instruction(SW(a2, "12($v0)")) + + # Almacenar el numero leido en dest + self.register_instruction(SW(v0, dest)) + self.used_registers[reg2] = False + + @visit.register + def _(self, node: cil.PrintNode): + src = self.visit(node.src) + assert src is not None + + self.add_source_line_comment(node) + + self.register_instruction(LW(v0, src)) + + # Cargar la direccion del string en a0 + self.register_instruction(LW(a0, "12($v0)")) + # syscall 4 = print_string + self.register_instruction(LI(v0, 4)) + self.register_instruction(SYSCALL()) + + @visit.register + def _(self, node: cil.TdtLookupNode): + # Cargar el valor que esta en offset en la tabla del tipo + self.add_source_line_comment(node) + dest = self.visit(node.dest) + offset_addr = self.visit(node.j) + tdt_table = self.get_available_register() + offset = self.get_available_register() + + assert offset is not None + assert tdt_table is not None + assert offset_addr is not None + assert dest is not None + + # Cargar la tabla referente al tipo + self.comment(f"Load TDT pointer to type {node.i}") + self.register_instruction(LA(tdt_table, f"{node.i}__TDT")) + + self.register_instruction(LW(offset, offset_addr)) + + # mover el puntero offset bytes + self.register_instruction(ADDU(tdt_table, tdt_table, offset)) + + self.comment("Save distance") + self.register_instruction(LW(offset, f"0(${REG_TO_STR[tdt_table]})")) + self.register_instruction(SW(offset, dest)) + + self.used_registers[tdt_table] = False + self.used_registers[offset] = False + + @visit.register + def _(self, node: int): + return node + + @visit.register + def _(self, node: cil.SelfNode): + dest = self.visit(node.dest) + assert dest is not None + # El puntero a self siempre se guarda en el registro $s1 + self.add_source_line_comment(node) + self.register_instruction(SW(s1, dest)) + + @visit.register + def _(self, node: GetValue): + dest = self.visit(node.dest) + src = self.visit(node.src) + + assert dest is not None + assert src is not None + self.comment(f"Obtain value from {src}") + self.register_instruction(LW(v0, src)) + self.register_instruction(LW(v0, f"12($v0)")) + self.register_instruction(SW(v0, dest)) + + @visit.register + def _(self, node: CompareType): + dest = self.visit(node.dest) + src = self.visit(node.src) + + assert dest is not None + assert src is not None + self.comment(f"Comparing {src} type with {node.type}") + # Cargar el puntero al tipo que queremos comparar + self.register_instruction(LA(v0, node.type)) + + # Cargar el puntero al string del tipo + self.register_instruction(LW(a0, src)) + self.register_instruction(LW(a0, f"0($a0)")) + # Cargar el valor del string + self.register_instruction(LW(a0, f"12($a0)")) + # Restar y devolver + self.register_instruction(SUB(a0, a0, v0)) + self.register_instruction(SW(a0, dest)) + + @visit.register + def _(self, node: CompareSTRType): + dest = self.visit(node.dest) + src = self.visit(node.src) + + assert dest is not None + assert src is not None + self.comment(f"Comparing {src} type with String") + # Cargar el puntero al tipo que queremos comparar + self.register_instruction(LA(v0, "String")) + + # Cargar el puntero al string del tipo + self.register_instruction(LW(a0, src)) + self.register_instruction(LW(a0, f"0($a0)")) + # Restar y devolver + self.register_instruction(SUB(a0, a0, v0)) + self.register_instruction(SW(a0, dest)) + + @visit.register + def _(self, node: CompareStringLengthNode): + dest = self.visit(node.dest) + left = self.visit(node.left) + right = self.visit(node.right) + + assert dest is not None + assert left is not None + assert right is not None + + # Cargar ambos strings + self.comment("Load strings for comparison") + self.register_instruction(LW(v0, left)) + self.register_instruction(LW(v1, right)) + + self.comment("Compare lengths") + self.register_instruction(LW(v0, f"16($v0)")) + self.register_instruction(LW(v1, f"16($v1)")) + self.register_instruction(SUB(v0, v0, v1)) + + # Return result + self.register_instruction(SW(v0, dest)) + + @visit.register + def _(self, node: CharToCharStringCompare): + dest = self.visit(node.dest) + left = self.visit(node.left) + right = self.visit(node.right) + + assert dest is not None + assert left is not None + assert right is not None + + self.register_instruction(MOVE(a2, zero)) + + # Cargar ambos strings + self.comment("Load strings for comparison") + self.register_instruction(LW(v0, left)) + self.register_instruction(LW(v1, right)) + + # Cargar los punteros a los strings + self.comment("Load strings pointers") + self.register_instruction(LW(v0, "12($v0)")) + self.register_instruction(LW(v1, f"12($v1)")) + + self.comment(f"Compare loop, while [v0] != \\0") + self.register_instruction(Label(node.while_label)) + self.register_instruction(LB(a0, f"0($v0)")) + self.comment("If EOS => break") + self.register_instruction(BEQZ(a0, node.end_label)) + self.register_instruction(LB(a1, f"0($v1)")) + self.comment("Move strings pointers") + self.register_instruction(ADDU(v0, v0, 1, True)) + self.register_instruction(ADDU(v1, v1, 1, True)) + self.comment("Compare chars") + self.register_instruction(SUB(a0, a0, a1)) + self.register_instruction(BEQZ(a0, node.while_label)) + self.comment("False") + self.register_instruction(LI(a2, 1)) + self.register_instruction(Label(node.end_label)) + + # Guardar el resultado + self.comment("Store result") + self.register_instruction(SW(a2, dest)) + + @visit.register + def _(self, node: ReferenceEqualNode): + # Comparar por referencias es simplemente + # cargar los punteros y restar + dest = self.visit(node.dest) + left = self.visit(node.left) + right = self.visit(node.right) + + assert dest is not None + assert left is not None + assert right is not None + + self.comment("Load pointers and SUB") + self.register_instruction(LW(a0, left)) + self.register_instruction(LW(a1, right)) + self.register_instruction(SUB(a0, a0, a1)) + + self.register_instruction(SW(a0, dest)) + + @visit.register + def _(self, node: MinusNodeComp): + # operate por valor sin devolver una instancia de int + # Comparar por referencias es simplemente + # cargar los punteros y restar + dest = self.visit(node.dest) + left = self.visit(node.left) + right = self.visit(node.right) + + assert dest is not None + assert left is not None + assert right is not None + + # Load pointers + self.register_instruction(LW(a0, left)) + self.register_instruction(LW(a1, right)) + + self.comment("Load values") + self.register_instruction(LW(a0, "12($a0)")) + self.register_instruction(LW(a1, "12($a1)")) + + self.comment("SUB and store") + self.register_instruction(SUB(a0, a0, a1)) + self.register_instruction(SW(a0, dest)) + + +class MipsCodeGenerator(CilToMipsVisitor): + """ + Clase que complete el pipeline entre un programa en CIL y un programa en MIPS. + El Generador visita el AST del programa en CIL para obtener el conjunto de nodos + correspondientes a cada instruccion de MIPS y luego devuelve una version en texto + plano del AST de MIPS, la cual se puede escribir a un archivo de salida y debe estar + lista para ejecutarse en SPIM. + """ + + def __call__(self, ast: cil.CilProgramNode) -> str: + self.visit(ast) + return self.to_str() + + def to_str(self) -> str: + program = "" + indent = 0 + for instr in self.program: + line = str(instr) + if ".data" in line or ".text" in line: + indent = 0 + program += "\n" + " " * (3 * indent) + line + if "#" not in line and (":" in line and "end" not in line): + if "word" not in line and "asciiz" not in line and "byte" not in line: + indent += 1 + if "# Function END" in line or "label_END" in line: + indent = 0 + return program diff --git a/src/travels/context_actions.py b/src/travels/context_actions.py new file mode 100755 index 00000000..3ed03650 --- /dev/null +++ b/src/travels/context_actions.py @@ -0,0 +1,28 @@ +from abstract.semantics import * + + +def update_attr_type(current_type_: Type, attr_name: str, new_type: Type): + for attr in current_type_.attributes: + attr.type = new_type if attr.name == attr_name else attr.type + + +def update_method_param(current_type: Type, method: str, param_name: str, + new_type: Type): + m = current_type.methods[method] + for i, (pname, ptype) in enumerate(zip(m.param_names, m.param_types)): + if pname == param_name: + m.param_types[i] = new_type + + +def update_scope_variable(vname: str, + new_type: Type, + scope: Scope, + index=None): + if not index: + index = 0 + for i in range(index, len(scope.locals)): + if scope.locals[i].name == vname: + scope.locals[i].type = new_type + return + if scope.parent: + update_scope_variable(vname, new_type, scope.parent, scope.index) diff --git a/src/travels/ctcill.py b/src/travels/ctcill.py new file mode 100644 index 00000000..f1bffd91 --- /dev/null +++ b/src/travels/ctcill.py @@ -0,0 +1,1186 @@ +from re import L +from abstract.semantics import Context, Type +from abstract.tree import ( + AttributeDef, + ClassDef, + EqualToNode, + IsVoidNode, + MethodDef, + NotNode, + SelfNode, +) +import cil.baseCilVisitor as baseCilVisitor +import abstract.tree as coolAst +import abstract.semantics as semantics +from typing import List, Optional, Tuple +from functools import singledispatchmethod +import re + +import cil.nodes + +from cil.nodes import ( + AbortNode, + AllocateBoolNode, + AllocateIntNode, + AllocateNode, + AllocateStringNode, + ArgNode, + AssignNode, + BitwiseNotNode, + CharToCharStringCompare, + CilNode, + CilProgramNode, + CompareSTRType, + CompareStringLengthNode, + CompareType, + ConcatString, + DataNode, + DivNode, + DynamicCallNode, + EqualToCilNode, + FunctionNode, + GetAttributeNode, + GetTypeIndex, + GetValue, + IfZeroJump, + InitSelfNode, + InstructionNode, + JumpIfGreater, + JumpIfGreaterThanZeroNode, + LabelNode, + LoadNode, + LocalNode, + MinusNode, + MinusNodeComp, + NotZeroJump, + ParamNode, + PlusNode, + PrintIntNode, + PrintNode, + PureMinus, + ReadIntNode, + ReadNode, + ReferenceEqualNode, + RestoreSelf, + ReturnNode, + SaveSelf, + SetAttributeNode, + StarNode, + StaticCallNode, + SubstringNode, + TdtLookupNode, + TypeName, + TypeNode, + TypeOffsetNode, + UnconditionalJump, +) + + +def find_min_i(vtables: List[List[Tuple[str, str]]], method: str): + return min( + [i for vtable in vtables for i, (m, _) in enumerate(vtable) if m == method] + ) + + +def sort_methods_tables(vtables: List[List[Tuple[str, str]]]): + methods = set([m for v in vtables for m, _ in v]) + new_tables = [[] for _ in vtables] + for m in methods: + for i, vtable in enumerate(vtables): + if m in [x for x, _ in vtable]: + name = next(n for x, n in vtable if x == m) + new_tables[i].append((m, name)) + else: + new_tables[i].append(("__not_a_func", "dummy")) + return new_tables + + +def find_method_in_parent(type_: Type, method: str, typeNodes: List[TypeNode]): + methods = [] + if type_.parent is not None: + parent = next(n for n in typeNodes if n.name == type_.name) + methods = [m for _, m in parent.methods] + if type_.parent is None or f"function_{method}_at_{type_.name}" in methods: + return type_ + return find_method_in_parent(type_.parent, method, typeNodes) + + +ExpressionReturn = Tuple[List[InstructionNode], List[LocalNode]] +Scope = semantics.Scope + + +class CoolToCILVisitor(baseCilVisitor.BaseCoolToCilVisitor): + @singledispatchmethod + def visit(self, node, scope: Scope) -> CilNode: + # Devolver un nodo vacio, al final este metodo no + # se debe llamar nunca. + return CilNode() + + @visit.register + def _(self, node: coolAst.ProgramNode, scope: Scope) -> CilProgramNode: + + # Definir el punto de entrada del programa. + self.current_function = self.register_function("entry") + instance = self.define_internal_local() + result = self.define_internal_local() + + # El primer metodo que se invoca es el metodo main de la clase Main + + # Reservar memoria para el objeto Main + main_type = self.context.get_type("Main") + self.register_instruction(AllocateNode(main_type, instance)) + self.register_instruction(InitSelfNode(instance)) + + # Llamar al metodo main + self.register_instruction(StaticCallNode(instance, main_type, "main", result)) + self.register_instruction(ReturnNode(0)) + self.current_function = None + + class_list = self.topological_sort_classDefs(node.class_list) + # Ordenar los scopes + children = [] + for x in class_list: + i = next(i for i, c in enumerate(node.class_list) if c.idx == x.idx) + children.append(scope.children[i]) + + for c in class_list: + self.register_type(c.idx) + + for klass, child_scope in zip(class_list, children): + self.visit(klass, child_scope) + + # print("\n".join(str(x) for x in sort_methods_tables([t.methods for t in self.dot_types]))) + new_vtable = sort_methods_tables([t.methods for t in self.dot_types]) + for i in range(len(self.dot_types)): + self.dot_types[i].methods = new_vtable[i] + + return CilProgramNode(self.dot_types, self.dot_data, self.dot_code) + + # *************** IMPLEMENTACION DE LAS DEFINICIONES DE CLASES ***************** + + @visit.register + def _(self, node: coolAst.ClassDef, scope: Scope) -> None: + # Registrar el tipo que creamos en .Types section + self.current_type = self.context.get_type(node.idx) + new_type_node = next(x for x in self.dot_types if x.name == node.idx) + + methods = self.current_type.methods + attributes = self.current_type.attributes + + # Manejar los features heredados como atributos y metodos + if self.current_type.parent is not None: + for attribute in self.current_type.parent.attributes: + new_type_node.attributes.append(attribute) + + parent = next( + t for t in self.dot_types if t.name == self.current_type.parent.name + ) + + for method, _ in parent.methods: + # Manejar la redefinicion de metodos + if method not in methods: + new_type_node.methods.append( + ( + method, + self.to_function_name( + method, + find_method_in_parent( + self.current_type.parent, method, self.dot_types + ).name, + ), + ) + ) + else: + new_type_node.methods.append( + (method, self.to_function_name(method, node.idx)) + ) + + defined_methods = [x for x, _ in new_type_node.methods] + + # Registrar cada atributo y metodo para este tipo + # la seccion .Type debe tener la siguiente forma: + ##################################################################### + # .TYPES # + # type A { # + # attribute x; # + # method f : function_f_at_A; # + # } # + ##################################################################### + for attribute in attributes: + if attribute not in self.current_type.parent.attributes: + new_type_node.attributes.append(attribute) + + for method in methods: + if method not in defined_methods: + new_type_node.methods.append( + (method, self.to_function_name(method, node.idx)) + ) + + attrib = [x for x in node.features if isinstance(x, AttributeDef)] + meth = [x for x in node.features if isinstance(x, MethodDef)] + features = attrib + meth + + self.current_type.attributes = new_type_node.attributes + + for f, s in zip(features, scope.children): + self.visit(f, s) + + self.current_type = None + + # ****************** IMPLEMENTACION DE LAS DEFINICIONES DE METODOS ****************** + + @visit.register + def _(self, node: coolAst.AttributeDef, scope: Scope) -> None: + self.current_function = self.register_function( + f"__{self.current_type.name}__attrib__{node.idx}__init" + ) + local = self.define_internal_local() + if node.default_value is not None: + # Generar el codigo de la expresion de inicializacion + # y devolver el valor de esta + value = self.visit(node.default_value, scope) + self.register_instruction(ReturnNode(value)) + + else: + # Si no tiene expresion de inicializacion entonces devolvemos + # 0 en caso de que sea Int, Bool u otro tipo excepto String + # (0 = false y 0 = void) + # attribute_type = self.context.get_type(node.typex) + attribute_type = scope.find_variable(node.idx).type + if attribute_type.name == "String": + self.register_instruction(AllocateStringNode(local, self.null, 0)) + self.register_instruction(ReturnNode(local)) + elif attribute_type.name == "Bool": + self.register_instruction(AllocateBoolNode(local, 0)) + self.register_instruction(ReturnNode(local)) + elif attribute_type.name == "Int": + self.register_instruction(AllocateIntNode(local, 0)) + self.register_instruction(ReturnNode(local)) + else: + self.register_instruction(ReturnNode(0)) + + @visit.register + def _(self, node: coolAst.MethodDef, scope: Scope) -> None: + self.current_method = self.current_type.get_method(node.idx) + + # Registrar la nueva funcion en .CODE + function_node = self.register_function( + self.to_function_name(node.idx, self.current_type.name) + ) + + # Establecer el metodo actual y la funcion actual en construccion + # para poder establecer nombres de variables y otras cosas. + self.current_function = function_node + + # Definir los parametros del metodo. + params: List[Optional[semantics.VariableInfo]] = [ + scope.find_variable(param.id) for param in node.param_list + ] + + # Establecer los parametros de la funcion. + for param in params: + if param: + self.register_params(param) + + # Registrar las instrucciones que conforman el cuerpo del metodo. + last = self.visit(node.statements, scope) + if last is not None: + self.register_instruction(ReturnNode(last)) + else: + self.register_instruction(ReturnNode()) + + self.current_method = None + self.current_function = None + + # ************** IMPLEMENTACION DE LAS EXPRESIONES CONDICIONAES (IF, WHILE, CASE) Y LAS DECLARACIONES + # DE VARIABLES (let) + # ************** + + @visit.register + def _(self, node: coolAst.IfThenElseNode, scope: Scope): # noqa: F811 + # Crear un LABEL al cual realizar un salto. + false_label = self.do_label("FALSEIF") + end_label = self.do_label("ENDIF") + cond_value = self.define_internal_local() + return_expr = self.define_internal_local() + + # Salvar las instrucciones relacionadas con la condicion, + # cada expresion retorna el nombre de la variable interna que contiene el valor ?? + internal_cond_vm_holder = self.visit(node.cond, scope) + + # Condicion es un Bool + self.register_instruction(GetValue(cond_value, internal_cond_vm_holder)) + + # Chequear y saltar si es necesario. + self.register_instruction(IfZeroJump(cond_value, false_label)) + + # Salvar las instrucciones relacionadas con la rama TRUE. + expr = self.visit(node.expr1, scope) + self.register_instruction(AssignNode(return_expr, expr)) + + self.register_instruction(UnconditionalJump(end_label)) + + # Registrar las instrucciones relacionadas con la rama ELSE + self.register_instruction(LabelNode(false_label)) + expr2 = self.visit(node.expr2, scope) + self.register_instruction(AssignNode(return_expr, expr2)) + + self.register_instruction(LabelNode(end_label)) + + return return_expr + + @visit.register + def _(self, node: coolAst.VariableDeclaration, scope: Scope) -> CilNode: + for var_idx, var_type, var_init_expr, _, _ in node.var_list: + + # Registrar las variables en orden. + var_info = scope.find_variable(var_idx) + assert var_info is not None, f"Var not found {var_idx}" + local_var = self.register_local(var_info) + + # Reservar memoria para la variable y realizar su inicializacion si tiene + assert var_info.type is not None + + # Si la variable es int, string o boolean, su valor por defecto es 0 + if var_info.type.name not in ("String", "Int", "Bool"): + self.register_instruction(AssignNode(local_var, 0)) + elif var_info.type.name == "String": + self.register_instruction(AllocateStringNode(local_var, self.null, 0)) + elif var_info.type.name == "Int": + self.register_instruction(AllocateIntNode(local_var, 0)) + elif var_info.type.name == "Bool": + self.register_instruction(AllocateBoolNode(local_var, 0)) + + if var_init_expr is not None: + expr_init_vm_holder = self.visit(var_init_expr, scope) + # Assignar el valor correspondiente a la variable reservada + self.register_instruction(AssignNode(local_var, expr_init_vm_holder)) + + # Compute the associated expr, if any, to the let declaration + # A block defines a new scope, so it is important to manage it + return self.visit(node.block_statements, scope) + + @visit.register + def _(self, node: coolAst.VariableCall, scope: Scope): + return self.visit(node.idx, scope) + + @visit.register + def _(self, node: coolAst.InstantiateClassNode, scope: Scope) -> LocalNode: + # Reservar una variable que guarde la nueva instancia + type_ = self.context.get_type(node.type_) + instance_vm_holder = self.define_internal_local() + + if type_.name not in ("String", "Int", "Bool"): + self.register_instruction(AllocateNode(type_, instance_vm_holder)) + elif type_.name == "String": + self.register_instruction( + AllocateStringNode(instance_vm_holder, self.null, 0) + ) + elif type_.name == "Int": + self.register_instruction(AllocateIntNode(instance_vm_holder, 0)) + elif type_.name == "Bool": + self.register_instruction(AllocateBoolNode(instance_vm_holder, 0)) + + return instance_vm_holder + + @visit.register + def _(self, node: coolAst.BlockNode, scope: Scope) -> CilNode: + last: CilNode = CilNode() + # A block is simply a list of statements, so visit each one + for stmt in node.expressions: + last = self.visit(stmt, scope) + # Return value of a block is its last statement + return last + + @visit.register + def _(self, node: coolAst.AssignNode, scope: Scope): + # La asignacion tiene la siguiente forma: + # id <- expr + # Aqui asumimos que una variable interna llamada id + # ya ha sido definida + + # Generar el codigo para el rvalue (expr) + rvalue_vm_holder = self.visit(node.expr, scope) + var_inf = scope.find_variable(node.idx) + + # Es necesario diferenciar entre variable y atributo. + # Las variables se diferencian en si son locales al + # metodo que estamos creando o si son atributos. + if var_inf.location == "PARAM": + # Buscar la variable en los parametros + var = next( + v + for v in self.params + if f"param_{self.current_function.name[9:]}_{var_inf.name}_" in v.name + ) + # registrar la instruccion de asignacion + self.register_instruction(AssignNode(var, rvalue_vm_holder)) + elif var_inf.location == "LOCAL": + var = next( + v + for v in list(reversed(self.localvars)) + if f"local_{self.current_function.name[9:]}_{var_inf.name}_" in v.name + ) + self.register_instruction(AssignNode(var, rvalue_vm_holder)) + else: + assert self.current_type is not None + self.register_instruction( + SetAttributeNode(self.current_type, node.idx, rvalue_vm_holder) + ) + + @visit.register + def _(self, node: str, scope: Scope): + var_inf = scope.find_variable(node) + + # Es necesario diferenciar entre variable y atributo. + # Las variables se diferencian en si son locales al + # metodo que estamos creando o si son atributos. + if var_inf.location == "PARAM": + # Buscar la variable en los parametros + var = next( + v + for v in self.params + if f"param_{self.current_function.name[9:]}_{var_inf.name}_" in v.name + ) + # registrar la instruccion de asignacion + return var + elif var_inf.location == "LOCAL": + var = next( + v + for v in list(reversed(self.localvars)) + if f"local_{self.current_function.name[9:]}_{var_inf.name}_" in v.name + ) + return var + else: + local = self.define_internal_local() + assert self.current_type is not None + self.register_instruction( + GetAttributeNode(self.current_type, var_inf.name, local) + ) + return local + + @visit.register + def _(self, node: coolAst.WhileBlockNode, scope: Scope): + # Evaluar la condicion y definir un LABEL al cual + # retornar + cond_value = self.define_internal_local() + while_label = self.do_label("WHILE") + end_label = self.do_label("WHILE_END") + self.register_instruction(LabelNode(while_label)) + cond_vm_holder = self.visit(node.cond, scope) + + # Lo que viene en cond es un Bool + self.register_instruction(GetValue(cond_value, cond_vm_holder)) + + # Probar la condicion, si es true continuar la ejecucion, sino saltar al LABEL end + self.register_instruction(IfZeroJump(cond_value, end_label)) + + # Registrar las instrucciones del cuerpo del while + self.visit(node.statements, scope) + + # Realizar un salto incondicional al chequeo de la condicion + self.register_instruction(UnconditionalJump(while_label)) + # Registrar el LABEL final + self.register_instruction(LabelNode(end_label)) + + @visit.register + def _(self, node: coolAst.CaseNode, scope: Scope): + # Evalauar la expr0 + expr_vm_holder = self.visit(node.expression, scope) + + # Almacenar el tipo del valor retornado + type_internal_local_holder = self.define_internal_local() + sub_vm_local_holder = self.define_internal_local() + result_vm_holder = self.define_internal_local() + + self.register_instruction( + TypeOffsetNode(expr_vm_holder, type_internal_local_holder) + ) + + # Variables internas para almacenar resultados intermedios + min_ = self.define_internal_local() + tdt_result = self.define_internal_local() + + self.register_instruction(AssignNode(min_, len(self.context.types))) + + for i, action_node in enumerate(node.actions): + # Calcular la distancia hacia el tipo, y actualizar el minimo de ser necesario + self.register_instruction( + TdtLookupNode(action_node.typex, type_internal_local_holder, tdt_result) + ) + + not_min_label = self.do_label(f"Not_min{i}") + + # Comparar el resultado obtenido con el minimo actual. + self.register_instruction(JumpIfGreater(tdt_result, min_, not_min_label)) + + # Si mejora el minimo, entonces actualizarlo. + self.register_instruction(AssignNode(min_, tdt_result)) + self.register_instruction(LabelNode(not_min_label)) + + # Ya tenemos la menor distancia entre el tipo calculado en la expr0, y todos los tipos definidos + # en los branches del case. + # Comprobar que tengamos una coincidencia + self.register_instruction(AssignNode(tdt_result, len(self.context.types))) + self.register_instruction( + ReferenceEqualNode(tdt_result, min_, sub_vm_local_holder) + ) + error_label = self.do_label("ERROR") + self.register_instruction(IfZeroJump(sub_vm_local_holder, error_label)) + + end_label = self.do_label("END") + + # Procesar cada accion y ejecutar el tipo cuya distancia sea igual a min_ + for i, (action_node, s) in enumerate(zip(node.actions, scope.children)): + next_label = self.do_label(f"NEXT{i}") + self.register_instruction( + TdtLookupNode(action_node.typex, type_internal_local_holder, tdt_result) + ) + self.register_instruction(JumpIfGreater(tdt_result, min_, next_label)) + # Implemententacion del branch. + # Registrar la variable + var_info = s.find_variable(action_node.idx) + assert var_info is not None + idk = self.register_local(var_info) + # Asignar al identificador idk el valor de expr0 + self.register_instruction(AssignNode(idk, expr_vm_holder)) + # Generar el codigo de la expresion asociada a esta rama + expr_val_vm_holder = self.visit(action_node.actions, s) + # Salvar el resultado + self.register_instruction(AssignNode(result_vm_holder, expr_val_vm_holder)) + # Generar un salto de modo que no se chequee otra rama + self.register_instruction(UnconditionalJump(end_label)) + self.register_instruction(LabelNode(next_label)) + + self.register_instruction(LabelNode(error_label)) + self.register_instruction(TypeName(expr_vm_holder)) + self.register_instruction( + AbortNode(expr_vm_holder, self.abortion, self.newLine) + ) + + self.register_instruction(LabelNode(end_label)) + return result_vm_holder + + # *************** IMPLEMENTACION DE LAS EXPRESIONES ARITMETICAS + # + # *************** + + @visit.register + def _(self, node: coolAst.PlusNode, scope: Scope) -> LocalNode: + # Definir una variable interna local para almacenar el resultado + sum_internal_local = self.define_internal_local() + + # Obtener el resultado del primero operando + left_vm_holder = self.visit(node.left, scope) + + # Obtener el resultado del segundo operando + right_vm_holder = self.visit(node.right, scope) + + # registrar la instruccion de suma + self.register_instruction( + PlusNode(sum_internal_local, left_vm_holder, right_vm_holder) + ) + + # Devolver la variable interna que contiene la suma + return sum_internal_local + + @visit.register + def _(self, node: coolAst.DifNode, scope: Scope) -> LocalNode: + # Definir una variable interna local para almacenar el resultado intermedio + minus_internal_vm_holder = self.define_internal_local() + + # Obtener el resultado del minuendo + left_vm_holder = self.visit(node.left, scope) + + # Obtener el resultado del sustraendo + right_vm_holder = self.visit(node.right, scope) + + self.register_instruction( + MinusNode(left_vm_holder, right_vm_holder, minus_internal_vm_holder) + ) + + # Devolver la variable que contiene el resultado + return minus_internal_vm_holder + + @visit.register + def _(self, node: coolAst.MulNode, scope: Scope) -> LocalNode: + # Definir una variable interna local para almacenar el resultado intermedio + mul_internal_vm_holder = self.define_internal_local() + + # Obtener el resultado del primer factor + left_vm_holder = self.visit(node.left, scope) + + # Obtener el resultado del segundo factor + right_vm_holder = self.visit(node.right, scope) + + # Registrar la instruccion de multimplicacion + self.register_instruction( + StarNode(left_vm_holder, right_vm_holder, mul_internal_vm_holder) + ) + + # Retornar el resultado + return mul_internal_vm_holder + + @visit.register + def _(self, node: coolAst.DivNode, scope: Scope) -> LocalNode: + # Definir una variable interna local para almacenar el resultado intermedio + div_internal_vm_holder = self.define_internal_local() + + # Obtener el resultad del dividendo + left_vm_holder = self.visit(node.left, scope) + + # Obtener el resultado del divisor + right_vm_holder = self.visit(node.right, scope) + + # Registrar la instruccion de division + self.register_instruction( + DivNode(div_internal_vm_holder, left_vm_holder, right_vm_holder) + ) + + # Devolver el resultado + return div_internal_vm_holder + + # ********************* IMPLEMENTACION DE LAS CONSTANTES + # + # ********************* + + @visit.register + def _(self, node: coolAst.IntegerConstant, scope: Scope): + # devolver el valor + return_vm_holder = self.define_internal_local() + self.register_instruction(AllocateIntNode(return_vm_holder, int(node.lex))) + return return_vm_holder + + @visit.register + def _(self, node: coolAst.StringConstant, scope: Scope) -> LocalNode: + # Variable interna que apunta al string + str_const_vm_holder = self.define_internal_local() + + # Registrar el string en la seccion de datos + s1 = self.register_data(node.lex) + + pluses = len(re.findall(r"\\n", node.lex)) + 2 + + # Cargar el string en la variable interna + self.register_instruction( + AllocateStringNode(str_const_vm_holder, s1, len(node.lex) - pluses) + ) + + # Devolver la variable que contiene el string + return str_const_vm_holder + + @visit.register + def _(self, node: coolAst.TrueConstant, scope: Scope): + # variable interna que devuelve el valor de la constante + expr = self.define_internal_local() + self.register_instruction(AllocateBoolNode(expr, 1)) + return expr + + @visit.register + def _(self, node: coolAst.FalseConstant, scope: Scope): + # variable interna que devuelve el valor de la constante + expr = self.define_internal_local() + self.register_instruction(AllocateBoolNode(expr, 0)) + return expr + + # ******************* Implementacion de las comparaciones ******************** + # Todas las operaciones de comparacion devuelven 1 si el resultado es verdadero, + # o 0 si es falso. + # ******************* + + @visit.register + def _(self, node: coolAst.NegNode, scope: Scope): + # Obtener el valor de la expresion + expr_result = self.visit(node.lex, scope) + result_vm_holder = self.define_internal_local() + + if isinstance(expr_result, int): + self.register_instruction( + AssignNode(result_vm_holder, abs(expr_result - 1)) + ) + return result_vm_holder + else: + false_label = self.do_label("FALSE") + not_end_label = self.do_label("NOT_END") + assert isinstance(expr_result, LocalNode) + self.register_instruction(GetValue(expr_result, expr_result)) + # Si expr = 0 entonces devolver 1 + self.register_instruction(IfZeroJump(expr_result, false_label)) + # Si expr = 1 devolver 0 + self.register_instruction(AllocateBoolNode(result_vm_holder, 0)) + self.register_instruction(UnconditionalJump(not_end_label)) + self.register_instruction(LabelNode(false_label)) + # Si expr = 0 entonces devolver 1 + self.register_instruction(AllocateBoolNode(result_vm_holder, 1)) + self.register_instruction(LabelNode(not_end_label)) + return result_vm_holder + + @visit.register + def _(self, node: coolAst.EqualToNode, scope: Scope) -> LocalNode: + expr_result_vm_holder = self.define_internal_local() + temp_expr_vm_holder = self.define_internal_local() + + # Obtener el valor de la expresion izquierda + left_vm_holder = self.visit(node.left, scope) + + # obtener el valor de la expresion derecha + right_vm_holder = self.visit(node.right, scope) + + false_ = self.do_label("FALSE") + true_ = self.do_label("TRUE") + end = self.do_label("END") + compare_string = self.do_label("COMPARE_STRING") + compare_by_value = self.do_label("COMPARE_BY_VALUE") + continue_ = self.do_label("CONTINUE") + while_label = self.do_label("WHILE_STR_COMP") + end_while_label = self.do_label("WHILE_STR_COMP_END") + + # Si left es un string realizar la comparacion entre strings + # si no realizar una resta y devolver el resultado + + # Si right = void o left = void (0) devolver false + self.register_instruction(IfZeroJump(left_vm_holder, false_)) + self.register_instruction(IfZeroJump(right_vm_holder, false_)) + + # Si es un string comparar char a char + self.register_instruction(CompareSTRType(temp_expr_vm_holder, left_vm_holder)) + # CompareType devuelve 0 para True y 1 para False + self.register_instruction(IfZeroJump(temp_expr_vm_holder, compare_string)) + # No es un string, comparar por valor si es bool o int + self.register_instruction( + CompareType(temp_expr_vm_holder, left_vm_holder, "Bool") + ) + self.register_instruction(IfZeroJump(temp_expr_vm_holder, compare_by_value)) + + self.register_instruction( + CompareType(temp_expr_vm_holder, left_vm_holder, "Int") + ) + self.register_instruction(IfZeroJump(temp_expr_vm_holder, compare_by_value)) + + # Comparar por referencia + self.register_instruction( + ReferenceEqualNode(left_vm_holder, right_vm_holder, temp_expr_vm_holder) + ) + self.register_instruction(IfZeroJump(temp_expr_vm_holder, true_)) + self.register_instruction(UnconditionalJump(false_)) + + self.register_instruction(LabelNode(compare_by_value)) + self.register_instruction( + MinusNodeComp(left_vm_holder, right_vm_holder, temp_expr_vm_holder) + ) + self.register_instruction(IfZeroJump(temp_expr_vm_holder, true_)) + self.register_instruction(UnconditionalJump(false_)) + + self.register_instruction(LabelNode(compare_string)) + self.register_instruction( + CompareStringLengthNode( + temp_expr_vm_holder, left_vm_holder, right_vm_holder + ) + ) + # Compare devuelve 0 para true y 1 para true + self.register_instruction(IfZeroJump(temp_expr_vm_holder, continue_)) + self.register_instruction(UnconditionalJump(false_)) + + # Los lengths son iguales, seguir comparando + self.register_instruction(LabelNode(continue_)) + self.register_instruction( + CharToCharStringCompare( + temp_expr_vm_holder, + left_vm_holder, + right_vm_holder, + while_label, + end_while_label, + ) + ) + self.register_instruction(IfZeroJump(temp_expr_vm_holder, true_)) + + self.register_instruction(LabelNode(false_)) + self.register_instruction(AllocateBoolNode(expr_result_vm_holder, 0)) + self.register_instruction(UnconditionalJump(end)) + + self.register_instruction(LabelNode(true_)) + self.register_instruction(AllocateBoolNode(expr_result_vm_holder, 1)) + self.register_instruction(LabelNode(end)) + + # Devolver la variable con el resultado + return expr_result_vm_holder + + @visit.register + def _(self, node: coolAst.LowerThanNode, scope: Scope) -> LocalNode: + expr_result_vm_holder = self.define_internal_local() + false_label = self.do_label("FALSE") + end_label = self.do_label("END") + + # Obtener el valor de la expresion izquierda + left_vm_holder = self.visit(node.left, scope) + + # Obtener el valor de la expresion derecha + right_vm_holder = self.visit(node.right, scope) + + self.register_instruction( + MinusNodeComp(left_vm_holder, right_vm_holder, expr_result_vm_holder) + ) + + self.register_instruction( + JumpIfGreaterThanZeroNode(expr_result_vm_holder, false_label) + ) + self.register_instruction(IfZeroJump(expr_result_vm_holder, false_label)) + + self.register_instruction(AllocateBoolNode(expr_result_vm_holder, 1)) + self.register_instruction(UnconditionalJump(end_label)) + + self.register_instruction(LabelNode(false_label)) + self.register_instruction(AllocateBoolNode(expr_result_vm_holder, 0)) + self.register_instruction(LabelNode(end_label)) + + return expr_result_vm_holder + + @visit.register + def _(self, node: coolAst.LowerEqual, scope: Scope) -> LocalNode: + expr_result_vm_holder = self.define_internal_local() + false_label = self.do_label("FALSE") + end_label = self.do_label("END") + + # Obtener el valor de la expresion izquierda + left_vm_holder = self.visit(node.left, scope) + + # Obtener el valor de la expresion derecha + right_vm_holder = self.visit(node.right, scope) + + self.register_instruction( + MinusNodeComp(left_vm_holder, right_vm_holder, expr_result_vm_holder) + ) + + self.register_instruction( + JumpIfGreaterThanZeroNode(expr_result_vm_holder, false_label) + ) + + self.register_instruction(AllocateBoolNode(expr_result_vm_holder, 1)) + self.register_instruction(UnconditionalJump(end_label)) + + self.register_instruction(LabelNode(false_label)) + self.register_instruction(AllocateBoolNode(expr_result_vm_holder, 0)) + self.register_instruction(LabelNode(end_label)) + + return expr_result_vm_holder + + @visit.register + def _(self, node: coolAst.GreaterThanNode, scope: Scope) -> LocalNode: + expr_result_vm_holder = self.define_internal_local() + true_label = self.do_label("TRUE") + end_label = self.do_label("END") + + # Obtener el valor de la expresion izquierda + left_vm_holder = self.visit(node.left, scope) + + # Obtener el valor de la expresion derecha + right_vm_holder = self.visit(node.right, scope) + + assert isinstance(left_vm_holder, LocalNode) and isinstance( + right_vm_holder, LocalNode + ) + + self.register_instruction( + MinusNodeComp(left_vm_holder, right_vm_holder, expr_result_vm_holder) + ) + + self.register_instruction( + JumpIfGreaterThanZeroNode(expr_result_vm_holder, true_label) + ) + + # False Branch + self.register_instruction(AllocateBoolNode(expr_result_vm_holder, 0)) + self.register_instruction(UnconditionalJump(end_label)) + + # True Branch + self.register_instruction(LabelNode(true_label)) + self.register_instruction(AllocateBoolNode(expr_result_vm_holder, 1)) + self.register_instruction(LabelNode(end_label)) + + return expr_result_vm_holder + + @visit.register + def _(self, node: coolAst.GreaterEqualNode, scope: Scope) -> LocalNode: + expr_result_vm_holder = self.define_internal_local() + true_label = self.do_label("TRUE") + end_label = self.do_label("END") + + # Obtener el valor de la expresion izquierda + left_vm_holder = self.visit(node.left, scope) + + # Obtener el valor de la expresion derecha + right_vm_holder = self.visit(node.right, scope) + + assert isinstance(left_vm_holder, LocalNode) and isinstance( + right_vm_holder, LocalNode + ) + + self.register_instruction( + MinusNodeComp(left_vm_holder, right_vm_holder, expr_result_vm_holder) + ) + + self.register_instruction( + JumpIfGreaterThanZeroNode(expr_result_vm_holder, true_label) + ) + self.register_instruction(IfZeroJump(expr_result_vm_holder, true_label)) + + # False Branch + self.register_instruction(AllocateBoolNode(expr_result_vm_holder, 0)) + self.register_instruction(UnconditionalJump(end_label)) + + # True Branch + self.register_instruction(LabelNode(true_label)) + self.register_instruction(AllocateBoolNode(expr_result_vm_holder, 1)) + self.register_instruction(LabelNode(end_label)) + + return expr_result_vm_holder + + # ********************* IMPLEMENTACION DE LOS METODOS DE DISPATCH ******************* + # + # ********************* + + @visit.register + def _(self, node: coolAst.FunCall, scope: Scope) -> LocalNode: + type_vm_holder = self.define_internal_local() + return_vm_holder = self.define_internal_local() + # Evaluar la expresion a la izquierda del punto + expr = self.visit(node.obj, scope) + + self.register_instruction(AssignNode(type_vm_holder, expr)) + + self.register_instruction(SaveSelf()) + + # Evaluar los argumentos + for arg in node.args: + arg_expr = self.visit(arg, scope) + self.register_instruction(ArgNode(arg_expr)) + + self.register_instruction( + DynamicCallNode(type_vm_holder, node.id, return_vm_holder) + ) + + self.register_instruction(RestoreSelf()) + + return return_vm_holder + + @visit.register + def _(self, node: coolAst.ParentFuncCall, scope: Scope) -> LocalNode: + return_expr_vm_holder = self.define_internal_local() + + # Evaluar el objeto sobre el que se llama la funcion + obj_dispatched = self.visit(node.obj, scope) + + self.register_instruction(SaveSelf()) + + # Evaluar los argumentos + for arg in node.arg_list: + arg_expr = self.visit(arg, scope) + self.register_instruction(ArgNode(arg_expr)) + + # Asignar el tipo a una variable + type_ = self.context.get_type(node.parent_type) + self.register_instruction( + StaticCallNode(obj_dispatched, type_, node.idx, return_expr_vm_holder) + ) + + self.register_instruction(RestoreSelf()) + + return return_expr_vm_holder + + @visit.register + def _(self, node: SelfNode, scope: Scope) -> LocalNode: + return_expr_vm_holder = self.define_internal_local() + self.register_instruction(cil.nodes.SelfNode(return_expr_vm_holder)) + return return_expr_vm_holder + + @visit.register + def _(self, node: IsVoidNode, scope: Scope): + return_bool_vm_holder = self.define_internal_local() + val = self.visit(node.expr, scope) + true_label = self.do_label("TRUE") + end_label = self.do_label("END") + self.register_instruction(IfZeroJump(val, true_label)) + # Bool con valor false + self.register_instruction(AllocateBoolNode(return_bool_vm_holder, 0)) + self.register_instruction(UnconditionalJump(end_label)) + self.register_instruction(LabelNode(true_label)) + self.register_instruction(AllocateBoolNode(return_bool_vm_holder, 1)) + self.register_instruction(LabelNode(end_label)) + return return_bool_vm_holder + + @visit.register + def _(self, node: NotNode, scope: Scope): + expr = self.define_internal_local() + result = self.visit(node.lex, scope) + self.register_instruction(BitwiseNotNode(result, expr)) + self.register_instruction(AllocateIntNode(expr, expr)) + return expr + + +class CilDisplayFormatter: + @singledispatchmethod + def visit(self, node) -> str: + return "" + + @visit.register + def _(self, node: CilProgramNode): + # Primero imprimir la seccion .TYPES + dottypes = "\n".join(self.visit(type_) for type_ in node.dottypes) + + # Imprimir la seccion .DATA + dotdata = "\n".join(self.visit(data) for data in node.dotdata) + + # Imprimir la seccion .CODE + dotcode = "\n".join(self.visit(code) for code in node.dotcode) + + return f".TYPES\n{dottypes}\n\n.DATA\n{dotdata}\n\n.CODE\n{dotcode}" + + @visit.register + def _(self, node: TypeNode): + attributes = "\n\t".join(f"{x}" for x in node.attributes) + methods = "\n\t".join(f"method {x}: {y}" for x, y in node.methods) + + return f"type {node.name} {{\n\t{attributes}\n\n\t{methods}\n}}" + + @visit.register + def _(self, node: FunctionNode): + params = "\n\t".join(self.visit(x) for x in node.params) + localvars = "\n\t".join(self.visit(x) for x in node.localvars) + instructions = "\n\t".join(self.visit(x) for x in node.instructions) + + return f"{node.name} {{\n\t{params}\n\n\t{localvars}\n\n\t{instructions}\n}}" + + @visit.register + def _(self, node: ParamNode) -> str: + return f"PARAM {node.name}" + + @visit.register + def _(self, node: LocalNode) -> str: + return f"{node.name}" + + @visit.register + def _(self, node: AssignNode) -> str: + return f"{self.visit(node.dest)} = {self.visit(node.source)}" + + @visit.register + def _(self, node: PlusNode) -> str: + return f"{self.visit(node.dest)} = {self.visit(node.left)} + {self.visit(node.right)}" + + @visit.register + def _(self, node: MinusNode) -> str: + return f"{self.visit(node.dest)} = {self.visit(node.x)} - {self.visit(node.y)}" + + @visit.register + def _(self, node: StarNode) -> str: + return f"{self.visit(node.dest)} = {self.visit(node.x)} * {self.visit(node.y)}" + + @visit.register + def _(self, node: DivNode) -> str: + return f"{self.visit(node.dest)} = {self.visit(node.left)} / {self.visit(node.right)}" + + @visit.register + def _(self, node: AllocateNode) -> str: + return f"{self.visit(node.dest)} = ALLOCATE {node.itype.name}" + + @visit.register + def _(self, node: TypeOffsetNode) -> str: + return f"{self.visit(node.dest)} = TYPEOF {node.variable.name}" + + @visit.register + def _(self, node: DynamicCallNode) -> str: + return f"{self.visit(node.dest)} = VCALL {node.xtype.name} {node.method}" + + @visit.register + def _(self, node: StaticCallNode) -> str: + return f"{self.visit(node.dest)} = CALL {node.function}" + + @visit.register + def _(self, node: ArgNode) -> str: + if isinstance(node.name, int): + return f"ARG {self.visit(node.name)}" + else: + return f"ARG {node.name.name}" + + @visit.register + def _(self, node: ReturnNode) -> str: + if isinstance(node.value, int): + return f"RETURN {node.value}" + elif isinstance(node.value, LocalNode): + return f"RETURN {node.value.name}" + return "RETURN" + + @visit.register + def _(self, node: DataNode) -> str: + if isinstance(node.value, str): + return f'{node.name} = "{node.value}" ;' + elif isinstance(node.value, list): + data = "\n\t".join(str(x) for x in node.value) + return f"{node.name} = {data}" + return f"{node.name} = {node.value}" + + @visit.register + def _(self, node: GetTypeIndex) -> str: + return f"{node.dest} = GETTYPEINDEX {node.itype}" + + @visit.register + def _(self, node: TdtLookupNode) -> str: + return f"{node.dest.name} = TYPE_DISTANCE {node.i} {node.j}" + + @visit.register + def _(self, node: IfZeroJump) -> str: + return f"IF_ZERO {node.variable.name} GOTO {node.label}" + + @visit.register + def _(self, node: UnconditionalJump) -> str: + return f"GOTO {node.label}" + + @visit.register + def _(self, node: JumpIfGreaterThanZeroNode) -> str: + return f"IF_GREATER_ZERO {node.variable.name} GOTO {node.label}" + + @visit.register + def _(self, node: LabelNode) -> str: + return f"{node.label}:" + + @visit.register + def _(self, node: int) -> str: + return str(node) + + @visit.register + def _(self, node: GetAttributeNode): + return f"{node.dest.name} = GETATTRIBUTE {node.attrname} {node.itype.name}" + + @visit.register + def _(self, node: cil.nodes.SelfNode): + return f"{node.dest.name} = SELF" + + @visit.register + def _(self, node: NotNode): + return f"NOT {node.src.name}" + + @visit.register + def _(self, node: PrintIntNode): + return f"PRINT_INT {node.src.name}" + + @visit.register + def _(self, node: ReadIntNode): + return f"{node.dest.name} = READ_INT" + + @visit.register + def _(self, node: ReadNode): + return f"{node.dest.name} = READ_STR" + + @visit.register + def _(self, node: PrintNode): + return f"PRINT_STR {node.src.name}" + + @visit.register + def _(self, node: SubstringNode): + return f"{self.visit(node.dest)} = SUBSTRING {self.visit(node.l)} {self.visit(node.r)} self" + + @visit.register + def _(self, node: ConcatString): + return f"{self.visit(node.dest)} = self.CONCAT {node.s}" + + def __call__(self, node) -> str: + return self.visit(node) diff --git a/src/travels/inference.py b/src/travels/inference.py new file mode 100755 index 00000000..ba6c6d89 --- /dev/null +++ b/src/travels/inference.py @@ -0,0 +1,817 @@ +from functools import singledispatchmethod +from typing import List, Optional + +import abstract.semantics as semantic +import abstract.tree as coolAst +from abstract.semantics import Scope, SemanticError, Type +from abstract.tree import ActionNode, AttributeDef, CaseNode, IsVoidNode, MethodDef, ParentFuncCall, SelfNode +from travels.context_actions import ( + update_attr_type, + update_method_param, + update_scope_variable, +) + +void = semantic.VoidType() + +def get_type_attribute_chain(type_: Type): + if type_.name == "Object": + return [] + else: + assert type_.parent is not None + return type_.attributes + get_type_attribute_chain(type_.parent) + + +def find_common_parent(e1, e2): + if e1.conforms_to(e2): + return e2 + elif e2.conforms_to(e1): + return e1 + else: + e1_types: List[Type] = [] + while e1: + e1_types.append(e1.parent) + e1 = e1.parent + + while e2 not in e1_types: + e2 = e2.parent + return e2 + # e1_parent = e1.parent + # e2_parent = e2.parent + # while e2_parent != e1_parent: + # if e1_parent.name != "Object": + # e1_parent = e1_parent.parent + # if e2_parent.name != "Object": + # e2_parent = e2_parent.parent + # return e1_parent + + +def TypeError(s, l, c): + return f"({l}, {c}) - TypeError: {s}" + + +class TypeInferer: + """ + Para inferir los tipos en un programa se aprovecha el AST devuelto al evaluar el parse de dicho programa. + Para este propósito, se toma el programa como una gran expresión, y entonces se realiza un recorrido en bottom-up + para inferir los tipos de las subexpresiones que sean necesarias. Empezando por las hojas que corresponden a las constantes + y tipos previamente definidos, que por supuesto ya tienen su tipo bien calculado, se procede a ir subiendo por el árbol + calculando el tipo de cada subexpresión en dependencia de su regla funcional y de los tipos previamente calculados + en el contexto del programa. Como ejemplo tomemos el de la expresion "if bool then e1 else e2": + + La regla de dicha expresion se puede representar como : + C|-bool: BOLEAN, C|-e1:T1, C|-e2:T2 + -------------------------------------- + C|- if bool then e1 else e2: T3 + donde T1 <= T2 <= T3. + + O sea que si en el contexto conocemos el tipo de e1 y el de e2 y además aseguramos que bool es una expresión de tipo + BOLEAN entonces el tipo de la expresión completa sera el Ancestro Común Mas Cercano a los tipos T1 y T2, o en otras palabras, + el menor tipo T3 tal que T1 se conforme en T3 y T2 se conforme en T3. + """ + + def __init__(self, context: semantic.Context, errors=[]): + self.context: semantic.Context = context + self.current_type: Optional[semantic.Type] = None + self.INTEGER = self.context.get_type("Int") + self.OBJECT = self.context.get_type("Object") + self.STRING = self.context.get_type("String") + self.BOOL = self.context.get_type("Bool") + self.AUTO_TYPE = self.context.get_type("AUTO_TYPE") + self.SELF_TYPE = self.context.get_type("SELF_TYPE") + self.errors = errors + self.current_method: Optional[semantic.Method] = None + + @singledispatchmethod + def visit(self, node, scope, infered_type=None) -> Type: + # Devolver un tipo por defecto, en verdad + # no importa ya que este metodo nunca sera llamado. + return Type("") + + # --------------------------------------------------------------------------------------------------------------------------# + # -----------------------------------------------------EXPRESIONES----------------------------------------------------------# + # --------------------------------------------------------------------------------------------------------------------------# + + # --------------------------------------------------------------- + # Calcular todos los tipos en el contexto del programa. | + # --------------------------------------------------------------- + @visit.register + def _(self, node: coolAst.ProgramNode, scope=None, infered_type=None, deep=1): + program_scope = semantic.Scope() if scope is None else scope + if deep == 1: + for class_ in node.class_list: + self.visit(class_, program_scope.create_child()) + else: + for class_, child_scope in zip(node.class_list, program_scope.children): + self.visit(class_, child_scope, deep=deep) + return program_scope + + # ----------------------------------------------------------------- + # Calcular los tipos en esta clase, visitar primero los atributos | + # y luego los métodos para garantizar que al revisar los métodos | + # ya todos los atributos estén definidos en el scope. | + # ----------------------------------------------------------------- + @visit.register + def _( + self, node: coolAst.ClassDef, scope: semantic.Scope, infered_type=None, deep=1 + ): + self.current_type = self.context.get_type(node.idx) + # Definir los atributos heredados + if deep == 1: + for attribute in ( + get_type_attribute_chain(self.current_type) + ): + scope.define_variable(attribute.name, attribute.type, "ATTRIBUTE") + + attrib = [x for x in node.features if isinstance(x, AttributeDef)] + meth = [x for x in node.features if isinstance(x, MethodDef)] + features = attrib + meth + + if deep == 1: + for f in features: + self.visit(f, scope.create_child(), deep) + else: + for f, s in zip(features, scope.children): + self.visit(f, s, deep) + + # for feature in node.features: + # if isinstance(feature, coolAst.AttributeDef): + # self.visit(feature, scope, deep=deep) + # if deep == 1: + # for feature in node.features: + # if isinstance(feature, coolAst.MethodDef): + # self.visit(feature, scope.create_child(), deep=deep) + # else: + # methods = (f for f in node.features if isinstance(f, coolAst.MethodDef)) + # for feature, child_scope in zip(methods, scope.children): + # self.visit(feature, child_scope, deep=deep) + + # --------------------------------------------------------- + # Definir un atributo en el scope. | + # --------------------------------------------------------- + @visit.register + def _( + self, + node: coolAst.AttributeDef, + scope: semantic.Scope, + infered_type=None, + deep=1, + ): + atrib = self.current_type.get_attribute(node.idx) + + # Checkear que el valor de retorno de la expresion + # de inicializacion del atributo (si existe) se + # conforme con el tipo del atributo + if node.default_value is not None: + return_type = self.visit(node.default_value, scope, infered_type, deep) + + if atrib.type == self.AUTO_TYPE: + # Inferir el tipo del atributo segun su expresion de inicializacion + atrib.type = return_type + elif not return_type.conforms_to(atrib.type): + raise SemanticError( + TypeError( + f"Attribute {node.idx} of type {atrib.type.name} can not be initialized with an expression of type {return_type.name}", + node.default_value.line, + node.default_value.column, + ) + ) + + # --------------------------------------------------------------------- + # Si el método no tiene un tipo definido, entonces tratar de inferir | + # su tipo en dependencia del tipo de su expresién de retorno. | + # Notar que al revisar el body del método se pueden inferir también | + # los argumentos que no hayan sido definidos con tipos específicos. | + # --------------------------------------------------------------------- + @visit.register + def _(self, node: coolAst.MethodDef, scope, infered_type=None, deep=1): + assert self.current_type is not None + method = self.current_type.get_method(node.idx) + self.current_method = method + params = [] + for param in node.param_list: + if param in params: + raise SemanticError( + f"({param.line}, {param.column}) - SemanticError: Param {param.id} multiply defined." + ) + self.visit(param, scope, deep=deep) + params.append(param) + + last = self.visit(node.statements, scope, deep=deep) + if last.name == "SELF_TYPE": + last = self.current_type + if not method.return_type != self.AUTO_TYPE: + method.return_type = last + else: + if not last.conforms_to(method.return_type): + raise SemanticError( + TypeError( + f"Inferred return type {last.name} of method {node.idx} does not conform to declared return type {method.return_type.name}", + node.statements.line, + node.statements.column, + ) + ) + + @visit.register + def _( + self, node: coolAst.BlockNode, scope: semantic.Scope, infered_type=None, deep=1 + ): + # Visitar cada expr del bloque, el tipo del bloque es el tipo de la ultima expresion + last = None + for expr in node.expressions: + last = self.visit(expr, scope, infered_type, deep) + return last + + @visit.register + def _(self, node: coolAst.Param, scope: semantic.Scope, infered_type=None, deep=1): + type_ = self.context.get_type(node.type) + if deep == 1: + scope.define_variable(node.id, type_, "PARAM") + + # ------------------------------------------------------------------------- + # Checkear si la variable a la que se le va a asignar el resultado de la | + # expresión tiene un tipo bien definido: en caso de tenerlo, verificar que| + # el tipo de la expresión coincide con el tipo de la variable, de lo con- | + # trario asignarle a la variable el tipo de retorno de la expresión. | + # ------------------------------------------------------------------------- + @visit.register + def _( + self, node: coolAst.AssignNode, scope: semantic.Scope, infered_type=None, deep=1 + ): + var_info = scope.find_variable(node.idx) + assert self.current_type is not None + if var_info: + e = self.visit(node.expr, scope, infered_type) + if var_info.type == self.AUTO_TYPE: + var_info.type = e + if not scope.is_local(var_info.name): + update_attr_type(self.current_type, var_info.name, var_info.type) + else: + update_method_param( + self.current_type, + self.current_method.name, + var_info.name, + var_info.type, + ) + update_scope_variable(var_info.name, e, scope) + return e + else: + if not e.conforms_to(var_info.type): + raise SemanticError( + f"Expresion of type {e.name} cannot be assigned to variable {var_info.name} of type {var_info.type.name}" + ) + return e + else: + raise SemanticError(f"Undefined variable name: {node.idx}") + + @visit.register + def _( + self, + node: coolAst.VariableCall, + scope: semantic.Scope, + infered_type=None, + deep=1, + ): + var_info = scope.find_variable(node.idx) + assert self.current_type is not None + if var_info: + if infered_type and var_info.type == self.AUTO_TYPE: + var_info.type = infered_type + if scope.is_local(var_info.name): + update_method_param( + self.current_type, + self.current_method.name, + var_info.name, + var_info.type, + ) + update_scope_variable(var_info.name, infered_type, scope) + return var_info.type + else: + raise SemanticError( + f"{node.line, node.column} - NameError: Undeclared identifier {node.idx}." + ) + + @visit.register + def _(self, node: SelfNode, scope: Scope, infered_type=None, deep=1): + return self.current_type + + @visit.register + def _( + self, + node: coolAst.IfThenElseNode, + scope: semantic.Scope, + infered_type=None, + deep=1, + ): + cond = self.visit(node.cond, scope, infered_type, deep) + e1 = self.visit(node.expr1, scope, infered_type, deep) + e2 = self.visit(node.expr2, scope, infered_type, deep) + if cond != self.BOOL: + raise SemanticError( + f"{node.cond.line, node.cond.column} - TypeError: Predicate of 'if' does not have type Bool." + ) + return find_common_parent(e1, e2) + + @visit.register + def _(self, node: CaseNode, scope: Scope, infered_type=None, deep=1): + if deep == 1: + types: List[Type] = [ + self.visit(action, scope.create_child(), infered_type, deep) + for action in node.actions + ] + else: + types = [ + self.visit(action, s, infered_type, deep) + for action, s in zip(node.actions, scope.children) + ] + + actions_types = [action.typex for action in node.actions] + + for i, action in enumerate(node.actions): + try: + self.context.get_type(action.typex) + except SemanticError: + raise SemanticError( + f"{action.line, action.column} - TypeError: Class {action.typex} of case branch is undefined." + ) + if action.typex in actions_types[:i]: + raise SemanticError( + f"{action.line, action.column} - SemanticError: Duplicate branch {action.typex} in case statement." + ) + + if len(types) == 1: + return types[0] + elif len(types) == 2: + return find_common_parent(types[0], types[1]) + else: + common = find_common_parent(*types[:2]) + for type_ in types[2:]: + common = find_common_parent(type_, common) + return common + + @visit.register + def _(self, node: ActionNode, scope: Scope, infered_type=None, deep=1): + if deep == 1: + try: + scope.define_variable( + node.idx, self.context.get_type(node.typex), "LOCAL" + ) + except SemanticError: + raise SemanticError( + f"{node.line, node.column} - TypeError: Undefined type {node.typex}" + ) + return self.visit(node.actions, scope, infered_type, deep) + + @visit.register + def _( + self, + node: coolAst.VariableDeclaration, + scope: semantic.Scope, + infered_type=None, + deep=1, + ): + # if deep == 1: + # scope = scope.create_child() + # else: + # scope = scope.children[0] if scope.children else scope + for var_id, var_type, var_init_expr, l, c in node.var_list: + try: + type_ = self.context.get_type(var_type) + except SemanticError: + raise SemanticError( + TypeError( + f"Class {var_type} of let-bound identifier b is undefined.", + l, + c, + ) + ) + # Revisar que la expresion de inicializacion (de existir) se conforme con el tipo + # de la variable. + # Se pueden dar varios casos: + # - La variable se inicializa en AUTO_TYPE y existe la expresion de inicializacion, + # en este caso la variable adquiere el tipo de la expresion + # - La variable se inicializa en un tipo T_1 y existe la expresion de inicializacion con tipo estatico T_2, + # en este caso T_2 < T_1. + # - La variable se inicializa en un tipo T y no existe expr de inicializacion (solo se define la variable). + # - La variable se inicializa en AUTO_TYPE y no existe la expr, en este caso se define la variable + # y su tipo se deja a inferir por el contexto. + if var_init_expr: + init_expr_type: Optional[Type] = self.visit( + var_init_expr, scope, infered_type, deep + ) + if type_ != self.AUTO_TYPE: + if not init_expr_type.conforms_to(type_): + raise SemanticError( + TypeError( + f"Declared type {init_expr_type.name} does not conform to type {type_.name} in var {var_id}.", + node.line, + node.column, + ) + ) + else: + if deep == 1: + scope.define_variable(var_id, type_, "LOCAL") + else: + if deep == 1: + scope.define_variable(var_id, init_expr_type, "LOCAL") + else: + # No hay expresion de inicializacion, entonces solo queda definir la variable, y si es necesario, + # se actualizara su tipo al chequear el contexto. + if not (scope.is_defined(var_id) and scope.is_local(var_id)): + scope.define_variable(var_id, type_, "LOCAL") + + # Visitar la expresion asociada. + return_type = self.visit(node.block_statements, scope, infered_type, deep) + return return_type + + @visit.register + def _(self, node: ParentFuncCall, scope: Scope, infered_type=None, deep=1): + assert self.current_type is not None + + # Encontrar el tipo que hace el dispatch + try: + dispatch_type = self.context.get_type(node.parent_type) + except SemanticError: + raise SemanticError( + f"{node.line, node.column} - TypeError: Type {node.parent_type} is undefined." + ) + + # Evaluar la expresion sobre la que se hace el dispatch + static_expr0_type = self.visit(node.obj, scope, infered_type, deep) + + if static_expr0_type.name == "SELF_TYPE": + static_expr0_type = self.current_type + + if not static_expr0_type.conforms_to(dispatch_type): + raise SemanticError( + f"{node.line, node.column} - TypeError: Expression type {static_expr0_type.name} does not conform to declared static dispatch type {dispatch_type.name}." + ) + + # Encontrar el metodo en el tipo. + try: + method: semantic.Method = dispatch_type.get_method(node.idx) + except SemanticError: + raise SemanticError( + f"{node.line, node.column} - AttributeError: Dispatch to undefined method {node.idx}." + ) + + if len(method.param_names) != len(node.arg_list): + raise SemanticError( + f"{node.line, node.column} - SemanticError: Method {node.idx} called with wrong number of arguments." + ) + + # Iterar por cada parametro del metodo y chequear que cada expresion corresponda en tipo. + for expr_i, type_i, param_name in zip( + node.arg_list, method.param_types, method.param_names + ): + type_expr_i = self.visit(expr_i, scope, infered_type, deep) + if not type_expr_i.conforms_to(type_i): + raise semantic.SemanticError( + f"{expr_i.line, expr_i.column} - TypeError: Expression corresponding to param {param_name} in call to {node.idx} must conform to {type_i.name}" + ) + + # Procesar el tipo de retorno de la funcion + if method.return_type == self.SELF_TYPE: + return static_expr0_type + if method.return_type != self.AUTO_TYPE: + return method.return_type + elif infered_type: + method.return_type = infered_type + return infered_type + else: + return self.AUTO_TYPE + + @visit.register + def _( + self, node: coolAst.FunCall, scope: semantic.Scope, infered_type=None, deep=1 + ): + assert self.current_type is not None + # Detectar el tipo estatico de la expr0. + static_expr0_type: semantic.Type = self.visit( + node.obj, scope, infered_type, deep + ) + + if static_expr0_type.name == "SELF_TYPE": + static_expr0_type = self.current_type + + # Encontrar el metodo en el tipo. + try: + method: semantic.Method = static_expr0_type.get_method(node.id) + except SemanticError: + raise SemanticError( + f"{node.line, node.column} - AttributeError: Dispatch to undefined method {node.id}." + ) + + if len(method.param_names) != len(node.args): + raise SemanticError( + f"{node.line, node.column} - SemanticError: Method {node.id} called with wrong number of arguments." + ) + + # Iterar por cada parametro del metodo y chequear que cada expresion corresponda en tipo. + for expr_i, type_i, param_name in zip( + node.args, method.param_types, method.param_names + ): + type_expr_i = self.visit(expr_i, scope, infered_type, deep) + if type_i == self.AUTO_TYPE: + update_scope_variable(param_name, type_expr_i, scope) + elif not type_expr_i.conforms_to(type_i): + raise semantic.SemanticError( + f"{expr_i.line, expr_i.column} - TypeError: Expression corresponding to param {param_name} in call to {node.id} must conform to {type_i.name}" + ) + + # Procesar el tipo de retorno de la funcion + if method.return_type == self.SELF_TYPE: + return static_expr0_type + if method.return_type != self.AUTO_TYPE: + return method.return_type + elif infered_type: + method.return_type = infered_type + return infered_type + else: + return self.AUTO_TYPE + + @visit.register + def _( + self, + node: coolAst.InstantiateClassNode, + scope: semantic.Scope, + infered_type=None, + deep=1, + ): + try: + ret_type = self.context.get_type(node.type_) + except SemanticError: + raise SemanticError( + f"{node.line, node.column + 4} - TypeError: 'new' used with undefined class {node.type_}." + ) + if ret_type in ( + self.AUTO_TYPE, + void, + ): + self.errors.append(f"Cannot instantiate {ret_type.name}") + return ret_type + + @visit.register + def _( + self, + node: coolAst.WhileBlockNode, + scope: semantic.Scope, + infered_type=None, + deep=1, + ): + cond_type = self.visit(node.cond, scope, infered_type, deep) + if cond_type != self.BOOL: + raise SemanticError( + f"{node.cond.line, node.cond.column} - TypeError: Loop condition does not have type Bool." + ) + ret_type = self.visit(node.statements, scope, infered_type, deep) + return self.OBJECT + + # ---------------------------------------------------------------------------------------------------------------------------# + # ---------------------------------------OPERACIONES ARITMÉTICAS-------------------------------------------------------------# + # ---------------------------------------------------------------------------------------------------------------------------# + + # ------------------------------------------------------------------------------------------------- + # Todas las operaciones aritméticas estan definidas solamente para los enteros, luego, de checkeo| + # de cada operación se realiza evaluando sus operandos y viendo si sus tipos son consistentes con| + # INTEGER. | + # ------------------------------------------------------------------------------------------------- + + @visit.register + def _( + self, node: coolAst.PlusNode, scope: semantic.Scope, infered_type=None, deep=1 + ): + left = self.visit(node.left, scope, self.INTEGER, deep) + right = self.visit(node.right, scope, self.INTEGER, deep) + if left.conforms_to(self.INTEGER) and right.conforms_to(self.INTEGER): + return self.INTEGER + else: + raise SemanticError( + TypeError( + f"Invalid operation: {left.name} + {right.name}", + node.line, + node.column, + ) + ) + + @visit.register + def _( + self, node: coolAst.DifNode, scope: semantic.Scope, infered_type=None, deep=1 + ): + left = self.visit(node.left, scope, self.INTEGER, deep) + right = self.visit(node.right, scope, self.INTEGER, deep) + if left.conforms_to(self.INTEGER) and right.conforms_to(self.INTEGER): + return self.INTEGER + else: + raise SemanticError( + TypeError( + f"Invalid operation: {left.name} - {right.name}", + node.line, + node.column, + ) + ) + + @visit.register + def _( + self, node: coolAst.DivNode, scope: semantic.Scope, infered_type=None, deep=1 + ): + left = self.visit(node.left, scope, self.INTEGER, deep) + right = self.visit(node.right, scope, self.INTEGER, deep) + if left.conforms_to(self.INTEGER) and right.conforms_to(self.INTEGER): + return self.INTEGER + else: + raise SemanticError( + TypeError( + f"Invalid operation: {left.name} / {right.name}", + node.line, + node.column, + ) + ) + + @visit.register + def _( + self, node: coolAst.MulNode, scope: semantic.Scope, infered_type=None, deep=1 + ): + left = self.visit(node.left, scope, self.INTEGER, deep) + right = self.visit(node.right, scope, self.INTEGER, deep) + if left.conforms_to(self.INTEGER) and right.conforms_to(self.INTEGER): + return self.INTEGER + else: + raise SemanticError( + TypeError( + f"Invalid operation: {left.name} * {right.name}", + node.line, + node.column, + ) + ) + + # -------------------------------------------------------------------------------------------# + # -----------------------------------OPERACIONES COMPARATIVAS -------------------------------# + # -------------------------------------------------------------------------------------------# + + # --------------------------------------------------------------------------------------------- + # Para poder comparar dos expresiones, estas deben ser del mismo tipo. El tipo de retorno de | + # toda operación comparativa es BOOLEAN. | + # --------------------------------------------------------------------------------------------- + @visit.register + def _( + self, + node: coolAst.GreaterThanNode, + scope: semantic.Scope, + infered_type=None, + deep=1, + ): + left = self.visit(node.left, scope, infered_type, deep) + right = self.visit(node.right, scope, infered_type, deep) + if left == right or left == self.AUTO_TYPE or right == self.AUTO_TYPE: + return self.BOOL + else: + raise SemanticError( + TypeError( + f"Invalid operation: {left.name} > {right.name}", + node.line, + node.column, + ) + ) + + @visit.register + def _( + self, + node: coolAst.GreaterEqualNode, + scope: semantic.Scope, + infered_type=None, + deep=1, + ): + left = self.visit(node.left, scope, infered_type, deep) + right = self.visit(node.right, scope, infered_type, deep) + if left == right or left == self.AUTO_TYPE or right == self.AUTO_TYPE: + return self.BOOL + else: + raise SemanticError( + TypeError( + f"Invalid operation: {left.name} >= {right.name}", + node.line, + node.column, + ) + ) + + @visit.register + def _( + self, + node: coolAst.LowerThanNode, + scope: semantic.Scope, + infered_type=None, + deep=1, + ): + left = self.visit(node.left, scope, infered_type, deep) + right = self.visit(node.right, scope, infered_type, deep) + if left == right or left == self.AUTO_TYPE or right == self.AUTO_TYPE: + return self.BOOL + else: + raise SemanticError( + TypeError( + f"Invalid operation: {left.name} < {right.name}", + node.line, + node.column, + ) + ) + + @visit.register + def _( + self, node: coolAst.LowerEqual, scope: semantic.Scope, infered_type=None, deep=1 + ): + left = self.visit(node.left, scope, infered_type, deep) + right = self.visit(node.right, scope, infered_type, deep) + if left == right or left == self.AUTO_TYPE or right == self.AUTO_TYPE: + return self.BOOL + else: + raise SemanticError( + TypeError( + f"Invalid operation: {left.name} <= {right.name}", + node.line, + node.column, + ) + ) + + @visit.register + def _( + self, + node: coolAst.EqualToNode, + scope: semantic.Scope, + infered_type=None, + deep=1, + ) -> Type: + left = self.visit(node.left, scope, infered_type, deep) + right = self.visit(node.right, scope, infered_type, deep) + if left in (self.BOOL, self.INTEGER, self.STRING) or left in ( + self.BOOL, + self.INTEGER, + self.STRING, + ): + if left == right or left == self.AUTO_TYPE or right == self.AUTO_TYPE: + return self.BOOL + else: + raise SemanticError( + TypeError( + f"Invalid operation: {left.name} = {right.name}", + node.line, + node.column, + ) + ) + else: + return self.BOOL + + @visit.register + def _( + self, node: coolAst.NotNode, scope: semantic.Scope, infered_type=None, deep=1 + ): + val_type = self.visit(node.lex, scope, infered_type, deep) + if val_type == self.AUTO_TYPE or val_type == self.INTEGER: + return self.INTEGER + else: + raise SemanticError( + TypeError( + f"Argument of ~ has type {val_type.name} instead of Int.", + node.line, + node.column, + ) + ) + + @visit.register + def _( + self, node: coolAst.NegNode, scope: semantic.Scope, infered_type=None, deep=1 + ) -> Type: + val_type = self.visit(node.lex, scope, infered_type, deep) + if val_type == self.AUTO_TYPE or val_type == self.BOOL: + return self.BOOL + else: + raise SemanticError( + f"{node.line, node.column} - TypeError: Argument of 'not' has type {val_type.name} instead of Bool." + ) + + # -----------------------------------------------------------------------------------------------------------------------# + # --------------------------------------------------CONSTANTES-----------------------------------------------------------# + # -----------------------------------------------------------------------------------------------------------------------# + + @visit.register + def _(self, node: coolAst.IntegerConstant, scope, infered_t=None, deep=1): + return self.INTEGER + + @visit.register + def _(self, node: coolAst.StringConstant, scope, infered_t=None, deep=1): + return self.STRING + + @visit.register + def _(self, node: coolAst.TrueConstant, scope, infered_type=None, deep=1): + return self.BOOL + + @visit.register + def _(self, node: coolAst.FalseConstant, scope, infered_type=None, deep=1): + return self.BOOL + + @visit.register + def _(self, node: coolAst.IsVoidNode, scope, infered_type=None, deep=1): + return self.BOOL + + @visit.register + def _(self, node: SelfNode, scope, infered_type=None, deep=1): + return self.current_type diff --git a/src/travels/typebuilder.py b/src/travels/typebuilder.py new file mode 100755 index 00000000..eae8627c --- /dev/null +++ b/src/travels/typebuilder.py @@ -0,0 +1,141 @@ +from typing import List, Any, Optional +import abstract.tree as coolAst +from abstract.semantics import Method, ObjectType, SemanticError, Type, Context +from functools import singledispatchmethod + +INHERITABLES = ("Int", "Bool", "String", "AUTO_TYPE") + + +class TypeBuilder: + def __init__(self, context: Context, errors=[]): + self.context: Context = context + self.errors: List[Any] = errors + self.current_type: Optional[Type] = None + + @singledispatchmethod + def visit(self, node): + pass + + @visit.register + def _(self, node: coolAst.ProgramNode): # noqa: F811 + for class_ in node.class_list: + self.visit(class_) + + @visit.register + def _(self, node: coolAst.ClassDef): + self.current_type = self.context.get_type(node.idx) + try: + parent = self.context.get_type(node.parent) + except SemanticError: + raise SemanticError(f"{node.line, node.column + len(node.idx) + 10} - TypeError: Cannot inherit from undefined {node.parent}") + + # No se puede heredar de Int ni de BOOL ni de AutoType ni de String + if parent.name in INHERITABLES: + raise SemanticError(f"{node.line, node.column + len(node.idx) + 10} - SemanticError: Cannot inherit from builtin {parent.name}") + + # Detectar dependencias circulares + if parent.conforms_to(self.current_type): + raise SemanticError( + f"{node.line, node.column + len(node.idx) + 10} - SemanticError: Circular dependency. Class {node.idx} can not inherit from {parent.name}" + ) + else: + self.current_type.set_parent(parent) + + # Definir los atributos y metodos del padre + for attrib in parent.attributes: + self.current_type.attributes.append(attrib) + + # self.current_type.methods.update(parent.methods) + + for feature in node.features: + self.visit(feature) + + @visit.register + def _(self, node: coolAst.AttributeDef): + # Detectar si el atributo que vamos a crear + # redefine algun atributo heredado definido + # anteriormente + try: + # Extraer el tipo del atributo del contexto + attr_type = ( + self.context.get_type(node.typex) + if isinstance(node.typex, str) + else node.typex + ) + except SemanticError: + raise SemanticError(f"{node.line, node.column + len(node.idx) + 2} - TypeError: Class {node.typex} of attribute {node.idx} is undefined.") + + # Definir el atributo en el tipo actual + self.current_type.define_attribute( + node.idx, attr_type, node.line, node.column + ) + + @visit.register + def _(self, node: coolAst.MethodDef): + params = [param.id for param in node.param_list] + try: + params_type = [ + self.context.get_type(param.type) + if isinstance(param.type, str) + else param.type + for param in node.param_list + ] + try: + return_type = ( + self.context.get_type(node.return_type) + if isinstance(node.return_type, str) + else node.return_type + ) + try: + # Manejar la redefinicion de metodos + try: + m = self.current_type.parent.get_method(node.idx) + redefined = True + except SemanticError: + redefined = False + + if redefined: + # verificar la cantidad de parametros + if len(node.param_list) != len(m.param_types): + raise SemanticError( + f"({node.line}, {node.column}) - SemanticError: Incompatible number of formal parameters in redefined method {node.idx}." + ) + # Verificar el tipo de los parametros + for param, parent_param in zip( + node.param_list, + m.param_types, + ): + if param.type != parent_param.name: + raise SemanticError( + f"({param.line}, {param.column}) - SemanticError: In redefined method {node.idx}, parameter type {param.type} is different from original type {parent_param.name}." + ) + # Verificar el tipo de retorno + if return_type.name != m.return_type.name: + raise SemanticError( + f"({node.line}, {node.ret_col}) - SemanticError: In redefined method {node.idx}, return type {return_type.name} is different from original return type {m.return_type.name}" + ) + self.current_type.define_method( + node.idx, + params, + params_type, + return_type, + node.line, + node.column, + ) + except SemanticError as e: + self.errors.append(e.text) + + except SemanticError as e: + self.errors.append( + f"({node.line}, {node.ret_col}) - TypeError: Undefined return type {node.return_type} in method {node.idx}." + ) + + except SemanticError as e: + for param in node.param_list: + if isinstance(param.type, str): + try: + self.context.get_type(param.type) + except: + self.errors.append( + f"({param.line}, {param.column + len(param.id) + 2}) - TypeError: Class {param.type} of formal parameter {param.id} is undefined" + ) diff --git a/src/travels/typecheck.py b/src/travels/typecheck.py new file mode 100755 index 00000000..b09eb0ba --- /dev/null +++ b/src/travels/typecheck.py @@ -0,0 +1,53 @@ +import abstract.semantics as semantics +import abstract.tree as coolAst +from functools import singledispatchmethod + +# Types aliases +Context = semantics.Context +Scope = semantics.Scope + +# AST aliases +ProgramNode = coolAst.ProgramNode +ClassDef = coolAst.ClassDef +AttributeDef = coolAst.AttributeDef +MethodDef = coolAst.MethodDef + + +class TypeChecker: + def __init__(self, context: Context, errors=[]): + self.current_type = None + self.context = context + self.AUTO_TYPE = self.context.get_type('AUTO_TYPE') + self.errors = errors + + @singledispatchmethod + def visit(self, node, scope): + pass + + @visit.register + def _(self, node: ProgramNode, scope=None): # noqa: F811 + scope = Scope() + for class_ in node.class_list: + self.visit(class_, scope.create_child()) + + @visit.register + def _(self, node: ClassDef, scope: Scope): # noqa: F811 + self.current_type = self.context.get_type(node.idx) + for feature in node.features: + if isinstance(feature, AttributeDef): + self.visit(feature, scope) + + for feature in node.features: + if isinstance(feature, MethodDef): + self.visit(feature, scope.create_child()) + + @visit.register + def _(self, node: AttributeDef, scope: Scope): # noqa: F811 + att = self.current_type.get_attribute(node.idx) + if att.type == self.AUTO_TYPE: + self.errors.append(f'Cannot infer type of attribute {att.name}') + scope.define_variable(att.name, att.type) + + @visit.register + def _(self, node: MethodDef, scope: Scope): # noqa: F811 + method = self.current_type.get_method(node.idx) diff --git a/src/travels/typecollector.py b/src/travels/typecollector.py new file mode 100755 index 00000000..7e766838 --- /dev/null +++ b/src/travels/typecollector.py @@ -0,0 +1,178 @@ +from typing import List +import abstract.tree as coolAst +from abstract.semantics import ( + IoType, + Method, + SelfType, + SemanticError, + Type, + VoidType, + IntegerType, + StringType, + ObjectType, + Context, + BoolType, + AutoType, +) +from functools import singledispatchmethod + +BUILTINS = ("Int", "Bool", "Object", "String", "IO", "AUTO_TYPE") + + +def bootstrap_string(obj: StringType, intType: IntegerType): + def length() -> Method: + method_name = "length" + param_names = [] + params_types = [] + return_type = intType + + return Method(method_name, param_names, params_types, return_type) + + def concat() -> Method: + method_name = "concat" + param_names = ["s"] + params_types: List[Type] = [StringType()] + return_type = obj + + return Method(method_name, param_names, params_types, return_type) + + def substr() -> Method: + method_name = "substr" + param_names = ["i", "l"] + params_types: List[Type] = [IntegerType(), IntegerType()] + return_type = obj + + return Method(method_name, param_names, params_types, return_type) + + obj.methods["length"] = length() + obj.methods["concat"] = concat() + obj.methods["substr"] = substr() + + +def bootstrap_io(io: IoType, strType: StringType, selfType: SelfType, intType: IntegerType): + def out_string() -> Method: + method_name = "out_string" + param_names = ["x"] + param_types: List[Type] = [StringType()] + return_type = selfType + + return Method(method_name, param_names, param_types, return_type) + + def out_int() -> Method: + method_name = "out_int" + param_names = ["x"] + params_types: List[Type] = [IntegerType()] + return_type = selfType + + return Method(method_name, param_names, params_types, return_type) + + def in_string() -> Method: + method_name = "in_string" + param_names = [] + params_types = [] + return_type = strType + + return Method(method_name, param_names, params_types, return_type) + + def in_int() -> Method: + method_name = "in_int" + param_names = [] + params_types = [] + return_type = intType + + return Method(method_name, param_names, params_types, return_type) + + # Crear el metodo out_string + io.methods["out_string"] = out_string() + io.methods["out_int"] = out_int() + io.methods["in_string"] = in_string() + io.methods["in_int"] = in_int() + + +def bootstrap_object(obj: ObjectType, strType: StringType): + def abort() -> Method: + method_name = "abort" + param_names = [] + params_types = [] + return_type = obj + + return Method(method_name, param_names, params_types, return_type) + + def type_name() -> Method: + method_name = "type_name" + param_names = [] + params_types = [] + return_type = strType + + return Method(method_name, param_names, params_types, return_type) + + def copy() -> Method: + method_name = "copy" + param_names = [] + params_types = [] + return_type = SelfType() + + return Method(method_name, param_names, params_types, return_type) + + obj.methods["abort"] = abort() + obj.methods["type_name"] = type_name() + obj.methods["copy"] = copy() + + +class TypeCollector: + def __init__(self, errors=[]): + self.context = None + self.errors = errors + + @singledispatchmethod + def visit(self, node): + pass + + @visit.register # type: ignore + def _(self, node: coolAst.ProgramNode): # noqa: F811 + self.context = Context() + OBJECT, INTEGER, STRING, BOOL, VOID, SELF_TYPE = ( + ObjectType(), + IntegerType(), + StringType(), + BoolType(), + VoidType(), + SelfType(), + ) + ioType = IoType() + + INTEGER.set_parent(OBJECT) + STRING.set_parent(OBJECT) + BOOL.set_parent(OBJECT) + ioType.set_parent(OBJECT) + + # Agregar los metodos builtin + bootstrap_string(STRING, INTEGER) + bootstrap_io(ioType, STRING, SELF_TYPE, INTEGER) + bootstrap_object(OBJECT, STRING) + + # Agregar al objeto IO los metodos de OBJECT + ioType.methods.update(OBJECT.methods) + + self.context.types["Object"] = OBJECT + self.context.types["Int"] = INTEGER + self.context.types["String"] = STRING + self.context.types["Bool"] = BOOL + self.context.types["Void"] = VOID + self.context.types["AUTO_TYPE"] = AutoType() + self.context.types["IO"] = ioType + self.context.types["SELF_TYPE"] = SELF_TYPE + + for class_ in node.class_list: + self.visit(class_) + + @visit.register + def _(self, node: coolAst.ClassDef): + try: + if node.idx in BUILTINS: + raise SemanticError( + f"{node.line, node.column} - SemanticError: Redefinition of basic class {node.idx}." + ) + self.context.create_type(node.idx) + except SemanticError as e: + raise SemanticError(f"{node.line, node.column - 2} - SemanticError: Classes may not be redefined") diff --git a/src/typecheck/__init__.py b/src/typecheck/__init__.py new file mode 100755 index 00000000..e69de29b diff --git a/src/typecheck/evaluator.py b/src/typecheck/evaluator.py new file mode 100755 index 00000000..a9c7cc9c --- /dev/null +++ b/src/typecheck/evaluator.py @@ -0,0 +1,22 @@ +def evaluate_right_parse(parse, tokens): + def evaluate_production(productions, production, tokens): + synteticed = [None] * (len(production.Right) + 1) + rules = production.attributes + + if not production.Right.IsEpsilon: + + for i, symbol in enumerate(production.Right[::-1], 1): + if symbol.IsTerminal: + synteticed[len(synteticed) - i] = next(tokens) + else: + synteticed[len(synteticed) - i] = evaluate_production( + productions, next(productions), tokens + ) + + rule = rules[0] + return rule(synteticed) if rule else None + + parse = iter(parse) + tokens = iter(tokens[::-1]) + + return evaluate_production(parse, next(parse), tokens) diff --git a/src/typecheck/visitor.py b/src/typecheck/visitor.py new file mode 100755 index 00000000..7d652011 --- /dev/null +++ b/src/typecheck/visitor.py @@ -0,0 +1,61 @@ +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 + 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: + issub = issubclass + t = self.targets + ks = t.keys() + ans = [t[k](*args, **kw) for k in ks if issub(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): + if hasattr(inspect, 'getfullargspec'): + return inspect.getfullargspec(fn) + else: + return inspect.getargspec(fn) diff --git a/testing.mips b/testing.mips new file mode 100644 index 00000000..e69de29b diff --git a/tests/codegen/arith.mips b/tests/codegen/arith.mips new file mode 100644 index 00000000..ca9e1767 --- /dev/null +++ b/tests/codegen/arith.mips @@ -0,0 +1,22254 @@ + +# Code generated by PyCoolc. +# Eliane Puerta, Liset Alfaro, Adrian Gonzalez --- Mon Dec 14 11:08:38 2020 +# School of Math and Computer Science, University of Havana +# + +.data +dummy: .word 0 +IO: .asciiz "IO" +# Function END +Object: .asciiz "Object" +# Function END +String: .asciiz "String" +# Function END +Bool: .asciiz "Bool" +# Function END +Int: .asciiz "Int" +# Function END +A2I: .asciiz "A2I" +# Function END +A: .asciiz "A" +# Function END +B: .asciiz "B" +# Function END +D: .asciiz "D" +# Function END +E: .asciiz "E" +# Function END +C: .asciiz "C" +# Function END +Main: .asciiz "Main" +# Function END +# + + +# **** VTABLE for type IO **** +IO_vtable: .word dummy, dummy, dummy, dummy, dummy, dummy, dummy, function_in_string_at_IO, dummy, dummy, dummy, dummy, dummy, dummy, function_copy_at_Object, function_in_int_at_IO, dummy, function_type_name_at_Object, dummy, dummy, dummy, function_abort_at_Object, function_out_string_at_IO, dummy, dummy, dummy, dummy, dummy, dummy, function_out_int_at_IO, dummy, dummy +# Function END +# + + +# **** Type RECORD for type IO **** +IO_start: + IO_vtable_pointer: .word IO_vtable + # Function END +IO_end: +# + + +# **** VTABLE for type Object **** +Object_vtable: .word dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, function_copy_at_Object, dummy, dummy, function_type_name_at_Object, dummy, dummy, dummy, function_abort_at_Object, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy +# Function END +# + + +# **** Type RECORD for type Object **** +Object_start: + Object_vtable_pointer: .word Object_vtable + # Function END +Object_end: +# + + +# **** VTABLE for type String **** +String_vtable: .word dummy, dummy, dummy, dummy, dummy, dummy, function_concat_at_String, dummy, dummy, dummy, function_length_at_String, dummy, dummy, dummy, function_copy_at_Object, dummy, dummy, function_type_name_at_Object, dummy, dummy, dummy, function_abort_at_Object, dummy, dummy, dummy, dummy, dummy, function_substr_at_String, dummy, dummy, dummy, dummy +# Function END +# + + +# **** Type RECORD for type String **** +String_start: + String_vtable_pointer: .word String_vtable + # Function END +String_end: +# + + +# **** VTABLE for type Bool **** +Bool_vtable: .word dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, function_copy_at_Object, dummy, dummy, function_type_name_at_Object, dummy, dummy, dummy, function_abort_at_Object, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy +# Function END +# + + +# **** Type RECORD for type Bool **** +Bool_start: + Bool_vtable_pointer: .word Bool_vtable + # Function END +Bool_end: +# + + +# **** VTABLE for type Int **** +Int_vtable: .word dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, function_copy_at_Object, dummy, dummy, function_type_name_at_Object, dummy, dummy, dummy, function_abort_at_Object, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy +# Function END +# + + +# **** Type RECORD for type Int **** +Int_start: + Int_vtable_pointer: .word Int_vtable + # Function END +Int_end: +# + + +# **** VTABLE for type A2I **** +A2I_vtable: .word dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, function_i2a_aux_at_A2I, dummy, dummy, dummy, dummy, dummy, function_copy_at_Object, dummy, dummy, function_type_name_at_Object, dummy, dummy, dummy, function_abort_at_Object, dummy, function_c2i_at_A2I, function_a2i_aux_at_A2I, function_i2a_at_A2I, function_i2c_at_A2I, dummy, dummy, dummy, dummy, function_a2i_at_A2I +# Function END +# + + +# **** Type RECORD for type A2I **** +A2I_start: + A2I_vtable_pointer: .word A2I_vtable + # Function END +A2I_end: +# + + +# **** VTABLE for type A **** +A_vtable: .word dummy, function_method4_at_A, function_value_at_A, dummy, dummy, dummy, dummy, dummy, dummy, function_method2_at_A, dummy, function_method3_at_A, function_method1_at_A, dummy, function_copy_at_Object, dummy, dummy, function_type_name_at_Object, dummy, dummy, function_method5_at_A, function_abort_at_Object, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, function_set_var_at_A, dummy +# Function END +# + + +# **** Type RECORD for type A **** +A_start: + A_vtable_pointer: .word A_vtable + # Function END +A_end: +# + + +# **** VTABLE for type B **** +B_vtable: .word dummy, function_method4_at_A, function_value_at_A, dummy, dummy, dummy, dummy, dummy, dummy, function_method2_at_A, dummy, function_method3_at_A, function_method1_at_A, dummy, function_copy_at_Object, dummy, dummy, function_type_name_at_Object, dummy, dummy, function_method5_at_B, function_abort_at_Object, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, function_set_var_at_A, dummy +# Function END +# + + +# **** Type RECORD for type B **** +B_start: + B_vtable_pointer: .word B_vtable + # Function END +B_end: +# + + +# **** VTABLE for type D **** +D_vtable: .word function_method7_at_D, function_method4_at_A, function_value_at_A, dummy, dummy, dummy, dummy, dummy, dummy, function_method2_at_A, dummy, function_method3_at_A, function_method1_at_A, dummy, function_copy_at_Object, dummy, dummy, function_type_name_at_Object, dummy, dummy, function_method5_at_B, function_abort_at_Object, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, function_set_var_at_A, dummy +# Function END +# + + +# **** Type RECORD for type D **** +D_start: + D_vtable_pointer: .word D_vtable + # Function END +D_end: +# + + +# **** VTABLE for type E **** +E_vtable: .word function_method7_at_D, function_method4_at_A, function_value_at_A, dummy, dummy, function_method6_at_E, dummy, dummy, dummy, function_method2_at_A, dummy, function_method3_at_A, function_method1_at_A, dummy, function_copy_at_Object, dummy, dummy, function_type_name_at_Object, dummy, dummy, function_method5_at_B, function_abort_at_Object, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, function_set_var_at_A, dummy +# Function END +# + + +# **** Type RECORD for type E **** +E_start: + E_vtable_pointer: .word E_vtable + # Function END +E_end: +# + + +# **** VTABLE for type C **** +C_vtable: .word dummy, function_method4_at_A, function_value_at_A, dummy, dummy, function_method6_at_C, dummy, dummy, dummy, function_method2_at_A, dummy, function_method3_at_A, function_method1_at_A, dummy, function_copy_at_Object, dummy, dummy, function_type_name_at_Object, dummy, dummy, function_method5_at_C, function_abort_at_Object, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, function_set_var_at_A, dummy +# Function END +# + + +# **** Type RECORD for type C **** +C_start: + C_vtable_pointer: .word C_vtable + # Function END +C_end: +# + + +# **** VTABLE for type Main **** +Main_vtable: .word dummy, dummy, dummy, function_menu_at_Main, function_get_int_at_Main, dummy, dummy, function_in_string_at_IO, dummy, dummy, dummy, dummy, dummy, function_class_type_at_Main, function_copy_at_Object, function_in_int_at_IO, function_prompt_at_Main, function_type_name_at_Object, function_print_at_Main, function_is_even_at_Main, dummy, function_abort_at_Object, function_out_string_at_IO, dummy, dummy, dummy, dummy, dummy, function_main_at_Main, function_out_int_at_IO, dummy, dummy +# Function END +# + + +# **** Type RECORD for type Main **** +Main_start: + Main_vtable_pointer: .word Main_vtable + # Function END +Main_end: +# + + +data_0: .asciiz "" +# + + +data_1: .asciiz "Abort called from class " +# + + +data_2: .asciiz "\n" +# + + +IO__TDT: .word 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1 +Object__TDT: .word 1, 0, 1, 1, 1, 1, 1, 2, 3, 4, 3, 2 +String__TDT: .word -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1 +Bool__TDT: .word -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1 +Int__TDT: .word -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1 +A2I__TDT: .word -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1 +A__TDT: .word -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 2, -1 +B__TDT: .word -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 1, -1 +D__TDT: .word -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, -1, -1 +E__TDT: .word -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1 +C__TDT: .word -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1 +Main__TDT: .word -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0 +# + + +data_4: .asciiz "0" +# + + +data_5: .asciiz "1" +# + + +data_6: .asciiz "2" +# + + +data_7: .asciiz "3" +# + + +data_8: .asciiz "4" +# + + +data_9: .asciiz "5" +# + + +data_10: .asciiz "6" +# + + +data_11: .asciiz "7" +# + + +data_12: .asciiz "8" +# + + +data_13: .asciiz "9" +# + + +data_14: .asciiz "0" +# + + +data_15: .asciiz "1" +# + + +data_16: .asciiz "2" +# + + +data_17: .asciiz "3" +# + + +data_18: .asciiz "4" +# + + +data_19: .asciiz "5" +# + + +data_20: .asciiz "6" +# + + +data_21: .asciiz "7" +# + + +data_22: .asciiz "8" +# + + +data_23: .asciiz "9" +# + + +data_24: .asciiz "" +# + + +data_25: .asciiz "-" +# + + +data_26: .asciiz "+" +# + + +data_27: .asciiz "0" +# + + +data_28: .asciiz "-" +# + + +data_29: .asciiz "" +# + + +data_30: .asciiz "\n\tTo add a number to " +# + + +data_31: .asciiz "...enter a:\n" +# + + +data_32: .asciiz "\tTo negate " +# + + +data_33: .asciiz "...enter b:\n" +# + + +data_34: .asciiz "\tTo find the difference between " +# + + +data_35: .asciiz "and another number...enter c:\n" +# + + +data_36: .asciiz "\tTo find the factorial of " +# + + +data_37: .asciiz "...enter d:\n" +# + + +data_38: .asciiz "\tTo square " +# + + +data_39: .asciiz "...enter e:\n" +# + + +data_40: .asciiz "\tTo cube " +# + + +data_41: .asciiz "...enter f:\n" +# + + +data_42: .asciiz "\tTo find out if " +# + + +data_43: .asciiz "is a multiple of 3...enter g:\n" +# + + +data_44: .asciiz "\tTo divide " +# + + +data_45: .asciiz "by 8...enter h:\n" +# + + +data_46: .asciiz "\tTo get a new number...enter j:\n" +# + + +data_47: .asciiz "\tTo quit...enter q:\n\n" +# + + +data_48: .asciiz "\n" +# + + +data_49: .asciiz "Please enter a number... " +# + + +data_50: .asciiz "Class type is now A\n" +# + + +data_51: .asciiz "Class type is now B\n" +# + + +data_52: .asciiz "Class type is now C\n" +# + + +data_53: .asciiz "Class type is now D\n" +# + + +data_54: .asciiz "Class type is now E\n" +# + + +data_55: .asciiz "Oooops\n" +# + + +data_56: .asciiz " " +# + + +data_57: .asciiz "number " +# + + +data_58: .asciiz "is even!\n" +# + + +data_59: .asciiz "is odd!\n" +# + + +data_60: .asciiz "a" +# + + +data_61: .asciiz "b" +# + + +data_62: .asciiz "Oooops\n" +# + + +data_63: .asciiz "c" +# + + +data_64: .asciiz "d" +# + + +data_65: .asciiz "e" +# + + +data_66: .asciiz "f" +# + + +data_67: .asciiz "g" +# + + +data_68: .asciiz "number " +# + + +data_69: .asciiz "is divisible by 3.\n" +# + + +data_70: .asciiz "number " +# + + +data_71: .asciiz "is not divisible by 3.\n" +# + + +data_72: .asciiz "h" +# + + +data_73: .asciiz "number " +# + + +data_74: .asciiz "is equal to " +# + + +data_75: .asciiz "times 8 with a remainder of " +# + + +data_76: .asciiz "\n" +# + + +data_77: .asciiz "j" +# + + +data_78: .asciiz "q" +# + + +.text +main: + jal entry + # syscall code 10 is for exit + li $v0, 10 + syscall + # Function END + +# function_in_string_at_IO implementation. +# @Params: +function_in_string_at_IO: + # Allocate stack frame for function function_in_string_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_in_string_at_IO_internal_0 --> -4($fp) + # Allocating 1024 bytes of memory + li $a0, 1024 + li $v0, 9 + syscall + move $t0, $v0 + move $a0, $v0 + li $a1, 1024 + li $v0, 8 + syscall + move $t2, $zero + move $t3, $zero + move $t1, $t0 + lb $t3, 0($t1) + beqz $t3, end_loop + read_length_loop: + lb $t3, 0($t1) + beqz $t3, end_read_length_loop + addu $t1, $t1, 1 + addu $t2, $t2, 1 + j read_length_loop + end_read_length_loop: + subu $t1, $t1, 1 + sb $zero, 0($t1) + subu $t2, $t2, 1 + end_loop: + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $t2, 16($v0) + sw $v0, -4($fp) + # RETURN local_in_string_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_in_string_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_out_int_at_IO implementation. +# @Params: +# 0($fp) = param_out_int_at_IO_x_0 +function_out_int_at_IO: + # Allocate stack frame for function function_out_int_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # PRINT_INT param_out_int_at_IO_x_0 + # PARAM param_out_int_at_IO_x_0 --> 0($fp) + lw $v0, 0($fp) + lw $a0, 12($v0) + li $v0, 1 + syscall + # LOCAL local_out_int_at_IO_internal_0 --> -4($fp) + # local_out_int_at_IO_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_out_int_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_out_int_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_out_string_at_IO implementation. +# @Params: +# 0($fp) = param_out_string_at_IO_x_0 +function_out_string_at_IO: + # Allocate stack frame for function function_out_string_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # PARAM param_out_string_at_IO_x_0 --> 0($fp) + # PRINT_STR param_out_string_at_IO_x_0 + lw $v0, 0($fp) + lw $a0, 12($v0) + li $v0, 4 + syscall + # LOCAL local_out_string_at_IO_internal_0 --> -4($fp) + # local_out_string_at_IO_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_out_string_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_out_string_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_in_int_at_IO implementation. +# @Params: +function_in_int_at_IO: + # Allocate stack frame for function function_in_int_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_in_int_at_IO_internal_0 --> -4($fp) + # local_in_int_at_IO_internal_0 = READ_INT + li $v0, 5 + syscall + move $a2, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + sw $a2, 12($v0) + sw $v0, -4($fp) + # RETURN local_in_int_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_in_int_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_abort_at_Object implementation. +# @Params: +function_abort_at_Object: + # Allocate stack frame for function function_abort_at_Object. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_abort_at_Object_internal_0 --> -4($fp) + lw $t0, 0($s1) + sw $t0, -4($fp) + # LOCAL local_abort_at_Object_internal_0 --> -4($fp) + la $a0, data_1 + li $v0, 4 + syscall + lw $a0, -4($fp) + li $v0, 4 + syscall + la $a0, data_2 + li $v0, 4 + syscall + li $v0, 10 + syscall + # Function END + + +# function_copy_at_Object implementation. +# @Params: +function_copy_at_Object: + # Allocate stack frame for function function_copy_at_Object. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_copy_at_Object_internal_0 --> -4($fp) + # local_copy_at_Object_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_copy_at_Object_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function function_copy_at_Object. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_type_name_at_Object implementation. +# @Params: +function_type_name_at_Object: + # Allocate stack frame for function function_type_name_at_Object. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_type_name_at_Object_internal_0 --> -4($fp) + lw $t0, 0($s1) + sw $t0, -4($fp) + # RETURN local_type_name_at_Object_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_type_name_at_Object. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_concat_at_String implementation. +# @Params: +# 0($fp) = param_concat_at_String_s_0 +function_concat_at_String: + # Allocate stack frame for function function_concat_at_String. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_concat_at_String_internal_0 = self.CONCAT + # LOCAL local_concat_at_String_internal_0 --> -4($fp) + # PARAM param_concat_at_String_s_0 --> 0($fp) + # Get first string length from self + lw $t0, 16($s1) + # Get second string length from param + lw $v0, 0($fp) + lw $t1, 16($v0) + # Save new string length in a0 for memory allocation + addu $a0, $t0, $t1 + move $t3, $a0 + # Get first string from self + lw $t0, 12($s1) + # Get second string from param + lw $t1, 12($v0) + addu $a0, $a0, 4 + li $v0, 9 + syscall + move $t2, $v0 + move $t4, $zero + concat_loop1: + # Compare t0 with \0 + lb $t4, 0($t0) + beqz $t4, concat_loop1_end + # Copy 1 byte + sb $t4, 0($t2) + addu $t2, $t2, 1 + addu $t0, $t0, 1 + j concat_loop1 + concat_loop1_end: + # Copy second string + concat_loop2: + # Compare t1 with \0 + lb $t4, 0($t1) + beqz $t4, concat_loop2_end + # Copy 1 byte + sb $t4, 0($t2) + addu $t2, $t2, 1 + addu $t1, $t1, 1 + j concat_loop2 + concat_loop2_end: + sb $zero, 0($t2) + # v0 contains resulting string + move $t1, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + sw $t1, 12($v0) + sw $t3, 16($v0) + sw $v0, -4($fp) + # RETURN local_concat_at_String_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_concat_at_String. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_substr_at_String implementation. +# @Params: +# 0($fp) = param_substr_at_String_l_0 +# 4($fp) = param_substr_at_String_r_1 +function_substr_at_String: + # Allocate stack frame for function function_substr_at_String. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_substr_at_String_internal_0 --> -4($fp) + # PARAM param_substr_at_String_l_0 --> 4($fp) + # PARAM param_substr_at_String_r_1 --> 0($fp) + lw $t0, 12($s1) + lw $t2, 4($fp) + lw $t2, 12($t2) + addu $t0, $t0, $t2 + lw $a0, 0($fp) + lw $a0, 12($a0) + move $t3, $a0 + move $t1, $a0 + addu $a0, $a0, 1 + li $v0, 9 + syscall + move $t2, $v0 + substr_loop: + beqz $t1, substr_end + lb $a0, 0($t0) + sb $a0, 0($t2) + addu $t0, $t0, 1 + addu $t2, $t2, 1 + subu $t1, $t1, 1 + j substr_loop + substr_end: + sb $zero, 0($t2) + move $t1, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + sw $t1, 12($v0) + sw $t3, 16($v0) + sw $v0, -4($fp) + # RETURN local_substr_at_String_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_substr_at_String. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 8 + jr $ra + # Function END + + +# function_length_at_String implementation. +# @Params: +function_length_at_String: + # Allocate stack frame for function function_length_at_String. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_length_at_String_internal_0 = GETATTRIBUTE length String + # LOCAL local_length_at_String_internal_0 --> -4($fp) + lw $t0, 16($s1) + sw $t0, -4($fp) + # LOCAL local_length_at_String_internal_1 --> -8($fp) + # LOCAL local_length_at_String_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + lw $t0, -4($fp) + sw $t0, 12($v0) + sw $v0, -8($fp) + # RETURN local_length_at_String_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function function_length_at_String. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# entry implementation. +# @Params: +entry: + # Allocate stack frame for function entry. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local__internal_0 --> -4($fp) + # local__internal_0 = ALLOCATE Main + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Main + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 28 bytes of memory + li $a0, 28 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Main_start + sw $t0, 4($v0) + # Load type offset + li $t0, 44 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Main__attrib__char__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 12($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Main__attrib__avar__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 16($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Main__attrib__a_var__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 20($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Main__attrib__flag__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 24($t1) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -4($fp) + # LOCAL local__internal_0 --> -4($fp) + lw $s1, -4($fp) + # local__internal_1 = CALL main + # LOCAL local__internal_1 --> -8($fp) + # LOCAL local__internal_0 --> -4($fp) + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type's VTABLE + la $t0, Main_vtable + # Get pointer to function address + lw $t1, 112($t0) + # Call function. Result is on $v0 + jalr $t1 + sw $v0, -8($fp) + # RETURN 0 + li $v0, 0 + # Deallocate stack frame for function entry. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_c2i_at_A2I implementation. +# @Params: +# 0($fp) = param_c2i_at_A2I_char_0 +function_c2i_at_A2I: + # Allocate stack frame for function function_c2i_at_A2I. + subu $sp, $sp, 264 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 264 + # LOCAL local_c2i_at_A2I_internal_4 --> -20($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_4 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -20($fp) + # IF_ZERO param_c2i_at_A2I_char_0 GOTO label_FALSE_3 + # IF_ZERO param_c2i_at_A2I_char_0 GOTO label_FALSE_3 + lw $t0, 0($fp) + beq $t0, 0, label_FALSE_3 + # IF_ZERO local_c2i_at_A2I_internal_4 GOTO label_FALSE_3 + # IF_ZERO local_c2i_at_A2I_internal_4 GOTO label_FALSE_3 + lw $t0, -20($fp) + beq $t0, 0, label_FALSE_3 + # LOCAL local_c2i_at_A2I_internal_3 --> -16($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # Comparing 0($fp) type with String + la $v0, String + lw $a0, 0($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -16($fp) + # IF_ZERO local_c2i_at_A2I_internal_3 GOTO label_COMPARE_STRING_6 + # IF_ZERO local_c2i_at_A2I_internal_3 GOTO label_COMPARE_STRING_6 + lw $t0, -16($fp) + beq $t0, 0, label_COMPARE_STRING_6 + # LOCAL local_c2i_at_A2I_internal_3 --> -16($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # Comparing 0($fp) type with Bool + la $v0, Bool + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -16($fp) + # IF_ZERO local_c2i_at_A2I_internal_3 GOTO label_COMPARE_BY_VALUE_7 + # IF_ZERO local_c2i_at_A2I_internal_3 GOTO label_COMPARE_BY_VALUE_7 + lw $t0, -16($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_7 + # LOCAL local_c2i_at_A2I_internal_3 --> -16($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # Comparing 0($fp) type with Int + la $v0, Int + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -16($fp) + # IF_ZERO local_c2i_at_A2I_internal_3 GOTO label_COMPARE_BY_VALUE_7 + # IF_ZERO local_c2i_at_A2I_internal_3 GOTO label_COMPARE_BY_VALUE_7 + lw $t0, -16($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_7 + # LOCAL local_c2i_at_A2I_internal_3 --> -16($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_4 --> -20($fp) + # Load pointers and SUB + lw $a0, 0($fp) + lw $a1, -20($fp) + sub $a0, $a0, $a1 + sw $a0, -16($fp) + # IF_ZERO local_c2i_at_A2I_internal_3 GOTO label_TRUE_4 + # IF_ZERO local_c2i_at_A2I_internal_3 GOTO label_TRUE_4 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_4 + # GOTO label_FALSE_3 + j label_FALSE_3 + label_COMPARE_BY_VALUE_7: + # LOCAL local_c2i_at_A2I_internal_3 --> -16($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_4 --> -20($fp) + lw $a0, 0($fp) + lw $a1, -20($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -16($fp) + # IF_ZERO local_c2i_at_A2I_internal_3 GOTO label_TRUE_4 + # IF_ZERO local_c2i_at_A2I_internal_3 GOTO label_TRUE_4 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_4 + # GOTO label_FALSE_3 + j label_FALSE_3 + label_COMPARE_STRING_6: + # LOCAL local_c2i_at_A2I_internal_3 --> -16($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_4 --> -20($fp) + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -20($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -16($fp) + # IF_ZERO local_c2i_at_A2I_internal_3 GOTO label_CONTINUE_8 + # IF_ZERO local_c2i_at_A2I_internal_3 GOTO label_CONTINUE_8 + lw $t0, -16($fp) + beq $t0, 0, label_CONTINUE_8 + # GOTO label_FALSE_3 + j label_FALSE_3 + label_CONTINUE_8: + # LOCAL local_c2i_at_A2I_internal_3 --> -16($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_4 --> -20($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -20($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_9: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_10 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_9 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_10: + # Store result + sw $a2, -16($fp) + # IF_ZERO local_c2i_at_A2I_internal_3 GOTO label_TRUE_4 + # IF_ZERO local_c2i_at_A2I_internal_3 GOTO label_TRUE_4 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_4 + label_FALSE_3: + # LOCAL local_c2i_at_A2I_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -12($fp) + # GOTO label_END_5 +j label_END_5 +label_TRUE_4: + # LOCAL local_c2i_at_A2I_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -12($fp) + label_END_5: +# LOCAL local_c2i_at_A2I_internal_0 --> -4($fp) +# LOCAL local_c2i_at_A2I_internal_2 --> -12($fp) +# Obtain value from -12($fp) +lw $v0, -12($fp) +lw $v0, 12($v0) +sw $v0, -4($fp) +# IF_ZERO local_c2i_at_A2I_internal_0 GOTO label_FALSEIF_1 +# IF_ZERO local_c2i_at_A2I_internal_0 GOTO label_FALSEIF_1 +lw $t0, -4($fp) +beq $t0, 0, label_FALSEIF_1 +# LOCAL local_c2i_at_A2I_internal_5 --> -24($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 0 +sw $t0, 12($v0) +sw $v0, -24($fp) +# LOCAL local_c2i_at_A2I_internal_1 --> -8($fp) +# LOCAL local_c2i_at_A2I_internal_5 --> -24($fp) +# local_c2i_at_A2I_internal_1 = local_c2i_at_A2I_internal_5 +lw $t0, -24($fp) +sw $t0, -8($fp) +# GOTO label_ENDIF_2 +j label_ENDIF_2 +label_FALSEIF_1: + # LOCAL local_c2i_at_A2I_internal_10 --> -44($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_5 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -44($fp) + # IF_ZERO param_c2i_at_A2I_char_0 GOTO label_FALSE_13 + # IF_ZERO param_c2i_at_A2I_char_0 GOTO label_FALSE_13 + lw $t0, 0($fp) + beq $t0, 0, label_FALSE_13 + # IF_ZERO local_c2i_at_A2I_internal_10 GOTO label_FALSE_13 + # IF_ZERO local_c2i_at_A2I_internal_10 GOTO label_FALSE_13 + lw $t0, -44($fp) + beq $t0, 0, label_FALSE_13 + # LOCAL local_c2i_at_A2I_internal_9 --> -40($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # Comparing 0($fp) type with String + la $v0, String + lw $a0, 0($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -40($fp) + # IF_ZERO local_c2i_at_A2I_internal_9 GOTO label_COMPARE_STRING_16 + # IF_ZERO local_c2i_at_A2I_internal_9 GOTO label_COMPARE_STRING_16 + lw $t0, -40($fp) + beq $t0, 0, label_COMPARE_STRING_16 + # LOCAL local_c2i_at_A2I_internal_9 --> -40($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # Comparing 0($fp) type with Bool + la $v0, Bool + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -40($fp) + # IF_ZERO local_c2i_at_A2I_internal_9 GOTO label_COMPARE_BY_VALUE_17 + # IF_ZERO local_c2i_at_A2I_internal_9 GOTO label_COMPARE_BY_VALUE_17 + lw $t0, -40($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_17 + # LOCAL local_c2i_at_A2I_internal_9 --> -40($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # Comparing 0($fp) type with Int + la $v0, Int + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -40($fp) + # IF_ZERO local_c2i_at_A2I_internal_9 GOTO label_COMPARE_BY_VALUE_17 + # IF_ZERO local_c2i_at_A2I_internal_9 GOTO label_COMPARE_BY_VALUE_17 + lw $t0, -40($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_17 + # LOCAL local_c2i_at_A2I_internal_9 --> -40($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_10 --> -44($fp) + # Load pointers and SUB + lw $a0, 0($fp) + lw $a1, -44($fp) + sub $a0, $a0, $a1 + sw $a0, -40($fp) + # IF_ZERO local_c2i_at_A2I_internal_9 GOTO label_TRUE_14 + # IF_ZERO local_c2i_at_A2I_internal_9 GOTO label_TRUE_14 + lw $t0, -40($fp) + beq $t0, 0, label_TRUE_14 + # GOTO label_FALSE_13 + j label_FALSE_13 + label_COMPARE_BY_VALUE_17: + # LOCAL local_c2i_at_A2I_internal_9 --> -40($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_10 --> -44($fp) + lw $a0, 0($fp) + lw $a1, -44($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -40($fp) + # IF_ZERO local_c2i_at_A2I_internal_9 GOTO label_TRUE_14 + # IF_ZERO local_c2i_at_A2I_internal_9 GOTO label_TRUE_14 + lw $t0, -40($fp) + beq $t0, 0, label_TRUE_14 + # GOTO label_FALSE_13 + j label_FALSE_13 + label_COMPARE_STRING_16: + # LOCAL local_c2i_at_A2I_internal_9 --> -40($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_10 --> -44($fp) + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -44($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -40($fp) + # IF_ZERO local_c2i_at_A2I_internal_9 GOTO label_CONTINUE_18 + # IF_ZERO local_c2i_at_A2I_internal_9 GOTO label_CONTINUE_18 + lw $t0, -40($fp) + beq $t0, 0, label_CONTINUE_18 + # GOTO label_FALSE_13 + j label_FALSE_13 + label_CONTINUE_18: + # LOCAL local_c2i_at_A2I_internal_9 --> -40($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_10 --> -44($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -44($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_19: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_20 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_19 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_20: + # Store result + sw $a2, -40($fp) + # IF_ZERO local_c2i_at_A2I_internal_9 GOTO label_TRUE_14 + # IF_ZERO local_c2i_at_A2I_internal_9 GOTO label_TRUE_14 + lw $t0, -40($fp) + beq $t0, 0, label_TRUE_14 + label_FALSE_13: + # LOCAL local_c2i_at_A2I_internal_8 --> -36($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -36($fp) + # GOTO label_END_15 +j label_END_15 +label_TRUE_14: + # LOCAL local_c2i_at_A2I_internal_8 --> -36($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -36($fp) + label_END_15: +# LOCAL local_c2i_at_A2I_internal_6 --> -28($fp) +# LOCAL local_c2i_at_A2I_internal_8 --> -36($fp) +# Obtain value from -36($fp) +lw $v0, -36($fp) +lw $v0, 12($v0) +sw $v0, -28($fp) +# IF_ZERO local_c2i_at_A2I_internal_6 GOTO label_FALSEIF_11 +# IF_ZERO local_c2i_at_A2I_internal_6 GOTO label_FALSEIF_11 +lw $t0, -28($fp) +beq $t0, 0, label_FALSEIF_11 +# LOCAL local_c2i_at_A2I_internal_11 --> -48($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 1 +sw $t0, 12($v0) +sw $v0, -48($fp) +# LOCAL local_c2i_at_A2I_internal_7 --> -32($fp) +# LOCAL local_c2i_at_A2I_internal_11 --> -48($fp) +# local_c2i_at_A2I_internal_7 = local_c2i_at_A2I_internal_11 +lw $t0, -48($fp) +sw $t0, -32($fp) +# GOTO label_ENDIF_12 +j label_ENDIF_12 +label_FALSEIF_11: + # LOCAL local_c2i_at_A2I_internal_16 --> -68($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_6 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -68($fp) + # IF_ZERO param_c2i_at_A2I_char_0 GOTO label_FALSE_23 + # IF_ZERO param_c2i_at_A2I_char_0 GOTO label_FALSE_23 + lw $t0, 0($fp) + beq $t0, 0, label_FALSE_23 + # IF_ZERO local_c2i_at_A2I_internal_16 GOTO label_FALSE_23 + # IF_ZERO local_c2i_at_A2I_internal_16 GOTO label_FALSE_23 + lw $t0, -68($fp) + beq $t0, 0, label_FALSE_23 + # LOCAL local_c2i_at_A2I_internal_15 --> -64($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # Comparing 0($fp) type with String + la $v0, String + lw $a0, 0($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -64($fp) + # IF_ZERO local_c2i_at_A2I_internal_15 GOTO label_COMPARE_STRING_26 + # IF_ZERO local_c2i_at_A2I_internal_15 GOTO label_COMPARE_STRING_26 + lw $t0, -64($fp) + beq $t0, 0, label_COMPARE_STRING_26 + # LOCAL local_c2i_at_A2I_internal_15 --> -64($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # Comparing 0($fp) type with Bool + la $v0, Bool + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -64($fp) + # IF_ZERO local_c2i_at_A2I_internal_15 GOTO label_COMPARE_BY_VALUE_27 + # IF_ZERO local_c2i_at_A2I_internal_15 GOTO label_COMPARE_BY_VALUE_27 + lw $t0, -64($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_27 + # LOCAL local_c2i_at_A2I_internal_15 --> -64($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # Comparing 0($fp) type with Int + la $v0, Int + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -64($fp) + # IF_ZERO local_c2i_at_A2I_internal_15 GOTO label_COMPARE_BY_VALUE_27 + # IF_ZERO local_c2i_at_A2I_internal_15 GOTO label_COMPARE_BY_VALUE_27 + lw $t0, -64($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_27 + # LOCAL local_c2i_at_A2I_internal_15 --> -64($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_16 --> -68($fp) + # Load pointers and SUB + lw $a0, 0($fp) + lw $a1, -68($fp) + sub $a0, $a0, $a1 + sw $a0, -64($fp) + # IF_ZERO local_c2i_at_A2I_internal_15 GOTO label_TRUE_24 + # IF_ZERO local_c2i_at_A2I_internal_15 GOTO label_TRUE_24 + lw $t0, -64($fp) + beq $t0, 0, label_TRUE_24 + # GOTO label_FALSE_23 + j label_FALSE_23 + label_COMPARE_BY_VALUE_27: + # LOCAL local_c2i_at_A2I_internal_15 --> -64($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_16 --> -68($fp) + lw $a0, 0($fp) + lw $a1, -68($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -64($fp) + # IF_ZERO local_c2i_at_A2I_internal_15 GOTO label_TRUE_24 + # IF_ZERO local_c2i_at_A2I_internal_15 GOTO label_TRUE_24 + lw $t0, -64($fp) + beq $t0, 0, label_TRUE_24 + # GOTO label_FALSE_23 + j label_FALSE_23 + label_COMPARE_STRING_26: + # LOCAL local_c2i_at_A2I_internal_15 --> -64($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_16 --> -68($fp) + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -68($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -64($fp) + # IF_ZERO local_c2i_at_A2I_internal_15 GOTO label_CONTINUE_28 + # IF_ZERO local_c2i_at_A2I_internal_15 GOTO label_CONTINUE_28 + lw $t0, -64($fp) + beq $t0, 0, label_CONTINUE_28 + # GOTO label_FALSE_23 + j label_FALSE_23 + label_CONTINUE_28: + # LOCAL local_c2i_at_A2I_internal_15 --> -64($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_16 --> -68($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -68($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_29: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_30 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_29 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_30: + # Store result + sw $a2, -64($fp) + # IF_ZERO local_c2i_at_A2I_internal_15 GOTO label_TRUE_24 + # IF_ZERO local_c2i_at_A2I_internal_15 GOTO label_TRUE_24 + lw $t0, -64($fp) + beq $t0, 0, label_TRUE_24 + label_FALSE_23: + # LOCAL local_c2i_at_A2I_internal_14 --> -60($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -60($fp) + # GOTO label_END_25 +j label_END_25 +label_TRUE_24: + # LOCAL local_c2i_at_A2I_internal_14 --> -60($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -60($fp) + label_END_25: +# LOCAL local_c2i_at_A2I_internal_12 --> -52($fp) +# LOCAL local_c2i_at_A2I_internal_14 --> -60($fp) +# Obtain value from -60($fp) +lw $v0, -60($fp) +lw $v0, 12($v0) +sw $v0, -52($fp) +# IF_ZERO local_c2i_at_A2I_internal_12 GOTO label_FALSEIF_21 +# IF_ZERO local_c2i_at_A2I_internal_12 GOTO label_FALSEIF_21 +lw $t0, -52($fp) +beq $t0, 0, label_FALSEIF_21 +# LOCAL local_c2i_at_A2I_internal_17 --> -72($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 2 +sw $t0, 12($v0) +sw $v0, -72($fp) +# LOCAL local_c2i_at_A2I_internal_13 --> -56($fp) +# LOCAL local_c2i_at_A2I_internal_17 --> -72($fp) +# local_c2i_at_A2I_internal_13 = local_c2i_at_A2I_internal_17 +lw $t0, -72($fp) +sw $t0, -56($fp) +# GOTO label_ENDIF_22 +j label_ENDIF_22 +label_FALSEIF_21: + # LOCAL local_c2i_at_A2I_internal_22 --> -92($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_7 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -92($fp) + # IF_ZERO param_c2i_at_A2I_char_0 GOTO label_FALSE_33 + # IF_ZERO param_c2i_at_A2I_char_0 GOTO label_FALSE_33 + lw $t0, 0($fp) + beq $t0, 0, label_FALSE_33 + # IF_ZERO local_c2i_at_A2I_internal_22 GOTO label_FALSE_33 + # IF_ZERO local_c2i_at_A2I_internal_22 GOTO label_FALSE_33 + lw $t0, -92($fp) + beq $t0, 0, label_FALSE_33 + # LOCAL local_c2i_at_A2I_internal_21 --> -88($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # Comparing 0($fp) type with String + la $v0, String + lw $a0, 0($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -88($fp) + # IF_ZERO local_c2i_at_A2I_internal_21 GOTO label_COMPARE_STRING_36 + # IF_ZERO local_c2i_at_A2I_internal_21 GOTO label_COMPARE_STRING_36 + lw $t0, -88($fp) + beq $t0, 0, label_COMPARE_STRING_36 + # LOCAL local_c2i_at_A2I_internal_21 --> -88($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # Comparing 0($fp) type with Bool + la $v0, Bool + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -88($fp) + # IF_ZERO local_c2i_at_A2I_internal_21 GOTO label_COMPARE_BY_VALUE_37 + # IF_ZERO local_c2i_at_A2I_internal_21 GOTO label_COMPARE_BY_VALUE_37 + lw $t0, -88($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_37 + # LOCAL local_c2i_at_A2I_internal_21 --> -88($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # Comparing 0($fp) type with Int + la $v0, Int + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -88($fp) + # IF_ZERO local_c2i_at_A2I_internal_21 GOTO label_COMPARE_BY_VALUE_37 + # IF_ZERO local_c2i_at_A2I_internal_21 GOTO label_COMPARE_BY_VALUE_37 + lw $t0, -88($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_37 + # LOCAL local_c2i_at_A2I_internal_21 --> -88($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_22 --> -92($fp) + # Load pointers and SUB + lw $a0, 0($fp) + lw $a1, -92($fp) + sub $a0, $a0, $a1 + sw $a0, -88($fp) + # IF_ZERO local_c2i_at_A2I_internal_21 GOTO label_TRUE_34 + # IF_ZERO local_c2i_at_A2I_internal_21 GOTO label_TRUE_34 + lw $t0, -88($fp) + beq $t0, 0, label_TRUE_34 + # GOTO label_FALSE_33 + j label_FALSE_33 + label_COMPARE_BY_VALUE_37: + # LOCAL local_c2i_at_A2I_internal_21 --> -88($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_22 --> -92($fp) + lw $a0, 0($fp) + lw $a1, -92($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -88($fp) + # IF_ZERO local_c2i_at_A2I_internal_21 GOTO label_TRUE_34 + # IF_ZERO local_c2i_at_A2I_internal_21 GOTO label_TRUE_34 + lw $t0, -88($fp) + beq $t0, 0, label_TRUE_34 + # GOTO label_FALSE_33 + j label_FALSE_33 + label_COMPARE_STRING_36: + # LOCAL local_c2i_at_A2I_internal_21 --> -88($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_22 --> -92($fp) + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -92($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -88($fp) + # IF_ZERO local_c2i_at_A2I_internal_21 GOTO label_CONTINUE_38 + # IF_ZERO local_c2i_at_A2I_internal_21 GOTO label_CONTINUE_38 + lw $t0, -88($fp) + beq $t0, 0, label_CONTINUE_38 + # GOTO label_FALSE_33 + j label_FALSE_33 + label_CONTINUE_38: + # LOCAL local_c2i_at_A2I_internal_21 --> -88($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_22 --> -92($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -92($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_39: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_40 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_39 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_40: + # Store result + sw $a2, -88($fp) + # IF_ZERO local_c2i_at_A2I_internal_21 GOTO label_TRUE_34 + # IF_ZERO local_c2i_at_A2I_internal_21 GOTO label_TRUE_34 + lw $t0, -88($fp) + beq $t0, 0, label_TRUE_34 + label_FALSE_33: + # LOCAL local_c2i_at_A2I_internal_20 --> -84($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -84($fp) + # GOTO label_END_35 +j label_END_35 +label_TRUE_34: + # LOCAL local_c2i_at_A2I_internal_20 --> -84($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -84($fp) + label_END_35: +# LOCAL local_c2i_at_A2I_internal_18 --> -76($fp) +# LOCAL local_c2i_at_A2I_internal_20 --> -84($fp) +# Obtain value from -84($fp) +lw $v0, -84($fp) +lw $v0, 12($v0) +sw $v0, -76($fp) +# IF_ZERO local_c2i_at_A2I_internal_18 GOTO label_FALSEIF_31 +# IF_ZERO local_c2i_at_A2I_internal_18 GOTO label_FALSEIF_31 +lw $t0, -76($fp) +beq $t0, 0, label_FALSEIF_31 +# LOCAL local_c2i_at_A2I_internal_23 --> -96($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 3 +sw $t0, 12($v0) +sw $v0, -96($fp) +# LOCAL local_c2i_at_A2I_internal_19 --> -80($fp) +# LOCAL local_c2i_at_A2I_internal_23 --> -96($fp) +# local_c2i_at_A2I_internal_19 = local_c2i_at_A2I_internal_23 +lw $t0, -96($fp) +sw $t0, -80($fp) +# GOTO label_ENDIF_32 +j label_ENDIF_32 +label_FALSEIF_31: + # LOCAL local_c2i_at_A2I_internal_28 --> -116($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_8 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -116($fp) + # IF_ZERO param_c2i_at_A2I_char_0 GOTO label_FALSE_43 + # IF_ZERO param_c2i_at_A2I_char_0 GOTO label_FALSE_43 + lw $t0, 0($fp) + beq $t0, 0, label_FALSE_43 + # IF_ZERO local_c2i_at_A2I_internal_28 GOTO label_FALSE_43 + # IF_ZERO local_c2i_at_A2I_internal_28 GOTO label_FALSE_43 + lw $t0, -116($fp) + beq $t0, 0, label_FALSE_43 + # LOCAL local_c2i_at_A2I_internal_27 --> -112($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # Comparing 0($fp) type with String + la $v0, String + lw $a0, 0($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -112($fp) + # IF_ZERO local_c2i_at_A2I_internal_27 GOTO label_COMPARE_STRING_46 + # IF_ZERO local_c2i_at_A2I_internal_27 GOTO label_COMPARE_STRING_46 + lw $t0, -112($fp) + beq $t0, 0, label_COMPARE_STRING_46 + # LOCAL local_c2i_at_A2I_internal_27 --> -112($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # Comparing 0($fp) type with Bool + la $v0, Bool + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -112($fp) + # IF_ZERO local_c2i_at_A2I_internal_27 GOTO label_COMPARE_BY_VALUE_47 + # IF_ZERO local_c2i_at_A2I_internal_27 GOTO label_COMPARE_BY_VALUE_47 + lw $t0, -112($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_47 + # LOCAL local_c2i_at_A2I_internal_27 --> -112($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # Comparing 0($fp) type with Int + la $v0, Int + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -112($fp) + # IF_ZERO local_c2i_at_A2I_internal_27 GOTO label_COMPARE_BY_VALUE_47 + # IF_ZERO local_c2i_at_A2I_internal_27 GOTO label_COMPARE_BY_VALUE_47 + lw $t0, -112($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_47 + # LOCAL local_c2i_at_A2I_internal_27 --> -112($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_28 --> -116($fp) + # Load pointers and SUB + lw $a0, 0($fp) + lw $a1, -116($fp) + sub $a0, $a0, $a1 + sw $a0, -112($fp) + # IF_ZERO local_c2i_at_A2I_internal_27 GOTO label_TRUE_44 + # IF_ZERO local_c2i_at_A2I_internal_27 GOTO label_TRUE_44 + lw $t0, -112($fp) + beq $t0, 0, label_TRUE_44 + # GOTO label_FALSE_43 + j label_FALSE_43 + label_COMPARE_BY_VALUE_47: + # LOCAL local_c2i_at_A2I_internal_27 --> -112($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_28 --> -116($fp) + lw $a0, 0($fp) + lw $a1, -116($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -112($fp) + # IF_ZERO local_c2i_at_A2I_internal_27 GOTO label_TRUE_44 + # IF_ZERO local_c2i_at_A2I_internal_27 GOTO label_TRUE_44 + lw $t0, -112($fp) + beq $t0, 0, label_TRUE_44 + # GOTO label_FALSE_43 + j label_FALSE_43 + label_COMPARE_STRING_46: + # LOCAL local_c2i_at_A2I_internal_27 --> -112($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_28 --> -116($fp) + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -116($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -112($fp) + # IF_ZERO local_c2i_at_A2I_internal_27 GOTO label_CONTINUE_48 + # IF_ZERO local_c2i_at_A2I_internal_27 GOTO label_CONTINUE_48 + lw $t0, -112($fp) + beq $t0, 0, label_CONTINUE_48 + # GOTO label_FALSE_43 + j label_FALSE_43 + label_CONTINUE_48: + # LOCAL local_c2i_at_A2I_internal_27 --> -112($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_28 --> -116($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -116($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_49: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_50 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_49 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_50: + # Store result + sw $a2, -112($fp) + # IF_ZERO local_c2i_at_A2I_internal_27 GOTO label_TRUE_44 + # IF_ZERO local_c2i_at_A2I_internal_27 GOTO label_TRUE_44 + lw $t0, -112($fp) + beq $t0, 0, label_TRUE_44 + label_FALSE_43: + # LOCAL local_c2i_at_A2I_internal_26 --> -108($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -108($fp) + # GOTO label_END_45 +j label_END_45 +label_TRUE_44: + # LOCAL local_c2i_at_A2I_internal_26 --> -108($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -108($fp) + label_END_45: +# LOCAL local_c2i_at_A2I_internal_24 --> -100($fp) +# LOCAL local_c2i_at_A2I_internal_26 --> -108($fp) +# Obtain value from -108($fp) +lw $v0, -108($fp) +lw $v0, 12($v0) +sw $v0, -100($fp) +# IF_ZERO local_c2i_at_A2I_internal_24 GOTO label_FALSEIF_41 +# IF_ZERO local_c2i_at_A2I_internal_24 GOTO label_FALSEIF_41 +lw $t0, -100($fp) +beq $t0, 0, label_FALSEIF_41 +# LOCAL local_c2i_at_A2I_internal_29 --> -120($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 4 +sw $t0, 12($v0) +sw $v0, -120($fp) +# LOCAL local_c2i_at_A2I_internal_25 --> -104($fp) +# LOCAL local_c2i_at_A2I_internal_29 --> -120($fp) +# local_c2i_at_A2I_internal_25 = local_c2i_at_A2I_internal_29 +lw $t0, -120($fp) +sw $t0, -104($fp) +# GOTO label_ENDIF_42 +j label_ENDIF_42 +label_FALSEIF_41: + # LOCAL local_c2i_at_A2I_internal_34 --> -140($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_9 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -140($fp) + # IF_ZERO param_c2i_at_A2I_char_0 GOTO label_FALSE_53 + # IF_ZERO param_c2i_at_A2I_char_0 GOTO label_FALSE_53 + lw $t0, 0($fp) + beq $t0, 0, label_FALSE_53 + # IF_ZERO local_c2i_at_A2I_internal_34 GOTO label_FALSE_53 + # IF_ZERO local_c2i_at_A2I_internal_34 GOTO label_FALSE_53 + lw $t0, -140($fp) + beq $t0, 0, label_FALSE_53 + # LOCAL local_c2i_at_A2I_internal_33 --> -136($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # Comparing 0($fp) type with String + la $v0, String + lw $a0, 0($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -136($fp) + # IF_ZERO local_c2i_at_A2I_internal_33 GOTO label_COMPARE_STRING_56 + # IF_ZERO local_c2i_at_A2I_internal_33 GOTO label_COMPARE_STRING_56 + lw $t0, -136($fp) + beq $t0, 0, label_COMPARE_STRING_56 + # LOCAL local_c2i_at_A2I_internal_33 --> -136($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # Comparing 0($fp) type with Bool + la $v0, Bool + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -136($fp) + # IF_ZERO local_c2i_at_A2I_internal_33 GOTO label_COMPARE_BY_VALUE_57 + # IF_ZERO local_c2i_at_A2I_internal_33 GOTO label_COMPARE_BY_VALUE_57 + lw $t0, -136($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_57 + # LOCAL local_c2i_at_A2I_internal_33 --> -136($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # Comparing 0($fp) type with Int + la $v0, Int + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -136($fp) + # IF_ZERO local_c2i_at_A2I_internal_33 GOTO label_COMPARE_BY_VALUE_57 + # IF_ZERO local_c2i_at_A2I_internal_33 GOTO label_COMPARE_BY_VALUE_57 + lw $t0, -136($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_57 + # LOCAL local_c2i_at_A2I_internal_33 --> -136($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_34 --> -140($fp) + # Load pointers and SUB + lw $a0, 0($fp) + lw $a1, -140($fp) + sub $a0, $a0, $a1 + sw $a0, -136($fp) + # IF_ZERO local_c2i_at_A2I_internal_33 GOTO label_TRUE_54 + # IF_ZERO local_c2i_at_A2I_internal_33 GOTO label_TRUE_54 + lw $t0, -136($fp) + beq $t0, 0, label_TRUE_54 + # GOTO label_FALSE_53 + j label_FALSE_53 + label_COMPARE_BY_VALUE_57: + # LOCAL local_c2i_at_A2I_internal_33 --> -136($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_34 --> -140($fp) + lw $a0, 0($fp) + lw $a1, -140($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -136($fp) + # IF_ZERO local_c2i_at_A2I_internal_33 GOTO label_TRUE_54 + # IF_ZERO local_c2i_at_A2I_internal_33 GOTO label_TRUE_54 + lw $t0, -136($fp) + beq $t0, 0, label_TRUE_54 + # GOTO label_FALSE_53 + j label_FALSE_53 + label_COMPARE_STRING_56: + # LOCAL local_c2i_at_A2I_internal_33 --> -136($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_34 --> -140($fp) + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -140($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -136($fp) + # IF_ZERO local_c2i_at_A2I_internal_33 GOTO label_CONTINUE_58 + # IF_ZERO local_c2i_at_A2I_internal_33 GOTO label_CONTINUE_58 + lw $t0, -136($fp) + beq $t0, 0, label_CONTINUE_58 + # GOTO label_FALSE_53 + j label_FALSE_53 + label_CONTINUE_58: + # LOCAL local_c2i_at_A2I_internal_33 --> -136($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_34 --> -140($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -140($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_59: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_60 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_59 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_60: + # Store result + sw $a2, -136($fp) + # IF_ZERO local_c2i_at_A2I_internal_33 GOTO label_TRUE_54 + # IF_ZERO local_c2i_at_A2I_internal_33 GOTO label_TRUE_54 + lw $t0, -136($fp) + beq $t0, 0, label_TRUE_54 + label_FALSE_53: + # LOCAL local_c2i_at_A2I_internal_32 --> -132($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -132($fp) + # GOTO label_END_55 +j label_END_55 +label_TRUE_54: + # LOCAL local_c2i_at_A2I_internal_32 --> -132($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -132($fp) + label_END_55: +# LOCAL local_c2i_at_A2I_internal_30 --> -124($fp) +# LOCAL local_c2i_at_A2I_internal_32 --> -132($fp) +# Obtain value from -132($fp) +lw $v0, -132($fp) +lw $v0, 12($v0) +sw $v0, -124($fp) +# IF_ZERO local_c2i_at_A2I_internal_30 GOTO label_FALSEIF_51 +# IF_ZERO local_c2i_at_A2I_internal_30 GOTO label_FALSEIF_51 +lw $t0, -124($fp) +beq $t0, 0, label_FALSEIF_51 +# LOCAL local_c2i_at_A2I_internal_35 --> -144($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 5 +sw $t0, 12($v0) +sw $v0, -144($fp) +# LOCAL local_c2i_at_A2I_internal_31 --> -128($fp) +# LOCAL local_c2i_at_A2I_internal_35 --> -144($fp) +# local_c2i_at_A2I_internal_31 = local_c2i_at_A2I_internal_35 +lw $t0, -144($fp) +sw $t0, -128($fp) +# GOTO label_ENDIF_52 +j label_ENDIF_52 +label_FALSEIF_51: + # LOCAL local_c2i_at_A2I_internal_40 --> -164($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_10 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -164($fp) + # IF_ZERO param_c2i_at_A2I_char_0 GOTO label_FALSE_63 + # IF_ZERO param_c2i_at_A2I_char_0 GOTO label_FALSE_63 + lw $t0, 0($fp) + beq $t0, 0, label_FALSE_63 + # IF_ZERO local_c2i_at_A2I_internal_40 GOTO label_FALSE_63 + # IF_ZERO local_c2i_at_A2I_internal_40 GOTO label_FALSE_63 + lw $t0, -164($fp) + beq $t0, 0, label_FALSE_63 + # LOCAL local_c2i_at_A2I_internal_39 --> -160($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # Comparing 0($fp) type with String + la $v0, String + lw $a0, 0($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -160($fp) + # IF_ZERO local_c2i_at_A2I_internal_39 GOTO label_COMPARE_STRING_66 + # IF_ZERO local_c2i_at_A2I_internal_39 GOTO label_COMPARE_STRING_66 + lw $t0, -160($fp) + beq $t0, 0, label_COMPARE_STRING_66 + # LOCAL local_c2i_at_A2I_internal_39 --> -160($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # Comparing 0($fp) type with Bool + la $v0, Bool + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -160($fp) + # IF_ZERO local_c2i_at_A2I_internal_39 GOTO label_COMPARE_BY_VALUE_67 + # IF_ZERO local_c2i_at_A2I_internal_39 GOTO label_COMPARE_BY_VALUE_67 + lw $t0, -160($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_67 + # LOCAL local_c2i_at_A2I_internal_39 --> -160($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # Comparing 0($fp) type with Int + la $v0, Int + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -160($fp) + # IF_ZERO local_c2i_at_A2I_internal_39 GOTO label_COMPARE_BY_VALUE_67 + # IF_ZERO local_c2i_at_A2I_internal_39 GOTO label_COMPARE_BY_VALUE_67 + lw $t0, -160($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_67 + # LOCAL local_c2i_at_A2I_internal_39 --> -160($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_40 --> -164($fp) + # Load pointers and SUB + lw $a0, 0($fp) + lw $a1, -164($fp) + sub $a0, $a0, $a1 + sw $a0, -160($fp) + # IF_ZERO local_c2i_at_A2I_internal_39 GOTO label_TRUE_64 + # IF_ZERO local_c2i_at_A2I_internal_39 GOTO label_TRUE_64 + lw $t0, -160($fp) + beq $t0, 0, label_TRUE_64 + # GOTO label_FALSE_63 + j label_FALSE_63 + label_COMPARE_BY_VALUE_67: + # LOCAL local_c2i_at_A2I_internal_39 --> -160($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_40 --> -164($fp) + lw $a0, 0($fp) + lw $a1, -164($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -160($fp) + # IF_ZERO local_c2i_at_A2I_internal_39 GOTO label_TRUE_64 + # IF_ZERO local_c2i_at_A2I_internal_39 GOTO label_TRUE_64 + lw $t0, -160($fp) + beq $t0, 0, label_TRUE_64 + # GOTO label_FALSE_63 + j label_FALSE_63 + label_COMPARE_STRING_66: + # LOCAL local_c2i_at_A2I_internal_39 --> -160($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_40 --> -164($fp) + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -164($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -160($fp) + # IF_ZERO local_c2i_at_A2I_internal_39 GOTO label_CONTINUE_68 + # IF_ZERO local_c2i_at_A2I_internal_39 GOTO label_CONTINUE_68 + lw $t0, -160($fp) + beq $t0, 0, label_CONTINUE_68 + # GOTO label_FALSE_63 + j label_FALSE_63 + label_CONTINUE_68: + # LOCAL local_c2i_at_A2I_internal_39 --> -160($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_40 --> -164($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -164($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_69: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_70 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_69 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_70: + # Store result + sw $a2, -160($fp) + # IF_ZERO local_c2i_at_A2I_internal_39 GOTO label_TRUE_64 + # IF_ZERO local_c2i_at_A2I_internal_39 GOTO label_TRUE_64 + lw $t0, -160($fp) + beq $t0, 0, label_TRUE_64 + label_FALSE_63: + # LOCAL local_c2i_at_A2I_internal_38 --> -156($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -156($fp) + # GOTO label_END_65 +j label_END_65 +label_TRUE_64: + # LOCAL local_c2i_at_A2I_internal_38 --> -156($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -156($fp) + label_END_65: +# LOCAL local_c2i_at_A2I_internal_36 --> -148($fp) +# LOCAL local_c2i_at_A2I_internal_38 --> -156($fp) +# Obtain value from -156($fp) +lw $v0, -156($fp) +lw $v0, 12($v0) +sw $v0, -148($fp) +# IF_ZERO local_c2i_at_A2I_internal_36 GOTO label_FALSEIF_61 +# IF_ZERO local_c2i_at_A2I_internal_36 GOTO label_FALSEIF_61 +lw $t0, -148($fp) +beq $t0, 0, label_FALSEIF_61 +# LOCAL local_c2i_at_A2I_internal_41 --> -168($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 6 +sw $t0, 12($v0) +sw $v0, -168($fp) +# LOCAL local_c2i_at_A2I_internal_37 --> -152($fp) +# LOCAL local_c2i_at_A2I_internal_41 --> -168($fp) +# local_c2i_at_A2I_internal_37 = local_c2i_at_A2I_internal_41 +lw $t0, -168($fp) +sw $t0, -152($fp) +# GOTO label_ENDIF_62 +j label_ENDIF_62 +label_FALSEIF_61: + # LOCAL local_c2i_at_A2I_internal_46 --> -188($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_11 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -188($fp) + # IF_ZERO param_c2i_at_A2I_char_0 GOTO label_FALSE_73 + # IF_ZERO param_c2i_at_A2I_char_0 GOTO label_FALSE_73 + lw $t0, 0($fp) + beq $t0, 0, label_FALSE_73 + # IF_ZERO local_c2i_at_A2I_internal_46 GOTO label_FALSE_73 + # IF_ZERO local_c2i_at_A2I_internal_46 GOTO label_FALSE_73 + lw $t0, -188($fp) + beq $t0, 0, label_FALSE_73 + # LOCAL local_c2i_at_A2I_internal_45 --> -184($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # Comparing 0($fp) type with String + la $v0, String + lw $a0, 0($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -184($fp) + # IF_ZERO local_c2i_at_A2I_internal_45 GOTO label_COMPARE_STRING_76 + # IF_ZERO local_c2i_at_A2I_internal_45 GOTO label_COMPARE_STRING_76 + lw $t0, -184($fp) + beq $t0, 0, label_COMPARE_STRING_76 + # LOCAL local_c2i_at_A2I_internal_45 --> -184($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # Comparing 0($fp) type with Bool + la $v0, Bool + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -184($fp) + # IF_ZERO local_c2i_at_A2I_internal_45 GOTO label_COMPARE_BY_VALUE_77 + # IF_ZERO local_c2i_at_A2I_internal_45 GOTO label_COMPARE_BY_VALUE_77 + lw $t0, -184($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_77 + # LOCAL local_c2i_at_A2I_internal_45 --> -184($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # Comparing 0($fp) type with Int + la $v0, Int + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -184($fp) + # IF_ZERO local_c2i_at_A2I_internal_45 GOTO label_COMPARE_BY_VALUE_77 + # IF_ZERO local_c2i_at_A2I_internal_45 GOTO label_COMPARE_BY_VALUE_77 + lw $t0, -184($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_77 + # LOCAL local_c2i_at_A2I_internal_45 --> -184($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_46 --> -188($fp) + # Load pointers and SUB + lw $a0, 0($fp) + lw $a1, -188($fp) + sub $a0, $a0, $a1 + sw $a0, -184($fp) + # IF_ZERO local_c2i_at_A2I_internal_45 GOTO label_TRUE_74 + # IF_ZERO local_c2i_at_A2I_internal_45 GOTO label_TRUE_74 + lw $t0, -184($fp) + beq $t0, 0, label_TRUE_74 + # GOTO label_FALSE_73 + j label_FALSE_73 + label_COMPARE_BY_VALUE_77: + # LOCAL local_c2i_at_A2I_internal_45 --> -184($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_46 --> -188($fp) + lw $a0, 0($fp) + lw $a1, -188($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -184($fp) + # IF_ZERO local_c2i_at_A2I_internal_45 GOTO label_TRUE_74 + # IF_ZERO local_c2i_at_A2I_internal_45 GOTO label_TRUE_74 + lw $t0, -184($fp) + beq $t0, 0, label_TRUE_74 + # GOTO label_FALSE_73 + j label_FALSE_73 + label_COMPARE_STRING_76: + # LOCAL local_c2i_at_A2I_internal_45 --> -184($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_46 --> -188($fp) + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -188($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -184($fp) + # IF_ZERO local_c2i_at_A2I_internal_45 GOTO label_CONTINUE_78 + # IF_ZERO local_c2i_at_A2I_internal_45 GOTO label_CONTINUE_78 + lw $t0, -184($fp) + beq $t0, 0, label_CONTINUE_78 + # GOTO label_FALSE_73 + j label_FALSE_73 + label_CONTINUE_78: + # LOCAL local_c2i_at_A2I_internal_45 --> -184($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_46 --> -188($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -188($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_79: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_80 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_79 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_80: + # Store result + sw $a2, -184($fp) + # IF_ZERO local_c2i_at_A2I_internal_45 GOTO label_TRUE_74 + # IF_ZERO local_c2i_at_A2I_internal_45 GOTO label_TRUE_74 + lw $t0, -184($fp) + beq $t0, 0, label_TRUE_74 + label_FALSE_73: + # LOCAL local_c2i_at_A2I_internal_44 --> -180($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -180($fp) + # GOTO label_END_75 +j label_END_75 +label_TRUE_74: + # LOCAL local_c2i_at_A2I_internal_44 --> -180($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -180($fp) + label_END_75: +# LOCAL local_c2i_at_A2I_internal_42 --> -172($fp) +# LOCAL local_c2i_at_A2I_internal_44 --> -180($fp) +# Obtain value from -180($fp) +lw $v0, -180($fp) +lw $v0, 12($v0) +sw $v0, -172($fp) +# IF_ZERO local_c2i_at_A2I_internal_42 GOTO label_FALSEIF_71 +# IF_ZERO local_c2i_at_A2I_internal_42 GOTO label_FALSEIF_71 +lw $t0, -172($fp) +beq $t0, 0, label_FALSEIF_71 +# LOCAL local_c2i_at_A2I_internal_47 --> -192($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 7 +sw $t0, 12($v0) +sw $v0, -192($fp) +# LOCAL local_c2i_at_A2I_internal_43 --> -176($fp) +# LOCAL local_c2i_at_A2I_internal_47 --> -192($fp) +# local_c2i_at_A2I_internal_43 = local_c2i_at_A2I_internal_47 +lw $t0, -192($fp) +sw $t0, -176($fp) +# GOTO label_ENDIF_72 +j label_ENDIF_72 +label_FALSEIF_71: + # LOCAL local_c2i_at_A2I_internal_52 --> -212($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_12 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -212($fp) + # IF_ZERO param_c2i_at_A2I_char_0 GOTO label_FALSE_83 + # IF_ZERO param_c2i_at_A2I_char_0 GOTO label_FALSE_83 + lw $t0, 0($fp) + beq $t0, 0, label_FALSE_83 + # IF_ZERO local_c2i_at_A2I_internal_52 GOTO label_FALSE_83 + # IF_ZERO local_c2i_at_A2I_internal_52 GOTO label_FALSE_83 + lw $t0, -212($fp) + beq $t0, 0, label_FALSE_83 + # LOCAL local_c2i_at_A2I_internal_51 --> -208($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # Comparing 0($fp) type with String + la $v0, String + lw $a0, 0($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -208($fp) + # IF_ZERO local_c2i_at_A2I_internal_51 GOTO label_COMPARE_STRING_86 + # IF_ZERO local_c2i_at_A2I_internal_51 GOTO label_COMPARE_STRING_86 + lw $t0, -208($fp) + beq $t0, 0, label_COMPARE_STRING_86 + # LOCAL local_c2i_at_A2I_internal_51 --> -208($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # Comparing 0($fp) type with Bool + la $v0, Bool + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -208($fp) + # IF_ZERO local_c2i_at_A2I_internal_51 GOTO label_COMPARE_BY_VALUE_87 + # IF_ZERO local_c2i_at_A2I_internal_51 GOTO label_COMPARE_BY_VALUE_87 + lw $t0, -208($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_87 + # LOCAL local_c2i_at_A2I_internal_51 --> -208($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # Comparing 0($fp) type with Int + la $v0, Int + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -208($fp) + # IF_ZERO local_c2i_at_A2I_internal_51 GOTO label_COMPARE_BY_VALUE_87 + # IF_ZERO local_c2i_at_A2I_internal_51 GOTO label_COMPARE_BY_VALUE_87 + lw $t0, -208($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_87 + # LOCAL local_c2i_at_A2I_internal_51 --> -208($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_52 --> -212($fp) + # Load pointers and SUB + lw $a0, 0($fp) + lw $a1, -212($fp) + sub $a0, $a0, $a1 + sw $a0, -208($fp) + # IF_ZERO local_c2i_at_A2I_internal_51 GOTO label_TRUE_84 + # IF_ZERO local_c2i_at_A2I_internal_51 GOTO label_TRUE_84 + lw $t0, -208($fp) + beq $t0, 0, label_TRUE_84 + # GOTO label_FALSE_83 + j label_FALSE_83 + label_COMPARE_BY_VALUE_87: + # LOCAL local_c2i_at_A2I_internal_51 --> -208($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_52 --> -212($fp) + lw $a0, 0($fp) + lw $a1, -212($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -208($fp) + # IF_ZERO local_c2i_at_A2I_internal_51 GOTO label_TRUE_84 + # IF_ZERO local_c2i_at_A2I_internal_51 GOTO label_TRUE_84 + lw $t0, -208($fp) + beq $t0, 0, label_TRUE_84 + # GOTO label_FALSE_83 + j label_FALSE_83 + label_COMPARE_STRING_86: + # LOCAL local_c2i_at_A2I_internal_51 --> -208($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_52 --> -212($fp) + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -212($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -208($fp) + # IF_ZERO local_c2i_at_A2I_internal_51 GOTO label_CONTINUE_88 + # IF_ZERO local_c2i_at_A2I_internal_51 GOTO label_CONTINUE_88 + lw $t0, -208($fp) + beq $t0, 0, label_CONTINUE_88 + # GOTO label_FALSE_83 + j label_FALSE_83 + label_CONTINUE_88: + # LOCAL local_c2i_at_A2I_internal_51 --> -208($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_52 --> -212($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -212($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_89: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_90 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_89 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_90: + # Store result + sw $a2, -208($fp) + # IF_ZERO local_c2i_at_A2I_internal_51 GOTO label_TRUE_84 + # IF_ZERO local_c2i_at_A2I_internal_51 GOTO label_TRUE_84 + lw $t0, -208($fp) + beq $t0, 0, label_TRUE_84 + label_FALSE_83: + # LOCAL local_c2i_at_A2I_internal_50 --> -204($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -204($fp) + # GOTO label_END_85 +j label_END_85 +label_TRUE_84: + # LOCAL local_c2i_at_A2I_internal_50 --> -204($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -204($fp) + label_END_85: +# LOCAL local_c2i_at_A2I_internal_48 --> -196($fp) +# LOCAL local_c2i_at_A2I_internal_50 --> -204($fp) +# Obtain value from -204($fp) +lw $v0, -204($fp) +lw $v0, 12($v0) +sw $v0, -196($fp) +# IF_ZERO local_c2i_at_A2I_internal_48 GOTO label_FALSEIF_81 +# IF_ZERO local_c2i_at_A2I_internal_48 GOTO label_FALSEIF_81 +lw $t0, -196($fp) +beq $t0, 0, label_FALSEIF_81 +# LOCAL local_c2i_at_A2I_internal_53 --> -216($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 8 +sw $t0, 12($v0) +sw $v0, -216($fp) +# LOCAL local_c2i_at_A2I_internal_49 --> -200($fp) +# LOCAL local_c2i_at_A2I_internal_53 --> -216($fp) +# local_c2i_at_A2I_internal_49 = local_c2i_at_A2I_internal_53 +lw $t0, -216($fp) +sw $t0, -200($fp) +# GOTO label_ENDIF_82 +j label_ENDIF_82 +label_FALSEIF_81: + # LOCAL local_c2i_at_A2I_internal_58 --> -236($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_13 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -236($fp) + # IF_ZERO param_c2i_at_A2I_char_0 GOTO label_FALSE_93 + # IF_ZERO param_c2i_at_A2I_char_0 GOTO label_FALSE_93 + lw $t0, 0($fp) + beq $t0, 0, label_FALSE_93 + # IF_ZERO local_c2i_at_A2I_internal_58 GOTO label_FALSE_93 + # IF_ZERO local_c2i_at_A2I_internal_58 GOTO label_FALSE_93 + lw $t0, -236($fp) + beq $t0, 0, label_FALSE_93 + # LOCAL local_c2i_at_A2I_internal_57 --> -232($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # Comparing 0($fp) type with String + la $v0, String + lw $a0, 0($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -232($fp) + # IF_ZERO local_c2i_at_A2I_internal_57 GOTO label_COMPARE_STRING_96 + # IF_ZERO local_c2i_at_A2I_internal_57 GOTO label_COMPARE_STRING_96 + lw $t0, -232($fp) + beq $t0, 0, label_COMPARE_STRING_96 + # LOCAL local_c2i_at_A2I_internal_57 --> -232($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # Comparing 0($fp) type with Bool + la $v0, Bool + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -232($fp) + # IF_ZERO local_c2i_at_A2I_internal_57 GOTO label_COMPARE_BY_VALUE_97 + # IF_ZERO local_c2i_at_A2I_internal_57 GOTO label_COMPARE_BY_VALUE_97 + lw $t0, -232($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_97 + # LOCAL local_c2i_at_A2I_internal_57 --> -232($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # Comparing 0($fp) type with Int + la $v0, Int + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -232($fp) + # IF_ZERO local_c2i_at_A2I_internal_57 GOTO label_COMPARE_BY_VALUE_97 + # IF_ZERO local_c2i_at_A2I_internal_57 GOTO label_COMPARE_BY_VALUE_97 + lw $t0, -232($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_97 + # LOCAL local_c2i_at_A2I_internal_57 --> -232($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_58 --> -236($fp) + # Load pointers and SUB + lw $a0, 0($fp) + lw $a1, -236($fp) + sub $a0, $a0, $a1 + sw $a0, -232($fp) + # IF_ZERO local_c2i_at_A2I_internal_57 GOTO label_TRUE_94 + # IF_ZERO local_c2i_at_A2I_internal_57 GOTO label_TRUE_94 + lw $t0, -232($fp) + beq $t0, 0, label_TRUE_94 + # GOTO label_FALSE_93 + j label_FALSE_93 + label_COMPARE_BY_VALUE_97: + # LOCAL local_c2i_at_A2I_internal_57 --> -232($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_58 --> -236($fp) + lw $a0, 0($fp) + lw $a1, -236($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -232($fp) + # IF_ZERO local_c2i_at_A2I_internal_57 GOTO label_TRUE_94 + # IF_ZERO local_c2i_at_A2I_internal_57 GOTO label_TRUE_94 + lw $t0, -232($fp) + beq $t0, 0, label_TRUE_94 + # GOTO label_FALSE_93 + j label_FALSE_93 + label_COMPARE_STRING_96: + # LOCAL local_c2i_at_A2I_internal_57 --> -232($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_58 --> -236($fp) + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -236($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -232($fp) + # IF_ZERO local_c2i_at_A2I_internal_57 GOTO label_CONTINUE_98 + # IF_ZERO local_c2i_at_A2I_internal_57 GOTO label_CONTINUE_98 + lw $t0, -232($fp) + beq $t0, 0, label_CONTINUE_98 + # GOTO label_FALSE_93 + j label_FALSE_93 + label_CONTINUE_98: + # LOCAL local_c2i_at_A2I_internal_57 --> -232($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_58 --> -236($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -236($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_99: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_100 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_99 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_100: + # Store result + sw $a2, -232($fp) + # IF_ZERO local_c2i_at_A2I_internal_57 GOTO label_TRUE_94 + # IF_ZERO local_c2i_at_A2I_internal_57 GOTO label_TRUE_94 + lw $t0, -232($fp) + beq $t0, 0, label_TRUE_94 + label_FALSE_93: + # LOCAL local_c2i_at_A2I_internal_56 --> -228($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -228($fp) + # GOTO label_END_95 +j label_END_95 +label_TRUE_94: + # LOCAL local_c2i_at_A2I_internal_56 --> -228($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -228($fp) + label_END_95: +# LOCAL local_c2i_at_A2I_internal_54 --> -220($fp) +# LOCAL local_c2i_at_A2I_internal_56 --> -228($fp) +# Obtain value from -228($fp) +lw $v0, -228($fp) +lw $v0, 12($v0) +sw $v0, -220($fp) +# IF_ZERO local_c2i_at_A2I_internal_54 GOTO label_FALSEIF_91 +# IF_ZERO local_c2i_at_A2I_internal_54 GOTO label_FALSEIF_91 +lw $t0, -220($fp) +beq $t0, 0, label_FALSEIF_91 +# LOCAL local_c2i_at_A2I_internal_59 --> -240($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 9 +sw $t0, 12($v0) +sw $v0, -240($fp) +# LOCAL local_c2i_at_A2I_internal_55 --> -224($fp) +# LOCAL local_c2i_at_A2I_internal_59 --> -240($fp) +# local_c2i_at_A2I_internal_55 = local_c2i_at_A2I_internal_59 +lw $t0, -240($fp) +sw $t0, -224($fp) +# GOTO label_ENDIF_92 +j label_ENDIF_92 +label_FALSEIF_91: + # LOCAL local_c2i_at_A2I_internal_62 --> -252($fp) + # local_c2i_at_A2I_internal_62 = SELF + sw $s1, -252($fp) + # LOCAL local_c2i_at_A2I_internal_60 --> -244($fp) + # LOCAL local_c2i_at_A2I_internal_62 --> -252($fp) + # local_c2i_at_A2I_internal_60 = local_c2i_at_A2I_internal_62 + lw $t0, -252($fp) + sw $t0, -244($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_c2i_at_A2I_internal_60 --> -244($fp) + # LOCAL local_c2i_at_A2I_internal_61 --> -248($fp) + # local_c2i_at_A2I_internal_61 = VCALL local_c2i_at_A2I_internal_60 abort + # Save new self pointer in $s1 + lw $s1, -244($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 84($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -248($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_c2i_at_A2I_internal_63 --> -256($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -256($fp) + # LOCAL local_c2i_at_A2I_internal_55 --> -224($fp) + # LOCAL local_c2i_at_A2I_internal_63 --> -256($fp) + # local_c2i_at_A2I_internal_55 = local_c2i_at_A2I_internal_63 + lw $t0, -256($fp) + sw $t0, -224($fp) + label_ENDIF_92: +# LOCAL local_c2i_at_A2I_internal_49 --> -200($fp) +# LOCAL local_c2i_at_A2I_internal_55 --> -224($fp) +# local_c2i_at_A2I_internal_49 = local_c2i_at_A2I_internal_55 +lw $t0, -224($fp) +sw $t0, -200($fp) +label_ENDIF_82: +# LOCAL local_c2i_at_A2I_internal_43 --> -176($fp) +# LOCAL local_c2i_at_A2I_internal_49 --> -200($fp) +# local_c2i_at_A2I_internal_43 = local_c2i_at_A2I_internal_49 +lw $t0, -200($fp) +sw $t0, -176($fp) +label_ENDIF_72: +# LOCAL local_c2i_at_A2I_internal_37 --> -152($fp) +# LOCAL local_c2i_at_A2I_internal_43 --> -176($fp) +# local_c2i_at_A2I_internal_37 = local_c2i_at_A2I_internal_43 +lw $t0, -176($fp) +sw $t0, -152($fp) +label_ENDIF_62: +# LOCAL local_c2i_at_A2I_internal_31 --> -128($fp) +# LOCAL local_c2i_at_A2I_internal_37 --> -152($fp) +# local_c2i_at_A2I_internal_31 = local_c2i_at_A2I_internal_37 +lw $t0, -152($fp) +sw $t0, -128($fp) +label_ENDIF_52: +# LOCAL local_c2i_at_A2I_internal_25 --> -104($fp) +# LOCAL local_c2i_at_A2I_internal_31 --> -128($fp) +# local_c2i_at_A2I_internal_25 = local_c2i_at_A2I_internal_31 +lw $t0, -128($fp) +sw $t0, -104($fp) +label_ENDIF_42: +# LOCAL local_c2i_at_A2I_internal_19 --> -80($fp) +# LOCAL local_c2i_at_A2I_internal_25 --> -104($fp) +# local_c2i_at_A2I_internal_19 = local_c2i_at_A2I_internal_25 +lw $t0, -104($fp) +sw $t0, -80($fp) +label_ENDIF_32: +# LOCAL local_c2i_at_A2I_internal_13 --> -56($fp) +# LOCAL local_c2i_at_A2I_internal_19 --> -80($fp) +# local_c2i_at_A2I_internal_13 = local_c2i_at_A2I_internal_19 +lw $t0, -80($fp) +sw $t0, -56($fp) +label_ENDIF_22: +# LOCAL local_c2i_at_A2I_internal_7 --> -32($fp) +# LOCAL local_c2i_at_A2I_internal_13 --> -56($fp) +# local_c2i_at_A2I_internal_7 = local_c2i_at_A2I_internal_13 +lw $t0, -56($fp) +sw $t0, -32($fp) +label_ENDIF_12: +# LOCAL local_c2i_at_A2I_internal_1 --> -8($fp) +# LOCAL local_c2i_at_A2I_internal_7 --> -32($fp) +# local_c2i_at_A2I_internal_1 = local_c2i_at_A2I_internal_7 +lw $t0, -32($fp) +sw $t0, -8($fp) +label_ENDIF_2: +# RETURN local_c2i_at_A2I_internal_1 +lw $v0, -8($fp) +# Deallocate stack frame for function function_c2i_at_A2I. +# Restore $ra +lw $ra, 4($sp) +# Restore $fp +lw $fp, 0($sp) +# Restore Stack pointer $sp +addu $sp, $sp, 264 +# Deallocate function args +addu $sp, $sp, 4 +jr $ra +# Function END + + +# function_i2c_at_A2I implementation. +# @Params: +# 0($fp) = param_i2c_at_A2I_i_0 +function_i2c_at_A2I: + # Allocate stack frame for function function_i2c_at_A2I. + subu $sp, $sp, 264 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 264 + # LOCAL local_i2c_at_A2I_internal_4 --> -20($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -20($fp) + # IF_ZERO param_i2c_at_A2I_i_0 GOTO label_FALSE_103 + # IF_ZERO param_i2c_at_A2I_i_0 GOTO label_FALSE_103 + lw $t0, 0($fp) + beq $t0, 0, label_FALSE_103 + # IF_ZERO local_i2c_at_A2I_internal_4 GOTO label_FALSE_103 + # IF_ZERO local_i2c_at_A2I_internal_4 GOTO label_FALSE_103 + lw $t0, -20($fp) + beq $t0, 0, label_FALSE_103 + # LOCAL local_i2c_at_A2I_internal_3 --> -16($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with String + la $v0, String + lw $a0, 0($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -16($fp) + # IF_ZERO local_i2c_at_A2I_internal_3 GOTO label_COMPARE_STRING_106 + # IF_ZERO local_i2c_at_A2I_internal_3 GOTO label_COMPARE_STRING_106 + lw $t0, -16($fp) + beq $t0, 0, label_COMPARE_STRING_106 + # LOCAL local_i2c_at_A2I_internal_3 --> -16($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with Bool + la $v0, Bool + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -16($fp) + # IF_ZERO local_i2c_at_A2I_internal_3 GOTO label_COMPARE_BY_VALUE_107 + # IF_ZERO local_i2c_at_A2I_internal_3 GOTO label_COMPARE_BY_VALUE_107 + lw $t0, -16($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_107 + # LOCAL local_i2c_at_A2I_internal_3 --> -16($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with Int + la $v0, Int + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -16($fp) + # IF_ZERO local_i2c_at_A2I_internal_3 GOTO label_COMPARE_BY_VALUE_107 + # IF_ZERO local_i2c_at_A2I_internal_3 GOTO label_COMPARE_BY_VALUE_107 + lw $t0, -16($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_107 + # LOCAL local_i2c_at_A2I_internal_3 --> -16($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_4 --> -20($fp) + # Load pointers and SUB + lw $a0, 0($fp) + lw $a1, -20($fp) + sub $a0, $a0, $a1 + sw $a0, -16($fp) + # IF_ZERO local_i2c_at_A2I_internal_3 GOTO label_TRUE_104 + # IF_ZERO local_i2c_at_A2I_internal_3 GOTO label_TRUE_104 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_104 + # GOTO label_FALSE_103 + j label_FALSE_103 + label_COMPARE_BY_VALUE_107: + # LOCAL local_i2c_at_A2I_internal_3 --> -16($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_4 --> -20($fp) + lw $a0, 0($fp) + lw $a1, -20($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -16($fp) + # IF_ZERO local_i2c_at_A2I_internal_3 GOTO label_TRUE_104 + # IF_ZERO local_i2c_at_A2I_internal_3 GOTO label_TRUE_104 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_104 + # GOTO label_FALSE_103 + j label_FALSE_103 + label_COMPARE_STRING_106: + # LOCAL local_i2c_at_A2I_internal_3 --> -16($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_4 --> -20($fp) + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -20($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -16($fp) + # IF_ZERO local_i2c_at_A2I_internal_3 GOTO label_CONTINUE_108 + # IF_ZERO local_i2c_at_A2I_internal_3 GOTO label_CONTINUE_108 + lw $t0, -16($fp) + beq $t0, 0, label_CONTINUE_108 + # GOTO label_FALSE_103 + j label_FALSE_103 + label_CONTINUE_108: + # LOCAL local_i2c_at_A2I_internal_3 --> -16($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_4 --> -20($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -20($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_109: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_110 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_109 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_110: + # Store result + sw $a2, -16($fp) + # IF_ZERO local_i2c_at_A2I_internal_3 GOTO label_TRUE_104 + # IF_ZERO local_i2c_at_A2I_internal_3 GOTO label_TRUE_104 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_104 + label_FALSE_103: + # LOCAL local_i2c_at_A2I_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -12($fp) + # GOTO label_END_105 +j label_END_105 +label_TRUE_104: + # LOCAL local_i2c_at_A2I_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -12($fp) + label_END_105: +# LOCAL local_i2c_at_A2I_internal_0 --> -4($fp) +# LOCAL local_i2c_at_A2I_internal_2 --> -12($fp) +# Obtain value from -12($fp) +lw $v0, -12($fp) +lw $v0, 12($v0) +sw $v0, -4($fp) +# IF_ZERO local_i2c_at_A2I_internal_0 GOTO label_FALSEIF_101 +# IF_ZERO local_i2c_at_A2I_internal_0 GOTO label_FALSEIF_101 +lw $t0, -4($fp) +beq $t0, 0, label_FALSEIF_101 +# LOCAL local_i2c_at_A2I_internal_5 --> -24($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_14 +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +sw $v0, -24($fp) +# LOCAL local_i2c_at_A2I_internal_1 --> -8($fp) +# LOCAL local_i2c_at_A2I_internal_5 --> -24($fp) +# local_i2c_at_A2I_internal_1 = local_i2c_at_A2I_internal_5 +lw $t0, -24($fp) +sw $t0, -8($fp) +# GOTO label_ENDIF_102 +j label_ENDIF_102 +label_FALSEIF_101: + # LOCAL local_i2c_at_A2I_internal_10 --> -44($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -44($fp) + # IF_ZERO param_i2c_at_A2I_i_0 GOTO label_FALSE_113 + # IF_ZERO param_i2c_at_A2I_i_0 GOTO label_FALSE_113 + lw $t0, 0($fp) + beq $t0, 0, label_FALSE_113 + # IF_ZERO local_i2c_at_A2I_internal_10 GOTO label_FALSE_113 + # IF_ZERO local_i2c_at_A2I_internal_10 GOTO label_FALSE_113 + lw $t0, -44($fp) + beq $t0, 0, label_FALSE_113 + # LOCAL local_i2c_at_A2I_internal_9 --> -40($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with String + la $v0, String + lw $a0, 0($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -40($fp) + # IF_ZERO local_i2c_at_A2I_internal_9 GOTO label_COMPARE_STRING_116 + # IF_ZERO local_i2c_at_A2I_internal_9 GOTO label_COMPARE_STRING_116 + lw $t0, -40($fp) + beq $t0, 0, label_COMPARE_STRING_116 + # LOCAL local_i2c_at_A2I_internal_9 --> -40($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with Bool + la $v0, Bool + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -40($fp) + # IF_ZERO local_i2c_at_A2I_internal_9 GOTO label_COMPARE_BY_VALUE_117 + # IF_ZERO local_i2c_at_A2I_internal_9 GOTO label_COMPARE_BY_VALUE_117 + lw $t0, -40($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_117 + # LOCAL local_i2c_at_A2I_internal_9 --> -40($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with Int + la $v0, Int + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -40($fp) + # IF_ZERO local_i2c_at_A2I_internal_9 GOTO label_COMPARE_BY_VALUE_117 + # IF_ZERO local_i2c_at_A2I_internal_9 GOTO label_COMPARE_BY_VALUE_117 + lw $t0, -40($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_117 + # LOCAL local_i2c_at_A2I_internal_9 --> -40($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_10 --> -44($fp) + # Load pointers and SUB + lw $a0, 0($fp) + lw $a1, -44($fp) + sub $a0, $a0, $a1 + sw $a0, -40($fp) + # IF_ZERO local_i2c_at_A2I_internal_9 GOTO label_TRUE_114 + # IF_ZERO local_i2c_at_A2I_internal_9 GOTO label_TRUE_114 + lw $t0, -40($fp) + beq $t0, 0, label_TRUE_114 + # GOTO label_FALSE_113 + j label_FALSE_113 + label_COMPARE_BY_VALUE_117: + # LOCAL local_i2c_at_A2I_internal_9 --> -40($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_10 --> -44($fp) + lw $a0, 0($fp) + lw $a1, -44($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -40($fp) + # IF_ZERO local_i2c_at_A2I_internal_9 GOTO label_TRUE_114 + # IF_ZERO local_i2c_at_A2I_internal_9 GOTO label_TRUE_114 + lw $t0, -40($fp) + beq $t0, 0, label_TRUE_114 + # GOTO label_FALSE_113 + j label_FALSE_113 + label_COMPARE_STRING_116: + # LOCAL local_i2c_at_A2I_internal_9 --> -40($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_10 --> -44($fp) + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -44($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -40($fp) + # IF_ZERO local_i2c_at_A2I_internal_9 GOTO label_CONTINUE_118 + # IF_ZERO local_i2c_at_A2I_internal_9 GOTO label_CONTINUE_118 + lw $t0, -40($fp) + beq $t0, 0, label_CONTINUE_118 + # GOTO label_FALSE_113 + j label_FALSE_113 + label_CONTINUE_118: + # LOCAL local_i2c_at_A2I_internal_9 --> -40($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_10 --> -44($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -44($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_119: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_120 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_119 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_120: + # Store result + sw $a2, -40($fp) + # IF_ZERO local_i2c_at_A2I_internal_9 GOTO label_TRUE_114 + # IF_ZERO local_i2c_at_A2I_internal_9 GOTO label_TRUE_114 + lw $t0, -40($fp) + beq $t0, 0, label_TRUE_114 + label_FALSE_113: + # LOCAL local_i2c_at_A2I_internal_8 --> -36($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -36($fp) + # GOTO label_END_115 +j label_END_115 +label_TRUE_114: + # LOCAL local_i2c_at_A2I_internal_8 --> -36($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -36($fp) + label_END_115: +# LOCAL local_i2c_at_A2I_internal_6 --> -28($fp) +# LOCAL local_i2c_at_A2I_internal_8 --> -36($fp) +# Obtain value from -36($fp) +lw $v0, -36($fp) +lw $v0, 12($v0) +sw $v0, -28($fp) +# IF_ZERO local_i2c_at_A2I_internal_6 GOTO label_FALSEIF_111 +# IF_ZERO local_i2c_at_A2I_internal_6 GOTO label_FALSEIF_111 +lw $t0, -28($fp) +beq $t0, 0, label_FALSEIF_111 +# LOCAL local_i2c_at_A2I_internal_11 --> -48($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_15 +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +sw $v0, -48($fp) +# LOCAL local_i2c_at_A2I_internal_7 --> -32($fp) +# LOCAL local_i2c_at_A2I_internal_11 --> -48($fp) +# local_i2c_at_A2I_internal_7 = local_i2c_at_A2I_internal_11 +lw $t0, -48($fp) +sw $t0, -32($fp) +# GOTO label_ENDIF_112 +j label_ENDIF_112 +label_FALSEIF_111: + # LOCAL local_i2c_at_A2I_internal_16 --> -68($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 2 + sw $t0, 12($v0) + sw $v0, -68($fp) + # IF_ZERO param_i2c_at_A2I_i_0 GOTO label_FALSE_123 + # IF_ZERO param_i2c_at_A2I_i_0 GOTO label_FALSE_123 + lw $t0, 0($fp) + beq $t0, 0, label_FALSE_123 + # IF_ZERO local_i2c_at_A2I_internal_16 GOTO label_FALSE_123 + # IF_ZERO local_i2c_at_A2I_internal_16 GOTO label_FALSE_123 + lw $t0, -68($fp) + beq $t0, 0, label_FALSE_123 + # LOCAL local_i2c_at_A2I_internal_15 --> -64($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with String + la $v0, String + lw $a0, 0($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -64($fp) + # IF_ZERO local_i2c_at_A2I_internal_15 GOTO label_COMPARE_STRING_126 + # IF_ZERO local_i2c_at_A2I_internal_15 GOTO label_COMPARE_STRING_126 + lw $t0, -64($fp) + beq $t0, 0, label_COMPARE_STRING_126 + # LOCAL local_i2c_at_A2I_internal_15 --> -64($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with Bool + la $v0, Bool + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -64($fp) + # IF_ZERO local_i2c_at_A2I_internal_15 GOTO label_COMPARE_BY_VALUE_127 + # IF_ZERO local_i2c_at_A2I_internal_15 GOTO label_COMPARE_BY_VALUE_127 + lw $t0, -64($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_127 + # LOCAL local_i2c_at_A2I_internal_15 --> -64($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with Int + la $v0, Int + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -64($fp) + # IF_ZERO local_i2c_at_A2I_internal_15 GOTO label_COMPARE_BY_VALUE_127 + # IF_ZERO local_i2c_at_A2I_internal_15 GOTO label_COMPARE_BY_VALUE_127 + lw $t0, -64($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_127 + # LOCAL local_i2c_at_A2I_internal_15 --> -64($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_16 --> -68($fp) + # Load pointers and SUB + lw $a0, 0($fp) + lw $a1, -68($fp) + sub $a0, $a0, $a1 + sw $a0, -64($fp) + # IF_ZERO local_i2c_at_A2I_internal_15 GOTO label_TRUE_124 + # IF_ZERO local_i2c_at_A2I_internal_15 GOTO label_TRUE_124 + lw $t0, -64($fp) + beq $t0, 0, label_TRUE_124 + # GOTO label_FALSE_123 + j label_FALSE_123 + label_COMPARE_BY_VALUE_127: + # LOCAL local_i2c_at_A2I_internal_15 --> -64($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_16 --> -68($fp) + lw $a0, 0($fp) + lw $a1, -68($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -64($fp) + # IF_ZERO local_i2c_at_A2I_internal_15 GOTO label_TRUE_124 + # IF_ZERO local_i2c_at_A2I_internal_15 GOTO label_TRUE_124 + lw $t0, -64($fp) + beq $t0, 0, label_TRUE_124 + # GOTO label_FALSE_123 + j label_FALSE_123 + label_COMPARE_STRING_126: + # LOCAL local_i2c_at_A2I_internal_15 --> -64($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_16 --> -68($fp) + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -68($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -64($fp) + # IF_ZERO local_i2c_at_A2I_internal_15 GOTO label_CONTINUE_128 + # IF_ZERO local_i2c_at_A2I_internal_15 GOTO label_CONTINUE_128 + lw $t0, -64($fp) + beq $t0, 0, label_CONTINUE_128 + # GOTO label_FALSE_123 + j label_FALSE_123 + label_CONTINUE_128: + # LOCAL local_i2c_at_A2I_internal_15 --> -64($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_16 --> -68($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -68($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_129: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_130 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_129 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_130: + # Store result + sw $a2, -64($fp) + # IF_ZERO local_i2c_at_A2I_internal_15 GOTO label_TRUE_124 + # IF_ZERO local_i2c_at_A2I_internal_15 GOTO label_TRUE_124 + lw $t0, -64($fp) + beq $t0, 0, label_TRUE_124 + label_FALSE_123: + # LOCAL local_i2c_at_A2I_internal_14 --> -60($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -60($fp) + # GOTO label_END_125 +j label_END_125 +label_TRUE_124: + # LOCAL local_i2c_at_A2I_internal_14 --> -60($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -60($fp) + label_END_125: +# LOCAL local_i2c_at_A2I_internal_12 --> -52($fp) +# LOCAL local_i2c_at_A2I_internal_14 --> -60($fp) +# Obtain value from -60($fp) +lw $v0, -60($fp) +lw $v0, 12($v0) +sw $v0, -52($fp) +# IF_ZERO local_i2c_at_A2I_internal_12 GOTO label_FALSEIF_121 +# IF_ZERO local_i2c_at_A2I_internal_12 GOTO label_FALSEIF_121 +lw $t0, -52($fp) +beq $t0, 0, label_FALSEIF_121 +# LOCAL local_i2c_at_A2I_internal_17 --> -72($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_16 +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +sw $v0, -72($fp) +# LOCAL local_i2c_at_A2I_internal_13 --> -56($fp) +# LOCAL local_i2c_at_A2I_internal_17 --> -72($fp) +# local_i2c_at_A2I_internal_13 = local_i2c_at_A2I_internal_17 +lw $t0, -72($fp) +sw $t0, -56($fp) +# GOTO label_ENDIF_122 +j label_ENDIF_122 +label_FALSEIF_121: + # LOCAL local_i2c_at_A2I_internal_22 --> -92($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 3 + sw $t0, 12($v0) + sw $v0, -92($fp) + # IF_ZERO param_i2c_at_A2I_i_0 GOTO label_FALSE_133 + # IF_ZERO param_i2c_at_A2I_i_0 GOTO label_FALSE_133 + lw $t0, 0($fp) + beq $t0, 0, label_FALSE_133 + # IF_ZERO local_i2c_at_A2I_internal_22 GOTO label_FALSE_133 + # IF_ZERO local_i2c_at_A2I_internal_22 GOTO label_FALSE_133 + lw $t0, -92($fp) + beq $t0, 0, label_FALSE_133 + # LOCAL local_i2c_at_A2I_internal_21 --> -88($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with String + la $v0, String + lw $a0, 0($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -88($fp) + # IF_ZERO local_i2c_at_A2I_internal_21 GOTO label_COMPARE_STRING_136 + # IF_ZERO local_i2c_at_A2I_internal_21 GOTO label_COMPARE_STRING_136 + lw $t0, -88($fp) + beq $t0, 0, label_COMPARE_STRING_136 + # LOCAL local_i2c_at_A2I_internal_21 --> -88($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with Bool + la $v0, Bool + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -88($fp) + # IF_ZERO local_i2c_at_A2I_internal_21 GOTO label_COMPARE_BY_VALUE_137 + # IF_ZERO local_i2c_at_A2I_internal_21 GOTO label_COMPARE_BY_VALUE_137 + lw $t0, -88($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_137 + # LOCAL local_i2c_at_A2I_internal_21 --> -88($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with Int + la $v0, Int + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -88($fp) + # IF_ZERO local_i2c_at_A2I_internal_21 GOTO label_COMPARE_BY_VALUE_137 + # IF_ZERO local_i2c_at_A2I_internal_21 GOTO label_COMPARE_BY_VALUE_137 + lw $t0, -88($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_137 + # LOCAL local_i2c_at_A2I_internal_21 --> -88($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_22 --> -92($fp) + # Load pointers and SUB + lw $a0, 0($fp) + lw $a1, -92($fp) + sub $a0, $a0, $a1 + sw $a0, -88($fp) + # IF_ZERO local_i2c_at_A2I_internal_21 GOTO label_TRUE_134 + # IF_ZERO local_i2c_at_A2I_internal_21 GOTO label_TRUE_134 + lw $t0, -88($fp) + beq $t0, 0, label_TRUE_134 + # GOTO label_FALSE_133 + j label_FALSE_133 + label_COMPARE_BY_VALUE_137: + # LOCAL local_i2c_at_A2I_internal_21 --> -88($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_22 --> -92($fp) + lw $a0, 0($fp) + lw $a1, -92($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -88($fp) + # IF_ZERO local_i2c_at_A2I_internal_21 GOTO label_TRUE_134 + # IF_ZERO local_i2c_at_A2I_internal_21 GOTO label_TRUE_134 + lw $t0, -88($fp) + beq $t0, 0, label_TRUE_134 + # GOTO label_FALSE_133 + j label_FALSE_133 + label_COMPARE_STRING_136: + # LOCAL local_i2c_at_A2I_internal_21 --> -88($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_22 --> -92($fp) + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -92($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -88($fp) + # IF_ZERO local_i2c_at_A2I_internal_21 GOTO label_CONTINUE_138 + # IF_ZERO local_i2c_at_A2I_internal_21 GOTO label_CONTINUE_138 + lw $t0, -88($fp) + beq $t0, 0, label_CONTINUE_138 + # GOTO label_FALSE_133 + j label_FALSE_133 + label_CONTINUE_138: + # LOCAL local_i2c_at_A2I_internal_21 --> -88($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_22 --> -92($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -92($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_139: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_140 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_139 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_140: + # Store result + sw $a2, -88($fp) + # IF_ZERO local_i2c_at_A2I_internal_21 GOTO label_TRUE_134 + # IF_ZERO local_i2c_at_A2I_internal_21 GOTO label_TRUE_134 + lw $t0, -88($fp) + beq $t0, 0, label_TRUE_134 + label_FALSE_133: + # LOCAL local_i2c_at_A2I_internal_20 --> -84($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -84($fp) + # GOTO label_END_135 +j label_END_135 +label_TRUE_134: + # LOCAL local_i2c_at_A2I_internal_20 --> -84($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -84($fp) + label_END_135: +# LOCAL local_i2c_at_A2I_internal_18 --> -76($fp) +# LOCAL local_i2c_at_A2I_internal_20 --> -84($fp) +# Obtain value from -84($fp) +lw $v0, -84($fp) +lw $v0, 12($v0) +sw $v0, -76($fp) +# IF_ZERO local_i2c_at_A2I_internal_18 GOTO label_FALSEIF_131 +# IF_ZERO local_i2c_at_A2I_internal_18 GOTO label_FALSEIF_131 +lw $t0, -76($fp) +beq $t0, 0, label_FALSEIF_131 +# LOCAL local_i2c_at_A2I_internal_23 --> -96($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_17 +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +sw $v0, -96($fp) +# LOCAL local_i2c_at_A2I_internal_19 --> -80($fp) +# LOCAL local_i2c_at_A2I_internal_23 --> -96($fp) +# local_i2c_at_A2I_internal_19 = local_i2c_at_A2I_internal_23 +lw $t0, -96($fp) +sw $t0, -80($fp) +# GOTO label_ENDIF_132 +j label_ENDIF_132 +label_FALSEIF_131: + # LOCAL local_i2c_at_A2I_internal_28 --> -116($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 4 + sw $t0, 12($v0) + sw $v0, -116($fp) + # IF_ZERO param_i2c_at_A2I_i_0 GOTO label_FALSE_143 + # IF_ZERO param_i2c_at_A2I_i_0 GOTO label_FALSE_143 + lw $t0, 0($fp) + beq $t0, 0, label_FALSE_143 + # IF_ZERO local_i2c_at_A2I_internal_28 GOTO label_FALSE_143 + # IF_ZERO local_i2c_at_A2I_internal_28 GOTO label_FALSE_143 + lw $t0, -116($fp) + beq $t0, 0, label_FALSE_143 + # LOCAL local_i2c_at_A2I_internal_27 --> -112($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with String + la $v0, String + lw $a0, 0($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -112($fp) + # IF_ZERO local_i2c_at_A2I_internal_27 GOTO label_COMPARE_STRING_146 + # IF_ZERO local_i2c_at_A2I_internal_27 GOTO label_COMPARE_STRING_146 + lw $t0, -112($fp) + beq $t0, 0, label_COMPARE_STRING_146 + # LOCAL local_i2c_at_A2I_internal_27 --> -112($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with Bool + la $v0, Bool + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -112($fp) + # IF_ZERO local_i2c_at_A2I_internal_27 GOTO label_COMPARE_BY_VALUE_147 + # IF_ZERO local_i2c_at_A2I_internal_27 GOTO label_COMPARE_BY_VALUE_147 + lw $t0, -112($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_147 + # LOCAL local_i2c_at_A2I_internal_27 --> -112($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with Int + la $v0, Int + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -112($fp) + # IF_ZERO local_i2c_at_A2I_internal_27 GOTO label_COMPARE_BY_VALUE_147 + # IF_ZERO local_i2c_at_A2I_internal_27 GOTO label_COMPARE_BY_VALUE_147 + lw $t0, -112($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_147 + # LOCAL local_i2c_at_A2I_internal_27 --> -112($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_28 --> -116($fp) + # Load pointers and SUB + lw $a0, 0($fp) + lw $a1, -116($fp) + sub $a0, $a0, $a1 + sw $a0, -112($fp) + # IF_ZERO local_i2c_at_A2I_internal_27 GOTO label_TRUE_144 + # IF_ZERO local_i2c_at_A2I_internal_27 GOTO label_TRUE_144 + lw $t0, -112($fp) + beq $t0, 0, label_TRUE_144 + # GOTO label_FALSE_143 + j label_FALSE_143 + label_COMPARE_BY_VALUE_147: + # LOCAL local_i2c_at_A2I_internal_27 --> -112($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_28 --> -116($fp) + lw $a0, 0($fp) + lw $a1, -116($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -112($fp) + # IF_ZERO local_i2c_at_A2I_internal_27 GOTO label_TRUE_144 + # IF_ZERO local_i2c_at_A2I_internal_27 GOTO label_TRUE_144 + lw $t0, -112($fp) + beq $t0, 0, label_TRUE_144 + # GOTO label_FALSE_143 + j label_FALSE_143 + label_COMPARE_STRING_146: + # LOCAL local_i2c_at_A2I_internal_27 --> -112($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_28 --> -116($fp) + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -116($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -112($fp) + # IF_ZERO local_i2c_at_A2I_internal_27 GOTO label_CONTINUE_148 + # IF_ZERO local_i2c_at_A2I_internal_27 GOTO label_CONTINUE_148 + lw $t0, -112($fp) + beq $t0, 0, label_CONTINUE_148 + # GOTO label_FALSE_143 + j label_FALSE_143 + label_CONTINUE_148: + # LOCAL local_i2c_at_A2I_internal_27 --> -112($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_28 --> -116($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -116($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_149: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_150 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_149 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_150: + # Store result + sw $a2, -112($fp) + # IF_ZERO local_i2c_at_A2I_internal_27 GOTO label_TRUE_144 + # IF_ZERO local_i2c_at_A2I_internal_27 GOTO label_TRUE_144 + lw $t0, -112($fp) + beq $t0, 0, label_TRUE_144 + label_FALSE_143: + # LOCAL local_i2c_at_A2I_internal_26 --> -108($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -108($fp) + # GOTO label_END_145 +j label_END_145 +label_TRUE_144: + # LOCAL local_i2c_at_A2I_internal_26 --> -108($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -108($fp) + label_END_145: +# LOCAL local_i2c_at_A2I_internal_24 --> -100($fp) +# LOCAL local_i2c_at_A2I_internal_26 --> -108($fp) +# Obtain value from -108($fp) +lw $v0, -108($fp) +lw $v0, 12($v0) +sw $v0, -100($fp) +# IF_ZERO local_i2c_at_A2I_internal_24 GOTO label_FALSEIF_141 +# IF_ZERO local_i2c_at_A2I_internal_24 GOTO label_FALSEIF_141 +lw $t0, -100($fp) +beq $t0, 0, label_FALSEIF_141 +# LOCAL local_i2c_at_A2I_internal_29 --> -120($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_18 +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +sw $v0, -120($fp) +# LOCAL local_i2c_at_A2I_internal_25 --> -104($fp) +# LOCAL local_i2c_at_A2I_internal_29 --> -120($fp) +# local_i2c_at_A2I_internal_25 = local_i2c_at_A2I_internal_29 +lw $t0, -120($fp) +sw $t0, -104($fp) +# GOTO label_ENDIF_142 +j label_ENDIF_142 +label_FALSEIF_141: + # LOCAL local_i2c_at_A2I_internal_34 --> -140($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 5 + sw $t0, 12($v0) + sw $v0, -140($fp) + # IF_ZERO param_i2c_at_A2I_i_0 GOTO label_FALSE_153 + # IF_ZERO param_i2c_at_A2I_i_0 GOTO label_FALSE_153 + lw $t0, 0($fp) + beq $t0, 0, label_FALSE_153 + # IF_ZERO local_i2c_at_A2I_internal_34 GOTO label_FALSE_153 + # IF_ZERO local_i2c_at_A2I_internal_34 GOTO label_FALSE_153 + lw $t0, -140($fp) + beq $t0, 0, label_FALSE_153 + # LOCAL local_i2c_at_A2I_internal_33 --> -136($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with String + la $v0, String + lw $a0, 0($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -136($fp) + # IF_ZERO local_i2c_at_A2I_internal_33 GOTO label_COMPARE_STRING_156 + # IF_ZERO local_i2c_at_A2I_internal_33 GOTO label_COMPARE_STRING_156 + lw $t0, -136($fp) + beq $t0, 0, label_COMPARE_STRING_156 + # LOCAL local_i2c_at_A2I_internal_33 --> -136($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with Bool + la $v0, Bool + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -136($fp) + # IF_ZERO local_i2c_at_A2I_internal_33 GOTO label_COMPARE_BY_VALUE_157 + # IF_ZERO local_i2c_at_A2I_internal_33 GOTO label_COMPARE_BY_VALUE_157 + lw $t0, -136($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_157 + # LOCAL local_i2c_at_A2I_internal_33 --> -136($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with Int + la $v0, Int + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -136($fp) + # IF_ZERO local_i2c_at_A2I_internal_33 GOTO label_COMPARE_BY_VALUE_157 + # IF_ZERO local_i2c_at_A2I_internal_33 GOTO label_COMPARE_BY_VALUE_157 + lw $t0, -136($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_157 + # LOCAL local_i2c_at_A2I_internal_33 --> -136($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_34 --> -140($fp) + # Load pointers and SUB + lw $a0, 0($fp) + lw $a1, -140($fp) + sub $a0, $a0, $a1 + sw $a0, -136($fp) + # IF_ZERO local_i2c_at_A2I_internal_33 GOTO label_TRUE_154 + # IF_ZERO local_i2c_at_A2I_internal_33 GOTO label_TRUE_154 + lw $t0, -136($fp) + beq $t0, 0, label_TRUE_154 + # GOTO label_FALSE_153 + j label_FALSE_153 + label_COMPARE_BY_VALUE_157: + # LOCAL local_i2c_at_A2I_internal_33 --> -136($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_34 --> -140($fp) + lw $a0, 0($fp) + lw $a1, -140($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -136($fp) + # IF_ZERO local_i2c_at_A2I_internal_33 GOTO label_TRUE_154 + # IF_ZERO local_i2c_at_A2I_internal_33 GOTO label_TRUE_154 + lw $t0, -136($fp) + beq $t0, 0, label_TRUE_154 + # GOTO label_FALSE_153 + j label_FALSE_153 + label_COMPARE_STRING_156: + # LOCAL local_i2c_at_A2I_internal_33 --> -136($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_34 --> -140($fp) + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -140($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -136($fp) + # IF_ZERO local_i2c_at_A2I_internal_33 GOTO label_CONTINUE_158 + # IF_ZERO local_i2c_at_A2I_internal_33 GOTO label_CONTINUE_158 + lw $t0, -136($fp) + beq $t0, 0, label_CONTINUE_158 + # GOTO label_FALSE_153 + j label_FALSE_153 + label_CONTINUE_158: + # LOCAL local_i2c_at_A2I_internal_33 --> -136($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_34 --> -140($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -140($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_159: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_160 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_159 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_160: + # Store result + sw $a2, -136($fp) + # IF_ZERO local_i2c_at_A2I_internal_33 GOTO label_TRUE_154 + # IF_ZERO local_i2c_at_A2I_internal_33 GOTO label_TRUE_154 + lw $t0, -136($fp) + beq $t0, 0, label_TRUE_154 + label_FALSE_153: + # LOCAL local_i2c_at_A2I_internal_32 --> -132($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -132($fp) + # GOTO label_END_155 +j label_END_155 +label_TRUE_154: + # LOCAL local_i2c_at_A2I_internal_32 --> -132($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -132($fp) + label_END_155: +# LOCAL local_i2c_at_A2I_internal_30 --> -124($fp) +# LOCAL local_i2c_at_A2I_internal_32 --> -132($fp) +# Obtain value from -132($fp) +lw $v0, -132($fp) +lw $v0, 12($v0) +sw $v0, -124($fp) +# IF_ZERO local_i2c_at_A2I_internal_30 GOTO label_FALSEIF_151 +# IF_ZERO local_i2c_at_A2I_internal_30 GOTO label_FALSEIF_151 +lw $t0, -124($fp) +beq $t0, 0, label_FALSEIF_151 +# LOCAL local_i2c_at_A2I_internal_35 --> -144($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_19 +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +sw $v0, -144($fp) +# LOCAL local_i2c_at_A2I_internal_31 --> -128($fp) +# LOCAL local_i2c_at_A2I_internal_35 --> -144($fp) +# local_i2c_at_A2I_internal_31 = local_i2c_at_A2I_internal_35 +lw $t0, -144($fp) +sw $t0, -128($fp) +# GOTO label_ENDIF_152 +j label_ENDIF_152 +label_FALSEIF_151: + # LOCAL local_i2c_at_A2I_internal_40 --> -164($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 6 + sw $t0, 12($v0) + sw $v0, -164($fp) + # IF_ZERO param_i2c_at_A2I_i_0 GOTO label_FALSE_163 + # IF_ZERO param_i2c_at_A2I_i_0 GOTO label_FALSE_163 + lw $t0, 0($fp) + beq $t0, 0, label_FALSE_163 + # IF_ZERO local_i2c_at_A2I_internal_40 GOTO label_FALSE_163 + # IF_ZERO local_i2c_at_A2I_internal_40 GOTO label_FALSE_163 + lw $t0, -164($fp) + beq $t0, 0, label_FALSE_163 + # LOCAL local_i2c_at_A2I_internal_39 --> -160($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with String + la $v0, String + lw $a0, 0($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -160($fp) + # IF_ZERO local_i2c_at_A2I_internal_39 GOTO label_COMPARE_STRING_166 + # IF_ZERO local_i2c_at_A2I_internal_39 GOTO label_COMPARE_STRING_166 + lw $t0, -160($fp) + beq $t0, 0, label_COMPARE_STRING_166 + # LOCAL local_i2c_at_A2I_internal_39 --> -160($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with Bool + la $v0, Bool + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -160($fp) + # IF_ZERO local_i2c_at_A2I_internal_39 GOTO label_COMPARE_BY_VALUE_167 + # IF_ZERO local_i2c_at_A2I_internal_39 GOTO label_COMPARE_BY_VALUE_167 + lw $t0, -160($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_167 + # LOCAL local_i2c_at_A2I_internal_39 --> -160($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with Int + la $v0, Int + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -160($fp) + # IF_ZERO local_i2c_at_A2I_internal_39 GOTO label_COMPARE_BY_VALUE_167 + # IF_ZERO local_i2c_at_A2I_internal_39 GOTO label_COMPARE_BY_VALUE_167 + lw $t0, -160($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_167 + # LOCAL local_i2c_at_A2I_internal_39 --> -160($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_40 --> -164($fp) + # Load pointers and SUB + lw $a0, 0($fp) + lw $a1, -164($fp) + sub $a0, $a0, $a1 + sw $a0, -160($fp) + # IF_ZERO local_i2c_at_A2I_internal_39 GOTO label_TRUE_164 + # IF_ZERO local_i2c_at_A2I_internal_39 GOTO label_TRUE_164 + lw $t0, -160($fp) + beq $t0, 0, label_TRUE_164 + # GOTO label_FALSE_163 + j label_FALSE_163 + label_COMPARE_BY_VALUE_167: + # LOCAL local_i2c_at_A2I_internal_39 --> -160($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_40 --> -164($fp) + lw $a0, 0($fp) + lw $a1, -164($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -160($fp) + # IF_ZERO local_i2c_at_A2I_internal_39 GOTO label_TRUE_164 + # IF_ZERO local_i2c_at_A2I_internal_39 GOTO label_TRUE_164 + lw $t0, -160($fp) + beq $t0, 0, label_TRUE_164 + # GOTO label_FALSE_163 + j label_FALSE_163 + label_COMPARE_STRING_166: + # LOCAL local_i2c_at_A2I_internal_39 --> -160($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_40 --> -164($fp) + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -164($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -160($fp) + # IF_ZERO local_i2c_at_A2I_internal_39 GOTO label_CONTINUE_168 + # IF_ZERO local_i2c_at_A2I_internal_39 GOTO label_CONTINUE_168 + lw $t0, -160($fp) + beq $t0, 0, label_CONTINUE_168 + # GOTO label_FALSE_163 + j label_FALSE_163 + label_CONTINUE_168: + # LOCAL local_i2c_at_A2I_internal_39 --> -160($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_40 --> -164($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -164($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_169: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_170 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_169 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_170: + # Store result + sw $a2, -160($fp) + # IF_ZERO local_i2c_at_A2I_internal_39 GOTO label_TRUE_164 + # IF_ZERO local_i2c_at_A2I_internal_39 GOTO label_TRUE_164 + lw $t0, -160($fp) + beq $t0, 0, label_TRUE_164 + label_FALSE_163: + # LOCAL local_i2c_at_A2I_internal_38 --> -156($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -156($fp) + # GOTO label_END_165 +j label_END_165 +label_TRUE_164: + # LOCAL local_i2c_at_A2I_internal_38 --> -156($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -156($fp) + label_END_165: +# LOCAL local_i2c_at_A2I_internal_36 --> -148($fp) +# LOCAL local_i2c_at_A2I_internal_38 --> -156($fp) +# Obtain value from -156($fp) +lw $v0, -156($fp) +lw $v0, 12($v0) +sw $v0, -148($fp) +# IF_ZERO local_i2c_at_A2I_internal_36 GOTO label_FALSEIF_161 +# IF_ZERO local_i2c_at_A2I_internal_36 GOTO label_FALSEIF_161 +lw $t0, -148($fp) +beq $t0, 0, label_FALSEIF_161 +# LOCAL local_i2c_at_A2I_internal_41 --> -168($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_20 +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +sw $v0, -168($fp) +# LOCAL local_i2c_at_A2I_internal_37 --> -152($fp) +# LOCAL local_i2c_at_A2I_internal_41 --> -168($fp) +# local_i2c_at_A2I_internal_37 = local_i2c_at_A2I_internal_41 +lw $t0, -168($fp) +sw $t0, -152($fp) +# GOTO label_ENDIF_162 +j label_ENDIF_162 +label_FALSEIF_161: + # LOCAL local_i2c_at_A2I_internal_46 --> -188($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 7 + sw $t0, 12($v0) + sw $v0, -188($fp) + # IF_ZERO param_i2c_at_A2I_i_0 GOTO label_FALSE_173 + # IF_ZERO param_i2c_at_A2I_i_0 GOTO label_FALSE_173 + lw $t0, 0($fp) + beq $t0, 0, label_FALSE_173 + # IF_ZERO local_i2c_at_A2I_internal_46 GOTO label_FALSE_173 + # IF_ZERO local_i2c_at_A2I_internal_46 GOTO label_FALSE_173 + lw $t0, -188($fp) + beq $t0, 0, label_FALSE_173 + # LOCAL local_i2c_at_A2I_internal_45 --> -184($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with String + la $v0, String + lw $a0, 0($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -184($fp) + # IF_ZERO local_i2c_at_A2I_internal_45 GOTO label_COMPARE_STRING_176 + # IF_ZERO local_i2c_at_A2I_internal_45 GOTO label_COMPARE_STRING_176 + lw $t0, -184($fp) + beq $t0, 0, label_COMPARE_STRING_176 + # LOCAL local_i2c_at_A2I_internal_45 --> -184($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with Bool + la $v0, Bool + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -184($fp) + # IF_ZERO local_i2c_at_A2I_internal_45 GOTO label_COMPARE_BY_VALUE_177 + # IF_ZERO local_i2c_at_A2I_internal_45 GOTO label_COMPARE_BY_VALUE_177 + lw $t0, -184($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_177 + # LOCAL local_i2c_at_A2I_internal_45 --> -184($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with Int + la $v0, Int + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -184($fp) + # IF_ZERO local_i2c_at_A2I_internal_45 GOTO label_COMPARE_BY_VALUE_177 + # IF_ZERO local_i2c_at_A2I_internal_45 GOTO label_COMPARE_BY_VALUE_177 + lw $t0, -184($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_177 + # LOCAL local_i2c_at_A2I_internal_45 --> -184($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_46 --> -188($fp) + # Load pointers and SUB + lw $a0, 0($fp) + lw $a1, -188($fp) + sub $a0, $a0, $a1 + sw $a0, -184($fp) + # IF_ZERO local_i2c_at_A2I_internal_45 GOTO label_TRUE_174 + # IF_ZERO local_i2c_at_A2I_internal_45 GOTO label_TRUE_174 + lw $t0, -184($fp) + beq $t0, 0, label_TRUE_174 + # GOTO label_FALSE_173 + j label_FALSE_173 + label_COMPARE_BY_VALUE_177: + # LOCAL local_i2c_at_A2I_internal_45 --> -184($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_46 --> -188($fp) + lw $a0, 0($fp) + lw $a1, -188($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -184($fp) + # IF_ZERO local_i2c_at_A2I_internal_45 GOTO label_TRUE_174 + # IF_ZERO local_i2c_at_A2I_internal_45 GOTO label_TRUE_174 + lw $t0, -184($fp) + beq $t0, 0, label_TRUE_174 + # GOTO label_FALSE_173 + j label_FALSE_173 + label_COMPARE_STRING_176: + # LOCAL local_i2c_at_A2I_internal_45 --> -184($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_46 --> -188($fp) + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -188($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -184($fp) + # IF_ZERO local_i2c_at_A2I_internal_45 GOTO label_CONTINUE_178 + # IF_ZERO local_i2c_at_A2I_internal_45 GOTO label_CONTINUE_178 + lw $t0, -184($fp) + beq $t0, 0, label_CONTINUE_178 + # GOTO label_FALSE_173 + j label_FALSE_173 + label_CONTINUE_178: + # LOCAL local_i2c_at_A2I_internal_45 --> -184($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_46 --> -188($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -188($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_179: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_180 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_179 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_180: + # Store result + sw $a2, -184($fp) + # IF_ZERO local_i2c_at_A2I_internal_45 GOTO label_TRUE_174 + # IF_ZERO local_i2c_at_A2I_internal_45 GOTO label_TRUE_174 + lw $t0, -184($fp) + beq $t0, 0, label_TRUE_174 + label_FALSE_173: + # LOCAL local_i2c_at_A2I_internal_44 --> -180($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -180($fp) + # GOTO label_END_175 +j label_END_175 +label_TRUE_174: + # LOCAL local_i2c_at_A2I_internal_44 --> -180($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -180($fp) + label_END_175: +# LOCAL local_i2c_at_A2I_internal_42 --> -172($fp) +# LOCAL local_i2c_at_A2I_internal_44 --> -180($fp) +# Obtain value from -180($fp) +lw $v0, -180($fp) +lw $v0, 12($v0) +sw $v0, -172($fp) +# IF_ZERO local_i2c_at_A2I_internal_42 GOTO label_FALSEIF_171 +# IF_ZERO local_i2c_at_A2I_internal_42 GOTO label_FALSEIF_171 +lw $t0, -172($fp) +beq $t0, 0, label_FALSEIF_171 +# LOCAL local_i2c_at_A2I_internal_47 --> -192($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_21 +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +sw $v0, -192($fp) +# LOCAL local_i2c_at_A2I_internal_43 --> -176($fp) +# LOCAL local_i2c_at_A2I_internal_47 --> -192($fp) +# local_i2c_at_A2I_internal_43 = local_i2c_at_A2I_internal_47 +lw $t0, -192($fp) +sw $t0, -176($fp) +# GOTO label_ENDIF_172 +j label_ENDIF_172 +label_FALSEIF_171: + # LOCAL local_i2c_at_A2I_internal_52 --> -212($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 8 + sw $t0, 12($v0) + sw $v0, -212($fp) + # IF_ZERO param_i2c_at_A2I_i_0 GOTO label_FALSE_183 + # IF_ZERO param_i2c_at_A2I_i_0 GOTO label_FALSE_183 + lw $t0, 0($fp) + beq $t0, 0, label_FALSE_183 + # IF_ZERO local_i2c_at_A2I_internal_52 GOTO label_FALSE_183 + # IF_ZERO local_i2c_at_A2I_internal_52 GOTO label_FALSE_183 + lw $t0, -212($fp) + beq $t0, 0, label_FALSE_183 + # LOCAL local_i2c_at_A2I_internal_51 --> -208($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with String + la $v0, String + lw $a0, 0($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -208($fp) + # IF_ZERO local_i2c_at_A2I_internal_51 GOTO label_COMPARE_STRING_186 + # IF_ZERO local_i2c_at_A2I_internal_51 GOTO label_COMPARE_STRING_186 + lw $t0, -208($fp) + beq $t0, 0, label_COMPARE_STRING_186 + # LOCAL local_i2c_at_A2I_internal_51 --> -208($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with Bool + la $v0, Bool + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -208($fp) + # IF_ZERO local_i2c_at_A2I_internal_51 GOTO label_COMPARE_BY_VALUE_187 + # IF_ZERO local_i2c_at_A2I_internal_51 GOTO label_COMPARE_BY_VALUE_187 + lw $t0, -208($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_187 + # LOCAL local_i2c_at_A2I_internal_51 --> -208($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with Int + la $v0, Int + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -208($fp) + # IF_ZERO local_i2c_at_A2I_internal_51 GOTO label_COMPARE_BY_VALUE_187 + # IF_ZERO local_i2c_at_A2I_internal_51 GOTO label_COMPARE_BY_VALUE_187 + lw $t0, -208($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_187 + # LOCAL local_i2c_at_A2I_internal_51 --> -208($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_52 --> -212($fp) + # Load pointers and SUB + lw $a0, 0($fp) + lw $a1, -212($fp) + sub $a0, $a0, $a1 + sw $a0, -208($fp) + # IF_ZERO local_i2c_at_A2I_internal_51 GOTO label_TRUE_184 + # IF_ZERO local_i2c_at_A2I_internal_51 GOTO label_TRUE_184 + lw $t0, -208($fp) + beq $t0, 0, label_TRUE_184 + # GOTO label_FALSE_183 + j label_FALSE_183 + label_COMPARE_BY_VALUE_187: + # LOCAL local_i2c_at_A2I_internal_51 --> -208($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_52 --> -212($fp) + lw $a0, 0($fp) + lw $a1, -212($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -208($fp) + # IF_ZERO local_i2c_at_A2I_internal_51 GOTO label_TRUE_184 + # IF_ZERO local_i2c_at_A2I_internal_51 GOTO label_TRUE_184 + lw $t0, -208($fp) + beq $t0, 0, label_TRUE_184 + # GOTO label_FALSE_183 + j label_FALSE_183 + label_COMPARE_STRING_186: + # LOCAL local_i2c_at_A2I_internal_51 --> -208($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_52 --> -212($fp) + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -212($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -208($fp) + # IF_ZERO local_i2c_at_A2I_internal_51 GOTO label_CONTINUE_188 + # IF_ZERO local_i2c_at_A2I_internal_51 GOTO label_CONTINUE_188 + lw $t0, -208($fp) + beq $t0, 0, label_CONTINUE_188 + # GOTO label_FALSE_183 + j label_FALSE_183 + label_CONTINUE_188: + # LOCAL local_i2c_at_A2I_internal_51 --> -208($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_52 --> -212($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -212($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_189: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_190 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_189 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_190: + # Store result + sw $a2, -208($fp) + # IF_ZERO local_i2c_at_A2I_internal_51 GOTO label_TRUE_184 + # IF_ZERO local_i2c_at_A2I_internal_51 GOTO label_TRUE_184 + lw $t0, -208($fp) + beq $t0, 0, label_TRUE_184 + label_FALSE_183: + # LOCAL local_i2c_at_A2I_internal_50 --> -204($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -204($fp) + # GOTO label_END_185 +j label_END_185 +label_TRUE_184: + # LOCAL local_i2c_at_A2I_internal_50 --> -204($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -204($fp) + label_END_185: +# LOCAL local_i2c_at_A2I_internal_48 --> -196($fp) +# LOCAL local_i2c_at_A2I_internal_50 --> -204($fp) +# Obtain value from -204($fp) +lw $v0, -204($fp) +lw $v0, 12($v0) +sw $v0, -196($fp) +# IF_ZERO local_i2c_at_A2I_internal_48 GOTO label_FALSEIF_181 +# IF_ZERO local_i2c_at_A2I_internal_48 GOTO label_FALSEIF_181 +lw $t0, -196($fp) +beq $t0, 0, label_FALSEIF_181 +# LOCAL local_i2c_at_A2I_internal_53 --> -216($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_22 +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +sw $v0, -216($fp) +# LOCAL local_i2c_at_A2I_internal_49 --> -200($fp) +# LOCAL local_i2c_at_A2I_internal_53 --> -216($fp) +# local_i2c_at_A2I_internal_49 = local_i2c_at_A2I_internal_53 +lw $t0, -216($fp) +sw $t0, -200($fp) +# GOTO label_ENDIF_182 +j label_ENDIF_182 +label_FALSEIF_181: + # LOCAL local_i2c_at_A2I_internal_58 --> -236($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 9 + sw $t0, 12($v0) + sw $v0, -236($fp) + # IF_ZERO param_i2c_at_A2I_i_0 GOTO label_FALSE_193 + # IF_ZERO param_i2c_at_A2I_i_0 GOTO label_FALSE_193 + lw $t0, 0($fp) + beq $t0, 0, label_FALSE_193 + # IF_ZERO local_i2c_at_A2I_internal_58 GOTO label_FALSE_193 + # IF_ZERO local_i2c_at_A2I_internal_58 GOTO label_FALSE_193 + lw $t0, -236($fp) + beq $t0, 0, label_FALSE_193 + # LOCAL local_i2c_at_A2I_internal_57 --> -232($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with String + la $v0, String + lw $a0, 0($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -232($fp) + # IF_ZERO local_i2c_at_A2I_internal_57 GOTO label_COMPARE_STRING_196 + # IF_ZERO local_i2c_at_A2I_internal_57 GOTO label_COMPARE_STRING_196 + lw $t0, -232($fp) + beq $t0, 0, label_COMPARE_STRING_196 + # LOCAL local_i2c_at_A2I_internal_57 --> -232($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with Bool + la $v0, Bool + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -232($fp) + # IF_ZERO local_i2c_at_A2I_internal_57 GOTO label_COMPARE_BY_VALUE_197 + # IF_ZERO local_i2c_at_A2I_internal_57 GOTO label_COMPARE_BY_VALUE_197 + lw $t0, -232($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_197 + # LOCAL local_i2c_at_A2I_internal_57 --> -232($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with Int + la $v0, Int + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -232($fp) + # IF_ZERO local_i2c_at_A2I_internal_57 GOTO label_COMPARE_BY_VALUE_197 + # IF_ZERO local_i2c_at_A2I_internal_57 GOTO label_COMPARE_BY_VALUE_197 + lw $t0, -232($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_197 + # LOCAL local_i2c_at_A2I_internal_57 --> -232($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_58 --> -236($fp) + # Load pointers and SUB + lw $a0, 0($fp) + lw $a1, -236($fp) + sub $a0, $a0, $a1 + sw $a0, -232($fp) + # IF_ZERO local_i2c_at_A2I_internal_57 GOTO label_TRUE_194 + # IF_ZERO local_i2c_at_A2I_internal_57 GOTO label_TRUE_194 + lw $t0, -232($fp) + beq $t0, 0, label_TRUE_194 + # GOTO label_FALSE_193 + j label_FALSE_193 + label_COMPARE_BY_VALUE_197: + # LOCAL local_i2c_at_A2I_internal_57 --> -232($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_58 --> -236($fp) + lw $a0, 0($fp) + lw $a1, -236($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -232($fp) + # IF_ZERO local_i2c_at_A2I_internal_57 GOTO label_TRUE_194 + # IF_ZERO local_i2c_at_A2I_internal_57 GOTO label_TRUE_194 + lw $t0, -232($fp) + beq $t0, 0, label_TRUE_194 + # GOTO label_FALSE_193 + j label_FALSE_193 + label_COMPARE_STRING_196: + # LOCAL local_i2c_at_A2I_internal_57 --> -232($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_58 --> -236($fp) + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -236($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -232($fp) + # IF_ZERO local_i2c_at_A2I_internal_57 GOTO label_CONTINUE_198 + # IF_ZERO local_i2c_at_A2I_internal_57 GOTO label_CONTINUE_198 + lw $t0, -232($fp) + beq $t0, 0, label_CONTINUE_198 + # GOTO label_FALSE_193 + j label_FALSE_193 + label_CONTINUE_198: + # LOCAL local_i2c_at_A2I_internal_57 --> -232($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_58 --> -236($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -236($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_199: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_200 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_199 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_200: + # Store result + sw $a2, -232($fp) + # IF_ZERO local_i2c_at_A2I_internal_57 GOTO label_TRUE_194 + # IF_ZERO local_i2c_at_A2I_internal_57 GOTO label_TRUE_194 + lw $t0, -232($fp) + beq $t0, 0, label_TRUE_194 + label_FALSE_193: + # LOCAL local_i2c_at_A2I_internal_56 --> -228($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -228($fp) + # GOTO label_END_195 +j label_END_195 +label_TRUE_194: + # LOCAL local_i2c_at_A2I_internal_56 --> -228($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -228($fp) + label_END_195: +# LOCAL local_i2c_at_A2I_internal_54 --> -220($fp) +# LOCAL local_i2c_at_A2I_internal_56 --> -228($fp) +# Obtain value from -228($fp) +lw $v0, -228($fp) +lw $v0, 12($v0) +sw $v0, -220($fp) +# IF_ZERO local_i2c_at_A2I_internal_54 GOTO label_FALSEIF_191 +# IF_ZERO local_i2c_at_A2I_internal_54 GOTO label_FALSEIF_191 +lw $t0, -220($fp) +beq $t0, 0, label_FALSEIF_191 +# LOCAL local_i2c_at_A2I_internal_59 --> -240($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_23 +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +sw $v0, -240($fp) +# LOCAL local_i2c_at_A2I_internal_55 --> -224($fp) +# LOCAL local_i2c_at_A2I_internal_59 --> -240($fp) +# local_i2c_at_A2I_internal_55 = local_i2c_at_A2I_internal_59 +lw $t0, -240($fp) +sw $t0, -224($fp) +# GOTO label_ENDIF_192 +j label_ENDIF_192 +label_FALSEIF_191: + # LOCAL local_i2c_at_A2I_internal_62 --> -252($fp) + # local_i2c_at_A2I_internal_62 = SELF + sw $s1, -252($fp) + # LOCAL local_i2c_at_A2I_internal_60 --> -244($fp) + # LOCAL local_i2c_at_A2I_internal_62 --> -252($fp) + # local_i2c_at_A2I_internal_60 = local_i2c_at_A2I_internal_62 + lw $t0, -252($fp) + sw $t0, -244($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_i2c_at_A2I_internal_60 --> -244($fp) + # LOCAL local_i2c_at_A2I_internal_61 --> -248($fp) + # local_i2c_at_A2I_internal_61 = VCALL local_i2c_at_A2I_internal_60 abort + # Save new self pointer in $s1 + lw $s1, -244($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 84($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -248($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_i2c_at_A2I_internal_63 --> -256($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_24 + sw $t0, 12($v0) + li $t0, 0 + sw $t0, 16($v0) + sw $v0, -256($fp) + # LOCAL local_i2c_at_A2I_internal_55 --> -224($fp) + # LOCAL local_i2c_at_A2I_internal_63 --> -256($fp) + # local_i2c_at_A2I_internal_55 = local_i2c_at_A2I_internal_63 + lw $t0, -256($fp) + sw $t0, -224($fp) + label_ENDIF_192: +# LOCAL local_i2c_at_A2I_internal_49 --> -200($fp) +# LOCAL local_i2c_at_A2I_internal_55 --> -224($fp) +# local_i2c_at_A2I_internal_49 = local_i2c_at_A2I_internal_55 +lw $t0, -224($fp) +sw $t0, -200($fp) +label_ENDIF_182: +# LOCAL local_i2c_at_A2I_internal_43 --> -176($fp) +# LOCAL local_i2c_at_A2I_internal_49 --> -200($fp) +# local_i2c_at_A2I_internal_43 = local_i2c_at_A2I_internal_49 +lw $t0, -200($fp) +sw $t0, -176($fp) +label_ENDIF_172: +# LOCAL local_i2c_at_A2I_internal_37 --> -152($fp) +# LOCAL local_i2c_at_A2I_internal_43 --> -176($fp) +# local_i2c_at_A2I_internal_37 = local_i2c_at_A2I_internal_43 +lw $t0, -176($fp) +sw $t0, -152($fp) +label_ENDIF_162: +# LOCAL local_i2c_at_A2I_internal_31 --> -128($fp) +# LOCAL local_i2c_at_A2I_internal_37 --> -152($fp) +# local_i2c_at_A2I_internal_31 = local_i2c_at_A2I_internal_37 +lw $t0, -152($fp) +sw $t0, -128($fp) +label_ENDIF_152: +# LOCAL local_i2c_at_A2I_internal_25 --> -104($fp) +# LOCAL local_i2c_at_A2I_internal_31 --> -128($fp) +# local_i2c_at_A2I_internal_25 = local_i2c_at_A2I_internal_31 +lw $t0, -128($fp) +sw $t0, -104($fp) +label_ENDIF_142: +# LOCAL local_i2c_at_A2I_internal_19 --> -80($fp) +# LOCAL local_i2c_at_A2I_internal_25 --> -104($fp) +# local_i2c_at_A2I_internal_19 = local_i2c_at_A2I_internal_25 +lw $t0, -104($fp) +sw $t0, -80($fp) +label_ENDIF_132: +# LOCAL local_i2c_at_A2I_internal_13 --> -56($fp) +# LOCAL local_i2c_at_A2I_internal_19 --> -80($fp) +# local_i2c_at_A2I_internal_13 = local_i2c_at_A2I_internal_19 +lw $t0, -80($fp) +sw $t0, -56($fp) +label_ENDIF_122: +# LOCAL local_i2c_at_A2I_internal_7 --> -32($fp) +# LOCAL local_i2c_at_A2I_internal_13 --> -56($fp) +# local_i2c_at_A2I_internal_7 = local_i2c_at_A2I_internal_13 +lw $t0, -56($fp) +sw $t0, -32($fp) +label_ENDIF_112: +# LOCAL local_i2c_at_A2I_internal_1 --> -8($fp) +# LOCAL local_i2c_at_A2I_internal_7 --> -32($fp) +# local_i2c_at_A2I_internal_1 = local_i2c_at_A2I_internal_7 +lw $t0, -32($fp) +sw $t0, -8($fp) +label_ENDIF_102: +# RETURN local_i2c_at_A2I_internal_1 +lw $v0, -8($fp) +# Deallocate stack frame for function function_i2c_at_A2I. +# Restore $ra +lw $ra, 4($sp) +# Restore $fp +lw $fp, 0($sp) +# Restore Stack pointer $sp +addu $sp, $sp, 264 +# Deallocate function args +addu $sp, $sp, 4 +jr $ra +# Function END + + +# function_a2i_at_A2I implementation. +# @Params: +# 0($fp) = param_a2i_at_A2I_s_0 +function_a2i_at_A2I: + # Allocate stack frame for function function_a2i_at_A2I. + subu $sp, $sp, 208 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 208 + # LOCAL local_a2i_at_A2I_internal_4 --> -20($fp) + # PARAM param_a2i_at_A2I_s_0 --> 0($fp) + # local_a2i_at_A2I_internal_4 = PARAM param_a2i_at_A2I_s_0 + lw $t0, 0($fp) + sw $t0, -20($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_a2i_at_A2I_internal_4 --> -20($fp) + # LOCAL local_a2i_at_A2I_internal_5 --> -24($fp) + # local_a2i_at_A2I_internal_5 = VCALL local_a2i_at_A2I_internal_4 length + # Save new self pointer in $s1 + lw $s1, -20($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 40($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -24($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_a2i_at_A2I_internal_6 --> -28($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -28($fp) + # IF_ZERO local_a2i_at_A2I_internal_5 GOTO label_FALSE_203 + # IF_ZERO local_a2i_at_A2I_internal_5 GOTO label_FALSE_203 + lw $t0, -24($fp) + beq $t0, 0, label_FALSE_203 + # IF_ZERO local_a2i_at_A2I_internal_6 GOTO label_FALSE_203 + # IF_ZERO local_a2i_at_A2I_internal_6 GOTO label_FALSE_203 + lw $t0, -28($fp) + beq $t0, 0, label_FALSE_203 + # LOCAL local_a2i_at_A2I_internal_3 --> -16($fp) + # LOCAL local_a2i_at_A2I_internal_5 --> -24($fp) + # Comparing -24($fp) type with String + la $v0, String + lw $a0, -24($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -16($fp) + # IF_ZERO local_a2i_at_A2I_internal_3 GOTO label_COMPARE_STRING_206 + # IF_ZERO local_a2i_at_A2I_internal_3 GOTO label_COMPARE_STRING_206 + lw $t0, -16($fp) + beq $t0, 0, label_COMPARE_STRING_206 + # LOCAL local_a2i_at_A2I_internal_3 --> -16($fp) + # LOCAL local_a2i_at_A2I_internal_5 --> -24($fp) + # Comparing -24($fp) type with Bool + la $v0, Bool + lw $a0, -24($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -16($fp) + # IF_ZERO local_a2i_at_A2I_internal_3 GOTO label_COMPARE_BY_VALUE_207 + # IF_ZERO local_a2i_at_A2I_internal_3 GOTO label_COMPARE_BY_VALUE_207 + lw $t0, -16($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_207 + # LOCAL local_a2i_at_A2I_internal_3 --> -16($fp) + # LOCAL local_a2i_at_A2I_internal_5 --> -24($fp) + # Comparing -24($fp) type with Int + la $v0, Int + lw $a0, -24($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -16($fp) + # IF_ZERO local_a2i_at_A2I_internal_3 GOTO label_COMPARE_BY_VALUE_207 + # IF_ZERO local_a2i_at_A2I_internal_3 GOTO label_COMPARE_BY_VALUE_207 + lw $t0, -16($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_207 + # LOCAL local_a2i_at_A2I_internal_3 --> -16($fp) + # LOCAL local_a2i_at_A2I_internal_5 --> -24($fp) + # LOCAL local_a2i_at_A2I_internal_6 --> -28($fp) + # Load pointers and SUB + lw $a0, -24($fp) + lw $a1, -28($fp) + sub $a0, $a0, $a1 + sw $a0, -16($fp) + # IF_ZERO local_a2i_at_A2I_internal_3 GOTO label_TRUE_204 + # IF_ZERO local_a2i_at_A2I_internal_3 GOTO label_TRUE_204 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_204 + # GOTO label_FALSE_203 + j label_FALSE_203 + label_COMPARE_BY_VALUE_207: + # LOCAL local_a2i_at_A2I_internal_3 --> -16($fp) + # LOCAL local_a2i_at_A2I_internal_5 --> -24($fp) + # LOCAL local_a2i_at_A2I_internal_6 --> -28($fp) + lw $a0, -24($fp) + lw $a1, -28($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -16($fp) + # IF_ZERO local_a2i_at_A2I_internal_3 GOTO label_TRUE_204 + # IF_ZERO local_a2i_at_A2I_internal_3 GOTO label_TRUE_204 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_204 + # GOTO label_FALSE_203 + j label_FALSE_203 + label_COMPARE_STRING_206: + # LOCAL local_a2i_at_A2I_internal_3 --> -16($fp) + # LOCAL local_a2i_at_A2I_internal_5 --> -24($fp) + # LOCAL local_a2i_at_A2I_internal_6 --> -28($fp) + # Load strings for comparison + lw $v0, -24($fp) + lw $v1, -28($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -16($fp) + # IF_ZERO local_a2i_at_A2I_internal_3 GOTO label_CONTINUE_208 + # IF_ZERO local_a2i_at_A2I_internal_3 GOTO label_CONTINUE_208 + lw $t0, -16($fp) + beq $t0, 0, label_CONTINUE_208 + # GOTO label_FALSE_203 + j label_FALSE_203 + label_CONTINUE_208: + # LOCAL local_a2i_at_A2I_internal_3 --> -16($fp) + # LOCAL local_a2i_at_A2I_internal_5 --> -24($fp) + # LOCAL local_a2i_at_A2I_internal_6 --> -28($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -24($fp) + lw $v1, -28($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_209: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_210 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_209 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_210: + # Store result + sw $a2, -16($fp) + # IF_ZERO local_a2i_at_A2I_internal_3 GOTO label_TRUE_204 + # IF_ZERO local_a2i_at_A2I_internal_3 GOTO label_TRUE_204 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_204 + label_FALSE_203: + # LOCAL local_a2i_at_A2I_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -12($fp) + # GOTO label_END_205 +j label_END_205 +label_TRUE_204: + # LOCAL local_a2i_at_A2I_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -12($fp) + label_END_205: +# LOCAL local_a2i_at_A2I_internal_0 --> -4($fp) +# LOCAL local_a2i_at_A2I_internal_2 --> -12($fp) +# Obtain value from -12($fp) +lw $v0, -12($fp) +lw $v0, 12($v0) +sw $v0, -4($fp) +# IF_ZERO local_a2i_at_A2I_internal_0 GOTO label_FALSEIF_201 +# IF_ZERO local_a2i_at_A2I_internal_0 GOTO label_FALSEIF_201 +lw $t0, -4($fp) +beq $t0, 0, label_FALSEIF_201 +# LOCAL local_a2i_at_A2I_internal_7 --> -32($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 0 +sw $t0, 12($v0) +sw $v0, -32($fp) +# LOCAL local_a2i_at_A2I_internal_1 --> -8($fp) +# LOCAL local_a2i_at_A2I_internal_7 --> -32($fp) +# local_a2i_at_A2I_internal_1 = local_a2i_at_A2I_internal_7 +lw $t0, -32($fp) +sw $t0, -8($fp) +# GOTO label_ENDIF_202 +j label_ENDIF_202 +label_FALSEIF_201: + # LOCAL local_a2i_at_A2I_internal_12 --> -52($fp) + # PARAM param_a2i_at_A2I_s_0 --> 0($fp) + # local_a2i_at_A2I_internal_12 = PARAM param_a2i_at_A2I_s_0 + lw $t0, 0($fp) + sw $t0, -52($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_a2i_at_A2I_internal_14 --> -60($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -60($fp) + # ARG local_a2i_at_A2I_internal_14 + # LOCAL local_a2i_at_A2I_internal_14 --> -60($fp) + lw $t0, -60($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_a2i_at_A2I_internal_15 --> -64($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -64($fp) + # ARG local_a2i_at_A2I_internal_15 + # LOCAL local_a2i_at_A2I_internal_15 --> -64($fp) + lw $t0, -64($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_a2i_at_A2I_internal_12 --> -52($fp) + # LOCAL local_a2i_at_A2I_internal_13 --> -56($fp) + # local_a2i_at_A2I_internal_13 = VCALL local_a2i_at_A2I_internal_12 substr + # Save new self pointer in $s1 + lw $s1, -52($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 108($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -56($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_a2i_at_A2I_internal_16 --> -68($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_25 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -68($fp) + # IF_ZERO local_a2i_at_A2I_internal_13 GOTO label_FALSE_213 + # IF_ZERO local_a2i_at_A2I_internal_13 GOTO label_FALSE_213 + lw $t0, -56($fp) + beq $t0, 0, label_FALSE_213 + # IF_ZERO local_a2i_at_A2I_internal_16 GOTO label_FALSE_213 + # IF_ZERO local_a2i_at_A2I_internal_16 GOTO label_FALSE_213 + lw $t0, -68($fp) + beq $t0, 0, label_FALSE_213 + # LOCAL local_a2i_at_A2I_internal_11 --> -48($fp) + # LOCAL local_a2i_at_A2I_internal_13 --> -56($fp) + # Comparing -56($fp) type with String + la $v0, String + lw $a0, -56($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -48($fp) + # IF_ZERO local_a2i_at_A2I_internal_11 GOTO label_COMPARE_STRING_216 + # IF_ZERO local_a2i_at_A2I_internal_11 GOTO label_COMPARE_STRING_216 + lw $t0, -48($fp) + beq $t0, 0, label_COMPARE_STRING_216 + # LOCAL local_a2i_at_A2I_internal_11 --> -48($fp) + # LOCAL local_a2i_at_A2I_internal_13 --> -56($fp) + # Comparing -56($fp) type with Bool + la $v0, Bool + lw $a0, -56($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -48($fp) + # IF_ZERO local_a2i_at_A2I_internal_11 GOTO label_COMPARE_BY_VALUE_217 + # IF_ZERO local_a2i_at_A2I_internal_11 GOTO label_COMPARE_BY_VALUE_217 + lw $t0, -48($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_217 + # LOCAL local_a2i_at_A2I_internal_11 --> -48($fp) + # LOCAL local_a2i_at_A2I_internal_13 --> -56($fp) + # Comparing -56($fp) type with Int + la $v0, Int + lw $a0, -56($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -48($fp) + # IF_ZERO local_a2i_at_A2I_internal_11 GOTO label_COMPARE_BY_VALUE_217 + # IF_ZERO local_a2i_at_A2I_internal_11 GOTO label_COMPARE_BY_VALUE_217 + lw $t0, -48($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_217 + # LOCAL local_a2i_at_A2I_internal_11 --> -48($fp) + # LOCAL local_a2i_at_A2I_internal_13 --> -56($fp) + # LOCAL local_a2i_at_A2I_internal_16 --> -68($fp) + # Load pointers and SUB + lw $a0, -56($fp) + lw $a1, -68($fp) + sub $a0, $a0, $a1 + sw $a0, -48($fp) + # IF_ZERO local_a2i_at_A2I_internal_11 GOTO label_TRUE_214 + # IF_ZERO local_a2i_at_A2I_internal_11 GOTO label_TRUE_214 + lw $t0, -48($fp) + beq $t0, 0, label_TRUE_214 + # GOTO label_FALSE_213 + j label_FALSE_213 + label_COMPARE_BY_VALUE_217: + # LOCAL local_a2i_at_A2I_internal_11 --> -48($fp) + # LOCAL local_a2i_at_A2I_internal_13 --> -56($fp) + # LOCAL local_a2i_at_A2I_internal_16 --> -68($fp) + lw $a0, -56($fp) + lw $a1, -68($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -48($fp) + # IF_ZERO local_a2i_at_A2I_internal_11 GOTO label_TRUE_214 + # IF_ZERO local_a2i_at_A2I_internal_11 GOTO label_TRUE_214 + lw $t0, -48($fp) + beq $t0, 0, label_TRUE_214 + # GOTO label_FALSE_213 + j label_FALSE_213 + label_COMPARE_STRING_216: + # LOCAL local_a2i_at_A2I_internal_11 --> -48($fp) + # LOCAL local_a2i_at_A2I_internal_13 --> -56($fp) + # LOCAL local_a2i_at_A2I_internal_16 --> -68($fp) + # Load strings for comparison + lw $v0, -56($fp) + lw $v1, -68($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -48($fp) + # IF_ZERO local_a2i_at_A2I_internal_11 GOTO label_CONTINUE_218 + # IF_ZERO local_a2i_at_A2I_internal_11 GOTO label_CONTINUE_218 + lw $t0, -48($fp) + beq $t0, 0, label_CONTINUE_218 + # GOTO label_FALSE_213 + j label_FALSE_213 + label_CONTINUE_218: + # LOCAL local_a2i_at_A2I_internal_11 --> -48($fp) + # LOCAL local_a2i_at_A2I_internal_13 --> -56($fp) + # LOCAL local_a2i_at_A2I_internal_16 --> -68($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -56($fp) + lw $v1, -68($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_219: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_220 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_219 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_220: + # Store result + sw $a2, -48($fp) + # IF_ZERO local_a2i_at_A2I_internal_11 GOTO label_TRUE_214 + # IF_ZERO local_a2i_at_A2I_internal_11 GOTO label_TRUE_214 + lw $t0, -48($fp) + beq $t0, 0, label_TRUE_214 + label_FALSE_213: + # LOCAL local_a2i_at_A2I_internal_10 --> -44($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -44($fp) + # GOTO label_END_215 +j label_END_215 +label_TRUE_214: + # LOCAL local_a2i_at_A2I_internal_10 --> -44($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -44($fp) + label_END_215: +# LOCAL local_a2i_at_A2I_internal_8 --> -36($fp) +# LOCAL local_a2i_at_A2I_internal_10 --> -44($fp) +# Obtain value from -44($fp) +lw $v0, -44($fp) +lw $v0, 12($v0) +sw $v0, -36($fp) +# IF_ZERO local_a2i_at_A2I_internal_8 GOTO label_FALSEIF_211 +# IF_ZERO local_a2i_at_A2I_internal_8 GOTO label_FALSEIF_211 +lw $t0, -36($fp) +beq $t0, 0, label_FALSEIF_211 +# LOCAL local_a2i_at_A2I_internal_20 --> -84($fp) +# local_a2i_at_A2I_internal_20 = SELF +sw $s1, -84($fp) +# LOCAL local_a2i_at_A2I_internal_18 --> -76($fp) +# LOCAL local_a2i_at_A2I_internal_20 --> -84($fp) +# local_a2i_at_A2I_internal_18 = local_a2i_at_A2I_internal_20 +lw $t0, -84($fp) +sw $t0, -76($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_a2i_at_A2I_internal_21 --> -88($fp) +# PARAM param_a2i_at_A2I_s_0 --> 0($fp) +# local_a2i_at_A2I_internal_21 = PARAM param_a2i_at_A2I_s_0 +lw $t0, 0($fp) +sw $t0, -88($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_a2i_at_A2I_internal_23 --> -96($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 1 +sw $t0, 12($v0) +sw $v0, -96($fp) +# ARG local_a2i_at_A2I_internal_23 +# LOCAL local_a2i_at_A2I_internal_23 --> -96($fp) +lw $t0, -96($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_a2i_at_A2I_internal_25 --> -104($fp) +# PARAM param_a2i_at_A2I_s_0 --> 0($fp) +# local_a2i_at_A2I_internal_25 = PARAM param_a2i_at_A2I_s_0 +lw $t0, 0($fp) +sw $t0, -104($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_a2i_at_A2I_internal_25 --> -104($fp) +# LOCAL local_a2i_at_A2I_internal_26 --> -108($fp) +# local_a2i_at_A2I_internal_26 = VCALL local_a2i_at_A2I_internal_25 length +# Save new self pointer in $s1 +lw $s1, -104($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 40($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -108($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_a2i_at_A2I_internal_27 --> -112($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 1 +sw $t0, 12($v0) +sw $v0, -112($fp) +# LOCAL local_a2i_at_A2I_internal_24 --> -100($fp) +# LOCAL local_a2i_at_A2I_internal_26 --> -108($fp) +# LOCAL local_a2i_at_A2I_internal_27 --> -112($fp) +# local_a2i_at_A2I_internal_24 = local_a2i_at_A2I_internal_26 - local_a2i_at_A2I_internal_27 +lw $t1, -108($fp) +lw $t0, 12($t1) +lw $t1, -112($fp) +lw $t2, 12($t1) +sub $t0, $t0, $t2 +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t1, String +sw $t1, 0($v0) +la $t1, String_start +sw $t1, 4($v0) +# Load type offset +li $t1, 8 +sw $t1, 8($v0) +la $t1, Int +sw $t1, 12($v0) +li $t1, 3 +sw $t1, 16($v0) +move $t1, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t1, 0($v0) +la $t1, Int_start +sw $t1, 4($v0) +# Load type offset +li $t1, 16 +sw $t1, 8($v0) +sw $t0, 12($v0) +sw $v0, -100($fp) +# ARG local_a2i_at_A2I_internal_24 +# LOCAL local_a2i_at_A2I_internal_24 --> -100($fp) +lw $t0, -100($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_a2i_at_A2I_internal_21 --> -88($fp) +# LOCAL local_a2i_at_A2I_internal_22 --> -92($fp) +# local_a2i_at_A2I_internal_22 = VCALL local_a2i_at_A2I_internal_21 substr +# Save new self pointer in $s1 +lw $s1, -88($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 108($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -92($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# ARG local_a2i_at_A2I_internal_22 +# LOCAL local_a2i_at_A2I_internal_22 --> -92($fp) +lw $t0, -92($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_a2i_at_A2I_internal_18 --> -76($fp) +# LOCAL local_a2i_at_A2I_internal_19 --> -80($fp) +# local_a2i_at_A2I_internal_19 = VCALL local_a2i_at_A2I_internal_18 a2i_aux +# Save new self pointer in $s1 +lw $s1, -76($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 96($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -80($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_a2i_at_A2I_internal_17 --> -72($fp) +# LOCAL local_a2i_at_A2I_internal_19 --> -80($fp) +lw $t0, -80($fp) +lw $t0, 12($t0) +not $t0, $t0 +add $t0, $t0, 1 +sw $t0, -72($fp) +# LOCAL local_a2i_at_A2I_internal_17 --> -72($fp) +# LOCAL local_a2i_at_A2I_internal_17 --> -72($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +lw $t0, -72($fp) +sw $t0, 12($v0) +sw $v0, -72($fp) +# LOCAL local_a2i_at_A2I_internal_9 --> -40($fp) +# LOCAL local_a2i_at_A2I_internal_17 --> -72($fp) +# local_a2i_at_A2I_internal_9 = local_a2i_at_A2I_internal_17 +lw $t0, -72($fp) +sw $t0, -40($fp) +# GOTO label_ENDIF_212 +j label_ENDIF_212 +label_FALSEIF_211: + # LOCAL local_a2i_at_A2I_internal_32 --> -132($fp) + # PARAM param_a2i_at_A2I_s_0 --> 0($fp) + # local_a2i_at_A2I_internal_32 = PARAM param_a2i_at_A2I_s_0 + lw $t0, 0($fp) + sw $t0, -132($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_a2i_at_A2I_internal_34 --> -140($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -140($fp) + # ARG local_a2i_at_A2I_internal_34 + # LOCAL local_a2i_at_A2I_internal_34 --> -140($fp) + lw $t0, -140($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_a2i_at_A2I_internal_35 --> -144($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -144($fp) + # ARG local_a2i_at_A2I_internal_35 + # LOCAL local_a2i_at_A2I_internal_35 --> -144($fp) + lw $t0, -144($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_a2i_at_A2I_internal_32 --> -132($fp) + # LOCAL local_a2i_at_A2I_internal_33 --> -136($fp) + # local_a2i_at_A2I_internal_33 = VCALL local_a2i_at_A2I_internal_32 substr + # Save new self pointer in $s1 + lw $s1, -132($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 108($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -136($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_a2i_at_A2I_internal_36 --> -148($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_26 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -148($fp) + # IF_ZERO local_a2i_at_A2I_internal_33 GOTO label_FALSE_223 + # IF_ZERO local_a2i_at_A2I_internal_33 GOTO label_FALSE_223 + lw $t0, -136($fp) + beq $t0, 0, label_FALSE_223 + # IF_ZERO local_a2i_at_A2I_internal_36 GOTO label_FALSE_223 + # IF_ZERO local_a2i_at_A2I_internal_36 GOTO label_FALSE_223 + lw $t0, -148($fp) + beq $t0, 0, label_FALSE_223 + # LOCAL local_a2i_at_A2I_internal_31 --> -128($fp) + # LOCAL local_a2i_at_A2I_internal_33 --> -136($fp) + # Comparing -136($fp) type with String + la $v0, String + lw $a0, -136($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -128($fp) + # IF_ZERO local_a2i_at_A2I_internal_31 GOTO label_COMPARE_STRING_226 + # IF_ZERO local_a2i_at_A2I_internal_31 GOTO label_COMPARE_STRING_226 + lw $t0, -128($fp) + beq $t0, 0, label_COMPARE_STRING_226 + # LOCAL local_a2i_at_A2I_internal_31 --> -128($fp) + # LOCAL local_a2i_at_A2I_internal_33 --> -136($fp) + # Comparing -136($fp) type with Bool + la $v0, Bool + lw $a0, -136($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -128($fp) + # IF_ZERO local_a2i_at_A2I_internal_31 GOTO label_COMPARE_BY_VALUE_227 + # IF_ZERO local_a2i_at_A2I_internal_31 GOTO label_COMPARE_BY_VALUE_227 + lw $t0, -128($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_227 + # LOCAL local_a2i_at_A2I_internal_31 --> -128($fp) + # LOCAL local_a2i_at_A2I_internal_33 --> -136($fp) + # Comparing -136($fp) type with Int + la $v0, Int + lw $a0, -136($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -128($fp) + # IF_ZERO local_a2i_at_A2I_internal_31 GOTO label_COMPARE_BY_VALUE_227 + # IF_ZERO local_a2i_at_A2I_internal_31 GOTO label_COMPARE_BY_VALUE_227 + lw $t0, -128($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_227 + # LOCAL local_a2i_at_A2I_internal_31 --> -128($fp) + # LOCAL local_a2i_at_A2I_internal_33 --> -136($fp) + # LOCAL local_a2i_at_A2I_internal_36 --> -148($fp) + # Load pointers and SUB + lw $a0, -136($fp) + lw $a1, -148($fp) + sub $a0, $a0, $a1 + sw $a0, -128($fp) + # IF_ZERO local_a2i_at_A2I_internal_31 GOTO label_TRUE_224 + # IF_ZERO local_a2i_at_A2I_internal_31 GOTO label_TRUE_224 + lw $t0, -128($fp) + beq $t0, 0, label_TRUE_224 + # GOTO label_FALSE_223 + j label_FALSE_223 + label_COMPARE_BY_VALUE_227: + # LOCAL local_a2i_at_A2I_internal_31 --> -128($fp) + # LOCAL local_a2i_at_A2I_internal_33 --> -136($fp) + # LOCAL local_a2i_at_A2I_internal_36 --> -148($fp) + lw $a0, -136($fp) + lw $a1, -148($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -128($fp) + # IF_ZERO local_a2i_at_A2I_internal_31 GOTO label_TRUE_224 + # IF_ZERO local_a2i_at_A2I_internal_31 GOTO label_TRUE_224 + lw $t0, -128($fp) + beq $t0, 0, label_TRUE_224 + # GOTO label_FALSE_223 + j label_FALSE_223 + label_COMPARE_STRING_226: + # LOCAL local_a2i_at_A2I_internal_31 --> -128($fp) + # LOCAL local_a2i_at_A2I_internal_33 --> -136($fp) + # LOCAL local_a2i_at_A2I_internal_36 --> -148($fp) + # Load strings for comparison + lw $v0, -136($fp) + lw $v1, -148($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -128($fp) + # IF_ZERO local_a2i_at_A2I_internal_31 GOTO label_CONTINUE_228 + # IF_ZERO local_a2i_at_A2I_internal_31 GOTO label_CONTINUE_228 + lw $t0, -128($fp) + beq $t0, 0, label_CONTINUE_228 + # GOTO label_FALSE_223 + j label_FALSE_223 + label_CONTINUE_228: + # LOCAL local_a2i_at_A2I_internal_31 --> -128($fp) + # LOCAL local_a2i_at_A2I_internal_33 --> -136($fp) + # LOCAL local_a2i_at_A2I_internal_36 --> -148($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -136($fp) + lw $v1, -148($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_229: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_230 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_229 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_230: + # Store result + sw $a2, -128($fp) + # IF_ZERO local_a2i_at_A2I_internal_31 GOTO label_TRUE_224 + # IF_ZERO local_a2i_at_A2I_internal_31 GOTO label_TRUE_224 + lw $t0, -128($fp) + beq $t0, 0, label_TRUE_224 + label_FALSE_223: + # LOCAL local_a2i_at_A2I_internal_30 --> -124($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -124($fp) + # GOTO label_END_225 +j label_END_225 +label_TRUE_224: + # LOCAL local_a2i_at_A2I_internal_30 --> -124($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -124($fp) + label_END_225: +# LOCAL local_a2i_at_A2I_internal_28 --> -116($fp) +# LOCAL local_a2i_at_A2I_internal_30 --> -124($fp) +# Obtain value from -124($fp) +lw $v0, -124($fp) +lw $v0, 12($v0) +sw $v0, -116($fp) +# IF_ZERO local_a2i_at_A2I_internal_28 GOTO label_FALSEIF_221 +# IF_ZERO local_a2i_at_A2I_internal_28 GOTO label_FALSEIF_221 +lw $t0, -116($fp) +beq $t0, 0, label_FALSEIF_221 +# LOCAL local_a2i_at_A2I_internal_39 --> -160($fp) +# local_a2i_at_A2I_internal_39 = SELF +sw $s1, -160($fp) +# LOCAL local_a2i_at_A2I_internal_37 --> -152($fp) +# LOCAL local_a2i_at_A2I_internal_39 --> -160($fp) +# local_a2i_at_A2I_internal_37 = local_a2i_at_A2I_internal_39 +lw $t0, -160($fp) +sw $t0, -152($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_a2i_at_A2I_internal_40 --> -164($fp) +# PARAM param_a2i_at_A2I_s_0 --> 0($fp) +# local_a2i_at_A2I_internal_40 = PARAM param_a2i_at_A2I_s_0 +lw $t0, 0($fp) +sw $t0, -164($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_a2i_at_A2I_internal_42 --> -172($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 1 +sw $t0, 12($v0) +sw $v0, -172($fp) +# ARG local_a2i_at_A2I_internal_42 +# LOCAL local_a2i_at_A2I_internal_42 --> -172($fp) +lw $t0, -172($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_a2i_at_A2I_internal_44 --> -180($fp) +# PARAM param_a2i_at_A2I_s_0 --> 0($fp) +# local_a2i_at_A2I_internal_44 = PARAM param_a2i_at_A2I_s_0 +lw $t0, 0($fp) +sw $t0, -180($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_a2i_at_A2I_internal_44 --> -180($fp) +# LOCAL local_a2i_at_A2I_internal_45 --> -184($fp) +# local_a2i_at_A2I_internal_45 = VCALL local_a2i_at_A2I_internal_44 length +# Save new self pointer in $s1 +lw $s1, -180($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 40($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -184($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_a2i_at_A2I_internal_46 --> -188($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 1 +sw $t0, 12($v0) +sw $v0, -188($fp) +# LOCAL local_a2i_at_A2I_internal_43 --> -176($fp) +# LOCAL local_a2i_at_A2I_internal_45 --> -184($fp) +# LOCAL local_a2i_at_A2I_internal_46 --> -188($fp) +# local_a2i_at_A2I_internal_43 = local_a2i_at_A2I_internal_45 - local_a2i_at_A2I_internal_46 +lw $t1, -184($fp) +lw $t0, 12($t1) +lw $t1, -188($fp) +lw $t2, 12($t1) +sub $t0, $t0, $t2 +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t1, String +sw $t1, 0($v0) +la $t1, String_start +sw $t1, 4($v0) +# Load type offset +li $t1, 8 +sw $t1, 8($v0) +la $t1, Int +sw $t1, 12($v0) +li $t1, 3 +sw $t1, 16($v0) +move $t1, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t1, 0($v0) +la $t1, Int_start +sw $t1, 4($v0) +# Load type offset +li $t1, 16 +sw $t1, 8($v0) +sw $t0, 12($v0) +sw $v0, -176($fp) +# ARG local_a2i_at_A2I_internal_43 +# LOCAL local_a2i_at_A2I_internal_43 --> -176($fp) +lw $t0, -176($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_a2i_at_A2I_internal_40 --> -164($fp) +# LOCAL local_a2i_at_A2I_internal_41 --> -168($fp) +# local_a2i_at_A2I_internal_41 = VCALL local_a2i_at_A2I_internal_40 substr +# Save new self pointer in $s1 +lw $s1, -164($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 108($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -168($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# ARG local_a2i_at_A2I_internal_41 +# LOCAL local_a2i_at_A2I_internal_41 --> -168($fp) +lw $t0, -168($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_a2i_at_A2I_internal_37 --> -152($fp) +# LOCAL local_a2i_at_A2I_internal_38 --> -156($fp) +# local_a2i_at_A2I_internal_38 = VCALL local_a2i_at_A2I_internal_37 a2i_aux +# Save new self pointer in $s1 +lw $s1, -152($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 96($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -156($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_a2i_at_A2I_internal_29 --> -120($fp) +# LOCAL local_a2i_at_A2I_internal_38 --> -156($fp) +# local_a2i_at_A2I_internal_29 = local_a2i_at_A2I_internal_38 +lw $t0, -156($fp) +sw $t0, -120($fp) +# GOTO label_ENDIF_222 +j label_ENDIF_222 +label_FALSEIF_221: + # LOCAL local_a2i_at_A2I_internal_49 --> -200($fp) + # local_a2i_at_A2I_internal_49 = SELF + sw $s1, -200($fp) + # LOCAL local_a2i_at_A2I_internal_47 --> -192($fp) + # LOCAL local_a2i_at_A2I_internal_49 --> -200($fp) + # local_a2i_at_A2I_internal_47 = local_a2i_at_A2I_internal_49 + lw $t0, -200($fp) + sw $t0, -192($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # ARG param_a2i_at_A2I_s_0 + # PARAM param_a2i_at_A2I_s_0 --> 0($fp) + lw $t0, 0($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_a2i_at_A2I_internal_47 --> -192($fp) + # LOCAL local_a2i_at_A2I_internal_48 --> -196($fp) + # local_a2i_at_A2I_internal_48 = VCALL local_a2i_at_A2I_internal_47 a2i_aux + # Save new self pointer in $s1 + lw $s1, -192($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 96($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -196($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_a2i_at_A2I_internal_29 --> -120($fp) + # LOCAL local_a2i_at_A2I_internal_48 --> -196($fp) + # local_a2i_at_A2I_internal_29 = local_a2i_at_A2I_internal_48 + lw $t0, -196($fp) + sw $t0, -120($fp) + label_ENDIF_222: +# LOCAL local_a2i_at_A2I_internal_9 --> -40($fp) +# LOCAL local_a2i_at_A2I_internal_29 --> -120($fp) +# local_a2i_at_A2I_internal_9 = local_a2i_at_A2I_internal_29 +lw $t0, -120($fp) +sw $t0, -40($fp) +label_ENDIF_212: +# LOCAL local_a2i_at_A2I_internal_1 --> -8($fp) +# LOCAL local_a2i_at_A2I_internal_9 --> -40($fp) +# local_a2i_at_A2I_internal_1 = local_a2i_at_A2I_internal_9 +lw $t0, -40($fp) +sw $t0, -8($fp) +label_ENDIF_202: +# RETURN local_a2i_at_A2I_internal_1 +lw $v0, -8($fp) +# Deallocate stack frame for function function_a2i_at_A2I. +# Restore $ra +lw $ra, 4($sp) +# Restore $fp +lw $fp, 0($sp) +# Restore Stack pointer $sp +addu $sp, $sp, 208 +# Deallocate function args +addu $sp, $sp, 4 +jr $ra +# Function END + + +# function_a2i_aux_at_A2I implementation. +# @Params: +# 0($fp) = param_a2i_aux_at_A2I_s_0 +function_a2i_aux_at_A2I: + # Allocate stack frame for function function_a2i_aux_at_A2I. + subu $sp, $sp, 88 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 88 + # LOCAL local_a2i_aux_at_A2I_int_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -4($fp) + # LOCAL local_a2i_aux_at_A2I_internal_1 --> -8($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -8($fp) + # LOCAL local_a2i_aux_at_A2I_int_0 --> -4($fp) + # LOCAL local_a2i_aux_at_A2I_internal_1 --> -8($fp) + # local_a2i_aux_at_A2I_int_0 = local_a2i_aux_at_A2I_internal_1 + lw $t0, -8($fp) + sw $t0, -4($fp) + # LOCAL local_a2i_aux_at_A2I_j_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -12($fp) + # LOCAL local_a2i_aux_at_A2I_internal_3 --> -16($fp) + # PARAM param_a2i_aux_at_A2I_s_0 --> 0($fp) + # local_a2i_aux_at_A2I_internal_3 = PARAM param_a2i_aux_at_A2I_s_0 + lw $t0, 0($fp) + sw $t0, -16($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_a2i_aux_at_A2I_internal_3 --> -16($fp) + # LOCAL local_a2i_aux_at_A2I_internal_4 --> -20($fp) + # local_a2i_aux_at_A2I_internal_4 = VCALL local_a2i_aux_at_A2I_internal_3 length + # Save new self pointer in $s1 + lw $s1, -16($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 40($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -20($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_a2i_aux_at_A2I_j_2 --> -12($fp) + # LOCAL local_a2i_aux_at_A2I_internal_4 --> -20($fp) + # local_a2i_aux_at_A2I_j_2 = local_a2i_aux_at_A2I_internal_4 + lw $t0, -20($fp) + sw $t0, -12($fp) + # LOCAL local_a2i_aux_at_A2I_i_5 --> -24($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -24($fp) + # LOCAL local_a2i_aux_at_A2I_internal_6 --> -28($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -28($fp) + # LOCAL local_a2i_aux_at_A2I_i_5 --> -24($fp) + # LOCAL local_a2i_aux_at_A2I_internal_6 --> -28($fp) + # local_a2i_aux_at_A2I_i_5 = local_a2i_aux_at_A2I_internal_6 + lw $t0, -28($fp) + sw $t0, -24($fp) + label_WHILE_231: + # LOCAL local_a2i_aux_at_A2I_internal_8 --> -36($fp) + # LOCAL local_a2i_aux_at_A2I_i_5 --> -24($fp) + # LOCAL local_a2i_aux_at_A2I_j_2 --> -12($fp) + lw $a0, -24($fp) + lw $a1, -12($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -36($fp) + # IF_GREATER_ZERO local_a2i_aux_at_A2I_internal_8 GOTO label_FALSE_233 + # IF_GREATER_ZERO local_a2i_aux_at_A2I_internal_8 GOTO label_FALSE_233 + lw $t0, -36($fp) + bgt $t0, 0, label_FALSE_233 + # IF_ZERO local_a2i_aux_at_A2I_internal_8 GOTO label_FALSE_233 + # IF_ZERO local_a2i_aux_at_A2I_internal_8 GOTO label_FALSE_233 + lw $t0, -36($fp) + beq $t0, 0, label_FALSE_233 + # LOCAL local_a2i_aux_at_A2I_internal_8 --> -36($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -36($fp) + # GOTO label_END_234 +j label_END_234 +label_FALSE_233: + # LOCAL local_a2i_aux_at_A2I_internal_8 --> -36($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -36($fp) + label_END_234: +# LOCAL local_a2i_aux_at_A2I_internal_7 --> -32($fp) +# LOCAL local_a2i_aux_at_A2I_internal_8 --> -36($fp) +# Obtain value from -36($fp) +lw $v0, -36($fp) +lw $v0, 12($v0) +sw $v0, -32($fp) +# IF_ZERO local_a2i_aux_at_A2I_internal_7 GOTO label_WHILE_END_232 +# IF_ZERO local_a2i_aux_at_A2I_internal_7 GOTO label_WHILE_END_232 +lw $t0, -32($fp) +beq $t0, 0, label_WHILE_END_232 +# LOCAL local_a2i_aux_at_A2I_internal_11 --> -48($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 10 +sw $t0, 12($v0) +sw $v0, -48($fp) +# LOCAL local_a2i_aux_at_A2I_internal_10 --> -44($fp) +# LOCAL local_a2i_aux_at_A2I_int_0 --> -4($fp) +# LOCAL local_a2i_aux_at_A2I_internal_11 --> -48($fp) +# local_a2i_aux_at_A2I_internal_10 = local_a2i_aux_at_A2I_int_0 * local_a2i_aux_at_A2I_internal_11 +lw $t1, -4($fp) +lw $t0, 12($t1) +lw $t1, -48($fp) +lw $t2, 12($t1) +mul $t0, $t0, $t2 +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t1, String +sw $t1, 0($v0) +la $t1, String_start +sw $t1, 4($v0) +# Load type offset +li $t1, 8 +sw $t1, 8($v0) +la $t1, Int +sw $t1, 12($v0) +li $t1, 3 +sw $t1, 16($v0) +move $t1, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t1, 0($v0) +la $t1, Int_start +sw $t1, 4($v0) +# Load type offset +li $t1, 16 +sw $t1, 8($v0) +sw $t0, 12($v0) +sw $v0, -44($fp) +# LOCAL local_a2i_aux_at_A2I_internal_14 --> -60($fp) +# local_a2i_aux_at_A2I_internal_14 = SELF +sw $s1, -60($fp) +# LOCAL local_a2i_aux_at_A2I_internal_12 --> -52($fp) +# LOCAL local_a2i_aux_at_A2I_internal_14 --> -60($fp) +# local_a2i_aux_at_A2I_internal_12 = local_a2i_aux_at_A2I_internal_14 +lw $t0, -60($fp) +sw $t0, -52($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_a2i_aux_at_A2I_internal_15 --> -64($fp) +# PARAM param_a2i_aux_at_A2I_s_0 --> 0($fp) +# local_a2i_aux_at_A2I_internal_15 = PARAM param_a2i_aux_at_A2I_s_0 +lw $t0, 0($fp) +sw $t0, -64($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# ARG local_a2i_aux_at_A2I_i_5 +# LOCAL local_a2i_aux_at_A2I_i_5 --> -24($fp) +lw $t0, -24($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_a2i_aux_at_A2I_internal_17 --> -72($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 1 +sw $t0, 12($v0) +sw $v0, -72($fp) +# ARG local_a2i_aux_at_A2I_internal_17 +# LOCAL local_a2i_aux_at_A2I_internal_17 --> -72($fp) +lw $t0, -72($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_a2i_aux_at_A2I_internal_15 --> -64($fp) +# LOCAL local_a2i_aux_at_A2I_internal_16 --> -68($fp) +# local_a2i_aux_at_A2I_internal_16 = VCALL local_a2i_aux_at_A2I_internal_15 substr +# Save new self pointer in $s1 +lw $s1, -64($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 108($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -68($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# ARG local_a2i_aux_at_A2I_internal_16 +# LOCAL local_a2i_aux_at_A2I_internal_16 --> -68($fp) +lw $t0, -68($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_a2i_aux_at_A2I_internal_12 --> -52($fp) +# LOCAL local_a2i_aux_at_A2I_internal_13 --> -56($fp) +# local_a2i_aux_at_A2I_internal_13 = VCALL local_a2i_aux_at_A2I_internal_12 c2i +# Save new self pointer in $s1 +lw $s1, -52($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 92($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -56($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_a2i_aux_at_A2I_internal_9 --> -40($fp) +# LOCAL local_a2i_aux_at_A2I_internal_10 --> -44($fp) +# LOCAL local_a2i_aux_at_A2I_internal_13 --> -56($fp) +# local_a2i_aux_at_A2I_internal_9 = local_a2i_aux_at_A2I_internal_10 + local_a2i_aux_at_A2I_internal_13 +lw $t1, -44($fp) +lw $t0, 12($t1) +lw $t1, -56($fp) +lw $t2, 12($t1) +add $t0, $t0, $t2 +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t1, String +sw $t1, 0($v0) +la $t1, String_start +sw $t1, 4($v0) +# Load type offset +li $t1, 8 +sw $t1, 8($v0) +la $t1, Int +sw $t1, 12($v0) +li $t1, 3 +sw $t1, 16($v0) +move $t1, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t1, 0($v0) +la $t1, Int_start +sw $t1, 4($v0) +# Load type offset +li $t1, 16 +sw $t1, 8($v0) +sw $t0, 12($v0) +sw $v0, -40($fp) +# LOCAL local_a2i_aux_at_A2I_int_0 --> -4($fp) +# LOCAL local_a2i_aux_at_A2I_internal_9 --> -40($fp) +# local_a2i_aux_at_A2I_int_0 = local_a2i_aux_at_A2I_internal_9 +lw $t0, -40($fp) +sw $t0, -4($fp) +# LOCAL local_a2i_aux_at_A2I_internal_19 --> -80($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 1 +sw $t0, 12($v0) +sw $v0, -80($fp) +# LOCAL local_a2i_aux_at_A2I_internal_18 --> -76($fp) +# LOCAL local_a2i_aux_at_A2I_i_5 --> -24($fp) +# LOCAL local_a2i_aux_at_A2I_internal_19 --> -80($fp) +# local_a2i_aux_at_A2I_internal_18 = local_a2i_aux_at_A2I_i_5 + local_a2i_aux_at_A2I_internal_19 +lw $t1, -24($fp) +lw $t0, 12($t1) +lw $t1, -80($fp) +lw $t2, 12($t1) +add $t0, $t0, $t2 +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t1, String +sw $t1, 0($v0) +la $t1, String_start +sw $t1, 4($v0) +# Load type offset +li $t1, 8 +sw $t1, 8($v0) +la $t1, Int +sw $t1, 12($v0) +li $t1, 3 +sw $t1, 16($v0) +move $t1, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t1, 0($v0) +la $t1, Int_start +sw $t1, 4($v0) +# Load type offset +li $t1, 16 +sw $t1, 8($v0) +sw $t0, 12($v0) +sw $v0, -76($fp) +# LOCAL local_a2i_aux_at_A2I_i_5 --> -24($fp) +# LOCAL local_a2i_aux_at_A2I_internal_18 --> -76($fp) +# local_a2i_aux_at_A2I_i_5 = local_a2i_aux_at_A2I_internal_18 +lw $t0, -76($fp) +sw $t0, -24($fp) +# GOTO label_WHILE_231 +j label_WHILE_231 +label_WHILE_END_232: + # RETURN local_a2i_aux_at_A2I_int_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_a2i_aux_at_A2I. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 88 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_i2a_at_A2I implementation. +# @Params: +# 0($fp) = param_i2a_at_A2I_i_0 +function_i2a_at_A2I: + # Allocate stack frame for function function_i2a_at_A2I. + subu $sp, $sp, 96 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 96 + # LOCAL local_i2a_at_A2I_internal_4 --> -20($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -20($fp) + # IF_ZERO param_i2a_at_A2I_i_0 GOTO label_FALSE_237 + # IF_ZERO param_i2a_at_A2I_i_0 GOTO label_FALSE_237 + lw $t0, 0($fp) + beq $t0, 0, label_FALSE_237 + # IF_ZERO local_i2a_at_A2I_internal_4 GOTO label_FALSE_237 + # IF_ZERO local_i2a_at_A2I_internal_4 GOTO label_FALSE_237 + lw $t0, -20($fp) + beq $t0, 0, label_FALSE_237 + # LOCAL local_i2a_at_A2I_internal_3 --> -16($fp) + # PARAM param_i2a_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with String + la $v0, String + lw $a0, 0($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -16($fp) + # IF_ZERO local_i2a_at_A2I_internal_3 GOTO label_COMPARE_STRING_240 + # IF_ZERO local_i2a_at_A2I_internal_3 GOTO label_COMPARE_STRING_240 + lw $t0, -16($fp) + beq $t0, 0, label_COMPARE_STRING_240 + # LOCAL local_i2a_at_A2I_internal_3 --> -16($fp) + # PARAM param_i2a_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with Bool + la $v0, Bool + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -16($fp) + # IF_ZERO local_i2a_at_A2I_internal_3 GOTO label_COMPARE_BY_VALUE_241 + # IF_ZERO local_i2a_at_A2I_internal_3 GOTO label_COMPARE_BY_VALUE_241 + lw $t0, -16($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_241 + # LOCAL local_i2a_at_A2I_internal_3 --> -16($fp) + # PARAM param_i2a_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with Int + la $v0, Int + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -16($fp) + # IF_ZERO local_i2a_at_A2I_internal_3 GOTO label_COMPARE_BY_VALUE_241 + # IF_ZERO local_i2a_at_A2I_internal_3 GOTO label_COMPARE_BY_VALUE_241 + lw $t0, -16($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_241 + # LOCAL local_i2a_at_A2I_internal_3 --> -16($fp) + # PARAM param_i2a_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2a_at_A2I_internal_4 --> -20($fp) + # Load pointers and SUB + lw $a0, 0($fp) + lw $a1, -20($fp) + sub $a0, $a0, $a1 + sw $a0, -16($fp) + # IF_ZERO local_i2a_at_A2I_internal_3 GOTO label_TRUE_238 + # IF_ZERO local_i2a_at_A2I_internal_3 GOTO label_TRUE_238 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_238 + # GOTO label_FALSE_237 + j label_FALSE_237 + label_COMPARE_BY_VALUE_241: + # LOCAL local_i2a_at_A2I_internal_3 --> -16($fp) + # PARAM param_i2a_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2a_at_A2I_internal_4 --> -20($fp) + lw $a0, 0($fp) + lw $a1, -20($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -16($fp) + # IF_ZERO local_i2a_at_A2I_internal_3 GOTO label_TRUE_238 + # IF_ZERO local_i2a_at_A2I_internal_3 GOTO label_TRUE_238 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_238 + # GOTO label_FALSE_237 + j label_FALSE_237 + label_COMPARE_STRING_240: + # LOCAL local_i2a_at_A2I_internal_3 --> -16($fp) + # PARAM param_i2a_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2a_at_A2I_internal_4 --> -20($fp) + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -20($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -16($fp) + # IF_ZERO local_i2a_at_A2I_internal_3 GOTO label_CONTINUE_242 + # IF_ZERO local_i2a_at_A2I_internal_3 GOTO label_CONTINUE_242 + lw $t0, -16($fp) + beq $t0, 0, label_CONTINUE_242 + # GOTO label_FALSE_237 + j label_FALSE_237 + label_CONTINUE_242: + # LOCAL local_i2a_at_A2I_internal_3 --> -16($fp) + # PARAM param_i2a_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2a_at_A2I_internal_4 --> -20($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -20($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_243: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_244 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_243 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_244: + # Store result + sw $a2, -16($fp) + # IF_ZERO local_i2a_at_A2I_internal_3 GOTO label_TRUE_238 + # IF_ZERO local_i2a_at_A2I_internal_3 GOTO label_TRUE_238 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_238 + label_FALSE_237: + # LOCAL local_i2a_at_A2I_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -12($fp) + # GOTO label_END_239 +j label_END_239 +label_TRUE_238: + # LOCAL local_i2a_at_A2I_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -12($fp) + label_END_239: +# LOCAL local_i2a_at_A2I_internal_0 --> -4($fp) +# LOCAL local_i2a_at_A2I_internal_2 --> -12($fp) +# Obtain value from -12($fp) +lw $v0, -12($fp) +lw $v0, 12($v0) +sw $v0, -4($fp) +# IF_ZERO local_i2a_at_A2I_internal_0 GOTO label_FALSEIF_235 +# IF_ZERO local_i2a_at_A2I_internal_0 GOTO label_FALSEIF_235 +lw $t0, -4($fp) +beq $t0, 0, label_FALSEIF_235 +# LOCAL local_i2a_at_A2I_internal_5 --> -24($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_27 +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +sw $v0, -24($fp) +# LOCAL local_i2a_at_A2I_internal_1 --> -8($fp) +# LOCAL local_i2a_at_A2I_internal_5 --> -24($fp) +# local_i2a_at_A2I_internal_1 = local_i2a_at_A2I_internal_5 +lw $t0, -24($fp) +sw $t0, -8($fp) +# GOTO label_ENDIF_236 +j label_ENDIF_236 +label_FALSEIF_235: + # LOCAL local_i2a_at_A2I_internal_9 --> -40($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -40($fp) + # LOCAL local_i2a_at_A2I_internal_8 --> -36($fp) + # LOCAL local_i2a_at_A2I_internal_9 --> -40($fp) + # PARAM param_i2a_at_A2I_i_0 --> 0($fp) + lw $a0, -40($fp) + lw $a1, 0($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -36($fp) + # IF_GREATER_ZERO local_i2a_at_A2I_internal_8 GOTO label_FALSE_247 + # IF_GREATER_ZERO local_i2a_at_A2I_internal_8 GOTO label_FALSE_247 + lw $t0, -36($fp) + bgt $t0, 0, label_FALSE_247 + # IF_ZERO local_i2a_at_A2I_internal_8 GOTO label_FALSE_247 + # IF_ZERO local_i2a_at_A2I_internal_8 GOTO label_FALSE_247 + lw $t0, -36($fp) + beq $t0, 0, label_FALSE_247 + # LOCAL local_i2a_at_A2I_internal_8 --> -36($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -36($fp) + # GOTO label_END_248 +j label_END_248 +label_FALSE_247: + # LOCAL local_i2a_at_A2I_internal_8 --> -36($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -36($fp) + label_END_248: +# LOCAL local_i2a_at_A2I_internal_6 --> -28($fp) +# LOCAL local_i2a_at_A2I_internal_8 --> -36($fp) +# Obtain value from -36($fp) +lw $v0, -36($fp) +lw $v0, 12($v0) +sw $v0, -28($fp) +# IF_ZERO local_i2a_at_A2I_internal_6 GOTO label_FALSEIF_245 +# IF_ZERO local_i2a_at_A2I_internal_6 GOTO label_FALSEIF_245 +lw $t0, -28($fp) +beq $t0, 0, label_FALSEIF_245 +# LOCAL local_i2a_at_A2I_internal_12 --> -52($fp) +# local_i2a_at_A2I_internal_12 = SELF +sw $s1, -52($fp) +# LOCAL local_i2a_at_A2I_internal_10 --> -44($fp) +# LOCAL local_i2a_at_A2I_internal_12 --> -52($fp) +# local_i2a_at_A2I_internal_10 = local_i2a_at_A2I_internal_12 +lw $t0, -52($fp) +sw $t0, -44($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# ARG param_i2a_at_A2I_i_0 +# PARAM param_i2a_at_A2I_i_0 --> 0($fp) +lw $t0, 0($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_i2a_at_A2I_internal_10 --> -44($fp) +# LOCAL local_i2a_at_A2I_internal_11 --> -48($fp) +# local_i2a_at_A2I_internal_11 = VCALL local_i2a_at_A2I_internal_10 i2a_aux +# Save new self pointer in $s1 +lw $s1, -44($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 32($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -48($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_i2a_at_A2I_internal_7 --> -32($fp) +# LOCAL local_i2a_at_A2I_internal_11 --> -48($fp) +# local_i2a_at_A2I_internal_7 = local_i2a_at_A2I_internal_11 +lw $t0, -48($fp) +sw $t0, -32($fp) +# GOTO label_ENDIF_246 +j label_ENDIF_246 +label_FALSEIF_245: + # LOCAL local_i2a_at_A2I_internal_15 --> -64($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_28 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -64($fp) + # LOCAL local_i2a_at_A2I_internal_13 --> -56($fp) + # LOCAL local_i2a_at_A2I_internal_15 --> -64($fp) + # local_i2a_at_A2I_internal_13 = local_i2a_at_A2I_internal_15 + lw $t0, -64($fp) + sw $t0, -56($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_i2a_at_A2I_internal_18 --> -76($fp) + # local_i2a_at_A2I_internal_18 = SELF + sw $s1, -76($fp) + # LOCAL local_i2a_at_A2I_internal_16 --> -68($fp) + # LOCAL local_i2a_at_A2I_internal_18 --> -76($fp) + # local_i2a_at_A2I_internal_16 = local_i2a_at_A2I_internal_18 + lw $t0, -76($fp) + sw $t0, -68($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_i2a_at_A2I_internal_21 --> -88($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -88($fp) + # LOCAL local_i2a_at_A2I_internal_20 --> -84($fp) + # LOCAL local_i2a_at_A2I_internal_21 --> -88($fp) + lw $t0, -88($fp) + lw $t0, 12($t0) + not $t0, $t0 + add $t0, $t0, 1 + sw $t0, -84($fp) + # LOCAL local_i2a_at_A2I_internal_20 --> -84($fp) + # LOCAL local_i2a_at_A2I_internal_20 --> -84($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + lw $t0, -84($fp) + sw $t0, 12($v0) + sw $v0, -84($fp) + # LOCAL local_i2a_at_A2I_internal_19 --> -80($fp) + # PARAM param_i2a_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2a_at_A2I_internal_20 --> -84($fp) + # local_i2a_at_A2I_internal_19 = PARAM param_i2a_at_A2I_i_0 * local_i2a_at_A2I_internal_20 + lw $t1, 0($fp) + lw $t0, 12($t1) + lw $t1, -84($fp) + lw $t2, 12($t1) + mul $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -80($fp) + # ARG local_i2a_at_A2I_internal_19 + # LOCAL local_i2a_at_A2I_internal_19 --> -80($fp) + lw $t0, -80($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_i2a_at_A2I_internal_16 --> -68($fp) + # LOCAL local_i2a_at_A2I_internal_17 --> -72($fp) + # local_i2a_at_A2I_internal_17 = VCALL local_i2a_at_A2I_internal_16 i2a_aux + # Save new self pointer in $s1 + lw $s1, -68($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 32($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -72($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # ARG local_i2a_at_A2I_internal_17 + # LOCAL local_i2a_at_A2I_internal_17 --> -72($fp) + lw $t0, -72($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_i2a_at_A2I_internal_13 --> -56($fp) + # LOCAL local_i2a_at_A2I_internal_14 --> -60($fp) + # local_i2a_at_A2I_internal_14 = VCALL local_i2a_at_A2I_internal_13 concat + # Save new self pointer in $s1 + lw $s1, -56($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 24($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -60($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_i2a_at_A2I_internal_7 --> -32($fp) + # LOCAL local_i2a_at_A2I_internal_14 --> -60($fp) + # local_i2a_at_A2I_internal_7 = local_i2a_at_A2I_internal_14 + lw $t0, -60($fp) + sw $t0, -32($fp) + label_ENDIF_246: +# LOCAL local_i2a_at_A2I_internal_1 --> -8($fp) +# LOCAL local_i2a_at_A2I_internal_7 --> -32($fp) +# local_i2a_at_A2I_internal_1 = local_i2a_at_A2I_internal_7 +lw $t0, -32($fp) +sw $t0, -8($fp) +label_ENDIF_236: +# RETURN local_i2a_at_A2I_internal_1 +lw $v0, -8($fp) +# Deallocate stack frame for function function_i2a_at_A2I. +# Restore $ra +lw $ra, 4($sp) +# Restore $fp +lw $fp, 0($sp) +# Restore Stack pointer $sp +addu $sp, $sp, 96 +# Deallocate function args +addu $sp, $sp, 4 +jr $ra +# Function END + + +# function_i2a_aux_at_A2I implementation. +# @Params: +# 0($fp) = param_i2a_aux_at_A2I_i_0 +function_i2a_aux_at_A2I: + # Allocate stack frame for function function_i2a_aux_at_A2I. + subu $sp, $sp, 88 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 88 + # LOCAL local_i2a_aux_at_A2I_internal_4 --> -20($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -20($fp) + # IF_ZERO param_i2a_aux_at_A2I_i_0 GOTO label_FALSE_251 + # IF_ZERO param_i2a_aux_at_A2I_i_0 GOTO label_FALSE_251 + lw $t0, 0($fp) + beq $t0, 0, label_FALSE_251 + # IF_ZERO local_i2a_aux_at_A2I_internal_4 GOTO label_FALSE_251 + # IF_ZERO local_i2a_aux_at_A2I_internal_4 GOTO label_FALSE_251 + lw $t0, -20($fp) + beq $t0, 0, label_FALSE_251 + # LOCAL local_i2a_aux_at_A2I_internal_3 --> -16($fp) + # PARAM param_i2a_aux_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with String + la $v0, String + lw $a0, 0($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -16($fp) + # IF_ZERO local_i2a_aux_at_A2I_internal_3 GOTO label_COMPARE_STRING_254 + # IF_ZERO local_i2a_aux_at_A2I_internal_3 GOTO label_COMPARE_STRING_254 + lw $t0, -16($fp) + beq $t0, 0, label_COMPARE_STRING_254 + # LOCAL local_i2a_aux_at_A2I_internal_3 --> -16($fp) + # PARAM param_i2a_aux_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with Bool + la $v0, Bool + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -16($fp) + # IF_ZERO local_i2a_aux_at_A2I_internal_3 GOTO label_COMPARE_BY_VALUE_255 + # IF_ZERO local_i2a_aux_at_A2I_internal_3 GOTO label_COMPARE_BY_VALUE_255 + lw $t0, -16($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_255 + # LOCAL local_i2a_aux_at_A2I_internal_3 --> -16($fp) + # PARAM param_i2a_aux_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with Int + la $v0, Int + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -16($fp) + # IF_ZERO local_i2a_aux_at_A2I_internal_3 GOTO label_COMPARE_BY_VALUE_255 + # IF_ZERO local_i2a_aux_at_A2I_internal_3 GOTO label_COMPARE_BY_VALUE_255 + lw $t0, -16($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_255 + # LOCAL local_i2a_aux_at_A2I_internal_3 --> -16($fp) + # PARAM param_i2a_aux_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2a_aux_at_A2I_internal_4 --> -20($fp) + # Load pointers and SUB + lw $a0, 0($fp) + lw $a1, -20($fp) + sub $a0, $a0, $a1 + sw $a0, -16($fp) + # IF_ZERO local_i2a_aux_at_A2I_internal_3 GOTO label_TRUE_252 + # IF_ZERO local_i2a_aux_at_A2I_internal_3 GOTO label_TRUE_252 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_252 + # GOTO label_FALSE_251 + j label_FALSE_251 + label_COMPARE_BY_VALUE_255: + # LOCAL local_i2a_aux_at_A2I_internal_3 --> -16($fp) + # PARAM param_i2a_aux_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2a_aux_at_A2I_internal_4 --> -20($fp) + lw $a0, 0($fp) + lw $a1, -20($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -16($fp) + # IF_ZERO local_i2a_aux_at_A2I_internal_3 GOTO label_TRUE_252 + # IF_ZERO local_i2a_aux_at_A2I_internal_3 GOTO label_TRUE_252 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_252 + # GOTO label_FALSE_251 + j label_FALSE_251 + label_COMPARE_STRING_254: + # LOCAL local_i2a_aux_at_A2I_internal_3 --> -16($fp) + # PARAM param_i2a_aux_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2a_aux_at_A2I_internal_4 --> -20($fp) + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -20($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -16($fp) + # IF_ZERO local_i2a_aux_at_A2I_internal_3 GOTO label_CONTINUE_256 + # IF_ZERO local_i2a_aux_at_A2I_internal_3 GOTO label_CONTINUE_256 + lw $t0, -16($fp) + beq $t0, 0, label_CONTINUE_256 + # GOTO label_FALSE_251 + j label_FALSE_251 + label_CONTINUE_256: + # LOCAL local_i2a_aux_at_A2I_internal_3 --> -16($fp) + # PARAM param_i2a_aux_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2a_aux_at_A2I_internal_4 --> -20($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -20($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_257: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_258 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_257 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_258: + # Store result + sw $a2, -16($fp) + # IF_ZERO local_i2a_aux_at_A2I_internal_3 GOTO label_TRUE_252 + # IF_ZERO local_i2a_aux_at_A2I_internal_3 GOTO label_TRUE_252 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_252 + label_FALSE_251: + # LOCAL local_i2a_aux_at_A2I_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -12($fp) + # GOTO label_END_253 +j label_END_253 +label_TRUE_252: + # LOCAL local_i2a_aux_at_A2I_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -12($fp) + label_END_253: +# LOCAL local_i2a_aux_at_A2I_internal_0 --> -4($fp) +# LOCAL local_i2a_aux_at_A2I_internal_2 --> -12($fp) +# Obtain value from -12($fp) +lw $v0, -12($fp) +lw $v0, 12($v0) +sw $v0, -4($fp) +# IF_ZERO local_i2a_aux_at_A2I_internal_0 GOTO label_FALSEIF_249 +# IF_ZERO local_i2a_aux_at_A2I_internal_0 GOTO label_FALSEIF_249 +lw $t0, -4($fp) +beq $t0, 0, label_FALSEIF_249 +# LOCAL local_i2a_aux_at_A2I_internal_5 --> -24($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_29 +sw $t0, 12($v0) +li $t0, 0 +sw $t0, 16($v0) +sw $v0, -24($fp) +# LOCAL local_i2a_aux_at_A2I_internal_1 --> -8($fp) +# LOCAL local_i2a_aux_at_A2I_internal_5 --> -24($fp) +# local_i2a_aux_at_A2I_internal_1 = local_i2a_aux_at_A2I_internal_5 +lw $t0, -24($fp) +sw $t0, -8($fp) +# GOTO label_ENDIF_250 +j label_ENDIF_250 +label_FALSEIF_249: + # LOCAL local_i2a_aux_at_A2I_next_6 --> -28($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -28($fp) + # LOCAL local_i2a_aux_at_A2I_internal_8 --> -36($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 10 + sw $t0, 12($v0) + sw $v0, -36($fp) + # LOCAL local_i2a_aux_at_A2I_internal_7 --> -32($fp) + # PARAM param_i2a_aux_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2a_aux_at_A2I_internal_8 --> -36($fp) + # local_i2a_aux_at_A2I_internal_7 = PARAM param_i2a_aux_at_A2I_i_0 / local_i2a_aux_at_A2I_internal_8 + lw $t1, 0($fp) + lw $t0, 12($t1) + lw $t1, -36($fp) + lw $t2, 12($t1) + div $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -32($fp) + # LOCAL local_i2a_aux_at_A2I_next_6 --> -28($fp) + # LOCAL local_i2a_aux_at_A2I_internal_7 --> -32($fp) + # local_i2a_aux_at_A2I_next_6 = local_i2a_aux_at_A2I_internal_7 + lw $t0, -32($fp) + sw $t0, -28($fp) + # LOCAL local_i2a_aux_at_A2I_internal_13 --> -56($fp) + # local_i2a_aux_at_A2I_internal_13 = SELF + sw $s1, -56($fp) + # LOCAL local_i2a_aux_at_A2I_internal_11 --> -48($fp) + # LOCAL local_i2a_aux_at_A2I_internal_13 --> -56($fp) + # local_i2a_aux_at_A2I_internal_11 = local_i2a_aux_at_A2I_internal_13 + lw $t0, -56($fp) + sw $t0, -48($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # ARG local_i2a_aux_at_A2I_next_6 + # LOCAL local_i2a_aux_at_A2I_next_6 --> -28($fp) + lw $t0, -28($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_i2a_aux_at_A2I_internal_11 --> -48($fp) + # LOCAL local_i2a_aux_at_A2I_internal_12 --> -52($fp) + # local_i2a_aux_at_A2I_internal_12 = VCALL local_i2a_aux_at_A2I_internal_11 i2a_aux + # Save new self pointer in $s1 + lw $s1, -48($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 32($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -52($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_i2a_aux_at_A2I_internal_9 --> -40($fp) + # LOCAL local_i2a_aux_at_A2I_internal_12 --> -52($fp) + # local_i2a_aux_at_A2I_internal_9 = local_i2a_aux_at_A2I_internal_12 + lw $t0, -52($fp) + sw $t0, -40($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_i2a_aux_at_A2I_internal_16 --> -68($fp) + # local_i2a_aux_at_A2I_internal_16 = SELF + sw $s1, -68($fp) + # LOCAL local_i2a_aux_at_A2I_internal_14 --> -60($fp) + # LOCAL local_i2a_aux_at_A2I_internal_16 --> -68($fp) + # local_i2a_aux_at_A2I_internal_14 = local_i2a_aux_at_A2I_internal_16 + lw $t0, -68($fp) + sw $t0, -60($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_i2a_aux_at_A2I_internal_19 --> -80($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 10 + sw $t0, 12($v0) + sw $v0, -80($fp) + # LOCAL local_i2a_aux_at_A2I_internal_18 --> -76($fp) + # LOCAL local_i2a_aux_at_A2I_next_6 --> -28($fp) + # LOCAL local_i2a_aux_at_A2I_internal_19 --> -80($fp) + # local_i2a_aux_at_A2I_internal_18 = local_i2a_aux_at_A2I_next_6 * local_i2a_aux_at_A2I_internal_19 + lw $t1, -28($fp) + lw $t0, 12($t1) + lw $t1, -80($fp) + lw $t2, 12($t1) + mul $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -76($fp) + # LOCAL local_i2a_aux_at_A2I_internal_17 --> -72($fp) + # PARAM param_i2a_aux_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2a_aux_at_A2I_internal_18 --> -76($fp) + # local_i2a_aux_at_A2I_internal_17 = PARAM param_i2a_aux_at_A2I_i_0 - local_i2a_aux_at_A2I_internal_18 + lw $t1, 0($fp) + lw $t0, 12($t1) + lw $t1, -76($fp) + lw $t2, 12($t1) + sub $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -72($fp) + # ARG local_i2a_aux_at_A2I_internal_17 + # LOCAL local_i2a_aux_at_A2I_internal_17 --> -72($fp) + lw $t0, -72($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_i2a_aux_at_A2I_internal_14 --> -60($fp) + # LOCAL local_i2a_aux_at_A2I_internal_15 --> -64($fp) + # local_i2a_aux_at_A2I_internal_15 = VCALL local_i2a_aux_at_A2I_internal_14 i2c + # Save new self pointer in $s1 + lw $s1, -60($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 104($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -64($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # ARG local_i2a_aux_at_A2I_internal_15 + # LOCAL local_i2a_aux_at_A2I_internal_15 --> -64($fp) + lw $t0, -64($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_i2a_aux_at_A2I_internal_9 --> -40($fp) + # LOCAL local_i2a_aux_at_A2I_internal_10 --> -44($fp) + # local_i2a_aux_at_A2I_internal_10 = VCALL local_i2a_aux_at_A2I_internal_9 concat + # Save new self pointer in $s1 + lw $s1, -40($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 24($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -44($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_i2a_aux_at_A2I_internal_1 --> -8($fp) + # LOCAL local_i2a_aux_at_A2I_internal_10 --> -44($fp) + # local_i2a_aux_at_A2I_internal_1 = local_i2a_aux_at_A2I_internal_10 + lw $t0, -44($fp) + sw $t0, -8($fp) + label_ENDIF_250: +# RETURN local_i2a_aux_at_A2I_internal_1 +lw $v0, -8($fp) +# Deallocate stack frame for function function_i2a_aux_at_A2I. +# Restore $ra +lw $ra, 4($sp) +# Restore $fp +lw $fp, 0($sp) +# Restore Stack pointer $sp +addu $sp, $sp, 88 +# Deallocate function args +addu $sp, $sp, 4 +jr $ra +# Function END + + +# __A__attrib__var__init implementation. +# @Params: +__A__attrib__var__init: + # Allocate stack frame for function __A__attrib__var__init. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_ib__var__init_internal_1 --> -8($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -8($fp) + # RETURN local_ib__var__init_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function __A__attrib__var__init. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_value_at_A implementation. +# @Params: +function_value_at_A: + # Allocate stack frame for function function_value_at_A. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_value_at_A_internal_0 = GETATTRIBUTE var A + # LOCAL local_value_at_A_internal_0 --> -4($fp) + lw $t0, 12($s1) + sw $t0, -4($fp) + # RETURN local_value_at_A_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_value_at_A. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_set_var_at_A implementation. +# @Params: +# 0($fp) = param_set_var_at_A_num_0 +function_set_var_at_A: + # Allocate stack frame for function function_set_var_at_A. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # + # PARAM param_set_var_at_A_num_0 --> 0($fp) + lw $t0, 0($fp) + sw $t0, 12($s1) + # LOCAL local_set_var_at_A_internal_0 --> -4($fp) + # local_set_var_at_A_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_set_var_at_A_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_set_var_at_A. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_method1_at_A implementation. +# @Params: +# 0($fp) = param_method1_at_A_num_0 +function_method1_at_A: + # Allocate stack frame for function function_method1_at_A. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_method1_at_A_internal_0 --> -4($fp) + # local_method1_at_A_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_method1_at_A_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_method1_at_A. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_method2_at_A implementation. +# @Params: +# 0($fp) = param_method2_at_A_num1_0 +# 4($fp) = param_method2_at_A_num2_1 +function_method2_at_A: + # Allocate stack frame for function function_method2_at_A. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_method2_at_A_x_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -4($fp) + # LOCAL local_method2_at_A_internal_1 --> -8($fp) + # PARAM param_method2_at_A_num1_0 --> 4($fp) + # PARAM param_method2_at_A_num2_1 --> 0($fp) + # local_method2_at_A_internal_1 = PARAM param_method2_at_A_num1_0 + PARAM param_method2_at_A_num2_1 + lw $t1, 4($fp) + lw $t0, 12($t1) + lw $t1, 0($fp) + lw $t2, 12($t1) + add $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -8($fp) + # LOCAL local_method2_at_A_x_0 --> -4($fp) + # LOCAL local_method2_at_A_internal_1 --> -8($fp) + # local_method2_at_A_x_0 = local_method2_at_A_internal_1 + lw $t0, -8($fp) + sw $t0, -4($fp) + # LOCAL local_method2_at_A_internal_4 --> -20($fp) + # local_method2_at_A_internal_4 = ALLOCATE B + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, B + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, B_start + sw $t0, 4($v0) + # Load type offset + li $t0, 28 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __A__attrib__var__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 12($t1) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -20($fp) + # LOCAL local_method2_at_A_internal_2 --> -12($fp) + # LOCAL local_method2_at_A_internal_4 --> -20($fp) + # local_method2_at_A_internal_2 = local_method2_at_A_internal_4 + lw $t0, -20($fp) + sw $t0, -12($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # ARG local_method2_at_A_x_0 + # LOCAL local_method2_at_A_x_0 --> -4($fp) + lw $t0, -4($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_method2_at_A_internal_2 --> -12($fp) + # LOCAL local_method2_at_A_internal_3 --> -16($fp) + # local_method2_at_A_internal_3 = VCALL local_method2_at_A_internal_2 set_var + # Save new self pointer in $s1 + lw $s1, -12($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 120($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -16($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # RETURN local_method2_at_A_internal_3 + lw $v0, -16($fp) + # Deallocate stack frame for function function_method2_at_A. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 8 + jr $ra + # Function END + + +# function_method3_at_A implementation. +# @Params: +# 0($fp) = param_method3_at_A_num_0 +function_method3_at_A: + # Allocate stack frame for function function_method3_at_A. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_method3_at_A_x_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -4($fp) + # LOCAL local_method3_at_A_internal_1 --> -8($fp) + # PARAM param_method3_at_A_num_0 --> 0($fp) + lw $t0, 0($fp) + lw $t0, 12($t0) + not $t0, $t0 + add $t0, $t0, 1 + sw $t0, -8($fp) + # LOCAL local_method3_at_A_internal_1 --> -8($fp) + # LOCAL local_method3_at_A_internal_1 --> -8($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + lw $t0, -8($fp) + sw $t0, 12($v0) + sw $v0, -8($fp) + # LOCAL local_method3_at_A_x_0 --> -4($fp) + # LOCAL local_method3_at_A_internal_1 --> -8($fp) + # local_method3_at_A_x_0 = local_method3_at_A_internal_1 + lw $t0, -8($fp) + sw $t0, -4($fp) + # LOCAL local_method3_at_A_internal_4 --> -20($fp) + # local_method3_at_A_internal_4 = ALLOCATE C + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, C + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, C_start + sw $t0, 4($v0) + # Load type offset + li $t0, 40 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __A__attrib__var__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 12($t1) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -20($fp) + # LOCAL local_method3_at_A_internal_2 --> -12($fp) + # LOCAL local_method3_at_A_internal_4 --> -20($fp) + # local_method3_at_A_internal_2 = local_method3_at_A_internal_4 + lw $t0, -20($fp) + sw $t0, -12($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # ARG local_method3_at_A_x_0 + # LOCAL local_method3_at_A_x_0 --> -4($fp) + lw $t0, -4($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_method3_at_A_internal_2 --> -12($fp) + # LOCAL local_method3_at_A_internal_3 --> -16($fp) + # local_method3_at_A_internal_3 = VCALL local_method3_at_A_internal_2 set_var + # Save new self pointer in $s1 + lw $s1, -12($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 120($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -16($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # RETURN local_method3_at_A_internal_3 + lw $v0, -16($fp) + # Deallocate stack frame for function function_method3_at_A. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_method4_at_A implementation. +# @Params: +# 0($fp) = param_method4_at_A_num1_0 +# 4($fp) = param_method4_at_A_num2_1 +function_method4_at_A: + # Allocate stack frame for function function_method4_at_A. + subu $sp, $sp, 60 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 60 + # LOCAL local_method4_at_A_internal_2 --> -12($fp) + # PARAM param_method4_at_A_num2_1 --> 0($fp) + # PARAM param_method4_at_A_num1_0 --> 4($fp) + lw $a0, 0($fp) + lw $a1, 4($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -12($fp) + # IF_GREATER_ZERO local_method4_at_A_internal_2 GOTO label_FALSE_261 + # IF_GREATER_ZERO local_method4_at_A_internal_2 GOTO label_FALSE_261 + lw $t0, -12($fp) + bgt $t0, 0, label_FALSE_261 + # IF_ZERO local_method4_at_A_internal_2 GOTO label_FALSE_261 + # IF_ZERO local_method4_at_A_internal_2 GOTO label_FALSE_261 + lw $t0, -12($fp) + beq $t0, 0, label_FALSE_261 + # LOCAL local_method4_at_A_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -12($fp) + # GOTO label_END_262 +j label_END_262 +label_FALSE_261: + # LOCAL local_method4_at_A_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -12($fp) + label_END_262: +# LOCAL local_method4_at_A_internal_0 --> -4($fp) +# LOCAL local_method4_at_A_internal_2 --> -12($fp) +# Obtain value from -12($fp) +lw $v0, -12($fp) +lw $v0, 12($v0) +sw $v0, -4($fp) +# IF_ZERO local_method4_at_A_internal_0 GOTO label_FALSEIF_259 +# IF_ZERO local_method4_at_A_internal_0 GOTO label_FALSEIF_259 +lw $t0, -4($fp) +beq $t0, 0, label_FALSEIF_259 +# LOCAL local_method4_at_A_x_3 --> -16($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 0 +sw $t0, 12($v0) +sw $v0, -16($fp) +# LOCAL local_method4_at_A_internal_4 --> -20($fp) +# PARAM param_method4_at_A_num1_0 --> 4($fp) +# PARAM param_method4_at_A_num2_1 --> 0($fp) +# local_method4_at_A_internal_4 = PARAM param_method4_at_A_num1_0 - PARAM param_method4_at_A_num2_1 +lw $t1, 4($fp) +lw $t0, 12($t1) +lw $t1, 0($fp) +lw $t2, 12($t1) +sub $t0, $t0, $t2 +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t1, String +sw $t1, 0($v0) +la $t1, String_start +sw $t1, 4($v0) +# Load type offset +li $t1, 8 +sw $t1, 8($v0) +la $t1, Int +sw $t1, 12($v0) +li $t1, 3 +sw $t1, 16($v0) +move $t1, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t1, 0($v0) +la $t1, Int_start +sw $t1, 4($v0) +# Load type offset +li $t1, 16 +sw $t1, 8($v0) +sw $t0, 12($v0) +sw $v0, -20($fp) +# LOCAL local_method4_at_A_x_3 --> -16($fp) +# LOCAL local_method4_at_A_internal_4 --> -20($fp) +# local_method4_at_A_x_3 = local_method4_at_A_internal_4 +lw $t0, -20($fp) +sw $t0, -16($fp) +# LOCAL local_method4_at_A_internal_7 --> -32($fp) +# local_method4_at_A_internal_7 = ALLOCATE D +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type name +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, D +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, D_start +sw $t0, 4($v0) +# Load type offset +li $t0, 32 +sw $t0, 8($v0) +move $t1, $v0 +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +move $s1, $v0 +# Push register t1 into stack +subu $sp, $sp, 4 +sw $t1, 0($sp) +jal __A__attrib__var__init +# Pop 4 bytes from stack into register t1 +lw $t1, 0($sp) +addu $sp, $sp, 4 +sw $v0, 12($t1) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +sw $t1, -32($fp) +# LOCAL local_method4_at_A_internal_5 --> -24($fp) +# LOCAL local_method4_at_A_internal_7 --> -32($fp) +# local_method4_at_A_internal_5 = local_method4_at_A_internal_7 +lw $t0, -32($fp) +sw $t0, -24($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# ARG local_method4_at_A_x_3 +# LOCAL local_method4_at_A_x_3 --> -16($fp) +lw $t0, -16($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_method4_at_A_internal_5 --> -24($fp) +# LOCAL local_method4_at_A_internal_6 --> -28($fp) +# local_method4_at_A_internal_6 = VCALL local_method4_at_A_internal_5 set_var +# Save new self pointer in $s1 +lw $s1, -24($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 120($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -28($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_method4_at_A_internal_1 --> -8($fp) +# LOCAL local_method4_at_A_internal_6 --> -28($fp) +# local_method4_at_A_internal_1 = local_method4_at_A_internal_6 +lw $t0, -28($fp) +sw $t0, -8($fp) +# GOTO label_ENDIF_260 +j label_ENDIF_260 +label_FALSEIF_259: + # LOCAL local_method4_at_A_x_8 --> -36($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -36($fp) + # LOCAL local_method4_at_A_internal_9 --> -40($fp) + # PARAM param_method4_at_A_num2_1 --> 0($fp) + # PARAM param_method4_at_A_num1_0 --> 4($fp) + # local_method4_at_A_internal_9 = PARAM param_method4_at_A_num2_1 - PARAM param_method4_at_A_num1_0 + lw $t1, 0($fp) + lw $t0, 12($t1) + lw $t1, 4($fp) + lw $t2, 12($t1) + sub $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -40($fp) + # LOCAL local_method4_at_A_x_8 --> -36($fp) + # LOCAL local_method4_at_A_internal_9 --> -40($fp) + # local_method4_at_A_x_8 = local_method4_at_A_internal_9 + lw $t0, -40($fp) + sw $t0, -36($fp) + # LOCAL local_method4_at_A_internal_12 --> -52($fp) + # local_method4_at_A_internal_12 = ALLOCATE D + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, D + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, D_start + sw $t0, 4($v0) + # Load type offset + li $t0, 32 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __A__attrib__var__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 12($t1) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -52($fp) + # LOCAL local_method4_at_A_internal_10 --> -44($fp) + # LOCAL local_method4_at_A_internal_12 --> -52($fp) + # local_method4_at_A_internal_10 = local_method4_at_A_internal_12 + lw $t0, -52($fp) + sw $t0, -44($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # ARG local_method4_at_A_x_8 + # LOCAL local_method4_at_A_x_8 --> -36($fp) + lw $t0, -36($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_method4_at_A_internal_10 --> -44($fp) + # LOCAL local_method4_at_A_internal_11 --> -48($fp) + # local_method4_at_A_internal_11 = VCALL local_method4_at_A_internal_10 set_var + # Save new self pointer in $s1 + lw $s1, -44($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 120($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -48($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_method4_at_A_internal_1 --> -8($fp) + # LOCAL local_method4_at_A_internal_11 --> -48($fp) + # local_method4_at_A_internal_1 = local_method4_at_A_internal_11 + lw $t0, -48($fp) + sw $t0, -8($fp) + label_ENDIF_260: +# RETURN local_method4_at_A_internal_1 +lw $v0, -8($fp) +# Deallocate stack frame for function function_method4_at_A. +# Restore $ra +lw $ra, 4($sp) +# Restore $fp +lw $fp, 0($sp) +# Restore Stack pointer $sp +addu $sp, $sp, 60 +# Deallocate function args +addu $sp, $sp, 8 +jr $ra +# Function END + + +# function_method5_at_A implementation. +# @Params: +# 0($fp) = param_method5_at_A_num_0 +function_method5_at_A: + # Allocate stack frame for function function_method5_at_A. + subu $sp, $sp, 56 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 56 + # LOCAL local_method5_at_A_x_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -4($fp) + # LOCAL local_method5_at_A_internal_1 --> -8($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -8($fp) + # LOCAL local_method5_at_A_x_0 --> -4($fp) + # LOCAL local_method5_at_A_internal_1 --> -8($fp) + # local_method5_at_A_x_0 = local_method5_at_A_internal_1 + lw $t0, -8($fp) + sw $t0, -4($fp) + # LOCAL local_method5_at_A_y_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -12($fp) + # LOCAL local_method5_at_A_internal_3 --> -16($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -16($fp) + # LOCAL local_method5_at_A_y_2 --> -12($fp) + # LOCAL local_method5_at_A_internal_3 --> -16($fp) + # local_method5_at_A_y_2 = local_method5_at_A_internal_3 + lw $t0, -16($fp) + sw $t0, -12($fp) + label_WHILE_263: + # LOCAL local_method5_at_A_internal_5 --> -24($fp) + # LOCAL local_method5_at_A_y_2 --> -12($fp) + # PARAM param_method5_at_A_num_0 --> 0($fp) + lw $a0, -12($fp) + lw $a1, 0($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -24($fp) + # IF_GREATER_ZERO local_method5_at_A_internal_5 GOTO label_FALSE_265 + # IF_GREATER_ZERO local_method5_at_A_internal_5 GOTO label_FALSE_265 + lw $t0, -24($fp) + bgt $t0, 0, label_FALSE_265 + # LOCAL local_method5_at_A_internal_5 --> -24($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -24($fp) + # GOTO label_END_266 +j label_END_266 +label_FALSE_265: + # LOCAL local_method5_at_A_internal_5 --> -24($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -24($fp) + label_END_266: +# LOCAL local_method5_at_A_internal_4 --> -20($fp) +# LOCAL local_method5_at_A_internal_5 --> -24($fp) +# Obtain value from -24($fp) +lw $v0, -24($fp) +lw $v0, 12($v0) +sw $v0, -20($fp) +# IF_ZERO local_method5_at_A_internal_4 GOTO label_WHILE_END_264 +# IF_ZERO local_method5_at_A_internal_4 GOTO label_WHILE_END_264 +lw $t0, -20($fp) +beq $t0, 0, label_WHILE_END_264 +# LOCAL local_method5_at_A_internal_6 --> -28($fp) +# LOCAL local_method5_at_A_x_0 --> -4($fp) +# LOCAL local_method5_at_A_y_2 --> -12($fp) +# local_method5_at_A_internal_6 = local_method5_at_A_x_0 * local_method5_at_A_y_2 +lw $t1, -4($fp) +lw $t0, 12($t1) +lw $t1, -12($fp) +lw $t2, 12($t1) +mul $t0, $t0, $t2 +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t1, String +sw $t1, 0($v0) +la $t1, String_start +sw $t1, 4($v0) +# Load type offset +li $t1, 8 +sw $t1, 8($v0) +la $t1, Int +sw $t1, 12($v0) +li $t1, 3 +sw $t1, 16($v0) +move $t1, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t1, 0($v0) +la $t1, Int_start +sw $t1, 4($v0) +# Load type offset +li $t1, 16 +sw $t1, 8($v0) +sw $t0, 12($v0) +sw $v0, -28($fp) +# LOCAL local_method5_at_A_x_0 --> -4($fp) +# LOCAL local_method5_at_A_internal_6 --> -28($fp) +# local_method5_at_A_x_0 = local_method5_at_A_internal_6 +lw $t0, -28($fp) +sw $t0, -4($fp) +# LOCAL local_method5_at_A_internal_8 --> -36($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 1 +sw $t0, 12($v0) +sw $v0, -36($fp) +# LOCAL local_method5_at_A_internal_7 --> -32($fp) +# LOCAL local_method5_at_A_y_2 --> -12($fp) +# LOCAL local_method5_at_A_internal_8 --> -36($fp) +# local_method5_at_A_internal_7 = local_method5_at_A_y_2 + local_method5_at_A_internal_8 +lw $t1, -12($fp) +lw $t0, 12($t1) +lw $t1, -36($fp) +lw $t2, 12($t1) +add $t0, $t0, $t2 +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t1, String +sw $t1, 0($v0) +la $t1, String_start +sw $t1, 4($v0) +# Load type offset +li $t1, 8 +sw $t1, 8($v0) +la $t1, Int +sw $t1, 12($v0) +li $t1, 3 +sw $t1, 16($v0) +move $t1, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t1, 0($v0) +la $t1, Int_start +sw $t1, 4($v0) +# Load type offset +li $t1, 16 +sw $t1, 8($v0) +sw $t0, 12($v0) +sw $v0, -32($fp) +# LOCAL local_method5_at_A_y_2 --> -12($fp) +# LOCAL local_method5_at_A_internal_7 --> -32($fp) +# local_method5_at_A_y_2 = local_method5_at_A_internal_7 +lw $t0, -32($fp) +sw $t0, -12($fp) +# GOTO label_WHILE_263 +j label_WHILE_263 +label_WHILE_END_264: + # LOCAL local_method5_at_A_internal_11 --> -48($fp) + # local_method5_at_A_internal_11 = ALLOCATE E + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, E + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, E_start + sw $t0, 4($v0) + # Load type offset + li $t0, 36 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __A__attrib__var__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 12($t1) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -48($fp) + # LOCAL local_method5_at_A_internal_9 --> -40($fp) + # LOCAL local_method5_at_A_internal_11 --> -48($fp) + # local_method5_at_A_internal_9 = local_method5_at_A_internal_11 + lw $t0, -48($fp) + sw $t0, -40($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # ARG local_method5_at_A_x_0 + # LOCAL local_method5_at_A_x_0 --> -4($fp) + lw $t0, -4($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_method5_at_A_internal_9 --> -40($fp) + # LOCAL local_method5_at_A_internal_10 --> -44($fp) + # local_method5_at_A_internal_10 = VCALL local_method5_at_A_internal_9 set_var + # Save new self pointer in $s1 + lw $s1, -40($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 120($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -44($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # RETURN local_method5_at_A_internal_10 + lw $v0, -44($fp) + # Deallocate stack frame for function function_method5_at_A. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 56 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_method5_at_B implementation. +# @Params: +# 0($fp) = param_method5_at_B_num_0 +function_method5_at_B: + # Allocate stack frame for function function_method5_at_B. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_method5_at_B_x_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -4($fp) + # LOCAL local_method5_at_B_internal_1 --> -8($fp) + # PARAM param_method5_at_B_num_0 --> 0($fp) + # PARAM param_method5_at_B_num_0 --> 0($fp) + # local_method5_at_B_internal_1 = PARAM param_method5_at_B_num_0 * PARAM param_method5_at_B_num_0 + lw $t1, 0($fp) + lw $t0, 12($t1) + lw $t1, 0($fp) + lw $t2, 12($t1) + mul $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -8($fp) + # LOCAL local_method5_at_B_x_0 --> -4($fp) + # LOCAL local_method5_at_B_internal_1 --> -8($fp) + # local_method5_at_B_x_0 = local_method5_at_B_internal_1 + lw $t0, -8($fp) + sw $t0, -4($fp) + # LOCAL local_method5_at_B_internal_4 --> -20($fp) + # local_method5_at_B_internal_4 = ALLOCATE E + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, E + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, E_start + sw $t0, 4($v0) + # Load type offset + li $t0, 36 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __A__attrib__var__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 12($t1) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -20($fp) + # LOCAL local_method5_at_B_internal_2 --> -12($fp) + # LOCAL local_method5_at_B_internal_4 --> -20($fp) + # local_method5_at_B_internal_2 = local_method5_at_B_internal_4 + lw $t0, -20($fp) + sw $t0, -12($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # ARG local_method5_at_B_x_0 + # LOCAL local_method5_at_B_x_0 --> -4($fp) + lw $t0, -4($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_method5_at_B_internal_2 --> -12($fp) + # LOCAL local_method5_at_B_internal_3 --> -16($fp) + # local_method5_at_B_internal_3 = VCALL local_method5_at_B_internal_2 set_var + # Save new self pointer in $s1 + lw $s1, -12($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 120($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -16($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # RETURN local_method5_at_B_internal_3 + lw $v0, -16($fp) + # Deallocate stack frame for function function_method5_at_B. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_method7_at_D implementation. +# @Params: +# 0($fp) = param_method7_at_D_num_0 +function_method7_at_D: + # Allocate stack frame for function function_method7_at_D. + subu $sp, $sp, 136 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 136 + # LOCAL local_method7_at_D_x_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -4($fp) + # LOCAL local_method7_at_D_x_0 --> -4($fp) + # PARAM param_method7_at_D_num_0 --> 0($fp) + # local_method7_at_D_x_0 = PARAM param_method7_at_D_num_0 + lw $t0, 0($fp) + sw $t0, -4($fp) + # LOCAL local_method7_at_D_internal_4 --> -20($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -20($fp) + # LOCAL local_method7_at_D_internal_3 --> -16($fp) + # LOCAL local_method7_at_D_x_0 --> -4($fp) + # LOCAL local_method7_at_D_internal_4 --> -20($fp) + lw $a0, -4($fp) + lw $a1, -20($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -16($fp) + # IF_GREATER_ZERO local_method7_at_D_internal_3 GOTO label_FALSE_269 + # IF_GREATER_ZERO local_method7_at_D_internal_3 GOTO label_FALSE_269 + lw $t0, -16($fp) + bgt $t0, 0, label_FALSE_269 + # IF_ZERO local_method7_at_D_internal_3 GOTO label_FALSE_269 + # IF_ZERO local_method7_at_D_internal_3 GOTO label_FALSE_269 + lw $t0, -16($fp) + beq $t0, 0, label_FALSE_269 + # LOCAL local_method7_at_D_internal_3 --> -16($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -16($fp) + # GOTO label_END_270 +j label_END_270 +label_FALSE_269: + # LOCAL local_method7_at_D_internal_3 --> -16($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -16($fp) + label_END_270: +# LOCAL local_method7_at_D_internal_1 --> -8($fp) +# LOCAL local_method7_at_D_internal_3 --> -16($fp) +# Obtain value from -16($fp) +lw $v0, -16($fp) +lw $v0, 12($v0) +sw $v0, -8($fp) +# IF_ZERO local_method7_at_D_internal_1 GOTO label_FALSEIF_267 +# IF_ZERO local_method7_at_D_internal_1 GOTO label_FALSEIF_267 +lw $t0, -8($fp) +beq $t0, 0, label_FALSEIF_267 +# LOCAL local_method7_at_D_internal_7 --> -32($fp) +# local_method7_at_D_internal_7 = SELF +sw $s1, -32($fp) +# LOCAL local_method7_at_D_internal_5 --> -24($fp) +# LOCAL local_method7_at_D_internal_7 --> -32($fp) +# local_method7_at_D_internal_5 = local_method7_at_D_internal_7 +lw $t0, -32($fp) +sw $t0, -24($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_method7_at_D_internal_8 --> -36($fp) +# LOCAL local_method7_at_D_x_0 --> -4($fp) +lw $t0, -4($fp) +lw $t0, 12($t0) +not $t0, $t0 +add $t0, $t0, 1 +sw $t0, -36($fp) +# LOCAL local_method7_at_D_internal_8 --> -36($fp) +# LOCAL local_method7_at_D_internal_8 --> -36($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +lw $t0, -36($fp) +sw $t0, 12($v0) +sw $v0, -36($fp) +# ARG local_method7_at_D_internal_8 +# LOCAL local_method7_at_D_internal_8 --> -36($fp) +lw $t0, -36($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_method7_at_D_internal_5 --> -24($fp) +# LOCAL local_method7_at_D_internal_6 --> -28($fp) +# local_method7_at_D_internal_6 = VCALL local_method7_at_D_internal_5 method7 +# Save new self pointer in $s1 +lw $s1, -24($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 0($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -28($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_method7_at_D_internal_2 --> -12($fp) +# LOCAL local_method7_at_D_internal_6 --> -28($fp) +# local_method7_at_D_internal_2 = local_method7_at_D_internal_6 +lw $t0, -28($fp) +sw $t0, -12($fp) +# GOTO label_ENDIF_268 +j label_ENDIF_268 +label_FALSEIF_267: + # LOCAL local_method7_at_D_internal_13 --> -56($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -56($fp) + # IF_ZERO local_method7_at_D_internal_13 GOTO label_FALSE_273 + # IF_ZERO local_method7_at_D_internal_13 GOTO label_FALSE_273 + lw $t0, -56($fp) + beq $t0, 0, label_FALSE_273 + # IF_ZERO local_method7_at_D_x_0 GOTO label_FALSE_273 + # IF_ZERO local_method7_at_D_x_0 GOTO label_FALSE_273 + lw $t0, -4($fp) + beq $t0, 0, label_FALSE_273 + # LOCAL local_method7_at_D_internal_12 --> -52($fp) + # LOCAL local_method7_at_D_internal_13 --> -56($fp) + # Comparing -56($fp) type with String + la $v0, String + lw $a0, -56($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -52($fp) + # IF_ZERO local_method7_at_D_internal_12 GOTO label_COMPARE_STRING_276 + # IF_ZERO local_method7_at_D_internal_12 GOTO label_COMPARE_STRING_276 + lw $t0, -52($fp) + beq $t0, 0, label_COMPARE_STRING_276 + # LOCAL local_method7_at_D_internal_12 --> -52($fp) + # LOCAL local_method7_at_D_internal_13 --> -56($fp) + # Comparing -56($fp) type with Bool + la $v0, Bool + lw $a0, -56($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -52($fp) + # IF_ZERO local_method7_at_D_internal_12 GOTO label_COMPARE_BY_VALUE_277 + # IF_ZERO local_method7_at_D_internal_12 GOTO label_COMPARE_BY_VALUE_277 + lw $t0, -52($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_277 + # LOCAL local_method7_at_D_internal_12 --> -52($fp) + # LOCAL local_method7_at_D_internal_13 --> -56($fp) + # Comparing -56($fp) type with Int + la $v0, Int + lw $a0, -56($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -52($fp) + # IF_ZERO local_method7_at_D_internal_12 GOTO label_COMPARE_BY_VALUE_277 + # IF_ZERO local_method7_at_D_internal_12 GOTO label_COMPARE_BY_VALUE_277 + lw $t0, -52($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_277 + # LOCAL local_method7_at_D_internal_12 --> -52($fp) + # LOCAL local_method7_at_D_internal_13 --> -56($fp) + # LOCAL local_method7_at_D_x_0 --> -4($fp) + # Load pointers and SUB + lw $a0, -56($fp) + lw $a1, -4($fp) + sub $a0, $a0, $a1 + sw $a0, -52($fp) + # IF_ZERO local_method7_at_D_internal_12 GOTO label_TRUE_274 + # IF_ZERO local_method7_at_D_internal_12 GOTO label_TRUE_274 + lw $t0, -52($fp) + beq $t0, 0, label_TRUE_274 + # GOTO label_FALSE_273 + j label_FALSE_273 + label_COMPARE_BY_VALUE_277: + # LOCAL local_method7_at_D_internal_12 --> -52($fp) + # LOCAL local_method7_at_D_internal_13 --> -56($fp) + # LOCAL local_method7_at_D_x_0 --> -4($fp) + lw $a0, -56($fp) + lw $a1, -4($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -52($fp) + # IF_ZERO local_method7_at_D_internal_12 GOTO label_TRUE_274 + # IF_ZERO local_method7_at_D_internal_12 GOTO label_TRUE_274 + lw $t0, -52($fp) + beq $t0, 0, label_TRUE_274 + # GOTO label_FALSE_273 + j label_FALSE_273 + label_COMPARE_STRING_276: + # LOCAL local_method7_at_D_internal_12 --> -52($fp) + # LOCAL local_method7_at_D_internal_13 --> -56($fp) + # LOCAL local_method7_at_D_x_0 --> -4($fp) + # Load strings for comparison + lw $v0, -56($fp) + lw $v1, -4($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -52($fp) + # IF_ZERO local_method7_at_D_internal_12 GOTO label_CONTINUE_278 + # IF_ZERO local_method7_at_D_internal_12 GOTO label_CONTINUE_278 + lw $t0, -52($fp) + beq $t0, 0, label_CONTINUE_278 + # GOTO label_FALSE_273 + j label_FALSE_273 + label_CONTINUE_278: + # LOCAL local_method7_at_D_internal_12 --> -52($fp) + # LOCAL local_method7_at_D_internal_13 --> -56($fp) + # LOCAL local_method7_at_D_x_0 --> -4($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -56($fp) + lw $v1, -4($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_279: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_280 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_279 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_280: + # Store result + sw $a2, -52($fp) + # IF_ZERO local_method7_at_D_internal_12 GOTO label_TRUE_274 + # IF_ZERO local_method7_at_D_internal_12 GOTO label_TRUE_274 + lw $t0, -52($fp) + beq $t0, 0, label_TRUE_274 + label_FALSE_273: + # LOCAL local_method7_at_D_internal_11 --> -48($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -48($fp) + # GOTO label_END_275 +j label_END_275 +label_TRUE_274: + # LOCAL local_method7_at_D_internal_11 --> -48($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -48($fp) + label_END_275: +# LOCAL local_method7_at_D_internal_9 --> -40($fp) +# LOCAL local_method7_at_D_internal_11 --> -48($fp) +# Obtain value from -48($fp) +lw $v0, -48($fp) +lw $v0, 12($v0) +sw $v0, -40($fp) +# IF_ZERO local_method7_at_D_internal_9 GOTO label_FALSEIF_271 +# IF_ZERO local_method7_at_D_internal_9 GOTO label_FALSEIF_271 +lw $t0, -40($fp) +beq $t0, 0, label_FALSEIF_271 +# LOCAL local_method7_at_D_internal_14 --> -60($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Bool +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Bool +sw $t0, 12($v0) +li $t0, 4 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Bool_start +sw $t0, 4($v0) +# Load type offset +li $t0, 12 +sw $t0, 8($v0) +li $t0, 1 +sw $t0, 12($v0) +sw $v0, -60($fp) +# LOCAL local_method7_at_D_internal_10 --> -44($fp) +# LOCAL local_method7_at_D_internal_14 --> -60($fp) +# local_method7_at_D_internal_10 = local_method7_at_D_internal_14 +lw $t0, -60($fp) +sw $t0, -44($fp) +# GOTO label_ENDIF_272 +j label_ENDIF_272 +label_FALSEIF_271: + # LOCAL local_method7_at_D_internal_19 --> -80($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -80($fp) + # IF_ZERO local_method7_at_D_internal_19 GOTO label_FALSE_283 + # IF_ZERO local_method7_at_D_internal_19 GOTO label_FALSE_283 + lw $t0, -80($fp) + beq $t0, 0, label_FALSE_283 + # IF_ZERO local_method7_at_D_x_0 GOTO label_FALSE_283 + # IF_ZERO local_method7_at_D_x_0 GOTO label_FALSE_283 + lw $t0, -4($fp) + beq $t0, 0, label_FALSE_283 + # LOCAL local_method7_at_D_internal_18 --> -76($fp) + # LOCAL local_method7_at_D_internal_19 --> -80($fp) + # Comparing -80($fp) type with String + la $v0, String + lw $a0, -80($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -76($fp) + # IF_ZERO local_method7_at_D_internal_18 GOTO label_COMPARE_STRING_286 + # IF_ZERO local_method7_at_D_internal_18 GOTO label_COMPARE_STRING_286 + lw $t0, -76($fp) + beq $t0, 0, label_COMPARE_STRING_286 + # LOCAL local_method7_at_D_internal_18 --> -76($fp) + # LOCAL local_method7_at_D_internal_19 --> -80($fp) + # Comparing -80($fp) type with Bool + la $v0, Bool + lw $a0, -80($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -76($fp) + # IF_ZERO local_method7_at_D_internal_18 GOTO label_COMPARE_BY_VALUE_287 + # IF_ZERO local_method7_at_D_internal_18 GOTO label_COMPARE_BY_VALUE_287 + lw $t0, -76($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_287 + # LOCAL local_method7_at_D_internal_18 --> -76($fp) + # LOCAL local_method7_at_D_internal_19 --> -80($fp) + # Comparing -80($fp) type with Int + la $v0, Int + lw $a0, -80($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -76($fp) + # IF_ZERO local_method7_at_D_internal_18 GOTO label_COMPARE_BY_VALUE_287 + # IF_ZERO local_method7_at_D_internal_18 GOTO label_COMPARE_BY_VALUE_287 + lw $t0, -76($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_287 + # LOCAL local_method7_at_D_internal_18 --> -76($fp) + # LOCAL local_method7_at_D_internal_19 --> -80($fp) + # LOCAL local_method7_at_D_x_0 --> -4($fp) + # Load pointers and SUB + lw $a0, -80($fp) + lw $a1, -4($fp) + sub $a0, $a0, $a1 + sw $a0, -76($fp) + # IF_ZERO local_method7_at_D_internal_18 GOTO label_TRUE_284 + # IF_ZERO local_method7_at_D_internal_18 GOTO label_TRUE_284 + lw $t0, -76($fp) + beq $t0, 0, label_TRUE_284 + # GOTO label_FALSE_283 + j label_FALSE_283 + label_COMPARE_BY_VALUE_287: + # LOCAL local_method7_at_D_internal_18 --> -76($fp) + # LOCAL local_method7_at_D_internal_19 --> -80($fp) + # LOCAL local_method7_at_D_x_0 --> -4($fp) + lw $a0, -80($fp) + lw $a1, -4($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -76($fp) + # IF_ZERO local_method7_at_D_internal_18 GOTO label_TRUE_284 + # IF_ZERO local_method7_at_D_internal_18 GOTO label_TRUE_284 + lw $t0, -76($fp) + beq $t0, 0, label_TRUE_284 + # GOTO label_FALSE_283 + j label_FALSE_283 + label_COMPARE_STRING_286: + # LOCAL local_method7_at_D_internal_18 --> -76($fp) + # LOCAL local_method7_at_D_internal_19 --> -80($fp) + # LOCAL local_method7_at_D_x_0 --> -4($fp) + # Load strings for comparison + lw $v0, -80($fp) + lw $v1, -4($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -76($fp) + # IF_ZERO local_method7_at_D_internal_18 GOTO label_CONTINUE_288 + # IF_ZERO local_method7_at_D_internal_18 GOTO label_CONTINUE_288 + lw $t0, -76($fp) + beq $t0, 0, label_CONTINUE_288 + # GOTO label_FALSE_283 + j label_FALSE_283 + label_CONTINUE_288: + # LOCAL local_method7_at_D_internal_18 --> -76($fp) + # LOCAL local_method7_at_D_internal_19 --> -80($fp) + # LOCAL local_method7_at_D_x_0 --> -4($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -80($fp) + lw $v1, -4($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_289: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_290 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_289 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_290: + # Store result + sw $a2, -76($fp) + # IF_ZERO local_method7_at_D_internal_18 GOTO label_TRUE_284 + # IF_ZERO local_method7_at_D_internal_18 GOTO label_TRUE_284 + lw $t0, -76($fp) + beq $t0, 0, label_TRUE_284 + label_FALSE_283: + # LOCAL local_method7_at_D_internal_17 --> -72($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -72($fp) + # GOTO label_END_285 +j label_END_285 +label_TRUE_284: + # LOCAL local_method7_at_D_internal_17 --> -72($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -72($fp) + label_END_285: +# LOCAL local_method7_at_D_internal_15 --> -64($fp) +# LOCAL local_method7_at_D_internal_17 --> -72($fp) +# Obtain value from -72($fp) +lw $v0, -72($fp) +lw $v0, 12($v0) +sw $v0, -64($fp) +# IF_ZERO local_method7_at_D_internal_15 GOTO label_FALSEIF_281 +# IF_ZERO local_method7_at_D_internal_15 GOTO label_FALSEIF_281 +lw $t0, -64($fp) +beq $t0, 0, label_FALSEIF_281 +# LOCAL local_method7_at_D_internal_20 --> -84($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Bool +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Bool +sw $t0, 12($v0) +li $t0, 4 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Bool_start +sw $t0, 4($v0) +# Load type offset +li $t0, 12 +sw $t0, 8($v0) +li $t0, 0 +sw $t0, 12($v0) +sw $v0, -84($fp) +# LOCAL local_method7_at_D_internal_16 --> -68($fp) +# LOCAL local_method7_at_D_internal_20 --> -84($fp) +# local_method7_at_D_internal_16 = local_method7_at_D_internal_20 +lw $t0, -84($fp) +sw $t0, -68($fp) +# GOTO label_ENDIF_282 +j label_ENDIF_282 +label_FALSEIF_281: + # LOCAL local_method7_at_D_internal_25 --> -104($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 2 + sw $t0, 12($v0) + sw $v0, -104($fp) + # IF_ZERO local_method7_at_D_internal_25 GOTO label_FALSE_293 + # IF_ZERO local_method7_at_D_internal_25 GOTO label_FALSE_293 + lw $t0, -104($fp) + beq $t0, 0, label_FALSE_293 + # IF_ZERO local_method7_at_D_x_0 GOTO label_FALSE_293 + # IF_ZERO local_method7_at_D_x_0 GOTO label_FALSE_293 + lw $t0, -4($fp) + beq $t0, 0, label_FALSE_293 + # LOCAL local_method7_at_D_internal_24 --> -100($fp) + # LOCAL local_method7_at_D_internal_25 --> -104($fp) + # Comparing -104($fp) type with String + la $v0, String + lw $a0, -104($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -100($fp) + # IF_ZERO local_method7_at_D_internal_24 GOTO label_COMPARE_STRING_296 + # IF_ZERO local_method7_at_D_internal_24 GOTO label_COMPARE_STRING_296 + lw $t0, -100($fp) + beq $t0, 0, label_COMPARE_STRING_296 + # LOCAL local_method7_at_D_internal_24 --> -100($fp) + # LOCAL local_method7_at_D_internal_25 --> -104($fp) + # Comparing -104($fp) type with Bool + la $v0, Bool + lw $a0, -104($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -100($fp) + # IF_ZERO local_method7_at_D_internal_24 GOTO label_COMPARE_BY_VALUE_297 + # IF_ZERO local_method7_at_D_internal_24 GOTO label_COMPARE_BY_VALUE_297 + lw $t0, -100($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_297 + # LOCAL local_method7_at_D_internal_24 --> -100($fp) + # LOCAL local_method7_at_D_internal_25 --> -104($fp) + # Comparing -104($fp) type with Int + la $v0, Int + lw $a0, -104($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -100($fp) + # IF_ZERO local_method7_at_D_internal_24 GOTO label_COMPARE_BY_VALUE_297 + # IF_ZERO local_method7_at_D_internal_24 GOTO label_COMPARE_BY_VALUE_297 + lw $t0, -100($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_297 + # LOCAL local_method7_at_D_internal_24 --> -100($fp) + # LOCAL local_method7_at_D_internal_25 --> -104($fp) + # LOCAL local_method7_at_D_x_0 --> -4($fp) + # Load pointers and SUB + lw $a0, -104($fp) + lw $a1, -4($fp) + sub $a0, $a0, $a1 + sw $a0, -100($fp) + # IF_ZERO local_method7_at_D_internal_24 GOTO label_TRUE_294 + # IF_ZERO local_method7_at_D_internal_24 GOTO label_TRUE_294 + lw $t0, -100($fp) + beq $t0, 0, label_TRUE_294 + # GOTO label_FALSE_293 + j label_FALSE_293 + label_COMPARE_BY_VALUE_297: + # LOCAL local_method7_at_D_internal_24 --> -100($fp) + # LOCAL local_method7_at_D_internal_25 --> -104($fp) + # LOCAL local_method7_at_D_x_0 --> -4($fp) + lw $a0, -104($fp) + lw $a1, -4($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -100($fp) + # IF_ZERO local_method7_at_D_internal_24 GOTO label_TRUE_294 + # IF_ZERO local_method7_at_D_internal_24 GOTO label_TRUE_294 + lw $t0, -100($fp) + beq $t0, 0, label_TRUE_294 + # GOTO label_FALSE_293 + j label_FALSE_293 + label_COMPARE_STRING_296: + # LOCAL local_method7_at_D_internal_24 --> -100($fp) + # LOCAL local_method7_at_D_internal_25 --> -104($fp) + # LOCAL local_method7_at_D_x_0 --> -4($fp) + # Load strings for comparison + lw $v0, -104($fp) + lw $v1, -4($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -100($fp) + # IF_ZERO local_method7_at_D_internal_24 GOTO label_CONTINUE_298 + # IF_ZERO local_method7_at_D_internal_24 GOTO label_CONTINUE_298 + lw $t0, -100($fp) + beq $t0, 0, label_CONTINUE_298 + # GOTO label_FALSE_293 + j label_FALSE_293 + label_CONTINUE_298: + # LOCAL local_method7_at_D_internal_24 --> -100($fp) + # LOCAL local_method7_at_D_internal_25 --> -104($fp) + # LOCAL local_method7_at_D_x_0 --> -4($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -104($fp) + lw $v1, -4($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_299: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_300 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_299 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_300: + # Store result + sw $a2, -100($fp) + # IF_ZERO local_method7_at_D_internal_24 GOTO label_TRUE_294 + # IF_ZERO local_method7_at_D_internal_24 GOTO label_TRUE_294 + lw $t0, -100($fp) + beq $t0, 0, label_TRUE_294 + label_FALSE_293: + # LOCAL local_method7_at_D_internal_23 --> -96($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -96($fp) + # GOTO label_END_295 +j label_END_295 +label_TRUE_294: + # LOCAL local_method7_at_D_internal_23 --> -96($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -96($fp) + label_END_295: +# LOCAL local_method7_at_D_internal_21 --> -88($fp) +# LOCAL local_method7_at_D_internal_23 --> -96($fp) +# Obtain value from -96($fp) +lw $v0, -96($fp) +lw $v0, 12($v0) +sw $v0, -88($fp) +# IF_ZERO local_method7_at_D_internal_21 GOTO label_FALSEIF_291 +# IF_ZERO local_method7_at_D_internal_21 GOTO label_FALSEIF_291 +lw $t0, -88($fp) +beq $t0, 0, label_FALSEIF_291 +# LOCAL local_method7_at_D_internal_26 --> -108($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Bool +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Bool +sw $t0, 12($v0) +li $t0, 4 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Bool_start +sw $t0, 4($v0) +# Load type offset +li $t0, 12 +sw $t0, 8($v0) +li $t0, 0 +sw $t0, 12($v0) +sw $v0, -108($fp) +# LOCAL local_method7_at_D_internal_22 --> -92($fp) +# LOCAL local_method7_at_D_internal_26 --> -108($fp) +# local_method7_at_D_internal_22 = local_method7_at_D_internal_26 +lw $t0, -108($fp) +sw $t0, -92($fp) +# GOTO label_ENDIF_292 +j label_ENDIF_292 +label_FALSEIF_291: + # LOCAL local_method7_at_D_internal_29 --> -120($fp) + # local_method7_at_D_internal_29 = SELF + sw $s1, -120($fp) + # LOCAL local_method7_at_D_internal_27 --> -112($fp) + # LOCAL local_method7_at_D_internal_29 --> -120($fp) + # local_method7_at_D_internal_27 = local_method7_at_D_internal_29 + lw $t0, -120($fp) + sw $t0, -112($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_method7_at_D_internal_31 --> -128($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 3 + sw $t0, 12($v0) + sw $v0, -128($fp) + # LOCAL local_method7_at_D_internal_30 --> -124($fp) + # LOCAL local_method7_at_D_x_0 --> -4($fp) + # LOCAL local_method7_at_D_internal_31 --> -128($fp) + # local_method7_at_D_internal_30 = local_method7_at_D_x_0 - local_method7_at_D_internal_31 + lw $t1, -4($fp) + lw $t0, 12($t1) + lw $t1, -128($fp) + lw $t2, 12($t1) + sub $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -124($fp) + # ARG local_method7_at_D_internal_30 + # LOCAL local_method7_at_D_internal_30 --> -124($fp) + lw $t0, -124($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_method7_at_D_internal_27 --> -112($fp) + # LOCAL local_method7_at_D_internal_28 --> -116($fp) + # local_method7_at_D_internal_28 = VCALL local_method7_at_D_internal_27 method7 + # Save new self pointer in $s1 + lw $s1, -112($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 0($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -116($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_method7_at_D_internal_22 --> -92($fp) + # LOCAL local_method7_at_D_internal_28 --> -116($fp) + # local_method7_at_D_internal_22 = local_method7_at_D_internal_28 + lw $t0, -116($fp) + sw $t0, -92($fp) + label_ENDIF_292: +# LOCAL local_method7_at_D_internal_16 --> -68($fp) +# LOCAL local_method7_at_D_internal_22 --> -92($fp) +# local_method7_at_D_internal_16 = local_method7_at_D_internal_22 +lw $t0, -92($fp) +sw $t0, -68($fp) +label_ENDIF_282: +# LOCAL local_method7_at_D_internal_10 --> -44($fp) +# LOCAL local_method7_at_D_internal_16 --> -68($fp) +# local_method7_at_D_internal_10 = local_method7_at_D_internal_16 +lw $t0, -68($fp) +sw $t0, -44($fp) +label_ENDIF_272: +# LOCAL local_method7_at_D_internal_2 --> -12($fp) +# LOCAL local_method7_at_D_internal_10 --> -44($fp) +# local_method7_at_D_internal_2 = local_method7_at_D_internal_10 +lw $t0, -44($fp) +sw $t0, -12($fp) +label_ENDIF_268: +# RETURN local_method7_at_D_internal_2 +lw $v0, -12($fp) +# Deallocate stack frame for function function_method7_at_D. +# Restore $ra +lw $ra, 4($sp) +# Restore $fp +lw $fp, 0($sp) +# Restore Stack pointer $sp +addu $sp, $sp, 136 +# Deallocate function args +addu $sp, $sp, 4 +jr $ra +# Function END + + +# function_method6_at_E implementation. +# @Params: +# 0($fp) = param_method6_at_E_num_0 +function_method6_at_E: + # Allocate stack frame for function function_method6_at_E. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_method6_at_E_x_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -4($fp) + # LOCAL local_method6_at_E_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 8 + sw $t0, 12($v0) + sw $v0, -12($fp) + # LOCAL local_method6_at_E_internal_1 --> -8($fp) + # PARAM param_method6_at_E_num_0 --> 0($fp) + # LOCAL local_method6_at_E_internal_2 --> -12($fp) + # local_method6_at_E_internal_1 = PARAM param_method6_at_E_num_0 / local_method6_at_E_internal_2 + lw $t1, 0($fp) + lw $t0, 12($t1) + lw $t1, -12($fp) + lw $t2, 12($t1) + div $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -8($fp) + # LOCAL local_method6_at_E_x_0 --> -4($fp) + # LOCAL local_method6_at_E_internal_1 --> -8($fp) + # local_method6_at_E_x_0 = local_method6_at_E_internal_1 + lw $t0, -8($fp) + sw $t0, -4($fp) + # LOCAL local_method6_at_E_internal_5 --> -24($fp) + # local_method6_at_E_internal_5 = ALLOCATE A + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, A + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, A_start + sw $t0, 4($v0) + # Load type offset + li $t0, 24 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __A__attrib__var__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 12($t1) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -24($fp) + # LOCAL local_method6_at_E_internal_3 --> -16($fp) + # LOCAL local_method6_at_E_internal_5 --> -24($fp) + # local_method6_at_E_internal_3 = local_method6_at_E_internal_5 + lw $t0, -24($fp) + sw $t0, -16($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # ARG local_method6_at_E_x_0 + # LOCAL local_method6_at_E_x_0 --> -4($fp) + lw $t0, -4($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_method6_at_E_internal_3 --> -16($fp) + # LOCAL local_method6_at_E_internal_4 --> -20($fp) + # local_method6_at_E_internal_4 = VCALL local_method6_at_E_internal_3 set_var + # Save new self pointer in $s1 + lw $s1, -16($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 120($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -20($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # RETURN local_method6_at_E_internal_4 + lw $v0, -20($fp) + # Deallocate stack frame for function function_method6_at_E. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_method6_at_C implementation. +# @Params: +# 0($fp) = param_method6_at_C_num_0 +function_method6_at_C: + # Allocate stack frame for function function_method6_at_C. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_method6_at_C_x_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -4($fp) + # LOCAL local_method6_at_C_internal_1 --> -8($fp) + # PARAM param_method6_at_C_num_0 --> 0($fp) + lw $t0, 0($fp) + lw $t0, 12($t0) + not $t0, $t0 + add $t0, $t0, 1 + sw $t0, -8($fp) + # LOCAL local_method6_at_C_internal_1 --> -8($fp) + # LOCAL local_method6_at_C_internal_1 --> -8($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + lw $t0, -8($fp) + sw $t0, 12($v0) + sw $v0, -8($fp) + # LOCAL local_method6_at_C_x_0 --> -4($fp) + # LOCAL local_method6_at_C_internal_1 --> -8($fp) + # local_method6_at_C_x_0 = local_method6_at_C_internal_1 + lw $t0, -8($fp) + sw $t0, -4($fp) + # LOCAL local_method6_at_C_internal_4 --> -20($fp) + # local_method6_at_C_internal_4 = ALLOCATE A + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, A + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, A_start + sw $t0, 4($v0) + # Load type offset + li $t0, 24 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __A__attrib__var__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 12($t1) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -20($fp) + # LOCAL local_method6_at_C_internal_2 --> -12($fp) + # LOCAL local_method6_at_C_internal_4 --> -20($fp) + # local_method6_at_C_internal_2 = local_method6_at_C_internal_4 + lw $t0, -20($fp) + sw $t0, -12($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # ARG local_method6_at_C_x_0 + # LOCAL local_method6_at_C_x_0 --> -4($fp) + lw $t0, -4($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_method6_at_C_internal_2 --> -12($fp) + # LOCAL local_method6_at_C_internal_3 --> -16($fp) + # local_method6_at_C_internal_3 = VCALL local_method6_at_C_internal_2 set_var + # Save new self pointer in $s1 + lw $s1, -12($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 120($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -16($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # RETURN local_method6_at_C_internal_3 + lw $v0, -16($fp) + # Deallocate stack frame for function function_method6_at_C. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_method5_at_C implementation. +# @Params: +# 0($fp) = param_method5_at_C_num_0 +function_method5_at_C: + # Allocate stack frame for function function_method5_at_C. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_method5_at_C_x_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -4($fp) + # LOCAL local_method5_at_C_internal_2 --> -12($fp) + # PARAM param_method5_at_C_num_0 --> 0($fp) + # PARAM param_method5_at_C_num_0 --> 0($fp) + # local_method5_at_C_internal_2 = PARAM param_method5_at_C_num_0 * PARAM param_method5_at_C_num_0 + lw $t1, 0($fp) + lw $t0, 12($t1) + lw $t1, 0($fp) + lw $t2, 12($t1) + mul $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -12($fp) + # LOCAL local_method5_at_C_internal_1 --> -8($fp) + # LOCAL local_method5_at_C_internal_2 --> -12($fp) + # PARAM param_method5_at_C_num_0 --> 0($fp) + # local_method5_at_C_internal_1 = local_method5_at_C_internal_2 * PARAM param_method5_at_C_num_0 + lw $t1, -12($fp) + lw $t0, 12($t1) + lw $t1, 0($fp) + lw $t2, 12($t1) + mul $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -8($fp) + # LOCAL local_method5_at_C_x_0 --> -4($fp) + # LOCAL local_method5_at_C_internal_1 --> -8($fp) + # local_method5_at_C_x_0 = local_method5_at_C_internal_1 + lw $t0, -8($fp) + sw $t0, -4($fp) + # LOCAL local_method5_at_C_internal_5 --> -24($fp) + # local_method5_at_C_internal_5 = ALLOCATE E + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, E + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, E_start + sw $t0, 4($v0) + # Load type offset + li $t0, 36 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __A__attrib__var__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 12($t1) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -24($fp) + # LOCAL local_method5_at_C_internal_3 --> -16($fp) + # LOCAL local_method5_at_C_internal_5 --> -24($fp) + # local_method5_at_C_internal_3 = local_method5_at_C_internal_5 + lw $t0, -24($fp) + sw $t0, -16($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # ARG local_method5_at_C_x_0 + # LOCAL local_method5_at_C_x_0 --> -4($fp) + lw $t0, -4($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_method5_at_C_internal_3 --> -16($fp) + # LOCAL local_method5_at_C_internal_4 --> -20($fp) + # local_method5_at_C_internal_4 = VCALL local_method5_at_C_internal_3 set_var + # Save new self pointer in $s1 + lw $s1, -16($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 120($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -20($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # RETURN local_method5_at_C_internal_4 + lw $v0, -20($fp) + # Deallocate stack frame for function function_method5_at_C. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# __Main__attrib__char__init implementation. +# @Params: +__Main__attrib__char__init: + # Allocate stack frame for function __Main__attrib__char__init. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_ttrib__char__init_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_0 + sw $t0, 12($v0) + li $t0, 0 + sw $t0, 16($v0) + sw $v0, -4($fp) + # RETURN local_ttrib__char__init_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function __Main__attrib__char__init. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# __Main__attrib__avar__init implementation. +# @Params: +__Main__attrib__avar__init: + # Allocate stack frame for function __Main__attrib__avar__init. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # RETURN 0 + li $v0, 0 + # Deallocate stack frame for function __Main__attrib__avar__init. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# __Main__attrib__a_var__init implementation. +# @Params: +__Main__attrib__a_var__init: + # Allocate stack frame for function __Main__attrib__a_var__init. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # RETURN 0 + li $v0, 0 + # Deallocate stack frame for function __Main__attrib__a_var__init. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# __Main__attrib__flag__init implementation. +# @Params: +__Main__attrib__flag__init: + # Allocate stack frame for function __Main__attrib__flag__init. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_ttrib__flag__init_internal_1 --> -8($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -8($fp) + # RETURN local_ttrib__flag__init_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function __Main__attrib__flag__init. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_menu_at_Main implementation. +# @Params: +function_menu_at_Main: + # Allocate stack frame for function function_menu_at_Main. + subu $sp, $sp, 436 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 436 + # LOCAL local_menu_at_Main_internal_2 --> -12($fp) + # local_menu_at_Main_internal_2 = SELF + sw $s1, -12($fp) + # LOCAL local_menu_at_Main_internal_0 --> -4($fp) + # LOCAL local_menu_at_Main_internal_2 --> -12($fp) + # local_menu_at_Main_internal_0 = local_menu_at_Main_internal_2 + lw $t0, -12($fp) + sw $t0, -4($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_menu_at_Main_internal_3 --> -16($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_30 + sw $t0, 12($v0) + li $t0, 22 + sw $t0, 16($v0) + sw $v0, -16($fp) + # ARG local_menu_at_Main_internal_3 + # LOCAL local_menu_at_Main_internal_3 --> -16($fp) + lw $t0, -16($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_menu_at_Main_internal_0 --> -4($fp) + # LOCAL local_menu_at_Main_internal_1 --> -8($fp) + # local_menu_at_Main_internal_1 = VCALL local_menu_at_Main_internal_0 out_string + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 88($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -8($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_menu_at_Main_internal_6 --> -28($fp) + # local_menu_at_Main_internal_6 = SELF + sw $s1, -28($fp) + # LOCAL local_menu_at_Main_internal_4 --> -20($fp) + # LOCAL local_menu_at_Main_internal_6 --> -28($fp) + # local_menu_at_Main_internal_4 = local_menu_at_Main_internal_6 + lw $t0, -28($fp) + sw $t0, -20($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # local_menu_at_Main_internal_7 = GETATTRIBUTE avar Main + # LOCAL local_menu_at_Main_internal_7 --> -32($fp) + lw $t0, 16($s1) + sw $t0, -32($fp) + # ARG local_menu_at_Main_internal_7 + # LOCAL local_menu_at_Main_internal_7 --> -32($fp) + lw $t0, -32($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_menu_at_Main_internal_4 --> -20($fp) + # LOCAL local_menu_at_Main_internal_5 --> -24($fp) + # local_menu_at_Main_internal_5 = VCALL local_menu_at_Main_internal_4 print + # Save new self pointer in $s1 + lw $s1, -20($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 72($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -24($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_menu_at_Main_internal_10 --> -44($fp) + # local_menu_at_Main_internal_10 = SELF + sw $s1, -44($fp) + # LOCAL local_menu_at_Main_internal_8 --> -36($fp) + # LOCAL local_menu_at_Main_internal_10 --> -44($fp) + # local_menu_at_Main_internal_8 = local_menu_at_Main_internal_10 + lw $t0, -44($fp) + sw $t0, -36($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_menu_at_Main_internal_11 --> -48($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_31 + sw $t0, 12($v0) + li $t0, 12 + sw $t0, 16($v0) + sw $v0, -48($fp) + # ARG local_menu_at_Main_internal_11 + # LOCAL local_menu_at_Main_internal_11 --> -48($fp) + lw $t0, -48($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_menu_at_Main_internal_8 --> -36($fp) + # LOCAL local_menu_at_Main_internal_9 --> -40($fp) + # local_menu_at_Main_internal_9 = VCALL local_menu_at_Main_internal_8 out_string + # Save new self pointer in $s1 + lw $s1, -36($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 88($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -40($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_menu_at_Main_internal_14 --> -60($fp) + # local_menu_at_Main_internal_14 = SELF + sw $s1, -60($fp) + # LOCAL local_menu_at_Main_internal_12 --> -52($fp) + # LOCAL local_menu_at_Main_internal_14 --> -60($fp) + # local_menu_at_Main_internal_12 = local_menu_at_Main_internal_14 + lw $t0, -60($fp) + sw $t0, -52($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_menu_at_Main_internal_15 --> -64($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_32 + sw $t0, 12($v0) + li $t0, 12 + sw $t0, 16($v0) + sw $v0, -64($fp) + # ARG local_menu_at_Main_internal_15 + # LOCAL local_menu_at_Main_internal_15 --> -64($fp) + lw $t0, -64($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_menu_at_Main_internal_12 --> -52($fp) + # LOCAL local_menu_at_Main_internal_13 --> -56($fp) + # local_menu_at_Main_internal_13 = VCALL local_menu_at_Main_internal_12 out_string + # Save new self pointer in $s1 + lw $s1, -52($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 88($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -56($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_menu_at_Main_internal_18 --> -76($fp) + # local_menu_at_Main_internal_18 = SELF + sw $s1, -76($fp) + # LOCAL local_menu_at_Main_internal_16 --> -68($fp) + # LOCAL local_menu_at_Main_internal_18 --> -76($fp) + # local_menu_at_Main_internal_16 = local_menu_at_Main_internal_18 + lw $t0, -76($fp) + sw $t0, -68($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # local_menu_at_Main_internal_19 = GETATTRIBUTE avar Main + # LOCAL local_menu_at_Main_internal_19 --> -80($fp) + lw $t0, 16($s1) + sw $t0, -80($fp) + # ARG local_menu_at_Main_internal_19 + # LOCAL local_menu_at_Main_internal_19 --> -80($fp) + lw $t0, -80($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_menu_at_Main_internal_16 --> -68($fp) + # LOCAL local_menu_at_Main_internal_17 --> -72($fp) + # local_menu_at_Main_internal_17 = VCALL local_menu_at_Main_internal_16 print + # Save new self pointer in $s1 + lw $s1, -68($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 72($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -72($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_menu_at_Main_internal_22 --> -92($fp) + # local_menu_at_Main_internal_22 = SELF + sw $s1, -92($fp) + # LOCAL local_menu_at_Main_internal_20 --> -84($fp) + # LOCAL local_menu_at_Main_internal_22 --> -92($fp) + # local_menu_at_Main_internal_20 = local_menu_at_Main_internal_22 + lw $t0, -92($fp) + sw $t0, -84($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_menu_at_Main_internal_23 --> -96($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_33 + sw $t0, 12($v0) + li $t0, 12 + sw $t0, 16($v0) + sw $v0, -96($fp) + # ARG local_menu_at_Main_internal_23 + # LOCAL local_menu_at_Main_internal_23 --> -96($fp) + lw $t0, -96($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_menu_at_Main_internal_20 --> -84($fp) + # LOCAL local_menu_at_Main_internal_21 --> -88($fp) + # local_menu_at_Main_internal_21 = VCALL local_menu_at_Main_internal_20 out_string + # Save new self pointer in $s1 + lw $s1, -84($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 88($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -88($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_menu_at_Main_internal_26 --> -108($fp) + # local_menu_at_Main_internal_26 = SELF + sw $s1, -108($fp) + # LOCAL local_menu_at_Main_internal_24 --> -100($fp) + # LOCAL local_menu_at_Main_internal_26 --> -108($fp) + # local_menu_at_Main_internal_24 = local_menu_at_Main_internal_26 + lw $t0, -108($fp) + sw $t0, -100($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_menu_at_Main_internal_27 --> -112($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_34 + sw $t0, 12($v0) + li $t0, 33 + sw $t0, 16($v0) + sw $v0, -112($fp) + # ARG local_menu_at_Main_internal_27 + # LOCAL local_menu_at_Main_internal_27 --> -112($fp) + lw $t0, -112($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_menu_at_Main_internal_24 --> -100($fp) + # LOCAL local_menu_at_Main_internal_25 --> -104($fp) + # local_menu_at_Main_internal_25 = VCALL local_menu_at_Main_internal_24 out_string + # Save new self pointer in $s1 + lw $s1, -100($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 88($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -104($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_menu_at_Main_internal_30 --> -124($fp) + # local_menu_at_Main_internal_30 = SELF + sw $s1, -124($fp) + # LOCAL local_menu_at_Main_internal_28 --> -116($fp) + # LOCAL local_menu_at_Main_internal_30 --> -124($fp) + # local_menu_at_Main_internal_28 = local_menu_at_Main_internal_30 + lw $t0, -124($fp) + sw $t0, -116($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # local_menu_at_Main_internal_31 = GETATTRIBUTE avar Main + # LOCAL local_menu_at_Main_internal_31 --> -128($fp) + lw $t0, 16($s1) + sw $t0, -128($fp) + # ARG local_menu_at_Main_internal_31 + # LOCAL local_menu_at_Main_internal_31 --> -128($fp) + lw $t0, -128($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_menu_at_Main_internal_28 --> -116($fp) + # LOCAL local_menu_at_Main_internal_29 --> -120($fp) + # local_menu_at_Main_internal_29 = VCALL local_menu_at_Main_internal_28 print + # Save new self pointer in $s1 + lw $s1, -116($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 72($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -120($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_menu_at_Main_internal_34 --> -140($fp) + # local_menu_at_Main_internal_34 = SELF + sw $s1, -140($fp) + # LOCAL local_menu_at_Main_internal_32 --> -132($fp) + # LOCAL local_menu_at_Main_internal_34 --> -140($fp) + # local_menu_at_Main_internal_32 = local_menu_at_Main_internal_34 + lw $t0, -140($fp) + sw $t0, -132($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_menu_at_Main_internal_35 --> -144($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_35 + sw $t0, 12($v0) + li $t0, 30 + sw $t0, 16($v0) + sw $v0, -144($fp) + # ARG local_menu_at_Main_internal_35 + # LOCAL local_menu_at_Main_internal_35 --> -144($fp) + lw $t0, -144($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_menu_at_Main_internal_32 --> -132($fp) + # LOCAL local_menu_at_Main_internal_33 --> -136($fp) + # local_menu_at_Main_internal_33 = VCALL local_menu_at_Main_internal_32 out_string + # Save new self pointer in $s1 + lw $s1, -132($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 88($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -136($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_menu_at_Main_internal_38 --> -156($fp) + # local_menu_at_Main_internal_38 = SELF + sw $s1, -156($fp) + # LOCAL local_menu_at_Main_internal_36 --> -148($fp) + # LOCAL local_menu_at_Main_internal_38 --> -156($fp) + # local_menu_at_Main_internal_36 = local_menu_at_Main_internal_38 + lw $t0, -156($fp) + sw $t0, -148($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_menu_at_Main_internal_39 --> -160($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_36 + sw $t0, 12($v0) + li $t0, 27 + sw $t0, 16($v0) + sw $v0, -160($fp) + # ARG local_menu_at_Main_internal_39 + # LOCAL local_menu_at_Main_internal_39 --> -160($fp) + lw $t0, -160($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_menu_at_Main_internal_36 --> -148($fp) + # LOCAL local_menu_at_Main_internal_37 --> -152($fp) + # local_menu_at_Main_internal_37 = VCALL local_menu_at_Main_internal_36 out_string + # Save new self pointer in $s1 + lw $s1, -148($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 88($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -152($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_menu_at_Main_internal_42 --> -172($fp) + # local_menu_at_Main_internal_42 = SELF + sw $s1, -172($fp) + # LOCAL local_menu_at_Main_internal_40 --> -164($fp) + # LOCAL local_menu_at_Main_internal_42 --> -172($fp) + # local_menu_at_Main_internal_40 = local_menu_at_Main_internal_42 + lw $t0, -172($fp) + sw $t0, -164($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # local_menu_at_Main_internal_43 = GETATTRIBUTE avar Main + # LOCAL local_menu_at_Main_internal_43 --> -176($fp) + lw $t0, 16($s1) + sw $t0, -176($fp) + # ARG local_menu_at_Main_internal_43 + # LOCAL local_menu_at_Main_internal_43 --> -176($fp) + lw $t0, -176($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_menu_at_Main_internal_40 --> -164($fp) + # LOCAL local_menu_at_Main_internal_41 --> -168($fp) + # local_menu_at_Main_internal_41 = VCALL local_menu_at_Main_internal_40 print + # Save new self pointer in $s1 + lw $s1, -164($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 72($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -168($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_menu_at_Main_internal_46 --> -188($fp) + # local_menu_at_Main_internal_46 = SELF + sw $s1, -188($fp) + # LOCAL local_menu_at_Main_internal_44 --> -180($fp) + # LOCAL local_menu_at_Main_internal_46 --> -188($fp) + # local_menu_at_Main_internal_44 = local_menu_at_Main_internal_46 + lw $t0, -188($fp) + sw $t0, -180($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_menu_at_Main_internal_47 --> -192($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_37 + sw $t0, 12($v0) + li $t0, 12 + sw $t0, 16($v0) + sw $v0, -192($fp) + # ARG local_menu_at_Main_internal_47 + # LOCAL local_menu_at_Main_internal_47 --> -192($fp) + lw $t0, -192($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_menu_at_Main_internal_44 --> -180($fp) + # LOCAL local_menu_at_Main_internal_45 --> -184($fp) + # local_menu_at_Main_internal_45 = VCALL local_menu_at_Main_internal_44 out_string + # Save new self pointer in $s1 + lw $s1, -180($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 88($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -184($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_menu_at_Main_internal_50 --> -204($fp) + # local_menu_at_Main_internal_50 = SELF + sw $s1, -204($fp) + # LOCAL local_menu_at_Main_internal_48 --> -196($fp) + # LOCAL local_menu_at_Main_internal_50 --> -204($fp) + # local_menu_at_Main_internal_48 = local_menu_at_Main_internal_50 + lw $t0, -204($fp) + sw $t0, -196($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_menu_at_Main_internal_51 --> -208($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_38 + sw $t0, 12($v0) + li $t0, 12 + sw $t0, 16($v0) + sw $v0, -208($fp) + # ARG local_menu_at_Main_internal_51 + # LOCAL local_menu_at_Main_internal_51 --> -208($fp) + lw $t0, -208($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_menu_at_Main_internal_48 --> -196($fp) + # LOCAL local_menu_at_Main_internal_49 --> -200($fp) + # local_menu_at_Main_internal_49 = VCALL local_menu_at_Main_internal_48 out_string + # Save new self pointer in $s1 + lw $s1, -196($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 88($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -200($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_menu_at_Main_internal_54 --> -220($fp) + # local_menu_at_Main_internal_54 = SELF + sw $s1, -220($fp) + # LOCAL local_menu_at_Main_internal_52 --> -212($fp) + # LOCAL local_menu_at_Main_internal_54 --> -220($fp) + # local_menu_at_Main_internal_52 = local_menu_at_Main_internal_54 + lw $t0, -220($fp) + sw $t0, -212($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # local_menu_at_Main_internal_55 = GETATTRIBUTE avar Main + # LOCAL local_menu_at_Main_internal_55 --> -224($fp) + lw $t0, 16($s1) + sw $t0, -224($fp) + # ARG local_menu_at_Main_internal_55 + # LOCAL local_menu_at_Main_internal_55 --> -224($fp) + lw $t0, -224($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_menu_at_Main_internal_52 --> -212($fp) + # LOCAL local_menu_at_Main_internal_53 --> -216($fp) + # local_menu_at_Main_internal_53 = VCALL local_menu_at_Main_internal_52 print + # Save new self pointer in $s1 + lw $s1, -212($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 72($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -216($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_menu_at_Main_internal_58 --> -236($fp) + # local_menu_at_Main_internal_58 = SELF + sw $s1, -236($fp) + # LOCAL local_menu_at_Main_internal_56 --> -228($fp) + # LOCAL local_menu_at_Main_internal_58 --> -236($fp) + # local_menu_at_Main_internal_56 = local_menu_at_Main_internal_58 + lw $t0, -236($fp) + sw $t0, -228($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_menu_at_Main_internal_59 --> -240($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_39 + sw $t0, 12($v0) + li $t0, 12 + sw $t0, 16($v0) + sw $v0, -240($fp) + # ARG local_menu_at_Main_internal_59 + # LOCAL local_menu_at_Main_internal_59 --> -240($fp) + lw $t0, -240($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_menu_at_Main_internal_56 --> -228($fp) + # LOCAL local_menu_at_Main_internal_57 --> -232($fp) + # local_menu_at_Main_internal_57 = VCALL local_menu_at_Main_internal_56 out_string + # Save new self pointer in $s1 + lw $s1, -228($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 88($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -232($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_menu_at_Main_internal_62 --> -252($fp) + # local_menu_at_Main_internal_62 = SELF + sw $s1, -252($fp) + # LOCAL local_menu_at_Main_internal_60 --> -244($fp) + # LOCAL local_menu_at_Main_internal_62 --> -252($fp) + # local_menu_at_Main_internal_60 = local_menu_at_Main_internal_62 + lw $t0, -252($fp) + sw $t0, -244($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_menu_at_Main_internal_63 --> -256($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_40 + sw $t0, 12($v0) + li $t0, 10 + sw $t0, 16($v0) + sw $v0, -256($fp) + # ARG local_menu_at_Main_internal_63 + # LOCAL local_menu_at_Main_internal_63 --> -256($fp) + lw $t0, -256($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_menu_at_Main_internal_60 --> -244($fp) + # LOCAL local_menu_at_Main_internal_61 --> -248($fp) + # local_menu_at_Main_internal_61 = VCALL local_menu_at_Main_internal_60 out_string + # Save new self pointer in $s1 + lw $s1, -244($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 88($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -248($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_menu_at_Main_internal_66 --> -268($fp) + # local_menu_at_Main_internal_66 = SELF + sw $s1, -268($fp) + # LOCAL local_menu_at_Main_internal_64 --> -260($fp) + # LOCAL local_menu_at_Main_internal_66 --> -268($fp) + # local_menu_at_Main_internal_64 = local_menu_at_Main_internal_66 + lw $t0, -268($fp) + sw $t0, -260($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # local_menu_at_Main_internal_67 = GETATTRIBUTE avar Main + # LOCAL local_menu_at_Main_internal_67 --> -272($fp) + lw $t0, 16($s1) + sw $t0, -272($fp) + # ARG local_menu_at_Main_internal_67 + # LOCAL local_menu_at_Main_internal_67 --> -272($fp) + lw $t0, -272($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_menu_at_Main_internal_64 --> -260($fp) + # LOCAL local_menu_at_Main_internal_65 --> -264($fp) + # local_menu_at_Main_internal_65 = VCALL local_menu_at_Main_internal_64 print + # Save new self pointer in $s1 + lw $s1, -260($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 72($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -264($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_menu_at_Main_internal_70 --> -284($fp) + # local_menu_at_Main_internal_70 = SELF + sw $s1, -284($fp) + # LOCAL local_menu_at_Main_internal_68 --> -276($fp) + # LOCAL local_menu_at_Main_internal_70 --> -284($fp) + # local_menu_at_Main_internal_68 = local_menu_at_Main_internal_70 + lw $t0, -284($fp) + sw $t0, -276($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_menu_at_Main_internal_71 --> -288($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_41 + sw $t0, 12($v0) + li $t0, 12 + sw $t0, 16($v0) + sw $v0, -288($fp) + # ARG local_menu_at_Main_internal_71 + # LOCAL local_menu_at_Main_internal_71 --> -288($fp) + lw $t0, -288($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_menu_at_Main_internal_68 --> -276($fp) + # LOCAL local_menu_at_Main_internal_69 --> -280($fp) + # local_menu_at_Main_internal_69 = VCALL local_menu_at_Main_internal_68 out_string + # Save new self pointer in $s1 + lw $s1, -276($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 88($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -280($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_menu_at_Main_internal_74 --> -300($fp) + # local_menu_at_Main_internal_74 = SELF + sw $s1, -300($fp) + # LOCAL local_menu_at_Main_internal_72 --> -292($fp) + # LOCAL local_menu_at_Main_internal_74 --> -300($fp) + # local_menu_at_Main_internal_72 = local_menu_at_Main_internal_74 + lw $t0, -300($fp) + sw $t0, -292($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_menu_at_Main_internal_75 --> -304($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_42 + sw $t0, 12($v0) + li $t0, 17 + sw $t0, 16($v0) + sw $v0, -304($fp) + # ARG local_menu_at_Main_internal_75 + # LOCAL local_menu_at_Main_internal_75 --> -304($fp) + lw $t0, -304($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_menu_at_Main_internal_72 --> -292($fp) + # LOCAL local_menu_at_Main_internal_73 --> -296($fp) + # local_menu_at_Main_internal_73 = VCALL local_menu_at_Main_internal_72 out_string + # Save new self pointer in $s1 + lw $s1, -292($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 88($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -296($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_menu_at_Main_internal_78 --> -316($fp) + # local_menu_at_Main_internal_78 = SELF + sw $s1, -316($fp) + # LOCAL local_menu_at_Main_internal_76 --> -308($fp) + # LOCAL local_menu_at_Main_internal_78 --> -316($fp) + # local_menu_at_Main_internal_76 = local_menu_at_Main_internal_78 + lw $t0, -316($fp) + sw $t0, -308($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # local_menu_at_Main_internal_79 = GETATTRIBUTE avar Main + # LOCAL local_menu_at_Main_internal_79 --> -320($fp) + lw $t0, 16($s1) + sw $t0, -320($fp) + # ARG local_menu_at_Main_internal_79 + # LOCAL local_menu_at_Main_internal_79 --> -320($fp) + lw $t0, -320($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_menu_at_Main_internal_76 --> -308($fp) + # LOCAL local_menu_at_Main_internal_77 --> -312($fp) + # local_menu_at_Main_internal_77 = VCALL local_menu_at_Main_internal_76 print + # Save new self pointer in $s1 + lw $s1, -308($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 72($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -312($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_menu_at_Main_internal_82 --> -332($fp) + # local_menu_at_Main_internal_82 = SELF + sw $s1, -332($fp) + # LOCAL local_menu_at_Main_internal_80 --> -324($fp) + # LOCAL local_menu_at_Main_internal_82 --> -332($fp) + # local_menu_at_Main_internal_80 = local_menu_at_Main_internal_82 + lw $t0, -332($fp) + sw $t0, -324($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_menu_at_Main_internal_83 --> -336($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_43 + sw $t0, 12($v0) + li $t0, 30 + sw $t0, 16($v0) + sw $v0, -336($fp) + # ARG local_menu_at_Main_internal_83 + # LOCAL local_menu_at_Main_internal_83 --> -336($fp) + lw $t0, -336($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_menu_at_Main_internal_80 --> -324($fp) + # LOCAL local_menu_at_Main_internal_81 --> -328($fp) + # local_menu_at_Main_internal_81 = VCALL local_menu_at_Main_internal_80 out_string + # Save new self pointer in $s1 + lw $s1, -324($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 88($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -328($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_menu_at_Main_internal_86 --> -348($fp) + # local_menu_at_Main_internal_86 = SELF + sw $s1, -348($fp) + # LOCAL local_menu_at_Main_internal_84 --> -340($fp) + # LOCAL local_menu_at_Main_internal_86 --> -348($fp) + # local_menu_at_Main_internal_84 = local_menu_at_Main_internal_86 + lw $t0, -348($fp) + sw $t0, -340($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_menu_at_Main_internal_87 --> -352($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_44 + sw $t0, 12($v0) + li $t0, 12 + sw $t0, 16($v0) + sw $v0, -352($fp) + # ARG local_menu_at_Main_internal_87 + # LOCAL local_menu_at_Main_internal_87 --> -352($fp) + lw $t0, -352($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_menu_at_Main_internal_84 --> -340($fp) + # LOCAL local_menu_at_Main_internal_85 --> -344($fp) + # local_menu_at_Main_internal_85 = VCALL local_menu_at_Main_internal_84 out_string + # Save new self pointer in $s1 + lw $s1, -340($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 88($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -344($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_menu_at_Main_internal_90 --> -364($fp) + # local_menu_at_Main_internal_90 = SELF + sw $s1, -364($fp) + # LOCAL local_menu_at_Main_internal_88 --> -356($fp) + # LOCAL local_menu_at_Main_internal_90 --> -364($fp) + # local_menu_at_Main_internal_88 = local_menu_at_Main_internal_90 + lw $t0, -364($fp) + sw $t0, -356($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # local_menu_at_Main_internal_91 = GETATTRIBUTE avar Main + # LOCAL local_menu_at_Main_internal_91 --> -368($fp) + lw $t0, 16($s1) + sw $t0, -368($fp) + # ARG local_menu_at_Main_internal_91 + # LOCAL local_menu_at_Main_internal_91 --> -368($fp) + lw $t0, -368($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_menu_at_Main_internal_88 --> -356($fp) + # LOCAL local_menu_at_Main_internal_89 --> -360($fp) + # local_menu_at_Main_internal_89 = VCALL local_menu_at_Main_internal_88 print + # Save new self pointer in $s1 + lw $s1, -356($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 72($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -360($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_menu_at_Main_internal_94 --> -380($fp) + # local_menu_at_Main_internal_94 = SELF + sw $s1, -380($fp) + # LOCAL local_menu_at_Main_internal_92 --> -372($fp) + # LOCAL local_menu_at_Main_internal_94 --> -380($fp) + # local_menu_at_Main_internal_92 = local_menu_at_Main_internal_94 + lw $t0, -380($fp) + sw $t0, -372($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_menu_at_Main_internal_95 --> -384($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_45 + sw $t0, 12($v0) + li $t0, 16 + sw $t0, 16($v0) + sw $v0, -384($fp) + # ARG local_menu_at_Main_internal_95 + # LOCAL local_menu_at_Main_internal_95 --> -384($fp) + lw $t0, -384($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_menu_at_Main_internal_92 --> -372($fp) + # LOCAL local_menu_at_Main_internal_93 --> -376($fp) + # local_menu_at_Main_internal_93 = VCALL local_menu_at_Main_internal_92 out_string + # Save new self pointer in $s1 + lw $s1, -372($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 88($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -376($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_menu_at_Main_internal_98 --> -396($fp) + # local_menu_at_Main_internal_98 = SELF + sw $s1, -396($fp) + # LOCAL local_menu_at_Main_internal_96 --> -388($fp) + # LOCAL local_menu_at_Main_internal_98 --> -396($fp) + # local_menu_at_Main_internal_96 = local_menu_at_Main_internal_98 + lw $t0, -396($fp) + sw $t0, -388($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_menu_at_Main_internal_99 --> -400($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_46 + sw $t0, 12($v0) + li $t0, 33 + sw $t0, 16($v0) + sw $v0, -400($fp) + # ARG local_menu_at_Main_internal_99 + # LOCAL local_menu_at_Main_internal_99 --> -400($fp) + lw $t0, -400($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_menu_at_Main_internal_96 --> -388($fp) + # LOCAL local_menu_at_Main_internal_97 --> -392($fp) + # local_menu_at_Main_internal_97 = VCALL local_menu_at_Main_internal_96 out_string + # Save new self pointer in $s1 + lw $s1, -388($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 88($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -392($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_menu_at_Main_internal_102 --> -412($fp) + # local_menu_at_Main_internal_102 = SELF + sw $s1, -412($fp) + # LOCAL local_menu_at_Main_internal_100 --> -404($fp) + # LOCAL local_menu_at_Main_internal_102 --> -412($fp) + # local_menu_at_Main_internal_100 = local_menu_at_Main_internal_102 + lw $t0, -412($fp) + sw $t0, -404($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_menu_at_Main_internal_103 --> -416($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_47 + sw $t0, 12($v0) + li $t0, 22 + sw $t0, 16($v0) + sw $v0, -416($fp) + # ARG local_menu_at_Main_internal_103 + # LOCAL local_menu_at_Main_internal_103 --> -416($fp) + lw $t0, -416($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_menu_at_Main_internal_100 --> -404($fp) + # LOCAL local_menu_at_Main_internal_101 --> -408($fp) + # local_menu_at_Main_internal_101 = VCALL local_menu_at_Main_internal_100 out_string + # Save new self pointer in $s1 + lw $s1, -404($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 88($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -408($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_menu_at_Main_internal_106 --> -428($fp) + # local_menu_at_Main_internal_106 = SELF + sw $s1, -428($fp) + # LOCAL local_menu_at_Main_internal_104 --> -420($fp) + # LOCAL local_menu_at_Main_internal_106 --> -428($fp) + # local_menu_at_Main_internal_104 = local_menu_at_Main_internal_106 + lw $t0, -428($fp) + sw $t0, -420($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_menu_at_Main_internal_104 --> -420($fp) + # LOCAL local_menu_at_Main_internal_105 --> -424($fp) + # local_menu_at_Main_internal_105 = VCALL local_menu_at_Main_internal_104 in_string + # Save new self pointer in $s1 + lw $s1, -420($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 28($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -424($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # RETURN local_menu_at_Main_internal_105 + lw $v0, -424($fp) + # Deallocate stack frame for function function_menu_at_Main. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 436 + jr $ra + # Function END + + +# function_prompt_at_Main implementation. +# @Params: +function_prompt_at_Main: + # Allocate stack frame for function function_prompt_at_Main. + subu $sp, $sp, 52 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 52 + # LOCAL local_prompt_at_Main_internal_2 --> -12($fp) + # local_prompt_at_Main_internal_2 = SELF + sw $s1, -12($fp) + # LOCAL local_prompt_at_Main_internal_0 --> -4($fp) + # LOCAL local_prompt_at_Main_internal_2 --> -12($fp) + # local_prompt_at_Main_internal_0 = local_prompt_at_Main_internal_2 + lw $t0, -12($fp) + sw $t0, -4($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_prompt_at_Main_internal_3 --> -16($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_48 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -16($fp) + # ARG local_prompt_at_Main_internal_3 + # LOCAL local_prompt_at_Main_internal_3 --> -16($fp) + lw $t0, -16($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_prompt_at_Main_internal_0 --> -4($fp) + # LOCAL local_prompt_at_Main_internal_1 --> -8($fp) + # local_prompt_at_Main_internal_1 = VCALL local_prompt_at_Main_internal_0 out_string + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 88($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -8($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_prompt_at_Main_internal_6 --> -28($fp) + # local_prompt_at_Main_internal_6 = SELF + sw $s1, -28($fp) + # LOCAL local_prompt_at_Main_internal_4 --> -20($fp) + # LOCAL local_prompt_at_Main_internal_6 --> -28($fp) + # local_prompt_at_Main_internal_4 = local_prompt_at_Main_internal_6 + lw $t0, -28($fp) + sw $t0, -20($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_prompt_at_Main_internal_7 --> -32($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_49 + sw $t0, 12($v0) + li $t0, 26 + sw $t0, 16($v0) + sw $v0, -32($fp) + # ARG local_prompt_at_Main_internal_7 + # LOCAL local_prompt_at_Main_internal_7 --> -32($fp) + lw $t0, -32($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_prompt_at_Main_internal_4 --> -20($fp) + # LOCAL local_prompt_at_Main_internal_5 --> -24($fp) + # local_prompt_at_Main_internal_5 = VCALL local_prompt_at_Main_internal_4 out_string + # Save new self pointer in $s1 + lw $s1, -20($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 88($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -24($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_prompt_at_Main_internal_10 --> -44($fp) + # local_prompt_at_Main_internal_10 = SELF + sw $s1, -44($fp) + # LOCAL local_prompt_at_Main_internal_8 --> -36($fp) + # LOCAL local_prompt_at_Main_internal_10 --> -44($fp) + # local_prompt_at_Main_internal_8 = local_prompt_at_Main_internal_10 + lw $t0, -44($fp) + sw $t0, -36($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_prompt_at_Main_internal_8 --> -36($fp) + # LOCAL local_prompt_at_Main_internal_9 --> -40($fp) + # local_prompt_at_Main_internal_9 = VCALL local_prompt_at_Main_internal_8 in_string + # Save new self pointer in $s1 + lw $s1, -36($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 28($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -40($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # RETURN local_prompt_at_Main_internal_9 + lw $v0, -40($fp) + # Deallocate stack frame for function function_prompt_at_Main. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 52 + jr $ra + # Function END + + +# function_get_int_at_Main implementation. +# @Params: +function_get_int_at_Main: + # Allocate stack frame for function function_get_int_at_Main. + subu $sp, $sp, 40 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 40 + # LOCAL local_get_int_at_Main_z_0 --> -4($fp) + # local_get_int_at_Main_z_0 = 0 + li $t0, 0 + sw $t0, -4($fp) + # LOCAL local_get_int_at_Main_internal_1 --> -8($fp) + # local_get_int_at_Main_internal_1 = ALLOCATE A2I + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, A2I + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 12 bytes of memory + li $a0, 12 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, A2I_start + sw $t0, 4($v0) + # Load type offset + li $t0, 20 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -8($fp) + # LOCAL local_get_int_at_Main_z_0 --> -4($fp) + # LOCAL local_get_int_at_Main_internal_1 --> -8($fp) + # local_get_int_at_Main_z_0 = local_get_int_at_Main_internal_1 + lw $t0, -8($fp) + sw $t0, -4($fp) + # LOCAL local_get_int_at_Main_s_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_0 + sw $t0, 12($v0) + li $t0, 0 + sw $t0, 16($v0) + sw $v0, -12($fp) + # LOCAL local_get_int_at_Main_internal_5 --> -24($fp) + # local_get_int_at_Main_internal_5 = SELF + sw $s1, -24($fp) + # LOCAL local_get_int_at_Main_internal_3 --> -16($fp) + # LOCAL local_get_int_at_Main_internal_5 --> -24($fp) + # local_get_int_at_Main_internal_3 = local_get_int_at_Main_internal_5 + lw $t0, -24($fp) + sw $t0, -16($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_get_int_at_Main_internal_3 --> -16($fp) + # LOCAL local_get_int_at_Main_internal_4 --> -20($fp) + # local_get_int_at_Main_internal_4 = VCALL local_get_int_at_Main_internal_3 prompt + # Save new self pointer in $s1 + lw $s1, -16($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 64($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -20($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_get_int_at_Main_s_2 --> -12($fp) + # LOCAL local_get_int_at_Main_internal_4 --> -20($fp) + # local_get_int_at_Main_s_2 = local_get_int_at_Main_internal_4 + lw $t0, -20($fp) + sw $t0, -12($fp) + # LOCAL local_get_int_at_Main_internal_6 --> -28($fp) + # LOCAL local_get_int_at_Main_z_0 --> -4($fp) + # local_get_int_at_Main_internal_6 = local_get_int_at_Main_z_0 + lw $t0, -4($fp) + sw $t0, -28($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # ARG local_get_int_at_Main_s_2 + # LOCAL local_get_int_at_Main_s_2 --> -12($fp) + lw $t0, -12($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_get_int_at_Main_internal_6 --> -28($fp) + # LOCAL local_get_int_at_Main_internal_7 --> -32($fp) + # local_get_int_at_Main_internal_7 = VCALL local_get_int_at_Main_internal_6 a2i + # Save new self pointer in $s1 + lw $s1, -28($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 124($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -32($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # RETURN local_get_int_at_Main_internal_7 + lw $v0, -32($fp) + # Deallocate stack frame for function function_get_int_at_Main. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 40 + jr $ra + # Function END + + +# function_is_even_at_Main implementation. +# @Params: +# 0($fp) = param_is_even_at_Main_num_0 +function_is_even_at_Main: + # Allocate stack frame for function function_is_even_at_Main. + subu $sp, $sp, 112 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 112 + # LOCAL local_is_even_at_Main_x_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -4($fp) + # LOCAL local_is_even_at_Main_x_0 --> -4($fp) + # PARAM param_is_even_at_Main_num_0 --> 0($fp) + # local_is_even_at_Main_x_0 = PARAM param_is_even_at_Main_num_0 + lw $t0, 0($fp) + sw $t0, -4($fp) + # LOCAL local_is_even_at_Main_internal_4 --> -20($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -20($fp) + # LOCAL local_is_even_at_Main_internal_3 --> -16($fp) + # LOCAL local_is_even_at_Main_x_0 --> -4($fp) + # LOCAL local_is_even_at_Main_internal_4 --> -20($fp) + lw $a0, -4($fp) + lw $a1, -20($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -16($fp) + # IF_GREATER_ZERO local_is_even_at_Main_internal_3 GOTO label_FALSE_303 + # IF_GREATER_ZERO local_is_even_at_Main_internal_3 GOTO label_FALSE_303 + lw $t0, -16($fp) + bgt $t0, 0, label_FALSE_303 + # IF_ZERO local_is_even_at_Main_internal_3 GOTO label_FALSE_303 + # IF_ZERO local_is_even_at_Main_internal_3 GOTO label_FALSE_303 + lw $t0, -16($fp) + beq $t0, 0, label_FALSE_303 + # LOCAL local_is_even_at_Main_internal_3 --> -16($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -16($fp) + # GOTO label_END_304 +j label_END_304 +label_FALSE_303: + # LOCAL local_is_even_at_Main_internal_3 --> -16($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -16($fp) + label_END_304: +# LOCAL local_is_even_at_Main_internal_1 --> -8($fp) +# LOCAL local_is_even_at_Main_internal_3 --> -16($fp) +# Obtain value from -16($fp) +lw $v0, -16($fp) +lw $v0, 12($v0) +sw $v0, -8($fp) +# IF_ZERO local_is_even_at_Main_internal_1 GOTO label_FALSEIF_301 +# IF_ZERO local_is_even_at_Main_internal_1 GOTO label_FALSEIF_301 +lw $t0, -8($fp) +beq $t0, 0, label_FALSEIF_301 +# LOCAL local_is_even_at_Main_internal_7 --> -32($fp) +# local_is_even_at_Main_internal_7 = SELF +sw $s1, -32($fp) +# LOCAL local_is_even_at_Main_internal_5 --> -24($fp) +# LOCAL local_is_even_at_Main_internal_7 --> -32($fp) +# local_is_even_at_Main_internal_5 = local_is_even_at_Main_internal_7 +lw $t0, -32($fp) +sw $t0, -24($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_is_even_at_Main_internal_8 --> -36($fp) +# LOCAL local_is_even_at_Main_x_0 --> -4($fp) +lw $t0, -4($fp) +lw $t0, 12($t0) +not $t0, $t0 +add $t0, $t0, 1 +sw $t0, -36($fp) +# LOCAL local_is_even_at_Main_internal_8 --> -36($fp) +# LOCAL local_is_even_at_Main_internal_8 --> -36($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +lw $t0, -36($fp) +sw $t0, 12($v0) +sw $v0, -36($fp) +# ARG local_is_even_at_Main_internal_8 +# LOCAL local_is_even_at_Main_internal_8 --> -36($fp) +lw $t0, -36($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_is_even_at_Main_internal_5 --> -24($fp) +# LOCAL local_is_even_at_Main_internal_6 --> -28($fp) +# local_is_even_at_Main_internal_6 = VCALL local_is_even_at_Main_internal_5 is_even +# Save new self pointer in $s1 +lw $s1, -24($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 76($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -28($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_is_even_at_Main_internal_2 --> -12($fp) +# LOCAL local_is_even_at_Main_internal_6 --> -28($fp) +# local_is_even_at_Main_internal_2 = local_is_even_at_Main_internal_6 +lw $t0, -28($fp) +sw $t0, -12($fp) +# GOTO label_ENDIF_302 +j label_ENDIF_302 +label_FALSEIF_301: + # LOCAL local_is_even_at_Main_internal_13 --> -56($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -56($fp) + # IF_ZERO local_is_even_at_Main_internal_13 GOTO label_FALSE_307 + # IF_ZERO local_is_even_at_Main_internal_13 GOTO label_FALSE_307 + lw $t0, -56($fp) + beq $t0, 0, label_FALSE_307 + # IF_ZERO local_is_even_at_Main_x_0 GOTO label_FALSE_307 + # IF_ZERO local_is_even_at_Main_x_0 GOTO label_FALSE_307 + lw $t0, -4($fp) + beq $t0, 0, label_FALSE_307 + # LOCAL local_is_even_at_Main_internal_12 --> -52($fp) + # LOCAL local_is_even_at_Main_internal_13 --> -56($fp) + # Comparing -56($fp) type with String + la $v0, String + lw $a0, -56($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -52($fp) + # IF_ZERO local_is_even_at_Main_internal_12 GOTO label_COMPARE_STRING_310 + # IF_ZERO local_is_even_at_Main_internal_12 GOTO label_COMPARE_STRING_310 + lw $t0, -52($fp) + beq $t0, 0, label_COMPARE_STRING_310 + # LOCAL local_is_even_at_Main_internal_12 --> -52($fp) + # LOCAL local_is_even_at_Main_internal_13 --> -56($fp) + # Comparing -56($fp) type with Bool + la $v0, Bool + lw $a0, -56($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -52($fp) + # IF_ZERO local_is_even_at_Main_internal_12 GOTO label_COMPARE_BY_VALUE_311 + # IF_ZERO local_is_even_at_Main_internal_12 GOTO label_COMPARE_BY_VALUE_311 + lw $t0, -52($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_311 + # LOCAL local_is_even_at_Main_internal_12 --> -52($fp) + # LOCAL local_is_even_at_Main_internal_13 --> -56($fp) + # Comparing -56($fp) type with Int + la $v0, Int + lw $a0, -56($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -52($fp) + # IF_ZERO local_is_even_at_Main_internal_12 GOTO label_COMPARE_BY_VALUE_311 + # IF_ZERO local_is_even_at_Main_internal_12 GOTO label_COMPARE_BY_VALUE_311 + lw $t0, -52($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_311 + # LOCAL local_is_even_at_Main_internal_12 --> -52($fp) + # LOCAL local_is_even_at_Main_internal_13 --> -56($fp) + # LOCAL local_is_even_at_Main_x_0 --> -4($fp) + # Load pointers and SUB + lw $a0, -56($fp) + lw $a1, -4($fp) + sub $a0, $a0, $a1 + sw $a0, -52($fp) + # IF_ZERO local_is_even_at_Main_internal_12 GOTO label_TRUE_308 + # IF_ZERO local_is_even_at_Main_internal_12 GOTO label_TRUE_308 + lw $t0, -52($fp) + beq $t0, 0, label_TRUE_308 + # GOTO label_FALSE_307 + j label_FALSE_307 + label_COMPARE_BY_VALUE_311: + # LOCAL local_is_even_at_Main_internal_12 --> -52($fp) + # LOCAL local_is_even_at_Main_internal_13 --> -56($fp) + # LOCAL local_is_even_at_Main_x_0 --> -4($fp) + lw $a0, -56($fp) + lw $a1, -4($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -52($fp) + # IF_ZERO local_is_even_at_Main_internal_12 GOTO label_TRUE_308 + # IF_ZERO local_is_even_at_Main_internal_12 GOTO label_TRUE_308 + lw $t0, -52($fp) + beq $t0, 0, label_TRUE_308 + # GOTO label_FALSE_307 + j label_FALSE_307 + label_COMPARE_STRING_310: + # LOCAL local_is_even_at_Main_internal_12 --> -52($fp) + # LOCAL local_is_even_at_Main_internal_13 --> -56($fp) + # LOCAL local_is_even_at_Main_x_0 --> -4($fp) + # Load strings for comparison + lw $v0, -56($fp) + lw $v1, -4($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -52($fp) + # IF_ZERO local_is_even_at_Main_internal_12 GOTO label_CONTINUE_312 + # IF_ZERO local_is_even_at_Main_internal_12 GOTO label_CONTINUE_312 + lw $t0, -52($fp) + beq $t0, 0, label_CONTINUE_312 + # GOTO label_FALSE_307 + j label_FALSE_307 + label_CONTINUE_312: + # LOCAL local_is_even_at_Main_internal_12 --> -52($fp) + # LOCAL local_is_even_at_Main_internal_13 --> -56($fp) + # LOCAL local_is_even_at_Main_x_0 --> -4($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -56($fp) + lw $v1, -4($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_313: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_314 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_313 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_314: + # Store result + sw $a2, -52($fp) + # IF_ZERO local_is_even_at_Main_internal_12 GOTO label_TRUE_308 + # IF_ZERO local_is_even_at_Main_internal_12 GOTO label_TRUE_308 + lw $t0, -52($fp) + beq $t0, 0, label_TRUE_308 + label_FALSE_307: + # LOCAL local_is_even_at_Main_internal_11 --> -48($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -48($fp) + # GOTO label_END_309 +j label_END_309 +label_TRUE_308: + # LOCAL local_is_even_at_Main_internal_11 --> -48($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -48($fp) + label_END_309: +# LOCAL local_is_even_at_Main_internal_9 --> -40($fp) +# LOCAL local_is_even_at_Main_internal_11 --> -48($fp) +# Obtain value from -48($fp) +lw $v0, -48($fp) +lw $v0, 12($v0) +sw $v0, -40($fp) +# IF_ZERO local_is_even_at_Main_internal_9 GOTO label_FALSEIF_305 +# IF_ZERO local_is_even_at_Main_internal_9 GOTO label_FALSEIF_305 +lw $t0, -40($fp) +beq $t0, 0, label_FALSEIF_305 +# LOCAL local_is_even_at_Main_internal_14 --> -60($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Bool +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Bool +sw $t0, 12($v0) +li $t0, 4 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Bool_start +sw $t0, 4($v0) +# Load type offset +li $t0, 12 +sw $t0, 8($v0) +li $t0, 1 +sw $t0, 12($v0) +sw $v0, -60($fp) +# LOCAL local_is_even_at_Main_internal_10 --> -44($fp) +# LOCAL local_is_even_at_Main_internal_14 --> -60($fp) +# local_is_even_at_Main_internal_10 = local_is_even_at_Main_internal_14 +lw $t0, -60($fp) +sw $t0, -44($fp) +# GOTO label_ENDIF_306 +j label_ENDIF_306 +label_FALSEIF_305: + # LOCAL local_is_even_at_Main_internal_19 --> -80($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -80($fp) + # IF_ZERO local_is_even_at_Main_internal_19 GOTO label_FALSE_317 + # IF_ZERO local_is_even_at_Main_internal_19 GOTO label_FALSE_317 + lw $t0, -80($fp) + beq $t0, 0, label_FALSE_317 + # IF_ZERO local_is_even_at_Main_x_0 GOTO label_FALSE_317 + # IF_ZERO local_is_even_at_Main_x_0 GOTO label_FALSE_317 + lw $t0, -4($fp) + beq $t0, 0, label_FALSE_317 + # LOCAL local_is_even_at_Main_internal_18 --> -76($fp) + # LOCAL local_is_even_at_Main_internal_19 --> -80($fp) + # Comparing -80($fp) type with String + la $v0, String + lw $a0, -80($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -76($fp) + # IF_ZERO local_is_even_at_Main_internal_18 GOTO label_COMPARE_STRING_320 + # IF_ZERO local_is_even_at_Main_internal_18 GOTO label_COMPARE_STRING_320 + lw $t0, -76($fp) + beq $t0, 0, label_COMPARE_STRING_320 + # LOCAL local_is_even_at_Main_internal_18 --> -76($fp) + # LOCAL local_is_even_at_Main_internal_19 --> -80($fp) + # Comparing -80($fp) type with Bool + la $v0, Bool + lw $a0, -80($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -76($fp) + # IF_ZERO local_is_even_at_Main_internal_18 GOTO label_COMPARE_BY_VALUE_321 + # IF_ZERO local_is_even_at_Main_internal_18 GOTO label_COMPARE_BY_VALUE_321 + lw $t0, -76($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_321 + # LOCAL local_is_even_at_Main_internal_18 --> -76($fp) + # LOCAL local_is_even_at_Main_internal_19 --> -80($fp) + # Comparing -80($fp) type with Int + la $v0, Int + lw $a0, -80($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -76($fp) + # IF_ZERO local_is_even_at_Main_internal_18 GOTO label_COMPARE_BY_VALUE_321 + # IF_ZERO local_is_even_at_Main_internal_18 GOTO label_COMPARE_BY_VALUE_321 + lw $t0, -76($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_321 + # LOCAL local_is_even_at_Main_internal_18 --> -76($fp) + # LOCAL local_is_even_at_Main_internal_19 --> -80($fp) + # LOCAL local_is_even_at_Main_x_0 --> -4($fp) + # Load pointers and SUB + lw $a0, -80($fp) + lw $a1, -4($fp) + sub $a0, $a0, $a1 + sw $a0, -76($fp) + # IF_ZERO local_is_even_at_Main_internal_18 GOTO label_TRUE_318 + # IF_ZERO local_is_even_at_Main_internal_18 GOTO label_TRUE_318 + lw $t0, -76($fp) + beq $t0, 0, label_TRUE_318 + # GOTO label_FALSE_317 + j label_FALSE_317 + label_COMPARE_BY_VALUE_321: + # LOCAL local_is_even_at_Main_internal_18 --> -76($fp) + # LOCAL local_is_even_at_Main_internal_19 --> -80($fp) + # LOCAL local_is_even_at_Main_x_0 --> -4($fp) + lw $a0, -80($fp) + lw $a1, -4($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -76($fp) + # IF_ZERO local_is_even_at_Main_internal_18 GOTO label_TRUE_318 + # IF_ZERO local_is_even_at_Main_internal_18 GOTO label_TRUE_318 + lw $t0, -76($fp) + beq $t0, 0, label_TRUE_318 + # GOTO label_FALSE_317 + j label_FALSE_317 + label_COMPARE_STRING_320: + # LOCAL local_is_even_at_Main_internal_18 --> -76($fp) + # LOCAL local_is_even_at_Main_internal_19 --> -80($fp) + # LOCAL local_is_even_at_Main_x_0 --> -4($fp) + # Load strings for comparison + lw $v0, -80($fp) + lw $v1, -4($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -76($fp) + # IF_ZERO local_is_even_at_Main_internal_18 GOTO label_CONTINUE_322 + # IF_ZERO local_is_even_at_Main_internal_18 GOTO label_CONTINUE_322 + lw $t0, -76($fp) + beq $t0, 0, label_CONTINUE_322 + # GOTO label_FALSE_317 + j label_FALSE_317 + label_CONTINUE_322: + # LOCAL local_is_even_at_Main_internal_18 --> -76($fp) + # LOCAL local_is_even_at_Main_internal_19 --> -80($fp) + # LOCAL local_is_even_at_Main_x_0 --> -4($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -80($fp) + lw $v1, -4($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_323: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_324 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_323 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_324: + # Store result + sw $a2, -76($fp) + # IF_ZERO local_is_even_at_Main_internal_18 GOTO label_TRUE_318 + # IF_ZERO local_is_even_at_Main_internal_18 GOTO label_TRUE_318 + lw $t0, -76($fp) + beq $t0, 0, label_TRUE_318 + label_FALSE_317: + # LOCAL local_is_even_at_Main_internal_17 --> -72($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -72($fp) + # GOTO label_END_319 +j label_END_319 +label_TRUE_318: + # LOCAL local_is_even_at_Main_internal_17 --> -72($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -72($fp) + label_END_319: +# LOCAL local_is_even_at_Main_internal_15 --> -64($fp) +# LOCAL local_is_even_at_Main_internal_17 --> -72($fp) +# Obtain value from -72($fp) +lw $v0, -72($fp) +lw $v0, 12($v0) +sw $v0, -64($fp) +# IF_ZERO local_is_even_at_Main_internal_15 GOTO label_FALSEIF_315 +# IF_ZERO local_is_even_at_Main_internal_15 GOTO label_FALSEIF_315 +lw $t0, -64($fp) +beq $t0, 0, label_FALSEIF_315 +# LOCAL local_is_even_at_Main_internal_20 --> -84($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Bool +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Bool +sw $t0, 12($v0) +li $t0, 4 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Bool_start +sw $t0, 4($v0) +# Load type offset +li $t0, 12 +sw $t0, 8($v0) +li $t0, 0 +sw $t0, 12($v0) +sw $v0, -84($fp) +# LOCAL local_is_even_at_Main_internal_16 --> -68($fp) +# LOCAL local_is_even_at_Main_internal_20 --> -84($fp) +# local_is_even_at_Main_internal_16 = local_is_even_at_Main_internal_20 +lw $t0, -84($fp) +sw $t0, -68($fp) +# GOTO label_ENDIF_316 +j label_ENDIF_316 +label_FALSEIF_315: + # LOCAL local_is_even_at_Main_internal_23 --> -96($fp) + # local_is_even_at_Main_internal_23 = SELF + sw $s1, -96($fp) + # LOCAL local_is_even_at_Main_internal_21 --> -88($fp) + # LOCAL local_is_even_at_Main_internal_23 --> -96($fp) + # local_is_even_at_Main_internal_21 = local_is_even_at_Main_internal_23 + lw $t0, -96($fp) + sw $t0, -88($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_is_even_at_Main_internal_25 --> -104($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 2 + sw $t0, 12($v0) + sw $v0, -104($fp) + # LOCAL local_is_even_at_Main_internal_24 --> -100($fp) + # LOCAL local_is_even_at_Main_x_0 --> -4($fp) + # LOCAL local_is_even_at_Main_internal_25 --> -104($fp) + # local_is_even_at_Main_internal_24 = local_is_even_at_Main_x_0 - local_is_even_at_Main_internal_25 + lw $t1, -4($fp) + lw $t0, 12($t1) + lw $t1, -104($fp) + lw $t2, 12($t1) + sub $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -100($fp) + # ARG local_is_even_at_Main_internal_24 + # LOCAL local_is_even_at_Main_internal_24 --> -100($fp) + lw $t0, -100($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_is_even_at_Main_internal_21 --> -88($fp) + # LOCAL local_is_even_at_Main_internal_22 --> -92($fp) + # local_is_even_at_Main_internal_22 = VCALL local_is_even_at_Main_internal_21 is_even + # Save new self pointer in $s1 + lw $s1, -88($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 76($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -92($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_is_even_at_Main_internal_16 --> -68($fp) + # LOCAL local_is_even_at_Main_internal_22 --> -92($fp) + # local_is_even_at_Main_internal_16 = local_is_even_at_Main_internal_22 + lw $t0, -92($fp) + sw $t0, -68($fp) + label_ENDIF_316: +# LOCAL local_is_even_at_Main_internal_10 --> -44($fp) +# LOCAL local_is_even_at_Main_internal_16 --> -68($fp) +# local_is_even_at_Main_internal_10 = local_is_even_at_Main_internal_16 +lw $t0, -68($fp) +sw $t0, -44($fp) +label_ENDIF_306: +# LOCAL local_is_even_at_Main_internal_2 --> -12($fp) +# LOCAL local_is_even_at_Main_internal_10 --> -44($fp) +# local_is_even_at_Main_internal_2 = local_is_even_at_Main_internal_10 +lw $t0, -44($fp) +sw $t0, -12($fp) +label_ENDIF_302: +# RETURN local_is_even_at_Main_internal_2 +lw $v0, -12($fp) +# Deallocate stack frame for function function_is_even_at_Main. +# Restore $ra +lw $ra, 4($sp) +# Restore $fp +lw $fp, 0($sp) +# Restore Stack pointer $sp +addu $sp, $sp, 112 +# Deallocate function args +addu $sp, $sp, 4 +jr $ra +# Function END + + +# function_class_type_at_Main implementation. +# @Params: +# 0($fp) = param_class_type_at_Main_var_0 +function_class_type_at_Main: + # Allocate stack frame for function function_class_type_at_Main. + subu $sp, $sp, 148 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 148 + # PARAM param_class_type_at_Main_var_0 --> 0($fp) + # LOCAL local_class_type_at_Main_internal_0 --> -4($fp) + # local_class_type_at_Main_internal_0 = TYPEOF param_class_type_at_Main_var_0 + lw $t0, 0($fp) + # Load pointer to type offset + lw $t1, 8($t0) + sw $t1, -4($fp) + # LOCAL local_class_type_at_Main_internal_3 --> -16($fp) + # local_class_type_at_Main_internal_3 = 15 + li $t0, 15 + sw $t0, -16($fp) + # local_class_type_at_Main_internal_4 = TYPE_DISTANCE A + # LOCAL local_class_type_at_Main_internal_4 --> -20($fp) + # LOCAL local_class_type_at_Main_internal_0 --> -4($fp) + # Load TDT pointer to type A + la $t0, A__TDT + lw $t1, -4($fp) + addu $t0, $t0, $t1 + # Save distance + lw $t1, 0($t0) + sw $t1, -20($fp) + # LOCAL local_class_type_at_Main_internal_4 --> -20($fp) + # LOCAL local_class_type_at_Main_internal_3 --> -16($fp) + # Update min if 8 < 9 + lw $t0, -20($fp) + lw $t1, -16($fp) + bgtu $t0, $t1, label_Not_min0_325 + # LOCAL local_class_type_at_Main_internal_3 --> -16($fp) + # LOCAL local_class_type_at_Main_internal_4 --> -20($fp) + # local_class_type_at_Main_internal_3 = local_class_type_at_Main_internal_4 + lw $t0, -20($fp) + sw $t0, -16($fp) + label_Not_min0_325: + # local_class_type_at_Main_internal_4 = TYPE_DISTANCE B + # LOCAL local_class_type_at_Main_internal_4 --> -20($fp) + # LOCAL local_class_type_at_Main_internal_0 --> -4($fp) + # Load TDT pointer to type B + la $t0, B__TDT + lw $t1, -4($fp) + addu $t0, $t0, $t1 + # Save distance + lw $t1, 0($t0) + sw $t1, -20($fp) + # LOCAL local_class_type_at_Main_internal_4 --> -20($fp) + # LOCAL local_class_type_at_Main_internal_3 --> -16($fp) + # Update min if 8 < 9 + lw $t0, -20($fp) + lw $t1, -16($fp) + bgtu $t0, $t1, label_Not_min1_326 + # LOCAL local_class_type_at_Main_internal_3 --> -16($fp) + # LOCAL local_class_type_at_Main_internal_4 --> -20($fp) + # local_class_type_at_Main_internal_3 = local_class_type_at_Main_internal_4 + lw $t0, -20($fp) + sw $t0, -16($fp) + label_Not_min1_326: + # local_class_type_at_Main_internal_4 = TYPE_DISTANCE C + # LOCAL local_class_type_at_Main_internal_4 --> -20($fp) + # LOCAL local_class_type_at_Main_internal_0 --> -4($fp) + # Load TDT pointer to type C + la $t0, C__TDT + lw $t1, -4($fp) + addu $t0, $t0, $t1 + # Save distance + lw $t1, 0($t0) + sw $t1, -20($fp) + # LOCAL local_class_type_at_Main_internal_4 --> -20($fp) + # LOCAL local_class_type_at_Main_internal_3 --> -16($fp) + # Update min if 8 < 9 + lw $t0, -20($fp) + lw $t1, -16($fp) + bgtu $t0, $t1, label_Not_min2_327 + # LOCAL local_class_type_at_Main_internal_3 --> -16($fp) + # LOCAL local_class_type_at_Main_internal_4 --> -20($fp) + # local_class_type_at_Main_internal_3 = local_class_type_at_Main_internal_4 + lw $t0, -20($fp) + sw $t0, -16($fp) + label_Not_min2_327: + # local_class_type_at_Main_internal_4 = TYPE_DISTANCE D + # LOCAL local_class_type_at_Main_internal_4 --> -20($fp) + # LOCAL local_class_type_at_Main_internal_0 --> -4($fp) + # Load TDT pointer to type D + la $t0, D__TDT + lw $t1, -4($fp) + addu $t0, $t0, $t1 + # Save distance + lw $t1, 0($t0) + sw $t1, -20($fp) + # LOCAL local_class_type_at_Main_internal_4 --> -20($fp) + # LOCAL local_class_type_at_Main_internal_3 --> -16($fp) + # Update min if 8 < 9 + lw $t0, -20($fp) + lw $t1, -16($fp) + bgtu $t0, $t1, label_Not_min3_328 + # LOCAL local_class_type_at_Main_internal_3 --> -16($fp) + # LOCAL local_class_type_at_Main_internal_4 --> -20($fp) + # local_class_type_at_Main_internal_3 = local_class_type_at_Main_internal_4 + lw $t0, -20($fp) + sw $t0, -16($fp) + label_Not_min3_328: + # local_class_type_at_Main_internal_4 = TYPE_DISTANCE E + # LOCAL local_class_type_at_Main_internal_4 --> -20($fp) + # LOCAL local_class_type_at_Main_internal_0 --> -4($fp) + # Load TDT pointer to type E + la $t0, E__TDT + lw $t1, -4($fp) + addu $t0, $t0, $t1 + # Save distance + lw $t1, 0($t0) + sw $t1, -20($fp) + # LOCAL local_class_type_at_Main_internal_4 --> -20($fp) + # LOCAL local_class_type_at_Main_internal_3 --> -16($fp) + # Update min if 8 < 9 + lw $t0, -20($fp) + lw $t1, -16($fp) + bgtu $t0, $t1, label_Not_min4_329 + # LOCAL local_class_type_at_Main_internal_3 --> -16($fp) + # LOCAL local_class_type_at_Main_internal_4 --> -20($fp) + # local_class_type_at_Main_internal_3 = local_class_type_at_Main_internal_4 + lw $t0, -20($fp) + sw $t0, -16($fp) + label_Not_min4_329: + # local_class_type_at_Main_internal_4 = TYPE_DISTANCE Object + # LOCAL local_class_type_at_Main_internal_4 --> -20($fp) + # LOCAL local_class_type_at_Main_internal_0 --> -4($fp) + # Load TDT pointer to type Object + la $t0, Object__TDT + lw $t1, -4($fp) + addu $t0, $t0, $t1 + # Save distance + lw $t1, 0($t0) + sw $t1, -20($fp) + # LOCAL local_class_type_at_Main_internal_4 --> -20($fp) + # LOCAL local_class_type_at_Main_internal_3 --> -16($fp) + # Update min if 8 < 9 + lw $t0, -20($fp) + lw $t1, -16($fp) + bgtu $t0, $t1, label_Not_min5_330 + # LOCAL local_class_type_at_Main_internal_3 --> -16($fp) + # LOCAL local_class_type_at_Main_internal_4 --> -20($fp) + # local_class_type_at_Main_internal_3 = local_class_type_at_Main_internal_4 + lw $t0, -20($fp) + sw $t0, -16($fp) + label_Not_min5_330: + # LOCAL local_class_type_at_Main_internal_4 --> -20($fp) + # local_class_type_at_Main_internal_4 = 15 + li $t0, 15 + sw $t0, -20($fp) + # LOCAL local_class_type_at_Main_internal_1 --> -8($fp) + # LOCAL local_class_type_at_Main_internal_4 --> -20($fp) + # LOCAL local_class_type_at_Main_internal_3 --> -16($fp) + # Load pointers and SUB + lw $a0, -20($fp) + lw $a1, -16($fp) + sub $a0, $a0, $a1 + sw $a0, -8($fp) + # IF_ZERO local_class_type_at_Main_internal_1 GOTO label_ERROR_331 + # IF_ZERO local_class_type_at_Main_internal_1 GOTO label_ERROR_331 + lw $t0, -8($fp) + beq $t0, 0, label_ERROR_331 + # local_class_type_at_Main_internal_4 = TYPE_DISTANCE A + # LOCAL local_class_type_at_Main_internal_4 --> -20($fp) + # LOCAL local_class_type_at_Main_internal_0 --> -4($fp) + # Load TDT pointer to type A + la $t0, A__TDT + lw $t1, -4($fp) + addu $t0, $t0, $t1 + # Save distance + lw $t1, 0($t0) + sw $t1, -20($fp) + # LOCAL local_class_type_at_Main_internal_4 --> -20($fp) + # LOCAL local_class_type_at_Main_internal_3 --> -16($fp) + # Update min if 8 < 9 + lw $t0, -20($fp) + lw $t1, -16($fp) + bgtu $t0, $t1, label_NEXT0_333 + # LOCAL local_class_type_at_Main_a_5 --> -24($fp) + # PARAM param_class_type_at_Main_var_0 --> 0($fp) + # local_class_type_at_Main_a_5 = PARAM param_class_type_at_Main_var_0 + lw $t0, 0($fp) + sw $t0, -24($fp) + # LOCAL local_class_type_at_Main_internal_8 --> -36($fp) + # local_class_type_at_Main_internal_8 = SELF + sw $s1, -36($fp) + # LOCAL local_class_type_at_Main_internal_6 --> -28($fp) + # LOCAL local_class_type_at_Main_internal_8 --> -36($fp) + # local_class_type_at_Main_internal_6 = local_class_type_at_Main_internal_8 + lw $t0, -36($fp) + sw $t0, -28($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_class_type_at_Main_internal_9 --> -40($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_50 + sw $t0, 12($v0) + li $t0, 20 + sw $t0, 16($v0) + sw $v0, -40($fp) + # ARG local_class_type_at_Main_internal_9 + # LOCAL local_class_type_at_Main_internal_9 --> -40($fp) + lw $t0, -40($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_class_type_at_Main_internal_6 --> -28($fp) + # LOCAL local_class_type_at_Main_internal_7 --> -32($fp) + # local_class_type_at_Main_internal_7 = VCALL local_class_type_at_Main_internal_6 out_string + # Save new self pointer in $s1 + lw $s1, -28($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 88($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -32($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_class_type_at_Main_internal_2 --> -12($fp) + # LOCAL local_class_type_at_Main_internal_7 --> -32($fp) + # local_class_type_at_Main_internal_2 = local_class_type_at_Main_internal_7 + lw $t0, -32($fp) + sw $t0, -12($fp) + # GOTO label_END_332 +j label_END_332 +label_NEXT0_333: + # local_class_type_at_Main_internal_4 = TYPE_DISTANCE B + # LOCAL local_class_type_at_Main_internal_4 --> -20($fp) + # LOCAL local_class_type_at_Main_internal_0 --> -4($fp) + # Load TDT pointer to type B + la $t0, B__TDT + lw $t1, -4($fp) + addu $t0, $t0, $t1 + # Save distance + lw $t1, 0($t0) + sw $t1, -20($fp) + # LOCAL local_class_type_at_Main_internal_4 --> -20($fp) + # LOCAL local_class_type_at_Main_internal_3 --> -16($fp) + # Update min if 8 < 9 + lw $t0, -20($fp) + lw $t1, -16($fp) + bgtu $t0, $t1, label_NEXT1_334 + # LOCAL local_class_type_at_Main_b_10 --> -44($fp) + # PARAM param_class_type_at_Main_var_0 --> 0($fp) + # local_class_type_at_Main_b_10 = PARAM param_class_type_at_Main_var_0 + lw $t0, 0($fp) + sw $t0, -44($fp) + # LOCAL local_class_type_at_Main_internal_13 --> -56($fp) + # local_class_type_at_Main_internal_13 = SELF + sw $s1, -56($fp) + # LOCAL local_class_type_at_Main_internal_11 --> -48($fp) + # LOCAL local_class_type_at_Main_internal_13 --> -56($fp) + # local_class_type_at_Main_internal_11 = local_class_type_at_Main_internal_13 + lw $t0, -56($fp) + sw $t0, -48($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_class_type_at_Main_internal_14 --> -60($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_51 + sw $t0, 12($v0) + li $t0, 20 + sw $t0, 16($v0) + sw $v0, -60($fp) + # ARG local_class_type_at_Main_internal_14 + # LOCAL local_class_type_at_Main_internal_14 --> -60($fp) + lw $t0, -60($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_class_type_at_Main_internal_11 --> -48($fp) + # LOCAL local_class_type_at_Main_internal_12 --> -52($fp) + # local_class_type_at_Main_internal_12 = VCALL local_class_type_at_Main_internal_11 out_string + # Save new self pointer in $s1 + lw $s1, -48($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 88($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -52($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_class_type_at_Main_internal_2 --> -12($fp) + # LOCAL local_class_type_at_Main_internal_12 --> -52($fp) + # local_class_type_at_Main_internal_2 = local_class_type_at_Main_internal_12 + lw $t0, -52($fp) + sw $t0, -12($fp) + # GOTO label_END_332 +j label_END_332 +label_NEXT1_334: + # local_class_type_at_Main_internal_4 = TYPE_DISTANCE C + # LOCAL local_class_type_at_Main_internal_4 --> -20($fp) + # LOCAL local_class_type_at_Main_internal_0 --> -4($fp) + # Load TDT pointer to type C + la $t0, C__TDT + lw $t1, -4($fp) + addu $t0, $t0, $t1 + # Save distance + lw $t1, 0($t0) + sw $t1, -20($fp) + # LOCAL local_class_type_at_Main_internal_4 --> -20($fp) + # LOCAL local_class_type_at_Main_internal_3 --> -16($fp) + # Update min if 8 < 9 + lw $t0, -20($fp) + lw $t1, -16($fp) + bgtu $t0, $t1, label_NEXT2_335 + # LOCAL local_class_type_at_Main_c_15 --> -64($fp) + # PARAM param_class_type_at_Main_var_0 --> 0($fp) + # local_class_type_at_Main_c_15 = PARAM param_class_type_at_Main_var_0 + lw $t0, 0($fp) + sw $t0, -64($fp) + # LOCAL local_class_type_at_Main_internal_18 --> -76($fp) + # local_class_type_at_Main_internal_18 = SELF + sw $s1, -76($fp) + # LOCAL local_class_type_at_Main_internal_16 --> -68($fp) + # LOCAL local_class_type_at_Main_internal_18 --> -76($fp) + # local_class_type_at_Main_internal_16 = local_class_type_at_Main_internal_18 + lw $t0, -76($fp) + sw $t0, -68($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_class_type_at_Main_internal_19 --> -80($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_52 + sw $t0, 12($v0) + li $t0, 20 + sw $t0, 16($v0) + sw $v0, -80($fp) + # ARG local_class_type_at_Main_internal_19 + # LOCAL local_class_type_at_Main_internal_19 --> -80($fp) + lw $t0, -80($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_class_type_at_Main_internal_16 --> -68($fp) + # LOCAL local_class_type_at_Main_internal_17 --> -72($fp) + # local_class_type_at_Main_internal_17 = VCALL local_class_type_at_Main_internal_16 out_string + # Save new self pointer in $s1 + lw $s1, -68($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 88($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -72($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_class_type_at_Main_internal_2 --> -12($fp) + # LOCAL local_class_type_at_Main_internal_17 --> -72($fp) + # local_class_type_at_Main_internal_2 = local_class_type_at_Main_internal_17 + lw $t0, -72($fp) + sw $t0, -12($fp) + # GOTO label_END_332 +j label_END_332 +label_NEXT2_335: + # local_class_type_at_Main_internal_4 = TYPE_DISTANCE D + # LOCAL local_class_type_at_Main_internal_4 --> -20($fp) + # LOCAL local_class_type_at_Main_internal_0 --> -4($fp) + # Load TDT pointer to type D + la $t0, D__TDT + lw $t1, -4($fp) + addu $t0, $t0, $t1 + # Save distance + lw $t1, 0($t0) + sw $t1, -20($fp) + # LOCAL local_class_type_at_Main_internal_4 --> -20($fp) + # LOCAL local_class_type_at_Main_internal_3 --> -16($fp) + # Update min if 8 < 9 + lw $t0, -20($fp) + lw $t1, -16($fp) + bgtu $t0, $t1, label_NEXT3_336 + # LOCAL local_class_type_at_Main_d_20 --> -84($fp) + # PARAM param_class_type_at_Main_var_0 --> 0($fp) + # local_class_type_at_Main_d_20 = PARAM param_class_type_at_Main_var_0 + lw $t0, 0($fp) + sw $t0, -84($fp) + # LOCAL local_class_type_at_Main_internal_23 --> -96($fp) + # local_class_type_at_Main_internal_23 = SELF + sw $s1, -96($fp) + # LOCAL local_class_type_at_Main_internal_21 --> -88($fp) + # LOCAL local_class_type_at_Main_internal_23 --> -96($fp) + # local_class_type_at_Main_internal_21 = local_class_type_at_Main_internal_23 + lw $t0, -96($fp) + sw $t0, -88($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_class_type_at_Main_internal_24 --> -100($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_53 + sw $t0, 12($v0) + li $t0, 20 + sw $t0, 16($v0) + sw $v0, -100($fp) + # ARG local_class_type_at_Main_internal_24 + # LOCAL local_class_type_at_Main_internal_24 --> -100($fp) + lw $t0, -100($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_class_type_at_Main_internal_21 --> -88($fp) + # LOCAL local_class_type_at_Main_internal_22 --> -92($fp) + # local_class_type_at_Main_internal_22 = VCALL local_class_type_at_Main_internal_21 out_string + # Save new self pointer in $s1 + lw $s1, -88($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 88($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -92($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_class_type_at_Main_internal_2 --> -12($fp) + # LOCAL local_class_type_at_Main_internal_22 --> -92($fp) + # local_class_type_at_Main_internal_2 = local_class_type_at_Main_internal_22 + lw $t0, -92($fp) + sw $t0, -12($fp) + # GOTO label_END_332 +j label_END_332 +label_NEXT3_336: + # local_class_type_at_Main_internal_4 = TYPE_DISTANCE E + # LOCAL local_class_type_at_Main_internal_4 --> -20($fp) + # LOCAL local_class_type_at_Main_internal_0 --> -4($fp) + # Load TDT pointer to type E + la $t0, E__TDT + lw $t1, -4($fp) + addu $t0, $t0, $t1 + # Save distance + lw $t1, 0($t0) + sw $t1, -20($fp) + # LOCAL local_class_type_at_Main_internal_4 --> -20($fp) + # LOCAL local_class_type_at_Main_internal_3 --> -16($fp) + # Update min if 8 < 9 + lw $t0, -20($fp) + lw $t1, -16($fp) + bgtu $t0, $t1, label_NEXT4_337 + # LOCAL local_class_type_at_Main_e_25 --> -104($fp) + # PARAM param_class_type_at_Main_var_0 --> 0($fp) + # local_class_type_at_Main_e_25 = PARAM param_class_type_at_Main_var_0 + lw $t0, 0($fp) + sw $t0, -104($fp) + # LOCAL local_class_type_at_Main_internal_28 --> -116($fp) + # local_class_type_at_Main_internal_28 = SELF + sw $s1, -116($fp) + # LOCAL local_class_type_at_Main_internal_26 --> -108($fp) + # LOCAL local_class_type_at_Main_internal_28 --> -116($fp) + # local_class_type_at_Main_internal_26 = local_class_type_at_Main_internal_28 + lw $t0, -116($fp) + sw $t0, -108($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_class_type_at_Main_internal_29 --> -120($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_54 + sw $t0, 12($v0) + li $t0, 20 + sw $t0, 16($v0) + sw $v0, -120($fp) + # ARG local_class_type_at_Main_internal_29 + # LOCAL local_class_type_at_Main_internal_29 --> -120($fp) + lw $t0, -120($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_class_type_at_Main_internal_26 --> -108($fp) + # LOCAL local_class_type_at_Main_internal_27 --> -112($fp) + # local_class_type_at_Main_internal_27 = VCALL local_class_type_at_Main_internal_26 out_string + # Save new self pointer in $s1 + lw $s1, -108($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 88($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -112($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_class_type_at_Main_internal_2 --> -12($fp) + # LOCAL local_class_type_at_Main_internal_27 --> -112($fp) + # local_class_type_at_Main_internal_2 = local_class_type_at_Main_internal_27 + lw $t0, -112($fp) + sw $t0, -12($fp) + # GOTO label_END_332 +j label_END_332 +label_NEXT4_337: + # local_class_type_at_Main_internal_4 = TYPE_DISTANCE Object + # LOCAL local_class_type_at_Main_internal_4 --> -20($fp) + # LOCAL local_class_type_at_Main_internal_0 --> -4($fp) + # Load TDT pointer to type Object + la $t0, Object__TDT + lw $t1, -4($fp) + addu $t0, $t0, $t1 + # Save distance + lw $t1, 0($t0) + sw $t1, -20($fp) + # LOCAL local_class_type_at_Main_internal_4 --> -20($fp) + # LOCAL local_class_type_at_Main_internal_3 --> -16($fp) + # Update min if 8 < 9 + lw $t0, -20($fp) + lw $t1, -16($fp) + bgtu $t0, $t1, label_NEXT5_338 + # LOCAL local_class_type_at_Main_o_30 --> -124($fp) + # PARAM param_class_type_at_Main_var_0 --> 0($fp) + # local_class_type_at_Main_o_30 = PARAM param_class_type_at_Main_var_0 + lw $t0, 0($fp) + sw $t0, -124($fp) + # LOCAL local_class_type_at_Main_internal_33 --> -136($fp) + # local_class_type_at_Main_internal_33 = SELF + sw $s1, -136($fp) + # LOCAL local_class_type_at_Main_internal_31 --> -128($fp) + # LOCAL local_class_type_at_Main_internal_33 --> -136($fp) + # local_class_type_at_Main_internal_31 = local_class_type_at_Main_internal_33 + lw $t0, -136($fp) + sw $t0, -128($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_class_type_at_Main_internal_34 --> -140($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_55 + sw $t0, 12($v0) + li $t0, 7 + sw $t0, 16($v0) + sw $v0, -140($fp) + # ARG local_class_type_at_Main_internal_34 + # LOCAL local_class_type_at_Main_internal_34 --> -140($fp) + lw $t0, -140($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_class_type_at_Main_internal_31 --> -128($fp) + # LOCAL local_class_type_at_Main_internal_32 --> -132($fp) + # local_class_type_at_Main_internal_32 = VCALL local_class_type_at_Main_internal_31 out_string + # Save new self pointer in $s1 + lw $s1, -128($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 88($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -132($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_class_type_at_Main_internal_2 --> -12($fp) + # LOCAL local_class_type_at_Main_internal_32 --> -132($fp) + # local_class_type_at_Main_internal_2 = local_class_type_at_Main_internal_32 + lw $t0, -132($fp) + sw $t0, -12($fp) + # GOTO label_END_332 +j label_END_332 +label_NEXT5_338: + label_ERROR_331: + # PARAM param_class_type_at_Main_var_0 --> 0($fp) + lw $t0, 0($s1) + sw $t0, 0($fp) + # PARAM param_class_type_at_Main_var_0 --> 0($fp) + la $a0, data_1 + li $v0, 4 + syscall + lw $a0, 0($fp) + li $v0, 4 + syscall + la $a0, data_2 + li $v0, 4 + syscall + li $v0, 10 + syscall + label_END_332: +# RETURN local_class_type_at_Main_internal_2 +lw $v0, -12($fp) +# Deallocate stack frame for function function_class_type_at_Main. +# Restore $ra +lw $ra, 4($sp) +# Restore $fp +lw $fp, 0($sp) +# Restore Stack pointer $sp +addu $sp, $sp, 148 +# Deallocate function args +addu $sp, $sp, 4 +jr $ra +# Function END + + +# function_print_at_Main implementation. +# @Params: +# 0($fp) = param_print_at_Main_var_0 +function_print_at_Main: + # Allocate stack frame for function function_print_at_Main. + subu $sp, $sp, 60 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 60 + # LOCAL local_print_at_Main_z_0 --> -4($fp) + # local_print_at_Main_z_0 = 0 + li $t0, 0 + sw $t0, -4($fp) + # LOCAL local_print_at_Main_internal_1 --> -8($fp) + # local_print_at_Main_internal_1 = ALLOCATE A2I + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, A2I + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 12 bytes of memory + li $a0, 12 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, A2I_start + sw $t0, 4($v0) + # Load type offset + li $t0, 20 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -8($fp) + # LOCAL local_print_at_Main_z_0 --> -4($fp) + # LOCAL local_print_at_Main_internal_1 --> -8($fp) + # local_print_at_Main_z_0 = local_print_at_Main_internal_1 + lw $t0, -8($fp) + sw $t0, -4($fp) + # LOCAL local_print_at_Main_internal_4 --> -20($fp) + # local_print_at_Main_internal_4 = SELF + sw $s1, -20($fp) + # LOCAL local_print_at_Main_internal_2 --> -12($fp) + # LOCAL local_print_at_Main_internal_4 --> -20($fp) + # local_print_at_Main_internal_2 = local_print_at_Main_internal_4 + lw $t0, -20($fp) + sw $t0, -12($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_print_at_Main_internal_5 --> -24($fp) + # LOCAL local_print_at_Main_z_0 --> -4($fp) + # local_print_at_Main_internal_5 = local_print_at_Main_z_0 + lw $t0, -4($fp) + sw $t0, -24($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_print_at_Main_internal_7 --> -32($fp) + # PARAM param_print_at_Main_var_0 --> 0($fp) + # local_print_at_Main_internal_7 = PARAM param_print_at_Main_var_0 + lw $t0, 0($fp) + sw $t0, -32($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_print_at_Main_internal_7 --> -32($fp) + # LOCAL local_print_at_Main_internal_8 --> -36($fp) + # local_print_at_Main_internal_8 = VCALL local_print_at_Main_internal_7 value + # Save new self pointer in $s1 + lw $s1, -32($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 8($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -36($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # ARG local_print_at_Main_internal_8 + # LOCAL local_print_at_Main_internal_8 --> -36($fp) + lw $t0, -36($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_print_at_Main_internal_5 --> -24($fp) + # LOCAL local_print_at_Main_internal_6 --> -28($fp) + # local_print_at_Main_internal_6 = VCALL local_print_at_Main_internal_5 i2a + # Save new self pointer in $s1 + lw $s1, -24($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 100($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -28($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # ARG local_print_at_Main_internal_6 + # LOCAL local_print_at_Main_internal_6 --> -28($fp) + lw $t0, -28($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_print_at_Main_internal_2 --> -12($fp) + # LOCAL local_print_at_Main_internal_3 --> -16($fp) + # local_print_at_Main_internal_3 = VCALL local_print_at_Main_internal_2 out_string + # Save new self pointer in $s1 + lw $s1, -12($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 88($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -16($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_print_at_Main_internal_11 --> -48($fp) + # local_print_at_Main_internal_11 = SELF + sw $s1, -48($fp) + # LOCAL local_print_at_Main_internal_9 --> -40($fp) + # LOCAL local_print_at_Main_internal_11 --> -48($fp) + # local_print_at_Main_internal_9 = local_print_at_Main_internal_11 + lw $t0, -48($fp) + sw $t0, -40($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_print_at_Main_internal_12 --> -52($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_56 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -52($fp) + # ARG local_print_at_Main_internal_12 + # LOCAL local_print_at_Main_internal_12 --> -52($fp) + lw $t0, -52($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_print_at_Main_internal_9 --> -40($fp) + # LOCAL local_print_at_Main_internal_10 --> -44($fp) + # local_print_at_Main_internal_10 = VCALL local_print_at_Main_internal_9 out_string + # Save new self pointer in $s1 + lw $s1, -40($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 88($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -44($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # RETURN local_print_at_Main_internal_10 + lw $v0, -44($fp) + # Deallocate stack frame for function function_print_at_Main. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 60 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_main_at_Main implementation. +# @Params: +function_main_at_Main: + # Allocate stack frame for function function_main_at_Main. + subu $sp, $sp, 1008 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 1008 + # LOCAL local_main_at_Main_internal_0 --> -4($fp) + # local_main_at_Main_internal_0 = ALLOCATE A + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, A + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, A_start + sw $t0, 4($v0) + # Load type offset + li $t0, 24 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __A__attrib__var__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 12($t1) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -4($fp) + # + # LOCAL local_main_at_Main_internal_0 --> -4($fp) + lw $t0, -4($fp) + sw $t0, 16($s1) + label_WHILE_339: + # local_main_at_Main_internal_2 = GETATTRIBUTE flag Main + # LOCAL local_main_at_Main_internal_2 --> -12($fp) + lw $t0, 24($s1) + sw $t0, -12($fp) + # LOCAL local_main_at_Main_internal_1 --> -8($fp) + # LOCAL local_main_at_Main_internal_2 --> -12($fp) + # Obtain value from -12($fp) + lw $v0, -12($fp) + lw $v0, 12($v0) + sw $v0, -8($fp) + # IF_ZERO local_main_at_Main_internal_1 GOTO label_WHILE_END_340 + # IF_ZERO local_main_at_Main_internal_1 GOTO label_WHILE_END_340 + lw $t0, -8($fp) + beq $t0, 0, label_WHILE_END_340 + # LOCAL local_main_at_Main_internal_5 --> -24($fp) + # local_main_at_Main_internal_5 = SELF + sw $s1, -24($fp) + # LOCAL local_main_at_Main_internal_3 --> -16($fp) + # LOCAL local_main_at_Main_internal_5 --> -24($fp) + # local_main_at_Main_internal_3 = local_main_at_Main_internal_5 + lw $t0, -24($fp) + sw $t0, -16($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_6 --> -28($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_57 + sw $t0, 12($v0) + li $t0, 7 + sw $t0, 16($v0) + sw $v0, -28($fp) + # ARG local_main_at_Main_internal_6 + # LOCAL local_main_at_Main_internal_6 --> -28($fp) + lw $t0, -28($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_main_at_Main_internal_3 --> -16($fp) + # LOCAL local_main_at_Main_internal_4 --> -20($fp) + # local_main_at_Main_internal_4 = VCALL local_main_at_Main_internal_3 out_string + # Save new self pointer in $s1 + lw $s1, -16($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 88($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -20($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_main_at_Main_internal_9 --> -40($fp) + # local_main_at_Main_internal_9 = SELF + sw $s1, -40($fp) + # LOCAL local_main_at_Main_internal_7 --> -32($fp) + # LOCAL local_main_at_Main_internal_9 --> -40($fp) + # local_main_at_Main_internal_7 = local_main_at_Main_internal_9 + lw $t0, -40($fp) + sw $t0, -32($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # local_main_at_Main_internal_10 = GETATTRIBUTE avar Main + # LOCAL local_main_at_Main_internal_10 --> -44($fp) + lw $t0, 16($s1) + sw $t0, -44($fp) + # ARG local_main_at_Main_internal_10 + # LOCAL local_main_at_Main_internal_10 --> -44($fp) + lw $t0, -44($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_main_at_Main_internal_7 --> -32($fp) + # LOCAL local_main_at_Main_internal_8 --> -36($fp) + # local_main_at_Main_internal_8 = VCALL local_main_at_Main_internal_7 print + # Save new self pointer in $s1 + lw $s1, -32($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 72($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -36($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_main_at_Main_internal_15 --> -64($fp) + # local_main_at_Main_internal_15 = SELF + sw $s1, -64($fp) + # LOCAL local_main_at_Main_internal_13 --> -56($fp) + # LOCAL local_main_at_Main_internal_15 --> -64($fp) + # local_main_at_Main_internal_13 = local_main_at_Main_internal_15 + lw $t0, -64($fp) + sw $t0, -56($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # local_main_at_Main_internal_18 = GETATTRIBUTE avar Main + # LOCAL local_main_at_Main_internal_18 --> -76($fp) + lw $t0, 16($s1) + sw $t0, -76($fp) + # LOCAL local_main_at_Main_internal_16 --> -68($fp) + # LOCAL local_main_at_Main_internal_18 --> -76($fp) + # local_main_at_Main_internal_16 = local_main_at_Main_internal_18 + lw $t0, -76($fp) + sw $t0, -68($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_16 --> -68($fp) + # LOCAL local_main_at_Main_internal_17 --> -72($fp) + # local_main_at_Main_internal_17 = VCALL local_main_at_Main_internal_16 value + # Save new self pointer in $s1 + lw $s1, -68($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 8($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -72($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # ARG local_main_at_Main_internal_17 + # LOCAL local_main_at_Main_internal_17 --> -72($fp) + lw $t0, -72($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_main_at_Main_internal_13 --> -56($fp) + # LOCAL local_main_at_Main_internal_14 --> -60($fp) + # local_main_at_Main_internal_14 = VCALL local_main_at_Main_internal_13 is_even + # Save new self pointer in $s1 + lw $s1, -56($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 76($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -60($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_main_at_Main_internal_11 --> -48($fp) + # LOCAL local_main_at_Main_internal_14 --> -60($fp) + # Obtain value from -60($fp) + lw $v0, -60($fp) + lw $v0, 12($v0) + sw $v0, -48($fp) + # IF_ZERO local_main_at_Main_internal_11 GOTO label_FALSEIF_341 + # IF_ZERO local_main_at_Main_internal_11 GOTO label_FALSEIF_341 + lw $t0, -48($fp) + beq $t0, 0, label_FALSEIF_341 + # LOCAL local_main_at_Main_internal_21 --> -88($fp) + # local_main_at_Main_internal_21 = SELF + sw $s1, -88($fp) + # LOCAL local_main_at_Main_internal_19 --> -80($fp) + # LOCAL local_main_at_Main_internal_21 --> -88($fp) + # local_main_at_Main_internal_19 = local_main_at_Main_internal_21 + lw $t0, -88($fp) + sw $t0, -80($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_22 --> -92($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_58 + sw $t0, 12($v0) + li $t0, 9 + sw $t0, 16($v0) + sw $v0, -92($fp) + # ARG local_main_at_Main_internal_22 + # LOCAL local_main_at_Main_internal_22 --> -92($fp) + lw $t0, -92($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_main_at_Main_internal_19 --> -80($fp) + # LOCAL local_main_at_Main_internal_20 --> -84($fp) + # local_main_at_Main_internal_20 = VCALL local_main_at_Main_internal_19 out_string + # Save new self pointer in $s1 + lw $s1, -80($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 88($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -84($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_main_at_Main_internal_12 --> -52($fp) + # LOCAL local_main_at_Main_internal_20 --> -84($fp) + # local_main_at_Main_internal_12 = local_main_at_Main_internal_20 + lw $t0, -84($fp) + sw $t0, -52($fp) + # GOTO label_ENDIF_342 +j label_ENDIF_342 +label_FALSEIF_341: + # LOCAL local_main_at_Main_internal_25 --> -104($fp) + # local_main_at_Main_internal_25 = SELF + sw $s1, -104($fp) + # LOCAL local_main_at_Main_internal_23 --> -96($fp) + # LOCAL local_main_at_Main_internal_25 --> -104($fp) + # local_main_at_Main_internal_23 = local_main_at_Main_internal_25 + lw $t0, -104($fp) + sw $t0, -96($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_26 --> -108($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_59 + sw $t0, 12($v0) + li $t0, 8 + sw $t0, 16($v0) + sw $v0, -108($fp) + # ARG local_main_at_Main_internal_26 + # LOCAL local_main_at_Main_internal_26 --> -108($fp) + lw $t0, -108($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_main_at_Main_internal_23 --> -96($fp) + # LOCAL local_main_at_Main_internal_24 --> -100($fp) + # local_main_at_Main_internal_24 = VCALL local_main_at_Main_internal_23 out_string + # Save new self pointer in $s1 + lw $s1, -96($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 88($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -100($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_main_at_Main_internal_12 --> -52($fp) + # LOCAL local_main_at_Main_internal_24 --> -100($fp) + # local_main_at_Main_internal_12 = local_main_at_Main_internal_24 + lw $t0, -100($fp) + sw $t0, -52($fp) + label_ENDIF_342: +# LOCAL local_main_at_Main_internal_29 --> -120($fp) +# local_main_at_Main_internal_29 = SELF +sw $s1, -120($fp) +# LOCAL local_main_at_Main_internal_27 --> -112($fp) +# LOCAL local_main_at_Main_internal_29 --> -120($fp) +# local_main_at_Main_internal_27 = local_main_at_Main_internal_29 +lw $t0, -120($fp) +sw $t0, -112($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# local_main_at_Main_internal_30 = GETATTRIBUTE avar Main +# LOCAL local_main_at_Main_internal_30 --> -124($fp) +lw $t0, 16($s1) +sw $t0, -124($fp) +# ARG local_main_at_Main_internal_30 +# LOCAL local_main_at_Main_internal_30 --> -124($fp) +lw $t0, -124($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_main_at_Main_internal_27 --> -112($fp) +# LOCAL local_main_at_Main_internal_28 --> -116($fp) +# local_main_at_Main_internal_28 = VCALL local_main_at_Main_internal_27 class_type +# Save new self pointer in $s1 +lw $s1, -112($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 52($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -116($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_main_at_Main_internal_33 --> -136($fp) +# local_main_at_Main_internal_33 = SELF +sw $s1, -136($fp) +# LOCAL local_main_at_Main_internal_31 --> -128($fp) +# LOCAL local_main_at_Main_internal_33 --> -136($fp) +# local_main_at_Main_internal_31 = local_main_at_Main_internal_33 +lw $t0, -136($fp) +sw $t0, -128($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_main_at_Main_internal_31 --> -128($fp) +# LOCAL local_main_at_Main_internal_32 --> -132($fp) +# local_main_at_Main_internal_32 = VCALL local_main_at_Main_internal_31 menu +# Save new self pointer in $s1 +lw $s1, -128($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 12($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -132($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# +# LOCAL local_main_at_Main_internal_32 --> -132($fp) +lw $t0, -132($fp) +sw $t0, 12($s1) +# local_main_at_Main_internal_38 = GETATTRIBUTE char Main +# LOCAL local_main_at_Main_internal_38 --> -156($fp) +lw $t0, 12($s1) +sw $t0, -156($fp) +# LOCAL local_main_at_Main_internal_39 --> -160($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_60 +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +sw $v0, -160($fp) +# IF_ZERO local_main_at_Main_internal_38 GOTO label_FALSE_345 +# IF_ZERO local_main_at_Main_internal_38 GOTO label_FALSE_345 +lw $t0, -156($fp) +beq $t0, 0, label_FALSE_345 +# IF_ZERO local_main_at_Main_internal_39 GOTO label_FALSE_345 +# IF_ZERO local_main_at_Main_internal_39 GOTO label_FALSE_345 +lw $t0, -160($fp) +beq $t0, 0, label_FALSE_345 +# LOCAL local_main_at_Main_internal_37 --> -152($fp) +# LOCAL local_main_at_Main_internal_38 --> -156($fp) +# Comparing -156($fp) type with String +la $v0, String +lw $a0, -156($fp) +lw $a0, 0($a0) +sub $a0, $a0, $v0 +sw $a0, -152($fp) +# IF_ZERO local_main_at_Main_internal_37 GOTO label_COMPARE_STRING_348 +# IF_ZERO local_main_at_Main_internal_37 GOTO label_COMPARE_STRING_348 +lw $t0, -152($fp) +beq $t0, 0, label_COMPARE_STRING_348 +# LOCAL local_main_at_Main_internal_37 --> -152($fp) +# LOCAL local_main_at_Main_internal_38 --> -156($fp) +# Comparing -156($fp) type with Bool +la $v0, Bool +lw $a0, -156($fp) +lw $a0, 0($a0) +lw $a0, 12($a0) +sub $a0, $a0, $v0 +sw $a0, -152($fp) +# IF_ZERO local_main_at_Main_internal_37 GOTO label_COMPARE_BY_VALUE_349 +# IF_ZERO local_main_at_Main_internal_37 GOTO label_COMPARE_BY_VALUE_349 +lw $t0, -152($fp) +beq $t0, 0, label_COMPARE_BY_VALUE_349 +# LOCAL local_main_at_Main_internal_37 --> -152($fp) +# LOCAL local_main_at_Main_internal_38 --> -156($fp) +# Comparing -156($fp) type with Int +la $v0, Int +lw $a0, -156($fp) +lw $a0, 0($a0) +lw $a0, 12($a0) +sub $a0, $a0, $v0 +sw $a0, -152($fp) +# IF_ZERO local_main_at_Main_internal_37 GOTO label_COMPARE_BY_VALUE_349 +# IF_ZERO local_main_at_Main_internal_37 GOTO label_COMPARE_BY_VALUE_349 +lw $t0, -152($fp) +beq $t0, 0, label_COMPARE_BY_VALUE_349 +# LOCAL local_main_at_Main_internal_37 --> -152($fp) +# LOCAL local_main_at_Main_internal_38 --> -156($fp) +# LOCAL local_main_at_Main_internal_39 --> -160($fp) +# Load pointers and SUB +lw $a0, -156($fp) +lw $a1, -160($fp) +sub $a0, $a0, $a1 +sw $a0, -152($fp) +# IF_ZERO local_main_at_Main_internal_37 GOTO label_TRUE_346 +# IF_ZERO local_main_at_Main_internal_37 GOTO label_TRUE_346 +lw $t0, -152($fp) +beq $t0, 0, label_TRUE_346 +# GOTO label_FALSE_345 +j label_FALSE_345 +label_COMPARE_BY_VALUE_349: + # LOCAL local_main_at_Main_internal_37 --> -152($fp) + # LOCAL local_main_at_Main_internal_38 --> -156($fp) + # LOCAL local_main_at_Main_internal_39 --> -160($fp) + lw $a0, -156($fp) + lw $a1, -160($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -152($fp) + # IF_ZERO local_main_at_Main_internal_37 GOTO label_TRUE_346 + # IF_ZERO local_main_at_Main_internal_37 GOTO label_TRUE_346 + lw $t0, -152($fp) + beq $t0, 0, label_TRUE_346 + # GOTO label_FALSE_345 + j label_FALSE_345 + label_COMPARE_STRING_348: + # LOCAL local_main_at_Main_internal_37 --> -152($fp) + # LOCAL local_main_at_Main_internal_38 --> -156($fp) + # LOCAL local_main_at_Main_internal_39 --> -160($fp) + # Load strings for comparison + lw $v0, -156($fp) + lw $v1, -160($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -152($fp) + # IF_ZERO local_main_at_Main_internal_37 GOTO label_CONTINUE_350 + # IF_ZERO local_main_at_Main_internal_37 GOTO label_CONTINUE_350 + lw $t0, -152($fp) + beq $t0, 0, label_CONTINUE_350 + # GOTO label_FALSE_345 + j label_FALSE_345 + label_CONTINUE_350: + # LOCAL local_main_at_Main_internal_37 --> -152($fp) + # LOCAL local_main_at_Main_internal_38 --> -156($fp) + # LOCAL local_main_at_Main_internal_39 --> -160($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -156($fp) + lw $v1, -160($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_351: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_352 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_351 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_352: + # Store result + sw $a2, -152($fp) + # IF_ZERO local_main_at_Main_internal_37 GOTO label_TRUE_346 + # IF_ZERO local_main_at_Main_internal_37 GOTO label_TRUE_346 + lw $t0, -152($fp) + beq $t0, 0, label_TRUE_346 + label_FALSE_345: + # LOCAL local_main_at_Main_internal_36 --> -148($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -148($fp) + # GOTO label_END_347 +j label_END_347 +label_TRUE_346: + # LOCAL local_main_at_Main_internal_36 --> -148($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -148($fp) + label_END_347: +# LOCAL local_main_at_Main_internal_34 --> -140($fp) +# LOCAL local_main_at_Main_internal_36 --> -148($fp) +# Obtain value from -148($fp) +lw $v0, -148($fp) +lw $v0, 12($v0) +sw $v0, -140($fp) +# IF_ZERO local_main_at_Main_internal_34 GOTO label_FALSEIF_343 +# IF_ZERO local_main_at_Main_internal_34 GOTO label_FALSEIF_343 +lw $t0, -140($fp) +beq $t0, 0, label_FALSEIF_343 +# LOCAL local_main_at_Main_internal_42 --> -172($fp) +# local_main_at_Main_internal_42 = ALLOCATE A +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type name +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, A +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, A_start +sw $t0, 4($v0) +# Load type offset +li $t0, 24 +sw $t0, 8($v0) +move $t1, $v0 +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +move $s1, $v0 +# Push register t1 into stack +subu $sp, $sp, 4 +sw $t1, 0($sp) +jal __A__attrib__var__init +# Pop 4 bytes from stack into register t1 +lw $t1, 0($sp) +addu $sp, $sp, 4 +sw $v0, 12($t1) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +sw $t1, -172($fp) +# LOCAL local_main_at_Main_internal_40 --> -164($fp) +# LOCAL local_main_at_Main_internal_42 --> -172($fp) +# local_main_at_Main_internal_40 = local_main_at_Main_internal_42 +lw $t0, -172($fp) +sw $t0, -164($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_main_at_Main_internal_45 --> -184($fp) +# local_main_at_Main_internal_45 = SELF +sw $s1, -184($fp) +# LOCAL local_main_at_Main_internal_43 --> -176($fp) +# LOCAL local_main_at_Main_internal_45 --> -184($fp) +# local_main_at_Main_internal_43 = local_main_at_Main_internal_45 +lw $t0, -184($fp) +sw $t0, -176($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_main_at_Main_internal_43 --> -176($fp) +# LOCAL local_main_at_Main_internal_44 --> -180($fp) +# local_main_at_Main_internal_44 = VCALL local_main_at_Main_internal_43 get_int +# Save new self pointer in $s1 +lw $s1, -176($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 16($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -180($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# ARG local_main_at_Main_internal_44 +# LOCAL local_main_at_Main_internal_44 --> -180($fp) +lw $t0, -180($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_main_at_Main_internal_40 --> -164($fp) +# LOCAL local_main_at_Main_internal_41 --> -168($fp) +# local_main_at_Main_internal_41 = VCALL local_main_at_Main_internal_40 set_var +# Save new self pointer in $s1 +lw $s1, -164($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 120($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -168($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# +# LOCAL local_main_at_Main_internal_41 --> -168($fp) +lw $t0, -168($fp) +sw $t0, 20($s1) +# LOCAL local_main_at_Main_internal_48 --> -196($fp) +# local_main_at_Main_internal_48 = ALLOCATE B +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type name +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, B +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, B_start +sw $t0, 4($v0) +# Load type offset +li $t0, 28 +sw $t0, 8($v0) +move $t1, $v0 +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +move $s1, $v0 +# Push register t1 into stack +subu $sp, $sp, 4 +sw $t1, 0($sp) +jal __A__attrib__var__init +# Pop 4 bytes from stack into register t1 +lw $t1, 0($sp) +addu $sp, $sp, 4 +sw $v0, 12($t1) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +sw $t1, -196($fp) +# LOCAL local_main_at_Main_internal_46 --> -188($fp) +# LOCAL local_main_at_Main_internal_48 --> -196($fp) +# local_main_at_Main_internal_46 = local_main_at_Main_internal_48 +lw $t0, -196($fp) +sw $t0, -188($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# local_main_at_Main_internal_51 = GETATTRIBUTE avar Main +# LOCAL local_main_at_Main_internal_51 --> -208($fp) +lw $t0, 16($s1) +sw $t0, -208($fp) +# LOCAL local_main_at_Main_internal_49 --> -200($fp) +# LOCAL local_main_at_Main_internal_51 --> -208($fp) +# local_main_at_Main_internal_49 = local_main_at_Main_internal_51 +lw $t0, -208($fp) +sw $t0, -200($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_main_at_Main_internal_49 --> -200($fp) +# LOCAL local_main_at_Main_internal_50 --> -204($fp) +# local_main_at_Main_internal_50 = VCALL local_main_at_Main_internal_49 value +# Save new self pointer in $s1 +lw $s1, -200($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 8($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -204($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# ARG local_main_at_Main_internal_50 +# LOCAL local_main_at_Main_internal_50 --> -204($fp) +lw $t0, -204($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# local_main_at_Main_internal_54 = GETATTRIBUTE a_var Main +# LOCAL local_main_at_Main_internal_54 --> -220($fp) +lw $t0, 20($s1) +sw $t0, -220($fp) +# LOCAL local_main_at_Main_internal_52 --> -212($fp) +# LOCAL local_main_at_Main_internal_54 --> -220($fp) +# local_main_at_Main_internal_52 = local_main_at_Main_internal_54 +lw $t0, -220($fp) +sw $t0, -212($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_main_at_Main_internal_52 --> -212($fp) +# LOCAL local_main_at_Main_internal_53 --> -216($fp) +# local_main_at_Main_internal_53 = VCALL local_main_at_Main_internal_52 value +# Save new self pointer in $s1 +lw $s1, -212($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 8($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -216($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# ARG local_main_at_Main_internal_53 +# LOCAL local_main_at_Main_internal_53 --> -216($fp) +lw $t0, -216($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_main_at_Main_internal_46 --> -188($fp) +# LOCAL local_main_at_Main_internal_47 --> -192($fp) +# local_main_at_Main_internal_47 = VCALL local_main_at_Main_internal_46 method2 +# Save new self pointer in $s1 +lw $s1, -188($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 36($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -192($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# +# LOCAL local_main_at_Main_internal_47 --> -192($fp) +lw $t0, -192($fp) +sw $t0, 16($s1) +# LOCAL local_main_at_Main_internal_35 --> -144($fp) +# local_main_at_Main_internal_35 = +# GOTO label_ENDIF_344 +j label_ENDIF_344 +label_FALSEIF_343: + # local_main_at_Main_internal_59 = GETATTRIBUTE char Main + # LOCAL local_main_at_Main_internal_59 --> -240($fp) + lw $t0, 12($s1) + sw $t0, -240($fp) + # LOCAL local_main_at_Main_internal_60 --> -244($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_61 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -244($fp) + # IF_ZERO local_main_at_Main_internal_59 GOTO label_FALSE_355 + # IF_ZERO local_main_at_Main_internal_59 GOTO label_FALSE_355 + lw $t0, -240($fp) + beq $t0, 0, label_FALSE_355 + # IF_ZERO local_main_at_Main_internal_60 GOTO label_FALSE_355 + # IF_ZERO local_main_at_Main_internal_60 GOTO label_FALSE_355 + lw $t0, -244($fp) + beq $t0, 0, label_FALSE_355 + # LOCAL local_main_at_Main_internal_58 --> -236($fp) + # LOCAL local_main_at_Main_internal_59 --> -240($fp) + # Comparing -240($fp) type with String + la $v0, String + lw $a0, -240($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -236($fp) + # IF_ZERO local_main_at_Main_internal_58 GOTO label_COMPARE_STRING_358 + # IF_ZERO local_main_at_Main_internal_58 GOTO label_COMPARE_STRING_358 + lw $t0, -236($fp) + beq $t0, 0, label_COMPARE_STRING_358 + # LOCAL local_main_at_Main_internal_58 --> -236($fp) + # LOCAL local_main_at_Main_internal_59 --> -240($fp) + # Comparing -240($fp) type with Bool + la $v0, Bool + lw $a0, -240($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -236($fp) + # IF_ZERO local_main_at_Main_internal_58 GOTO label_COMPARE_BY_VALUE_359 + # IF_ZERO local_main_at_Main_internal_58 GOTO label_COMPARE_BY_VALUE_359 + lw $t0, -236($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_359 + # LOCAL local_main_at_Main_internal_58 --> -236($fp) + # LOCAL local_main_at_Main_internal_59 --> -240($fp) + # Comparing -240($fp) type with Int + la $v0, Int + lw $a0, -240($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -236($fp) + # IF_ZERO local_main_at_Main_internal_58 GOTO label_COMPARE_BY_VALUE_359 + # IF_ZERO local_main_at_Main_internal_58 GOTO label_COMPARE_BY_VALUE_359 + lw $t0, -236($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_359 + # LOCAL local_main_at_Main_internal_58 --> -236($fp) + # LOCAL local_main_at_Main_internal_59 --> -240($fp) + # LOCAL local_main_at_Main_internal_60 --> -244($fp) + # Load pointers and SUB + lw $a0, -240($fp) + lw $a1, -244($fp) + sub $a0, $a0, $a1 + sw $a0, -236($fp) + # IF_ZERO local_main_at_Main_internal_58 GOTO label_TRUE_356 + # IF_ZERO local_main_at_Main_internal_58 GOTO label_TRUE_356 + lw $t0, -236($fp) + beq $t0, 0, label_TRUE_356 + # GOTO label_FALSE_355 + j label_FALSE_355 + label_COMPARE_BY_VALUE_359: + # LOCAL local_main_at_Main_internal_58 --> -236($fp) + # LOCAL local_main_at_Main_internal_59 --> -240($fp) + # LOCAL local_main_at_Main_internal_60 --> -244($fp) + lw $a0, -240($fp) + lw $a1, -244($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -236($fp) + # IF_ZERO local_main_at_Main_internal_58 GOTO label_TRUE_356 + # IF_ZERO local_main_at_Main_internal_58 GOTO label_TRUE_356 + lw $t0, -236($fp) + beq $t0, 0, label_TRUE_356 + # GOTO label_FALSE_355 + j label_FALSE_355 + label_COMPARE_STRING_358: + # LOCAL local_main_at_Main_internal_58 --> -236($fp) + # LOCAL local_main_at_Main_internal_59 --> -240($fp) + # LOCAL local_main_at_Main_internal_60 --> -244($fp) + # Load strings for comparison + lw $v0, -240($fp) + lw $v1, -244($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -236($fp) + # IF_ZERO local_main_at_Main_internal_58 GOTO label_CONTINUE_360 + # IF_ZERO local_main_at_Main_internal_58 GOTO label_CONTINUE_360 + lw $t0, -236($fp) + beq $t0, 0, label_CONTINUE_360 + # GOTO label_FALSE_355 + j label_FALSE_355 + label_CONTINUE_360: + # LOCAL local_main_at_Main_internal_58 --> -236($fp) + # LOCAL local_main_at_Main_internal_59 --> -240($fp) + # LOCAL local_main_at_Main_internal_60 --> -244($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -240($fp) + lw $v1, -244($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_361: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_362 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_361 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_362: + # Store result + sw $a2, -236($fp) + # IF_ZERO local_main_at_Main_internal_58 GOTO label_TRUE_356 + # IF_ZERO local_main_at_Main_internal_58 GOTO label_TRUE_356 + lw $t0, -236($fp) + beq $t0, 0, label_TRUE_356 + label_FALSE_355: + # LOCAL local_main_at_Main_internal_57 --> -232($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -232($fp) + # GOTO label_END_357 +j label_END_357 +label_TRUE_356: + # LOCAL local_main_at_Main_internal_57 --> -232($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -232($fp) + label_END_357: +# LOCAL local_main_at_Main_internal_55 --> -224($fp) +# LOCAL local_main_at_Main_internal_57 --> -232($fp) +# Obtain value from -232($fp) +lw $v0, -232($fp) +lw $v0, 12($v0) +sw $v0, -224($fp) +# IF_ZERO local_main_at_Main_internal_55 GOTO label_FALSEIF_353 +# IF_ZERO local_main_at_Main_internal_55 GOTO label_FALSEIF_353 +lw $t0, -224($fp) +beq $t0, 0, label_FALSEIF_353 +# local_main_at_Main_internal_61 = GETATTRIBUTE avar Main +# LOCAL local_main_at_Main_internal_61 --> -248($fp) +lw $t0, 16($s1) +sw $t0, -248($fp) +# LOCAL local_main_at_Main_internal_61 --> -248($fp) +# LOCAL local_main_at_Main_internal_62 --> -252($fp) +# local_main_at_Main_internal_62 = TYPEOF local_main_at_Main_internal_61 +lw $t0, -248($fp) +# Load pointer to type offset +lw $t1, 8($t0) +sw $t1, -252($fp) +# LOCAL local_main_at_Main_internal_65 --> -264($fp) +# local_main_at_Main_internal_65 = 15 +li $t0, 15 +sw $t0, -264($fp) +# local_main_at_Main_internal_66 = TYPE_DISTANCE C +# LOCAL local_main_at_Main_internal_66 --> -268($fp) +# LOCAL local_main_at_Main_internal_62 --> -252($fp) +# Load TDT pointer to type C +la $t0, C__TDT +lw $t1, -252($fp) +addu $t0, $t0, $t1 +# Save distance +lw $t1, 0($t0) +sw $t1, -268($fp) +# LOCAL local_main_at_Main_internal_66 --> -268($fp) +# LOCAL local_main_at_Main_internal_65 --> -264($fp) +# Update min if 8 < 9 +lw $t0, -268($fp) +lw $t1, -264($fp) +bgtu $t0, $t1, label_Not_min0_363 +# LOCAL local_main_at_Main_internal_65 --> -264($fp) +# LOCAL local_main_at_Main_internal_66 --> -268($fp) +# local_main_at_Main_internal_65 = local_main_at_Main_internal_66 +lw $t0, -268($fp) +sw $t0, -264($fp) +label_Not_min0_363: + # local_main_at_Main_internal_66 = TYPE_DISTANCE A + # LOCAL local_main_at_Main_internal_66 --> -268($fp) + # LOCAL local_main_at_Main_internal_62 --> -252($fp) + # Load TDT pointer to type A + la $t0, A__TDT + lw $t1, -252($fp) + addu $t0, $t0, $t1 + # Save distance + lw $t1, 0($t0) + sw $t1, -268($fp) + # LOCAL local_main_at_Main_internal_66 --> -268($fp) + # LOCAL local_main_at_Main_internal_65 --> -264($fp) + # Update min if 8 < 9 + lw $t0, -268($fp) + lw $t1, -264($fp) + bgtu $t0, $t1, label_Not_min1_364 + # LOCAL local_main_at_Main_internal_65 --> -264($fp) + # LOCAL local_main_at_Main_internal_66 --> -268($fp) + # local_main_at_Main_internal_65 = local_main_at_Main_internal_66 + lw $t0, -268($fp) + sw $t0, -264($fp) + label_Not_min1_364: + # local_main_at_Main_internal_66 = TYPE_DISTANCE Object + # LOCAL local_main_at_Main_internal_66 --> -268($fp) + # LOCAL local_main_at_Main_internal_62 --> -252($fp) + # Load TDT pointer to type Object + la $t0, Object__TDT + lw $t1, -252($fp) + addu $t0, $t0, $t1 + # Save distance + lw $t1, 0($t0) + sw $t1, -268($fp) + # LOCAL local_main_at_Main_internal_66 --> -268($fp) + # LOCAL local_main_at_Main_internal_65 --> -264($fp) + # Update min if 8 < 9 + lw $t0, -268($fp) + lw $t1, -264($fp) + bgtu $t0, $t1, label_Not_min2_365 + # LOCAL local_main_at_Main_internal_65 --> -264($fp) + # LOCAL local_main_at_Main_internal_66 --> -268($fp) + # local_main_at_Main_internal_65 = local_main_at_Main_internal_66 + lw $t0, -268($fp) + sw $t0, -264($fp) + label_Not_min2_365: + # LOCAL local_main_at_Main_internal_66 --> -268($fp) + # local_main_at_Main_internal_66 = 15 + li $t0, 15 + sw $t0, -268($fp) + # LOCAL local_main_at_Main_internal_63 --> -256($fp) + # LOCAL local_main_at_Main_internal_66 --> -268($fp) + # LOCAL local_main_at_Main_internal_65 --> -264($fp) + # Load pointers and SUB + lw $a0, -268($fp) + lw $a1, -264($fp) + sub $a0, $a0, $a1 + sw $a0, -256($fp) + # IF_ZERO local_main_at_Main_internal_63 GOTO label_ERROR_366 + # IF_ZERO local_main_at_Main_internal_63 GOTO label_ERROR_366 + lw $t0, -256($fp) + beq $t0, 0, label_ERROR_366 + # local_main_at_Main_internal_66 = TYPE_DISTANCE C + # LOCAL local_main_at_Main_internal_66 --> -268($fp) + # LOCAL local_main_at_Main_internal_62 --> -252($fp) + # Load TDT pointer to type C + la $t0, C__TDT + lw $t1, -252($fp) + addu $t0, $t0, $t1 + # Save distance + lw $t1, 0($t0) + sw $t1, -268($fp) + # LOCAL local_main_at_Main_internal_66 --> -268($fp) + # LOCAL local_main_at_Main_internal_65 --> -264($fp) + # Update min if 8 < 9 + lw $t0, -268($fp) + lw $t1, -264($fp) + bgtu $t0, $t1, label_NEXT0_368 + # LOCAL local_main_at_Main_c_67 --> -272($fp) + # LOCAL local_main_at_Main_internal_61 --> -248($fp) + # local_main_at_Main_c_67 = local_main_at_Main_internal_61 + lw $t0, -248($fp) + sw $t0, -272($fp) + # LOCAL local_main_at_Main_internal_68 --> -276($fp) + # LOCAL local_main_at_Main_c_67 --> -272($fp) + # local_main_at_Main_internal_68 = local_main_at_Main_c_67 + lw $t0, -272($fp) + sw $t0, -276($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_70 --> -284($fp) + # LOCAL local_main_at_Main_c_67 --> -272($fp) + # local_main_at_Main_internal_70 = local_main_at_Main_c_67 + lw $t0, -272($fp) + sw $t0, -284($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_70 --> -284($fp) + # LOCAL local_main_at_Main_internal_71 --> -288($fp) + # local_main_at_Main_internal_71 = VCALL local_main_at_Main_internal_70 value + # Save new self pointer in $s1 + lw $s1, -284($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 8($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -288($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # ARG local_main_at_Main_internal_71 + # LOCAL local_main_at_Main_internal_71 --> -288($fp) + lw $t0, -288($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_main_at_Main_internal_68 --> -276($fp) + # LOCAL local_main_at_Main_internal_69 --> -280($fp) + # local_main_at_Main_internal_69 = VCALL local_main_at_Main_internal_68 method6 + # Save new self pointer in $s1 + lw $s1, -276($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 20($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -280($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # + # LOCAL local_main_at_Main_internal_69 --> -280($fp) + lw $t0, -280($fp) + sw $t0, 16($s1) + # LOCAL local_main_at_Main_internal_64 --> -260($fp) + # local_main_at_Main_internal_64 = + # GOTO label_END_367 +j label_END_367 +label_NEXT0_368: + # local_main_at_Main_internal_66 = TYPE_DISTANCE A + # LOCAL local_main_at_Main_internal_66 --> -268($fp) + # LOCAL local_main_at_Main_internal_62 --> -252($fp) + # Load TDT pointer to type A + la $t0, A__TDT + lw $t1, -252($fp) + addu $t0, $t0, $t1 + # Save distance + lw $t1, 0($t0) + sw $t1, -268($fp) + # LOCAL local_main_at_Main_internal_66 --> -268($fp) + # LOCAL local_main_at_Main_internal_65 --> -264($fp) + # Update min if 8 < 9 + lw $t0, -268($fp) + lw $t1, -264($fp) + bgtu $t0, $t1, label_NEXT1_369 + # LOCAL local_main_at_Main_a_72 --> -292($fp) + # LOCAL local_main_at_Main_internal_61 --> -248($fp) + # local_main_at_Main_a_72 = local_main_at_Main_internal_61 + lw $t0, -248($fp) + sw $t0, -292($fp) + # LOCAL local_main_at_Main_internal_73 --> -296($fp) + # LOCAL local_main_at_Main_a_72 --> -292($fp) + # local_main_at_Main_internal_73 = local_main_at_Main_a_72 + lw $t0, -292($fp) + sw $t0, -296($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_75 --> -304($fp) + # LOCAL local_main_at_Main_a_72 --> -292($fp) + # local_main_at_Main_internal_75 = local_main_at_Main_a_72 + lw $t0, -292($fp) + sw $t0, -304($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_75 --> -304($fp) + # LOCAL local_main_at_Main_internal_76 --> -308($fp) + # local_main_at_Main_internal_76 = VCALL local_main_at_Main_internal_75 value + # Save new self pointer in $s1 + lw $s1, -304($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 8($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -308($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # ARG local_main_at_Main_internal_76 + # LOCAL local_main_at_Main_internal_76 --> -308($fp) + lw $t0, -308($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_main_at_Main_internal_73 --> -296($fp) + # LOCAL local_main_at_Main_internal_74 --> -300($fp) + # local_main_at_Main_internal_74 = VCALL local_main_at_Main_internal_73 method3 + # Save new self pointer in $s1 + lw $s1, -296($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 44($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -300($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # + # LOCAL local_main_at_Main_internal_74 --> -300($fp) + lw $t0, -300($fp) + sw $t0, 16($s1) + # LOCAL local_main_at_Main_internal_64 --> -260($fp) + # local_main_at_Main_internal_64 = + # GOTO label_END_367 +j label_END_367 +label_NEXT1_369: + # local_main_at_Main_internal_66 = TYPE_DISTANCE Object + # LOCAL local_main_at_Main_internal_66 --> -268($fp) + # LOCAL local_main_at_Main_internal_62 --> -252($fp) + # Load TDT pointer to type Object + la $t0, Object__TDT + lw $t1, -252($fp) + addu $t0, $t0, $t1 + # Save distance + lw $t1, 0($t0) + sw $t1, -268($fp) + # LOCAL local_main_at_Main_internal_66 --> -268($fp) + # LOCAL local_main_at_Main_internal_65 --> -264($fp) + # Update min if 8 < 9 + lw $t0, -268($fp) + lw $t1, -264($fp) + bgtu $t0, $t1, label_NEXT2_370 + # LOCAL local_main_at_Main_o_77 --> -312($fp) + # LOCAL local_main_at_Main_internal_61 --> -248($fp) + # local_main_at_Main_o_77 = local_main_at_Main_internal_61 + lw $t0, -248($fp) + sw $t0, -312($fp) + # LOCAL local_main_at_Main_internal_80 --> -324($fp) + # local_main_at_Main_internal_80 = SELF + sw $s1, -324($fp) + # LOCAL local_main_at_Main_internal_78 --> -316($fp) + # LOCAL local_main_at_Main_internal_80 --> -324($fp) + # local_main_at_Main_internal_78 = local_main_at_Main_internal_80 + lw $t0, -324($fp) + sw $t0, -316($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_81 --> -328($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_62 + sw $t0, 12($v0) + li $t0, 7 + sw $t0, 16($v0) + sw $v0, -328($fp) + # ARG local_main_at_Main_internal_81 + # LOCAL local_main_at_Main_internal_81 --> -328($fp) + lw $t0, -328($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_main_at_Main_internal_78 --> -316($fp) + # LOCAL local_main_at_Main_internal_79 --> -320($fp) + # local_main_at_Main_internal_79 = VCALL local_main_at_Main_internal_78 out_string + # Save new self pointer in $s1 + lw $s1, -316($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 88($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -320($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_main_at_Main_internal_84 --> -340($fp) + # local_main_at_Main_internal_84 = SELF + sw $s1, -340($fp) + # LOCAL local_main_at_Main_internal_82 --> -332($fp) + # LOCAL local_main_at_Main_internal_84 --> -340($fp) + # local_main_at_Main_internal_82 = local_main_at_Main_internal_84 + lw $t0, -340($fp) + sw $t0, -332($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_82 --> -332($fp) + # LOCAL local_main_at_Main_internal_83 --> -336($fp) + # local_main_at_Main_internal_83 = VCALL local_main_at_Main_internal_82 abort + # Save new self pointer in $s1 + lw $s1, -332($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 84($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -336($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_main_at_Main_internal_85 --> -344($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -344($fp) + # LOCAL local_main_at_Main_internal_64 --> -260($fp) + # LOCAL local_main_at_Main_internal_85 --> -344($fp) + # local_main_at_Main_internal_64 = local_main_at_Main_internal_85 + lw $t0, -344($fp) + sw $t0, -260($fp) + # GOTO label_END_367 +j label_END_367 +label_NEXT2_370: + label_ERROR_366: + # LOCAL local_main_at_Main_internal_61 --> -248($fp) + lw $t0, 0($s1) + sw $t0, -248($fp) + # LOCAL local_main_at_Main_internal_61 --> -248($fp) + la $a0, data_1 + li $v0, 4 + syscall + lw $a0, -248($fp) + li $v0, 4 + syscall + la $a0, data_2 + li $v0, 4 + syscall + li $v0, 10 + syscall + label_END_367: +# LOCAL local_main_at_Main_internal_56 --> -228($fp) +# LOCAL local_main_at_Main_internal_64 --> -260($fp) +# local_main_at_Main_internal_56 = local_main_at_Main_internal_64 +lw $t0, -260($fp) +sw $t0, -228($fp) +# GOTO label_ENDIF_354 +j label_ENDIF_354 +label_FALSEIF_353: + # local_main_at_Main_internal_90 = GETATTRIBUTE char Main + # LOCAL local_main_at_Main_internal_90 --> -364($fp) + lw $t0, 12($s1) + sw $t0, -364($fp) + # LOCAL local_main_at_Main_internal_91 --> -368($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_63 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -368($fp) + # IF_ZERO local_main_at_Main_internal_90 GOTO label_FALSE_373 + # IF_ZERO local_main_at_Main_internal_90 GOTO label_FALSE_373 + lw $t0, -364($fp) + beq $t0, 0, label_FALSE_373 + # IF_ZERO local_main_at_Main_internal_91 GOTO label_FALSE_373 + # IF_ZERO local_main_at_Main_internal_91 GOTO label_FALSE_373 + lw $t0, -368($fp) + beq $t0, 0, label_FALSE_373 + # LOCAL local_main_at_Main_internal_89 --> -360($fp) + # LOCAL local_main_at_Main_internal_90 --> -364($fp) + # Comparing -364($fp) type with String + la $v0, String + lw $a0, -364($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -360($fp) + # IF_ZERO local_main_at_Main_internal_89 GOTO label_COMPARE_STRING_376 + # IF_ZERO local_main_at_Main_internal_89 GOTO label_COMPARE_STRING_376 + lw $t0, -360($fp) + beq $t0, 0, label_COMPARE_STRING_376 + # LOCAL local_main_at_Main_internal_89 --> -360($fp) + # LOCAL local_main_at_Main_internal_90 --> -364($fp) + # Comparing -364($fp) type with Bool + la $v0, Bool + lw $a0, -364($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -360($fp) + # IF_ZERO local_main_at_Main_internal_89 GOTO label_COMPARE_BY_VALUE_377 + # IF_ZERO local_main_at_Main_internal_89 GOTO label_COMPARE_BY_VALUE_377 + lw $t0, -360($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_377 + # LOCAL local_main_at_Main_internal_89 --> -360($fp) + # LOCAL local_main_at_Main_internal_90 --> -364($fp) + # Comparing -364($fp) type with Int + la $v0, Int + lw $a0, -364($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -360($fp) + # IF_ZERO local_main_at_Main_internal_89 GOTO label_COMPARE_BY_VALUE_377 + # IF_ZERO local_main_at_Main_internal_89 GOTO label_COMPARE_BY_VALUE_377 + lw $t0, -360($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_377 + # LOCAL local_main_at_Main_internal_89 --> -360($fp) + # LOCAL local_main_at_Main_internal_90 --> -364($fp) + # LOCAL local_main_at_Main_internal_91 --> -368($fp) + # Load pointers and SUB + lw $a0, -364($fp) + lw $a1, -368($fp) + sub $a0, $a0, $a1 + sw $a0, -360($fp) + # IF_ZERO local_main_at_Main_internal_89 GOTO label_TRUE_374 + # IF_ZERO local_main_at_Main_internal_89 GOTO label_TRUE_374 + lw $t0, -360($fp) + beq $t0, 0, label_TRUE_374 + # GOTO label_FALSE_373 + j label_FALSE_373 + label_COMPARE_BY_VALUE_377: + # LOCAL local_main_at_Main_internal_89 --> -360($fp) + # LOCAL local_main_at_Main_internal_90 --> -364($fp) + # LOCAL local_main_at_Main_internal_91 --> -368($fp) + lw $a0, -364($fp) + lw $a1, -368($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -360($fp) + # IF_ZERO local_main_at_Main_internal_89 GOTO label_TRUE_374 + # IF_ZERO local_main_at_Main_internal_89 GOTO label_TRUE_374 + lw $t0, -360($fp) + beq $t0, 0, label_TRUE_374 + # GOTO label_FALSE_373 + j label_FALSE_373 + label_COMPARE_STRING_376: + # LOCAL local_main_at_Main_internal_89 --> -360($fp) + # LOCAL local_main_at_Main_internal_90 --> -364($fp) + # LOCAL local_main_at_Main_internal_91 --> -368($fp) + # Load strings for comparison + lw $v0, -364($fp) + lw $v1, -368($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -360($fp) + # IF_ZERO local_main_at_Main_internal_89 GOTO label_CONTINUE_378 + # IF_ZERO local_main_at_Main_internal_89 GOTO label_CONTINUE_378 + lw $t0, -360($fp) + beq $t0, 0, label_CONTINUE_378 + # GOTO label_FALSE_373 + j label_FALSE_373 + label_CONTINUE_378: + # LOCAL local_main_at_Main_internal_89 --> -360($fp) + # LOCAL local_main_at_Main_internal_90 --> -364($fp) + # LOCAL local_main_at_Main_internal_91 --> -368($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -364($fp) + lw $v1, -368($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_379: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_380 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_379 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_380: + # Store result + sw $a2, -360($fp) + # IF_ZERO local_main_at_Main_internal_89 GOTO label_TRUE_374 + # IF_ZERO local_main_at_Main_internal_89 GOTO label_TRUE_374 + lw $t0, -360($fp) + beq $t0, 0, label_TRUE_374 + label_FALSE_373: + # LOCAL local_main_at_Main_internal_88 --> -356($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -356($fp) + # GOTO label_END_375 +j label_END_375 +label_TRUE_374: + # LOCAL local_main_at_Main_internal_88 --> -356($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -356($fp) + label_END_375: +# LOCAL local_main_at_Main_internal_86 --> -348($fp) +# LOCAL local_main_at_Main_internal_88 --> -356($fp) +# Obtain value from -356($fp) +lw $v0, -356($fp) +lw $v0, 12($v0) +sw $v0, -348($fp) +# IF_ZERO local_main_at_Main_internal_86 GOTO label_FALSEIF_371 +# IF_ZERO local_main_at_Main_internal_86 GOTO label_FALSEIF_371 +lw $t0, -348($fp) +beq $t0, 0, label_FALSEIF_371 +# LOCAL local_main_at_Main_internal_94 --> -380($fp) +# local_main_at_Main_internal_94 = ALLOCATE A +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type name +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, A +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, A_start +sw $t0, 4($v0) +# Load type offset +li $t0, 24 +sw $t0, 8($v0) +move $t1, $v0 +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +move $s1, $v0 +# Push register t1 into stack +subu $sp, $sp, 4 +sw $t1, 0($sp) +jal __A__attrib__var__init +# Pop 4 bytes from stack into register t1 +lw $t1, 0($sp) +addu $sp, $sp, 4 +sw $v0, 12($t1) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +sw $t1, -380($fp) +# LOCAL local_main_at_Main_internal_92 --> -372($fp) +# LOCAL local_main_at_Main_internal_94 --> -380($fp) +# local_main_at_Main_internal_92 = local_main_at_Main_internal_94 +lw $t0, -380($fp) +sw $t0, -372($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_main_at_Main_internal_97 --> -392($fp) +# local_main_at_Main_internal_97 = SELF +sw $s1, -392($fp) +# LOCAL local_main_at_Main_internal_95 --> -384($fp) +# LOCAL local_main_at_Main_internal_97 --> -392($fp) +# local_main_at_Main_internal_95 = local_main_at_Main_internal_97 +lw $t0, -392($fp) +sw $t0, -384($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_main_at_Main_internal_95 --> -384($fp) +# LOCAL local_main_at_Main_internal_96 --> -388($fp) +# local_main_at_Main_internal_96 = VCALL local_main_at_Main_internal_95 get_int +# Save new self pointer in $s1 +lw $s1, -384($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 16($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -388($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# ARG local_main_at_Main_internal_96 +# LOCAL local_main_at_Main_internal_96 --> -388($fp) +lw $t0, -388($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_main_at_Main_internal_92 --> -372($fp) +# LOCAL local_main_at_Main_internal_93 --> -376($fp) +# local_main_at_Main_internal_93 = VCALL local_main_at_Main_internal_92 set_var +# Save new self pointer in $s1 +lw $s1, -372($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 120($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -376($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# +# LOCAL local_main_at_Main_internal_93 --> -376($fp) +lw $t0, -376($fp) +sw $t0, 20($s1) +# LOCAL local_main_at_Main_internal_100 --> -404($fp) +# local_main_at_Main_internal_100 = ALLOCATE D +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type name +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, D +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, D_start +sw $t0, 4($v0) +# Load type offset +li $t0, 32 +sw $t0, 8($v0) +move $t1, $v0 +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +move $s1, $v0 +# Push register t1 into stack +subu $sp, $sp, 4 +sw $t1, 0($sp) +jal __A__attrib__var__init +# Pop 4 bytes from stack into register t1 +lw $t1, 0($sp) +addu $sp, $sp, 4 +sw $v0, 12($t1) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +sw $t1, -404($fp) +# LOCAL local_main_at_Main_internal_98 --> -396($fp) +# LOCAL local_main_at_Main_internal_100 --> -404($fp) +# local_main_at_Main_internal_98 = local_main_at_Main_internal_100 +lw $t0, -404($fp) +sw $t0, -396($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# local_main_at_Main_internal_103 = GETATTRIBUTE avar Main +# LOCAL local_main_at_Main_internal_103 --> -416($fp) +lw $t0, 16($s1) +sw $t0, -416($fp) +# LOCAL local_main_at_Main_internal_101 --> -408($fp) +# LOCAL local_main_at_Main_internal_103 --> -416($fp) +# local_main_at_Main_internal_101 = local_main_at_Main_internal_103 +lw $t0, -416($fp) +sw $t0, -408($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_main_at_Main_internal_101 --> -408($fp) +# LOCAL local_main_at_Main_internal_102 --> -412($fp) +# local_main_at_Main_internal_102 = VCALL local_main_at_Main_internal_101 value +# Save new self pointer in $s1 +lw $s1, -408($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 8($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -412($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# ARG local_main_at_Main_internal_102 +# LOCAL local_main_at_Main_internal_102 --> -412($fp) +lw $t0, -412($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# local_main_at_Main_internal_106 = GETATTRIBUTE a_var Main +# LOCAL local_main_at_Main_internal_106 --> -428($fp) +lw $t0, 20($s1) +sw $t0, -428($fp) +# LOCAL local_main_at_Main_internal_104 --> -420($fp) +# LOCAL local_main_at_Main_internal_106 --> -428($fp) +# local_main_at_Main_internal_104 = local_main_at_Main_internal_106 +lw $t0, -428($fp) +sw $t0, -420($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_main_at_Main_internal_104 --> -420($fp) +# LOCAL local_main_at_Main_internal_105 --> -424($fp) +# local_main_at_Main_internal_105 = VCALL local_main_at_Main_internal_104 value +# Save new self pointer in $s1 +lw $s1, -420($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 8($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -424($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# ARG local_main_at_Main_internal_105 +# LOCAL local_main_at_Main_internal_105 --> -424($fp) +lw $t0, -424($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_main_at_Main_internal_98 --> -396($fp) +# LOCAL local_main_at_Main_internal_99 --> -400($fp) +# local_main_at_Main_internal_99 = VCALL local_main_at_Main_internal_98 method4 +# Save new self pointer in $s1 +lw $s1, -396($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 4($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -400($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# +# LOCAL local_main_at_Main_internal_99 --> -400($fp) +lw $t0, -400($fp) +sw $t0, 16($s1) +# LOCAL local_main_at_Main_internal_87 --> -352($fp) +# local_main_at_Main_internal_87 = +# GOTO label_ENDIF_372 +j label_ENDIF_372 +label_FALSEIF_371: + # local_main_at_Main_internal_111 = GETATTRIBUTE char Main + # LOCAL local_main_at_Main_internal_111 --> -448($fp) + lw $t0, 12($s1) + sw $t0, -448($fp) + # LOCAL local_main_at_Main_internal_112 --> -452($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_64 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -452($fp) + # IF_ZERO local_main_at_Main_internal_111 GOTO label_FALSE_383 + # IF_ZERO local_main_at_Main_internal_111 GOTO label_FALSE_383 + lw $t0, -448($fp) + beq $t0, 0, label_FALSE_383 + # IF_ZERO local_main_at_Main_internal_112 GOTO label_FALSE_383 + # IF_ZERO local_main_at_Main_internal_112 GOTO label_FALSE_383 + lw $t0, -452($fp) + beq $t0, 0, label_FALSE_383 + # LOCAL local_main_at_Main_internal_110 --> -444($fp) + # LOCAL local_main_at_Main_internal_111 --> -448($fp) + # Comparing -448($fp) type with String + la $v0, String + lw $a0, -448($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -444($fp) + # IF_ZERO local_main_at_Main_internal_110 GOTO label_COMPARE_STRING_386 + # IF_ZERO local_main_at_Main_internal_110 GOTO label_COMPARE_STRING_386 + lw $t0, -444($fp) + beq $t0, 0, label_COMPARE_STRING_386 + # LOCAL local_main_at_Main_internal_110 --> -444($fp) + # LOCAL local_main_at_Main_internal_111 --> -448($fp) + # Comparing -448($fp) type with Bool + la $v0, Bool + lw $a0, -448($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -444($fp) + # IF_ZERO local_main_at_Main_internal_110 GOTO label_COMPARE_BY_VALUE_387 + # IF_ZERO local_main_at_Main_internal_110 GOTO label_COMPARE_BY_VALUE_387 + lw $t0, -444($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_387 + # LOCAL local_main_at_Main_internal_110 --> -444($fp) + # LOCAL local_main_at_Main_internal_111 --> -448($fp) + # Comparing -448($fp) type with Int + la $v0, Int + lw $a0, -448($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -444($fp) + # IF_ZERO local_main_at_Main_internal_110 GOTO label_COMPARE_BY_VALUE_387 + # IF_ZERO local_main_at_Main_internal_110 GOTO label_COMPARE_BY_VALUE_387 + lw $t0, -444($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_387 + # LOCAL local_main_at_Main_internal_110 --> -444($fp) + # LOCAL local_main_at_Main_internal_111 --> -448($fp) + # LOCAL local_main_at_Main_internal_112 --> -452($fp) + # Load pointers and SUB + lw $a0, -448($fp) + lw $a1, -452($fp) + sub $a0, $a0, $a1 + sw $a0, -444($fp) + # IF_ZERO local_main_at_Main_internal_110 GOTO label_TRUE_384 + # IF_ZERO local_main_at_Main_internal_110 GOTO label_TRUE_384 + lw $t0, -444($fp) + beq $t0, 0, label_TRUE_384 + # GOTO label_FALSE_383 + j label_FALSE_383 + label_COMPARE_BY_VALUE_387: + # LOCAL local_main_at_Main_internal_110 --> -444($fp) + # LOCAL local_main_at_Main_internal_111 --> -448($fp) + # LOCAL local_main_at_Main_internal_112 --> -452($fp) + lw $a0, -448($fp) + lw $a1, -452($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -444($fp) + # IF_ZERO local_main_at_Main_internal_110 GOTO label_TRUE_384 + # IF_ZERO local_main_at_Main_internal_110 GOTO label_TRUE_384 + lw $t0, -444($fp) + beq $t0, 0, label_TRUE_384 + # GOTO label_FALSE_383 + j label_FALSE_383 + label_COMPARE_STRING_386: + # LOCAL local_main_at_Main_internal_110 --> -444($fp) + # LOCAL local_main_at_Main_internal_111 --> -448($fp) + # LOCAL local_main_at_Main_internal_112 --> -452($fp) + # Load strings for comparison + lw $v0, -448($fp) + lw $v1, -452($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -444($fp) + # IF_ZERO local_main_at_Main_internal_110 GOTO label_CONTINUE_388 + # IF_ZERO local_main_at_Main_internal_110 GOTO label_CONTINUE_388 + lw $t0, -444($fp) + beq $t0, 0, label_CONTINUE_388 + # GOTO label_FALSE_383 + j label_FALSE_383 + label_CONTINUE_388: + # LOCAL local_main_at_Main_internal_110 --> -444($fp) + # LOCAL local_main_at_Main_internal_111 --> -448($fp) + # LOCAL local_main_at_Main_internal_112 --> -452($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -448($fp) + lw $v1, -452($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_389: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_390 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_389 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_390: + # Store result + sw $a2, -444($fp) + # IF_ZERO local_main_at_Main_internal_110 GOTO label_TRUE_384 + # IF_ZERO local_main_at_Main_internal_110 GOTO label_TRUE_384 + lw $t0, -444($fp) + beq $t0, 0, label_TRUE_384 + label_FALSE_383: + # LOCAL local_main_at_Main_internal_109 --> -440($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -440($fp) + # GOTO label_END_385 +j label_END_385 +label_TRUE_384: + # LOCAL local_main_at_Main_internal_109 --> -440($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -440($fp) + label_END_385: +# LOCAL local_main_at_Main_internal_107 --> -432($fp) +# LOCAL local_main_at_Main_internal_109 --> -440($fp) +# Obtain value from -440($fp) +lw $v0, -440($fp) +lw $v0, 12($v0) +sw $v0, -432($fp) +# IF_ZERO local_main_at_Main_internal_107 GOTO label_FALSEIF_381 +# IF_ZERO local_main_at_Main_internal_107 GOTO label_FALSEIF_381 +lw $t0, -432($fp) +beq $t0, 0, label_FALSEIF_381 +# LOCAL local_main_at_Main_internal_114 --> -460($fp) +# local_main_at_Main_internal_114 = ALLOCATE C +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type name +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, C +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, C_start +sw $t0, 4($v0) +# Load type offset +li $t0, 40 +sw $t0, 8($v0) +move $t1, $v0 +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +move $s1, $v0 +# Push register t1 into stack +subu $sp, $sp, 4 +sw $t1, 0($sp) +jal __A__attrib__var__init +# Pop 4 bytes from stack into register t1 +lw $t1, 0($sp) +addu $sp, $sp, 4 +sw $v0, 12($t1) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +sw $t1, -460($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# local_main_at_Main_internal_117 = GETATTRIBUTE avar Main +# LOCAL local_main_at_Main_internal_117 --> -472($fp) +lw $t0, 16($s1) +sw $t0, -472($fp) +# LOCAL local_main_at_Main_internal_115 --> -464($fp) +# LOCAL local_main_at_Main_internal_117 --> -472($fp) +# local_main_at_Main_internal_115 = local_main_at_Main_internal_117 +lw $t0, -472($fp) +sw $t0, -464($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_main_at_Main_internal_115 --> -464($fp) +# LOCAL local_main_at_Main_internal_116 --> -468($fp) +# local_main_at_Main_internal_116 = VCALL local_main_at_Main_internal_115 value +# Save new self pointer in $s1 +lw $s1, -464($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 8($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -468($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# ARG local_main_at_Main_internal_116 +# LOCAL local_main_at_Main_internal_116 --> -468($fp) +lw $t0, -468($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# local_main_at_Main_internal_113 = CALL method5 +# LOCAL local_main_at_Main_internal_113 --> -456($fp) +# LOCAL local_main_at_Main_internal_114 --> -460($fp) +# Save new self pointer in $s1 +lw $s1, -460($fp) +# Get pointer to type's VTABLE +la $t0, A_vtable +# Get pointer to function address +lw $t1, 80($t0) +# Call function. Result is on $v0 +jalr $t1 +sw $v0, -456($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# +# LOCAL local_main_at_Main_internal_113 --> -456($fp) +lw $t0, -456($fp) +sw $t0, 16($s1) +# LOCAL local_main_at_Main_internal_108 --> -436($fp) +# local_main_at_Main_internal_108 = +# GOTO label_ENDIF_382 +j label_ENDIF_382 +label_FALSEIF_381: + # local_main_at_Main_internal_122 = GETATTRIBUTE char Main + # LOCAL local_main_at_Main_internal_122 --> -492($fp) + lw $t0, 12($s1) + sw $t0, -492($fp) + # LOCAL local_main_at_Main_internal_123 --> -496($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_65 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -496($fp) + # IF_ZERO local_main_at_Main_internal_122 GOTO label_FALSE_393 + # IF_ZERO local_main_at_Main_internal_122 GOTO label_FALSE_393 + lw $t0, -492($fp) + beq $t0, 0, label_FALSE_393 + # IF_ZERO local_main_at_Main_internal_123 GOTO label_FALSE_393 + # IF_ZERO local_main_at_Main_internal_123 GOTO label_FALSE_393 + lw $t0, -496($fp) + beq $t0, 0, label_FALSE_393 + # LOCAL local_main_at_Main_internal_121 --> -488($fp) + # LOCAL local_main_at_Main_internal_122 --> -492($fp) + # Comparing -492($fp) type with String + la $v0, String + lw $a0, -492($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -488($fp) + # IF_ZERO local_main_at_Main_internal_121 GOTO label_COMPARE_STRING_396 + # IF_ZERO local_main_at_Main_internal_121 GOTO label_COMPARE_STRING_396 + lw $t0, -488($fp) + beq $t0, 0, label_COMPARE_STRING_396 + # LOCAL local_main_at_Main_internal_121 --> -488($fp) + # LOCAL local_main_at_Main_internal_122 --> -492($fp) + # Comparing -492($fp) type with Bool + la $v0, Bool + lw $a0, -492($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -488($fp) + # IF_ZERO local_main_at_Main_internal_121 GOTO label_COMPARE_BY_VALUE_397 + # IF_ZERO local_main_at_Main_internal_121 GOTO label_COMPARE_BY_VALUE_397 + lw $t0, -488($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_397 + # LOCAL local_main_at_Main_internal_121 --> -488($fp) + # LOCAL local_main_at_Main_internal_122 --> -492($fp) + # Comparing -492($fp) type with Int + la $v0, Int + lw $a0, -492($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -488($fp) + # IF_ZERO local_main_at_Main_internal_121 GOTO label_COMPARE_BY_VALUE_397 + # IF_ZERO local_main_at_Main_internal_121 GOTO label_COMPARE_BY_VALUE_397 + lw $t0, -488($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_397 + # LOCAL local_main_at_Main_internal_121 --> -488($fp) + # LOCAL local_main_at_Main_internal_122 --> -492($fp) + # LOCAL local_main_at_Main_internal_123 --> -496($fp) + # Load pointers and SUB + lw $a0, -492($fp) + lw $a1, -496($fp) + sub $a0, $a0, $a1 + sw $a0, -488($fp) + # IF_ZERO local_main_at_Main_internal_121 GOTO label_TRUE_394 + # IF_ZERO local_main_at_Main_internal_121 GOTO label_TRUE_394 + lw $t0, -488($fp) + beq $t0, 0, label_TRUE_394 + # GOTO label_FALSE_393 + j label_FALSE_393 + label_COMPARE_BY_VALUE_397: + # LOCAL local_main_at_Main_internal_121 --> -488($fp) + # LOCAL local_main_at_Main_internal_122 --> -492($fp) + # LOCAL local_main_at_Main_internal_123 --> -496($fp) + lw $a0, -492($fp) + lw $a1, -496($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -488($fp) + # IF_ZERO local_main_at_Main_internal_121 GOTO label_TRUE_394 + # IF_ZERO local_main_at_Main_internal_121 GOTO label_TRUE_394 + lw $t0, -488($fp) + beq $t0, 0, label_TRUE_394 + # GOTO label_FALSE_393 + j label_FALSE_393 + label_COMPARE_STRING_396: + # LOCAL local_main_at_Main_internal_121 --> -488($fp) + # LOCAL local_main_at_Main_internal_122 --> -492($fp) + # LOCAL local_main_at_Main_internal_123 --> -496($fp) + # Load strings for comparison + lw $v0, -492($fp) + lw $v1, -496($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -488($fp) + # IF_ZERO local_main_at_Main_internal_121 GOTO label_CONTINUE_398 + # IF_ZERO local_main_at_Main_internal_121 GOTO label_CONTINUE_398 + lw $t0, -488($fp) + beq $t0, 0, label_CONTINUE_398 + # GOTO label_FALSE_393 + j label_FALSE_393 + label_CONTINUE_398: + # LOCAL local_main_at_Main_internal_121 --> -488($fp) + # LOCAL local_main_at_Main_internal_122 --> -492($fp) + # LOCAL local_main_at_Main_internal_123 --> -496($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -492($fp) + lw $v1, -496($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_399: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_400 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_399 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_400: + # Store result + sw $a2, -488($fp) + # IF_ZERO local_main_at_Main_internal_121 GOTO label_TRUE_394 + # IF_ZERO local_main_at_Main_internal_121 GOTO label_TRUE_394 + lw $t0, -488($fp) + beq $t0, 0, label_TRUE_394 + label_FALSE_393: + # LOCAL local_main_at_Main_internal_120 --> -484($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -484($fp) + # GOTO label_END_395 +j label_END_395 +label_TRUE_394: + # LOCAL local_main_at_Main_internal_120 --> -484($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -484($fp) + label_END_395: +# LOCAL local_main_at_Main_internal_118 --> -476($fp) +# LOCAL local_main_at_Main_internal_120 --> -484($fp) +# Obtain value from -484($fp) +lw $v0, -484($fp) +lw $v0, 12($v0) +sw $v0, -476($fp) +# IF_ZERO local_main_at_Main_internal_118 GOTO label_FALSEIF_391 +# IF_ZERO local_main_at_Main_internal_118 GOTO label_FALSEIF_391 +lw $t0, -476($fp) +beq $t0, 0, label_FALSEIF_391 +# LOCAL local_main_at_Main_internal_125 --> -504($fp) +# local_main_at_Main_internal_125 = ALLOCATE C +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type name +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, C +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, C_start +sw $t0, 4($v0) +# Load type offset +li $t0, 40 +sw $t0, 8($v0) +move $t1, $v0 +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +move $s1, $v0 +# Push register t1 into stack +subu $sp, $sp, 4 +sw $t1, 0($sp) +jal __A__attrib__var__init +# Pop 4 bytes from stack into register t1 +lw $t1, 0($sp) +addu $sp, $sp, 4 +sw $v0, 12($t1) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +sw $t1, -504($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# local_main_at_Main_internal_128 = GETATTRIBUTE avar Main +# LOCAL local_main_at_Main_internal_128 --> -516($fp) +lw $t0, 16($s1) +sw $t0, -516($fp) +# LOCAL local_main_at_Main_internal_126 --> -508($fp) +# LOCAL local_main_at_Main_internal_128 --> -516($fp) +# local_main_at_Main_internal_126 = local_main_at_Main_internal_128 +lw $t0, -516($fp) +sw $t0, -508($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_main_at_Main_internal_126 --> -508($fp) +# LOCAL local_main_at_Main_internal_127 --> -512($fp) +# local_main_at_Main_internal_127 = VCALL local_main_at_Main_internal_126 value +# Save new self pointer in $s1 +lw $s1, -508($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 8($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -512($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# ARG local_main_at_Main_internal_127 +# LOCAL local_main_at_Main_internal_127 --> -512($fp) +lw $t0, -512($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# local_main_at_Main_internal_124 = CALL method5 +# LOCAL local_main_at_Main_internal_124 --> -500($fp) +# LOCAL local_main_at_Main_internal_125 --> -504($fp) +# Save new self pointer in $s1 +lw $s1, -504($fp) +# Get pointer to type's VTABLE +la $t0, B_vtable +# Get pointer to function address +lw $t1, 80($t0) +# Call function. Result is on $v0 +jalr $t1 +sw $v0, -500($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# +# LOCAL local_main_at_Main_internal_124 --> -500($fp) +lw $t0, -500($fp) +sw $t0, 16($s1) +# LOCAL local_main_at_Main_internal_119 --> -480($fp) +# local_main_at_Main_internal_119 = +# GOTO label_ENDIF_392 +j label_ENDIF_392 +label_FALSEIF_391: + # local_main_at_Main_internal_133 = GETATTRIBUTE char Main + # LOCAL local_main_at_Main_internal_133 --> -536($fp) + lw $t0, 12($s1) + sw $t0, -536($fp) + # LOCAL local_main_at_Main_internal_134 --> -540($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_66 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -540($fp) + # IF_ZERO local_main_at_Main_internal_133 GOTO label_FALSE_403 + # IF_ZERO local_main_at_Main_internal_133 GOTO label_FALSE_403 + lw $t0, -536($fp) + beq $t0, 0, label_FALSE_403 + # IF_ZERO local_main_at_Main_internal_134 GOTO label_FALSE_403 + # IF_ZERO local_main_at_Main_internal_134 GOTO label_FALSE_403 + lw $t0, -540($fp) + beq $t0, 0, label_FALSE_403 + # LOCAL local_main_at_Main_internal_132 --> -532($fp) + # LOCAL local_main_at_Main_internal_133 --> -536($fp) + # Comparing -536($fp) type with String + la $v0, String + lw $a0, -536($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -532($fp) + # IF_ZERO local_main_at_Main_internal_132 GOTO label_COMPARE_STRING_406 + # IF_ZERO local_main_at_Main_internal_132 GOTO label_COMPARE_STRING_406 + lw $t0, -532($fp) + beq $t0, 0, label_COMPARE_STRING_406 + # LOCAL local_main_at_Main_internal_132 --> -532($fp) + # LOCAL local_main_at_Main_internal_133 --> -536($fp) + # Comparing -536($fp) type with Bool + la $v0, Bool + lw $a0, -536($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -532($fp) + # IF_ZERO local_main_at_Main_internal_132 GOTO label_COMPARE_BY_VALUE_407 + # IF_ZERO local_main_at_Main_internal_132 GOTO label_COMPARE_BY_VALUE_407 + lw $t0, -532($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_407 + # LOCAL local_main_at_Main_internal_132 --> -532($fp) + # LOCAL local_main_at_Main_internal_133 --> -536($fp) + # Comparing -536($fp) type with Int + la $v0, Int + lw $a0, -536($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -532($fp) + # IF_ZERO local_main_at_Main_internal_132 GOTO label_COMPARE_BY_VALUE_407 + # IF_ZERO local_main_at_Main_internal_132 GOTO label_COMPARE_BY_VALUE_407 + lw $t0, -532($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_407 + # LOCAL local_main_at_Main_internal_132 --> -532($fp) + # LOCAL local_main_at_Main_internal_133 --> -536($fp) + # LOCAL local_main_at_Main_internal_134 --> -540($fp) + # Load pointers and SUB + lw $a0, -536($fp) + lw $a1, -540($fp) + sub $a0, $a0, $a1 + sw $a0, -532($fp) + # IF_ZERO local_main_at_Main_internal_132 GOTO label_TRUE_404 + # IF_ZERO local_main_at_Main_internal_132 GOTO label_TRUE_404 + lw $t0, -532($fp) + beq $t0, 0, label_TRUE_404 + # GOTO label_FALSE_403 + j label_FALSE_403 + label_COMPARE_BY_VALUE_407: + # LOCAL local_main_at_Main_internal_132 --> -532($fp) + # LOCAL local_main_at_Main_internal_133 --> -536($fp) + # LOCAL local_main_at_Main_internal_134 --> -540($fp) + lw $a0, -536($fp) + lw $a1, -540($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -532($fp) + # IF_ZERO local_main_at_Main_internal_132 GOTO label_TRUE_404 + # IF_ZERO local_main_at_Main_internal_132 GOTO label_TRUE_404 + lw $t0, -532($fp) + beq $t0, 0, label_TRUE_404 + # GOTO label_FALSE_403 + j label_FALSE_403 + label_COMPARE_STRING_406: + # LOCAL local_main_at_Main_internal_132 --> -532($fp) + # LOCAL local_main_at_Main_internal_133 --> -536($fp) + # LOCAL local_main_at_Main_internal_134 --> -540($fp) + # Load strings for comparison + lw $v0, -536($fp) + lw $v1, -540($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -532($fp) + # IF_ZERO local_main_at_Main_internal_132 GOTO label_CONTINUE_408 + # IF_ZERO local_main_at_Main_internal_132 GOTO label_CONTINUE_408 + lw $t0, -532($fp) + beq $t0, 0, label_CONTINUE_408 + # GOTO label_FALSE_403 + j label_FALSE_403 + label_CONTINUE_408: + # LOCAL local_main_at_Main_internal_132 --> -532($fp) + # LOCAL local_main_at_Main_internal_133 --> -536($fp) + # LOCAL local_main_at_Main_internal_134 --> -540($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -536($fp) + lw $v1, -540($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_409: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_410 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_409 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_410: + # Store result + sw $a2, -532($fp) + # IF_ZERO local_main_at_Main_internal_132 GOTO label_TRUE_404 + # IF_ZERO local_main_at_Main_internal_132 GOTO label_TRUE_404 + lw $t0, -532($fp) + beq $t0, 0, label_TRUE_404 + label_FALSE_403: + # LOCAL local_main_at_Main_internal_131 --> -528($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -528($fp) + # GOTO label_END_405 +j label_END_405 +label_TRUE_404: + # LOCAL local_main_at_Main_internal_131 --> -528($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -528($fp) + label_END_405: +# LOCAL local_main_at_Main_internal_129 --> -520($fp) +# LOCAL local_main_at_Main_internal_131 --> -528($fp) +# Obtain value from -528($fp) +lw $v0, -528($fp) +lw $v0, 12($v0) +sw $v0, -520($fp) +# IF_ZERO local_main_at_Main_internal_129 GOTO label_FALSEIF_401 +# IF_ZERO local_main_at_Main_internal_129 GOTO label_FALSEIF_401 +lw $t0, -520($fp) +beq $t0, 0, label_FALSEIF_401 +# LOCAL local_main_at_Main_internal_136 --> -548($fp) +# local_main_at_Main_internal_136 = ALLOCATE C +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type name +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, C +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, C_start +sw $t0, 4($v0) +# Load type offset +li $t0, 40 +sw $t0, 8($v0) +move $t1, $v0 +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +move $s1, $v0 +# Push register t1 into stack +subu $sp, $sp, 4 +sw $t1, 0($sp) +jal __A__attrib__var__init +# Pop 4 bytes from stack into register t1 +lw $t1, 0($sp) +addu $sp, $sp, 4 +sw $v0, 12($t1) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +sw $t1, -548($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# local_main_at_Main_internal_139 = GETATTRIBUTE avar Main +# LOCAL local_main_at_Main_internal_139 --> -560($fp) +lw $t0, 16($s1) +sw $t0, -560($fp) +# LOCAL local_main_at_Main_internal_137 --> -552($fp) +# LOCAL local_main_at_Main_internal_139 --> -560($fp) +# local_main_at_Main_internal_137 = local_main_at_Main_internal_139 +lw $t0, -560($fp) +sw $t0, -552($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_main_at_Main_internal_137 --> -552($fp) +# LOCAL local_main_at_Main_internal_138 --> -556($fp) +# local_main_at_Main_internal_138 = VCALL local_main_at_Main_internal_137 value +# Save new self pointer in $s1 +lw $s1, -552($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 8($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -556($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# ARG local_main_at_Main_internal_138 +# LOCAL local_main_at_Main_internal_138 --> -556($fp) +lw $t0, -556($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# local_main_at_Main_internal_135 = CALL method5 +# LOCAL local_main_at_Main_internal_135 --> -544($fp) +# LOCAL local_main_at_Main_internal_136 --> -548($fp) +# Save new self pointer in $s1 +lw $s1, -548($fp) +# Get pointer to type's VTABLE +la $t0, C_vtable +# Get pointer to function address +lw $t1, 80($t0) +# Call function. Result is on $v0 +jalr $t1 +sw $v0, -544($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# +# LOCAL local_main_at_Main_internal_135 --> -544($fp) +lw $t0, -544($fp) +sw $t0, 16($s1) +# LOCAL local_main_at_Main_internal_130 --> -524($fp) +# local_main_at_Main_internal_130 = +# GOTO label_ENDIF_402 +j label_ENDIF_402 +label_FALSEIF_401: + # local_main_at_Main_internal_144 = GETATTRIBUTE char Main + # LOCAL local_main_at_Main_internal_144 --> -580($fp) + lw $t0, 12($s1) + sw $t0, -580($fp) + # LOCAL local_main_at_Main_internal_145 --> -584($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_67 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -584($fp) + # IF_ZERO local_main_at_Main_internal_144 GOTO label_FALSE_413 + # IF_ZERO local_main_at_Main_internal_144 GOTO label_FALSE_413 + lw $t0, -580($fp) + beq $t0, 0, label_FALSE_413 + # IF_ZERO local_main_at_Main_internal_145 GOTO label_FALSE_413 + # IF_ZERO local_main_at_Main_internal_145 GOTO label_FALSE_413 + lw $t0, -584($fp) + beq $t0, 0, label_FALSE_413 + # LOCAL local_main_at_Main_internal_143 --> -576($fp) + # LOCAL local_main_at_Main_internal_144 --> -580($fp) + # Comparing -580($fp) type with String + la $v0, String + lw $a0, -580($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -576($fp) + # IF_ZERO local_main_at_Main_internal_143 GOTO label_COMPARE_STRING_416 + # IF_ZERO local_main_at_Main_internal_143 GOTO label_COMPARE_STRING_416 + lw $t0, -576($fp) + beq $t0, 0, label_COMPARE_STRING_416 + # LOCAL local_main_at_Main_internal_143 --> -576($fp) + # LOCAL local_main_at_Main_internal_144 --> -580($fp) + # Comparing -580($fp) type with Bool + la $v0, Bool + lw $a0, -580($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -576($fp) + # IF_ZERO local_main_at_Main_internal_143 GOTO label_COMPARE_BY_VALUE_417 + # IF_ZERO local_main_at_Main_internal_143 GOTO label_COMPARE_BY_VALUE_417 + lw $t0, -576($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_417 + # LOCAL local_main_at_Main_internal_143 --> -576($fp) + # LOCAL local_main_at_Main_internal_144 --> -580($fp) + # Comparing -580($fp) type with Int + la $v0, Int + lw $a0, -580($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -576($fp) + # IF_ZERO local_main_at_Main_internal_143 GOTO label_COMPARE_BY_VALUE_417 + # IF_ZERO local_main_at_Main_internal_143 GOTO label_COMPARE_BY_VALUE_417 + lw $t0, -576($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_417 + # LOCAL local_main_at_Main_internal_143 --> -576($fp) + # LOCAL local_main_at_Main_internal_144 --> -580($fp) + # LOCAL local_main_at_Main_internal_145 --> -584($fp) + # Load pointers and SUB + lw $a0, -580($fp) + lw $a1, -584($fp) + sub $a0, $a0, $a1 + sw $a0, -576($fp) + # IF_ZERO local_main_at_Main_internal_143 GOTO label_TRUE_414 + # IF_ZERO local_main_at_Main_internal_143 GOTO label_TRUE_414 + lw $t0, -576($fp) + beq $t0, 0, label_TRUE_414 + # GOTO label_FALSE_413 + j label_FALSE_413 + label_COMPARE_BY_VALUE_417: + # LOCAL local_main_at_Main_internal_143 --> -576($fp) + # LOCAL local_main_at_Main_internal_144 --> -580($fp) + # LOCAL local_main_at_Main_internal_145 --> -584($fp) + lw $a0, -580($fp) + lw $a1, -584($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -576($fp) + # IF_ZERO local_main_at_Main_internal_143 GOTO label_TRUE_414 + # IF_ZERO local_main_at_Main_internal_143 GOTO label_TRUE_414 + lw $t0, -576($fp) + beq $t0, 0, label_TRUE_414 + # GOTO label_FALSE_413 + j label_FALSE_413 + label_COMPARE_STRING_416: + # LOCAL local_main_at_Main_internal_143 --> -576($fp) + # LOCAL local_main_at_Main_internal_144 --> -580($fp) + # LOCAL local_main_at_Main_internal_145 --> -584($fp) + # Load strings for comparison + lw $v0, -580($fp) + lw $v1, -584($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -576($fp) + # IF_ZERO local_main_at_Main_internal_143 GOTO label_CONTINUE_418 + # IF_ZERO local_main_at_Main_internal_143 GOTO label_CONTINUE_418 + lw $t0, -576($fp) + beq $t0, 0, label_CONTINUE_418 + # GOTO label_FALSE_413 + j label_FALSE_413 + label_CONTINUE_418: + # LOCAL local_main_at_Main_internal_143 --> -576($fp) + # LOCAL local_main_at_Main_internal_144 --> -580($fp) + # LOCAL local_main_at_Main_internal_145 --> -584($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -580($fp) + lw $v1, -584($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_419: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_420 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_419 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_420: + # Store result + sw $a2, -576($fp) + # IF_ZERO local_main_at_Main_internal_143 GOTO label_TRUE_414 + # IF_ZERO local_main_at_Main_internal_143 GOTO label_TRUE_414 + lw $t0, -576($fp) + beq $t0, 0, label_TRUE_414 + label_FALSE_413: + # LOCAL local_main_at_Main_internal_142 --> -572($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -572($fp) + # GOTO label_END_415 +j label_END_415 +label_TRUE_414: + # LOCAL local_main_at_Main_internal_142 --> -572($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -572($fp) + label_END_415: +# LOCAL local_main_at_Main_internal_140 --> -564($fp) +# LOCAL local_main_at_Main_internal_142 --> -572($fp) +# Obtain value from -572($fp) +lw $v0, -572($fp) +lw $v0, 12($v0) +sw $v0, -564($fp) +# IF_ZERO local_main_at_Main_internal_140 GOTO label_FALSEIF_411 +# IF_ZERO local_main_at_Main_internal_140 GOTO label_FALSEIF_411 +lw $t0, -564($fp) +beq $t0, 0, label_FALSEIF_411 +# LOCAL local_main_at_Main_internal_150 --> -604($fp) +# local_main_at_Main_internal_150 = ALLOCATE D +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type name +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, D +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, D_start +sw $t0, 4($v0) +# Load type offset +li $t0, 32 +sw $t0, 8($v0) +move $t1, $v0 +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +move $s1, $v0 +# Push register t1 into stack +subu $sp, $sp, 4 +sw $t1, 0($sp) +jal __A__attrib__var__init +# Pop 4 bytes from stack into register t1 +lw $t1, 0($sp) +addu $sp, $sp, 4 +sw $v0, 12($t1) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +sw $t1, -604($fp) +# LOCAL local_main_at_Main_internal_148 --> -596($fp) +# LOCAL local_main_at_Main_internal_150 --> -604($fp) +# local_main_at_Main_internal_148 = local_main_at_Main_internal_150 +lw $t0, -604($fp) +sw $t0, -596($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# local_main_at_Main_internal_153 = GETATTRIBUTE avar Main +# LOCAL local_main_at_Main_internal_153 --> -616($fp) +lw $t0, 16($s1) +sw $t0, -616($fp) +# LOCAL local_main_at_Main_internal_151 --> -608($fp) +# LOCAL local_main_at_Main_internal_153 --> -616($fp) +# local_main_at_Main_internal_151 = local_main_at_Main_internal_153 +lw $t0, -616($fp) +sw $t0, -608($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_main_at_Main_internal_151 --> -608($fp) +# LOCAL local_main_at_Main_internal_152 --> -612($fp) +# local_main_at_Main_internal_152 = VCALL local_main_at_Main_internal_151 value +# Save new self pointer in $s1 +lw $s1, -608($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 8($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -612($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# ARG local_main_at_Main_internal_152 +# LOCAL local_main_at_Main_internal_152 --> -612($fp) +lw $t0, -612($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_main_at_Main_internal_148 --> -596($fp) +# LOCAL local_main_at_Main_internal_149 --> -600($fp) +# local_main_at_Main_internal_149 = VCALL local_main_at_Main_internal_148 method7 +# Save new self pointer in $s1 +lw $s1, -596($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 0($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -600($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_main_at_Main_internal_146 --> -588($fp) +# LOCAL local_main_at_Main_internal_149 --> -600($fp) +# Obtain value from -600($fp) +lw $v0, -600($fp) +lw $v0, 12($v0) +sw $v0, -588($fp) +# IF_ZERO local_main_at_Main_internal_146 GOTO label_FALSEIF_421 +# IF_ZERO local_main_at_Main_internal_146 GOTO label_FALSEIF_421 +lw $t0, -588($fp) +beq $t0, 0, label_FALSEIF_421 +# LOCAL local_main_at_Main_internal_156 --> -628($fp) +# local_main_at_Main_internal_156 = SELF +sw $s1, -628($fp) +# LOCAL local_main_at_Main_internal_154 --> -620($fp) +# LOCAL local_main_at_Main_internal_156 --> -628($fp) +# local_main_at_Main_internal_154 = local_main_at_Main_internal_156 +lw $t0, -628($fp) +sw $t0, -620($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_main_at_Main_internal_157 --> -632($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_68 +sw $t0, 12($v0) +li $t0, 7 +sw $t0, 16($v0) +sw $v0, -632($fp) +# ARG local_main_at_Main_internal_157 +# LOCAL local_main_at_Main_internal_157 --> -632($fp) +lw $t0, -632($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_main_at_Main_internal_154 --> -620($fp) +# LOCAL local_main_at_Main_internal_155 --> -624($fp) +# local_main_at_Main_internal_155 = VCALL local_main_at_Main_internal_154 out_string +# Save new self pointer in $s1 +lw $s1, -620($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 88($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -624($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_main_at_Main_internal_160 --> -644($fp) +# local_main_at_Main_internal_160 = SELF +sw $s1, -644($fp) +# LOCAL local_main_at_Main_internal_158 --> -636($fp) +# LOCAL local_main_at_Main_internal_160 --> -644($fp) +# local_main_at_Main_internal_158 = local_main_at_Main_internal_160 +lw $t0, -644($fp) +sw $t0, -636($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# local_main_at_Main_internal_161 = GETATTRIBUTE avar Main +# LOCAL local_main_at_Main_internal_161 --> -648($fp) +lw $t0, 16($s1) +sw $t0, -648($fp) +# ARG local_main_at_Main_internal_161 +# LOCAL local_main_at_Main_internal_161 --> -648($fp) +lw $t0, -648($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_main_at_Main_internal_158 --> -636($fp) +# LOCAL local_main_at_Main_internal_159 --> -640($fp) +# local_main_at_Main_internal_159 = VCALL local_main_at_Main_internal_158 print +# Save new self pointer in $s1 +lw $s1, -636($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 72($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -640($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_main_at_Main_internal_164 --> -660($fp) +# local_main_at_Main_internal_164 = SELF +sw $s1, -660($fp) +# LOCAL local_main_at_Main_internal_162 --> -652($fp) +# LOCAL local_main_at_Main_internal_164 --> -660($fp) +# local_main_at_Main_internal_162 = local_main_at_Main_internal_164 +lw $t0, -660($fp) +sw $t0, -652($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_main_at_Main_internal_165 --> -664($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_69 +sw $t0, 12($v0) +li $t0, 19 +sw $t0, 16($v0) +sw $v0, -664($fp) +# ARG local_main_at_Main_internal_165 +# LOCAL local_main_at_Main_internal_165 --> -664($fp) +lw $t0, -664($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_main_at_Main_internal_162 --> -652($fp) +# LOCAL local_main_at_Main_internal_163 --> -656($fp) +# local_main_at_Main_internal_163 = VCALL local_main_at_Main_internal_162 out_string +# Save new self pointer in $s1 +lw $s1, -652($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 88($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -656($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_main_at_Main_internal_147 --> -592($fp) +# LOCAL local_main_at_Main_internal_163 --> -656($fp) +# local_main_at_Main_internal_147 = local_main_at_Main_internal_163 +lw $t0, -656($fp) +sw $t0, -592($fp) +# GOTO label_ENDIF_422 +j label_ENDIF_422 +label_FALSEIF_421: + # LOCAL local_main_at_Main_internal_168 --> -676($fp) + # local_main_at_Main_internal_168 = SELF + sw $s1, -676($fp) + # LOCAL local_main_at_Main_internal_166 --> -668($fp) + # LOCAL local_main_at_Main_internal_168 --> -676($fp) + # local_main_at_Main_internal_166 = local_main_at_Main_internal_168 + lw $t0, -676($fp) + sw $t0, -668($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_169 --> -680($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_70 + sw $t0, 12($v0) + li $t0, 7 + sw $t0, 16($v0) + sw $v0, -680($fp) + # ARG local_main_at_Main_internal_169 + # LOCAL local_main_at_Main_internal_169 --> -680($fp) + lw $t0, -680($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_main_at_Main_internal_166 --> -668($fp) + # LOCAL local_main_at_Main_internal_167 --> -672($fp) + # local_main_at_Main_internal_167 = VCALL local_main_at_Main_internal_166 out_string + # Save new self pointer in $s1 + lw $s1, -668($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 88($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -672($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_main_at_Main_internal_172 --> -692($fp) + # local_main_at_Main_internal_172 = SELF + sw $s1, -692($fp) + # LOCAL local_main_at_Main_internal_170 --> -684($fp) + # LOCAL local_main_at_Main_internal_172 --> -692($fp) + # local_main_at_Main_internal_170 = local_main_at_Main_internal_172 + lw $t0, -692($fp) + sw $t0, -684($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # local_main_at_Main_internal_173 = GETATTRIBUTE avar Main + # LOCAL local_main_at_Main_internal_173 --> -696($fp) + lw $t0, 16($s1) + sw $t0, -696($fp) + # ARG local_main_at_Main_internal_173 + # LOCAL local_main_at_Main_internal_173 --> -696($fp) + lw $t0, -696($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_main_at_Main_internal_170 --> -684($fp) + # LOCAL local_main_at_Main_internal_171 --> -688($fp) + # local_main_at_Main_internal_171 = VCALL local_main_at_Main_internal_170 print + # Save new self pointer in $s1 + lw $s1, -684($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 72($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -688($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_main_at_Main_internal_176 --> -708($fp) + # local_main_at_Main_internal_176 = SELF + sw $s1, -708($fp) + # LOCAL local_main_at_Main_internal_174 --> -700($fp) + # LOCAL local_main_at_Main_internal_176 --> -708($fp) + # local_main_at_Main_internal_174 = local_main_at_Main_internal_176 + lw $t0, -708($fp) + sw $t0, -700($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_177 --> -712($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_71 + sw $t0, 12($v0) + li $t0, 23 + sw $t0, 16($v0) + sw $v0, -712($fp) + # ARG local_main_at_Main_internal_177 + # LOCAL local_main_at_Main_internal_177 --> -712($fp) + lw $t0, -712($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_main_at_Main_internal_174 --> -700($fp) + # LOCAL local_main_at_Main_internal_175 --> -704($fp) + # local_main_at_Main_internal_175 = VCALL local_main_at_Main_internal_174 out_string + # Save new self pointer in $s1 + lw $s1, -700($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 88($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -704($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_main_at_Main_internal_147 --> -592($fp) + # LOCAL local_main_at_Main_internal_175 --> -704($fp) + # local_main_at_Main_internal_147 = local_main_at_Main_internal_175 + lw $t0, -704($fp) + sw $t0, -592($fp) + label_ENDIF_422: +# LOCAL local_main_at_Main_internal_141 --> -568($fp) +# LOCAL local_main_at_Main_internal_147 --> -592($fp) +# local_main_at_Main_internal_141 = local_main_at_Main_internal_147 +lw $t0, -592($fp) +sw $t0, -568($fp) +# GOTO label_ENDIF_412 +j label_ENDIF_412 +label_FALSEIF_411: + # local_main_at_Main_internal_182 = GETATTRIBUTE char Main + # LOCAL local_main_at_Main_internal_182 --> -732($fp) + lw $t0, 12($s1) + sw $t0, -732($fp) + # LOCAL local_main_at_Main_internal_183 --> -736($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_72 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -736($fp) + # IF_ZERO local_main_at_Main_internal_182 GOTO label_FALSE_425 + # IF_ZERO local_main_at_Main_internal_182 GOTO label_FALSE_425 + lw $t0, -732($fp) + beq $t0, 0, label_FALSE_425 + # IF_ZERO local_main_at_Main_internal_183 GOTO label_FALSE_425 + # IF_ZERO local_main_at_Main_internal_183 GOTO label_FALSE_425 + lw $t0, -736($fp) + beq $t0, 0, label_FALSE_425 + # LOCAL local_main_at_Main_internal_181 --> -728($fp) + # LOCAL local_main_at_Main_internal_182 --> -732($fp) + # Comparing -732($fp) type with String + la $v0, String + lw $a0, -732($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -728($fp) + # IF_ZERO local_main_at_Main_internal_181 GOTO label_COMPARE_STRING_428 + # IF_ZERO local_main_at_Main_internal_181 GOTO label_COMPARE_STRING_428 + lw $t0, -728($fp) + beq $t0, 0, label_COMPARE_STRING_428 + # LOCAL local_main_at_Main_internal_181 --> -728($fp) + # LOCAL local_main_at_Main_internal_182 --> -732($fp) + # Comparing -732($fp) type with Bool + la $v0, Bool + lw $a0, -732($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -728($fp) + # IF_ZERO local_main_at_Main_internal_181 GOTO label_COMPARE_BY_VALUE_429 + # IF_ZERO local_main_at_Main_internal_181 GOTO label_COMPARE_BY_VALUE_429 + lw $t0, -728($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_429 + # LOCAL local_main_at_Main_internal_181 --> -728($fp) + # LOCAL local_main_at_Main_internal_182 --> -732($fp) + # Comparing -732($fp) type with Int + la $v0, Int + lw $a0, -732($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -728($fp) + # IF_ZERO local_main_at_Main_internal_181 GOTO label_COMPARE_BY_VALUE_429 + # IF_ZERO local_main_at_Main_internal_181 GOTO label_COMPARE_BY_VALUE_429 + lw $t0, -728($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_429 + # LOCAL local_main_at_Main_internal_181 --> -728($fp) + # LOCAL local_main_at_Main_internal_182 --> -732($fp) + # LOCAL local_main_at_Main_internal_183 --> -736($fp) + # Load pointers and SUB + lw $a0, -732($fp) + lw $a1, -736($fp) + sub $a0, $a0, $a1 + sw $a0, -728($fp) + # IF_ZERO local_main_at_Main_internal_181 GOTO label_TRUE_426 + # IF_ZERO local_main_at_Main_internal_181 GOTO label_TRUE_426 + lw $t0, -728($fp) + beq $t0, 0, label_TRUE_426 + # GOTO label_FALSE_425 + j label_FALSE_425 + label_COMPARE_BY_VALUE_429: + # LOCAL local_main_at_Main_internal_181 --> -728($fp) + # LOCAL local_main_at_Main_internal_182 --> -732($fp) + # LOCAL local_main_at_Main_internal_183 --> -736($fp) + lw $a0, -732($fp) + lw $a1, -736($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -728($fp) + # IF_ZERO local_main_at_Main_internal_181 GOTO label_TRUE_426 + # IF_ZERO local_main_at_Main_internal_181 GOTO label_TRUE_426 + lw $t0, -728($fp) + beq $t0, 0, label_TRUE_426 + # GOTO label_FALSE_425 + j label_FALSE_425 + label_COMPARE_STRING_428: + # LOCAL local_main_at_Main_internal_181 --> -728($fp) + # LOCAL local_main_at_Main_internal_182 --> -732($fp) + # LOCAL local_main_at_Main_internal_183 --> -736($fp) + # Load strings for comparison + lw $v0, -732($fp) + lw $v1, -736($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -728($fp) + # IF_ZERO local_main_at_Main_internal_181 GOTO label_CONTINUE_430 + # IF_ZERO local_main_at_Main_internal_181 GOTO label_CONTINUE_430 + lw $t0, -728($fp) + beq $t0, 0, label_CONTINUE_430 + # GOTO label_FALSE_425 + j label_FALSE_425 + label_CONTINUE_430: + # LOCAL local_main_at_Main_internal_181 --> -728($fp) + # LOCAL local_main_at_Main_internal_182 --> -732($fp) + # LOCAL local_main_at_Main_internal_183 --> -736($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -732($fp) + lw $v1, -736($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_431: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_432 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_431 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_432: + # Store result + sw $a2, -728($fp) + # IF_ZERO local_main_at_Main_internal_181 GOTO label_TRUE_426 + # IF_ZERO local_main_at_Main_internal_181 GOTO label_TRUE_426 + lw $t0, -728($fp) + beq $t0, 0, label_TRUE_426 + label_FALSE_425: + # LOCAL local_main_at_Main_internal_180 --> -724($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -724($fp) + # GOTO label_END_427 +j label_END_427 +label_TRUE_426: + # LOCAL local_main_at_Main_internal_180 --> -724($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -724($fp) + label_END_427: +# LOCAL local_main_at_Main_internal_178 --> -716($fp) +# LOCAL local_main_at_Main_internal_180 --> -724($fp) +# Obtain value from -724($fp) +lw $v0, -724($fp) +lw $v0, 12($v0) +sw $v0, -716($fp) +# IF_ZERO local_main_at_Main_internal_178 GOTO label_FALSEIF_423 +# IF_ZERO local_main_at_Main_internal_178 GOTO label_FALSEIF_423 +lw $t0, -716($fp) +beq $t0, 0, label_FALSEIF_423 +# LOCAL local_main_at_Main_x_184 --> -740($fp) +# local_main_at_Main_x_184 = 0 +li $t0, 0 +sw $t0, -740($fp) +# LOCAL local_main_at_Main_internal_187 --> -752($fp) +# local_main_at_Main_internal_187 = ALLOCATE E +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type name +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, E +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, E_start +sw $t0, 4($v0) +# Load type offset +li $t0, 36 +sw $t0, 8($v0) +move $t1, $v0 +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +move $s1, $v0 +# Push register t1 into stack +subu $sp, $sp, 4 +sw $t1, 0($sp) +jal __A__attrib__var__init +# Pop 4 bytes from stack into register t1 +lw $t1, 0($sp) +addu $sp, $sp, 4 +sw $v0, 12($t1) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +sw $t1, -752($fp) +# LOCAL local_main_at_Main_internal_185 --> -744($fp) +# LOCAL local_main_at_Main_internal_187 --> -752($fp) +# local_main_at_Main_internal_185 = local_main_at_Main_internal_187 +lw $t0, -752($fp) +sw $t0, -744($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# local_main_at_Main_internal_190 = GETATTRIBUTE avar Main +# LOCAL local_main_at_Main_internal_190 --> -764($fp) +lw $t0, 16($s1) +sw $t0, -764($fp) +# LOCAL local_main_at_Main_internal_188 --> -756($fp) +# LOCAL local_main_at_Main_internal_190 --> -764($fp) +# local_main_at_Main_internal_188 = local_main_at_Main_internal_190 +lw $t0, -764($fp) +sw $t0, -756($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_main_at_Main_internal_188 --> -756($fp) +# LOCAL local_main_at_Main_internal_189 --> -760($fp) +# local_main_at_Main_internal_189 = VCALL local_main_at_Main_internal_188 value +# Save new self pointer in $s1 +lw $s1, -756($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 8($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -760($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# ARG local_main_at_Main_internal_189 +# LOCAL local_main_at_Main_internal_189 --> -760($fp) +lw $t0, -760($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_main_at_Main_internal_185 --> -744($fp) +# LOCAL local_main_at_Main_internal_186 --> -748($fp) +# local_main_at_Main_internal_186 = VCALL local_main_at_Main_internal_185 method6 +# Save new self pointer in $s1 +lw $s1, -744($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 20($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -748($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_main_at_Main_x_184 --> -740($fp) +# LOCAL local_main_at_Main_internal_186 --> -748($fp) +# local_main_at_Main_x_184 = local_main_at_Main_internal_186 +lw $t0, -748($fp) +sw $t0, -740($fp) +# LOCAL local_main_at_Main_r_191 --> -768($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 0 +sw $t0, 12($v0) +sw $v0, -768($fp) +# local_main_at_Main_internal_195 = GETATTRIBUTE avar Main +# LOCAL local_main_at_Main_internal_195 --> -784($fp) +lw $t0, 16($s1) +sw $t0, -784($fp) +# LOCAL local_main_at_Main_internal_193 --> -776($fp) +# LOCAL local_main_at_Main_internal_195 --> -784($fp) +# local_main_at_Main_internal_193 = local_main_at_Main_internal_195 +lw $t0, -784($fp) +sw $t0, -776($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_main_at_Main_internal_193 --> -776($fp) +# LOCAL local_main_at_Main_internal_194 --> -780($fp) +# local_main_at_Main_internal_194 = VCALL local_main_at_Main_internal_193 value +# Save new self pointer in $s1 +lw $s1, -776($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 8($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -780($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_main_at_Main_internal_197 --> -792($fp) +# LOCAL local_main_at_Main_x_184 --> -740($fp) +# local_main_at_Main_internal_197 = local_main_at_Main_x_184 +lw $t0, -740($fp) +sw $t0, -792($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_main_at_Main_internal_197 --> -792($fp) +# LOCAL local_main_at_Main_internal_198 --> -796($fp) +# local_main_at_Main_internal_198 = VCALL local_main_at_Main_internal_197 value +# Save new self pointer in $s1 +lw $s1, -792($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 8($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -796($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_main_at_Main_internal_199 --> -800($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 8 +sw $t0, 12($v0) +sw $v0, -800($fp) +# LOCAL local_main_at_Main_internal_196 --> -788($fp) +# LOCAL local_main_at_Main_internal_198 --> -796($fp) +# LOCAL local_main_at_Main_internal_199 --> -800($fp) +# local_main_at_Main_internal_196 = local_main_at_Main_internal_198 * local_main_at_Main_internal_199 +lw $t1, -796($fp) +lw $t0, 12($t1) +lw $t1, -800($fp) +lw $t2, 12($t1) +mul $t0, $t0, $t2 +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t1, String +sw $t1, 0($v0) +la $t1, String_start +sw $t1, 4($v0) +# Load type offset +li $t1, 8 +sw $t1, 8($v0) +la $t1, Int +sw $t1, 12($v0) +li $t1, 3 +sw $t1, 16($v0) +move $t1, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t1, 0($v0) +la $t1, Int_start +sw $t1, 4($v0) +# Load type offset +li $t1, 16 +sw $t1, 8($v0) +sw $t0, 12($v0) +sw $v0, -788($fp) +# LOCAL local_main_at_Main_internal_192 --> -772($fp) +# LOCAL local_main_at_Main_internal_194 --> -780($fp) +# LOCAL local_main_at_Main_internal_196 --> -788($fp) +# local_main_at_Main_internal_192 = local_main_at_Main_internal_194 - local_main_at_Main_internal_196 +lw $t1, -780($fp) +lw $t0, 12($t1) +lw $t1, -788($fp) +lw $t2, 12($t1) +sub $t0, $t0, $t2 +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t1, String +sw $t1, 0($v0) +la $t1, String_start +sw $t1, 4($v0) +# Load type offset +li $t1, 8 +sw $t1, 8($v0) +la $t1, Int +sw $t1, 12($v0) +li $t1, 3 +sw $t1, 16($v0) +move $t1, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t1, 0($v0) +la $t1, Int_start +sw $t1, 4($v0) +# Load type offset +li $t1, 16 +sw $t1, 8($v0) +sw $t0, 12($v0) +sw $v0, -772($fp) +# LOCAL local_main_at_Main_r_191 --> -768($fp) +# LOCAL local_main_at_Main_internal_192 --> -772($fp) +# local_main_at_Main_r_191 = local_main_at_Main_internal_192 +lw $t0, -772($fp) +sw $t0, -768($fp) +# LOCAL local_main_at_Main_internal_202 --> -812($fp) +# local_main_at_Main_internal_202 = SELF +sw $s1, -812($fp) +# LOCAL local_main_at_Main_internal_200 --> -804($fp) +# LOCAL local_main_at_Main_internal_202 --> -812($fp) +# local_main_at_Main_internal_200 = local_main_at_Main_internal_202 +lw $t0, -812($fp) +sw $t0, -804($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_main_at_Main_internal_203 --> -816($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_73 +sw $t0, 12($v0) +li $t0, 7 +sw $t0, 16($v0) +sw $v0, -816($fp) +# ARG local_main_at_Main_internal_203 +# LOCAL local_main_at_Main_internal_203 --> -816($fp) +lw $t0, -816($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_main_at_Main_internal_200 --> -804($fp) +# LOCAL local_main_at_Main_internal_201 --> -808($fp) +# local_main_at_Main_internal_201 = VCALL local_main_at_Main_internal_200 out_string +# Save new self pointer in $s1 +lw $s1, -804($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 88($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -808($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_main_at_Main_internal_206 --> -828($fp) +# local_main_at_Main_internal_206 = SELF +sw $s1, -828($fp) +# LOCAL local_main_at_Main_internal_204 --> -820($fp) +# LOCAL local_main_at_Main_internal_206 --> -828($fp) +# local_main_at_Main_internal_204 = local_main_at_Main_internal_206 +lw $t0, -828($fp) +sw $t0, -820($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# local_main_at_Main_internal_207 = GETATTRIBUTE avar Main +# LOCAL local_main_at_Main_internal_207 --> -832($fp) +lw $t0, 16($s1) +sw $t0, -832($fp) +# ARG local_main_at_Main_internal_207 +# LOCAL local_main_at_Main_internal_207 --> -832($fp) +lw $t0, -832($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_main_at_Main_internal_204 --> -820($fp) +# LOCAL local_main_at_Main_internal_205 --> -824($fp) +# local_main_at_Main_internal_205 = VCALL local_main_at_Main_internal_204 print +# Save new self pointer in $s1 +lw $s1, -820($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 72($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -824($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_main_at_Main_internal_210 --> -844($fp) +# local_main_at_Main_internal_210 = SELF +sw $s1, -844($fp) +# LOCAL local_main_at_Main_internal_208 --> -836($fp) +# LOCAL local_main_at_Main_internal_210 --> -844($fp) +# local_main_at_Main_internal_208 = local_main_at_Main_internal_210 +lw $t0, -844($fp) +sw $t0, -836($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_main_at_Main_internal_211 --> -848($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_74 +sw $t0, 12($v0) +li $t0, 12 +sw $t0, 16($v0) +sw $v0, -848($fp) +# ARG local_main_at_Main_internal_211 +# LOCAL local_main_at_Main_internal_211 --> -848($fp) +lw $t0, -848($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_main_at_Main_internal_208 --> -836($fp) +# LOCAL local_main_at_Main_internal_209 --> -840($fp) +# local_main_at_Main_internal_209 = VCALL local_main_at_Main_internal_208 out_string +# Save new self pointer in $s1 +lw $s1, -836($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 88($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -840($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_main_at_Main_internal_214 --> -860($fp) +# local_main_at_Main_internal_214 = SELF +sw $s1, -860($fp) +# LOCAL local_main_at_Main_internal_212 --> -852($fp) +# LOCAL local_main_at_Main_internal_214 --> -860($fp) +# local_main_at_Main_internal_212 = local_main_at_Main_internal_214 +lw $t0, -860($fp) +sw $t0, -852($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# ARG local_main_at_Main_x_184 +# LOCAL local_main_at_Main_x_184 --> -740($fp) +lw $t0, -740($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_main_at_Main_internal_212 --> -852($fp) +# LOCAL local_main_at_Main_internal_213 --> -856($fp) +# local_main_at_Main_internal_213 = VCALL local_main_at_Main_internal_212 print +# Save new self pointer in $s1 +lw $s1, -852($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 72($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -856($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_main_at_Main_internal_217 --> -872($fp) +# local_main_at_Main_internal_217 = SELF +sw $s1, -872($fp) +# LOCAL local_main_at_Main_internal_215 --> -864($fp) +# LOCAL local_main_at_Main_internal_217 --> -872($fp) +# local_main_at_Main_internal_215 = local_main_at_Main_internal_217 +lw $t0, -872($fp) +sw $t0, -864($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_main_at_Main_internal_218 --> -876($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_75 +sw $t0, 12($v0) +li $t0, 28 +sw $t0, 16($v0) +sw $v0, -876($fp) +# ARG local_main_at_Main_internal_218 +# LOCAL local_main_at_Main_internal_218 --> -876($fp) +lw $t0, -876($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_main_at_Main_internal_215 --> -864($fp) +# LOCAL local_main_at_Main_internal_216 --> -868($fp) +# local_main_at_Main_internal_216 = VCALL local_main_at_Main_internal_215 out_string +# Save new self pointer in $s1 +lw $s1, -864($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 88($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -868($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_main_at_Main_a_219 --> -880($fp) +# local_main_at_Main_a_219 = 0 +li $t0, 0 +sw $t0, -880($fp) +# LOCAL local_main_at_Main_internal_220 --> -884($fp) +# local_main_at_Main_internal_220 = ALLOCATE A2I +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type name +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, A2I +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 12 bytes of memory +li $a0, 12 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, A2I_start +sw $t0, 4($v0) +# Load type offset +li $t0, 20 +sw $t0, 8($v0) +move $t1, $v0 +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +move $s1, $v0 +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +sw $t1, -884($fp) +# LOCAL local_main_at_Main_a_219 --> -880($fp) +# LOCAL local_main_at_Main_internal_220 --> -884($fp) +# local_main_at_Main_a_219 = local_main_at_Main_internal_220 +lw $t0, -884($fp) +sw $t0, -880($fp) +# LOCAL local_main_at_Main_internal_223 --> -896($fp) +# local_main_at_Main_internal_223 = SELF +sw $s1, -896($fp) +# LOCAL local_main_at_Main_internal_221 --> -888($fp) +# LOCAL local_main_at_Main_internal_223 --> -896($fp) +# local_main_at_Main_internal_221 = local_main_at_Main_internal_223 +lw $t0, -896($fp) +sw $t0, -888($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_main_at_Main_internal_224 --> -900($fp) +# LOCAL local_main_at_Main_a_219 --> -880($fp) +# local_main_at_Main_internal_224 = local_main_at_Main_a_219 +lw $t0, -880($fp) +sw $t0, -900($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# ARG local_main_at_Main_r_191 +# LOCAL local_main_at_Main_r_191 --> -768($fp) +lw $t0, -768($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_main_at_Main_internal_224 --> -900($fp) +# LOCAL local_main_at_Main_internal_225 --> -904($fp) +# local_main_at_Main_internal_225 = VCALL local_main_at_Main_internal_224 i2a +# Save new self pointer in $s1 +lw $s1, -900($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 100($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -904($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# ARG local_main_at_Main_internal_225 +# LOCAL local_main_at_Main_internal_225 --> -904($fp) +lw $t0, -904($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_main_at_Main_internal_221 --> -888($fp) +# LOCAL local_main_at_Main_internal_222 --> -892($fp) +# local_main_at_Main_internal_222 = VCALL local_main_at_Main_internal_221 out_string +# Save new self pointer in $s1 +lw $s1, -888($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 88($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -892($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_main_at_Main_internal_228 --> -916($fp) +# local_main_at_Main_internal_228 = SELF +sw $s1, -916($fp) +# LOCAL local_main_at_Main_internal_226 --> -908($fp) +# LOCAL local_main_at_Main_internal_228 --> -916($fp) +# local_main_at_Main_internal_226 = local_main_at_Main_internal_228 +lw $t0, -916($fp) +sw $t0, -908($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_main_at_Main_internal_229 --> -920($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_76 +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +sw $v0, -920($fp) +# ARG local_main_at_Main_internal_229 +# LOCAL local_main_at_Main_internal_229 --> -920($fp) +lw $t0, -920($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_main_at_Main_internal_226 --> -908($fp) +# LOCAL local_main_at_Main_internal_227 --> -912($fp) +# local_main_at_Main_internal_227 = VCALL local_main_at_Main_internal_226 out_string +# Save new self pointer in $s1 +lw $s1, -908($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 88($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -912($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# +# LOCAL local_main_at_Main_x_184 --> -740($fp) +lw $t0, -740($fp) +sw $t0, 16($s1) +# LOCAL local_main_at_Main_internal_179 --> -720($fp) +# local_main_at_Main_internal_179 = +# GOTO label_ENDIF_424 +j label_ENDIF_424 +label_FALSEIF_423: + # local_main_at_Main_internal_234 = GETATTRIBUTE char Main + # LOCAL local_main_at_Main_internal_234 --> -940($fp) + lw $t0, 12($s1) + sw $t0, -940($fp) + # LOCAL local_main_at_Main_internal_235 --> -944($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_77 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -944($fp) + # IF_ZERO local_main_at_Main_internal_234 GOTO label_FALSE_435 + # IF_ZERO local_main_at_Main_internal_234 GOTO label_FALSE_435 + lw $t0, -940($fp) + beq $t0, 0, label_FALSE_435 + # IF_ZERO local_main_at_Main_internal_235 GOTO label_FALSE_435 + # IF_ZERO local_main_at_Main_internal_235 GOTO label_FALSE_435 + lw $t0, -944($fp) + beq $t0, 0, label_FALSE_435 + # LOCAL local_main_at_Main_internal_233 --> -936($fp) + # LOCAL local_main_at_Main_internal_234 --> -940($fp) + # Comparing -940($fp) type with String + la $v0, String + lw $a0, -940($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -936($fp) + # IF_ZERO local_main_at_Main_internal_233 GOTO label_COMPARE_STRING_438 + # IF_ZERO local_main_at_Main_internal_233 GOTO label_COMPARE_STRING_438 + lw $t0, -936($fp) + beq $t0, 0, label_COMPARE_STRING_438 + # LOCAL local_main_at_Main_internal_233 --> -936($fp) + # LOCAL local_main_at_Main_internal_234 --> -940($fp) + # Comparing -940($fp) type with Bool + la $v0, Bool + lw $a0, -940($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -936($fp) + # IF_ZERO local_main_at_Main_internal_233 GOTO label_COMPARE_BY_VALUE_439 + # IF_ZERO local_main_at_Main_internal_233 GOTO label_COMPARE_BY_VALUE_439 + lw $t0, -936($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_439 + # LOCAL local_main_at_Main_internal_233 --> -936($fp) + # LOCAL local_main_at_Main_internal_234 --> -940($fp) + # Comparing -940($fp) type with Int + la $v0, Int + lw $a0, -940($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -936($fp) + # IF_ZERO local_main_at_Main_internal_233 GOTO label_COMPARE_BY_VALUE_439 + # IF_ZERO local_main_at_Main_internal_233 GOTO label_COMPARE_BY_VALUE_439 + lw $t0, -936($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_439 + # LOCAL local_main_at_Main_internal_233 --> -936($fp) + # LOCAL local_main_at_Main_internal_234 --> -940($fp) + # LOCAL local_main_at_Main_internal_235 --> -944($fp) + # Load pointers and SUB + lw $a0, -940($fp) + lw $a1, -944($fp) + sub $a0, $a0, $a1 + sw $a0, -936($fp) + # IF_ZERO local_main_at_Main_internal_233 GOTO label_TRUE_436 + # IF_ZERO local_main_at_Main_internal_233 GOTO label_TRUE_436 + lw $t0, -936($fp) + beq $t0, 0, label_TRUE_436 + # GOTO label_FALSE_435 + j label_FALSE_435 + label_COMPARE_BY_VALUE_439: + # LOCAL local_main_at_Main_internal_233 --> -936($fp) + # LOCAL local_main_at_Main_internal_234 --> -940($fp) + # LOCAL local_main_at_Main_internal_235 --> -944($fp) + lw $a0, -940($fp) + lw $a1, -944($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -936($fp) + # IF_ZERO local_main_at_Main_internal_233 GOTO label_TRUE_436 + # IF_ZERO local_main_at_Main_internal_233 GOTO label_TRUE_436 + lw $t0, -936($fp) + beq $t0, 0, label_TRUE_436 + # GOTO label_FALSE_435 + j label_FALSE_435 + label_COMPARE_STRING_438: + # LOCAL local_main_at_Main_internal_233 --> -936($fp) + # LOCAL local_main_at_Main_internal_234 --> -940($fp) + # LOCAL local_main_at_Main_internal_235 --> -944($fp) + # Load strings for comparison + lw $v0, -940($fp) + lw $v1, -944($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -936($fp) + # IF_ZERO local_main_at_Main_internal_233 GOTO label_CONTINUE_440 + # IF_ZERO local_main_at_Main_internal_233 GOTO label_CONTINUE_440 + lw $t0, -936($fp) + beq $t0, 0, label_CONTINUE_440 + # GOTO label_FALSE_435 + j label_FALSE_435 + label_CONTINUE_440: + # LOCAL local_main_at_Main_internal_233 --> -936($fp) + # LOCAL local_main_at_Main_internal_234 --> -940($fp) + # LOCAL local_main_at_Main_internal_235 --> -944($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -940($fp) + lw $v1, -944($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_441: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_442 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_441 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_442: + # Store result + sw $a2, -936($fp) + # IF_ZERO local_main_at_Main_internal_233 GOTO label_TRUE_436 + # IF_ZERO local_main_at_Main_internal_233 GOTO label_TRUE_436 + lw $t0, -936($fp) + beq $t0, 0, label_TRUE_436 + label_FALSE_435: + # LOCAL local_main_at_Main_internal_232 --> -932($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -932($fp) + # GOTO label_END_437 +j label_END_437 +label_TRUE_436: + # LOCAL local_main_at_Main_internal_232 --> -932($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -932($fp) + label_END_437: +# LOCAL local_main_at_Main_internal_230 --> -924($fp) +# LOCAL local_main_at_Main_internal_232 --> -932($fp) +# Obtain value from -932($fp) +lw $v0, -932($fp) +lw $v0, 12($v0) +sw $v0, -924($fp) +# IF_ZERO local_main_at_Main_internal_230 GOTO label_FALSEIF_433 +# IF_ZERO local_main_at_Main_internal_230 GOTO label_FALSEIF_433 +lw $t0, -924($fp) +beq $t0, 0, label_FALSEIF_433 +# LOCAL local_main_at_Main_internal_236 --> -948($fp) +# local_main_at_Main_internal_236 = ALLOCATE A +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type name +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, A +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, A_start +sw $t0, 4($v0) +# Load type offset +li $t0, 24 +sw $t0, 8($v0) +move $t1, $v0 +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +move $s1, $v0 +# Push register t1 into stack +subu $sp, $sp, 4 +sw $t1, 0($sp) +jal __A__attrib__var__init +# Pop 4 bytes from stack into register t1 +lw $t1, 0($sp) +addu $sp, $sp, 4 +sw $v0, 12($t1) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +sw $t1, -948($fp) +# +# LOCAL local_main_at_Main_internal_236 --> -948($fp) +lw $t0, -948($fp) +sw $t0, 16($s1) +# LOCAL local_main_at_Main_internal_231 --> -928($fp) +# local_main_at_Main_internal_231 = +# GOTO label_ENDIF_434 +j label_ENDIF_434 +label_FALSEIF_433: + # local_main_at_Main_internal_241 = GETATTRIBUTE char Main + # LOCAL local_main_at_Main_internal_241 --> -968($fp) + lw $t0, 12($s1) + sw $t0, -968($fp) + # LOCAL local_main_at_Main_internal_242 --> -972($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_78 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -972($fp) + # IF_ZERO local_main_at_Main_internal_241 GOTO label_FALSE_445 + # IF_ZERO local_main_at_Main_internal_241 GOTO label_FALSE_445 + lw $t0, -968($fp) + beq $t0, 0, label_FALSE_445 + # IF_ZERO local_main_at_Main_internal_242 GOTO label_FALSE_445 + # IF_ZERO local_main_at_Main_internal_242 GOTO label_FALSE_445 + lw $t0, -972($fp) + beq $t0, 0, label_FALSE_445 + # LOCAL local_main_at_Main_internal_240 --> -964($fp) + # LOCAL local_main_at_Main_internal_241 --> -968($fp) + # Comparing -968($fp) type with String + la $v0, String + lw $a0, -968($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -964($fp) + # IF_ZERO local_main_at_Main_internal_240 GOTO label_COMPARE_STRING_448 + # IF_ZERO local_main_at_Main_internal_240 GOTO label_COMPARE_STRING_448 + lw $t0, -964($fp) + beq $t0, 0, label_COMPARE_STRING_448 + # LOCAL local_main_at_Main_internal_240 --> -964($fp) + # LOCAL local_main_at_Main_internal_241 --> -968($fp) + # Comparing -968($fp) type with Bool + la $v0, Bool + lw $a0, -968($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -964($fp) + # IF_ZERO local_main_at_Main_internal_240 GOTO label_COMPARE_BY_VALUE_449 + # IF_ZERO local_main_at_Main_internal_240 GOTO label_COMPARE_BY_VALUE_449 + lw $t0, -964($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_449 + # LOCAL local_main_at_Main_internal_240 --> -964($fp) + # LOCAL local_main_at_Main_internal_241 --> -968($fp) + # Comparing -968($fp) type with Int + la $v0, Int + lw $a0, -968($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -964($fp) + # IF_ZERO local_main_at_Main_internal_240 GOTO label_COMPARE_BY_VALUE_449 + # IF_ZERO local_main_at_Main_internal_240 GOTO label_COMPARE_BY_VALUE_449 + lw $t0, -964($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_449 + # LOCAL local_main_at_Main_internal_240 --> -964($fp) + # LOCAL local_main_at_Main_internal_241 --> -968($fp) + # LOCAL local_main_at_Main_internal_242 --> -972($fp) + # Load pointers and SUB + lw $a0, -968($fp) + lw $a1, -972($fp) + sub $a0, $a0, $a1 + sw $a0, -964($fp) + # IF_ZERO local_main_at_Main_internal_240 GOTO label_TRUE_446 + # IF_ZERO local_main_at_Main_internal_240 GOTO label_TRUE_446 + lw $t0, -964($fp) + beq $t0, 0, label_TRUE_446 + # GOTO label_FALSE_445 + j label_FALSE_445 + label_COMPARE_BY_VALUE_449: + # LOCAL local_main_at_Main_internal_240 --> -964($fp) + # LOCAL local_main_at_Main_internal_241 --> -968($fp) + # LOCAL local_main_at_Main_internal_242 --> -972($fp) + lw $a0, -968($fp) + lw $a1, -972($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -964($fp) + # IF_ZERO local_main_at_Main_internal_240 GOTO label_TRUE_446 + # IF_ZERO local_main_at_Main_internal_240 GOTO label_TRUE_446 + lw $t0, -964($fp) + beq $t0, 0, label_TRUE_446 + # GOTO label_FALSE_445 + j label_FALSE_445 + label_COMPARE_STRING_448: + # LOCAL local_main_at_Main_internal_240 --> -964($fp) + # LOCAL local_main_at_Main_internal_241 --> -968($fp) + # LOCAL local_main_at_Main_internal_242 --> -972($fp) + # Load strings for comparison + lw $v0, -968($fp) + lw $v1, -972($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -964($fp) + # IF_ZERO local_main_at_Main_internal_240 GOTO label_CONTINUE_450 + # IF_ZERO local_main_at_Main_internal_240 GOTO label_CONTINUE_450 + lw $t0, -964($fp) + beq $t0, 0, label_CONTINUE_450 + # GOTO label_FALSE_445 + j label_FALSE_445 + label_CONTINUE_450: + # LOCAL local_main_at_Main_internal_240 --> -964($fp) + # LOCAL local_main_at_Main_internal_241 --> -968($fp) + # LOCAL local_main_at_Main_internal_242 --> -972($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -968($fp) + lw $v1, -972($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_451: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_452 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_451 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_452: + # Store result + sw $a2, -964($fp) + # IF_ZERO local_main_at_Main_internal_240 GOTO label_TRUE_446 + # IF_ZERO local_main_at_Main_internal_240 GOTO label_TRUE_446 + lw $t0, -964($fp) + beq $t0, 0, label_TRUE_446 + label_FALSE_445: + # LOCAL local_main_at_Main_internal_239 --> -960($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -960($fp) + # GOTO label_END_447 +j label_END_447 +label_TRUE_446: + # LOCAL local_main_at_Main_internal_239 --> -960($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -960($fp) + label_END_447: +# LOCAL local_main_at_Main_internal_237 --> -952($fp) +# LOCAL local_main_at_Main_internal_239 --> -960($fp) +# Obtain value from -960($fp) +lw $v0, -960($fp) +lw $v0, 12($v0) +sw $v0, -952($fp) +# IF_ZERO local_main_at_Main_internal_237 GOTO label_FALSEIF_443 +# IF_ZERO local_main_at_Main_internal_237 GOTO label_FALSEIF_443 +lw $t0, -952($fp) +beq $t0, 0, label_FALSEIF_443 +# LOCAL local_main_at_Main_internal_243 --> -976($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Bool +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Bool +sw $t0, 12($v0) +li $t0, 4 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Bool_start +sw $t0, 4($v0) +# Load type offset +li $t0, 12 +sw $t0, 8($v0) +li $t0, 0 +sw $t0, 12($v0) +sw $v0, -976($fp) +# +# LOCAL local_main_at_Main_internal_243 --> -976($fp) +lw $t0, -976($fp) +sw $t0, 24($s1) +# LOCAL local_main_at_Main_internal_238 --> -956($fp) +# local_main_at_Main_internal_238 = +# GOTO label_ENDIF_444 +j label_ENDIF_444 +label_FALSEIF_443: + # LOCAL local_main_at_Main_internal_246 --> -988($fp) + # local_main_at_Main_internal_246 = ALLOCATE A + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, A + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, A_start + sw $t0, 4($v0) + # Load type offset + li $t0, 24 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __A__attrib__var__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 12($t1) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -988($fp) + # LOCAL local_main_at_Main_internal_244 --> -980($fp) + # LOCAL local_main_at_Main_internal_246 --> -988($fp) + # local_main_at_Main_internal_244 = local_main_at_Main_internal_246 + lw $t0, -988($fp) + sw $t0, -980($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # local_main_at_Main_internal_249 = GETATTRIBUTE avar Main + # LOCAL local_main_at_Main_internal_249 --> -1000($fp) + lw $t0, 16($s1) + sw $t0, -1000($fp) + # LOCAL local_main_at_Main_internal_247 --> -992($fp) + # LOCAL local_main_at_Main_internal_249 --> -1000($fp) + # local_main_at_Main_internal_247 = local_main_at_Main_internal_249 + lw $t0, -1000($fp) + sw $t0, -992($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_247 --> -992($fp) + # LOCAL local_main_at_Main_internal_248 --> -996($fp) + # local_main_at_Main_internal_248 = VCALL local_main_at_Main_internal_247 value + # Save new self pointer in $s1 + lw $s1, -992($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 8($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -996($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # ARG local_main_at_Main_internal_248 + # LOCAL local_main_at_Main_internal_248 --> -996($fp) + lw $t0, -996($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_main_at_Main_internal_244 --> -980($fp) + # LOCAL local_main_at_Main_internal_245 --> -984($fp) + # local_main_at_Main_internal_245 = VCALL local_main_at_Main_internal_244 method1 + # Save new self pointer in $s1 + lw $s1, -980($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 48($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -984($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # + # LOCAL local_main_at_Main_internal_245 --> -984($fp) + lw $t0, -984($fp) + sw $t0, 16($s1) + # LOCAL local_main_at_Main_internal_238 --> -956($fp) + # local_main_at_Main_internal_238 = + label_ENDIF_444: +# LOCAL local_main_at_Main_internal_231 --> -928($fp) +# LOCAL local_main_at_Main_internal_238 --> -956($fp) +# local_main_at_Main_internal_231 = local_main_at_Main_internal_238 +lw $t0, -956($fp) +sw $t0, -928($fp) +label_ENDIF_434: +# LOCAL local_main_at_Main_internal_179 --> -720($fp) +# LOCAL local_main_at_Main_internal_231 --> -928($fp) +# local_main_at_Main_internal_179 = local_main_at_Main_internal_231 +lw $t0, -928($fp) +sw $t0, -720($fp) +label_ENDIF_424: +# LOCAL local_main_at_Main_internal_141 --> -568($fp) +# LOCAL local_main_at_Main_internal_179 --> -720($fp) +# local_main_at_Main_internal_141 = local_main_at_Main_internal_179 +lw $t0, -720($fp) +sw $t0, -568($fp) +label_ENDIF_412: +# LOCAL local_main_at_Main_internal_130 --> -524($fp) +# LOCAL local_main_at_Main_internal_141 --> -568($fp) +# local_main_at_Main_internal_130 = local_main_at_Main_internal_141 +lw $t0, -568($fp) +sw $t0, -524($fp) +label_ENDIF_402: +# LOCAL local_main_at_Main_internal_119 --> -480($fp) +# LOCAL local_main_at_Main_internal_130 --> -524($fp) +# local_main_at_Main_internal_119 = local_main_at_Main_internal_130 +lw $t0, -524($fp) +sw $t0, -480($fp) +label_ENDIF_392: +# LOCAL local_main_at_Main_internal_108 --> -436($fp) +# LOCAL local_main_at_Main_internal_119 --> -480($fp) +# local_main_at_Main_internal_108 = local_main_at_Main_internal_119 +lw $t0, -480($fp) +sw $t0, -436($fp) +label_ENDIF_382: +# LOCAL local_main_at_Main_internal_87 --> -352($fp) +# LOCAL local_main_at_Main_internal_108 --> -436($fp) +# local_main_at_Main_internal_87 = local_main_at_Main_internal_108 +lw $t0, -436($fp) +sw $t0, -352($fp) +label_ENDIF_372: +# LOCAL local_main_at_Main_internal_56 --> -228($fp) +# LOCAL local_main_at_Main_internal_87 --> -352($fp) +# local_main_at_Main_internal_56 = local_main_at_Main_internal_87 +lw $t0, -352($fp) +sw $t0, -228($fp) +label_ENDIF_354: +# LOCAL local_main_at_Main_internal_35 --> -144($fp) +# LOCAL local_main_at_Main_internal_56 --> -228($fp) +# local_main_at_Main_internal_35 = local_main_at_Main_internal_56 +lw $t0, -228($fp) +sw $t0, -144($fp) +label_ENDIF_344: +# GOTO label_WHILE_339 +j label_WHILE_339 +label_WHILE_END_340: + # RETURN + # Deallocate stack frame for function function_main_at_Main. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 1008 + jr $ra + # Function END + diff --git a/tests/codegen/atoi.mips b/tests/codegen/atoi.mips new file mode 100644 index 00000000..60af7ab2 --- /dev/null +++ b/tests/codegen/atoi.mips @@ -0,0 +1,10089 @@ + +# Code generated by PyCoolc. +# Eliane Puerta, Liset Alfaro, Adrian Gonzalez --- Mon Dec 14 11:08:40 2020 +# School of Math and Computer Science, University of Havana +# + +.data +dummy: .word 0 +IO: .asciiz "IO" +# Function END +Object: .asciiz "Object" +# Function END +String: .asciiz "String" +# Function END +Bool: .asciiz "Bool" +# Function END +Int: .asciiz "Int" +# Function END +A2I: .asciiz "A2I" +# Function END +Main: .asciiz "Main" +# Function END +# + + +# **** VTABLE for type IO **** +IO_vtable: .word dummy, function_out_string_at_IO, dummy, dummy, dummy, function_copy_at_Object, function_out_int_at_IO, function_abort_at_Object, dummy, dummy, dummy, function_in_string_at_IO, dummy, dummy, function_type_name_at_Object, dummy, function_in_int_at_IO +# Function END +# + + +# **** Type RECORD for type IO **** +IO_start: + IO_vtable_pointer: .word IO_vtable + # Function END +IO_end: +# + + +# **** VTABLE for type Object **** +Object_vtable: .word dummy, dummy, dummy, dummy, dummy, function_copy_at_Object, dummy, function_abort_at_Object, dummy, dummy, dummy, dummy, dummy, dummy, function_type_name_at_Object, dummy, dummy +# Function END +# + + +# **** Type RECORD for type Object **** +Object_start: + Object_vtable_pointer: .word Object_vtable + # Function END +Object_end: +# + + +# **** VTABLE for type String **** +String_vtable: .word function_length_at_String, dummy, function_substr_at_String, dummy, dummy, function_copy_at_Object, dummy, function_abort_at_Object, dummy, function_concat_at_String, dummy, dummy, dummy, dummy, function_type_name_at_Object, dummy, dummy +# Function END +# + + +# **** Type RECORD for type String **** +String_start: + String_vtable_pointer: .word String_vtable + # Function END +String_end: +# + + +# **** VTABLE for type Bool **** +Bool_vtable: .word dummy, dummy, dummy, dummy, dummy, function_copy_at_Object, dummy, function_abort_at_Object, dummy, dummy, dummy, dummy, dummy, dummy, function_type_name_at_Object, dummy, dummy +# Function END +# + + +# **** Type RECORD for type Bool **** +Bool_start: + Bool_vtable_pointer: .word Bool_vtable + # Function END +Bool_end: +# + + +# **** VTABLE for type Int **** +Int_vtable: .word dummy, dummy, dummy, dummy, dummy, function_copy_at_Object, dummy, function_abort_at_Object, dummy, dummy, dummy, dummy, dummy, dummy, function_type_name_at_Object, dummy, dummy +# Function END +# + + +# **** Type RECORD for type Int **** +Int_start: + Int_vtable_pointer: .word Int_vtable + # Function END +Int_end: +# + + +# **** VTABLE for type A2I **** +A2I_vtable: .word dummy, dummy, dummy, function_c2i_at_A2I, dummy, function_copy_at_Object, dummy, function_abort_at_Object, function_a2i_aux_at_A2I, dummy, function_i2a_aux_at_A2I, dummy, function_i2a_at_A2I, function_a2i_at_A2I, function_type_name_at_Object, function_i2c_at_A2I, dummy +# Function END +# + + +# **** Type RECORD for type A2I **** +A2I_start: + A2I_vtable_pointer: .word A2I_vtable + # Function END +A2I_end: +# + + +# **** VTABLE for type Main **** +Main_vtable: .word dummy, function_out_string_at_IO, dummy, dummy, function_main_at_Main, function_copy_at_Object, function_out_int_at_IO, function_abort_at_Object, dummy, dummy, dummy, function_in_string_at_IO, dummy, dummy, function_type_name_at_Object, dummy, function_in_int_at_IO +# Function END +# + + +# **** Type RECORD for type Main **** +Main_start: + Main_vtable_pointer: .word Main_vtable + # Function END +Main_end: +# + + +data_0: .asciiz "" +# + + +data_1: .asciiz "Abort called from class " +# + + +data_2: .asciiz "\n" +# + + +IO__TDT: .word 0, -1, -1, -1, -1, -1, 1 +Object__TDT: .word 1, 0, 1, 1, 1, 1, 2 +String__TDT: .word -1, -1, 0, -1, -1, -1, -1 +Bool__TDT: .word -1, -1, -1, 0, -1, -1, -1 +Int__TDT: .word -1, -1, -1, -1, 0, -1, -1 +A2I__TDT: .word -1, -1, -1, -1, -1, 0, -1 +Main__TDT: .word -1, -1, -1, -1, -1, -1, 0 +# + + +data_4: .asciiz "0" +# + + +data_5: .asciiz "1" +# + + +data_6: .asciiz "2" +# + + +data_7: .asciiz "3" +# + + +data_8: .asciiz "4" +# + + +data_9: .asciiz "5" +# + + +data_10: .asciiz "6" +# + + +data_11: .asciiz "7" +# + + +data_12: .asciiz "8" +# + + +data_13: .asciiz "9" +# + + +data_14: .asciiz "0" +# + + +data_15: .asciiz "1" +# + + +data_16: .asciiz "2" +# + + +data_17: .asciiz "3" +# + + +data_18: .asciiz "4" +# + + +data_19: .asciiz "5" +# + + +data_20: .asciiz "6" +# + + +data_21: .asciiz "7" +# + + +data_22: .asciiz "8" +# + + +data_23: .asciiz "9" +# + + +data_24: .asciiz "" +# + + +data_25: .asciiz "-" +# + + +data_26: .asciiz "+" +# + + +data_27: .asciiz "0" +# + + +data_28: .asciiz "-" +# + + +data_29: .asciiz "" +# + + +data_30: .asciiz "678987" +# + + +data_31: .asciiz " == " +# + + +data_32: .asciiz "\n" +# + + +.text +main: + jal entry + # syscall code 10 is for exit + li $v0, 10 + syscall + # Function END + +# function_in_string_at_IO implementation. +# @Params: +function_in_string_at_IO: + # Allocate stack frame for function function_in_string_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_in_string_at_IO_internal_0 --> -4($fp) + # Allocating 1024 bytes of memory + li $a0, 1024 + li $v0, 9 + syscall + move $t0, $v0 + move $a0, $v0 + li $a1, 1024 + li $v0, 8 + syscall + move $t2, $zero + move $t3, $zero + move $t1, $t0 + lb $t3, 0($t1) + beqz $t3, end_loop + read_length_loop: + lb $t3, 0($t1) + beqz $t3, end_read_length_loop + addu $t1, $t1, 1 + addu $t2, $t2, 1 + j read_length_loop + end_read_length_loop: + subu $t1, $t1, 1 + sb $zero, 0($t1) + subu $t2, $t2, 1 + end_loop: + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $t2, 16($v0) + sw $v0, -4($fp) + # RETURN local_in_string_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_in_string_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_out_int_at_IO implementation. +# @Params: +# 0($fp) = param_out_int_at_IO_x_0 +function_out_int_at_IO: + # Allocate stack frame for function function_out_int_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # PRINT_INT param_out_int_at_IO_x_0 + # PARAM param_out_int_at_IO_x_0 --> 0($fp) + lw $v0, 0($fp) + lw $a0, 12($v0) + li $v0, 1 + syscall + # LOCAL local_out_int_at_IO_internal_0 --> -4($fp) + # local_out_int_at_IO_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_out_int_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_out_int_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_out_string_at_IO implementation. +# @Params: +# 0($fp) = param_out_string_at_IO_x_0 +function_out_string_at_IO: + # Allocate stack frame for function function_out_string_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # PARAM param_out_string_at_IO_x_0 --> 0($fp) + # PRINT_STR param_out_string_at_IO_x_0 + lw $v0, 0($fp) + lw $a0, 12($v0) + li $v0, 4 + syscall + # LOCAL local_out_string_at_IO_internal_0 --> -4($fp) + # local_out_string_at_IO_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_out_string_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_out_string_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_in_int_at_IO implementation. +# @Params: +function_in_int_at_IO: + # Allocate stack frame for function function_in_int_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_in_int_at_IO_internal_0 --> -4($fp) + # local_in_int_at_IO_internal_0 = READ_INT + li $v0, 5 + syscall + move $a2, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + sw $a2, 12($v0) + sw $v0, -4($fp) + # RETURN local_in_int_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_in_int_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_abort_at_Object implementation. +# @Params: +function_abort_at_Object: + # Allocate stack frame for function function_abort_at_Object. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_abort_at_Object_internal_0 --> -4($fp) + lw $t0, 0($s1) + sw $t0, -4($fp) + # LOCAL local_abort_at_Object_internal_0 --> -4($fp) + la $a0, data_1 + li $v0, 4 + syscall + lw $a0, -4($fp) + li $v0, 4 + syscall + la $a0, data_2 + li $v0, 4 + syscall + li $v0, 10 + syscall + # Function END + + +# function_copy_at_Object implementation. +# @Params: +function_copy_at_Object: + # Allocate stack frame for function function_copy_at_Object. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_copy_at_Object_internal_0 --> -4($fp) + # local_copy_at_Object_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_copy_at_Object_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function function_copy_at_Object. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_type_name_at_Object implementation. +# @Params: +function_type_name_at_Object: + # Allocate stack frame for function function_type_name_at_Object. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_type_name_at_Object_internal_0 --> -4($fp) + lw $t0, 0($s1) + sw $t0, -4($fp) + # RETURN local_type_name_at_Object_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_type_name_at_Object. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_concat_at_String implementation. +# @Params: +# 0($fp) = param_concat_at_String_s_0 +function_concat_at_String: + # Allocate stack frame for function function_concat_at_String. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_concat_at_String_internal_0 = self.CONCAT + # LOCAL local_concat_at_String_internal_0 --> -4($fp) + # PARAM param_concat_at_String_s_0 --> 0($fp) + # Get first string length from self + lw $t0, 16($s1) + # Get second string length from param + lw $v0, 0($fp) + lw $t1, 16($v0) + # Save new string length in a0 for memory allocation + addu $a0, $t0, $t1 + move $t3, $a0 + # Get first string from self + lw $t0, 12($s1) + # Get second string from param + lw $t1, 12($v0) + addu $a0, $a0, 4 + li $v0, 9 + syscall + move $t2, $v0 + move $t4, $zero + concat_loop1: + # Compare t0 with \0 + lb $t4, 0($t0) + beqz $t4, concat_loop1_end + # Copy 1 byte + sb $t4, 0($t2) + addu $t2, $t2, 1 + addu $t0, $t0, 1 + j concat_loop1 + concat_loop1_end: + # Copy second string + concat_loop2: + # Compare t1 with \0 + lb $t4, 0($t1) + beqz $t4, concat_loop2_end + # Copy 1 byte + sb $t4, 0($t2) + addu $t2, $t2, 1 + addu $t1, $t1, 1 + j concat_loop2 + concat_loop2_end: + sb $zero, 0($t2) + # v0 contains resulting string + move $t1, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + sw $t1, 12($v0) + sw $t3, 16($v0) + sw $v0, -4($fp) + # RETURN local_concat_at_String_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_concat_at_String. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_substr_at_String implementation. +# @Params: +# 0($fp) = param_substr_at_String_l_0 +# 4($fp) = param_substr_at_String_r_1 +function_substr_at_String: + # Allocate stack frame for function function_substr_at_String. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_substr_at_String_internal_0 --> -4($fp) + # PARAM param_substr_at_String_l_0 --> 4($fp) + # PARAM param_substr_at_String_r_1 --> 0($fp) + lw $t0, 12($s1) + lw $t2, 4($fp) + lw $t2, 12($t2) + addu $t0, $t0, $t2 + lw $a0, 0($fp) + lw $a0, 12($a0) + move $t3, $a0 + move $t1, $a0 + addu $a0, $a0, 1 + li $v0, 9 + syscall + move $t2, $v0 + substr_loop: + beqz $t1, substr_end + lb $a0, 0($t0) + sb $a0, 0($t2) + addu $t0, $t0, 1 + addu $t2, $t2, 1 + subu $t1, $t1, 1 + j substr_loop + substr_end: + sb $zero, 0($t2) + move $t1, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + sw $t1, 12($v0) + sw $t3, 16($v0) + sw $v0, -4($fp) + # RETURN local_substr_at_String_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_substr_at_String. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 8 + jr $ra + # Function END + + +# function_length_at_String implementation. +# @Params: +function_length_at_String: + # Allocate stack frame for function function_length_at_String. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_length_at_String_internal_0 = GETATTRIBUTE length String + # LOCAL local_length_at_String_internal_0 --> -4($fp) + lw $t0, 16($s1) + sw $t0, -4($fp) + # LOCAL local_length_at_String_internal_1 --> -8($fp) + # LOCAL local_length_at_String_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + lw $t0, -4($fp) + sw $t0, 12($v0) + sw $v0, -8($fp) + # RETURN local_length_at_String_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function function_length_at_String. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# entry implementation. +# @Params: +entry: + # Allocate stack frame for function entry. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local__internal_0 --> -4($fp) + # local__internal_0 = ALLOCATE Main + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Main + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 12 bytes of memory + li $a0, 12 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Main_start + sw $t0, 4($v0) + # Load type offset + li $t0, 24 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -4($fp) + # LOCAL local__internal_0 --> -4($fp) + lw $s1, -4($fp) + # local__internal_1 = CALL main + # LOCAL local__internal_1 --> -8($fp) + # LOCAL local__internal_0 --> -4($fp) + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type's VTABLE + la $t0, Main_vtable + # Get pointer to function address + lw $t1, 16($t0) + # Call function. Result is on $v0 + jalr $t1 + sw $v0, -8($fp) + # RETURN 0 + li $v0, 0 + # Deallocate stack frame for function entry. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_c2i_at_A2I implementation. +# @Params: +# 0($fp) = param_c2i_at_A2I_char_0 +function_c2i_at_A2I: + # Allocate stack frame for function function_c2i_at_A2I. + subu $sp, $sp, 264 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 264 + # LOCAL local_c2i_at_A2I_internal_4 --> -20($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_4 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -20($fp) + # IF_ZERO param_c2i_at_A2I_char_0 GOTO label_FALSE_3 + # IF_ZERO param_c2i_at_A2I_char_0 GOTO label_FALSE_3 + lw $t0, 0($fp) + beq $t0, 0, label_FALSE_3 + # IF_ZERO local_c2i_at_A2I_internal_4 GOTO label_FALSE_3 + # IF_ZERO local_c2i_at_A2I_internal_4 GOTO label_FALSE_3 + lw $t0, -20($fp) + beq $t0, 0, label_FALSE_3 + # LOCAL local_c2i_at_A2I_internal_3 --> -16($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # Comparing 0($fp) type with String + la $v0, String + lw $a0, 0($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -16($fp) + # IF_ZERO local_c2i_at_A2I_internal_3 GOTO label_COMPARE_STRING_6 + # IF_ZERO local_c2i_at_A2I_internal_3 GOTO label_COMPARE_STRING_6 + lw $t0, -16($fp) + beq $t0, 0, label_COMPARE_STRING_6 + # LOCAL local_c2i_at_A2I_internal_3 --> -16($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # Comparing 0($fp) type with Bool + la $v0, Bool + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -16($fp) + # IF_ZERO local_c2i_at_A2I_internal_3 GOTO label_COMPARE_BY_VALUE_7 + # IF_ZERO local_c2i_at_A2I_internal_3 GOTO label_COMPARE_BY_VALUE_7 + lw $t0, -16($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_7 + # LOCAL local_c2i_at_A2I_internal_3 --> -16($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # Comparing 0($fp) type with Int + la $v0, Int + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -16($fp) + # IF_ZERO local_c2i_at_A2I_internal_3 GOTO label_COMPARE_BY_VALUE_7 + # IF_ZERO local_c2i_at_A2I_internal_3 GOTO label_COMPARE_BY_VALUE_7 + lw $t0, -16($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_7 + # LOCAL local_c2i_at_A2I_internal_3 --> -16($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_4 --> -20($fp) + # Load pointers and SUB + lw $a0, 0($fp) + lw $a1, -20($fp) + sub $a0, $a0, $a1 + sw $a0, -16($fp) + # IF_ZERO local_c2i_at_A2I_internal_3 GOTO label_TRUE_4 + # IF_ZERO local_c2i_at_A2I_internal_3 GOTO label_TRUE_4 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_4 + # GOTO label_FALSE_3 + j label_FALSE_3 + label_COMPARE_BY_VALUE_7: + # LOCAL local_c2i_at_A2I_internal_3 --> -16($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_4 --> -20($fp) + lw $a0, 0($fp) + lw $a1, -20($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -16($fp) + # IF_ZERO local_c2i_at_A2I_internal_3 GOTO label_TRUE_4 + # IF_ZERO local_c2i_at_A2I_internal_3 GOTO label_TRUE_4 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_4 + # GOTO label_FALSE_3 + j label_FALSE_3 + label_COMPARE_STRING_6: + # LOCAL local_c2i_at_A2I_internal_3 --> -16($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_4 --> -20($fp) + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -20($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -16($fp) + # IF_ZERO local_c2i_at_A2I_internal_3 GOTO label_CONTINUE_8 + # IF_ZERO local_c2i_at_A2I_internal_3 GOTO label_CONTINUE_8 + lw $t0, -16($fp) + beq $t0, 0, label_CONTINUE_8 + # GOTO label_FALSE_3 + j label_FALSE_3 + label_CONTINUE_8: + # LOCAL local_c2i_at_A2I_internal_3 --> -16($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_4 --> -20($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -20($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_9: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_10 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_9 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_10: + # Store result + sw $a2, -16($fp) + # IF_ZERO local_c2i_at_A2I_internal_3 GOTO label_TRUE_4 + # IF_ZERO local_c2i_at_A2I_internal_3 GOTO label_TRUE_4 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_4 + label_FALSE_3: + # LOCAL local_c2i_at_A2I_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -12($fp) + # GOTO label_END_5 +j label_END_5 +label_TRUE_4: + # LOCAL local_c2i_at_A2I_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -12($fp) + label_END_5: +# LOCAL local_c2i_at_A2I_internal_0 --> -4($fp) +# LOCAL local_c2i_at_A2I_internal_2 --> -12($fp) +# Obtain value from -12($fp) +lw $v0, -12($fp) +lw $v0, 12($v0) +sw $v0, -4($fp) +# IF_ZERO local_c2i_at_A2I_internal_0 GOTO label_FALSEIF_1 +# IF_ZERO local_c2i_at_A2I_internal_0 GOTO label_FALSEIF_1 +lw $t0, -4($fp) +beq $t0, 0, label_FALSEIF_1 +# LOCAL local_c2i_at_A2I_internal_5 --> -24($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 0 +sw $t0, 12($v0) +sw $v0, -24($fp) +# LOCAL local_c2i_at_A2I_internal_1 --> -8($fp) +# LOCAL local_c2i_at_A2I_internal_5 --> -24($fp) +# local_c2i_at_A2I_internal_1 = local_c2i_at_A2I_internal_5 +lw $t0, -24($fp) +sw $t0, -8($fp) +# GOTO label_ENDIF_2 +j label_ENDIF_2 +label_FALSEIF_1: + # LOCAL local_c2i_at_A2I_internal_10 --> -44($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_5 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -44($fp) + # IF_ZERO param_c2i_at_A2I_char_0 GOTO label_FALSE_13 + # IF_ZERO param_c2i_at_A2I_char_0 GOTO label_FALSE_13 + lw $t0, 0($fp) + beq $t0, 0, label_FALSE_13 + # IF_ZERO local_c2i_at_A2I_internal_10 GOTO label_FALSE_13 + # IF_ZERO local_c2i_at_A2I_internal_10 GOTO label_FALSE_13 + lw $t0, -44($fp) + beq $t0, 0, label_FALSE_13 + # LOCAL local_c2i_at_A2I_internal_9 --> -40($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # Comparing 0($fp) type with String + la $v0, String + lw $a0, 0($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -40($fp) + # IF_ZERO local_c2i_at_A2I_internal_9 GOTO label_COMPARE_STRING_16 + # IF_ZERO local_c2i_at_A2I_internal_9 GOTO label_COMPARE_STRING_16 + lw $t0, -40($fp) + beq $t0, 0, label_COMPARE_STRING_16 + # LOCAL local_c2i_at_A2I_internal_9 --> -40($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # Comparing 0($fp) type with Bool + la $v0, Bool + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -40($fp) + # IF_ZERO local_c2i_at_A2I_internal_9 GOTO label_COMPARE_BY_VALUE_17 + # IF_ZERO local_c2i_at_A2I_internal_9 GOTO label_COMPARE_BY_VALUE_17 + lw $t0, -40($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_17 + # LOCAL local_c2i_at_A2I_internal_9 --> -40($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # Comparing 0($fp) type with Int + la $v0, Int + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -40($fp) + # IF_ZERO local_c2i_at_A2I_internal_9 GOTO label_COMPARE_BY_VALUE_17 + # IF_ZERO local_c2i_at_A2I_internal_9 GOTO label_COMPARE_BY_VALUE_17 + lw $t0, -40($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_17 + # LOCAL local_c2i_at_A2I_internal_9 --> -40($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_10 --> -44($fp) + # Load pointers and SUB + lw $a0, 0($fp) + lw $a1, -44($fp) + sub $a0, $a0, $a1 + sw $a0, -40($fp) + # IF_ZERO local_c2i_at_A2I_internal_9 GOTO label_TRUE_14 + # IF_ZERO local_c2i_at_A2I_internal_9 GOTO label_TRUE_14 + lw $t0, -40($fp) + beq $t0, 0, label_TRUE_14 + # GOTO label_FALSE_13 + j label_FALSE_13 + label_COMPARE_BY_VALUE_17: + # LOCAL local_c2i_at_A2I_internal_9 --> -40($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_10 --> -44($fp) + lw $a0, 0($fp) + lw $a1, -44($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -40($fp) + # IF_ZERO local_c2i_at_A2I_internal_9 GOTO label_TRUE_14 + # IF_ZERO local_c2i_at_A2I_internal_9 GOTO label_TRUE_14 + lw $t0, -40($fp) + beq $t0, 0, label_TRUE_14 + # GOTO label_FALSE_13 + j label_FALSE_13 + label_COMPARE_STRING_16: + # LOCAL local_c2i_at_A2I_internal_9 --> -40($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_10 --> -44($fp) + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -44($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -40($fp) + # IF_ZERO local_c2i_at_A2I_internal_9 GOTO label_CONTINUE_18 + # IF_ZERO local_c2i_at_A2I_internal_9 GOTO label_CONTINUE_18 + lw $t0, -40($fp) + beq $t0, 0, label_CONTINUE_18 + # GOTO label_FALSE_13 + j label_FALSE_13 + label_CONTINUE_18: + # LOCAL local_c2i_at_A2I_internal_9 --> -40($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_10 --> -44($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -44($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_19: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_20 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_19 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_20: + # Store result + sw $a2, -40($fp) + # IF_ZERO local_c2i_at_A2I_internal_9 GOTO label_TRUE_14 + # IF_ZERO local_c2i_at_A2I_internal_9 GOTO label_TRUE_14 + lw $t0, -40($fp) + beq $t0, 0, label_TRUE_14 + label_FALSE_13: + # LOCAL local_c2i_at_A2I_internal_8 --> -36($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -36($fp) + # GOTO label_END_15 +j label_END_15 +label_TRUE_14: + # LOCAL local_c2i_at_A2I_internal_8 --> -36($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -36($fp) + label_END_15: +# LOCAL local_c2i_at_A2I_internal_6 --> -28($fp) +# LOCAL local_c2i_at_A2I_internal_8 --> -36($fp) +# Obtain value from -36($fp) +lw $v0, -36($fp) +lw $v0, 12($v0) +sw $v0, -28($fp) +# IF_ZERO local_c2i_at_A2I_internal_6 GOTO label_FALSEIF_11 +# IF_ZERO local_c2i_at_A2I_internal_6 GOTO label_FALSEIF_11 +lw $t0, -28($fp) +beq $t0, 0, label_FALSEIF_11 +# LOCAL local_c2i_at_A2I_internal_11 --> -48($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 1 +sw $t0, 12($v0) +sw $v0, -48($fp) +# LOCAL local_c2i_at_A2I_internal_7 --> -32($fp) +# LOCAL local_c2i_at_A2I_internal_11 --> -48($fp) +# local_c2i_at_A2I_internal_7 = local_c2i_at_A2I_internal_11 +lw $t0, -48($fp) +sw $t0, -32($fp) +# GOTO label_ENDIF_12 +j label_ENDIF_12 +label_FALSEIF_11: + # LOCAL local_c2i_at_A2I_internal_16 --> -68($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_6 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -68($fp) + # IF_ZERO param_c2i_at_A2I_char_0 GOTO label_FALSE_23 + # IF_ZERO param_c2i_at_A2I_char_0 GOTO label_FALSE_23 + lw $t0, 0($fp) + beq $t0, 0, label_FALSE_23 + # IF_ZERO local_c2i_at_A2I_internal_16 GOTO label_FALSE_23 + # IF_ZERO local_c2i_at_A2I_internal_16 GOTO label_FALSE_23 + lw $t0, -68($fp) + beq $t0, 0, label_FALSE_23 + # LOCAL local_c2i_at_A2I_internal_15 --> -64($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # Comparing 0($fp) type with String + la $v0, String + lw $a0, 0($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -64($fp) + # IF_ZERO local_c2i_at_A2I_internal_15 GOTO label_COMPARE_STRING_26 + # IF_ZERO local_c2i_at_A2I_internal_15 GOTO label_COMPARE_STRING_26 + lw $t0, -64($fp) + beq $t0, 0, label_COMPARE_STRING_26 + # LOCAL local_c2i_at_A2I_internal_15 --> -64($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # Comparing 0($fp) type with Bool + la $v0, Bool + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -64($fp) + # IF_ZERO local_c2i_at_A2I_internal_15 GOTO label_COMPARE_BY_VALUE_27 + # IF_ZERO local_c2i_at_A2I_internal_15 GOTO label_COMPARE_BY_VALUE_27 + lw $t0, -64($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_27 + # LOCAL local_c2i_at_A2I_internal_15 --> -64($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # Comparing 0($fp) type with Int + la $v0, Int + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -64($fp) + # IF_ZERO local_c2i_at_A2I_internal_15 GOTO label_COMPARE_BY_VALUE_27 + # IF_ZERO local_c2i_at_A2I_internal_15 GOTO label_COMPARE_BY_VALUE_27 + lw $t0, -64($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_27 + # LOCAL local_c2i_at_A2I_internal_15 --> -64($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_16 --> -68($fp) + # Load pointers and SUB + lw $a0, 0($fp) + lw $a1, -68($fp) + sub $a0, $a0, $a1 + sw $a0, -64($fp) + # IF_ZERO local_c2i_at_A2I_internal_15 GOTO label_TRUE_24 + # IF_ZERO local_c2i_at_A2I_internal_15 GOTO label_TRUE_24 + lw $t0, -64($fp) + beq $t0, 0, label_TRUE_24 + # GOTO label_FALSE_23 + j label_FALSE_23 + label_COMPARE_BY_VALUE_27: + # LOCAL local_c2i_at_A2I_internal_15 --> -64($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_16 --> -68($fp) + lw $a0, 0($fp) + lw $a1, -68($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -64($fp) + # IF_ZERO local_c2i_at_A2I_internal_15 GOTO label_TRUE_24 + # IF_ZERO local_c2i_at_A2I_internal_15 GOTO label_TRUE_24 + lw $t0, -64($fp) + beq $t0, 0, label_TRUE_24 + # GOTO label_FALSE_23 + j label_FALSE_23 + label_COMPARE_STRING_26: + # LOCAL local_c2i_at_A2I_internal_15 --> -64($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_16 --> -68($fp) + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -68($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -64($fp) + # IF_ZERO local_c2i_at_A2I_internal_15 GOTO label_CONTINUE_28 + # IF_ZERO local_c2i_at_A2I_internal_15 GOTO label_CONTINUE_28 + lw $t0, -64($fp) + beq $t0, 0, label_CONTINUE_28 + # GOTO label_FALSE_23 + j label_FALSE_23 + label_CONTINUE_28: + # LOCAL local_c2i_at_A2I_internal_15 --> -64($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_16 --> -68($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -68($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_29: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_30 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_29 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_30: + # Store result + sw $a2, -64($fp) + # IF_ZERO local_c2i_at_A2I_internal_15 GOTO label_TRUE_24 + # IF_ZERO local_c2i_at_A2I_internal_15 GOTO label_TRUE_24 + lw $t0, -64($fp) + beq $t0, 0, label_TRUE_24 + label_FALSE_23: + # LOCAL local_c2i_at_A2I_internal_14 --> -60($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -60($fp) + # GOTO label_END_25 +j label_END_25 +label_TRUE_24: + # LOCAL local_c2i_at_A2I_internal_14 --> -60($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -60($fp) + label_END_25: +# LOCAL local_c2i_at_A2I_internal_12 --> -52($fp) +# LOCAL local_c2i_at_A2I_internal_14 --> -60($fp) +# Obtain value from -60($fp) +lw $v0, -60($fp) +lw $v0, 12($v0) +sw $v0, -52($fp) +# IF_ZERO local_c2i_at_A2I_internal_12 GOTO label_FALSEIF_21 +# IF_ZERO local_c2i_at_A2I_internal_12 GOTO label_FALSEIF_21 +lw $t0, -52($fp) +beq $t0, 0, label_FALSEIF_21 +# LOCAL local_c2i_at_A2I_internal_17 --> -72($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 2 +sw $t0, 12($v0) +sw $v0, -72($fp) +# LOCAL local_c2i_at_A2I_internal_13 --> -56($fp) +# LOCAL local_c2i_at_A2I_internal_17 --> -72($fp) +# local_c2i_at_A2I_internal_13 = local_c2i_at_A2I_internal_17 +lw $t0, -72($fp) +sw $t0, -56($fp) +# GOTO label_ENDIF_22 +j label_ENDIF_22 +label_FALSEIF_21: + # LOCAL local_c2i_at_A2I_internal_22 --> -92($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_7 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -92($fp) + # IF_ZERO param_c2i_at_A2I_char_0 GOTO label_FALSE_33 + # IF_ZERO param_c2i_at_A2I_char_0 GOTO label_FALSE_33 + lw $t0, 0($fp) + beq $t0, 0, label_FALSE_33 + # IF_ZERO local_c2i_at_A2I_internal_22 GOTO label_FALSE_33 + # IF_ZERO local_c2i_at_A2I_internal_22 GOTO label_FALSE_33 + lw $t0, -92($fp) + beq $t0, 0, label_FALSE_33 + # LOCAL local_c2i_at_A2I_internal_21 --> -88($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # Comparing 0($fp) type with String + la $v0, String + lw $a0, 0($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -88($fp) + # IF_ZERO local_c2i_at_A2I_internal_21 GOTO label_COMPARE_STRING_36 + # IF_ZERO local_c2i_at_A2I_internal_21 GOTO label_COMPARE_STRING_36 + lw $t0, -88($fp) + beq $t0, 0, label_COMPARE_STRING_36 + # LOCAL local_c2i_at_A2I_internal_21 --> -88($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # Comparing 0($fp) type with Bool + la $v0, Bool + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -88($fp) + # IF_ZERO local_c2i_at_A2I_internal_21 GOTO label_COMPARE_BY_VALUE_37 + # IF_ZERO local_c2i_at_A2I_internal_21 GOTO label_COMPARE_BY_VALUE_37 + lw $t0, -88($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_37 + # LOCAL local_c2i_at_A2I_internal_21 --> -88($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # Comparing 0($fp) type with Int + la $v0, Int + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -88($fp) + # IF_ZERO local_c2i_at_A2I_internal_21 GOTO label_COMPARE_BY_VALUE_37 + # IF_ZERO local_c2i_at_A2I_internal_21 GOTO label_COMPARE_BY_VALUE_37 + lw $t0, -88($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_37 + # LOCAL local_c2i_at_A2I_internal_21 --> -88($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_22 --> -92($fp) + # Load pointers and SUB + lw $a0, 0($fp) + lw $a1, -92($fp) + sub $a0, $a0, $a1 + sw $a0, -88($fp) + # IF_ZERO local_c2i_at_A2I_internal_21 GOTO label_TRUE_34 + # IF_ZERO local_c2i_at_A2I_internal_21 GOTO label_TRUE_34 + lw $t0, -88($fp) + beq $t0, 0, label_TRUE_34 + # GOTO label_FALSE_33 + j label_FALSE_33 + label_COMPARE_BY_VALUE_37: + # LOCAL local_c2i_at_A2I_internal_21 --> -88($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_22 --> -92($fp) + lw $a0, 0($fp) + lw $a1, -92($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -88($fp) + # IF_ZERO local_c2i_at_A2I_internal_21 GOTO label_TRUE_34 + # IF_ZERO local_c2i_at_A2I_internal_21 GOTO label_TRUE_34 + lw $t0, -88($fp) + beq $t0, 0, label_TRUE_34 + # GOTO label_FALSE_33 + j label_FALSE_33 + label_COMPARE_STRING_36: + # LOCAL local_c2i_at_A2I_internal_21 --> -88($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_22 --> -92($fp) + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -92($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -88($fp) + # IF_ZERO local_c2i_at_A2I_internal_21 GOTO label_CONTINUE_38 + # IF_ZERO local_c2i_at_A2I_internal_21 GOTO label_CONTINUE_38 + lw $t0, -88($fp) + beq $t0, 0, label_CONTINUE_38 + # GOTO label_FALSE_33 + j label_FALSE_33 + label_CONTINUE_38: + # LOCAL local_c2i_at_A2I_internal_21 --> -88($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_22 --> -92($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -92($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_39: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_40 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_39 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_40: + # Store result + sw $a2, -88($fp) + # IF_ZERO local_c2i_at_A2I_internal_21 GOTO label_TRUE_34 + # IF_ZERO local_c2i_at_A2I_internal_21 GOTO label_TRUE_34 + lw $t0, -88($fp) + beq $t0, 0, label_TRUE_34 + label_FALSE_33: + # LOCAL local_c2i_at_A2I_internal_20 --> -84($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -84($fp) + # GOTO label_END_35 +j label_END_35 +label_TRUE_34: + # LOCAL local_c2i_at_A2I_internal_20 --> -84($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -84($fp) + label_END_35: +# LOCAL local_c2i_at_A2I_internal_18 --> -76($fp) +# LOCAL local_c2i_at_A2I_internal_20 --> -84($fp) +# Obtain value from -84($fp) +lw $v0, -84($fp) +lw $v0, 12($v0) +sw $v0, -76($fp) +# IF_ZERO local_c2i_at_A2I_internal_18 GOTO label_FALSEIF_31 +# IF_ZERO local_c2i_at_A2I_internal_18 GOTO label_FALSEIF_31 +lw $t0, -76($fp) +beq $t0, 0, label_FALSEIF_31 +# LOCAL local_c2i_at_A2I_internal_23 --> -96($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 3 +sw $t0, 12($v0) +sw $v0, -96($fp) +# LOCAL local_c2i_at_A2I_internal_19 --> -80($fp) +# LOCAL local_c2i_at_A2I_internal_23 --> -96($fp) +# local_c2i_at_A2I_internal_19 = local_c2i_at_A2I_internal_23 +lw $t0, -96($fp) +sw $t0, -80($fp) +# GOTO label_ENDIF_32 +j label_ENDIF_32 +label_FALSEIF_31: + # LOCAL local_c2i_at_A2I_internal_28 --> -116($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_8 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -116($fp) + # IF_ZERO param_c2i_at_A2I_char_0 GOTO label_FALSE_43 + # IF_ZERO param_c2i_at_A2I_char_0 GOTO label_FALSE_43 + lw $t0, 0($fp) + beq $t0, 0, label_FALSE_43 + # IF_ZERO local_c2i_at_A2I_internal_28 GOTO label_FALSE_43 + # IF_ZERO local_c2i_at_A2I_internal_28 GOTO label_FALSE_43 + lw $t0, -116($fp) + beq $t0, 0, label_FALSE_43 + # LOCAL local_c2i_at_A2I_internal_27 --> -112($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # Comparing 0($fp) type with String + la $v0, String + lw $a0, 0($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -112($fp) + # IF_ZERO local_c2i_at_A2I_internal_27 GOTO label_COMPARE_STRING_46 + # IF_ZERO local_c2i_at_A2I_internal_27 GOTO label_COMPARE_STRING_46 + lw $t0, -112($fp) + beq $t0, 0, label_COMPARE_STRING_46 + # LOCAL local_c2i_at_A2I_internal_27 --> -112($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # Comparing 0($fp) type with Bool + la $v0, Bool + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -112($fp) + # IF_ZERO local_c2i_at_A2I_internal_27 GOTO label_COMPARE_BY_VALUE_47 + # IF_ZERO local_c2i_at_A2I_internal_27 GOTO label_COMPARE_BY_VALUE_47 + lw $t0, -112($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_47 + # LOCAL local_c2i_at_A2I_internal_27 --> -112($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # Comparing 0($fp) type with Int + la $v0, Int + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -112($fp) + # IF_ZERO local_c2i_at_A2I_internal_27 GOTO label_COMPARE_BY_VALUE_47 + # IF_ZERO local_c2i_at_A2I_internal_27 GOTO label_COMPARE_BY_VALUE_47 + lw $t0, -112($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_47 + # LOCAL local_c2i_at_A2I_internal_27 --> -112($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_28 --> -116($fp) + # Load pointers and SUB + lw $a0, 0($fp) + lw $a1, -116($fp) + sub $a0, $a0, $a1 + sw $a0, -112($fp) + # IF_ZERO local_c2i_at_A2I_internal_27 GOTO label_TRUE_44 + # IF_ZERO local_c2i_at_A2I_internal_27 GOTO label_TRUE_44 + lw $t0, -112($fp) + beq $t0, 0, label_TRUE_44 + # GOTO label_FALSE_43 + j label_FALSE_43 + label_COMPARE_BY_VALUE_47: + # LOCAL local_c2i_at_A2I_internal_27 --> -112($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_28 --> -116($fp) + lw $a0, 0($fp) + lw $a1, -116($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -112($fp) + # IF_ZERO local_c2i_at_A2I_internal_27 GOTO label_TRUE_44 + # IF_ZERO local_c2i_at_A2I_internal_27 GOTO label_TRUE_44 + lw $t0, -112($fp) + beq $t0, 0, label_TRUE_44 + # GOTO label_FALSE_43 + j label_FALSE_43 + label_COMPARE_STRING_46: + # LOCAL local_c2i_at_A2I_internal_27 --> -112($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_28 --> -116($fp) + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -116($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -112($fp) + # IF_ZERO local_c2i_at_A2I_internal_27 GOTO label_CONTINUE_48 + # IF_ZERO local_c2i_at_A2I_internal_27 GOTO label_CONTINUE_48 + lw $t0, -112($fp) + beq $t0, 0, label_CONTINUE_48 + # GOTO label_FALSE_43 + j label_FALSE_43 + label_CONTINUE_48: + # LOCAL local_c2i_at_A2I_internal_27 --> -112($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_28 --> -116($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -116($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_49: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_50 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_49 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_50: + # Store result + sw $a2, -112($fp) + # IF_ZERO local_c2i_at_A2I_internal_27 GOTO label_TRUE_44 + # IF_ZERO local_c2i_at_A2I_internal_27 GOTO label_TRUE_44 + lw $t0, -112($fp) + beq $t0, 0, label_TRUE_44 + label_FALSE_43: + # LOCAL local_c2i_at_A2I_internal_26 --> -108($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -108($fp) + # GOTO label_END_45 +j label_END_45 +label_TRUE_44: + # LOCAL local_c2i_at_A2I_internal_26 --> -108($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -108($fp) + label_END_45: +# LOCAL local_c2i_at_A2I_internal_24 --> -100($fp) +# LOCAL local_c2i_at_A2I_internal_26 --> -108($fp) +# Obtain value from -108($fp) +lw $v0, -108($fp) +lw $v0, 12($v0) +sw $v0, -100($fp) +# IF_ZERO local_c2i_at_A2I_internal_24 GOTO label_FALSEIF_41 +# IF_ZERO local_c2i_at_A2I_internal_24 GOTO label_FALSEIF_41 +lw $t0, -100($fp) +beq $t0, 0, label_FALSEIF_41 +# LOCAL local_c2i_at_A2I_internal_29 --> -120($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 4 +sw $t0, 12($v0) +sw $v0, -120($fp) +# LOCAL local_c2i_at_A2I_internal_25 --> -104($fp) +# LOCAL local_c2i_at_A2I_internal_29 --> -120($fp) +# local_c2i_at_A2I_internal_25 = local_c2i_at_A2I_internal_29 +lw $t0, -120($fp) +sw $t0, -104($fp) +# GOTO label_ENDIF_42 +j label_ENDIF_42 +label_FALSEIF_41: + # LOCAL local_c2i_at_A2I_internal_34 --> -140($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_9 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -140($fp) + # IF_ZERO param_c2i_at_A2I_char_0 GOTO label_FALSE_53 + # IF_ZERO param_c2i_at_A2I_char_0 GOTO label_FALSE_53 + lw $t0, 0($fp) + beq $t0, 0, label_FALSE_53 + # IF_ZERO local_c2i_at_A2I_internal_34 GOTO label_FALSE_53 + # IF_ZERO local_c2i_at_A2I_internal_34 GOTO label_FALSE_53 + lw $t0, -140($fp) + beq $t0, 0, label_FALSE_53 + # LOCAL local_c2i_at_A2I_internal_33 --> -136($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # Comparing 0($fp) type with String + la $v0, String + lw $a0, 0($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -136($fp) + # IF_ZERO local_c2i_at_A2I_internal_33 GOTO label_COMPARE_STRING_56 + # IF_ZERO local_c2i_at_A2I_internal_33 GOTO label_COMPARE_STRING_56 + lw $t0, -136($fp) + beq $t0, 0, label_COMPARE_STRING_56 + # LOCAL local_c2i_at_A2I_internal_33 --> -136($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # Comparing 0($fp) type with Bool + la $v0, Bool + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -136($fp) + # IF_ZERO local_c2i_at_A2I_internal_33 GOTO label_COMPARE_BY_VALUE_57 + # IF_ZERO local_c2i_at_A2I_internal_33 GOTO label_COMPARE_BY_VALUE_57 + lw $t0, -136($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_57 + # LOCAL local_c2i_at_A2I_internal_33 --> -136($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # Comparing 0($fp) type with Int + la $v0, Int + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -136($fp) + # IF_ZERO local_c2i_at_A2I_internal_33 GOTO label_COMPARE_BY_VALUE_57 + # IF_ZERO local_c2i_at_A2I_internal_33 GOTO label_COMPARE_BY_VALUE_57 + lw $t0, -136($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_57 + # LOCAL local_c2i_at_A2I_internal_33 --> -136($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_34 --> -140($fp) + # Load pointers and SUB + lw $a0, 0($fp) + lw $a1, -140($fp) + sub $a0, $a0, $a1 + sw $a0, -136($fp) + # IF_ZERO local_c2i_at_A2I_internal_33 GOTO label_TRUE_54 + # IF_ZERO local_c2i_at_A2I_internal_33 GOTO label_TRUE_54 + lw $t0, -136($fp) + beq $t0, 0, label_TRUE_54 + # GOTO label_FALSE_53 + j label_FALSE_53 + label_COMPARE_BY_VALUE_57: + # LOCAL local_c2i_at_A2I_internal_33 --> -136($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_34 --> -140($fp) + lw $a0, 0($fp) + lw $a1, -140($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -136($fp) + # IF_ZERO local_c2i_at_A2I_internal_33 GOTO label_TRUE_54 + # IF_ZERO local_c2i_at_A2I_internal_33 GOTO label_TRUE_54 + lw $t0, -136($fp) + beq $t0, 0, label_TRUE_54 + # GOTO label_FALSE_53 + j label_FALSE_53 + label_COMPARE_STRING_56: + # LOCAL local_c2i_at_A2I_internal_33 --> -136($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_34 --> -140($fp) + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -140($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -136($fp) + # IF_ZERO local_c2i_at_A2I_internal_33 GOTO label_CONTINUE_58 + # IF_ZERO local_c2i_at_A2I_internal_33 GOTO label_CONTINUE_58 + lw $t0, -136($fp) + beq $t0, 0, label_CONTINUE_58 + # GOTO label_FALSE_53 + j label_FALSE_53 + label_CONTINUE_58: + # LOCAL local_c2i_at_A2I_internal_33 --> -136($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_34 --> -140($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -140($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_59: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_60 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_59 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_60: + # Store result + sw $a2, -136($fp) + # IF_ZERO local_c2i_at_A2I_internal_33 GOTO label_TRUE_54 + # IF_ZERO local_c2i_at_A2I_internal_33 GOTO label_TRUE_54 + lw $t0, -136($fp) + beq $t0, 0, label_TRUE_54 + label_FALSE_53: + # LOCAL local_c2i_at_A2I_internal_32 --> -132($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -132($fp) + # GOTO label_END_55 +j label_END_55 +label_TRUE_54: + # LOCAL local_c2i_at_A2I_internal_32 --> -132($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -132($fp) + label_END_55: +# LOCAL local_c2i_at_A2I_internal_30 --> -124($fp) +# LOCAL local_c2i_at_A2I_internal_32 --> -132($fp) +# Obtain value from -132($fp) +lw $v0, -132($fp) +lw $v0, 12($v0) +sw $v0, -124($fp) +# IF_ZERO local_c2i_at_A2I_internal_30 GOTO label_FALSEIF_51 +# IF_ZERO local_c2i_at_A2I_internal_30 GOTO label_FALSEIF_51 +lw $t0, -124($fp) +beq $t0, 0, label_FALSEIF_51 +# LOCAL local_c2i_at_A2I_internal_35 --> -144($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 5 +sw $t0, 12($v0) +sw $v0, -144($fp) +# LOCAL local_c2i_at_A2I_internal_31 --> -128($fp) +# LOCAL local_c2i_at_A2I_internal_35 --> -144($fp) +# local_c2i_at_A2I_internal_31 = local_c2i_at_A2I_internal_35 +lw $t0, -144($fp) +sw $t0, -128($fp) +# GOTO label_ENDIF_52 +j label_ENDIF_52 +label_FALSEIF_51: + # LOCAL local_c2i_at_A2I_internal_40 --> -164($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_10 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -164($fp) + # IF_ZERO param_c2i_at_A2I_char_0 GOTO label_FALSE_63 + # IF_ZERO param_c2i_at_A2I_char_0 GOTO label_FALSE_63 + lw $t0, 0($fp) + beq $t0, 0, label_FALSE_63 + # IF_ZERO local_c2i_at_A2I_internal_40 GOTO label_FALSE_63 + # IF_ZERO local_c2i_at_A2I_internal_40 GOTO label_FALSE_63 + lw $t0, -164($fp) + beq $t0, 0, label_FALSE_63 + # LOCAL local_c2i_at_A2I_internal_39 --> -160($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # Comparing 0($fp) type with String + la $v0, String + lw $a0, 0($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -160($fp) + # IF_ZERO local_c2i_at_A2I_internal_39 GOTO label_COMPARE_STRING_66 + # IF_ZERO local_c2i_at_A2I_internal_39 GOTO label_COMPARE_STRING_66 + lw $t0, -160($fp) + beq $t0, 0, label_COMPARE_STRING_66 + # LOCAL local_c2i_at_A2I_internal_39 --> -160($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # Comparing 0($fp) type with Bool + la $v0, Bool + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -160($fp) + # IF_ZERO local_c2i_at_A2I_internal_39 GOTO label_COMPARE_BY_VALUE_67 + # IF_ZERO local_c2i_at_A2I_internal_39 GOTO label_COMPARE_BY_VALUE_67 + lw $t0, -160($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_67 + # LOCAL local_c2i_at_A2I_internal_39 --> -160($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # Comparing 0($fp) type with Int + la $v0, Int + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -160($fp) + # IF_ZERO local_c2i_at_A2I_internal_39 GOTO label_COMPARE_BY_VALUE_67 + # IF_ZERO local_c2i_at_A2I_internal_39 GOTO label_COMPARE_BY_VALUE_67 + lw $t0, -160($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_67 + # LOCAL local_c2i_at_A2I_internal_39 --> -160($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_40 --> -164($fp) + # Load pointers and SUB + lw $a0, 0($fp) + lw $a1, -164($fp) + sub $a0, $a0, $a1 + sw $a0, -160($fp) + # IF_ZERO local_c2i_at_A2I_internal_39 GOTO label_TRUE_64 + # IF_ZERO local_c2i_at_A2I_internal_39 GOTO label_TRUE_64 + lw $t0, -160($fp) + beq $t0, 0, label_TRUE_64 + # GOTO label_FALSE_63 + j label_FALSE_63 + label_COMPARE_BY_VALUE_67: + # LOCAL local_c2i_at_A2I_internal_39 --> -160($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_40 --> -164($fp) + lw $a0, 0($fp) + lw $a1, -164($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -160($fp) + # IF_ZERO local_c2i_at_A2I_internal_39 GOTO label_TRUE_64 + # IF_ZERO local_c2i_at_A2I_internal_39 GOTO label_TRUE_64 + lw $t0, -160($fp) + beq $t0, 0, label_TRUE_64 + # GOTO label_FALSE_63 + j label_FALSE_63 + label_COMPARE_STRING_66: + # LOCAL local_c2i_at_A2I_internal_39 --> -160($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_40 --> -164($fp) + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -164($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -160($fp) + # IF_ZERO local_c2i_at_A2I_internal_39 GOTO label_CONTINUE_68 + # IF_ZERO local_c2i_at_A2I_internal_39 GOTO label_CONTINUE_68 + lw $t0, -160($fp) + beq $t0, 0, label_CONTINUE_68 + # GOTO label_FALSE_63 + j label_FALSE_63 + label_CONTINUE_68: + # LOCAL local_c2i_at_A2I_internal_39 --> -160($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_40 --> -164($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -164($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_69: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_70 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_69 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_70: + # Store result + sw $a2, -160($fp) + # IF_ZERO local_c2i_at_A2I_internal_39 GOTO label_TRUE_64 + # IF_ZERO local_c2i_at_A2I_internal_39 GOTO label_TRUE_64 + lw $t0, -160($fp) + beq $t0, 0, label_TRUE_64 + label_FALSE_63: + # LOCAL local_c2i_at_A2I_internal_38 --> -156($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -156($fp) + # GOTO label_END_65 +j label_END_65 +label_TRUE_64: + # LOCAL local_c2i_at_A2I_internal_38 --> -156($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -156($fp) + label_END_65: +# LOCAL local_c2i_at_A2I_internal_36 --> -148($fp) +# LOCAL local_c2i_at_A2I_internal_38 --> -156($fp) +# Obtain value from -156($fp) +lw $v0, -156($fp) +lw $v0, 12($v0) +sw $v0, -148($fp) +# IF_ZERO local_c2i_at_A2I_internal_36 GOTO label_FALSEIF_61 +# IF_ZERO local_c2i_at_A2I_internal_36 GOTO label_FALSEIF_61 +lw $t0, -148($fp) +beq $t0, 0, label_FALSEIF_61 +# LOCAL local_c2i_at_A2I_internal_41 --> -168($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 6 +sw $t0, 12($v0) +sw $v0, -168($fp) +# LOCAL local_c2i_at_A2I_internal_37 --> -152($fp) +# LOCAL local_c2i_at_A2I_internal_41 --> -168($fp) +# local_c2i_at_A2I_internal_37 = local_c2i_at_A2I_internal_41 +lw $t0, -168($fp) +sw $t0, -152($fp) +# GOTO label_ENDIF_62 +j label_ENDIF_62 +label_FALSEIF_61: + # LOCAL local_c2i_at_A2I_internal_46 --> -188($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_11 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -188($fp) + # IF_ZERO param_c2i_at_A2I_char_0 GOTO label_FALSE_73 + # IF_ZERO param_c2i_at_A2I_char_0 GOTO label_FALSE_73 + lw $t0, 0($fp) + beq $t0, 0, label_FALSE_73 + # IF_ZERO local_c2i_at_A2I_internal_46 GOTO label_FALSE_73 + # IF_ZERO local_c2i_at_A2I_internal_46 GOTO label_FALSE_73 + lw $t0, -188($fp) + beq $t0, 0, label_FALSE_73 + # LOCAL local_c2i_at_A2I_internal_45 --> -184($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # Comparing 0($fp) type with String + la $v0, String + lw $a0, 0($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -184($fp) + # IF_ZERO local_c2i_at_A2I_internal_45 GOTO label_COMPARE_STRING_76 + # IF_ZERO local_c2i_at_A2I_internal_45 GOTO label_COMPARE_STRING_76 + lw $t0, -184($fp) + beq $t0, 0, label_COMPARE_STRING_76 + # LOCAL local_c2i_at_A2I_internal_45 --> -184($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # Comparing 0($fp) type with Bool + la $v0, Bool + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -184($fp) + # IF_ZERO local_c2i_at_A2I_internal_45 GOTO label_COMPARE_BY_VALUE_77 + # IF_ZERO local_c2i_at_A2I_internal_45 GOTO label_COMPARE_BY_VALUE_77 + lw $t0, -184($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_77 + # LOCAL local_c2i_at_A2I_internal_45 --> -184($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # Comparing 0($fp) type with Int + la $v0, Int + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -184($fp) + # IF_ZERO local_c2i_at_A2I_internal_45 GOTO label_COMPARE_BY_VALUE_77 + # IF_ZERO local_c2i_at_A2I_internal_45 GOTO label_COMPARE_BY_VALUE_77 + lw $t0, -184($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_77 + # LOCAL local_c2i_at_A2I_internal_45 --> -184($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_46 --> -188($fp) + # Load pointers and SUB + lw $a0, 0($fp) + lw $a1, -188($fp) + sub $a0, $a0, $a1 + sw $a0, -184($fp) + # IF_ZERO local_c2i_at_A2I_internal_45 GOTO label_TRUE_74 + # IF_ZERO local_c2i_at_A2I_internal_45 GOTO label_TRUE_74 + lw $t0, -184($fp) + beq $t0, 0, label_TRUE_74 + # GOTO label_FALSE_73 + j label_FALSE_73 + label_COMPARE_BY_VALUE_77: + # LOCAL local_c2i_at_A2I_internal_45 --> -184($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_46 --> -188($fp) + lw $a0, 0($fp) + lw $a1, -188($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -184($fp) + # IF_ZERO local_c2i_at_A2I_internal_45 GOTO label_TRUE_74 + # IF_ZERO local_c2i_at_A2I_internal_45 GOTO label_TRUE_74 + lw $t0, -184($fp) + beq $t0, 0, label_TRUE_74 + # GOTO label_FALSE_73 + j label_FALSE_73 + label_COMPARE_STRING_76: + # LOCAL local_c2i_at_A2I_internal_45 --> -184($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_46 --> -188($fp) + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -188($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -184($fp) + # IF_ZERO local_c2i_at_A2I_internal_45 GOTO label_CONTINUE_78 + # IF_ZERO local_c2i_at_A2I_internal_45 GOTO label_CONTINUE_78 + lw $t0, -184($fp) + beq $t0, 0, label_CONTINUE_78 + # GOTO label_FALSE_73 + j label_FALSE_73 + label_CONTINUE_78: + # LOCAL local_c2i_at_A2I_internal_45 --> -184($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_46 --> -188($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -188($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_79: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_80 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_79 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_80: + # Store result + sw $a2, -184($fp) + # IF_ZERO local_c2i_at_A2I_internal_45 GOTO label_TRUE_74 + # IF_ZERO local_c2i_at_A2I_internal_45 GOTO label_TRUE_74 + lw $t0, -184($fp) + beq $t0, 0, label_TRUE_74 + label_FALSE_73: + # LOCAL local_c2i_at_A2I_internal_44 --> -180($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -180($fp) + # GOTO label_END_75 +j label_END_75 +label_TRUE_74: + # LOCAL local_c2i_at_A2I_internal_44 --> -180($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -180($fp) + label_END_75: +# LOCAL local_c2i_at_A2I_internal_42 --> -172($fp) +# LOCAL local_c2i_at_A2I_internal_44 --> -180($fp) +# Obtain value from -180($fp) +lw $v0, -180($fp) +lw $v0, 12($v0) +sw $v0, -172($fp) +# IF_ZERO local_c2i_at_A2I_internal_42 GOTO label_FALSEIF_71 +# IF_ZERO local_c2i_at_A2I_internal_42 GOTO label_FALSEIF_71 +lw $t0, -172($fp) +beq $t0, 0, label_FALSEIF_71 +# LOCAL local_c2i_at_A2I_internal_47 --> -192($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 7 +sw $t0, 12($v0) +sw $v0, -192($fp) +# LOCAL local_c2i_at_A2I_internal_43 --> -176($fp) +# LOCAL local_c2i_at_A2I_internal_47 --> -192($fp) +# local_c2i_at_A2I_internal_43 = local_c2i_at_A2I_internal_47 +lw $t0, -192($fp) +sw $t0, -176($fp) +# GOTO label_ENDIF_72 +j label_ENDIF_72 +label_FALSEIF_71: + # LOCAL local_c2i_at_A2I_internal_52 --> -212($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_12 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -212($fp) + # IF_ZERO param_c2i_at_A2I_char_0 GOTO label_FALSE_83 + # IF_ZERO param_c2i_at_A2I_char_0 GOTO label_FALSE_83 + lw $t0, 0($fp) + beq $t0, 0, label_FALSE_83 + # IF_ZERO local_c2i_at_A2I_internal_52 GOTO label_FALSE_83 + # IF_ZERO local_c2i_at_A2I_internal_52 GOTO label_FALSE_83 + lw $t0, -212($fp) + beq $t0, 0, label_FALSE_83 + # LOCAL local_c2i_at_A2I_internal_51 --> -208($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # Comparing 0($fp) type with String + la $v0, String + lw $a0, 0($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -208($fp) + # IF_ZERO local_c2i_at_A2I_internal_51 GOTO label_COMPARE_STRING_86 + # IF_ZERO local_c2i_at_A2I_internal_51 GOTO label_COMPARE_STRING_86 + lw $t0, -208($fp) + beq $t0, 0, label_COMPARE_STRING_86 + # LOCAL local_c2i_at_A2I_internal_51 --> -208($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # Comparing 0($fp) type with Bool + la $v0, Bool + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -208($fp) + # IF_ZERO local_c2i_at_A2I_internal_51 GOTO label_COMPARE_BY_VALUE_87 + # IF_ZERO local_c2i_at_A2I_internal_51 GOTO label_COMPARE_BY_VALUE_87 + lw $t0, -208($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_87 + # LOCAL local_c2i_at_A2I_internal_51 --> -208($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # Comparing 0($fp) type with Int + la $v0, Int + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -208($fp) + # IF_ZERO local_c2i_at_A2I_internal_51 GOTO label_COMPARE_BY_VALUE_87 + # IF_ZERO local_c2i_at_A2I_internal_51 GOTO label_COMPARE_BY_VALUE_87 + lw $t0, -208($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_87 + # LOCAL local_c2i_at_A2I_internal_51 --> -208($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_52 --> -212($fp) + # Load pointers and SUB + lw $a0, 0($fp) + lw $a1, -212($fp) + sub $a0, $a0, $a1 + sw $a0, -208($fp) + # IF_ZERO local_c2i_at_A2I_internal_51 GOTO label_TRUE_84 + # IF_ZERO local_c2i_at_A2I_internal_51 GOTO label_TRUE_84 + lw $t0, -208($fp) + beq $t0, 0, label_TRUE_84 + # GOTO label_FALSE_83 + j label_FALSE_83 + label_COMPARE_BY_VALUE_87: + # LOCAL local_c2i_at_A2I_internal_51 --> -208($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_52 --> -212($fp) + lw $a0, 0($fp) + lw $a1, -212($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -208($fp) + # IF_ZERO local_c2i_at_A2I_internal_51 GOTO label_TRUE_84 + # IF_ZERO local_c2i_at_A2I_internal_51 GOTO label_TRUE_84 + lw $t0, -208($fp) + beq $t0, 0, label_TRUE_84 + # GOTO label_FALSE_83 + j label_FALSE_83 + label_COMPARE_STRING_86: + # LOCAL local_c2i_at_A2I_internal_51 --> -208($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_52 --> -212($fp) + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -212($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -208($fp) + # IF_ZERO local_c2i_at_A2I_internal_51 GOTO label_CONTINUE_88 + # IF_ZERO local_c2i_at_A2I_internal_51 GOTO label_CONTINUE_88 + lw $t0, -208($fp) + beq $t0, 0, label_CONTINUE_88 + # GOTO label_FALSE_83 + j label_FALSE_83 + label_CONTINUE_88: + # LOCAL local_c2i_at_A2I_internal_51 --> -208($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_52 --> -212($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -212($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_89: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_90 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_89 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_90: + # Store result + sw $a2, -208($fp) + # IF_ZERO local_c2i_at_A2I_internal_51 GOTO label_TRUE_84 + # IF_ZERO local_c2i_at_A2I_internal_51 GOTO label_TRUE_84 + lw $t0, -208($fp) + beq $t0, 0, label_TRUE_84 + label_FALSE_83: + # LOCAL local_c2i_at_A2I_internal_50 --> -204($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -204($fp) + # GOTO label_END_85 +j label_END_85 +label_TRUE_84: + # LOCAL local_c2i_at_A2I_internal_50 --> -204($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -204($fp) + label_END_85: +# LOCAL local_c2i_at_A2I_internal_48 --> -196($fp) +# LOCAL local_c2i_at_A2I_internal_50 --> -204($fp) +# Obtain value from -204($fp) +lw $v0, -204($fp) +lw $v0, 12($v0) +sw $v0, -196($fp) +# IF_ZERO local_c2i_at_A2I_internal_48 GOTO label_FALSEIF_81 +# IF_ZERO local_c2i_at_A2I_internal_48 GOTO label_FALSEIF_81 +lw $t0, -196($fp) +beq $t0, 0, label_FALSEIF_81 +# LOCAL local_c2i_at_A2I_internal_53 --> -216($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 8 +sw $t0, 12($v0) +sw $v0, -216($fp) +# LOCAL local_c2i_at_A2I_internal_49 --> -200($fp) +# LOCAL local_c2i_at_A2I_internal_53 --> -216($fp) +# local_c2i_at_A2I_internal_49 = local_c2i_at_A2I_internal_53 +lw $t0, -216($fp) +sw $t0, -200($fp) +# GOTO label_ENDIF_82 +j label_ENDIF_82 +label_FALSEIF_81: + # LOCAL local_c2i_at_A2I_internal_58 --> -236($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_13 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -236($fp) + # IF_ZERO param_c2i_at_A2I_char_0 GOTO label_FALSE_93 + # IF_ZERO param_c2i_at_A2I_char_0 GOTO label_FALSE_93 + lw $t0, 0($fp) + beq $t0, 0, label_FALSE_93 + # IF_ZERO local_c2i_at_A2I_internal_58 GOTO label_FALSE_93 + # IF_ZERO local_c2i_at_A2I_internal_58 GOTO label_FALSE_93 + lw $t0, -236($fp) + beq $t0, 0, label_FALSE_93 + # LOCAL local_c2i_at_A2I_internal_57 --> -232($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # Comparing 0($fp) type with String + la $v0, String + lw $a0, 0($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -232($fp) + # IF_ZERO local_c2i_at_A2I_internal_57 GOTO label_COMPARE_STRING_96 + # IF_ZERO local_c2i_at_A2I_internal_57 GOTO label_COMPARE_STRING_96 + lw $t0, -232($fp) + beq $t0, 0, label_COMPARE_STRING_96 + # LOCAL local_c2i_at_A2I_internal_57 --> -232($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # Comparing 0($fp) type with Bool + la $v0, Bool + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -232($fp) + # IF_ZERO local_c2i_at_A2I_internal_57 GOTO label_COMPARE_BY_VALUE_97 + # IF_ZERO local_c2i_at_A2I_internal_57 GOTO label_COMPARE_BY_VALUE_97 + lw $t0, -232($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_97 + # LOCAL local_c2i_at_A2I_internal_57 --> -232($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # Comparing 0($fp) type with Int + la $v0, Int + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -232($fp) + # IF_ZERO local_c2i_at_A2I_internal_57 GOTO label_COMPARE_BY_VALUE_97 + # IF_ZERO local_c2i_at_A2I_internal_57 GOTO label_COMPARE_BY_VALUE_97 + lw $t0, -232($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_97 + # LOCAL local_c2i_at_A2I_internal_57 --> -232($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_58 --> -236($fp) + # Load pointers and SUB + lw $a0, 0($fp) + lw $a1, -236($fp) + sub $a0, $a0, $a1 + sw $a0, -232($fp) + # IF_ZERO local_c2i_at_A2I_internal_57 GOTO label_TRUE_94 + # IF_ZERO local_c2i_at_A2I_internal_57 GOTO label_TRUE_94 + lw $t0, -232($fp) + beq $t0, 0, label_TRUE_94 + # GOTO label_FALSE_93 + j label_FALSE_93 + label_COMPARE_BY_VALUE_97: + # LOCAL local_c2i_at_A2I_internal_57 --> -232($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_58 --> -236($fp) + lw $a0, 0($fp) + lw $a1, -236($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -232($fp) + # IF_ZERO local_c2i_at_A2I_internal_57 GOTO label_TRUE_94 + # IF_ZERO local_c2i_at_A2I_internal_57 GOTO label_TRUE_94 + lw $t0, -232($fp) + beq $t0, 0, label_TRUE_94 + # GOTO label_FALSE_93 + j label_FALSE_93 + label_COMPARE_STRING_96: + # LOCAL local_c2i_at_A2I_internal_57 --> -232($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_58 --> -236($fp) + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -236($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -232($fp) + # IF_ZERO local_c2i_at_A2I_internal_57 GOTO label_CONTINUE_98 + # IF_ZERO local_c2i_at_A2I_internal_57 GOTO label_CONTINUE_98 + lw $t0, -232($fp) + beq $t0, 0, label_CONTINUE_98 + # GOTO label_FALSE_93 + j label_FALSE_93 + label_CONTINUE_98: + # LOCAL local_c2i_at_A2I_internal_57 --> -232($fp) + # PARAM param_c2i_at_A2I_char_0 --> 0($fp) + # LOCAL local_c2i_at_A2I_internal_58 --> -236($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -236($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_99: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_100 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_99 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_100: + # Store result + sw $a2, -232($fp) + # IF_ZERO local_c2i_at_A2I_internal_57 GOTO label_TRUE_94 + # IF_ZERO local_c2i_at_A2I_internal_57 GOTO label_TRUE_94 + lw $t0, -232($fp) + beq $t0, 0, label_TRUE_94 + label_FALSE_93: + # LOCAL local_c2i_at_A2I_internal_56 --> -228($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -228($fp) + # GOTO label_END_95 +j label_END_95 +label_TRUE_94: + # LOCAL local_c2i_at_A2I_internal_56 --> -228($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -228($fp) + label_END_95: +# LOCAL local_c2i_at_A2I_internal_54 --> -220($fp) +# LOCAL local_c2i_at_A2I_internal_56 --> -228($fp) +# Obtain value from -228($fp) +lw $v0, -228($fp) +lw $v0, 12($v0) +sw $v0, -220($fp) +# IF_ZERO local_c2i_at_A2I_internal_54 GOTO label_FALSEIF_91 +# IF_ZERO local_c2i_at_A2I_internal_54 GOTO label_FALSEIF_91 +lw $t0, -220($fp) +beq $t0, 0, label_FALSEIF_91 +# LOCAL local_c2i_at_A2I_internal_59 --> -240($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 9 +sw $t0, 12($v0) +sw $v0, -240($fp) +# LOCAL local_c2i_at_A2I_internal_55 --> -224($fp) +# LOCAL local_c2i_at_A2I_internal_59 --> -240($fp) +# local_c2i_at_A2I_internal_55 = local_c2i_at_A2I_internal_59 +lw $t0, -240($fp) +sw $t0, -224($fp) +# GOTO label_ENDIF_92 +j label_ENDIF_92 +label_FALSEIF_91: + # LOCAL local_c2i_at_A2I_internal_62 --> -252($fp) + # local_c2i_at_A2I_internal_62 = SELF + sw $s1, -252($fp) + # LOCAL local_c2i_at_A2I_internal_60 --> -244($fp) + # LOCAL local_c2i_at_A2I_internal_62 --> -252($fp) + # local_c2i_at_A2I_internal_60 = local_c2i_at_A2I_internal_62 + lw $t0, -252($fp) + sw $t0, -244($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_c2i_at_A2I_internal_60 --> -244($fp) + # LOCAL local_c2i_at_A2I_internal_61 --> -248($fp) + # local_c2i_at_A2I_internal_61 = VCALL local_c2i_at_A2I_internal_60 abort + # Save new self pointer in $s1 + lw $s1, -244($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 28($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -248($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_c2i_at_A2I_internal_63 --> -256($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -256($fp) + # LOCAL local_c2i_at_A2I_internal_55 --> -224($fp) + # LOCAL local_c2i_at_A2I_internal_63 --> -256($fp) + # local_c2i_at_A2I_internal_55 = local_c2i_at_A2I_internal_63 + lw $t0, -256($fp) + sw $t0, -224($fp) + label_ENDIF_92: +# LOCAL local_c2i_at_A2I_internal_49 --> -200($fp) +# LOCAL local_c2i_at_A2I_internal_55 --> -224($fp) +# local_c2i_at_A2I_internal_49 = local_c2i_at_A2I_internal_55 +lw $t0, -224($fp) +sw $t0, -200($fp) +label_ENDIF_82: +# LOCAL local_c2i_at_A2I_internal_43 --> -176($fp) +# LOCAL local_c2i_at_A2I_internal_49 --> -200($fp) +# local_c2i_at_A2I_internal_43 = local_c2i_at_A2I_internal_49 +lw $t0, -200($fp) +sw $t0, -176($fp) +label_ENDIF_72: +# LOCAL local_c2i_at_A2I_internal_37 --> -152($fp) +# LOCAL local_c2i_at_A2I_internal_43 --> -176($fp) +# local_c2i_at_A2I_internal_37 = local_c2i_at_A2I_internal_43 +lw $t0, -176($fp) +sw $t0, -152($fp) +label_ENDIF_62: +# LOCAL local_c2i_at_A2I_internal_31 --> -128($fp) +# LOCAL local_c2i_at_A2I_internal_37 --> -152($fp) +# local_c2i_at_A2I_internal_31 = local_c2i_at_A2I_internal_37 +lw $t0, -152($fp) +sw $t0, -128($fp) +label_ENDIF_52: +# LOCAL local_c2i_at_A2I_internal_25 --> -104($fp) +# LOCAL local_c2i_at_A2I_internal_31 --> -128($fp) +# local_c2i_at_A2I_internal_25 = local_c2i_at_A2I_internal_31 +lw $t0, -128($fp) +sw $t0, -104($fp) +label_ENDIF_42: +# LOCAL local_c2i_at_A2I_internal_19 --> -80($fp) +# LOCAL local_c2i_at_A2I_internal_25 --> -104($fp) +# local_c2i_at_A2I_internal_19 = local_c2i_at_A2I_internal_25 +lw $t0, -104($fp) +sw $t0, -80($fp) +label_ENDIF_32: +# LOCAL local_c2i_at_A2I_internal_13 --> -56($fp) +# LOCAL local_c2i_at_A2I_internal_19 --> -80($fp) +# local_c2i_at_A2I_internal_13 = local_c2i_at_A2I_internal_19 +lw $t0, -80($fp) +sw $t0, -56($fp) +label_ENDIF_22: +# LOCAL local_c2i_at_A2I_internal_7 --> -32($fp) +# LOCAL local_c2i_at_A2I_internal_13 --> -56($fp) +# local_c2i_at_A2I_internal_7 = local_c2i_at_A2I_internal_13 +lw $t0, -56($fp) +sw $t0, -32($fp) +label_ENDIF_12: +# LOCAL local_c2i_at_A2I_internal_1 --> -8($fp) +# LOCAL local_c2i_at_A2I_internal_7 --> -32($fp) +# local_c2i_at_A2I_internal_1 = local_c2i_at_A2I_internal_7 +lw $t0, -32($fp) +sw $t0, -8($fp) +label_ENDIF_2: +# RETURN local_c2i_at_A2I_internal_1 +lw $v0, -8($fp) +# Deallocate stack frame for function function_c2i_at_A2I. +# Restore $ra +lw $ra, 4($sp) +# Restore $fp +lw $fp, 0($sp) +# Restore Stack pointer $sp +addu $sp, $sp, 264 +# Deallocate function args +addu $sp, $sp, 4 +jr $ra +# Function END + + +# function_i2c_at_A2I implementation. +# @Params: +# 0($fp) = param_i2c_at_A2I_i_0 +function_i2c_at_A2I: + # Allocate stack frame for function function_i2c_at_A2I. + subu $sp, $sp, 264 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 264 + # LOCAL local_i2c_at_A2I_internal_4 --> -20($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -20($fp) + # IF_ZERO param_i2c_at_A2I_i_0 GOTO label_FALSE_103 + # IF_ZERO param_i2c_at_A2I_i_0 GOTO label_FALSE_103 + lw $t0, 0($fp) + beq $t0, 0, label_FALSE_103 + # IF_ZERO local_i2c_at_A2I_internal_4 GOTO label_FALSE_103 + # IF_ZERO local_i2c_at_A2I_internal_4 GOTO label_FALSE_103 + lw $t0, -20($fp) + beq $t0, 0, label_FALSE_103 + # LOCAL local_i2c_at_A2I_internal_3 --> -16($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with String + la $v0, String + lw $a0, 0($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -16($fp) + # IF_ZERO local_i2c_at_A2I_internal_3 GOTO label_COMPARE_STRING_106 + # IF_ZERO local_i2c_at_A2I_internal_3 GOTO label_COMPARE_STRING_106 + lw $t0, -16($fp) + beq $t0, 0, label_COMPARE_STRING_106 + # LOCAL local_i2c_at_A2I_internal_3 --> -16($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with Bool + la $v0, Bool + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -16($fp) + # IF_ZERO local_i2c_at_A2I_internal_3 GOTO label_COMPARE_BY_VALUE_107 + # IF_ZERO local_i2c_at_A2I_internal_3 GOTO label_COMPARE_BY_VALUE_107 + lw $t0, -16($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_107 + # LOCAL local_i2c_at_A2I_internal_3 --> -16($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with Int + la $v0, Int + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -16($fp) + # IF_ZERO local_i2c_at_A2I_internal_3 GOTO label_COMPARE_BY_VALUE_107 + # IF_ZERO local_i2c_at_A2I_internal_3 GOTO label_COMPARE_BY_VALUE_107 + lw $t0, -16($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_107 + # LOCAL local_i2c_at_A2I_internal_3 --> -16($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_4 --> -20($fp) + # Load pointers and SUB + lw $a0, 0($fp) + lw $a1, -20($fp) + sub $a0, $a0, $a1 + sw $a0, -16($fp) + # IF_ZERO local_i2c_at_A2I_internal_3 GOTO label_TRUE_104 + # IF_ZERO local_i2c_at_A2I_internal_3 GOTO label_TRUE_104 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_104 + # GOTO label_FALSE_103 + j label_FALSE_103 + label_COMPARE_BY_VALUE_107: + # LOCAL local_i2c_at_A2I_internal_3 --> -16($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_4 --> -20($fp) + lw $a0, 0($fp) + lw $a1, -20($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -16($fp) + # IF_ZERO local_i2c_at_A2I_internal_3 GOTO label_TRUE_104 + # IF_ZERO local_i2c_at_A2I_internal_3 GOTO label_TRUE_104 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_104 + # GOTO label_FALSE_103 + j label_FALSE_103 + label_COMPARE_STRING_106: + # LOCAL local_i2c_at_A2I_internal_3 --> -16($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_4 --> -20($fp) + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -20($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -16($fp) + # IF_ZERO local_i2c_at_A2I_internal_3 GOTO label_CONTINUE_108 + # IF_ZERO local_i2c_at_A2I_internal_3 GOTO label_CONTINUE_108 + lw $t0, -16($fp) + beq $t0, 0, label_CONTINUE_108 + # GOTO label_FALSE_103 + j label_FALSE_103 + label_CONTINUE_108: + # LOCAL local_i2c_at_A2I_internal_3 --> -16($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_4 --> -20($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -20($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_109: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_110 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_109 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_110: + # Store result + sw $a2, -16($fp) + # IF_ZERO local_i2c_at_A2I_internal_3 GOTO label_TRUE_104 + # IF_ZERO local_i2c_at_A2I_internal_3 GOTO label_TRUE_104 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_104 + label_FALSE_103: + # LOCAL local_i2c_at_A2I_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -12($fp) + # GOTO label_END_105 +j label_END_105 +label_TRUE_104: + # LOCAL local_i2c_at_A2I_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -12($fp) + label_END_105: +# LOCAL local_i2c_at_A2I_internal_0 --> -4($fp) +# LOCAL local_i2c_at_A2I_internal_2 --> -12($fp) +# Obtain value from -12($fp) +lw $v0, -12($fp) +lw $v0, 12($v0) +sw $v0, -4($fp) +# IF_ZERO local_i2c_at_A2I_internal_0 GOTO label_FALSEIF_101 +# IF_ZERO local_i2c_at_A2I_internal_0 GOTO label_FALSEIF_101 +lw $t0, -4($fp) +beq $t0, 0, label_FALSEIF_101 +# LOCAL local_i2c_at_A2I_internal_5 --> -24($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_14 +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +sw $v0, -24($fp) +# LOCAL local_i2c_at_A2I_internal_1 --> -8($fp) +# LOCAL local_i2c_at_A2I_internal_5 --> -24($fp) +# local_i2c_at_A2I_internal_1 = local_i2c_at_A2I_internal_5 +lw $t0, -24($fp) +sw $t0, -8($fp) +# GOTO label_ENDIF_102 +j label_ENDIF_102 +label_FALSEIF_101: + # LOCAL local_i2c_at_A2I_internal_10 --> -44($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -44($fp) + # IF_ZERO param_i2c_at_A2I_i_0 GOTO label_FALSE_113 + # IF_ZERO param_i2c_at_A2I_i_0 GOTO label_FALSE_113 + lw $t0, 0($fp) + beq $t0, 0, label_FALSE_113 + # IF_ZERO local_i2c_at_A2I_internal_10 GOTO label_FALSE_113 + # IF_ZERO local_i2c_at_A2I_internal_10 GOTO label_FALSE_113 + lw $t0, -44($fp) + beq $t0, 0, label_FALSE_113 + # LOCAL local_i2c_at_A2I_internal_9 --> -40($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with String + la $v0, String + lw $a0, 0($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -40($fp) + # IF_ZERO local_i2c_at_A2I_internal_9 GOTO label_COMPARE_STRING_116 + # IF_ZERO local_i2c_at_A2I_internal_9 GOTO label_COMPARE_STRING_116 + lw $t0, -40($fp) + beq $t0, 0, label_COMPARE_STRING_116 + # LOCAL local_i2c_at_A2I_internal_9 --> -40($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with Bool + la $v0, Bool + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -40($fp) + # IF_ZERO local_i2c_at_A2I_internal_9 GOTO label_COMPARE_BY_VALUE_117 + # IF_ZERO local_i2c_at_A2I_internal_9 GOTO label_COMPARE_BY_VALUE_117 + lw $t0, -40($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_117 + # LOCAL local_i2c_at_A2I_internal_9 --> -40($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with Int + la $v0, Int + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -40($fp) + # IF_ZERO local_i2c_at_A2I_internal_9 GOTO label_COMPARE_BY_VALUE_117 + # IF_ZERO local_i2c_at_A2I_internal_9 GOTO label_COMPARE_BY_VALUE_117 + lw $t0, -40($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_117 + # LOCAL local_i2c_at_A2I_internal_9 --> -40($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_10 --> -44($fp) + # Load pointers and SUB + lw $a0, 0($fp) + lw $a1, -44($fp) + sub $a0, $a0, $a1 + sw $a0, -40($fp) + # IF_ZERO local_i2c_at_A2I_internal_9 GOTO label_TRUE_114 + # IF_ZERO local_i2c_at_A2I_internal_9 GOTO label_TRUE_114 + lw $t0, -40($fp) + beq $t0, 0, label_TRUE_114 + # GOTO label_FALSE_113 + j label_FALSE_113 + label_COMPARE_BY_VALUE_117: + # LOCAL local_i2c_at_A2I_internal_9 --> -40($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_10 --> -44($fp) + lw $a0, 0($fp) + lw $a1, -44($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -40($fp) + # IF_ZERO local_i2c_at_A2I_internal_9 GOTO label_TRUE_114 + # IF_ZERO local_i2c_at_A2I_internal_9 GOTO label_TRUE_114 + lw $t0, -40($fp) + beq $t0, 0, label_TRUE_114 + # GOTO label_FALSE_113 + j label_FALSE_113 + label_COMPARE_STRING_116: + # LOCAL local_i2c_at_A2I_internal_9 --> -40($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_10 --> -44($fp) + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -44($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -40($fp) + # IF_ZERO local_i2c_at_A2I_internal_9 GOTO label_CONTINUE_118 + # IF_ZERO local_i2c_at_A2I_internal_9 GOTO label_CONTINUE_118 + lw $t0, -40($fp) + beq $t0, 0, label_CONTINUE_118 + # GOTO label_FALSE_113 + j label_FALSE_113 + label_CONTINUE_118: + # LOCAL local_i2c_at_A2I_internal_9 --> -40($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_10 --> -44($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -44($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_119: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_120 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_119 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_120: + # Store result + sw $a2, -40($fp) + # IF_ZERO local_i2c_at_A2I_internal_9 GOTO label_TRUE_114 + # IF_ZERO local_i2c_at_A2I_internal_9 GOTO label_TRUE_114 + lw $t0, -40($fp) + beq $t0, 0, label_TRUE_114 + label_FALSE_113: + # LOCAL local_i2c_at_A2I_internal_8 --> -36($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -36($fp) + # GOTO label_END_115 +j label_END_115 +label_TRUE_114: + # LOCAL local_i2c_at_A2I_internal_8 --> -36($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -36($fp) + label_END_115: +# LOCAL local_i2c_at_A2I_internal_6 --> -28($fp) +# LOCAL local_i2c_at_A2I_internal_8 --> -36($fp) +# Obtain value from -36($fp) +lw $v0, -36($fp) +lw $v0, 12($v0) +sw $v0, -28($fp) +# IF_ZERO local_i2c_at_A2I_internal_6 GOTO label_FALSEIF_111 +# IF_ZERO local_i2c_at_A2I_internal_6 GOTO label_FALSEIF_111 +lw $t0, -28($fp) +beq $t0, 0, label_FALSEIF_111 +# LOCAL local_i2c_at_A2I_internal_11 --> -48($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_15 +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +sw $v0, -48($fp) +# LOCAL local_i2c_at_A2I_internal_7 --> -32($fp) +# LOCAL local_i2c_at_A2I_internal_11 --> -48($fp) +# local_i2c_at_A2I_internal_7 = local_i2c_at_A2I_internal_11 +lw $t0, -48($fp) +sw $t0, -32($fp) +# GOTO label_ENDIF_112 +j label_ENDIF_112 +label_FALSEIF_111: + # LOCAL local_i2c_at_A2I_internal_16 --> -68($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 2 + sw $t0, 12($v0) + sw $v0, -68($fp) + # IF_ZERO param_i2c_at_A2I_i_0 GOTO label_FALSE_123 + # IF_ZERO param_i2c_at_A2I_i_0 GOTO label_FALSE_123 + lw $t0, 0($fp) + beq $t0, 0, label_FALSE_123 + # IF_ZERO local_i2c_at_A2I_internal_16 GOTO label_FALSE_123 + # IF_ZERO local_i2c_at_A2I_internal_16 GOTO label_FALSE_123 + lw $t0, -68($fp) + beq $t0, 0, label_FALSE_123 + # LOCAL local_i2c_at_A2I_internal_15 --> -64($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with String + la $v0, String + lw $a0, 0($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -64($fp) + # IF_ZERO local_i2c_at_A2I_internal_15 GOTO label_COMPARE_STRING_126 + # IF_ZERO local_i2c_at_A2I_internal_15 GOTO label_COMPARE_STRING_126 + lw $t0, -64($fp) + beq $t0, 0, label_COMPARE_STRING_126 + # LOCAL local_i2c_at_A2I_internal_15 --> -64($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with Bool + la $v0, Bool + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -64($fp) + # IF_ZERO local_i2c_at_A2I_internal_15 GOTO label_COMPARE_BY_VALUE_127 + # IF_ZERO local_i2c_at_A2I_internal_15 GOTO label_COMPARE_BY_VALUE_127 + lw $t0, -64($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_127 + # LOCAL local_i2c_at_A2I_internal_15 --> -64($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with Int + la $v0, Int + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -64($fp) + # IF_ZERO local_i2c_at_A2I_internal_15 GOTO label_COMPARE_BY_VALUE_127 + # IF_ZERO local_i2c_at_A2I_internal_15 GOTO label_COMPARE_BY_VALUE_127 + lw $t0, -64($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_127 + # LOCAL local_i2c_at_A2I_internal_15 --> -64($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_16 --> -68($fp) + # Load pointers and SUB + lw $a0, 0($fp) + lw $a1, -68($fp) + sub $a0, $a0, $a1 + sw $a0, -64($fp) + # IF_ZERO local_i2c_at_A2I_internal_15 GOTO label_TRUE_124 + # IF_ZERO local_i2c_at_A2I_internal_15 GOTO label_TRUE_124 + lw $t0, -64($fp) + beq $t0, 0, label_TRUE_124 + # GOTO label_FALSE_123 + j label_FALSE_123 + label_COMPARE_BY_VALUE_127: + # LOCAL local_i2c_at_A2I_internal_15 --> -64($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_16 --> -68($fp) + lw $a0, 0($fp) + lw $a1, -68($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -64($fp) + # IF_ZERO local_i2c_at_A2I_internal_15 GOTO label_TRUE_124 + # IF_ZERO local_i2c_at_A2I_internal_15 GOTO label_TRUE_124 + lw $t0, -64($fp) + beq $t0, 0, label_TRUE_124 + # GOTO label_FALSE_123 + j label_FALSE_123 + label_COMPARE_STRING_126: + # LOCAL local_i2c_at_A2I_internal_15 --> -64($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_16 --> -68($fp) + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -68($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -64($fp) + # IF_ZERO local_i2c_at_A2I_internal_15 GOTO label_CONTINUE_128 + # IF_ZERO local_i2c_at_A2I_internal_15 GOTO label_CONTINUE_128 + lw $t0, -64($fp) + beq $t0, 0, label_CONTINUE_128 + # GOTO label_FALSE_123 + j label_FALSE_123 + label_CONTINUE_128: + # LOCAL local_i2c_at_A2I_internal_15 --> -64($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_16 --> -68($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -68($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_129: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_130 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_129 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_130: + # Store result + sw $a2, -64($fp) + # IF_ZERO local_i2c_at_A2I_internal_15 GOTO label_TRUE_124 + # IF_ZERO local_i2c_at_A2I_internal_15 GOTO label_TRUE_124 + lw $t0, -64($fp) + beq $t0, 0, label_TRUE_124 + label_FALSE_123: + # LOCAL local_i2c_at_A2I_internal_14 --> -60($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -60($fp) + # GOTO label_END_125 +j label_END_125 +label_TRUE_124: + # LOCAL local_i2c_at_A2I_internal_14 --> -60($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -60($fp) + label_END_125: +# LOCAL local_i2c_at_A2I_internal_12 --> -52($fp) +# LOCAL local_i2c_at_A2I_internal_14 --> -60($fp) +# Obtain value from -60($fp) +lw $v0, -60($fp) +lw $v0, 12($v0) +sw $v0, -52($fp) +# IF_ZERO local_i2c_at_A2I_internal_12 GOTO label_FALSEIF_121 +# IF_ZERO local_i2c_at_A2I_internal_12 GOTO label_FALSEIF_121 +lw $t0, -52($fp) +beq $t0, 0, label_FALSEIF_121 +# LOCAL local_i2c_at_A2I_internal_17 --> -72($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_16 +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +sw $v0, -72($fp) +# LOCAL local_i2c_at_A2I_internal_13 --> -56($fp) +# LOCAL local_i2c_at_A2I_internal_17 --> -72($fp) +# local_i2c_at_A2I_internal_13 = local_i2c_at_A2I_internal_17 +lw $t0, -72($fp) +sw $t0, -56($fp) +# GOTO label_ENDIF_122 +j label_ENDIF_122 +label_FALSEIF_121: + # LOCAL local_i2c_at_A2I_internal_22 --> -92($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 3 + sw $t0, 12($v0) + sw $v0, -92($fp) + # IF_ZERO param_i2c_at_A2I_i_0 GOTO label_FALSE_133 + # IF_ZERO param_i2c_at_A2I_i_0 GOTO label_FALSE_133 + lw $t0, 0($fp) + beq $t0, 0, label_FALSE_133 + # IF_ZERO local_i2c_at_A2I_internal_22 GOTO label_FALSE_133 + # IF_ZERO local_i2c_at_A2I_internal_22 GOTO label_FALSE_133 + lw $t0, -92($fp) + beq $t0, 0, label_FALSE_133 + # LOCAL local_i2c_at_A2I_internal_21 --> -88($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with String + la $v0, String + lw $a0, 0($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -88($fp) + # IF_ZERO local_i2c_at_A2I_internal_21 GOTO label_COMPARE_STRING_136 + # IF_ZERO local_i2c_at_A2I_internal_21 GOTO label_COMPARE_STRING_136 + lw $t0, -88($fp) + beq $t0, 0, label_COMPARE_STRING_136 + # LOCAL local_i2c_at_A2I_internal_21 --> -88($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with Bool + la $v0, Bool + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -88($fp) + # IF_ZERO local_i2c_at_A2I_internal_21 GOTO label_COMPARE_BY_VALUE_137 + # IF_ZERO local_i2c_at_A2I_internal_21 GOTO label_COMPARE_BY_VALUE_137 + lw $t0, -88($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_137 + # LOCAL local_i2c_at_A2I_internal_21 --> -88($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with Int + la $v0, Int + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -88($fp) + # IF_ZERO local_i2c_at_A2I_internal_21 GOTO label_COMPARE_BY_VALUE_137 + # IF_ZERO local_i2c_at_A2I_internal_21 GOTO label_COMPARE_BY_VALUE_137 + lw $t0, -88($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_137 + # LOCAL local_i2c_at_A2I_internal_21 --> -88($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_22 --> -92($fp) + # Load pointers and SUB + lw $a0, 0($fp) + lw $a1, -92($fp) + sub $a0, $a0, $a1 + sw $a0, -88($fp) + # IF_ZERO local_i2c_at_A2I_internal_21 GOTO label_TRUE_134 + # IF_ZERO local_i2c_at_A2I_internal_21 GOTO label_TRUE_134 + lw $t0, -88($fp) + beq $t0, 0, label_TRUE_134 + # GOTO label_FALSE_133 + j label_FALSE_133 + label_COMPARE_BY_VALUE_137: + # LOCAL local_i2c_at_A2I_internal_21 --> -88($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_22 --> -92($fp) + lw $a0, 0($fp) + lw $a1, -92($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -88($fp) + # IF_ZERO local_i2c_at_A2I_internal_21 GOTO label_TRUE_134 + # IF_ZERO local_i2c_at_A2I_internal_21 GOTO label_TRUE_134 + lw $t0, -88($fp) + beq $t0, 0, label_TRUE_134 + # GOTO label_FALSE_133 + j label_FALSE_133 + label_COMPARE_STRING_136: + # LOCAL local_i2c_at_A2I_internal_21 --> -88($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_22 --> -92($fp) + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -92($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -88($fp) + # IF_ZERO local_i2c_at_A2I_internal_21 GOTO label_CONTINUE_138 + # IF_ZERO local_i2c_at_A2I_internal_21 GOTO label_CONTINUE_138 + lw $t0, -88($fp) + beq $t0, 0, label_CONTINUE_138 + # GOTO label_FALSE_133 + j label_FALSE_133 + label_CONTINUE_138: + # LOCAL local_i2c_at_A2I_internal_21 --> -88($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_22 --> -92($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -92($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_139: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_140 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_139 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_140: + # Store result + sw $a2, -88($fp) + # IF_ZERO local_i2c_at_A2I_internal_21 GOTO label_TRUE_134 + # IF_ZERO local_i2c_at_A2I_internal_21 GOTO label_TRUE_134 + lw $t0, -88($fp) + beq $t0, 0, label_TRUE_134 + label_FALSE_133: + # LOCAL local_i2c_at_A2I_internal_20 --> -84($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -84($fp) + # GOTO label_END_135 +j label_END_135 +label_TRUE_134: + # LOCAL local_i2c_at_A2I_internal_20 --> -84($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -84($fp) + label_END_135: +# LOCAL local_i2c_at_A2I_internal_18 --> -76($fp) +# LOCAL local_i2c_at_A2I_internal_20 --> -84($fp) +# Obtain value from -84($fp) +lw $v0, -84($fp) +lw $v0, 12($v0) +sw $v0, -76($fp) +# IF_ZERO local_i2c_at_A2I_internal_18 GOTO label_FALSEIF_131 +# IF_ZERO local_i2c_at_A2I_internal_18 GOTO label_FALSEIF_131 +lw $t0, -76($fp) +beq $t0, 0, label_FALSEIF_131 +# LOCAL local_i2c_at_A2I_internal_23 --> -96($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_17 +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +sw $v0, -96($fp) +# LOCAL local_i2c_at_A2I_internal_19 --> -80($fp) +# LOCAL local_i2c_at_A2I_internal_23 --> -96($fp) +# local_i2c_at_A2I_internal_19 = local_i2c_at_A2I_internal_23 +lw $t0, -96($fp) +sw $t0, -80($fp) +# GOTO label_ENDIF_132 +j label_ENDIF_132 +label_FALSEIF_131: + # LOCAL local_i2c_at_A2I_internal_28 --> -116($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 4 + sw $t0, 12($v0) + sw $v0, -116($fp) + # IF_ZERO param_i2c_at_A2I_i_0 GOTO label_FALSE_143 + # IF_ZERO param_i2c_at_A2I_i_0 GOTO label_FALSE_143 + lw $t0, 0($fp) + beq $t0, 0, label_FALSE_143 + # IF_ZERO local_i2c_at_A2I_internal_28 GOTO label_FALSE_143 + # IF_ZERO local_i2c_at_A2I_internal_28 GOTO label_FALSE_143 + lw $t0, -116($fp) + beq $t0, 0, label_FALSE_143 + # LOCAL local_i2c_at_A2I_internal_27 --> -112($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with String + la $v0, String + lw $a0, 0($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -112($fp) + # IF_ZERO local_i2c_at_A2I_internal_27 GOTO label_COMPARE_STRING_146 + # IF_ZERO local_i2c_at_A2I_internal_27 GOTO label_COMPARE_STRING_146 + lw $t0, -112($fp) + beq $t0, 0, label_COMPARE_STRING_146 + # LOCAL local_i2c_at_A2I_internal_27 --> -112($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with Bool + la $v0, Bool + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -112($fp) + # IF_ZERO local_i2c_at_A2I_internal_27 GOTO label_COMPARE_BY_VALUE_147 + # IF_ZERO local_i2c_at_A2I_internal_27 GOTO label_COMPARE_BY_VALUE_147 + lw $t0, -112($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_147 + # LOCAL local_i2c_at_A2I_internal_27 --> -112($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with Int + la $v0, Int + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -112($fp) + # IF_ZERO local_i2c_at_A2I_internal_27 GOTO label_COMPARE_BY_VALUE_147 + # IF_ZERO local_i2c_at_A2I_internal_27 GOTO label_COMPARE_BY_VALUE_147 + lw $t0, -112($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_147 + # LOCAL local_i2c_at_A2I_internal_27 --> -112($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_28 --> -116($fp) + # Load pointers and SUB + lw $a0, 0($fp) + lw $a1, -116($fp) + sub $a0, $a0, $a1 + sw $a0, -112($fp) + # IF_ZERO local_i2c_at_A2I_internal_27 GOTO label_TRUE_144 + # IF_ZERO local_i2c_at_A2I_internal_27 GOTO label_TRUE_144 + lw $t0, -112($fp) + beq $t0, 0, label_TRUE_144 + # GOTO label_FALSE_143 + j label_FALSE_143 + label_COMPARE_BY_VALUE_147: + # LOCAL local_i2c_at_A2I_internal_27 --> -112($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_28 --> -116($fp) + lw $a0, 0($fp) + lw $a1, -116($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -112($fp) + # IF_ZERO local_i2c_at_A2I_internal_27 GOTO label_TRUE_144 + # IF_ZERO local_i2c_at_A2I_internal_27 GOTO label_TRUE_144 + lw $t0, -112($fp) + beq $t0, 0, label_TRUE_144 + # GOTO label_FALSE_143 + j label_FALSE_143 + label_COMPARE_STRING_146: + # LOCAL local_i2c_at_A2I_internal_27 --> -112($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_28 --> -116($fp) + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -116($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -112($fp) + # IF_ZERO local_i2c_at_A2I_internal_27 GOTO label_CONTINUE_148 + # IF_ZERO local_i2c_at_A2I_internal_27 GOTO label_CONTINUE_148 + lw $t0, -112($fp) + beq $t0, 0, label_CONTINUE_148 + # GOTO label_FALSE_143 + j label_FALSE_143 + label_CONTINUE_148: + # LOCAL local_i2c_at_A2I_internal_27 --> -112($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_28 --> -116($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -116($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_149: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_150 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_149 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_150: + # Store result + sw $a2, -112($fp) + # IF_ZERO local_i2c_at_A2I_internal_27 GOTO label_TRUE_144 + # IF_ZERO local_i2c_at_A2I_internal_27 GOTO label_TRUE_144 + lw $t0, -112($fp) + beq $t0, 0, label_TRUE_144 + label_FALSE_143: + # LOCAL local_i2c_at_A2I_internal_26 --> -108($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -108($fp) + # GOTO label_END_145 +j label_END_145 +label_TRUE_144: + # LOCAL local_i2c_at_A2I_internal_26 --> -108($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -108($fp) + label_END_145: +# LOCAL local_i2c_at_A2I_internal_24 --> -100($fp) +# LOCAL local_i2c_at_A2I_internal_26 --> -108($fp) +# Obtain value from -108($fp) +lw $v0, -108($fp) +lw $v0, 12($v0) +sw $v0, -100($fp) +# IF_ZERO local_i2c_at_A2I_internal_24 GOTO label_FALSEIF_141 +# IF_ZERO local_i2c_at_A2I_internal_24 GOTO label_FALSEIF_141 +lw $t0, -100($fp) +beq $t0, 0, label_FALSEIF_141 +# LOCAL local_i2c_at_A2I_internal_29 --> -120($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_18 +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +sw $v0, -120($fp) +# LOCAL local_i2c_at_A2I_internal_25 --> -104($fp) +# LOCAL local_i2c_at_A2I_internal_29 --> -120($fp) +# local_i2c_at_A2I_internal_25 = local_i2c_at_A2I_internal_29 +lw $t0, -120($fp) +sw $t0, -104($fp) +# GOTO label_ENDIF_142 +j label_ENDIF_142 +label_FALSEIF_141: + # LOCAL local_i2c_at_A2I_internal_34 --> -140($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 5 + sw $t0, 12($v0) + sw $v0, -140($fp) + # IF_ZERO param_i2c_at_A2I_i_0 GOTO label_FALSE_153 + # IF_ZERO param_i2c_at_A2I_i_0 GOTO label_FALSE_153 + lw $t0, 0($fp) + beq $t0, 0, label_FALSE_153 + # IF_ZERO local_i2c_at_A2I_internal_34 GOTO label_FALSE_153 + # IF_ZERO local_i2c_at_A2I_internal_34 GOTO label_FALSE_153 + lw $t0, -140($fp) + beq $t0, 0, label_FALSE_153 + # LOCAL local_i2c_at_A2I_internal_33 --> -136($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with String + la $v0, String + lw $a0, 0($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -136($fp) + # IF_ZERO local_i2c_at_A2I_internal_33 GOTO label_COMPARE_STRING_156 + # IF_ZERO local_i2c_at_A2I_internal_33 GOTO label_COMPARE_STRING_156 + lw $t0, -136($fp) + beq $t0, 0, label_COMPARE_STRING_156 + # LOCAL local_i2c_at_A2I_internal_33 --> -136($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with Bool + la $v0, Bool + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -136($fp) + # IF_ZERO local_i2c_at_A2I_internal_33 GOTO label_COMPARE_BY_VALUE_157 + # IF_ZERO local_i2c_at_A2I_internal_33 GOTO label_COMPARE_BY_VALUE_157 + lw $t0, -136($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_157 + # LOCAL local_i2c_at_A2I_internal_33 --> -136($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with Int + la $v0, Int + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -136($fp) + # IF_ZERO local_i2c_at_A2I_internal_33 GOTO label_COMPARE_BY_VALUE_157 + # IF_ZERO local_i2c_at_A2I_internal_33 GOTO label_COMPARE_BY_VALUE_157 + lw $t0, -136($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_157 + # LOCAL local_i2c_at_A2I_internal_33 --> -136($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_34 --> -140($fp) + # Load pointers and SUB + lw $a0, 0($fp) + lw $a1, -140($fp) + sub $a0, $a0, $a1 + sw $a0, -136($fp) + # IF_ZERO local_i2c_at_A2I_internal_33 GOTO label_TRUE_154 + # IF_ZERO local_i2c_at_A2I_internal_33 GOTO label_TRUE_154 + lw $t0, -136($fp) + beq $t0, 0, label_TRUE_154 + # GOTO label_FALSE_153 + j label_FALSE_153 + label_COMPARE_BY_VALUE_157: + # LOCAL local_i2c_at_A2I_internal_33 --> -136($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_34 --> -140($fp) + lw $a0, 0($fp) + lw $a1, -140($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -136($fp) + # IF_ZERO local_i2c_at_A2I_internal_33 GOTO label_TRUE_154 + # IF_ZERO local_i2c_at_A2I_internal_33 GOTO label_TRUE_154 + lw $t0, -136($fp) + beq $t0, 0, label_TRUE_154 + # GOTO label_FALSE_153 + j label_FALSE_153 + label_COMPARE_STRING_156: + # LOCAL local_i2c_at_A2I_internal_33 --> -136($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_34 --> -140($fp) + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -140($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -136($fp) + # IF_ZERO local_i2c_at_A2I_internal_33 GOTO label_CONTINUE_158 + # IF_ZERO local_i2c_at_A2I_internal_33 GOTO label_CONTINUE_158 + lw $t0, -136($fp) + beq $t0, 0, label_CONTINUE_158 + # GOTO label_FALSE_153 + j label_FALSE_153 + label_CONTINUE_158: + # LOCAL local_i2c_at_A2I_internal_33 --> -136($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_34 --> -140($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -140($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_159: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_160 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_159 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_160: + # Store result + sw $a2, -136($fp) + # IF_ZERO local_i2c_at_A2I_internal_33 GOTO label_TRUE_154 + # IF_ZERO local_i2c_at_A2I_internal_33 GOTO label_TRUE_154 + lw $t0, -136($fp) + beq $t0, 0, label_TRUE_154 + label_FALSE_153: + # LOCAL local_i2c_at_A2I_internal_32 --> -132($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -132($fp) + # GOTO label_END_155 +j label_END_155 +label_TRUE_154: + # LOCAL local_i2c_at_A2I_internal_32 --> -132($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -132($fp) + label_END_155: +# LOCAL local_i2c_at_A2I_internal_30 --> -124($fp) +# LOCAL local_i2c_at_A2I_internal_32 --> -132($fp) +# Obtain value from -132($fp) +lw $v0, -132($fp) +lw $v0, 12($v0) +sw $v0, -124($fp) +# IF_ZERO local_i2c_at_A2I_internal_30 GOTO label_FALSEIF_151 +# IF_ZERO local_i2c_at_A2I_internal_30 GOTO label_FALSEIF_151 +lw $t0, -124($fp) +beq $t0, 0, label_FALSEIF_151 +# LOCAL local_i2c_at_A2I_internal_35 --> -144($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_19 +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +sw $v0, -144($fp) +# LOCAL local_i2c_at_A2I_internal_31 --> -128($fp) +# LOCAL local_i2c_at_A2I_internal_35 --> -144($fp) +# local_i2c_at_A2I_internal_31 = local_i2c_at_A2I_internal_35 +lw $t0, -144($fp) +sw $t0, -128($fp) +# GOTO label_ENDIF_152 +j label_ENDIF_152 +label_FALSEIF_151: + # LOCAL local_i2c_at_A2I_internal_40 --> -164($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 6 + sw $t0, 12($v0) + sw $v0, -164($fp) + # IF_ZERO param_i2c_at_A2I_i_0 GOTO label_FALSE_163 + # IF_ZERO param_i2c_at_A2I_i_0 GOTO label_FALSE_163 + lw $t0, 0($fp) + beq $t0, 0, label_FALSE_163 + # IF_ZERO local_i2c_at_A2I_internal_40 GOTO label_FALSE_163 + # IF_ZERO local_i2c_at_A2I_internal_40 GOTO label_FALSE_163 + lw $t0, -164($fp) + beq $t0, 0, label_FALSE_163 + # LOCAL local_i2c_at_A2I_internal_39 --> -160($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with String + la $v0, String + lw $a0, 0($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -160($fp) + # IF_ZERO local_i2c_at_A2I_internal_39 GOTO label_COMPARE_STRING_166 + # IF_ZERO local_i2c_at_A2I_internal_39 GOTO label_COMPARE_STRING_166 + lw $t0, -160($fp) + beq $t0, 0, label_COMPARE_STRING_166 + # LOCAL local_i2c_at_A2I_internal_39 --> -160($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with Bool + la $v0, Bool + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -160($fp) + # IF_ZERO local_i2c_at_A2I_internal_39 GOTO label_COMPARE_BY_VALUE_167 + # IF_ZERO local_i2c_at_A2I_internal_39 GOTO label_COMPARE_BY_VALUE_167 + lw $t0, -160($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_167 + # LOCAL local_i2c_at_A2I_internal_39 --> -160($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with Int + la $v0, Int + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -160($fp) + # IF_ZERO local_i2c_at_A2I_internal_39 GOTO label_COMPARE_BY_VALUE_167 + # IF_ZERO local_i2c_at_A2I_internal_39 GOTO label_COMPARE_BY_VALUE_167 + lw $t0, -160($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_167 + # LOCAL local_i2c_at_A2I_internal_39 --> -160($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_40 --> -164($fp) + # Load pointers and SUB + lw $a0, 0($fp) + lw $a1, -164($fp) + sub $a0, $a0, $a1 + sw $a0, -160($fp) + # IF_ZERO local_i2c_at_A2I_internal_39 GOTO label_TRUE_164 + # IF_ZERO local_i2c_at_A2I_internal_39 GOTO label_TRUE_164 + lw $t0, -160($fp) + beq $t0, 0, label_TRUE_164 + # GOTO label_FALSE_163 + j label_FALSE_163 + label_COMPARE_BY_VALUE_167: + # LOCAL local_i2c_at_A2I_internal_39 --> -160($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_40 --> -164($fp) + lw $a0, 0($fp) + lw $a1, -164($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -160($fp) + # IF_ZERO local_i2c_at_A2I_internal_39 GOTO label_TRUE_164 + # IF_ZERO local_i2c_at_A2I_internal_39 GOTO label_TRUE_164 + lw $t0, -160($fp) + beq $t0, 0, label_TRUE_164 + # GOTO label_FALSE_163 + j label_FALSE_163 + label_COMPARE_STRING_166: + # LOCAL local_i2c_at_A2I_internal_39 --> -160($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_40 --> -164($fp) + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -164($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -160($fp) + # IF_ZERO local_i2c_at_A2I_internal_39 GOTO label_CONTINUE_168 + # IF_ZERO local_i2c_at_A2I_internal_39 GOTO label_CONTINUE_168 + lw $t0, -160($fp) + beq $t0, 0, label_CONTINUE_168 + # GOTO label_FALSE_163 + j label_FALSE_163 + label_CONTINUE_168: + # LOCAL local_i2c_at_A2I_internal_39 --> -160($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_40 --> -164($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -164($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_169: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_170 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_169 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_170: + # Store result + sw $a2, -160($fp) + # IF_ZERO local_i2c_at_A2I_internal_39 GOTO label_TRUE_164 + # IF_ZERO local_i2c_at_A2I_internal_39 GOTO label_TRUE_164 + lw $t0, -160($fp) + beq $t0, 0, label_TRUE_164 + label_FALSE_163: + # LOCAL local_i2c_at_A2I_internal_38 --> -156($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -156($fp) + # GOTO label_END_165 +j label_END_165 +label_TRUE_164: + # LOCAL local_i2c_at_A2I_internal_38 --> -156($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -156($fp) + label_END_165: +# LOCAL local_i2c_at_A2I_internal_36 --> -148($fp) +# LOCAL local_i2c_at_A2I_internal_38 --> -156($fp) +# Obtain value from -156($fp) +lw $v0, -156($fp) +lw $v0, 12($v0) +sw $v0, -148($fp) +# IF_ZERO local_i2c_at_A2I_internal_36 GOTO label_FALSEIF_161 +# IF_ZERO local_i2c_at_A2I_internal_36 GOTO label_FALSEIF_161 +lw $t0, -148($fp) +beq $t0, 0, label_FALSEIF_161 +# LOCAL local_i2c_at_A2I_internal_41 --> -168($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_20 +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +sw $v0, -168($fp) +# LOCAL local_i2c_at_A2I_internal_37 --> -152($fp) +# LOCAL local_i2c_at_A2I_internal_41 --> -168($fp) +# local_i2c_at_A2I_internal_37 = local_i2c_at_A2I_internal_41 +lw $t0, -168($fp) +sw $t0, -152($fp) +# GOTO label_ENDIF_162 +j label_ENDIF_162 +label_FALSEIF_161: + # LOCAL local_i2c_at_A2I_internal_46 --> -188($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 7 + sw $t0, 12($v0) + sw $v0, -188($fp) + # IF_ZERO param_i2c_at_A2I_i_0 GOTO label_FALSE_173 + # IF_ZERO param_i2c_at_A2I_i_0 GOTO label_FALSE_173 + lw $t0, 0($fp) + beq $t0, 0, label_FALSE_173 + # IF_ZERO local_i2c_at_A2I_internal_46 GOTO label_FALSE_173 + # IF_ZERO local_i2c_at_A2I_internal_46 GOTO label_FALSE_173 + lw $t0, -188($fp) + beq $t0, 0, label_FALSE_173 + # LOCAL local_i2c_at_A2I_internal_45 --> -184($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with String + la $v0, String + lw $a0, 0($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -184($fp) + # IF_ZERO local_i2c_at_A2I_internal_45 GOTO label_COMPARE_STRING_176 + # IF_ZERO local_i2c_at_A2I_internal_45 GOTO label_COMPARE_STRING_176 + lw $t0, -184($fp) + beq $t0, 0, label_COMPARE_STRING_176 + # LOCAL local_i2c_at_A2I_internal_45 --> -184($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with Bool + la $v0, Bool + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -184($fp) + # IF_ZERO local_i2c_at_A2I_internal_45 GOTO label_COMPARE_BY_VALUE_177 + # IF_ZERO local_i2c_at_A2I_internal_45 GOTO label_COMPARE_BY_VALUE_177 + lw $t0, -184($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_177 + # LOCAL local_i2c_at_A2I_internal_45 --> -184($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with Int + la $v0, Int + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -184($fp) + # IF_ZERO local_i2c_at_A2I_internal_45 GOTO label_COMPARE_BY_VALUE_177 + # IF_ZERO local_i2c_at_A2I_internal_45 GOTO label_COMPARE_BY_VALUE_177 + lw $t0, -184($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_177 + # LOCAL local_i2c_at_A2I_internal_45 --> -184($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_46 --> -188($fp) + # Load pointers and SUB + lw $a0, 0($fp) + lw $a1, -188($fp) + sub $a0, $a0, $a1 + sw $a0, -184($fp) + # IF_ZERO local_i2c_at_A2I_internal_45 GOTO label_TRUE_174 + # IF_ZERO local_i2c_at_A2I_internal_45 GOTO label_TRUE_174 + lw $t0, -184($fp) + beq $t0, 0, label_TRUE_174 + # GOTO label_FALSE_173 + j label_FALSE_173 + label_COMPARE_BY_VALUE_177: + # LOCAL local_i2c_at_A2I_internal_45 --> -184($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_46 --> -188($fp) + lw $a0, 0($fp) + lw $a1, -188($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -184($fp) + # IF_ZERO local_i2c_at_A2I_internal_45 GOTO label_TRUE_174 + # IF_ZERO local_i2c_at_A2I_internal_45 GOTO label_TRUE_174 + lw $t0, -184($fp) + beq $t0, 0, label_TRUE_174 + # GOTO label_FALSE_173 + j label_FALSE_173 + label_COMPARE_STRING_176: + # LOCAL local_i2c_at_A2I_internal_45 --> -184($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_46 --> -188($fp) + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -188($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -184($fp) + # IF_ZERO local_i2c_at_A2I_internal_45 GOTO label_CONTINUE_178 + # IF_ZERO local_i2c_at_A2I_internal_45 GOTO label_CONTINUE_178 + lw $t0, -184($fp) + beq $t0, 0, label_CONTINUE_178 + # GOTO label_FALSE_173 + j label_FALSE_173 + label_CONTINUE_178: + # LOCAL local_i2c_at_A2I_internal_45 --> -184($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_46 --> -188($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -188($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_179: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_180 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_179 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_180: + # Store result + sw $a2, -184($fp) + # IF_ZERO local_i2c_at_A2I_internal_45 GOTO label_TRUE_174 + # IF_ZERO local_i2c_at_A2I_internal_45 GOTO label_TRUE_174 + lw $t0, -184($fp) + beq $t0, 0, label_TRUE_174 + label_FALSE_173: + # LOCAL local_i2c_at_A2I_internal_44 --> -180($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -180($fp) + # GOTO label_END_175 +j label_END_175 +label_TRUE_174: + # LOCAL local_i2c_at_A2I_internal_44 --> -180($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -180($fp) + label_END_175: +# LOCAL local_i2c_at_A2I_internal_42 --> -172($fp) +# LOCAL local_i2c_at_A2I_internal_44 --> -180($fp) +# Obtain value from -180($fp) +lw $v0, -180($fp) +lw $v0, 12($v0) +sw $v0, -172($fp) +# IF_ZERO local_i2c_at_A2I_internal_42 GOTO label_FALSEIF_171 +# IF_ZERO local_i2c_at_A2I_internal_42 GOTO label_FALSEIF_171 +lw $t0, -172($fp) +beq $t0, 0, label_FALSEIF_171 +# LOCAL local_i2c_at_A2I_internal_47 --> -192($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_21 +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +sw $v0, -192($fp) +# LOCAL local_i2c_at_A2I_internal_43 --> -176($fp) +# LOCAL local_i2c_at_A2I_internal_47 --> -192($fp) +# local_i2c_at_A2I_internal_43 = local_i2c_at_A2I_internal_47 +lw $t0, -192($fp) +sw $t0, -176($fp) +# GOTO label_ENDIF_172 +j label_ENDIF_172 +label_FALSEIF_171: + # LOCAL local_i2c_at_A2I_internal_52 --> -212($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 8 + sw $t0, 12($v0) + sw $v0, -212($fp) + # IF_ZERO param_i2c_at_A2I_i_0 GOTO label_FALSE_183 + # IF_ZERO param_i2c_at_A2I_i_0 GOTO label_FALSE_183 + lw $t0, 0($fp) + beq $t0, 0, label_FALSE_183 + # IF_ZERO local_i2c_at_A2I_internal_52 GOTO label_FALSE_183 + # IF_ZERO local_i2c_at_A2I_internal_52 GOTO label_FALSE_183 + lw $t0, -212($fp) + beq $t0, 0, label_FALSE_183 + # LOCAL local_i2c_at_A2I_internal_51 --> -208($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with String + la $v0, String + lw $a0, 0($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -208($fp) + # IF_ZERO local_i2c_at_A2I_internal_51 GOTO label_COMPARE_STRING_186 + # IF_ZERO local_i2c_at_A2I_internal_51 GOTO label_COMPARE_STRING_186 + lw $t0, -208($fp) + beq $t0, 0, label_COMPARE_STRING_186 + # LOCAL local_i2c_at_A2I_internal_51 --> -208($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with Bool + la $v0, Bool + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -208($fp) + # IF_ZERO local_i2c_at_A2I_internal_51 GOTO label_COMPARE_BY_VALUE_187 + # IF_ZERO local_i2c_at_A2I_internal_51 GOTO label_COMPARE_BY_VALUE_187 + lw $t0, -208($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_187 + # LOCAL local_i2c_at_A2I_internal_51 --> -208($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with Int + la $v0, Int + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -208($fp) + # IF_ZERO local_i2c_at_A2I_internal_51 GOTO label_COMPARE_BY_VALUE_187 + # IF_ZERO local_i2c_at_A2I_internal_51 GOTO label_COMPARE_BY_VALUE_187 + lw $t0, -208($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_187 + # LOCAL local_i2c_at_A2I_internal_51 --> -208($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_52 --> -212($fp) + # Load pointers and SUB + lw $a0, 0($fp) + lw $a1, -212($fp) + sub $a0, $a0, $a1 + sw $a0, -208($fp) + # IF_ZERO local_i2c_at_A2I_internal_51 GOTO label_TRUE_184 + # IF_ZERO local_i2c_at_A2I_internal_51 GOTO label_TRUE_184 + lw $t0, -208($fp) + beq $t0, 0, label_TRUE_184 + # GOTO label_FALSE_183 + j label_FALSE_183 + label_COMPARE_BY_VALUE_187: + # LOCAL local_i2c_at_A2I_internal_51 --> -208($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_52 --> -212($fp) + lw $a0, 0($fp) + lw $a1, -212($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -208($fp) + # IF_ZERO local_i2c_at_A2I_internal_51 GOTO label_TRUE_184 + # IF_ZERO local_i2c_at_A2I_internal_51 GOTO label_TRUE_184 + lw $t0, -208($fp) + beq $t0, 0, label_TRUE_184 + # GOTO label_FALSE_183 + j label_FALSE_183 + label_COMPARE_STRING_186: + # LOCAL local_i2c_at_A2I_internal_51 --> -208($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_52 --> -212($fp) + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -212($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -208($fp) + # IF_ZERO local_i2c_at_A2I_internal_51 GOTO label_CONTINUE_188 + # IF_ZERO local_i2c_at_A2I_internal_51 GOTO label_CONTINUE_188 + lw $t0, -208($fp) + beq $t0, 0, label_CONTINUE_188 + # GOTO label_FALSE_183 + j label_FALSE_183 + label_CONTINUE_188: + # LOCAL local_i2c_at_A2I_internal_51 --> -208($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_52 --> -212($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -212($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_189: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_190 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_189 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_190: + # Store result + sw $a2, -208($fp) + # IF_ZERO local_i2c_at_A2I_internal_51 GOTO label_TRUE_184 + # IF_ZERO local_i2c_at_A2I_internal_51 GOTO label_TRUE_184 + lw $t0, -208($fp) + beq $t0, 0, label_TRUE_184 + label_FALSE_183: + # LOCAL local_i2c_at_A2I_internal_50 --> -204($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -204($fp) + # GOTO label_END_185 +j label_END_185 +label_TRUE_184: + # LOCAL local_i2c_at_A2I_internal_50 --> -204($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -204($fp) + label_END_185: +# LOCAL local_i2c_at_A2I_internal_48 --> -196($fp) +# LOCAL local_i2c_at_A2I_internal_50 --> -204($fp) +# Obtain value from -204($fp) +lw $v0, -204($fp) +lw $v0, 12($v0) +sw $v0, -196($fp) +# IF_ZERO local_i2c_at_A2I_internal_48 GOTO label_FALSEIF_181 +# IF_ZERO local_i2c_at_A2I_internal_48 GOTO label_FALSEIF_181 +lw $t0, -196($fp) +beq $t0, 0, label_FALSEIF_181 +# LOCAL local_i2c_at_A2I_internal_53 --> -216($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_22 +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +sw $v0, -216($fp) +# LOCAL local_i2c_at_A2I_internal_49 --> -200($fp) +# LOCAL local_i2c_at_A2I_internal_53 --> -216($fp) +# local_i2c_at_A2I_internal_49 = local_i2c_at_A2I_internal_53 +lw $t0, -216($fp) +sw $t0, -200($fp) +# GOTO label_ENDIF_182 +j label_ENDIF_182 +label_FALSEIF_181: + # LOCAL local_i2c_at_A2I_internal_58 --> -236($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 9 + sw $t0, 12($v0) + sw $v0, -236($fp) + # IF_ZERO param_i2c_at_A2I_i_0 GOTO label_FALSE_193 + # IF_ZERO param_i2c_at_A2I_i_0 GOTO label_FALSE_193 + lw $t0, 0($fp) + beq $t0, 0, label_FALSE_193 + # IF_ZERO local_i2c_at_A2I_internal_58 GOTO label_FALSE_193 + # IF_ZERO local_i2c_at_A2I_internal_58 GOTO label_FALSE_193 + lw $t0, -236($fp) + beq $t0, 0, label_FALSE_193 + # LOCAL local_i2c_at_A2I_internal_57 --> -232($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with String + la $v0, String + lw $a0, 0($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -232($fp) + # IF_ZERO local_i2c_at_A2I_internal_57 GOTO label_COMPARE_STRING_196 + # IF_ZERO local_i2c_at_A2I_internal_57 GOTO label_COMPARE_STRING_196 + lw $t0, -232($fp) + beq $t0, 0, label_COMPARE_STRING_196 + # LOCAL local_i2c_at_A2I_internal_57 --> -232($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with Bool + la $v0, Bool + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -232($fp) + # IF_ZERO local_i2c_at_A2I_internal_57 GOTO label_COMPARE_BY_VALUE_197 + # IF_ZERO local_i2c_at_A2I_internal_57 GOTO label_COMPARE_BY_VALUE_197 + lw $t0, -232($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_197 + # LOCAL local_i2c_at_A2I_internal_57 --> -232($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with Int + la $v0, Int + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -232($fp) + # IF_ZERO local_i2c_at_A2I_internal_57 GOTO label_COMPARE_BY_VALUE_197 + # IF_ZERO local_i2c_at_A2I_internal_57 GOTO label_COMPARE_BY_VALUE_197 + lw $t0, -232($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_197 + # LOCAL local_i2c_at_A2I_internal_57 --> -232($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_58 --> -236($fp) + # Load pointers and SUB + lw $a0, 0($fp) + lw $a1, -236($fp) + sub $a0, $a0, $a1 + sw $a0, -232($fp) + # IF_ZERO local_i2c_at_A2I_internal_57 GOTO label_TRUE_194 + # IF_ZERO local_i2c_at_A2I_internal_57 GOTO label_TRUE_194 + lw $t0, -232($fp) + beq $t0, 0, label_TRUE_194 + # GOTO label_FALSE_193 + j label_FALSE_193 + label_COMPARE_BY_VALUE_197: + # LOCAL local_i2c_at_A2I_internal_57 --> -232($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_58 --> -236($fp) + lw $a0, 0($fp) + lw $a1, -236($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -232($fp) + # IF_ZERO local_i2c_at_A2I_internal_57 GOTO label_TRUE_194 + # IF_ZERO local_i2c_at_A2I_internal_57 GOTO label_TRUE_194 + lw $t0, -232($fp) + beq $t0, 0, label_TRUE_194 + # GOTO label_FALSE_193 + j label_FALSE_193 + label_COMPARE_STRING_196: + # LOCAL local_i2c_at_A2I_internal_57 --> -232($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_58 --> -236($fp) + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -236($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -232($fp) + # IF_ZERO local_i2c_at_A2I_internal_57 GOTO label_CONTINUE_198 + # IF_ZERO local_i2c_at_A2I_internal_57 GOTO label_CONTINUE_198 + lw $t0, -232($fp) + beq $t0, 0, label_CONTINUE_198 + # GOTO label_FALSE_193 + j label_FALSE_193 + label_CONTINUE_198: + # LOCAL local_i2c_at_A2I_internal_57 --> -232($fp) + # PARAM param_i2c_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2c_at_A2I_internal_58 --> -236($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -236($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_199: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_200 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_199 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_200: + # Store result + sw $a2, -232($fp) + # IF_ZERO local_i2c_at_A2I_internal_57 GOTO label_TRUE_194 + # IF_ZERO local_i2c_at_A2I_internal_57 GOTO label_TRUE_194 + lw $t0, -232($fp) + beq $t0, 0, label_TRUE_194 + label_FALSE_193: + # LOCAL local_i2c_at_A2I_internal_56 --> -228($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -228($fp) + # GOTO label_END_195 +j label_END_195 +label_TRUE_194: + # LOCAL local_i2c_at_A2I_internal_56 --> -228($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -228($fp) + label_END_195: +# LOCAL local_i2c_at_A2I_internal_54 --> -220($fp) +# LOCAL local_i2c_at_A2I_internal_56 --> -228($fp) +# Obtain value from -228($fp) +lw $v0, -228($fp) +lw $v0, 12($v0) +sw $v0, -220($fp) +# IF_ZERO local_i2c_at_A2I_internal_54 GOTO label_FALSEIF_191 +# IF_ZERO local_i2c_at_A2I_internal_54 GOTO label_FALSEIF_191 +lw $t0, -220($fp) +beq $t0, 0, label_FALSEIF_191 +# LOCAL local_i2c_at_A2I_internal_59 --> -240($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_23 +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +sw $v0, -240($fp) +# LOCAL local_i2c_at_A2I_internal_55 --> -224($fp) +# LOCAL local_i2c_at_A2I_internal_59 --> -240($fp) +# local_i2c_at_A2I_internal_55 = local_i2c_at_A2I_internal_59 +lw $t0, -240($fp) +sw $t0, -224($fp) +# GOTO label_ENDIF_192 +j label_ENDIF_192 +label_FALSEIF_191: + # LOCAL local_i2c_at_A2I_internal_62 --> -252($fp) + # local_i2c_at_A2I_internal_62 = SELF + sw $s1, -252($fp) + # LOCAL local_i2c_at_A2I_internal_60 --> -244($fp) + # LOCAL local_i2c_at_A2I_internal_62 --> -252($fp) + # local_i2c_at_A2I_internal_60 = local_i2c_at_A2I_internal_62 + lw $t0, -252($fp) + sw $t0, -244($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_i2c_at_A2I_internal_60 --> -244($fp) + # LOCAL local_i2c_at_A2I_internal_61 --> -248($fp) + # local_i2c_at_A2I_internal_61 = VCALL local_i2c_at_A2I_internal_60 abort + # Save new self pointer in $s1 + lw $s1, -244($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 28($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -248($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_i2c_at_A2I_internal_63 --> -256($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_24 + sw $t0, 12($v0) + li $t0, 0 + sw $t0, 16($v0) + sw $v0, -256($fp) + # LOCAL local_i2c_at_A2I_internal_55 --> -224($fp) + # LOCAL local_i2c_at_A2I_internal_63 --> -256($fp) + # local_i2c_at_A2I_internal_55 = local_i2c_at_A2I_internal_63 + lw $t0, -256($fp) + sw $t0, -224($fp) + label_ENDIF_192: +# LOCAL local_i2c_at_A2I_internal_49 --> -200($fp) +# LOCAL local_i2c_at_A2I_internal_55 --> -224($fp) +# local_i2c_at_A2I_internal_49 = local_i2c_at_A2I_internal_55 +lw $t0, -224($fp) +sw $t0, -200($fp) +label_ENDIF_182: +# LOCAL local_i2c_at_A2I_internal_43 --> -176($fp) +# LOCAL local_i2c_at_A2I_internal_49 --> -200($fp) +# local_i2c_at_A2I_internal_43 = local_i2c_at_A2I_internal_49 +lw $t0, -200($fp) +sw $t0, -176($fp) +label_ENDIF_172: +# LOCAL local_i2c_at_A2I_internal_37 --> -152($fp) +# LOCAL local_i2c_at_A2I_internal_43 --> -176($fp) +# local_i2c_at_A2I_internal_37 = local_i2c_at_A2I_internal_43 +lw $t0, -176($fp) +sw $t0, -152($fp) +label_ENDIF_162: +# LOCAL local_i2c_at_A2I_internal_31 --> -128($fp) +# LOCAL local_i2c_at_A2I_internal_37 --> -152($fp) +# local_i2c_at_A2I_internal_31 = local_i2c_at_A2I_internal_37 +lw $t0, -152($fp) +sw $t0, -128($fp) +label_ENDIF_152: +# LOCAL local_i2c_at_A2I_internal_25 --> -104($fp) +# LOCAL local_i2c_at_A2I_internal_31 --> -128($fp) +# local_i2c_at_A2I_internal_25 = local_i2c_at_A2I_internal_31 +lw $t0, -128($fp) +sw $t0, -104($fp) +label_ENDIF_142: +# LOCAL local_i2c_at_A2I_internal_19 --> -80($fp) +# LOCAL local_i2c_at_A2I_internal_25 --> -104($fp) +# local_i2c_at_A2I_internal_19 = local_i2c_at_A2I_internal_25 +lw $t0, -104($fp) +sw $t0, -80($fp) +label_ENDIF_132: +# LOCAL local_i2c_at_A2I_internal_13 --> -56($fp) +# LOCAL local_i2c_at_A2I_internal_19 --> -80($fp) +# local_i2c_at_A2I_internal_13 = local_i2c_at_A2I_internal_19 +lw $t0, -80($fp) +sw $t0, -56($fp) +label_ENDIF_122: +# LOCAL local_i2c_at_A2I_internal_7 --> -32($fp) +# LOCAL local_i2c_at_A2I_internal_13 --> -56($fp) +# local_i2c_at_A2I_internal_7 = local_i2c_at_A2I_internal_13 +lw $t0, -56($fp) +sw $t0, -32($fp) +label_ENDIF_112: +# LOCAL local_i2c_at_A2I_internal_1 --> -8($fp) +# LOCAL local_i2c_at_A2I_internal_7 --> -32($fp) +# local_i2c_at_A2I_internal_1 = local_i2c_at_A2I_internal_7 +lw $t0, -32($fp) +sw $t0, -8($fp) +label_ENDIF_102: +# RETURN local_i2c_at_A2I_internal_1 +lw $v0, -8($fp) +# Deallocate stack frame for function function_i2c_at_A2I. +# Restore $ra +lw $ra, 4($sp) +# Restore $fp +lw $fp, 0($sp) +# Restore Stack pointer $sp +addu $sp, $sp, 264 +# Deallocate function args +addu $sp, $sp, 4 +jr $ra +# Function END + + +# function_a2i_at_A2I implementation. +# @Params: +# 0($fp) = param_a2i_at_A2I_s_0 +function_a2i_at_A2I: + # Allocate stack frame for function function_a2i_at_A2I. + subu $sp, $sp, 208 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 208 + # LOCAL local_a2i_at_A2I_internal_4 --> -20($fp) + # PARAM param_a2i_at_A2I_s_0 --> 0($fp) + # local_a2i_at_A2I_internal_4 = PARAM param_a2i_at_A2I_s_0 + lw $t0, 0($fp) + sw $t0, -20($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_a2i_at_A2I_internal_4 --> -20($fp) + # LOCAL local_a2i_at_A2I_internal_5 --> -24($fp) + # local_a2i_at_A2I_internal_5 = VCALL local_a2i_at_A2I_internal_4 length + # Save new self pointer in $s1 + lw $s1, -20($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 0($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -24($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_a2i_at_A2I_internal_6 --> -28($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -28($fp) + # IF_ZERO local_a2i_at_A2I_internal_5 GOTO label_FALSE_203 + # IF_ZERO local_a2i_at_A2I_internal_5 GOTO label_FALSE_203 + lw $t0, -24($fp) + beq $t0, 0, label_FALSE_203 + # IF_ZERO local_a2i_at_A2I_internal_6 GOTO label_FALSE_203 + # IF_ZERO local_a2i_at_A2I_internal_6 GOTO label_FALSE_203 + lw $t0, -28($fp) + beq $t0, 0, label_FALSE_203 + # LOCAL local_a2i_at_A2I_internal_3 --> -16($fp) + # LOCAL local_a2i_at_A2I_internal_5 --> -24($fp) + # Comparing -24($fp) type with String + la $v0, String + lw $a0, -24($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -16($fp) + # IF_ZERO local_a2i_at_A2I_internal_3 GOTO label_COMPARE_STRING_206 + # IF_ZERO local_a2i_at_A2I_internal_3 GOTO label_COMPARE_STRING_206 + lw $t0, -16($fp) + beq $t0, 0, label_COMPARE_STRING_206 + # LOCAL local_a2i_at_A2I_internal_3 --> -16($fp) + # LOCAL local_a2i_at_A2I_internal_5 --> -24($fp) + # Comparing -24($fp) type with Bool + la $v0, Bool + lw $a0, -24($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -16($fp) + # IF_ZERO local_a2i_at_A2I_internal_3 GOTO label_COMPARE_BY_VALUE_207 + # IF_ZERO local_a2i_at_A2I_internal_3 GOTO label_COMPARE_BY_VALUE_207 + lw $t0, -16($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_207 + # LOCAL local_a2i_at_A2I_internal_3 --> -16($fp) + # LOCAL local_a2i_at_A2I_internal_5 --> -24($fp) + # Comparing -24($fp) type with Int + la $v0, Int + lw $a0, -24($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -16($fp) + # IF_ZERO local_a2i_at_A2I_internal_3 GOTO label_COMPARE_BY_VALUE_207 + # IF_ZERO local_a2i_at_A2I_internal_3 GOTO label_COMPARE_BY_VALUE_207 + lw $t0, -16($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_207 + # LOCAL local_a2i_at_A2I_internal_3 --> -16($fp) + # LOCAL local_a2i_at_A2I_internal_5 --> -24($fp) + # LOCAL local_a2i_at_A2I_internal_6 --> -28($fp) + # Load pointers and SUB + lw $a0, -24($fp) + lw $a1, -28($fp) + sub $a0, $a0, $a1 + sw $a0, -16($fp) + # IF_ZERO local_a2i_at_A2I_internal_3 GOTO label_TRUE_204 + # IF_ZERO local_a2i_at_A2I_internal_3 GOTO label_TRUE_204 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_204 + # GOTO label_FALSE_203 + j label_FALSE_203 + label_COMPARE_BY_VALUE_207: + # LOCAL local_a2i_at_A2I_internal_3 --> -16($fp) + # LOCAL local_a2i_at_A2I_internal_5 --> -24($fp) + # LOCAL local_a2i_at_A2I_internal_6 --> -28($fp) + lw $a0, -24($fp) + lw $a1, -28($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -16($fp) + # IF_ZERO local_a2i_at_A2I_internal_3 GOTO label_TRUE_204 + # IF_ZERO local_a2i_at_A2I_internal_3 GOTO label_TRUE_204 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_204 + # GOTO label_FALSE_203 + j label_FALSE_203 + label_COMPARE_STRING_206: + # LOCAL local_a2i_at_A2I_internal_3 --> -16($fp) + # LOCAL local_a2i_at_A2I_internal_5 --> -24($fp) + # LOCAL local_a2i_at_A2I_internal_6 --> -28($fp) + # Load strings for comparison + lw $v0, -24($fp) + lw $v1, -28($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -16($fp) + # IF_ZERO local_a2i_at_A2I_internal_3 GOTO label_CONTINUE_208 + # IF_ZERO local_a2i_at_A2I_internal_3 GOTO label_CONTINUE_208 + lw $t0, -16($fp) + beq $t0, 0, label_CONTINUE_208 + # GOTO label_FALSE_203 + j label_FALSE_203 + label_CONTINUE_208: + # LOCAL local_a2i_at_A2I_internal_3 --> -16($fp) + # LOCAL local_a2i_at_A2I_internal_5 --> -24($fp) + # LOCAL local_a2i_at_A2I_internal_6 --> -28($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -24($fp) + lw $v1, -28($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_209: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_210 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_209 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_210: + # Store result + sw $a2, -16($fp) + # IF_ZERO local_a2i_at_A2I_internal_3 GOTO label_TRUE_204 + # IF_ZERO local_a2i_at_A2I_internal_3 GOTO label_TRUE_204 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_204 + label_FALSE_203: + # LOCAL local_a2i_at_A2I_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -12($fp) + # GOTO label_END_205 +j label_END_205 +label_TRUE_204: + # LOCAL local_a2i_at_A2I_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -12($fp) + label_END_205: +# LOCAL local_a2i_at_A2I_internal_0 --> -4($fp) +# LOCAL local_a2i_at_A2I_internal_2 --> -12($fp) +# Obtain value from -12($fp) +lw $v0, -12($fp) +lw $v0, 12($v0) +sw $v0, -4($fp) +# IF_ZERO local_a2i_at_A2I_internal_0 GOTO label_FALSEIF_201 +# IF_ZERO local_a2i_at_A2I_internal_0 GOTO label_FALSEIF_201 +lw $t0, -4($fp) +beq $t0, 0, label_FALSEIF_201 +# LOCAL local_a2i_at_A2I_internal_7 --> -32($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 0 +sw $t0, 12($v0) +sw $v0, -32($fp) +# LOCAL local_a2i_at_A2I_internal_1 --> -8($fp) +# LOCAL local_a2i_at_A2I_internal_7 --> -32($fp) +# local_a2i_at_A2I_internal_1 = local_a2i_at_A2I_internal_7 +lw $t0, -32($fp) +sw $t0, -8($fp) +# GOTO label_ENDIF_202 +j label_ENDIF_202 +label_FALSEIF_201: + # LOCAL local_a2i_at_A2I_internal_12 --> -52($fp) + # PARAM param_a2i_at_A2I_s_0 --> 0($fp) + # local_a2i_at_A2I_internal_12 = PARAM param_a2i_at_A2I_s_0 + lw $t0, 0($fp) + sw $t0, -52($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_a2i_at_A2I_internal_14 --> -60($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -60($fp) + # ARG local_a2i_at_A2I_internal_14 + # LOCAL local_a2i_at_A2I_internal_14 --> -60($fp) + lw $t0, -60($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_a2i_at_A2I_internal_15 --> -64($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -64($fp) + # ARG local_a2i_at_A2I_internal_15 + # LOCAL local_a2i_at_A2I_internal_15 --> -64($fp) + lw $t0, -64($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_a2i_at_A2I_internal_12 --> -52($fp) + # LOCAL local_a2i_at_A2I_internal_13 --> -56($fp) + # local_a2i_at_A2I_internal_13 = VCALL local_a2i_at_A2I_internal_12 substr + # Save new self pointer in $s1 + lw $s1, -52($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 8($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -56($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_a2i_at_A2I_internal_16 --> -68($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_25 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -68($fp) + # IF_ZERO local_a2i_at_A2I_internal_13 GOTO label_FALSE_213 + # IF_ZERO local_a2i_at_A2I_internal_13 GOTO label_FALSE_213 + lw $t0, -56($fp) + beq $t0, 0, label_FALSE_213 + # IF_ZERO local_a2i_at_A2I_internal_16 GOTO label_FALSE_213 + # IF_ZERO local_a2i_at_A2I_internal_16 GOTO label_FALSE_213 + lw $t0, -68($fp) + beq $t0, 0, label_FALSE_213 + # LOCAL local_a2i_at_A2I_internal_11 --> -48($fp) + # LOCAL local_a2i_at_A2I_internal_13 --> -56($fp) + # Comparing -56($fp) type with String + la $v0, String + lw $a0, -56($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -48($fp) + # IF_ZERO local_a2i_at_A2I_internal_11 GOTO label_COMPARE_STRING_216 + # IF_ZERO local_a2i_at_A2I_internal_11 GOTO label_COMPARE_STRING_216 + lw $t0, -48($fp) + beq $t0, 0, label_COMPARE_STRING_216 + # LOCAL local_a2i_at_A2I_internal_11 --> -48($fp) + # LOCAL local_a2i_at_A2I_internal_13 --> -56($fp) + # Comparing -56($fp) type with Bool + la $v0, Bool + lw $a0, -56($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -48($fp) + # IF_ZERO local_a2i_at_A2I_internal_11 GOTO label_COMPARE_BY_VALUE_217 + # IF_ZERO local_a2i_at_A2I_internal_11 GOTO label_COMPARE_BY_VALUE_217 + lw $t0, -48($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_217 + # LOCAL local_a2i_at_A2I_internal_11 --> -48($fp) + # LOCAL local_a2i_at_A2I_internal_13 --> -56($fp) + # Comparing -56($fp) type with Int + la $v0, Int + lw $a0, -56($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -48($fp) + # IF_ZERO local_a2i_at_A2I_internal_11 GOTO label_COMPARE_BY_VALUE_217 + # IF_ZERO local_a2i_at_A2I_internal_11 GOTO label_COMPARE_BY_VALUE_217 + lw $t0, -48($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_217 + # LOCAL local_a2i_at_A2I_internal_11 --> -48($fp) + # LOCAL local_a2i_at_A2I_internal_13 --> -56($fp) + # LOCAL local_a2i_at_A2I_internal_16 --> -68($fp) + # Load pointers and SUB + lw $a0, -56($fp) + lw $a1, -68($fp) + sub $a0, $a0, $a1 + sw $a0, -48($fp) + # IF_ZERO local_a2i_at_A2I_internal_11 GOTO label_TRUE_214 + # IF_ZERO local_a2i_at_A2I_internal_11 GOTO label_TRUE_214 + lw $t0, -48($fp) + beq $t0, 0, label_TRUE_214 + # GOTO label_FALSE_213 + j label_FALSE_213 + label_COMPARE_BY_VALUE_217: + # LOCAL local_a2i_at_A2I_internal_11 --> -48($fp) + # LOCAL local_a2i_at_A2I_internal_13 --> -56($fp) + # LOCAL local_a2i_at_A2I_internal_16 --> -68($fp) + lw $a0, -56($fp) + lw $a1, -68($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -48($fp) + # IF_ZERO local_a2i_at_A2I_internal_11 GOTO label_TRUE_214 + # IF_ZERO local_a2i_at_A2I_internal_11 GOTO label_TRUE_214 + lw $t0, -48($fp) + beq $t0, 0, label_TRUE_214 + # GOTO label_FALSE_213 + j label_FALSE_213 + label_COMPARE_STRING_216: + # LOCAL local_a2i_at_A2I_internal_11 --> -48($fp) + # LOCAL local_a2i_at_A2I_internal_13 --> -56($fp) + # LOCAL local_a2i_at_A2I_internal_16 --> -68($fp) + # Load strings for comparison + lw $v0, -56($fp) + lw $v1, -68($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -48($fp) + # IF_ZERO local_a2i_at_A2I_internal_11 GOTO label_CONTINUE_218 + # IF_ZERO local_a2i_at_A2I_internal_11 GOTO label_CONTINUE_218 + lw $t0, -48($fp) + beq $t0, 0, label_CONTINUE_218 + # GOTO label_FALSE_213 + j label_FALSE_213 + label_CONTINUE_218: + # LOCAL local_a2i_at_A2I_internal_11 --> -48($fp) + # LOCAL local_a2i_at_A2I_internal_13 --> -56($fp) + # LOCAL local_a2i_at_A2I_internal_16 --> -68($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -56($fp) + lw $v1, -68($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_219: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_220 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_219 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_220: + # Store result + sw $a2, -48($fp) + # IF_ZERO local_a2i_at_A2I_internal_11 GOTO label_TRUE_214 + # IF_ZERO local_a2i_at_A2I_internal_11 GOTO label_TRUE_214 + lw $t0, -48($fp) + beq $t0, 0, label_TRUE_214 + label_FALSE_213: + # LOCAL local_a2i_at_A2I_internal_10 --> -44($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -44($fp) + # GOTO label_END_215 +j label_END_215 +label_TRUE_214: + # LOCAL local_a2i_at_A2I_internal_10 --> -44($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -44($fp) + label_END_215: +# LOCAL local_a2i_at_A2I_internal_8 --> -36($fp) +# LOCAL local_a2i_at_A2I_internal_10 --> -44($fp) +# Obtain value from -44($fp) +lw $v0, -44($fp) +lw $v0, 12($v0) +sw $v0, -36($fp) +# IF_ZERO local_a2i_at_A2I_internal_8 GOTO label_FALSEIF_211 +# IF_ZERO local_a2i_at_A2I_internal_8 GOTO label_FALSEIF_211 +lw $t0, -36($fp) +beq $t0, 0, label_FALSEIF_211 +# LOCAL local_a2i_at_A2I_internal_20 --> -84($fp) +# local_a2i_at_A2I_internal_20 = SELF +sw $s1, -84($fp) +# LOCAL local_a2i_at_A2I_internal_18 --> -76($fp) +# LOCAL local_a2i_at_A2I_internal_20 --> -84($fp) +# local_a2i_at_A2I_internal_18 = local_a2i_at_A2I_internal_20 +lw $t0, -84($fp) +sw $t0, -76($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_a2i_at_A2I_internal_21 --> -88($fp) +# PARAM param_a2i_at_A2I_s_0 --> 0($fp) +# local_a2i_at_A2I_internal_21 = PARAM param_a2i_at_A2I_s_0 +lw $t0, 0($fp) +sw $t0, -88($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_a2i_at_A2I_internal_23 --> -96($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 1 +sw $t0, 12($v0) +sw $v0, -96($fp) +# ARG local_a2i_at_A2I_internal_23 +# LOCAL local_a2i_at_A2I_internal_23 --> -96($fp) +lw $t0, -96($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_a2i_at_A2I_internal_25 --> -104($fp) +# PARAM param_a2i_at_A2I_s_0 --> 0($fp) +# local_a2i_at_A2I_internal_25 = PARAM param_a2i_at_A2I_s_0 +lw $t0, 0($fp) +sw $t0, -104($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_a2i_at_A2I_internal_25 --> -104($fp) +# LOCAL local_a2i_at_A2I_internal_26 --> -108($fp) +# local_a2i_at_A2I_internal_26 = VCALL local_a2i_at_A2I_internal_25 length +# Save new self pointer in $s1 +lw $s1, -104($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 0($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -108($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_a2i_at_A2I_internal_27 --> -112($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 1 +sw $t0, 12($v0) +sw $v0, -112($fp) +# LOCAL local_a2i_at_A2I_internal_24 --> -100($fp) +# LOCAL local_a2i_at_A2I_internal_26 --> -108($fp) +# LOCAL local_a2i_at_A2I_internal_27 --> -112($fp) +# local_a2i_at_A2I_internal_24 = local_a2i_at_A2I_internal_26 - local_a2i_at_A2I_internal_27 +lw $t1, -108($fp) +lw $t0, 12($t1) +lw $t1, -112($fp) +lw $t2, 12($t1) +sub $t0, $t0, $t2 +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t1, String +sw $t1, 0($v0) +la $t1, String_start +sw $t1, 4($v0) +# Load type offset +li $t1, 8 +sw $t1, 8($v0) +la $t1, Int +sw $t1, 12($v0) +li $t1, 3 +sw $t1, 16($v0) +move $t1, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t1, 0($v0) +la $t1, Int_start +sw $t1, 4($v0) +# Load type offset +li $t1, 16 +sw $t1, 8($v0) +sw $t0, 12($v0) +sw $v0, -100($fp) +# ARG local_a2i_at_A2I_internal_24 +# LOCAL local_a2i_at_A2I_internal_24 --> -100($fp) +lw $t0, -100($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_a2i_at_A2I_internal_21 --> -88($fp) +# LOCAL local_a2i_at_A2I_internal_22 --> -92($fp) +# local_a2i_at_A2I_internal_22 = VCALL local_a2i_at_A2I_internal_21 substr +# Save new self pointer in $s1 +lw $s1, -88($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 8($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -92($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# ARG local_a2i_at_A2I_internal_22 +# LOCAL local_a2i_at_A2I_internal_22 --> -92($fp) +lw $t0, -92($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_a2i_at_A2I_internal_18 --> -76($fp) +# LOCAL local_a2i_at_A2I_internal_19 --> -80($fp) +# local_a2i_at_A2I_internal_19 = VCALL local_a2i_at_A2I_internal_18 a2i_aux +# Save new self pointer in $s1 +lw $s1, -76($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 32($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -80($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_a2i_at_A2I_internal_17 --> -72($fp) +# LOCAL local_a2i_at_A2I_internal_19 --> -80($fp) +lw $t0, -80($fp) +lw $t0, 12($t0) +not $t0, $t0 +add $t0, $t0, 1 +sw $t0, -72($fp) +# LOCAL local_a2i_at_A2I_internal_17 --> -72($fp) +# LOCAL local_a2i_at_A2I_internal_17 --> -72($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +lw $t0, -72($fp) +sw $t0, 12($v0) +sw $v0, -72($fp) +# LOCAL local_a2i_at_A2I_internal_9 --> -40($fp) +# LOCAL local_a2i_at_A2I_internal_17 --> -72($fp) +# local_a2i_at_A2I_internal_9 = local_a2i_at_A2I_internal_17 +lw $t0, -72($fp) +sw $t0, -40($fp) +# GOTO label_ENDIF_212 +j label_ENDIF_212 +label_FALSEIF_211: + # LOCAL local_a2i_at_A2I_internal_32 --> -132($fp) + # PARAM param_a2i_at_A2I_s_0 --> 0($fp) + # local_a2i_at_A2I_internal_32 = PARAM param_a2i_at_A2I_s_0 + lw $t0, 0($fp) + sw $t0, -132($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_a2i_at_A2I_internal_34 --> -140($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -140($fp) + # ARG local_a2i_at_A2I_internal_34 + # LOCAL local_a2i_at_A2I_internal_34 --> -140($fp) + lw $t0, -140($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_a2i_at_A2I_internal_35 --> -144($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -144($fp) + # ARG local_a2i_at_A2I_internal_35 + # LOCAL local_a2i_at_A2I_internal_35 --> -144($fp) + lw $t0, -144($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_a2i_at_A2I_internal_32 --> -132($fp) + # LOCAL local_a2i_at_A2I_internal_33 --> -136($fp) + # local_a2i_at_A2I_internal_33 = VCALL local_a2i_at_A2I_internal_32 substr + # Save new self pointer in $s1 + lw $s1, -132($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 8($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -136($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_a2i_at_A2I_internal_36 --> -148($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_26 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -148($fp) + # IF_ZERO local_a2i_at_A2I_internal_33 GOTO label_FALSE_223 + # IF_ZERO local_a2i_at_A2I_internal_33 GOTO label_FALSE_223 + lw $t0, -136($fp) + beq $t0, 0, label_FALSE_223 + # IF_ZERO local_a2i_at_A2I_internal_36 GOTO label_FALSE_223 + # IF_ZERO local_a2i_at_A2I_internal_36 GOTO label_FALSE_223 + lw $t0, -148($fp) + beq $t0, 0, label_FALSE_223 + # LOCAL local_a2i_at_A2I_internal_31 --> -128($fp) + # LOCAL local_a2i_at_A2I_internal_33 --> -136($fp) + # Comparing -136($fp) type with String + la $v0, String + lw $a0, -136($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -128($fp) + # IF_ZERO local_a2i_at_A2I_internal_31 GOTO label_COMPARE_STRING_226 + # IF_ZERO local_a2i_at_A2I_internal_31 GOTO label_COMPARE_STRING_226 + lw $t0, -128($fp) + beq $t0, 0, label_COMPARE_STRING_226 + # LOCAL local_a2i_at_A2I_internal_31 --> -128($fp) + # LOCAL local_a2i_at_A2I_internal_33 --> -136($fp) + # Comparing -136($fp) type with Bool + la $v0, Bool + lw $a0, -136($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -128($fp) + # IF_ZERO local_a2i_at_A2I_internal_31 GOTO label_COMPARE_BY_VALUE_227 + # IF_ZERO local_a2i_at_A2I_internal_31 GOTO label_COMPARE_BY_VALUE_227 + lw $t0, -128($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_227 + # LOCAL local_a2i_at_A2I_internal_31 --> -128($fp) + # LOCAL local_a2i_at_A2I_internal_33 --> -136($fp) + # Comparing -136($fp) type with Int + la $v0, Int + lw $a0, -136($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -128($fp) + # IF_ZERO local_a2i_at_A2I_internal_31 GOTO label_COMPARE_BY_VALUE_227 + # IF_ZERO local_a2i_at_A2I_internal_31 GOTO label_COMPARE_BY_VALUE_227 + lw $t0, -128($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_227 + # LOCAL local_a2i_at_A2I_internal_31 --> -128($fp) + # LOCAL local_a2i_at_A2I_internal_33 --> -136($fp) + # LOCAL local_a2i_at_A2I_internal_36 --> -148($fp) + # Load pointers and SUB + lw $a0, -136($fp) + lw $a1, -148($fp) + sub $a0, $a0, $a1 + sw $a0, -128($fp) + # IF_ZERO local_a2i_at_A2I_internal_31 GOTO label_TRUE_224 + # IF_ZERO local_a2i_at_A2I_internal_31 GOTO label_TRUE_224 + lw $t0, -128($fp) + beq $t0, 0, label_TRUE_224 + # GOTO label_FALSE_223 + j label_FALSE_223 + label_COMPARE_BY_VALUE_227: + # LOCAL local_a2i_at_A2I_internal_31 --> -128($fp) + # LOCAL local_a2i_at_A2I_internal_33 --> -136($fp) + # LOCAL local_a2i_at_A2I_internal_36 --> -148($fp) + lw $a0, -136($fp) + lw $a1, -148($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -128($fp) + # IF_ZERO local_a2i_at_A2I_internal_31 GOTO label_TRUE_224 + # IF_ZERO local_a2i_at_A2I_internal_31 GOTO label_TRUE_224 + lw $t0, -128($fp) + beq $t0, 0, label_TRUE_224 + # GOTO label_FALSE_223 + j label_FALSE_223 + label_COMPARE_STRING_226: + # LOCAL local_a2i_at_A2I_internal_31 --> -128($fp) + # LOCAL local_a2i_at_A2I_internal_33 --> -136($fp) + # LOCAL local_a2i_at_A2I_internal_36 --> -148($fp) + # Load strings for comparison + lw $v0, -136($fp) + lw $v1, -148($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -128($fp) + # IF_ZERO local_a2i_at_A2I_internal_31 GOTO label_CONTINUE_228 + # IF_ZERO local_a2i_at_A2I_internal_31 GOTO label_CONTINUE_228 + lw $t0, -128($fp) + beq $t0, 0, label_CONTINUE_228 + # GOTO label_FALSE_223 + j label_FALSE_223 + label_CONTINUE_228: + # LOCAL local_a2i_at_A2I_internal_31 --> -128($fp) + # LOCAL local_a2i_at_A2I_internal_33 --> -136($fp) + # LOCAL local_a2i_at_A2I_internal_36 --> -148($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -136($fp) + lw $v1, -148($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_229: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_230 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_229 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_230: + # Store result + sw $a2, -128($fp) + # IF_ZERO local_a2i_at_A2I_internal_31 GOTO label_TRUE_224 + # IF_ZERO local_a2i_at_A2I_internal_31 GOTO label_TRUE_224 + lw $t0, -128($fp) + beq $t0, 0, label_TRUE_224 + label_FALSE_223: + # LOCAL local_a2i_at_A2I_internal_30 --> -124($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -124($fp) + # GOTO label_END_225 +j label_END_225 +label_TRUE_224: + # LOCAL local_a2i_at_A2I_internal_30 --> -124($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -124($fp) + label_END_225: +# LOCAL local_a2i_at_A2I_internal_28 --> -116($fp) +# LOCAL local_a2i_at_A2I_internal_30 --> -124($fp) +# Obtain value from -124($fp) +lw $v0, -124($fp) +lw $v0, 12($v0) +sw $v0, -116($fp) +# IF_ZERO local_a2i_at_A2I_internal_28 GOTO label_FALSEIF_221 +# IF_ZERO local_a2i_at_A2I_internal_28 GOTO label_FALSEIF_221 +lw $t0, -116($fp) +beq $t0, 0, label_FALSEIF_221 +# LOCAL local_a2i_at_A2I_internal_39 --> -160($fp) +# local_a2i_at_A2I_internal_39 = SELF +sw $s1, -160($fp) +# LOCAL local_a2i_at_A2I_internal_37 --> -152($fp) +# LOCAL local_a2i_at_A2I_internal_39 --> -160($fp) +# local_a2i_at_A2I_internal_37 = local_a2i_at_A2I_internal_39 +lw $t0, -160($fp) +sw $t0, -152($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_a2i_at_A2I_internal_40 --> -164($fp) +# PARAM param_a2i_at_A2I_s_0 --> 0($fp) +# local_a2i_at_A2I_internal_40 = PARAM param_a2i_at_A2I_s_0 +lw $t0, 0($fp) +sw $t0, -164($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_a2i_at_A2I_internal_42 --> -172($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 1 +sw $t0, 12($v0) +sw $v0, -172($fp) +# ARG local_a2i_at_A2I_internal_42 +# LOCAL local_a2i_at_A2I_internal_42 --> -172($fp) +lw $t0, -172($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_a2i_at_A2I_internal_44 --> -180($fp) +# PARAM param_a2i_at_A2I_s_0 --> 0($fp) +# local_a2i_at_A2I_internal_44 = PARAM param_a2i_at_A2I_s_0 +lw $t0, 0($fp) +sw $t0, -180($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_a2i_at_A2I_internal_44 --> -180($fp) +# LOCAL local_a2i_at_A2I_internal_45 --> -184($fp) +# local_a2i_at_A2I_internal_45 = VCALL local_a2i_at_A2I_internal_44 length +# Save new self pointer in $s1 +lw $s1, -180($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 0($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -184($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_a2i_at_A2I_internal_46 --> -188($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 1 +sw $t0, 12($v0) +sw $v0, -188($fp) +# LOCAL local_a2i_at_A2I_internal_43 --> -176($fp) +# LOCAL local_a2i_at_A2I_internal_45 --> -184($fp) +# LOCAL local_a2i_at_A2I_internal_46 --> -188($fp) +# local_a2i_at_A2I_internal_43 = local_a2i_at_A2I_internal_45 - local_a2i_at_A2I_internal_46 +lw $t1, -184($fp) +lw $t0, 12($t1) +lw $t1, -188($fp) +lw $t2, 12($t1) +sub $t0, $t0, $t2 +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t1, String +sw $t1, 0($v0) +la $t1, String_start +sw $t1, 4($v0) +# Load type offset +li $t1, 8 +sw $t1, 8($v0) +la $t1, Int +sw $t1, 12($v0) +li $t1, 3 +sw $t1, 16($v0) +move $t1, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t1, 0($v0) +la $t1, Int_start +sw $t1, 4($v0) +# Load type offset +li $t1, 16 +sw $t1, 8($v0) +sw $t0, 12($v0) +sw $v0, -176($fp) +# ARG local_a2i_at_A2I_internal_43 +# LOCAL local_a2i_at_A2I_internal_43 --> -176($fp) +lw $t0, -176($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_a2i_at_A2I_internal_40 --> -164($fp) +# LOCAL local_a2i_at_A2I_internal_41 --> -168($fp) +# local_a2i_at_A2I_internal_41 = VCALL local_a2i_at_A2I_internal_40 substr +# Save new self pointer in $s1 +lw $s1, -164($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 8($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -168($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# ARG local_a2i_at_A2I_internal_41 +# LOCAL local_a2i_at_A2I_internal_41 --> -168($fp) +lw $t0, -168($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_a2i_at_A2I_internal_37 --> -152($fp) +# LOCAL local_a2i_at_A2I_internal_38 --> -156($fp) +# local_a2i_at_A2I_internal_38 = VCALL local_a2i_at_A2I_internal_37 a2i_aux +# Save new self pointer in $s1 +lw $s1, -152($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 32($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -156($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_a2i_at_A2I_internal_29 --> -120($fp) +# LOCAL local_a2i_at_A2I_internal_38 --> -156($fp) +# local_a2i_at_A2I_internal_29 = local_a2i_at_A2I_internal_38 +lw $t0, -156($fp) +sw $t0, -120($fp) +# GOTO label_ENDIF_222 +j label_ENDIF_222 +label_FALSEIF_221: + # LOCAL local_a2i_at_A2I_internal_49 --> -200($fp) + # local_a2i_at_A2I_internal_49 = SELF + sw $s1, -200($fp) + # LOCAL local_a2i_at_A2I_internal_47 --> -192($fp) + # LOCAL local_a2i_at_A2I_internal_49 --> -200($fp) + # local_a2i_at_A2I_internal_47 = local_a2i_at_A2I_internal_49 + lw $t0, -200($fp) + sw $t0, -192($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # ARG param_a2i_at_A2I_s_0 + # PARAM param_a2i_at_A2I_s_0 --> 0($fp) + lw $t0, 0($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_a2i_at_A2I_internal_47 --> -192($fp) + # LOCAL local_a2i_at_A2I_internal_48 --> -196($fp) + # local_a2i_at_A2I_internal_48 = VCALL local_a2i_at_A2I_internal_47 a2i_aux + # Save new self pointer in $s1 + lw $s1, -192($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 32($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -196($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_a2i_at_A2I_internal_29 --> -120($fp) + # LOCAL local_a2i_at_A2I_internal_48 --> -196($fp) + # local_a2i_at_A2I_internal_29 = local_a2i_at_A2I_internal_48 + lw $t0, -196($fp) + sw $t0, -120($fp) + label_ENDIF_222: +# LOCAL local_a2i_at_A2I_internal_9 --> -40($fp) +# LOCAL local_a2i_at_A2I_internal_29 --> -120($fp) +# local_a2i_at_A2I_internal_9 = local_a2i_at_A2I_internal_29 +lw $t0, -120($fp) +sw $t0, -40($fp) +label_ENDIF_212: +# LOCAL local_a2i_at_A2I_internal_1 --> -8($fp) +# LOCAL local_a2i_at_A2I_internal_9 --> -40($fp) +# local_a2i_at_A2I_internal_1 = local_a2i_at_A2I_internal_9 +lw $t0, -40($fp) +sw $t0, -8($fp) +label_ENDIF_202: +# RETURN local_a2i_at_A2I_internal_1 +lw $v0, -8($fp) +# Deallocate stack frame for function function_a2i_at_A2I. +# Restore $ra +lw $ra, 4($sp) +# Restore $fp +lw $fp, 0($sp) +# Restore Stack pointer $sp +addu $sp, $sp, 208 +# Deallocate function args +addu $sp, $sp, 4 +jr $ra +# Function END + + +# function_a2i_aux_at_A2I implementation. +# @Params: +# 0($fp) = param_a2i_aux_at_A2I_s_0 +function_a2i_aux_at_A2I: + # Allocate stack frame for function function_a2i_aux_at_A2I. + subu $sp, $sp, 88 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 88 + # LOCAL local_a2i_aux_at_A2I_int_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -4($fp) + # LOCAL local_a2i_aux_at_A2I_internal_1 --> -8($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -8($fp) + # LOCAL local_a2i_aux_at_A2I_int_0 --> -4($fp) + # LOCAL local_a2i_aux_at_A2I_internal_1 --> -8($fp) + # local_a2i_aux_at_A2I_int_0 = local_a2i_aux_at_A2I_internal_1 + lw $t0, -8($fp) + sw $t0, -4($fp) + # LOCAL local_a2i_aux_at_A2I_j_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -12($fp) + # LOCAL local_a2i_aux_at_A2I_internal_3 --> -16($fp) + # PARAM param_a2i_aux_at_A2I_s_0 --> 0($fp) + # local_a2i_aux_at_A2I_internal_3 = PARAM param_a2i_aux_at_A2I_s_0 + lw $t0, 0($fp) + sw $t0, -16($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_a2i_aux_at_A2I_internal_3 --> -16($fp) + # LOCAL local_a2i_aux_at_A2I_internal_4 --> -20($fp) + # local_a2i_aux_at_A2I_internal_4 = VCALL local_a2i_aux_at_A2I_internal_3 length + # Save new self pointer in $s1 + lw $s1, -16($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 0($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -20($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_a2i_aux_at_A2I_j_2 --> -12($fp) + # LOCAL local_a2i_aux_at_A2I_internal_4 --> -20($fp) + # local_a2i_aux_at_A2I_j_2 = local_a2i_aux_at_A2I_internal_4 + lw $t0, -20($fp) + sw $t0, -12($fp) + # LOCAL local_a2i_aux_at_A2I_i_5 --> -24($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -24($fp) + # LOCAL local_a2i_aux_at_A2I_internal_6 --> -28($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -28($fp) + # LOCAL local_a2i_aux_at_A2I_i_5 --> -24($fp) + # LOCAL local_a2i_aux_at_A2I_internal_6 --> -28($fp) + # local_a2i_aux_at_A2I_i_5 = local_a2i_aux_at_A2I_internal_6 + lw $t0, -28($fp) + sw $t0, -24($fp) + label_WHILE_231: + # LOCAL local_a2i_aux_at_A2I_internal_8 --> -36($fp) + # LOCAL local_a2i_aux_at_A2I_i_5 --> -24($fp) + # LOCAL local_a2i_aux_at_A2I_j_2 --> -12($fp) + lw $a0, -24($fp) + lw $a1, -12($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -36($fp) + # IF_GREATER_ZERO local_a2i_aux_at_A2I_internal_8 GOTO label_FALSE_233 + # IF_GREATER_ZERO local_a2i_aux_at_A2I_internal_8 GOTO label_FALSE_233 + lw $t0, -36($fp) + bgt $t0, 0, label_FALSE_233 + # IF_ZERO local_a2i_aux_at_A2I_internal_8 GOTO label_FALSE_233 + # IF_ZERO local_a2i_aux_at_A2I_internal_8 GOTO label_FALSE_233 + lw $t0, -36($fp) + beq $t0, 0, label_FALSE_233 + # LOCAL local_a2i_aux_at_A2I_internal_8 --> -36($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -36($fp) + # GOTO label_END_234 +j label_END_234 +label_FALSE_233: + # LOCAL local_a2i_aux_at_A2I_internal_8 --> -36($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -36($fp) + label_END_234: +# LOCAL local_a2i_aux_at_A2I_internal_7 --> -32($fp) +# LOCAL local_a2i_aux_at_A2I_internal_8 --> -36($fp) +# Obtain value from -36($fp) +lw $v0, -36($fp) +lw $v0, 12($v0) +sw $v0, -32($fp) +# IF_ZERO local_a2i_aux_at_A2I_internal_7 GOTO label_WHILE_END_232 +# IF_ZERO local_a2i_aux_at_A2I_internal_7 GOTO label_WHILE_END_232 +lw $t0, -32($fp) +beq $t0, 0, label_WHILE_END_232 +# LOCAL local_a2i_aux_at_A2I_internal_11 --> -48($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 10 +sw $t0, 12($v0) +sw $v0, -48($fp) +# LOCAL local_a2i_aux_at_A2I_internal_10 --> -44($fp) +# LOCAL local_a2i_aux_at_A2I_int_0 --> -4($fp) +# LOCAL local_a2i_aux_at_A2I_internal_11 --> -48($fp) +# local_a2i_aux_at_A2I_internal_10 = local_a2i_aux_at_A2I_int_0 * local_a2i_aux_at_A2I_internal_11 +lw $t1, -4($fp) +lw $t0, 12($t1) +lw $t1, -48($fp) +lw $t2, 12($t1) +mul $t0, $t0, $t2 +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t1, String +sw $t1, 0($v0) +la $t1, String_start +sw $t1, 4($v0) +# Load type offset +li $t1, 8 +sw $t1, 8($v0) +la $t1, Int +sw $t1, 12($v0) +li $t1, 3 +sw $t1, 16($v0) +move $t1, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t1, 0($v0) +la $t1, Int_start +sw $t1, 4($v0) +# Load type offset +li $t1, 16 +sw $t1, 8($v0) +sw $t0, 12($v0) +sw $v0, -44($fp) +# LOCAL local_a2i_aux_at_A2I_internal_14 --> -60($fp) +# local_a2i_aux_at_A2I_internal_14 = SELF +sw $s1, -60($fp) +# LOCAL local_a2i_aux_at_A2I_internal_12 --> -52($fp) +# LOCAL local_a2i_aux_at_A2I_internal_14 --> -60($fp) +# local_a2i_aux_at_A2I_internal_12 = local_a2i_aux_at_A2I_internal_14 +lw $t0, -60($fp) +sw $t0, -52($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_a2i_aux_at_A2I_internal_15 --> -64($fp) +# PARAM param_a2i_aux_at_A2I_s_0 --> 0($fp) +# local_a2i_aux_at_A2I_internal_15 = PARAM param_a2i_aux_at_A2I_s_0 +lw $t0, 0($fp) +sw $t0, -64($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# ARG local_a2i_aux_at_A2I_i_5 +# LOCAL local_a2i_aux_at_A2I_i_5 --> -24($fp) +lw $t0, -24($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_a2i_aux_at_A2I_internal_17 --> -72($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 1 +sw $t0, 12($v0) +sw $v0, -72($fp) +# ARG local_a2i_aux_at_A2I_internal_17 +# LOCAL local_a2i_aux_at_A2I_internal_17 --> -72($fp) +lw $t0, -72($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_a2i_aux_at_A2I_internal_15 --> -64($fp) +# LOCAL local_a2i_aux_at_A2I_internal_16 --> -68($fp) +# local_a2i_aux_at_A2I_internal_16 = VCALL local_a2i_aux_at_A2I_internal_15 substr +# Save new self pointer in $s1 +lw $s1, -64($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 8($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -68($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# ARG local_a2i_aux_at_A2I_internal_16 +# LOCAL local_a2i_aux_at_A2I_internal_16 --> -68($fp) +lw $t0, -68($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_a2i_aux_at_A2I_internal_12 --> -52($fp) +# LOCAL local_a2i_aux_at_A2I_internal_13 --> -56($fp) +# local_a2i_aux_at_A2I_internal_13 = VCALL local_a2i_aux_at_A2I_internal_12 c2i +# Save new self pointer in $s1 +lw $s1, -52($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 12($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -56($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_a2i_aux_at_A2I_internal_9 --> -40($fp) +# LOCAL local_a2i_aux_at_A2I_internal_10 --> -44($fp) +# LOCAL local_a2i_aux_at_A2I_internal_13 --> -56($fp) +# local_a2i_aux_at_A2I_internal_9 = local_a2i_aux_at_A2I_internal_10 + local_a2i_aux_at_A2I_internal_13 +lw $t1, -44($fp) +lw $t0, 12($t1) +lw $t1, -56($fp) +lw $t2, 12($t1) +add $t0, $t0, $t2 +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t1, String +sw $t1, 0($v0) +la $t1, String_start +sw $t1, 4($v0) +# Load type offset +li $t1, 8 +sw $t1, 8($v0) +la $t1, Int +sw $t1, 12($v0) +li $t1, 3 +sw $t1, 16($v0) +move $t1, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t1, 0($v0) +la $t1, Int_start +sw $t1, 4($v0) +# Load type offset +li $t1, 16 +sw $t1, 8($v0) +sw $t0, 12($v0) +sw $v0, -40($fp) +# LOCAL local_a2i_aux_at_A2I_int_0 --> -4($fp) +# LOCAL local_a2i_aux_at_A2I_internal_9 --> -40($fp) +# local_a2i_aux_at_A2I_int_0 = local_a2i_aux_at_A2I_internal_9 +lw $t0, -40($fp) +sw $t0, -4($fp) +# LOCAL local_a2i_aux_at_A2I_internal_19 --> -80($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 1 +sw $t0, 12($v0) +sw $v0, -80($fp) +# LOCAL local_a2i_aux_at_A2I_internal_18 --> -76($fp) +# LOCAL local_a2i_aux_at_A2I_i_5 --> -24($fp) +# LOCAL local_a2i_aux_at_A2I_internal_19 --> -80($fp) +# local_a2i_aux_at_A2I_internal_18 = local_a2i_aux_at_A2I_i_5 + local_a2i_aux_at_A2I_internal_19 +lw $t1, -24($fp) +lw $t0, 12($t1) +lw $t1, -80($fp) +lw $t2, 12($t1) +add $t0, $t0, $t2 +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t1, String +sw $t1, 0($v0) +la $t1, String_start +sw $t1, 4($v0) +# Load type offset +li $t1, 8 +sw $t1, 8($v0) +la $t1, Int +sw $t1, 12($v0) +li $t1, 3 +sw $t1, 16($v0) +move $t1, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t1, 0($v0) +la $t1, Int_start +sw $t1, 4($v0) +# Load type offset +li $t1, 16 +sw $t1, 8($v0) +sw $t0, 12($v0) +sw $v0, -76($fp) +# LOCAL local_a2i_aux_at_A2I_i_5 --> -24($fp) +# LOCAL local_a2i_aux_at_A2I_internal_18 --> -76($fp) +# local_a2i_aux_at_A2I_i_5 = local_a2i_aux_at_A2I_internal_18 +lw $t0, -76($fp) +sw $t0, -24($fp) +# GOTO label_WHILE_231 +j label_WHILE_231 +label_WHILE_END_232: + # RETURN local_a2i_aux_at_A2I_int_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_a2i_aux_at_A2I. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 88 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_i2a_at_A2I implementation. +# @Params: +# 0($fp) = param_i2a_at_A2I_i_0 +function_i2a_at_A2I: + # Allocate stack frame for function function_i2a_at_A2I. + subu $sp, $sp, 96 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 96 + # LOCAL local_i2a_at_A2I_internal_4 --> -20($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -20($fp) + # IF_ZERO param_i2a_at_A2I_i_0 GOTO label_FALSE_237 + # IF_ZERO param_i2a_at_A2I_i_0 GOTO label_FALSE_237 + lw $t0, 0($fp) + beq $t0, 0, label_FALSE_237 + # IF_ZERO local_i2a_at_A2I_internal_4 GOTO label_FALSE_237 + # IF_ZERO local_i2a_at_A2I_internal_4 GOTO label_FALSE_237 + lw $t0, -20($fp) + beq $t0, 0, label_FALSE_237 + # LOCAL local_i2a_at_A2I_internal_3 --> -16($fp) + # PARAM param_i2a_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with String + la $v0, String + lw $a0, 0($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -16($fp) + # IF_ZERO local_i2a_at_A2I_internal_3 GOTO label_COMPARE_STRING_240 + # IF_ZERO local_i2a_at_A2I_internal_3 GOTO label_COMPARE_STRING_240 + lw $t0, -16($fp) + beq $t0, 0, label_COMPARE_STRING_240 + # LOCAL local_i2a_at_A2I_internal_3 --> -16($fp) + # PARAM param_i2a_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with Bool + la $v0, Bool + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -16($fp) + # IF_ZERO local_i2a_at_A2I_internal_3 GOTO label_COMPARE_BY_VALUE_241 + # IF_ZERO local_i2a_at_A2I_internal_3 GOTO label_COMPARE_BY_VALUE_241 + lw $t0, -16($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_241 + # LOCAL local_i2a_at_A2I_internal_3 --> -16($fp) + # PARAM param_i2a_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with Int + la $v0, Int + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -16($fp) + # IF_ZERO local_i2a_at_A2I_internal_3 GOTO label_COMPARE_BY_VALUE_241 + # IF_ZERO local_i2a_at_A2I_internal_3 GOTO label_COMPARE_BY_VALUE_241 + lw $t0, -16($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_241 + # LOCAL local_i2a_at_A2I_internal_3 --> -16($fp) + # PARAM param_i2a_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2a_at_A2I_internal_4 --> -20($fp) + # Load pointers and SUB + lw $a0, 0($fp) + lw $a1, -20($fp) + sub $a0, $a0, $a1 + sw $a0, -16($fp) + # IF_ZERO local_i2a_at_A2I_internal_3 GOTO label_TRUE_238 + # IF_ZERO local_i2a_at_A2I_internal_3 GOTO label_TRUE_238 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_238 + # GOTO label_FALSE_237 + j label_FALSE_237 + label_COMPARE_BY_VALUE_241: + # LOCAL local_i2a_at_A2I_internal_3 --> -16($fp) + # PARAM param_i2a_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2a_at_A2I_internal_4 --> -20($fp) + lw $a0, 0($fp) + lw $a1, -20($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -16($fp) + # IF_ZERO local_i2a_at_A2I_internal_3 GOTO label_TRUE_238 + # IF_ZERO local_i2a_at_A2I_internal_3 GOTO label_TRUE_238 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_238 + # GOTO label_FALSE_237 + j label_FALSE_237 + label_COMPARE_STRING_240: + # LOCAL local_i2a_at_A2I_internal_3 --> -16($fp) + # PARAM param_i2a_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2a_at_A2I_internal_4 --> -20($fp) + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -20($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -16($fp) + # IF_ZERO local_i2a_at_A2I_internal_3 GOTO label_CONTINUE_242 + # IF_ZERO local_i2a_at_A2I_internal_3 GOTO label_CONTINUE_242 + lw $t0, -16($fp) + beq $t0, 0, label_CONTINUE_242 + # GOTO label_FALSE_237 + j label_FALSE_237 + label_CONTINUE_242: + # LOCAL local_i2a_at_A2I_internal_3 --> -16($fp) + # PARAM param_i2a_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2a_at_A2I_internal_4 --> -20($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -20($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_243: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_244 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_243 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_244: + # Store result + sw $a2, -16($fp) + # IF_ZERO local_i2a_at_A2I_internal_3 GOTO label_TRUE_238 + # IF_ZERO local_i2a_at_A2I_internal_3 GOTO label_TRUE_238 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_238 + label_FALSE_237: + # LOCAL local_i2a_at_A2I_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -12($fp) + # GOTO label_END_239 +j label_END_239 +label_TRUE_238: + # LOCAL local_i2a_at_A2I_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -12($fp) + label_END_239: +# LOCAL local_i2a_at_A2I_internal_0 --> -4($fp) +# LOCAL local_i2a_at_A2I_internal_2 --> -12($fp) +# Obtain value from -12($fp) +lw $v0, -12($fp) +lw $v0, 12($v0) +sw $v0, -4($fp) +# IF_ZERO local_i2a_at_A2I_internal_0 GOTO label_FALSEIF_235 +# IF_ZERO local_i2a_at_A2I_internal_0 GOTO label_FALSEIF_235 +lw $t0, -4($fp) +beq $t0, 0, label_FALSEIF_235 +# LOCAL local_i2a_at_A2I_internal_5 --> -24($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_27 +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +sw $v0, -24($fp) +# LOCAL local_i2a_at_A2I_internal_1 --> -8($fp) +# LOCAL local_i2a_at_A2I_internal_5 --> -24($fp) +# local_i2a_at_A2I_internal_1 = local_i2a_at_A2I_internal_5 +lw $t0, -24($fp) +sw $t0, -8($fp) +# GOTO label_ENDIF_236 +j label_ENDIF_236 +label_FALSEIF_235: + # LOCAL local_i2a_at_A2I_internal_9 --> -40($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -40($fp) + # LOCAL local_i2a_at_A2I_internal_8 --> -36($fp) + # LOCAL local_i2a_at_A2I_internal_9 --> -40($fp) + # PARAM param_i2a_at_A2I_i_0 --> 0($fp) + lw $a0, -40($fp) + lw $a1, 0($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -36($fp) + # IF_GREATER_ZERO local_i2a_at_A2I_internal_8 GOTO label_FALSE_247 + # IF_GREATER_ZERO local_i2a_at_A2I_internal_8 GOTO label_FALSE_247 + lw $t0, -36($fp) + bgt $t0, 0, label_FALSE_247 + # IF_ZERO local_i2a_at_A2I_internal_8 GOTO label_FALSE_247 + # IF_ZERO local_i2a_at_A2I_internal_8 GOTO label_FALSE_247 + lw $t0, -36($fp) + beq $t0, 0, label_FALSE_247 + # LOCAL local_i2a_at_A2I_internal_8 --> -36($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -36($fp) + # GOTO label_END_248 +j label_END_248 +label_FALSE_247: + # LOCAL local_i2a_at_A2I_internal_8 --> -36($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -36($fp) + label_END_248: +# LOCAL local_i2a_at_A2I_internal_6 --> -28($fp) +# LOCAL local_i2a_at_A2I_internal_8 --> -36($fp) +# Obtain value from -36($fp) +lw $v0, -36($fp) +lw $v0, 12($v0) +sw $v0, -28($fp) +# IF_ZERO local_i2a_at_A2I_internal_6 GOTO label_FALSEIF_245 +# IF_ZERO local_i2a_at_A2I_internal_6 GOTO label_FALSEIF_245 +lw $t0, -28($fp) +beq $t0, 0, label_FALSEIF_245 +# LOCAL local_i2a_at_A2I_internal_12 --> -52($fp) +# local_i2a_at_A2I_internal_12 = SELF +sw $s1, -52($fp) +# LOCAL local_i2a_at_A2I_internal_10 --> -44($fp) +# LOCAL local_i2a_at_A2I_internal_12 --> -52($fp) +# local_i2a_at_A2I_internal_10 = local_i2a_at_A2I_internal_12 +lw $t0, -52($fp) +sw $t0, -44($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# ARG param_i2a_at_A2I_i_0 +# PARAM param_i2a_at_A2I_i_0 --> 0($fp) +lw $t0, 0($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_i2a_at_A2I_internal_10 --> -44($fp) +# LOCAL local_i2a_at_A2I_internal_11 --> -48($fp) +# local_i2a_at_A2I_internal_11 = VCALL local_i2a_at_A2I_internal_10 i2a_aux +# Save new self pointer in $s1 +lw $s1, -44($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 40($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -48($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_i2a_at_A2I_internal_7 --> -32($fp) +# LOCAL local_i2a_at_A2I_internal_11 --> -48($fp) +# local_i2a_at_A2I_internal_7 = local_i2a_at_A2I_internal_11 +lw $t0, -48($fp) +sw $t0, -32($fp) +# GOTO label_ENDIF_246 +j label_ENDIF_246 +label_FALSEIF_245: + # LOCAL local_i2a_at_A2I_internal_15 --> -64($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_28 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -64($fp) + # LOCAL local_i2a_at_A2I_internal_13 --> -56($fp) + # LOCAL local_i2a_at_A2I_internal_15 --> -64($fp) + # local_i2a_at_A2I_internal_13 = local_i2a_at_A2I_internal_15 + lw $t0, -64($fp) + sw $t0, -56($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_i2a_at_A2I_internal_18 --> -76($fp) + # local_i2a_at_A2I_internal_18 = SELF + sw $s1, -76($fp) + # LOCAL local_i2a_at_A2I_internal_16 --> -68($fp) + # LOCAL local_i2a_at_A2I_internal_18 --> -76($fp) + # local_i2a_at_A2I_internal_16 = local_i2a_at_A2I_internal_18 + lw $t0, -76($fp) + sw $t0, -68($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_i2a_at_A2I_internal_21 --> -88($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -88($fp) + # LOCAL local_i2a_at_A2I_internal_20 --> -84($fp) + # LOCAL local_i2a_at_A2I_internal_21 --> -88($fp) + lw $t0, -88($fp) + lw $t0, 12($t0) + not $t0, $t0 + add $t0, $t0, 1 + sw $t0, -84($fp) + # LOCAL local_i2a_at_A2I_internal_20 --> -84($fp) + # LOCAL local_i2a_at_A2I_internal_20 --> -84($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + lw $t0, -84($fp) + sw $t0, 12($v0) + sw $v0, -84($fp) + # LOCAL local_i2a_at_A2I_internal_19 --> -80($fp) + # PARAM param_i2a_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2a_at_A2I_internal_20 --> -84($fp) + # local_i2a_at_A2I_internal_19 = PARAM param_i2a_at_A2I_i_0 * local_i2a_at_A2I_internal_20 + lw $t1, 0($fp) + lw $t0, 12($t1) + lw $t1, -84($fp) + lw $t2, 12($t1) + mul $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -80($fp) + # ARG local_i2a_at_A2I_internal_19 + # LOCAL local_i2a_at_A2I_internal_19 --> -80($fp) + lw $t0, -80($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_i2a_at_A2I_internal_16 --> -68($fp) + # LOCAL local_i2a_at_A2I_internal_17 --> -72($fp) + # local_i2a_at_A2I_internal_17 = VCALL local_i2a_at_A2I_internal_16 i2a_aux + # Save new self pointer in $s1 + lw $s1, -68($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 40($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -72($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # ARG local_i2a_at_A2I_internal_17 + # LOCAL local_i2a_at_A2I_internal_17 --> -72($fp) + lw $t0, -72($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_i2a_at_A2I_internal_13 --> -56($fp) + # LOCAL local_i2a_at_A2I_internal_14 --> -60($fp) + # local_i2a_at_A2I_internal_14 = VCALL local_i2a_at_A2I_internal_13 concat + # Save new self pointer in $s1 + lw $s1, -56($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 36($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -60($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_i2a_at_A2I_internal_7 --> -32($fp) + # LOCAL local_i2a_at_A2I_internal_14 --> -60($fp) + # local_i2a_at_A2I_internal_7 = local_i2a_at_A2I_internal_14 + lw $t0, -60($fp) + sw $t0, -32($fp) + label_ENDIF_246: +# LOCAL local_i2a_at_A2I_internal_1 --> -8($fp) +# LOCAL local_i2a_at_A2I_internal_7 --> -32($fp) +# local_i2a_at_A2I_internal_1 = local_i2a_at_A2I_internal_7 +lw $t0, -32($fp) +sw $t0, -8($fp) +label_ENDIF_236: +# RETURN local_i2a_at_A2I_internal_1 +lw $v0, -8($fp) +# Deallocate stack frame for function function_i2a_at_A2I. +# Restore $ra +lw $ra, 4($sp) +# Restore $fp +lw $fp, 0($sp) +# Restore Stack pointer $sp +addu $sp, $sp, 96 +# Deallocate function args +addu $sp, $sp, 4 +jr $ra +# Function END + + +# function_i2a_aux_at_A2I implementation. +# @Params: +# 0($fp) = param_i2a_aux_at_A2I_i_0 +function_i2a_aux_at_A2I: + # Allocate stack frame for function function_i2a_aux_at_A2I. + subu $sp, $sp, 88 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 88 + # LOCAL local_i2a_aux_at_A2I_internal_4 --> -20($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -20($fp) + # IF_ZERO param_i2a_aux_at_A2I_i_0 GOTO label_FALSE_251 + # IF_ZERO param_i2a_aux_at_A2I_i_0 GOTO label_FALSE_251 + lw $t0, 0($fp) + beq $t0, 0, label_FALSE_251 + # IF_ZERO local_i2a_aux_at_A2I_internal_4 GOTO label_FALSE_251 + # IF_ZERO local_i2a_aux_at_A2I_internal_4 GOTO label_FALSE_251 + lw $t0, -20($fp) + beq $t0, 0, label_FALSE_251 + # LOCAL local_i2a_aux_at_A2I_internal_3 --> -16($fp) + # PARAM param_i2a_aux_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with String + la $v0, String + lw $a0, 0($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -16($fp) + # IF_ZERO local_i2a_aux_at_A2I_internal_3 GOTO label_COMPARE_STRING_254 + # IF_ZERO local_i2a_aux_at_A2I_internal_3 GOTO label_COMPARE_STRING_254 + lw $t0, -16($fp) + beq $t0, 0, label_COMPARE_STRING_254 + # LOCAL local_i2a_aux_at_A2I_internal_3 --> -16($fp) + # PARAM param_i2a_aux_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with Bool + la $v0, Bool + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -16($fp) + # IF_ZERO local_i2a_aux_at_A2I_internal_3 GOTO label_COMPARE_BY_VALUE_255 + # IF_ZERO local_i2a_aux_at_A2I_internal_3 GOTO label_COMPARE_BY_VALUE_255 + lw $t0, -16($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_255 + # LOCAL local_i2a_aux_at_A2I_internal_3 --> -16($fp) + # PARAM param_i2a_aux_at_A2I_i_0 --> 0($fp) + # Comparing 0($fp) type with Int + la $v0, Int + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -16($fp) + # IF_ZERO local_i2a_aux_at_A2I_internal_3 GOTO label_COMPARE_BY_VALUE_255 + # IF_ZERO local_i2a_aux_at_A2I_internal_3 GOTO label_COMPARE_BY_VALUE_255 + lw $t0, -16($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_255 + # LOCAL local_i2a_aux_at_A2I_internal_3 --> -16($fp) + # PARAM param_i2a_aux_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2a_aux_at_A2I_internal_4 --> -20($fp) + # Load pointers and SUB + lw $a0, 0($fp) + lw $a1, -20($fp) + sub $a0, $a0, $a1 + sw $a0, -16($fp) + # IF_ZERO local_i2a_aux_at_A2I_internal_3 GOTO label_TRUE_252 + # IF_ZERO local_i2a_aux_at_A2I_internal_3 GOTO label_TRUE_252 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_252 + # GOTO label_FALSE_251 + j label_FALSE_251 + label_COMPARE_BY_VALUE_255: + # LOCAL local_i2a_aux_at_A2I_internal_3 --> -16($fp) + # PARAM param_i2a_aux_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2a_aux_at_A2I_internal_4 --> -20($fp) + lw $a0, 0($fp) + lw $a1, -20($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -16($fp) + # IF_ZERO local_i2a_aux_at_A2I_internal_3 GOTO label_TRUE_252 + # IF_ZERO local_i2a_aux_at_A2I_internal_3 GOTO label_TRUE_252 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_252 + # GOTO label_FALSE_251 + j label_FALSE_251 + label_COMPARE_STRING_254: + # LOCAL local_i2a_aux_at_A2I_internal_3 --> -16($fp) + # PARAM param_i2a_aux_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2a_aux_at_A2I_internal_4 --> -20($fp) + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -20($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -16($fp) + # IF_ZERO local_i2a_aux_at_A2I_internal_3 GOTO label_CONTINUE_256 + # IF_ZERO local_i2a_aux_at_A2I_internal_3 GOTO label_CONTINUE_256 + lw $t0, -16($fp) + beq $t0, 0, label_CONTINUE_256 + # GOTO label_FALSE_251 + j label_FALSE_251 + label_CONTINUE_256: + # LOCAL local_i2a_aux_at_A2I_internal_3 --> -16($fp) + # PARAM param_i2a_aux_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2a_aux_at_A2I_internal_4 --> -20($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -20($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_257: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_258 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_257 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_258: + # Store result + sw $a2, -16($fp) + # IF_ZERO local_i2a_aux_at_A2I_internal_3 GOTO label_TRUE_252 + # IF_ZERO local_i2a_aux_at_A2I_internal_3 GOTO label_TRUE_252 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_252 + label_FALSE_251: + # LOCAL local_i2a_aux_at_A2I_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -12($fp) + # GOTO label_END_253 +j label_END_253 +label_TRUE_252: + # LOCAL local_i2a_aux_at_A2I_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -12($fp) + label_END_253: +# LOCAL local_i2a_aux_at_A2I_internal_0 --> -4($fp) +# LOCAL local_i2a_aux_at_A2I_internal_2 --> -12($fp) +# Obtain value from -12($fp) +lw $v0, -12($fp) +lw $v0, 12($v0) +sw $v0, -4($fp) +# IF_ZERO local_i2a_aux_at_A2I_internal_0 GOTO label_FALSEIF_249 +# IF_ZERO local_i2a_aux_at_A2I_internal_0 GOTO label_FALSEIF_249 +lw $t0, -4($fp) +beq $t0, 0, label_FALSEIF_249 +# LOCAL local_i2a_aux_at_A2I_internal_5 --> -24($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_29 +sw $t0, 12($v0) +li $t0, 0 +sw $t0, 16($v0) +sw $v0, -24($fp) +# LOCAL local_i2a_aux_at_A2I_internal_1 --> -8($fp) +# LOCAL local_i2a_aux_at_A2I_internal_5 --> -24($fp) +# local_i2a_aux_at_A2I_internal_1 = local_i2a_aux_at_A2I_internal_5 +lw $t0, -24($fp) +sw $t0, -8($fp) +# GOTO label_ENDIF_250 +j label_ENDIF_250 +label_FALSEIF_249: + # LOCAL local_i2a_aux_at_A2I_next_6 --> -28($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -28($fp) + # LOCAL local_i2a_aux_at_A2I_internal_8 --> -36($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 10 + sw $t0, 12($v0) + sw $v0, -36($fp) + # LOCAL local_i2a_aux_at_A2I_internal_7 --> -32($fp) + # PARAM param_i2a_aux_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2a_aux_at_A2I_internal_8 --> -36($fp) + # local_i2a_aux_at_A2I_internal_7 = PARAM param_i2a_aux_at_A2I_i_0 / local_i2a_aux_at_A2I_internal_8 + lw $t1, 0($fp) + lw $t0, 12($t1) + lw $t1, -36($fp) + lw $t2, 12($t1) + div $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -32($fp) + # LOCAL local_i2a_aux_at_A2I_next_6 --> -28($fp) + # LOCAL local_i2a_aux_at_A2I_internal_7 --> -32($fp) + # local_i2a_aux_at_A2I_next_6 = local_i2a_aux_at_A2I_internal_7 + lw $t0, -32($fp) + sw $t0, -28($fp) + # LOCAL local_i2a_aux_at_A2I_internal_13 --> -56($fp) + # local_i2a_aux_at_A2I_internal_13 = SELF + sw $s1, -56($fp) + # LOCAL local_i2a_aux_at_A2I_internal_11 --> -48($fp) + # LOCAL local_i2a_aux_at_A2I_internal_13 --> -56($fp) + # local_i2a_aux_at_A2I_internal_11 = local_i2a_aux_at_A2I_internal_13 + lw $t0, -56($fp) + sw $t0, -48($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # ARG local_i2a_aux_at_A2I_next_6 + # LOCAL local_i2a_aux_at_A2I_next_6 --> -28($fp) + lw $t0, -28($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_i2a_aux_at_A2I_internal_11 --> -48($fp) + # LOCAL local_i2a_aux_at_A2I_internal_12 --> -52($fp) + # local_i2a_aux_at_A2I_internal_12 = VCALL local_i2a_aux_at_A2I_internal_11 i2a_aux + # Save new self pointer in $s1 + lw $s1, -48($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 40($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -52($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_i2a_aux_at_A2I_internal_9 --> -40($fp) + # LOCAL local_i2a_aux_at_A2I_internal_12 --> -52($fp) + # local_i2a_aux_at_A2I_internal_9 = local_i2a_aux_at_A2I_internal_12 + lw $t0, -52($fp) + sw $t0, -40($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_i2a_aux_at_A2I_internal_16 --> -68($fp) + # local_i2a_aux_at_A2I_internal_16 = SELF + sw $s1, -68($fp) + # LOCAL local_i2a_aux_at_A2I_internal_14 --> -60($fp) + # LOCAL local_i2a_aux_at_A2I_internal_16 --> -68($fp) + # local_i2a_aux_at_A2I_internal_14 = local_i2a_aux_at_A2I_internal_16 + lw $t0, -68($fp) + sw $t0, -60($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_i2a_aux_at_A2I_internal_19 --> -80($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 10 + sw $t0, 12($v0) + sw $v0, -80($fp) + # LOCAL local_i2a_aux_at_A2I_internal_18 --> -76($fp) + # LOCAL local_i2a_aux_at_A2I_next_6 --> -28($fp) + # LOCAL local_i2a_aux_at_A2I_internal_19 --> -80($fp) + # local_i2a_aux_at_A2I_internal_18 = local_i2a_aux_at_A2I_next_6 * local_i2a_aux_at_A2I_internal_19 + lw $t1, -28($fp) + lw $t0, 12($t1) + lw $t1, -80($fp) + lw $t2, 12($t1) + mul $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -76($fp) + # LOCAL local_i2a_aux_at_A2I_internal_17 --> -72($fp) + # PARAM param_i2a_aux_at_A2I_i_0 --> 0($fp) + # LOCAL local_i2a_aux_at_A2I_internal_18 --> -76($fp) + # local_i2a_aux_at_A2I_internal_17 = PARAM param_i2a_aux_at_A2I_i_0 - local_i2a_aux_at_A2I_internal_18 + lw $t1, 0($fp) + lw $t0, 12($t1) + lw $t1, -76($fp) + lw $t2, 12($t1) + sub $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -72($fp) + # ARG local_i2a_aux_at_A2I_internal_17 + # LOCAL local_i2a_aux_at_A2I_internal_17 --> -72($fp) + lw $t0, -72($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_i2a_aux_at_A2I_internal_14 --> -60($fp) + # LOCAL local_i2a_aux_at_A2I_internal_15 --> -64($fp) + # local_i2a_aux_at_A2I_internal_15 = VCALL local_i2a_aux_at_A2I_internal_14 i2c + # Save new self pointer in $s1 + lw $s1, -60($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 60($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -64($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # ARG local_i2a_aux_at_A2I_internal_15 + # LOCAL local_i2a_aux_at_A2I_internal_15 --> -64($fp) + lw $t0, -64($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_i2a_aux_at_A2I_internal_9 --> -40($fp) + # LOCAL local_i2a_aux_at_A2I_internal_10 --> -44($fp) + # local_i2a_aux_at_A2I_internal_10 = VCALL local_i2a_aux_at_A2I_internal_9 concat + # Save new self pointer in $s1 + lw $s1, -40($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 36($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -44($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_i2a_aux_at_A2I_internal_1 --> -8($fp) + # LOCAL local_i2a_aux_at_A2I_internal_10 --> -44($fp) + # local_i2a_aux_at_A2I_internal_1 = local_i2a_aux_at_A2I_internal_10 + lw $t0, -44($fp) + sw $t0, -8($fp) + label_ENDIF_250: +# RETURN local_i2a_aux_at_A2I_internal_1 +lw $v0, -8($fp) +# Deallocate stack frame for function function_i2a_aux_at_A2I. +# Restore $ra +lw $ra, 4($sp) +# Restore $fp +lw $fp, 0($sp) +# Restore Stack pointer $sp +addu $sp, $sp, 88 +# Deallocate function args +addu $sp, $sp, 4 +jr $ra +# Function END + + +# function_main_at_Main implementation. +# @Params: +function_main_at_Main: + # Allocate stack frame for function function_main_at_Main. + subu $sp, $sp, 104 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 104 + # LOCAL local_main_at_Main_a_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -4($fp) + # LOCAL local_main_at_Main_internal_3 --> -16($fp) + # local_main_at_Main_internal_3 = ALLOCATE A2I + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, A2I + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 12 bytes of memory + li $a0, 12 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, A2I_start + sw $t0, 4($v0) + # Load type offset + li $t0, 20 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -16($fp) + # LOCAL local_main_at_Main_internal_1 --> -8($fp) + # LOCAL local_main_at_Main_internal_3 --> -16($fp) + # local_main_at_Main_internal_1 = local_main_at_Main_internal_3 + lw $t0, -16($fp) + sw $t0, -8($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_4 --> -20($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_30 + sw $t0, 12($v0) + li $t0, 6 + sw $t0, 16($v0) + sw $v0, -20($fp) + # ARG local_main_at_Main_internal_4 + # LOCAL local_main_at_Main_internal_4 --> -20($fp) + lw $t0, -20($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_main_at_Main_internal_1 --> -8($fp) + # LOCAL local_main_at_Main_internal_2 --> -12($fp) + # local_main_at_Main_internal_2 = VCALL local_main_at_Main_internal_1 a2i + # Save new self pointer in $s1 + lw $s1, -8($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 52($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -12($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_main_at_Main_a_0 --> -4($fp) + # LOCAL local_main_at_Main_internal_2 --> -12($fp) + # local_main_at_Main_a_0 = local_main_at_Main_internal_2 + lw $t0, -12($fp) + sw $t0, -4($fp) + # LOCAL local_main_at_Main_b_5 --> -24($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_0 + sw $t0, 12($v0) + li $t0, 0 + sw $t0, 16($v0) + sw $v0, -24($fp) + # LOCAL local_main_at_Main_internal_8 --> -36($fp) + # local_main_at_Main_internal_8 = ALLOCATE A2I + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, A2I + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 12 bytes of memory + li $a0, 12 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, A2I_start + sw $t0, 4($v0) + # Load type offset + li $t0, 20 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -36($fp) + # LOCAL local_main_at_Main_internal_6 --> -28($fp) + # LOCAL local_main_at_Main_internal_8 --> -36($fp) + # local_main_at_Main_internal_6 = local_main_at_Main_internal_8 + lw $t0, -36($fp) + sw $t0, -28($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_9 --> -40($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 678987 + sw $t0, 12($v0) + sw $v0, -40($fp) + # ARG local_main_at_Main_internal_9 + # LOCAL local_main_at_Main_internal_9 --> -40($fp) + lw $t0, -40($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_main_at_Main_internal_6 --> -28($fp) + # LOCAL local_main_at_Main_internal_7 --> -32($fp) + # local_main_at_Main_internal_7 = VCALL local_main_at_Main_internal_6 i2a + # Save new self pointer in $s1 + lw $s1, -28($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 48($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -32($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_main_at_Main_b_5 --> -24($fp) + # LOCAL local_main_at_Main_internal_7 --> -32($fp) + # local_main_at_Main_b_5 = local_main_at_Main_internal_7 + lw $t0, -32($fp) + sw $t0, -24($fp) + # LOCAL local_main_at_Main_internal_12 --> -52($fp) + # local_main_at_Main_internal_12 = SELF + sw $s1, -52($fp) + # LOCAL local_main_at_Main_internal_10 --> -44($fp) + # LOCAL local_main_at_Main_internal_12 --> -52($fp) + # local_main_at_Main_internal_10 = local_main_at_Main_internal_12 + lw $t0, -52($fp) + sw $t0, -44($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # ARG local_main_at_Main_a_0 + # LOCAL local_main_at_Main_a_0 --> -4($fp) + lw $t0, -4($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_main_at_Main_internal_10 --> -44($fp) + # LOCAL local_main_at_Main_internal_11 --> -48($fp) + # local_main_at_Main_internal_11 = VCALL local_main_at_Main_internal_10 out_int + # Save new self pointer in $s1 + lw $s1, -44($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 24($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -48($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_main_at_Main_internal_15 --> -64($fp) + # local_main_at_Main_internal_15 = SELF + sw $s1, -64($fp) + # LOCAL local_main_at_Main_internal_13 --> -56($fp) + # LOCAL local_main_at_Main_internal_15 --> -64($fp) + # local_main_at_Main_internal_13 = local_main_at_Main_internal_15 + lw $t0, -64($fp) + sw $t0, -56($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_16 --> -68($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_31 + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + sw $v0, -68($fp) + # ARG local_main_at_Main_internal_16 + # LOCAL local_main_at_Main_internal_16 --> -68($fp) + lw $t0, -68($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_main_at_Main_internal_13 --> -56($fp) + # LOCAL local_main_at_Main_internal_14 --> -60($fp) + # local_main_at_Main_internal_14 = VCALL local_main_at_Main_internal_13 out_string + # Save new self pointer in $s1 + lw $s1, -56($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 4($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -60($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_main_at_Main_internal_19 --> -80($fp) + # local_main_at_Main_internal_19 = SELF + sw $s1, -80($fp) + # LOCAL local_main_at_Main_internal_17 --> -72($fp) + # LOCAL local_main_at_Main_internal_19 --> -80($fp) + # local_main_at_Main_internal_17 = local_main_at_Main_internal_19 + lw $t0, -80($fp) + sw $t0, -72($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # ARG local_main_at_Main_b_5 + # LOCAL local_main_at_Main_b_5 --> -24($fp) + lw $t0, -24($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_main_at_Main_internal_17 --> -72($fp) + # LOCAL local_main_at_Main_internal_18 --> -76($fp) + # local_main_at_Main_internal_18 = VCALL local_main_at_Main_internal_17 out_string + # Save new self pointer in $s1 + lw $s1, -72($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 4($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -76($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_main_at_Main_internal_22 --> -92($fp) + # local_main_at_Main_internal_22 = SELF + sw $s1, -92($fp) + # LOCAL local_main_at_Main_internal_20 --> -84($fp) + # LOCAL local_main_at_Main_internal_22 --> -92($fp) + # local_main_at_Main_internal_20 = local_main_at_Main_internal_22 + lw $t0, -92($fp) + sw $t0, -84($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_23 --> -96($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_32 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -96($fp) + # ARG local_main_at_Main_internal_23 + # LOCAL local_main_at_Main_internal_23 --> -96($fp) + lw $t0, -96($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_main_at_Main_internal_20 --> -84($fp) + # LOCAL local_main_at_Main_internal_21 --> -88($fp) + # local_main_at_Main_internal_21 = VCALL local_main_at_Main_internal_20 out_string + # Save new self pointer in $s1 + lw $s1, -84($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 4($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -88($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # RETURN local_main_at_Main_internal_21 + lw $v0, -88($fp) + # Deallocate stack frame for function function_main_at_Main. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 104 + jr $ra + # Function END + diff --git a/tests/codegen/book_list.mips b/tests/codegen/book_list.mips new file mode 100644 index 00000000..2292ca7e --- /dev/null +++ b/tests/codegen/book_list.mips @@ -0,0 +1,3057 @@ + +# Code generated by PyCoolc. +# Eliane Puerta, Liset Alfaro, Adrian Gonzalez --- Mon Dec 14 11:08:39 2020 +# School of Math and Computer Science, University of Havana +# + +.data +dummy: .word 0 +IO: .asciiz "IO" +# Function END +Object: .asciiz "Object" +# Function END +String: .asciiz "String" +# Function END +Bool: .asciiz "Bool" +# Function END +Int: .asciiz "Int" +# Function END +Main: .asciiz "Main" +# Function END +BookList: .asciiz "BookList" +# Function END +Nil: .asciiz "Nil" +# Function END +Cons: .asciiz "Cons" +# Function END +Book: .asciiz "Book" +# Function END +Article: .asciiz "Article" +# Function END +# + + +# **** VTABLE for type IO **** +IO_vtable: .word dummy, function_abort_at_Object, function_in_int_at_IO, dummy, dummy, function_out_string_at_IO, function_out_int_at_IO, dummy, dummy, function_copy_at_Object, dummy, dummy, dummy, dummy, function_in_string_at_IO, dummy, function_type_name_at_Object, dummy, dummy, dummy +# Function END +# + + +# **** Type RECORD for type IO **** +IO_start: + IO_vtable_pointer: .word IO_vtable + # Function END +IO_end: +# + + +# **** VTABLE for type Object **** +Object_vtable: .word dummy, function_abort_at_Object, dummy, dummy, dummy, dummy, dummy, dummy, dummy, function_copy_at_Object, dummy, dummy, dummy, dummy, dummy, dummy, function_type_name_at_Object, dummy, dummy, dummy +# Function END +# + + +# **** Type RECORD for type Object **** +Object_start: + Object_vtable_pointer: .word Object_vtable + # Function END +Object_end: +# + + +# **** VTABLE for type String **** +String_vtable: .word dummy, function_abort_at_Object, dummy, dummy, dummy, dummy, dummy, dummy, dummy, function_copy_at_Object, dummy, function_concat_at_String, dummy, dummy, dummy, function_length_at_String, function_type_name_at_Object, dummy, dummy, function_substr_at_String +# Function END +# + + +# **** Type RECORD for type String **** +String_start: + String_vtable_pointer: .word String_vtable + # Function END +String_end: +# + + +# **** VTABLE for type Bool **** +Bool_vtable: .word dummy, function_abort_at_Object, dummy, dummy, dummy, dummy, dummy, dummy, dummy, function_copy_at_Object, dummy, dummy, dummy, dummy, dummy, dummy, function_type_name_at_Object, dummy, dummy, dummy +# Function END +# + + +# **** Type RECORD for type Bool **** +Bool_start: + Bool_vtable_pointer: .word Bool_vtable + # Function END +Bool_end: +# + + +# **** VTABLE for type Int **** +Int_vtable: .word dummy, function_abort_at_Object, dummy, dummy, dummy, dummy, dummy, dummy, dummy, function_copy_at_Object, dummy, dummy, dummy, dummy, dummy, dummy, function_type_name_at_Object, dummy, dummy, dummy +# Function END +# + + +# **** Type RECORD for type Int **** +Int_start: + Int_vtable_pointer: .word Int_vtable + # Function END +Int_end: +# + + +# **** VTABLE for type Main **** +Main_vtable: .word dummy, function_abort_at_Object, dummy, dummy, dummy, dummy, dummy, dummy, dummy, function_copy_at_Object, dummy, dummy, dummy, dummy, dummy, dummy, function_type_name_at_Object, dummy, function_main_at_Main, dummy +# Function END +# + + +# **** Type RECORD for type Main **** +Main_start: + Main_vtable_pointer: .word Main_vtable + # Function END +Main_end: +# + + +# **** VTABLE for type BookList **** +BookList_vtable: .word function_isNil_at_BookList, function_abort_at_Object, function_in_int_at_IO, function_car_at_BookList, function_cdr_at_BookList, function_out_string_at_IO, function_out_int_at_IO, dummy, function_cons_at_BookList, function_copy_at_Object, dummy, dummy, dummy, dummy, function_in_string_at_IO, dummy, function_type_name_at_Object, function_print_list_at_BookList, dummy, dummy +# Function END +# + + +# **** Type RECORD for type BookList **** +BookList_start: + BookList_vtable_pointer: .word BookList_vtable + # Function END +BookList_end: +# + + +# **** VTABLE for type Nil **** +Nil_vtable: .word function_isNil_at_Nil, function_abort_at_Object, function_in_int_at_IO, function_car_at_BookList, function_cdr_at_BookList, function_out_string_at_IO, function_out_int_at_IO, dummy, function_cons_at_BookList, function_copy_at_Object, dummy, dummy, dummy, dummy, function_in_string_at_IO, dummy, function_type_name_at_Object, function_print_list_at_Nil, dummy, dummy +# Function END +# + + +# **** Type RECORD for type Nil **** +Nil_start: + Nil_vtable_pointer: .word Nil_vtable + # Function END +Nil_end: +# + + +# **** VTABLE for type Cons **** +Cons_vtable: .word function_isNil_at_Cons, function_abort_at_Object, function_in_int_at_IO, function_car_at_Cons, function_cdr_at_Cons, function_out_string_at_IO, function_out_int_at_IO, dummy, function_cons_at_BookList, function_copy_at_Object, dummy, dummy, dummy, function_init_at_Cons, function_in_string_at_IO, dummy, function_type_name_at_Object, function_print_list_at_Cons, dummy, dummy +# Function END +# + + +# **** Type RECORD for type Cons **** +Cons_start: + Cons_vtable_pointer: .word Cons_vtable + # Function END +Cons_end: +# + + +# **** VTABLE for type Book **** +Book_vtable: .word dummy, function_abort_at_Object, function_in_int_at_IO, dummy, dummy, function_out_string_at_IO, function_out_int_at_IO, function_initBook_at_Book, dummy, function_copy_at_Object, function_print_at_Book, dummy, dummy, dummy, function_in_string_at_IO, dummy, function_type_name_at_Object, dummy, dummy, dummy +# Function END +# + + +# **** Type RECORD for type Book **** +Book_start: + Book_vtable_pointer: .word Book_vtable + # Function END +Book_end: +# + + +# **** VTABLE for type Article **** +Article_vtable: .word dummy, function_abort_at_Object, function_in_int_at_IO, dummy, dummy, function_out_string_at_IO, function_out_int_at_IO, function_initBook_at_Book, dummy, function_copy_at_Object, function_print_at_Article, dummy, function_initArticle_at_Article, dummy, function_in_string_at_IO, dummy, function_type_name_at_Object, dummy, dummy, dummy +# Function END +# + + +# **** Type RECORD for type Article **** +Article_start: + Article_vtable_pointer: .word Article_vtable + # Function END +Article_end: +# + + +data_0: .asciiz "" +# + + +data_1: .asciiz "Abort called from class " +# + + +data_2: .asciiz "\n" +# + + +IO__TDT: .word 0, -1, -1, -1, -1, -1, 1, 2, 2, 1, 2 +Object__TDT: .word 1, 0, 1, 1, 1, 1, 2, 3, 3, 2, 3 +String__TDT: .word -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1 +Bool__TDT: .word -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1 +Int__TDT: .word -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1 +Main__TDT: .word -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1 +BookList__TDT: .word -1, -1, -1, -1, -1, -1, 0, 1, 1, -1, -1 +Nil__TDT: .word -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1 +Cons__TDT: .word -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1 +Book__TDT: .word -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1 +Article__TDT: .word -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0 +# + + +data_4: .asciiz "Compilers, Principles, Techniques, and Tools" +# + + +data_5: .asciiz "Aho, Sethi, and Ullman" +# + + +data_6: .asciiz "The Top 100 CD_ROMs" +# + + +data_7: .asciiz "Ulanoff" +# + + +data_8: .asciiz "PC Magazine" +# + + +data_9: .asciiz "- dynamic type was Book -\n" +# + + +data_10: .asciiz "- dynamic type was Article -\n" +# + + +data_11: .asciiz "title: " +# + + +data_12: .asciiz "\n" +# + + +data_13: .asciiz "author: " +# + + +data_14: .asciiz "\n" +# + + +data_15: .asciiz "periodical: " +# + + +data_16: .asciiz "\n" +# + + +.text +main: + jal entry + # syscall code 10 is for exit + li $v0, 10 + syscall + # Function END + +# function_in_string_at_IO implementation. +# @Params: +function_in_string_at_IO: + # Allocate stack frame for function function_in_string_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_in_string_at_IO_internal_0 --> -4($fp) + # Allocating 1024 bytes of memory + li $a0, 1024 + li $v0, 9 + syscall + move $t0, $v0 + move $a0, $v0 + li $a1, 1024 + li $v0, 8 + syscall + move $t2, $zero + move $t3, $zero + move $t1, $t0 + lb $t3, 0($t1) + beqz $t3, end_loop + read_length_loop: + lb $t3, 0($t1) + beqz $t3, end_read_length_loop + addu $t1, $t1, 1 + addu $t2, $t2, 1 + j read_length_loop + end_read_length_loop: + subu $t1, $t1, 1 + sb $zero, 0($t1) + subu $t2, $t2, 1 + end_loop: + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $t2, 16($v0) + sw $v0, -4($fp) + # RETURN local_in_string_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_in_string_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_out_int_at_IO implementation. +# @Params: +# 0($fp) = param_out_int_at_IO_x_0 +function_out_int_at_IO: + # Allocate stack frame for function function_out_int_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # PRINT_INT param_out_int_at_IO_x_0 + # PARAM param_out_int_at_IO_x_0 --> 0($fp) + lw $v0, 0($fp) + lw $a0, 12($v0) + li $v0, 1 + syscall + # LOCAL local_out_int_at_IO_internal_0 --> -4($fp) + # local_out_int_at_IO_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_out_int_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_out_int_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_out_string_at_IO implementation. +# @Params: +# 0($fp) = param_out_string_at_IO_x_0 +function_out_string_at_IO: + # Allocate stack frame for function function_out_string_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # PARAM param_out_string_at_IO_x_0 --> 0($fp) + # PRINT_STR param_out_string_at_IO_x_0 + lw $v0, 0($fp) + lw $a0, 12($v0) + li $v0, 4 + syscall + # LOCAL local_out_string_at_IO_internal_0 --> -4($fp) + # local_out_string_at_IO_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_out_string_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_out_string_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_in_int_at_IO implementation. +# @Params: +function_in_int_at_IO: + # Allocate stack frame for function function_in_int_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_in_int_at_IO_internal_0 --> -4($fp) + # local_in_int_at_IO_internal_0 = READ_INT + li $v0, 5 + syscall + move $a2, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + sw $a2, 12($v0) + sw $v0, -4($fp) + # RETURN local_in_int_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_in_int_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_abort_at_Object implementation. +# @Params: +function_abort_at_Object: + # Allocate stack frame for function function_abort_at_Object. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_abort_at_Object_internal_0 --> -4($fp) + lw $t0, 0($s1) + sw $t0, -4($fp) + # LOCAL local_abort_at_Object_internal_0 --> -4($fp) + la $a0, data_1 + li $v0, 4 + syscall + lw $a0, -4($fp) + li $v0, 4 + syscall + la $a0, data_2 + li $v0, 4 + syscall + li $v0, 10 + syscall + # Function END + + +# function_copy_at_Object implementation. +# @Params: +function_copy_at_Object: + # Allocate stack frame for function function_copy_at_Object. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_copy_at_Object_internal_0 --> -4($fp) + # local_copy_at_Object_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_copy_at_Object_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function function_copy_at_Object. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_type_name_at_Object implementation. +# @Params: +function_type_name_at_Object: + # Allocate stack frame for function function_type_name_at_Object. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_type_name_at_Object_internal_0 --> -4($fp) + lw $t0, 0($s1) + sw $t0, -4($fp) + # RETURN local_type_name_at_Object_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_type_name_at_Object. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_concat_at_String implementation. +# @Params: +# 0($fp) = param_concat_at_String_s_0 +function_concat_at_String: + # Allocate stack frame for function function_concat_at_String. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_concat_at_String_internal_0 = self.CONCAT + # LOCAL local_concat_at_String_internal_0 --> -4($fp) + # PARAM param_concat_at_String_s_0 --> 0($fp) + # Get first string length from self + lw $t0, 16($s1) + # Get second string length from param + lw $v0, 0($fp) + lw $t1, 16($v0) + # Save new string length in a0 for memory allocation + addu $a0, $t0, $t1 + move $t3, $a0 + # Get first string from self + lw $t0, 12($s1) + # Get second string from param + lw $t1, 12($v0) + addu $a0, $a0, 4 + li $v0, 9 + syscall + move $t2, $v0 + move $t4, $zero + concat_loop1: + # Compare t0 with \0 + lb $t4, 0($t0) + beqz $t4, concat_loop1_end + # Copy 1 byte + sb $t4, 0($t2) + addu $t2, $t2, 1 + addu $t0, $t0, 1 + j concat_loop1 + concat_loop1_end: + # Copy second string + concat_loop2: + # Compare t1 with \0 + lb $t4, 0($t1) + beqz $t4, concat_loop2_end + # Copy 1 byte + sb $t4, 0($t2) + addu $t2, $t2, 1 + addu $t1, $t1, 1 + j concat_loop2 + concat_loop2_end: + sb $zero, 0($t2) + # v0 contains resulting string + move $t1, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + sw $t1, 12($v0) + sw $t3, 16($v0) + sw $v0, -4($fp) + # RETURN local_concat_at_String_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_concat_at_String. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_substr_at_String implementation. +# @Params: +# 0($fp) = param_substr_at_String_l_0 +# 4($fp) = param_substr_at_String_r_1 +function_substr_at_String: + # Allocate stack frame for function function_substr_at_String. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_substr_at_String_internal_0 --> -4($fp) + # PARAM param_substr_at_String_l_0 --> 4($fp) + # PARAM param_substr_at_String_r_1 --> 0($fp) + lw $t0, 12($s1) + lw $t2, 4($fp) + lw $t2, 12($t2) + addu $t0, $t0, $t2 + lw $a0, 0($fp) + lw $a0, 12($a0) + move $t3, $a0 + move $t1, $a0 + addu $a0, $a0, 1 + li $v0, 9 + syscall + move $t2, $v0 + substr_loop: + beqz $t1, substr_end + lb $a0, 0($t0) + sb $a0, 0($t2) + addu $t0, $t0, 1 + addu $t2, $t2, 1 + subu $t1, $t1, 1 + j substr_loop + substr_end: + sb $zero, 0($t2) + move $t1, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + sw $t1, 12($v0) + sw $t3, 16($v0) + sw $v0, -4($fp) + # RETURN local_substr_at_String_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_substr_at_String. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 8 + jr $ra + # Function END + + +# function_length_at_String implementation. +# @Params: +function_length_at_String: + # Allocate stack frame for function function_length_at_String. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_length_at_String_internal_0 = GETATTRIBUTE length String + # LOCAL local_length_at_String_internal_0 --> -4($fp) + lw $t0, 16($s1) + sw $t0, -4($fp) + # LOCAL local_length_at_String_internal_1 --> -8($fp) + # LOCAL local_length_at_String_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + lw $t0, -4($fp) + sw $t0, 12($v0) + sw $v0, -8($fp) + # RETURN local_length_at_String_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function function_length_at_String. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# entry implementation. +# @Params: +entry: + # Allocate stack frame for function entry. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local__internal_0 --> -4($fp) + # local__internal_0 = ALLOCATE Main + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Main + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Main_start + sw $t0, 4($v0) + # Load type offset + li $t0, 20 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Main__attrib__books__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 12($t1) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -4($fp) + # LOCAL local__internal_0 --> -4($fp) + lw $s1, -4($fp) + # local__internal_1 = CALL main + # LOCAL local__internal_1 --> -8($fp) + # LOCAL local__internal_0 --> -4($fp) + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type's VTABLE + la $t0, Main_vtable + # Get pointer to function address + lw $t1, 72($t0) + # Call function. Result is on $v0 + jalr $t1 + sw $v0, -8($fp) + # RETURN 0 + li $v0, 0 + # Deallocate stack frame for function entry. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# __Main__attrib__books__init implementation. +# @Params: +__Main__attrib__books__init: + # Allocate stack frame for function __Main__attrib__books__init. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # RETURN 0 + li $v0, 0 + # Deallocate stack frame for function __Main__attrib__books__init. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_main_at_Main implementation. +# @Params: +function_main_at_Main: + # Allocate stack frame for function function_main_at_Main. + subu $sp, $sp, 92 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 92 + # LOCAL local_main_at_Main_a_book_0 --> -4($fp) + # local_main_at_Main_a_book_0 = 0 + li $t0, 0 + sw $t0, -4($fp) + # LOCAL local_main_at_Main_internal_3 --> -16($fp) + # local_main_at_Main_internal_3 = ALLOCATE Book + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Book + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Book_start + sw $t0, 4($v0) + # Load type offset + li $t0, 36 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Book__attrib__title__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 12($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Book__attrib__author__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 16($t1) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -16($fp) + # LOCAL local_main_at_Main_internal_1 --> -8($fp) + # LOCAL local_main_at_Main_internal_3 --> -16($fp) + # local_main_at_Main_internal_1 = local_main_at_Main_internal_3 + lw $t0, -16($fp) + sw $t0, -8($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_4 --> -20($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_4 + sw $t0, 12($v0) + li $t0, 44 + sw $t0, 16($v0) + sw $v0, -20($fp) + # ARG local_main_at_Main_internal_4 + # LOCAL local_main_at_Main_internal_4 --> -20($fp) + lw $t0, -20($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_main_at_Main_internal_5 --> -24($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_5 + sw $t0, 12($v0) + li $t0, 22 + sw $t0, 16($v0) + sw $v0, -24($fp) + # ARG local_main_at_Main_internal_5 + # LOCAL local_main_at_Main_internal_5 --> -24($fp) + lw $t0, -24($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_main_at_Main_internal_1 --> -8($fp) + # LOCAL local_main_at_Main_internal_2 --> -12($fp) + # local_main_at_Main_internal_2 = VCALL local_main_at_Main_internal_1 initBook + # Save new self pointer in $s1 + lw $s1, -8($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 28($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -12($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_main_at_Main_a_book_0 --> -4($fp) + # LOCAL local_main_at_Main_internal_2 --> -12($fp) + # local_main_at_Main_a_book_0 = local_main_at_Main_internal_2 + lw $t0, -12($fp) + sw $t0, -4($fp) + # LOCAL local_main_at_Main_an_article_6 --> -28($fp) + # local_main_at_Main_an_article_6 = 0 + li $t0, 0 + sw $t0, -28($fp) + # LOCAL local_main_at_Main_internal_9 --> -40($fp) + # local_main_at_Main_internal_9 = ALLOCATE Article + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Article + sw $t0, 12($v0) + li $t0, 7 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 24 bytes of memory + li $a0, 24 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Article_start + sw $t0, 4($v0) + # Load type offset + li $t0, 40 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Book__attrib__title__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 12($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Book__attrib__author__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 16($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Article__attrib__per_title__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 20($t1) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -40($fp) + # LOCAL local_main_at_Main_internal_7 --> -32($fp) + # LOCAL local_main_at_Main_internal_9 --> -40($fp) + # local_main_at_Main_internal_7 = local_main_at_Main_internal_9 + lw $t0, -40($fp) + sw $t0, -32($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_10 --> -44($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_6 + sw $t0, 12($v0) + li $t0, 19 + sw $t0, 16($v0) + sw $v0, -44($fp) + # ARG local_main_at_Main_internal_10 + # LOCAL local_main_at_Main_internal_10 --> -44($fp) + lw $t0, -44($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_main_at_Main_internal_11 --> -48($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_7 + sw $t0, 12($v0) + li $t0, 7 + sw $t0, 16($v0) + sw $v0, -48($fp) + # ARG local_main_at_Main_internal_11 + # LOCAL local_main_at_Main_internal_11 --> -48($fp) + lw $t0, -48($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_main_at_Main_internal_12 --> -52($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_8 + sw $t0, 12($v0) + li $t0, 11 + sw $t0, 16($v0) + sw $v0, -52($fp) + # ARG local_main_at_Main_internal_12 + # LOCAL local_main_at_Main_internal_12 --> -52($fp) + lw $t0, -52($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_main_at_Main_internal_7 --> -32($fp) + # LOCAL local_main_at_Main_internal_8 --> -36($fp) + # local_main_at_Main_internal_8 = VCALL local_main_at_Main_internal_7 initArticle + # Save new self pointer in $s1 + lw $s1, -32($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 48($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -36($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_main_at_Main_an_article_6 --> -28($fp) + # LOCAL local_main_at_Main_internal_8 --> -36($fp) + # local_main_at_Main_an_article_6 = local_main_at_Main_internal_8 + lw $t0, -36($fp) + sw $t0, -28($fp) + # LOCAL local_main_at_Main_internal_17 --> -72($fp) + # local_main_at_Main_internal_17 = ALLOCATE Nil + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Nil + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 12 bytes of memory + li $a0, 12 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Nil_start + sw $t0, 4($v0) + # Load type offset + li $t0, 28 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -72($fp) + # LOCAL local_main_at_Main_internal_15 --> -64($fp) + # LOCAL local_main_at_Main_internal_17 --> -72($fp) + # local_main_at_Main_internal_15 = local_main_at_Main_internal_17 + lw $t0, -72($fp) + sw $t0, -64($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # ARG local_main_at_Main_a_book_0 + # LOCAL local_main_at_Main_a_book_0 --> -4($fp) + lw $t0, -4($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_main_at_Main_internal_15 --> -64($fp) + # LOCAL local_main_at_Main_internal_16 --> -68($fp) + # local_main_at_Main_internal_16 = VCALL local_main_at_Main_internal_15 cons + # Save new self pointer in $s1 + lw $s1, -64($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 32($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -68($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_main_at_Main_internal_13 --> -56($fp) + # LOCAL local_main_at_Main_internal_16 --> -68($fp) + # local_main_at_Main_internal_13 = local_main_at_Main_internal_16 + lw $t0, -68($fp) + sw $t0, -56($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # ARG local_main_at_Main_an_article_6 + # LOCAL local_main_at_Main_an_article_6 --> -28($fp) + lw $t0, -28($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_main_at_Main_internal_13 --> -56($fp) + # LOCAL local_main_at_Main_internal_14 --> -60($fp) + # local_main_at_Main_internal_14 = VCALL local_main_at_Main_internal_13 cons + # Save new self pointer in $s1 + lw $s1, -56($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 32($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -60($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # + # LOCAL local_main_at_Main_internal_14 --> -60($fp) + lw $t0, -60($fp) + sw $t0, 12($s1) + # local_main_at_Main_internal_20 = GETATTRIBUTE books Main + # LOCAL local_main_at_Main_internal_20 --> -84($fp) + lw $t0, 12($s1) + sw $t0, -84($fp) + # LOCAL local_main_at_Main_internal_18 --> -76($fp) + # LOCAL local_main_at_Main_internal_20 --> -84($fp) + # local_main_at_Main_internal_18 = local_main_at_Main_internal_20 + lw $t0, -84($fp) + sw $t0, -76($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_18 --> -76($fp) + # LOCAL local_main_at_Main_internal_19 --> -80($fp) + # local_main_at_Main_internal_19 = VCALL local_main_at_Main_internal_18 print_list + # Save new self pointer in $s1 + lw $s1, -76($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 68($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -80($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # RETURN local_main_at_Main_internal_19 + lw $v0, -80($fp) + # Deallocate stack frame for function function_main_at_Main. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 92 + jr $ra + # Function END + + +# function_isNil_at_BookList implementation. +# @Params: +function_isNil_at_BookList: + # Allocate stack frame for function function_isNil_at_BookList. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_isNil_at_BookList_internal_2 --> -12($fp) + # local_isNil_at_BookList_internal_2 = SELF + sw $s1, -12($fp) + # LOCAL local_isNil_at_BookList_internal_0 --> -4($fp) + # LOCAL local_isNil_at_BookList_internal_2 --> -12($fp) + # local_isNil_at_BookList_internal_0 = local_isNil_at_BookList_internal_2 + lw $t0, -12($fp) + sw $t0, -4($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_isNil_at_BookList_internal_0 --> -4($fp) + # LOCAL local_isNil_at_BookList_internal_1 --> -8($fp) + # local_isNil_at_BookList_internal_1 = VCALL local_isNil_at_BookList_internal_0 abort + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 4($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -8($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_isNil_at_BookList_internal_3 --> -16($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -16($fp) + # RETURN local_isNil_at_BookList_internal_3 + lw $v0, -16($fp) + # Deallocate stack frame for function function_isNil_at_BookList. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_cons_at_BookList implementation. +# @Params: +# 0($fp) = param_cons_at_BookList_hd_0 +function_cons_at_BookList: + # Allocate stack frame for function function_cons_at_BookList. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_cons_at_BookList_new_cell_0 --> -4($fp) + # local_cons_at_BookList_new_cell_0 = 0 + li $t0, 0 + sw $t0, -4($fp) + # LOCAL local_cons_at_BookList_internal_1 --> -8($fp) + # local_cons_at_BookList_internal_1 = ALLOCATE Cons + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Cons + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Cons_start + sw $t0, 4($v0) + # Load type offset + li $t0, 32 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Cons__attrib__xcar__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 12($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Cons__attrib__xcdr__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 16($t1) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -8($fp) + # LOCAL local_cons_at_BookList_new_cell_0 --> -4($fp) + # LOCAL local_cons_at_BookList_internal_1 --> -8($fp) + # local_cons_at_BookList_new_cell_0 = local_cons_at_BookList_internal_1 + lw $t0, -8($fp) + sw $t0, -4($fp) + # LOCAL local_cons_at_BookList_internal_2 --> -12($fp) + # LOCAL local_cons_at_BookList_new_cell_0 --> -4($fp) + # local_cons_at_BookList_internal_2 = local_cons_at_BookList_new_cell_0 + lw $t0, -4($fp) + sw $t0, -12($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # ARG param_cons_at_BookList_hd_0 + # PARAM param_cons_at_BookList_hd_0 --> 0($fp) + lw $t0, 0($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_cons_at_BookList_internal_4 --> -20($fp) + # local_cons_at_BookList_internal_4 = SELF + sw $s1, -20($fp) + # ARG local_cons_at_BookList_internal_4 + # LOCAL local_cons_at_BookList_internal_4 --> -20($fp) + lw $t0, -20($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_cons_at_BookList_internal_2 --> -12($fp) + # LOCAL local_cons_at_BookList_internal_3 --> -16($fp) + # local_cons_at_BookList_internal_3 = VCALL local_cons_at_BookList_internal_2 init + # Save new self pointer in $s1 + lw $s1, -12($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 52($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -16($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # RETURN local_cons_at_BookList_internal_3 + lw $v0, -16($fp) + # Deallocate stack frame for function function_cons_at_BookList. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_car_at_BookList implementation. +# @Params: +function_car_at_BookList: + # Allocate stack frame for function function_car_at_BookList. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_car_at_BookList_internal_2 --> -12($fp) + # local_car_at_BookList_internal_2 = SELF + sw $s1, -12($fp) + # LOCAL local_car_at_BookList_internal_0 --> -4($fp) + # LOCAL local_car_at_BookList_internal_2 --> -12($fp) + # local_car_at_BookList_internal_0 = local_car_at_BookList_internal_2 + lw $t0, -12($fp) + sw $t0, -4($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_car_at_BookList_internal_0 --> -4($fp) + # LOCAL local_car_at_BookList_internal_1 --> -8($fp) + # local_car_at_BookList_internal_1 = VCALL local_car_at_BookList_internal_0 abort + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 4($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -8($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_car_at_BookList_internal_3 --> -16($fp) + # local_car_at_BookList_internal_3 = ALLOCATE Book + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Book + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Book_start + sw $t0, 4($v0) + # Load type offset + li $t0, 36 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Book__attrib__title__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 12($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Book__attrib__author__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 16($t1) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -16($fp) + # RETURN local_car_at_BookList_internal_3 + lw $v0, -16($fp) + # Deallocate stack frame for function function_car_at_BookList. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_cdr_at_BookList implementation. +# @Params: +function_cdr_at_BookList: + # Allocate stack frame for function function_cdr_at_BookList. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_cdr_at_BookList_internal_2 --> -12($fp) + # local_cdr_at_BookList_internal_2 = SELF + sw $s1, -12($fp) + # LOCAL local_cdr_at_BookList_internal_0 --> -4($fp) + # LOCAL local_cdr_at_BookList_internal_2 --> -12($fp) + # local_cdr_at_BookList_internal_0 = local_cdr_at_BookList_internal_2 + lw $t0, -12($fp) + sw $t0, -4($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_cdr_at_BookList_internal_0 --> -4($fp) + # LOCAL local_cdr_at_BookList_internal_1 --> -8($fp) + # local_cdr_at_BookList_internal_1 = VCALL local_cdr_at_BookList_internal_0 abort + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 4($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -8($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_cdr_at_BookList_internal_3 --> -16($fp) + # local_cdr_at_BookList_internal_3 = ALLOCATE BookList + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, BookList + sw $t0, 12($v0) + li $t0, 8 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 12 bytes of memory + li $a0, 12 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, BookList_start + sw $t0, 4($v0) + # Load type offset + li $t0, 24 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -16($fp) + # RETURN local_cdr_at_BookList_internal_3 + lw $v0, -16($fp) + # Deallocate stack frame for function function_cdr_at_BookList. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_print_list_at_BookList implementation. +# @Params: +function_print_list_at_BookList: + # Allocate stack frame for function function_print_list_at_BookList. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_print_list_at_BookList_internal_2 --> -12($fp) + # local_print_list_at_BookList_internal_2 = SELF + sw $s1, -12($fp) + # LOCAL local_print_list_at_BookList_internal_0 --> -4($fp) + # LOCAL local_print_list_at_BookList_internal_2 --> -12($fp) + # local_print_list_at_BookList_internal_0 = local_print_list_at_BookList_internal_2 + lw $t0, -12($fp) + sw $t0, -4($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_print_list_at_BookList_internal_0 --> -4($fp) + # LOCAL local_print_list_at_BookList_internal_1 --> -8($fp) + # local_print_list_at_BookList_internal_1 = VCALL local_print_list_at_BookList_internal_0 abort + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 4($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -8($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # RETURN local_print_list_at_BookList_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function function_print_list_at_BookList. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_isNil_at_Nil implementation. +# @Params: +function_isNil_at_Nil: + # Allocate stack frame for function function_isNil_at_Nil. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_isNil_at_Nil_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -4($fp) + # RETURN local_isNil_at_Nil_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_isNil_at_Nil. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_print_list_at_Nil implementation. +# @Params: +function_print_list_at_Nil: + # Allocate stack frame for function function_print_list_at_Nil. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_print_list_at_Nil_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -4($fp) + # RETURN local_print_list_at_Nil_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_print_list_at_Nil. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# __Cons__attrib__xcar__init implementation. +# @Params: +__Cons__attrib__xcar__init: + # Allocate stack frame for function __Cons__attrib__xcar__init. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # RETURN 0 + li $v0, 0 + # Deallocate stack frame for function __Cons__attrib__xcar__init. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# __Cons__attrib__xcdr__init implementation. +# @Params: +__Cons__attrib__xcdr__init: + # Allocate stack frame for function __Cons__attrib__xcdr__init. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # RETURN 0 + li $v0, 0 + # Deallocate stack frame for function __Cons__attrib__xcdr__init. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_isNil_at_Cons implementation. +# @Params: +function_isNil_at_Cons: + # Allocate stack frame for function function_isNil_at_Cons. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_isNil_at_Cons_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -4($fp) + # RETURN local_isNil_at_Cons_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_isNil_at_Cons. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_init_at_Cons implementation. +# @Params: +# 0($fp) = param_init_at_Cons_hd_0 +# 4($fp) = param_init_at_Cons_tl_1 +function_init_at_Cons: + # Allocate stack frame for function function_init_at_Cons. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # + # PARAM param_init_at_Cons_hd_0 --> 4($fp) + lw $t0, 4($fp) + sw $t0, 12($s1) + # + # PARAM param_init_at_Cons_tl_1 --> 0($fp) + lw $t0, 0($fp) + sw $t0, 16($s1) + # LOCAL local_init_at_Cons_internal_0 --> -4($fp) + # local_init_at_Cons_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_init_at_Cons_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_init_at_Cons. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 8 + jr $ra + # Function END + + +# function_car_at_Cons implementation. +# @Params: +function_car_at_Cons: + # Allocate stack frame for function function_car_at_Cons. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_car_at_Cons_internal_0 = GETATTRIBUTE xcar Cons + # LOCAL local_car_at_Cons_internal_0 --> -4($fp) + lw $t0, 12($s1) + sw $t0, -4($fp) + # RETURN local_car_at_Cons_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_car_at_Cons. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_cdr_at_Cons implementation. +# @Params: +function_cdr_at_Cons: + # Allocate stack frame for function function_cdr_at_Cons. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_cdr_at_Cons_internal_0 = GETATTRIBUTE xcdr Cons + # LOCAL local_cdr_at_Cons_internal_0 --> -4($fp) + lw $t0, 16($s1) + sw $t0, -4($fp) + # RETURN local_cdr_at_Cons_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_cdr_at_Cons. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_print_list_at_Cons implementation. +# @Params: +function_print_list_at_Cons: + # Allocate stack frame for function function_print_list_at_Cons. + subu $sp, $sp, 92 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 92 + # local_print_list_at_Cons_internal_2 = GETATTRIBUTE xcar Cons + # LOCAL local_print_list_at_Cons_internal_2 --> -12($fp) + lw $t0, 12($s1) + sw $t0, -12($fp) + # LOCAL local_print_list_at_Cons_internal_0 --> -4($fp) + # LOCAL local_print_list_at_Cons_internal_2 --> -12($fp) + # local_print_list_at_Cons_internal_0 = local_print_list_at_Cons_internal_2 + lw $t0, -12($fp) + sw $t0, -4($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_print_list_at_Cons_internal_0 --> -4($fp) + # LOCAL local_print_list_at_Cons_internal_1 --> -8($fp) + # local_print_list_at_Cons_internal_1 = VCALL local_print_list_at_Cons_internal_0 print + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 40($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -8($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_print_list_at_Cons_internal_1 --> -8($fp) + # LOCAL local_print_list_at_Cons_internal_3 --> -16($fp) + # local_print_list_at_Cons_internal_3 = TYPEOF local_print_list_at_Cons_internal_1 + lw $t0, -8($fp) + # Load pointer to type offset + lw $t1, 8($t0) + sw $t1, -16($fp) + # LOCAL local_print_list_at_Cons_internal_6 --> -28($fp) + # local_print_list_at_Cons_internal_6 = 14 + li $t0, 14 + sw $t0, -28($fp) + # local_print_list_at_Cons_internal_7 = TYPE_DISTANCE Book + # LOCAL local_print_list_at_Cons_internal_7 --> -32($fp) + # LOCAL local_print_list_at_Cons_internal_3 --> -16($fp) + # Load TDT pointer to type Book + la $t0, Book__TDT + lw $t1, -16($fp) + addu $t0, $t0, $t1 + # Save distance + lw $t1, 0($t0) + sw $t1, -32($fp) + # LOCAL local_print_list_at_Cons_internal_7 --> -32($fp) + # LOCAL local_print_list_at_Cons_internal_6 --> -28($fp) + # Update min if 8 < 9 + lw $t0, -32($fp) + lw $t1, -28($fp) + bgtu $t0, $t1, label_Not_min0_1 + # LOCAL local_print_list_at_Cons_internal_6 --> -28($fp) + # LOCAL local_print_list_at_Cons_internal_7 --> -32($fp) + # local_print_list_at_Cons_internal_6 = local_print_list_at_Cons_internal_7 + lw $t0, -32($fp) + sw $t0, -28($fp) + label_Not_min0_1: + # local_print_list_at_Cons_internal_7 = TYPE_DISTANCE Article + # LOCAL local_print_list_at_Cons_internal_7 --> -32($fp) + # LOCAL local_print_list_at_Cons_internal_3 --> -16($fp) + # Load TDT pointer to type Article + la $t0, Article__TDT + lw $t1, -16($fp) + addu $t0, $t0, $t1 + # Save distance + lw $t1, 0($t0) + sw $t1, -32($fp) + # LOCAL local_print_list_at_Cons_internal_7 --> -32($fp) + # LOCAL local_print_list_at_Cons_internal_6 --> -28($fp) + # Update min if 8 < 9 + lw $t0, -32($fp) + lw $t1, -28($fp) + bgtu $t0, $t1, label_Not_min1_2 + # LOCAL local_print_list_at_Cons_internal_6 --> -28($fp) + # LOCAL local_print_list_at_Cons_internal_7 --> -32($fp) + # local_print_list_at_Cons_internal_6 = local_print_list_at_Cons_internal_7 + lw $t0, -32($fp) + sw $t0, -28($fp) + label_Not_min1_2: + # LOCAL local_print_list_at_Cons_internal_7 --> -32($fp) + # local_print_list_at_Cons_internal_7 = 14 + li $t0, 14 + sw $t0, -32($fp) + # LOCAL local_print_list_at_Cons_internal_4 --> -20($fp) + # LOCAL local_print_list_at_Cons_internal_7 --> -32($fp) + # LOCAL local_print_list_at_Cons_internal_6 --> -28($fp) + # Load pointers and SUB + lw $a0, -32($fp) + lw $a1, -28($fp) + sub $a0, $a0, $a1 + sw $a0, -20($fp) + # IF_ZERO local_print_list_at_Cons_internal_4 GOTO label_ERROR_3 + # IF_ZERO local_print_list_at_Cons_internal_4 GOTO label_ERROR_3 + lw $t0, -20($fp) + beq $t0, 0, label_ERROR_3 + # local_print_list_at_Cons_internal_7 = TYPE_DISTANCE Book + # LOCAL local_print_list_at_Cons_internal_7 --> -32($fp) + # LOCAL local_print_list_at_Cons_internal_3 --> -16($fp) + # Load TDT pointer to type Book + la $t0, Book__TDT + lw $t1, -16($fp) + addu $t0, $t0, $t1 + # Save distance + lw $t1, 0($t0) + sw $t1, -32($fp) + # LOCAL local_print_list_at_Cons_internal_7 --> -32($fp) + # LOCAL local_print_list_at_Cons_internal_6 --> -28($fp) + # Update min if 8 < 9 + lw $t0, -32($fp) + lw $t1, -28($fp) + bgtu $t0, $t1, label_NEXT0_5 + # LOCAL local_print_list_at_Cons_dummy_8 --> -36($fp) + # LOCAL local_print_list_at_Cons_internal_1 --> -8($fp) + # local_print_list_at_Cons_dummy_8 = local_print_list_at_Cons_internal_1 + lw $t0, -8($fp) + sw $t0, -36($fp) + # LOCAL local_print_list_at_Cons_internal_11 --> -48($fp) + # local_print_list_at_Cons_internal_11 = SELF + sw $s1, -48($fp) + # LOCAL local_print_list_at_Cons_internal_9 --> -40($fp) + # LOCAL local_print_list_at_Cons_internal_11 --> -48($fp) + # local_print_list_at_Cons_internal_9 = local_print_list_at_Cons_internal_11 + lw $t0, -48($fp) + sw $t0, -40($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_print_list_at_Cons_internal_12 --> -52($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_9 + sw $t0, 12($v0) + li $t0, 26 + sw $t0, 16($v0) + sw $v0, -52($fp) + # ARG local_print_list_at_Cons_internal_12 + # LOCAL local_print_list_at_Cons_internal_12 --> -52($fp) + lw $t0, -52($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_print_list_at_Cons_internal_9 --> -40($fp) + # LOCAL local_print_list_at_Cons_internal_10 --> -44($fp) + # local_print_list_at_Cons_internal_10 = VCALL local_print_list_at_Cons_internal_9 out_string + # Save new self pointer in $s1 + lw $s1, -40($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 20($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -44($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_print_list_at_Cons_internal_5 --> -24($fp) + # LOCAL local_print_list_at_Cons_internal_10 --> -44($fp) + # local_print_list_at_Cons_internal_5 = local_print_list_at_Cons_internal_10 + lw $t0, -44($fp) + sw $t0, -24($fp) + # GOTO label_END_4 +j label_END_4 +label_NEXT0_5: + # local_print_list_at_Cons_internal_7 = TYPE_DISTANCE Article + # LOCAL local_print_list_at_Cons_internal_7 --> -32($fp) + # LOCAL local_print_list_at_Cons_internal_3 --> -16($fp) + # Load TDT pointer to type Article + la $t0, Article__TDT + lw $t1, -16($fp) + addu $t0, $t0, $t1 + # Save distance + lw $t1, 0($t0) + sw $t1, -32($fp) + # LOCAL local_print_list_at_Cons_internal_7 --> -32($fp) + # LOCAL local_print_list_at_Cons_internal_6 --> -28($fp) + # Update min if 8 < 9 + lw $t0, -32($fp) + lw $t1, -28($fp) + bgtu $t0, $t1, label_NEXT1_6 + # LOCAL local_print_list_at_Cons_dummy_13 --> -56($fp) + # LOCAL local_print_list_at_Cons_internal_1 --> -8($fp) + # local_print_list_at_Cons_dummy_13 = local_print_list_at_Cons_internal_1 + lw $t0, -8($fp) + sw $t0, -56($fp) + # LOCAL local_print_list_at_Cons_internal_16 --> -68($fp) + # local_print_list_at_Cons_internal_16 = SELF + sw $s1, -68($fp) + # LOCAL local_print_list_at_Cons_internal_14 --> -60($fp) + # LOCAL local_print_list_at_Cons_internal_16 --> -68($fp) + # local_print_list_at_Cons_internal_14 = local_print_list_at_Cons_internal_16 + lw $t0, -68($fp) + sw $t0, -60($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_print_list_at_Cons_internal_17 --> -72($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_10 + sw $t0, 12($v0) + li $t0, 29 + sw $t0, 16($v0) + sw $v0, -72($fp) + # ARG local_print_list_at_Cons_internal_17 + # LOCAL local_print_list_at_Cons_internal_17 --> -72($fp) + lw $t0, -72($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_print_list_at_Cons_internal_14 --> -60($fp) + # LOCAL local_print_list_at_Cons_internal_15 --> -64($fp) + # local_print_list_at_Cons_internal_15 = VCALL local_print_list_at_Cons_internal_14 out_string + # Save new self pointer in $s1 + lw $s1, -60($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 20($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -64($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_print_list_at_Cons_internal_5 --> -24($fp) + # LOCAL local_print_list_at_Cons_internal_15 --> -64($fp) + # local_print_list_at_Cons_internal_5 = local_print_list_at_Cons_internal_15 + lw $t0, -64($fp) + sw $t0, -24($fp) + # GOTO label_END_4 +j label_END_4 +label_NEXT1_6: + label_ERROR_3: + # LOCAL local_print_list_at_Cons_internal_1 --> -8($fp) + lw $t0, 0($s1) + sw $t0, -8($fp) + # LOCAL local_print_list_at_Cons_internal_1 --> -8($fp) + la $a0, data_1 + li $v0, 4 + syscall + lw $a0, -8($fp) + li $v0, 4 + syscall + la $a0, data_2 + li $v0, 4 + syscall + li $v0, 10 + syscall + label_END_4: +# local_print_list_at_Cons_internal_20 = GETATTRIBUTE xcdr Cons +# LOCAL local_print_list_at_Cons_internal_20 --> -84($fp) +lw $t0, 16($s1) +sw $t0, -84($fp) +# LOCAL local_print_list_at_Cons_internal_18 --> -76($fp) +# LOCAL local_print_list_at_Cons_internal_20 --> -84($fp) +# local_print_list_at_Cons_internal_18 = local_print_list_at_Cons_internal_20 +lw $t0, -84($fp) +sw $t0, -76($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_print_list_at_Cons_internal_18 --> -76($fp) +# LOCAL local_print_list_at_Cons_internal_19 --> -80($fp) +# local_print_list_at_Cons_internal_19 = VCALL local_print_list_at_Cons_internal_18 print_list +# Save new self pointer in $s1 +lw $s1, -76($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 68($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -80($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# RETURN local_print_list_at_Cons_internal_19 +lw $v0, -80($fp) +# Deallocate stack frame for function function_print_list_at_Cons. +# Restore $ra +lw $ra, 4($sp) +# Restore $fp +lw $fp, 0($sp) +# Restore Stack pointer $sp +addu $sp, $sp, 92 +jr $ra +# Function END + + +# __Book__attrib__title__init implementation. +# @Params: +__Book__attrib__title__init: + # Allocate stack frame for function __Book__attrib__title__init. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_ttrib__title__init_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_0 + sw $t0, 12($v0) + li $t0, 0 + sw $t0, 16($v0) + sw $v0, -4($fp) + # RETURN local_ttrib__title__init_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function __Book__attrib__title__init. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# __Book__attrib__author__init implementation. +# @Params: +__Book__attrib__author__init: + # Allocate stack frame for function __Book__attrib__author__init. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_ttrib__author__init_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_0 + sw $t0, 12($v0) + li $t0, 0 + sw $t0, 16($v0) + sw $v0, -4($fp) + # RETURN local_ttrib__author__init_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function __Book__attrib__author__init. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_initBook_at_Book implementation. +# @Params: +# 0($fp) = param_initBook_at_Book_title_p_0 +# 4($fp) = param_initBook_at_Book_author_p_1 +function_initBook_at_Book: + # Allocate stack frame for function function_initBook_at_Book. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # + # PARAM param_initBook_at_Book_title_p_0 --> 4($fp) + lw $t0, 4($fp) + sw $t0, 12($s1) + # + # PARAM param_initBook_at_Book_author_p_1 --> 0($fp) + lw $t0, 0($fp) + sw $t0, 16($s1) + # LOCAL local_initBook_at_Book_internal_0 --> -4($fp) + # local_initBook_at_Book_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_initBook_at_Book_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_initBook_at_Book. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 8 + jr $ra + # Function END + + +# function_print_at_Book implementation. +# @Params: +function_print_at_Book: + # Allocate stack frame for function function_print_at_Book. + subu $sp, $sp, 92 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 92 + # LOCAL local_print_at_Book_internal_6 --> -28($fp) + # local_print_at_Book_internal_6 = SELF + sw $s1, -28($fp) + # LOCAL local_print_at_Book_internal_4 --> -20($fp) + # LOCAL local_print_at_Book_internal_6 --> -28($fp) + # local_print_at_Book_internal_4 = local_print_at_Book_internal_6 + lw $t0, -28($fp) + sw $t0, -20($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_print_at_Book_internal_7 --> -32($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_11 + sw $t0, 12($v0) + li $t0, 12 + sw $t0, 16($v0) + sw $v0, -32($fp) + # ARG local_print_at_Book_internal_7 + # LOCAL local_print_at_Book_internal_7 --> -32($fp) + lw $t0, -32($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_print_at_Book_internal_4 --> -20($fp) + # LOCAL local_print_at_Book_internal_5 --> -24($fp) + # local_print_at_Book_internal_5 = VCALL local_print_at_Book_internal_4 out_string + # Save new self pointer in $s1 + lw $s1, -20($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 20($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -24($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_print_at_Book_internal_2 --> -12($fp) + # LOCAL local_print_at_Book_internal_5 --> -24($fp) + # local_print_at_Book_internal_2 = local_print_at_Book_internal_5 + lw $t0, -24($fp) + sw $t0, -12($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # local_print_at_Book_internal_8 = GETATTRIBUTE title Book + # LOCAL local_print_at_Book_internal_8 --> -36($fp) + lw $t0, 12($s1) + sw $t0, -36($fp) + # ARG local_print_at_Book_internal_8 + # LOCAL local_print_at_Book_internal_8 --> -36($fp) + lw $t0, -36($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_print_at_Book_internal_2 --> -12($fp) + # LOCAL local_print_at_Book_internal_3 --> -16($fp) + # local_print_at_Book_internal_3 = VCALL local_print_at_Book_internal_2 out_string + # Save new self pointer in $s1 + lw $s1, -12($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 20($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -16($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_print_at_Book_internal_0 --> -4($fp) + # LOCAL local_print_at_Book_internal_3 --> -16($fp) + # local_print_at_Book_internal_0 = local_print_at_Book_internal_3 + lw $t0, -16($fp) + sw $t0, -4($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_print_at_Book_internal_9 --> -40($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_12 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -40($fp) + # ARG local_print_at_Book_internal_9 + # LOCAL local_print_at_Book_internal_9 --> -40($fp) + lw $t0, -40($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_print_at_Book_internal_0 --> -4($fp) + # LOCAL local_print_at_Book_internal_1 --> -8($fp) + # local_print_at_Book_internal_1 = VCALL local_print_at_Book_internal_0 out_string + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 20($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -8($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_print_at_Book_internal_16 --> -68($fp) + # local_print_at_Book_internal_16 = SELF + sw $s1, -68($fp) + # LOCAL local_print_at_Book_internal_14 --> -60($fp) + # LOCAL local_print_at_Book_internal_16 --> -68($fp) + # local_print_at_Book_internal_14 = local_print_at_Book_internal_16 + lw $t0, -68($fp) + sw $t0, -60($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_print_at_Book_internal_17 --> -72($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_13 + sw $t0, 12($v0) + li $t0, 12 + sw $t0, 16($v0) + sw $v0, -72($fp) + # ARG local_print_at_Book_internal_17 + # LOCAL local_print_at_Book_internal_17 --> -72($fp) + lw $t0, -72($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_print_at_Book_internal_14 --> -60($fp) + # LOCAL local_print_at_Book_internal_15 --> -64($fp) + # local_print_at_Book_internal_15 = VCALL local_print_at_Book_internal_14 out_string + # Save new self pointer in $s1 + lw $s1, -60($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 20($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -64($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_print_at_Book_internal_12 --> -52($fp) + # LOCAL local_print_at_Book_internal_15 --> -64($fp) + # local_print_at_Book_internal_12 = local_print_at_Book_internal_15 + lw $t0, -64($fp) + sw $t0, -52($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # local_print_at_Book_internal_18 = GETATTRIBUTE author Book + # LOCAL local_print_at_Book_internal_18 --> -76($fp) + lw $t0, 16($s1) + sw $t0, -76($fp) + # ARG local_print_at_Book_internal_18 + # LOCAL local_print_at_Book_internal_18 --> -76($fp) + lw $t0, -76($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_print_at_Book_internal_12 --> -52($fp) + # LOCAL local_print_at_Book_internal_13 --> -56($fp) + # local_print_at_Book_internal_13 = VCALL local_print_at_Book_internal_12 out_string + # Save new self pointer in $s1 + lw $s1, -52($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 20($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -56($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_print_at_Book_internal_10 --> -44($fp) + # LOCAL local_print_at_Book_internal_13 --> -56($fp) + # local_print_at_Book_internal_10 = local_print_at_Book_internal_13 + lw $t0, -56($fp) + sw $t0, -44($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_print_at_Book_internal_19 --> -80($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_14 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -80($fp) + # ARG local_print_at_Book_internal_19 + # LOCAL local_print_at_Book_internal_19 --> -80($fp) + lw $t0, -80($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_print_at_Book_internal_10 --> -44($fp) + # LOCAL local_print_at_Book_internal_11 --> -48($fp) + # local_print_at_Book_internal_11 = VCALL local_print_at_Book_internal_10 out_string + # Save new self pointer in $s1 + lw $s1, -44($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 20($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -48($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_print_at_Book_internal_20 --> -84($fp) + # local_print_at_Book_internal_20 = SELF + sw $s1, -84($fp) + # RETURN local_print_at_Book_internal_20 + lw $v0, -84($fp) + # Deallocate stack frame for function function_print_at_Book. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 92 + jr $ra + # Function END + + +# __Article__attrib__per_title__init implementation. +# @Params: +__Article__attrib__per_title__init: + # Allocate stack frame for function __Article__attrib__per_title__init. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local___attrib__per_title__init_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_0 + sw $t0, 12($v0) + li $t0, 0 + sw $t0, 16($v0) + sw $v0, -4($fp) + # RETURN local___attrib__per_title__init_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function __Article__attrib__per_title__init. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_initArticle_at_Article implementation. +# @Params: +# 0($fp) = param_initArticle_at_Article_title_p_0 +# 4($fp) = param_initArticle_at_Article_author_p_1 +# 8($fp) = param_initArticle_at_Article_per_title_p_2 +function_initArticle_at_Article: + # Allocate stack frame for function function_initArticle_at_Article. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_initArticle_at_Article_internal_2 --> -12($fp) + # local_initArticle_at_Article_internal_2 = SELF + sw $s1, -12($fp) + # LOCAL local_initArticle_at_Article_internal_0 --> -4($fp) + # LOCAL local_initArticle_at_Article_internal_2 --> -12($fp) + # local_initArticle_at_Article_internal_0 = local_initArticle_at_Article_internal_2 + lw $t0, -12($fp) + sw $t0, -4($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # ARG param_initArticle_at_Article_title_p_0 + # PARAM param_initArticle_at_Article_title_p_0 --> 8($fp) + lw $t0, 8($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # ARG param_initArticle_at_Article_author_p_1 + # PARAM param_initArticle_at_Article_author_p_1 --> 4($fp) + lw $t0, 4($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_initArticle_at_Article_internal_0 --> -4($fp) + # LOCAL local_initArticle_at_Article_internal_1 --> -8($fp) + # local_initArticle_at_Article_internal_1 = VCALL local_initArticle_at_Article_internal_0 initBook + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 28($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -8($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # + # PARAM param_initArticle_at_Article_per_title_p_2 --> 0($fp) + lw $t0, 0($fp) + sw $t0, 20($s1) + # LOCAL local_initArticle_at_Article_internal_3 --> -16($fp) + # local_initArticle_at_Article_internal_3 = SELF + sw $s1, -16($fp) + # RETURN local_initArticle_at_Article_internal_3 + lw $v0, -16($fp) + # Deallocate stack frame for function function_initArticle_at_Article. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 12 + jr $ra + # Function END + + +# function_print_at_Article implementation. +# @Params: +function_print_at_Article: + # Allocate stack frame for function function_print_at_Article. + subu $sp, $sp, 60 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 60 + # LOCAL local_print_at_Article_internal_1 --> -8($fp) + # local_print_at_Article_internal_1 = SELF + sw $s1, -8($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # local_print_at_Article_internal_0 = CALL print + # LOCAL local_print_at_Article_internal_0 --> -4($fp) + # LOCAL local_print_at_Article_internal_1 --> -8($fp) + # Save new self pointer in $s1 + lw $s1, -8($fp) + # Get pointer to type's VTABLE + la $t0, Book_vtable + # Get pointer to function address + lw $t1, 40($t0) + # Call function. Result is on $v0 + jalr $t1 + sw $v0, -4($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_print_at_Article_internal_8 --> -36($fp) + # local_print_at_Article_internal_8 = SELF + sw $s1, -36($fp) + # LOCAL local_print_at_Article_internal_6 --> -28($fp) + # LOCAL local_print_at_Article_internal_8 --> -36($fp) + # local_print_at_Article_internal_6 = local_print_at_Article_internal_8 + lw $t0, -36($fp) + sw $t0, -28($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_print_at_Article_internal_9 --> -40($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_15 + sw $t0, 12($v0) + li $t0, 13 + sw $t0, 16($v0) + sw $v0, -40($fp) + # ARG local_print_at_Article_internal_9 + # LOCAL local_print_at_Article_internal_9 --> -40($fp) + lw $t0, -40($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_print_at_Article_internal_6 --> -28($fp) + # LOCAL local_print_at_Article_internal_7 --> -32($fp) + # local_print_at_Article_internal_7 = VCALL local_print_at_Article_internal_6 out_string + # Save new self pointer in $s1 + lw $s1, -28($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 20($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -32($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_print_at_Article_internal_4 --> -20($fp) + # LOCAL local_print_at_Article_internal_7 --> -32($fp) + # local_print_at_Article_internal_4 = local_print_at_Article_internal_7 + lw $t0, -32($fp) + sw $t0, -20($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # local_print_at_Article_internal_10 = GETATTRIBUTE per_title Article + # LOCAL local_print_at_Article_internal_10 --> -44($fp) + lw $t0, 20($s1) + sw $t0, -44($fp) + # ARG local_print_at_Article_internal_10 + # LOCAL local_print_at_Article_internal_10 --> -44($fp) + lw $t0, -44($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_print_at_Article_internal_4 --> -20($fp) + # LOCAL local_print_at_Article_internal_5 --> -24($fp) + # local_print_at_Article_internal_5 = VCALL local_print_at_Article_internal_4 out_string + # Save new self pointer in $s1 + lw $s1, -20($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 20($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -24($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_print_at_Article_internal_2 --> -12($fp) + # LOCAL local_print_at_Article_internal_5 --> -24($fp) + # local_print_at_Article_internal_2 = local_print_at_Article_internal_5 + lw $t0, -24($fp) + sw $t0, -12($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_print_at_Article_internal_11 --> -48($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_16 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -48($fp) + # ARG local_print_at_Article_internal_11 + # LOCAL local_print_at_Article_internal_11 --> -48($fp) + lw $t0, -48($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_print_at_Article_internal_2 --> -12($fp) + # LOCAL local_print_at_Article_internal_3 --> -16($fp) + # local_print_at_Article_internal_3 = VCALL local_print_at_Article_internal_2 out_string + # Save new self pointer in $s1 + lw $s1, -12($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 20($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -16($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_print_at_Article_internal_12 --> -52($fp) + # local_print_at_Article_internal_12 = SELF + sw $s1, -52($fp) + # RETURN local_print_at_Article_internal_12 + lw $v0, -52($fp) + # Deallocate stack frame for function function_print_at_Article. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 60 + jr $ra + # Function END + diff --git a/tests/codegen/cells.mips b/tests/codegen/cells.mips new file mode 100644 index 00000000..1829ea80 --- /dev/null +++ b/tests/codegen/cells.mips @@ -0,0 +1,4338 @@ + +# Code generated by PyCoolc. +# Eliane Puerta, Liset Alfaro, Adrian Gonzalez --- Mon Dec 14 11:08:41 2020 +# School of Math and Computer Science, University of Havana +# + +.data +dummy: .word 0 +IO: .asciiz "IO" +# Function END +Object: .asciiz "Object" +# Function END +String: .asciiz "String" +# Function END +Bool: .asciiz "Bool" +# Function END +Int: .asciiz "Int" +# Function END +Main: .asciiz "Main" +# Function END +CellularAutomaton: .asciiz "CellularAutomaton" +# Function END +# + + +# **** VTABLE for type IO **** +IO_vtable: .word dummy, dummy, function_in_int_at_IO, function_out_string_at_IO, function_in_string_at_IO, dummy, dummy, dummy, function_abort_at_Object, dummy, dummy, dummy, dummy, function_out_int_at_IO, dummy, dummy, dummy, function_type_name_at_Object, function_copy_at_Object +# Function END +# + + +# **** Type RECORD for type IO **** +IO_start: + IO_vtable_pointer: .word IO_vtable + # Function END +IO_end: +# + + +# **** VTABLE for type Object **** +Object_vtable: .word dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, function_abort_at_Object, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, function_type_name_at_Object, function_copy_at_Object +# Function END +# + + +# **** Type RECORD for type Object **** +Object_start: + Object_vtable_pointer: .word Object_vtable + # Function END +Object_end: +# + + +# **** VTABLE for type String **** +String_vtable: .word function_substr_at_String, dummy, dummy, dummy, dummy, dummy, dummy, dummy, function_abort_at_Object, dummy, dummy, dummy, dummy, dummy, function_concat_at_String, dummy, function_length_at_String, function_type_name_at_Object, function_copy_at_Object +# Function END +# + + +# **** Type RECORD for type String **** +String_start: + String_vtable_pointer: .word String_vtable + # Function END +String_end: +# + + +# **** VTABLE for type Bool **** +Bool_vtable: .word dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, function_abort_at_Object, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, function_type_name_at_Object, function_copy_at_Object +# Function END +# + + +# **** Type RECORD for type Bool **** +Bool_start: + Bool_vtable_pointer: .word Bool_vtable + # Function END +Bool_end: +# + + +# **** VTABLE for type Int **** +Int_vtable: .word dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, function_abort_at_Object, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, function_type_name_at_Object, function_copy_at_Object +# Function END +# + + +# **** Type RECORD for type Int **** +Int_start: + Int_vtable_pointer: .word Int_vtable + # Function END +Int_end: +# + + +# **** VTABLE for type Main **** +Main_vtable: .word dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, function_abort_at_Object, dummy, function_main_at_Main, dummy, dummy, dummy, dummy, dummy, dummy, function_type_name_at_Object, function_copy_at_Object +# Function END +# + + +# **** Type RECORD for type Main **** +Main_start: + Main_vtable_pointer: .word Main_vtable + # Function END +Main_end: +# + + +# **** VTABLE for type CellularAutomaton **** +CellularAutomaton_vtable: .word dummy, function_num_cells_at_CellularAutomaton, function_in_int_at_IO, function_out_string_at_IO, function_in_string_at_IO, function_print_at_CellularAutomaton, function_cell_at_next_evolution_at_CellularAutomaton, function_init_at_CellularAutomaton, function_abort_at_Object, function_evolve_at_CellularAutomaton, dummy, function_cell_left_neighbor_at_CellularAutomaton, function_cell_right_neighbor_at_CellularAutomaton, function_out_int_at_IO, dummy, function_cell_at_CellularAutomaton, dummy, function_type_name_at_Object, function_copy_at_Object +# Function END +# + + +# **** Type RECORD for type CellularAutomaton **** +CellularAutomaton_start: + CellularAutomaton_vtable_pointer: .word CellularAutomaton_vtable + # Function END +CellularAutomaton_end: +# + + +data_0: .asciiz "" +# + + +data_1: .asciiz "Abort called from class " +# + + +data_2: .asciiz "\n" +# + + +IO__TDT: .word 0, -1, -1, -1, -1, -1, 1 +Object__TDT: .word 1, 0, 1, 1, 1, 1, 2 +String__TDT: .word -1, -1, 0, -1, -1, -1, -1 +Bool__TDT: .word -1, -1, -1, 0, -1, -1, -1 +Int__TDT: .word -1, -1, -1, -1, 0, -1, -1 +Main__TDT: .word -1, -1, -1, -1, -1, 0, -1 +CellularAutomaton__TDT: .word -1, -1, -1, -1, -1, -1, 0 +# + + +data_4: .asciiz " X " +# + + +data_5: .asciiz "\n" +# + + +data_6: .asciiz "X" +# + + +data_7: .asciiz "X" +# + + +data_8: .asciiz "X" +# + + +data_9: .asciiz "X" +# + + +data_10: .asciiz "." +# + + +.text +main: + jal entry + # syscall code 10 is for exit + li $v0, 10 + syscall + # Function END + +# function_in_string_at_IO implementation. +# @Params: +function_in_string_at_IO: + # Allocate stack frame for function function_in_string_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_in_string_at_IO_internal_0 --> -4($fp) + # Allocating 1024 bytes of memory + li $a0, 1024 + li $v0, 9 + syscall + move $t0, $v0 + move $a0, $v0 + li $a1, 1024 + li $v0, 8 + syscall + move $t2, $zero + move $t3, $zero + move $t1, $t0 + lb $t3, 0($t1) + beqz $t3, end_loop + read_length_loop: + lb $t3, 0($t1) + beqz $t3, end_read_length_loop + addu $t1, $t1, 1 + addu $t2, $t2, 1 + j read_length_loop + end_read_length_loop: + subu $t1, $t1, 1 + sb $zero, 0($t1) + subu $t2, $t2, 1 + end_loop: + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $t2, 16($v0) + sw $v0, -4($fp) + # RETURN local_in_string_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_in_string_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_out_int_at_IO implementation. +# @Params: +# 0($fp) = param_out_int_at_IO_x_0 +function_out_int_at_IO: + # Allocate stack frame for function function_out_int_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # PRINT_INT param_out_int_at_IO_x_0 + # PARAM param_out_int_at_IO_x_0 --> 0($fp) + lw $v0, 0($fp) + lw $a0, 12($v0) + li $v0, 1 + syscall + # LOCAL local_out_int_at_IO_internal_0 --> -4($fp) + # local_out_int_at_IO_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_out_int_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_out_int_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_out_string_at_IO implementation. +# @Params: +# 0($fp) = param_out_string_at_IO_x_0 +function_out_string_at_IO: + # Allocate stack frame for function function_out_string_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # PARAM param_out_string_at_IO_x_0 --> 0($fp) + # PRINT_STR param_out_string_at_IO_x_0 + lw $v0, 0($fp) + lw $a0, 12($v0) + li $v0, 4 + syscall + # LOCAL local_out_string_at_IO_internal_0 --> -4($fp) + # local_out_string_at_IO_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_out_string_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_out_string_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_in_int_at_IO implementation. +# @Params: +function_in_int_at_IO: + # Allocate stack frame for function function_in_int_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_in_int_at_IO_internal_0 --> -4($fp) + # local_in_int_at_IO_internal_0 = READ_INT + li $v0, 5 + syscall + move $a2, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + sw $a2, 12($v0) + sw $v0, -4($fp) + # RETURN local_in_int_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_in_int_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_abort_at_Object implementation. +# @Params: +function_abort_at_Object: + # Allocate stack frame for function function_abort_at_Object. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_abort_at_Object_internal_0 --> -4($fp) + lw $t0, 0($s1) + sw $t0, -4($fp) + # LOCAL local_abort_at_Object_internal_0 --> -4($fp) + la $a0, data_1 + li $v0, 4 + syscall + lw $a0, -4($fp) + li $v0, 4 + syscall + la $a0, data_2 + li $v0, 4 + syscall + li $v0, 10 + syscall + # Function END + + +# function_copy_at_Object implementation. +# @Params: +function_copy_at_Object: + # Allocate stack frame for function function_copy_at_Object. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_copy_at_Object_internal_0 --> -4($fp) + # local_copy_at_Object_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_copy_at_Object_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function function_copy_at_Object. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_type_name_at_Object implementation. +# @Params: +function_type_name_at_Object: + # Allocate stack frame for function function_type_name_at_Object. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_type_name_at_Object_internal_0 --> -4($fp) + lw $t0, 0($s1) + sw $t0, -4($fp) + # RETURN local_type_name_at_Object_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_type_name_at_Object. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_concat_at_String implementation. +# @Params: +# 0($fp) = param_concat_at_String_s_0 +function_concat_at_String: + # Allocate stack frame for function function_concat_at_String. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_concat_at_String_internal_0 = self.CONCAT + # LOCAL local_concat_at_String_internal_0 --> -4($fp) + # PARAM param_concat_at_String_s_0 --> 0($fp) + # Get first string length from self + lw $t0, 16($s1) + # Get second string length from param + lw $v0, 0($fp) + lw $t1, 16($v0) + # Save new string length in a0 for memory allocation + addu $a0, $t0, $t1 + move $t3, $a0 + # Get first string from self + lw $t0, 12($s1) + # Get second string from param + lw $t1, 12($v0) + addu $a0, $a0, 4 + li $v0, 9 + syscall + move $t2, $v0 + move $t4, $zero + concat_loop1: + # Compare t0 with \0 + lb $t4, 0($t0) + beqz $t4, concat_loop1_end + # Copy 1 byte + sb $t4, 0($t2) + addu $t2, $t2, 1 + addu $t0, $t0, 1 + j concat_loop1 + concat_loop1_end: + # Copy second string + concat_loop2: + # Compare t1 with \0 + lb $t4, 0($t1) + beqz $t4, concat_loop2_end + # Copy 1 byte + sb $t4, 0($t2) + addu $t2, $t2, 1 + addu $t1, $t1, 1 + j concat_loop2 + concat_loop2_end: + sb $zero, 0($t2) + # v0 contains resulting string + move $t1, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + sw $t1, 12($v0) + sw $t3, 16($v0) + sw $v0, -4($fp) + # RETURN local_concat_at_String_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_concat_at_String. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_substr_at_String implementation. +# @Params: +# 0($fp) = param_substr_at_String_l_0 +# 4($fp) = param_substr_at_String_r_1 +function_substr_at_String: + # Allocate stack frame for function function_substr_at_String. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_substr_at_String_internal_0 --> -4($fp) + # PARAM param_substr_at_String_l_0 --> 4($fp) + # PARAM param_substr_at_String_r_1 --> 0($fp) + lw $t0, 12($s1) + lw $t2, 4($fp) + lw $t2, 12($t2) + addu $t0, $t0, $t2 + lw $a0, 0($fp) + lw $a0, 12($a0) + move $t3, $a0 + move $t1, $a0 + addu $a0, $a0, 1 + li $v0, 9 + syscall + move $t2, $v0 + substr_loop: + beqz $t1, substr_end + lb $a0, 0($t0) + sb $a0, 0($t2) + addu $t0, $t0, 1 + addu $t2, $t2, 1 + subu $t1, $t1, 1 + j substr_loop + substr_end: + sb $zero, 0($t2) + move $t1, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + sw $t1, 12($v0) + sw $t3, 16($v0) + sw $v0, -4($fp) + # RETURN local_substr_at_String_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_substr_at_String. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 8 + jr $ra + # Function END + + +# function_length_at_String implementation. +# @Params: +function_length_at_String: + # Allocate stack frame for function function_length_at_String. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_length_at_String_internal_0 = GETATTRIBUTE length String + # LOCAL local_length_at_String_internal_0 --> -4($fp) + lw $t0, 16($s1) + sw $t0, -4($fp) + # LOCAL local_length_at_String_internal_1 --> -8($fp) + # LOCAL local_length_at_String_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + lw $t0, -4($fp) + sw $t0, 12($v0) + sw $v0, -8($fp) + # RETURN local_length_at_String_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function function_length_at_String. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# entry implementation. +# @Params: +entry: + # Allocate stack frame for function entry. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local__internal_0 --> -4($fp) + # local__internal_0 = ALLOCATE Main + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Main + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Main_start + sw $t0, 4($v0) + # Load type offset + li $t0, 20 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Main__attrib__cells__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 12($t1) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -4($fp) + # LOCAL local__internal_0 --> -4($fp) + lw $s1, -4($fp) + # local__internal_1 = CALL main + # LOCAL local__internal_1 --> -8($fp) + # LOCAL local__internal_0 --> -4($fp) + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type's VTABLE + la $t0, Main_vtable + # Get pointer to function address + lw $t1, 40($t0) + # Call function. Result is on $v0 + jalr $t1 + sw $v0, -8($fp) + # RETURN 0 + li $v0, 0 + # Deallocate stack frame for function entry. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# __Main__attrib__cells__init implementation. +# @Params: +__Main__attrib__cells__init: + # Allocate stack frame for function __Main__attrib__cells__init. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # RETURN 0 + li $v0, 0 + # Deallocate stack frame for function __Main__attrib__cells__init. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_main_at_Main implementation. +# @Params: +function_main_at_Main: + # Allocate stack frame for function function_main_at_Main. + subu $sp, $sp, 92 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 92 + # LOCAL local_main_at_Main_internal_2 --> -12($fp) + # local_main_at_Main_internal_2 = ALLOCATE CellularAutomaton + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, CellularAutomaton + sw $t0, 12($v0) + li $t0, 17 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, CellularAutomaton_start + sw $t0, 4($v0) + # Load type offset + li $t0, 24 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __CellularAutomaton__attrib__population_map__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 12($t1) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -12($fp) + # LOCAL local_main_at_Main_internal_0 --> -4($fp) + # LOCAL local_main_at_Main_internal_2 --> -12($fp) + # local_main_at_Main_internal_0 = local_main_at_Main_internal_2 + lw $t0, -12($fp) + sw $t0, -4($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_3 --> -16($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_4 + sw $t0, 12($v0) + li $t0, 19 + sw $t0, 16($v0) + sw $v0, -16($fp) + # ARG local_main_at_Main_internal_3 + # LOCAL local_main_at_Main_internal_3 --> -16($fp) + lw $t0, -16($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_main_at_Main_internal_0 --> -4($fp) + # LOCAL local_main_at_Main_internal_1 --> -8($fp) + # local_main_at_Main_internal_1 = VCALL local_main_at_Main_internal_0 init + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 28($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -8($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # + # LOCAL local_main_at_Main_internal_1 --> -8($fp) + lw $t0, -8($fp) + sw $t0, 12($s1) + # local_main_at_Main_internal_6 = GETATTRIBUTE cells Main + # LOCAL local_main_at_Main_internal_6 --> -28($fp) + lw $t0, 12($s1) + sw $t0, -28($fp) + # LOCAL local_main_at_Main_internal_4 --> -20($fp) + # LOCAL local_main_at_Main_internal_6 --> -28($fp) + # local_main_at_Main_internal_4 = local_main_at_Main_internal_6 + lw $t0, -28($fp) + sw $t0, -20($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_4 --> -20($fp) + # LOCAL local_main_at_Main_internal_5 --> -24($fp) + # local_main_at_Main_internal_5 = VCALL local_main_at_Main_internal_4 print + # Save new self pointer in $s1 + lw $s1, -20($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 20($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -24($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_main_at_Main_countdown_7 --> -32($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -32($fp) + # LOCAL local_main_at_Main_internal_8 --> -36($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 20 + sw $t0, 12($v0) + sw $v0, -36($fp) + # LOCAL local_main_at_Main_countdown_7 --> -32($fp) + # LOCAL local_main_at_Main_internal_8 --> -36($fp) + # local_main_at_Main_countdown_7 = local_main_at_Main_internal_8 + lw $t0, -36($fp) + sw $t0, -32($fp) + label_WHILE_1: + # LOCAL local_main_at_Main_internal_11 --> -48($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -48($fp) + # LOCAL local_main_at_Main_internal_10 --> -44($fp) + # LOCAL local_main_at_Main_internal_11 --> -48($fp) + # LOCAL local_main_at_Main_countdown_7 --> -32($fp) + lw $a0, -48($fp) + lw $a1, -32($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -44($fp) + # IF_GREATER_ZERO local_main_at_Main_internal_10 GOTO label_FALSE_3 + # IF_GREATER_ZERO local_main_at_Main_internal_10 GOTO label_FALSE_3 + lw $t0, -44($fp) + bgt $t0, 0, label_FALSE_3 + # IF_ZERO local_main_at_Main_internal_10 GOTO label_FALSE_3 + # IF_ZERO local_main_at_Main_internal_10 GOTO label_FALSE_3 + lw $t0, -44($fp) + beq $t0, 0, label_FALSE_3 + # LOCAL local_main_at_Main_internal_10 --> -44($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -44($fp) + # GOTO label_END_4 +j label_END_4 +label_FALSE_3: + # LOCAL local_main_at_Main_internal_10 --> -44($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -44($fp) + label_END_4: +# LOCAL local_main_at_Main_internal_9 --> -40($fp) +# LOCAL local_main_at_Main_internal_10 --> -44($fp) +# Obtain value from -44($fp) +lw $v0, -44($fp) +lw $v0, 12($v0) +sw $v0, -40($fp) +# IF_ZERO local_main_at_Main_internal_9 GOTO label_WHILE_END_2 +# IF_ZERO local_main_at_Main_internal_9 GOTO label_WHILE_END_2 +lw $t0, -40($fp) +beq $t0, 0, label_WHILE_END_2 +# local_main_at_Main_internal_14 = GETATTRIBUTE cells Main +# LOCAL local_main_at_Main_internal_14 --> -60($fp) +lw $t0, 12($s1) +sw $t0, -60($fp) +# LOCAL local_main_at_Main_internal_12 --> -52($fp) +# LOCAL local_main_at_Main_internal_14 --> -60($fp) +# local_main_at_Main_internal_12 = local_main_at_Main_internal_14 +lw $t0, -60($fp) +sw $t0, -52($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_main_at_Main_internal_12 --> -52($fp) +# LOCAL local_main_at_Main_internal_13 --> -56($fp) +# local_main_at_Main_internal_13 = VCALL local_main_at_Main_internal_12 evolve +# Save new self pointer in $s1 +lw $s1, -52($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 36($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -56($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# local_main_at_Main_internal_17 = GETATTRIBUTE cells Main +# LOCAL local_main_at_Main_internal_17 --> -72($fp) +lw $t0, 12($s1) +sw $t0, -72($fp) +# LOCAL local_main_at_Main_internal_15 --> -64($fp) +# LOCAL local_main_at_Main_internal_17 --> -72($fp) +# local_main_at_Main_internal_15 = local_main_at_Main_internal_17 +lw $t0, -72($fp) +sw $t0, -64($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_main_at_Main_internal_15 --> -64($fp) +# LOCAL local_main_at_Main_internal_16 --> -68($fp) +# local_main_at_Main_internal_16 = VCALL local_main_at_Main_internal_15 print +# Save new self pointer in $s1 +lw $s1, -64($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 20($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -68($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_main_at_Main_internal_19 --> -80($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 1 +sw $t0, 12($v0) +sw $v0, -80($fp) +# LOCAL local_main_at_Main_internal_18 --> -76($fp) +# LOCAL local_main_at_Main_countdown_7 --> -32($fp) +# LOCAL local_main_at_Main_internal_19 --> -80($fp) +# local_main_at_Main_internal_18 = local_main_at_Main_countdown_7 - local_main_at_Main_internal_19 +lw $t1, -32($fp) +lw $t0, 12($t1) +lw $t1, -80($fp) +lw $t2, 12($t1) +sub $t0, $t0, $t2 +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t1, String +sw $t1, 0($v0) +la $t1, String_start +sw $t1, 4($v0) +# Load type offset +li $t1, 8 +sw $t1, 8($v0) +la $t1, Int +sw $t1, 12($v0) +li $t1, 3 +sw $t1, 16($v0) +move $t1, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t1, 0($v0) +la $t1, Int_start +sw $t1, 4($v0) +# Load type offset +li $t1, 16 +sw $t1, 8($v0) +sw $t0, 12($v0) +sw $v0, -76($fp) +# LOCAL local_main_at_Main_countdown_7 --> -32($fp) +# LOCAL local_main_at_Main_internal_18 --> -76($fp) +# local_main_at_Main_countdown_7 = local_main_at_Main_internal_18 +lw $t0, -76($fp) +sw $t0, -32($fp) +# GOTO label_WHILE_1 +j label_WHILE_1 +label_WHILE_END_2: + # LOCAL local_main_at_Main_internal_20 --> -84($fp) + # local_main_at_Main_internal_20 = SELF + sw $s1, -84($fp) + # RETURN local_main_at_Main_internal_20 + lw $v0, -84($fp) + # Deallocate stack frame for function function_main_at_Main. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 92 + jr $ra + # Function END + + +# __CellularAutomaton__attrib__population_map__init implementation. +# @Params: +__CellularAutomaton__attrib__population_map__init: + # Allocate stack frame for function __CellularAutomaton__attrib__population_map__init. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_rAutomaton__attrib__population_map__init_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_0 + sw $t0, 12($v0) + li $t0, 0 + sw $t0, 16($v0) + sw $v0, -4($fp) + # RETURN local_rAutomaton__attrib__population_map__init_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function __CellularAutomaton__attrib__population_map__init. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_init_at_CellularAutomaton implementation. +# @Params: +# 0($fp) = param_init_at_CellularAutomaton_map_0 +function_init_at_CellularAutomaton: + # Allocate stack frame for function function_init_at_CellularAutomaton. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # + # PARAM param_init_at_CellularAutomaton_map_0 --> 0($fp) + lw $t0, 0($fp) + sw $t0, 12($s1) + # LOCAL local_init_at_CellularAutomaton_internal_0 --> -4($fp) + # local_init_at_CellularAutomaton_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_init_at_CellularAutomaton_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_init_at_CellularAutomaton. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_print_at_CellularAutomaton implementation. +# @Params: +function_print_at_CellularAutomaton: + # Allocate stack frame for function function_print_at_CellularAutomaton. + subu $sp, $sp, 40 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 40 + # LOCAL local_print_at_CellularAutomaton_internal_2 --> -12($fp) + # local_print_at_CellularAutomaton_internal_2 = SELF + sw $s1, -12($fp) + # LOCAL local_print_at_CellularAutomaton_internal_0 --> -4($fp) + # LOCAL local_print_at_CellularAutomaton_internal_2 --> -12($fp) + # local_print_at_CellularAutomaton_internal_0 = local_print_at_CellularAutomaton_internal_2 + lw $t0, -12($fp) + sw $t0, -4($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # local_print_at_CellularAutomaton_internal_5 = GETATTRIBUTE population_map CellularAutomaton + # LOCAL local_print_at_CellularAutomaton_internal_5 --> -24($fp) + lw $t0, 12($s1) + sw $t0, -24($fp) + # LOCAL local_print_at_CellularAutomaton_internal_3 --> -16($fp) + # LOCAL local_print_at_CellularAutomaton_internal_5 --> -24($fp) + # local_print_at_CellularAutomaton_internal_3 = local_print_at_CellularAutomaton_internal_5 + lw $t0, -24($fp) + sw $t0, -16($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_print_at_CellularAutomaton_internal_6 --> -28($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_5 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -28($fp) + # ARG local_print_at_CellularAutomaton_internal_6 + # LOCAL local_print_at_CellularAutomaton_internal_6 --> -28($fp) + lw $t0, -28($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_print_at_CellularAutomaton_internal_3 --> -16($fp) + # LOCAL local_print_at_CellularAutomaton_internal_4 --> -20($fp) + # local_print_at_CellularAutomaton_internal_4 = VCALL local_print_at_CellularAutomaton_internal_3 concat + # Save new self pointer in $s1 + lw $s1, -16($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 56($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -20($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # ARG local_print_at_CellularAutomaton_internal_4 + # LOCAL local_print_at_CellularAutomaton_internal_4 --> -20($fp) + lw $t0, -20($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_print_at_CellularAutomaton_internal_0 --> -4($fp) + # LOCAL local_print_at_CellularAutomaton_internal_1 --> -8($fp) + # local_print_at_CellularAutomaton_internal_1 = VCALL local_print_at_CellularAutomaton_internal_0 out_string + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 12($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -8($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_print_at_CellularAutomaton_internal_7 --> -32($fp) + # local_print_at_CellularAutomaton_internal_7 = SELF + sw $s1, -32($fp) + # RETURN local_print_at_CellularAutomaton_internal_7 + lw $v0, -32($fp) + # Deallocate stack frame for function function_print_at_CellularAutomaton. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 40 + jr $ra + # Function END + + +# function_num_cells_at_CellularAutomaton implementation. +# @Params: +function_num_cells_at_CellularAutomaton: + # Allocate stack frame for function function_num_cells_at_CellularAutomaton. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_num_cells_at_CellularAutomaton_internal_2 = GETATTRIBUTE population_map CellularAutomaton + # LOCAL local_num_cells_at_CellularAutomaton_internal_2 --> -12($fp) + lw $t0, 12($s1) + sw $t0, -12($fp) + # LOCAL local_num_cells_at_CellularAutomaton_internal_0 --> -4($fp) + # LOCAL local_num_cells_at_CellularAutomaton_internal_2 --> -12($fp) + # local_num_cells_at_CellularAutomaton_internal_0 = local_num_cells_at_CellularAutomaton_internal_2 + lw $t0, -12($fp) + sw $t0, -4($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_num_cells_at_CellularAutomaton_internal_0 --> -4($fp) + # LOCAL local_num_cells_at_CellularAutomaton_internal_1 --> -8($fp) + # local_num_cells_at_CellularAutomaton_internal_1 = VCALL local_num_cells_at_CellularAutomaton_internal_0 length + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 64($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -8($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # RETURN local_num_cells_at_CellularAutomaton_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function function_num_cells_at_CellularAutomaton. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_cell_at_CellularAutomaton implementation. +# @Params: +# 0($fp) = param_cell_at_CellularAutomaton_position_0 +function_cell_at_CellularAutomaton: + # Allocate stack frame for function function_cell_at_CellularAutomaton. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_cell_at_CellularAutomaton_internal_2 = GETATTRIBUTE population_map CellularAutomaton + # LOCAL local_cell_at_CellularAutomaton_internal_2 --> -12($fp) + lw $t0, 12($s1) + sw $t0, -12($fp) + # LOCAL local_cell_at_CellularAutomaton_internal_0 --> -4($fp) + # LOCAL local_cell_at_CellularAutomaton_internal_2 --> -12($fp) + # local_cell_at_CellularAutomaton_internal_0 = local_cell_at_CellularAutomaton_internal_2 + lw $t0, -12($fp) + sw $t0, -4($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # ARG param_cell_at_CellularAutomaton_position_0 + # PARAM param_cell_at_CellularAutomaton_position_0 --> 0($fp) + lw $t0, 0($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_cell_at_CellularAutomaton_internal_3 --> -16($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -16($fp) + # ARG local_cell_at_CellularAutomaton_internal_3 + # LOCAL local_cell_at_CellularAutomaton_internal_3 --> -16($fp) + lw $t0, -16($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_cell_at_CellularAutomaton_internal_0 --> -4($fp) + # LOCAL local_cell_at_CellularAutomaton_internal_1 --> -8($fp) + # local_cell_at_CellularAutomaton_internal_1 = VCALL local_cell_at_CellularAutomaton_internal_0 substr + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 0($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -8($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # RETURN local_cell_at_CellularAutomaton_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function function_cell_at_CellularAutomaton. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_cell_left_neighbor_at_CellularAutomaton implementation. +# @Params: +# 0($fp) = param_cell_left_neighbor_at_CellularAutomaton_position_0 +function_cell_left_neighbor_at_CellularAutomaton: + # Allocate stack frame for function function_cell_left_neighbor_at_CellularAutomaton. + subu $sp, $sp, 80 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 80 + # LOCAL local_cell_left_neighbor_at_CellularAutomaton_internal_4 --> -20($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -20($fp) + # IF_ZERO param_cell_left_neighbor_at_CellularAutomaton_position_0 GOTO label_FALSE_7 + # IF_ZERO param_cell_left_neighbor_at_CellularAutomaton_position_0 GOTO label_FALSE_7 + lw $t0, 0($fp) + beq $t0, 0, label_FALSE_7 + # IF_ZERO local_cell_left_neighbor_at_CellularAutomaton_internal_4 GOTO label_FALSE_7 + # IF_ZERO local_cell_left_neighbor_at_CellularAutomaton_internal_4 GOTO label_FALSE_7 + lw $t0, -20($fp) + beq $t0, 0, label_FALSE_7 + # LOCAL local_cell_left_neighbor_at_CellularAutomaton_internal_3 --> -16($fp) + # PARAM param_cell_left_neighbor_at_CellularAutomaton_position_0 --> 0($fp) + # Comparing 0($fp) type with String + la $v0, String + lw $a0, 0($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -16($fp) + # IF_ZERO local_cell_left_neighbor_at_CellularAutomaton_internal_3 GOTO label_COMPARE_STRING_10 + # IF_ZERO local_cell_left_neighbor_at_CellularAutomaton_internal_3 GOTO label_COMPARE_STRING_10 + lw $t0, -16($fp) + beq $t0, 0, label_COMPARE_STRING_10 + # LOCAL local_cell_left_neighbor_at_CellularAutomaton_internal_3 --> -16($fp) + # PARAM param_cell_left_neighbor_at_CellularAutomaton_position_0 --> 0($fp) + # Comparing 0($fp) type with Bool + la $v0, Bool + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -16($fp) + # IF_ZERO local_cell_left_neighbor_at_CellularAutomaton_internal_3 GOTO label_COMPARE_BY_VALUE_11 + # IF_ZERO local_cell_left_neighbor_at_CellularAutomaton_internal_3 GOTO label_COMPARE_BY_VALUE_11 + lw $t0, -16($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_11 + # LOCAL local_cell_left_neighbor_at_CellularAutomaton_internal_3 --> -16($fp) + # PARAM param_cell_left_neighbor_at_CellularAutomaton_position_0 --> 0($fp) + # Comparing 0($fp) type with Int + la $v0, Int + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -16($fp) + # IF_ZERO local_cell_left_neighbor_at_CellularAutomaton_internal_3 GOTO label_COMPARE_BY_VALUE_11 + # IF_ZERO local_cell_left_neighbor_at_CellularAutomaton_internal_3 GOTO label_COMPARE_BY_VALUE_11 + lw $t0, -16($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_11 + # LOCAL local_cell_left_neighbor_at_CellularAutomaton_internal_3 --> -16($fp) + # PARAM param_cell_left_neighbor_at_CellularAutomaton_position_0 --> 0($fp) + # LOCAL local_cell_left_neighbor_at_CellularAutomaton_internal_4 --> -20($fp) + # Load pointers and SUB + lw $a0, 0($fp) + lw $a1, -20($fp) + sub $a0, $a0, $a1 + sw $a0, -16($fp) + # IF_ZERO local_cell_left_neighbor_at_CellularAutomaton_internal_3 GOTO label_TRUE_8 + # IF_ZERO local_cell_left_neighbor_at_CellularAutomaton_internal_3 GOTO label_TRUE_8 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_8 + # GOTO label_FALSE_7 + j label_FALSE_7 + label_COMPARE_BY_VALUE_11: + # LOCAL local_cell_left_neighbor_at_CellularAutomaton_internal_3 --> -16($fp) + # PARAM param_cell_left_neighbor_at_CellularAutomaton_position_0 --> 0($fp) + # LOCAL local_cell_left_neighbor_at_CellularAutomaton_internal_4 --> -20($fp) + lw $a0, 0($fp) + lw $a1, -20($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -16($fp) + # IF_ZERO local_cell_left_neighbor_at_CellularAutomaton_internal_3 GOTO label_TRUE_8 + # IF_ZERO local_cell_left_neighbor_at_CellularAutomaton_internal_3 GOTO label_TRUE_8 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_8 + # GOTO label_FALSE_7 + j label_FALSE_7 + label_COMPARE_STRING_10: + # LOCAL local_cell_left_neighbor_at_CellularAutomaton_internal_3 --> -16($fp) + # PARAM param_cell_left_neighbor_at_CellularAutomaton_position_0 --> 0($fp) + # LOCAL local_cell_left_neighbor_at_CellularAutomaton_internal_4 --> -20($fp) + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -20($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -16($fp) + # IF_ZERO local_cell_left_neighbor_at_CellularAutomaton_internal_3 GOTO label_CONTINUE_12 + # IF_ZERO local_cell_left_neighbor_at_CellularAutomaton_internal_3 GOTO label_CONTINUE_12 + lw $t0, -16($fp) + beq $t0, 0, label_CONTINUE_12 + # GOTO label_FALSE_7 + j label_FALSE_7 + label_CONTINUE_12: + # LOCAL local_cell_left_neighbor_at_CellularAutomaton_internal_3 --> -16($fp) + # PARAM param_cell_left_neighbor_at_CellularAutomaton_position_0 --> 0($fp) + # LOCAL local_cell_left_neighbor_at_CellularAutomaton_internal_4 --> -20($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -20($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_13: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_14 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_13 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_14: + # Store result + sw $a2, -16($fp) + # IF_ZERO local_cell_left_neighbor_at_CellularAutomaton_internal_3 GOTO label_TRUE_8 + # IF_ZERO local_cell_left_neighbor_at_CellularAutomaton_internal_3 GOTO label_TRUE_8 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_8 + label_FALSE_7: + # LOCAL local_cell_left_neighbor_at_CellularAutomaton_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -12($fp) + # GOTO label_END_9 +j label_END_9 +label_TRUE_8: + # LOCAL local_cell_left_neighbor_at_CellularAutomaton_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -12($fp) + label_END_9: +# LOCAL local_cell_left_neighbor_at_CellularAutomaton_internal_0 --> -4($fp) +# LOCAL local_cell_left_neighbor_at_CellularAutomaton_internal_2 --> -12($fp) +# Obtain value from -12($fp) +lw $v0, -12($fp) +lw $v0, 12($v0) +sw $v0, -4($fp) +# IF_ZERO local_cell_left_neighbor_at_CellularAutomaton_internal_0 GOTO label_FALSEIF_5 +# IF_ZERO local_cell_left_neighbor_at_CellularAutomaton_internal_0 GOTO label_FALSEIF_5 +lw $t0, -4($fp) +beq $t0, 0, label_FALSEIF_5 +# LOCAL local_cell_left_neighbor_at_CellularAutomaton_internal_7 --> -32($fp) +# local_cell_left_neighbor_at_CellularAutomaton_internal_7 = SELF +sw $s1, -32($fp) +# LOCAL local_cell_left_neighbor_at_CellularAutomaton_internal_5 --> -24($fp) +# LOCAL local_cell_left_neighbor_at_CellularAutomaton_internal_7 --> -32($fp) +# local_cell_left_neighbor_at_CellularAutomaton_internal_5 = local_cell_left_neighbor_at_CellularAutomaton_internal_7 +lw $t0, -32($fp) +sw $t0, -24($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_cell_left_neighbor_at_CellularAutomaton_internal_11 --> -48($fp) +# local_cell_left_neighbor_at_CellularAutomaton_internal_11 = SELF +sw $s1, -48($fp) +# LOCAL local_cell_left_neighbor_at_CellularAutomaton_internal_9 --> -40($fp) +# LOCAL local_cell_left_neighbor_at_CellularAutomaton_internal_11 --> -48($fp) +# local_cell_left_neighbor_at_CellularAutomaton_internal_9 = local_cell_left_neighbor_at_CellularAutomaton_internal_11 +lw $t0, -48($fp) +sw $t0, -40($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_cell_left_neighbor_at_CellularAutomaton_internal_9 --> -40($fp) +# LOCAL local_cell_left_neighbor_at_CellularAutomaton_internal_10 --> -44($fp) +# local_cell_left_neighbor_at_CellularAutomaton_internal_10 = VCALL local_cell_left_neighbor_at_CellularAutomaton_internal_9 num_cells +# Save new self pointer in $s1 +lw $s1, -40($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 4($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -44($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_cell_left_neighbor_at_CellularAutomaton_internal_12 --> -52($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 1 +sw $t0, 12($v0) +sw $v0, -52($fp) +# LOCAL local_cell_left_neighbor_at_CellularAutomaton_internal_8 --> -36($fp) +# LOCAL local_cell_left_neighbor_at_CellularAutomaton_internal_10 --> -44($fp) +# LOCAL local_cell_left_neighbor_at_CellularAutomaton_internal_12 --> -52($fp) +# local_cell_left_neighbor_at_CellularAutomaton_internal_8 = local_cell_left_neighbor_at_CellularAutomaton_internal_10 - local_cell_left_neighbor_at_CellularAutomaton_internal_12 +lw $t1, -44($fp) +lw $t0, 12($t1) +lw $t1, -52($fp) +lw $t2, 12($t1) +sub $t0, $t0, $t2 +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t1, String +sw $t1, 0($v0) +la $t1, String_start +sw $t1, 4($v0) +# Load type offset +li $t1, 8 +sw $t1, 8($v0) +la $t1, Int +sw $t1, 12($v0) +li $t1, 3 +sw $t1, 16($v0) +move $t1, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t1, 0($v0) +la $t1, Int_start +sw $t1, 4($v0) +# Load type offset +li $t1, 16 +sw $t1, 8($v0) +sw $t0, 12($v0) +sw $v0, -36($fp) +# ARG local_cell_left_neighbor_at_CellularAutomaton_internal_8 +# LOCAL local_cell_left_neighbor_at_CellularAutomaton_internal_8 --> -36($fp) +lw $t0, -36($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_cell_left_neighbor_at_CellularAutomaton_internal_5 --> -24($fp) +# LOCAL local_cell_left_neighbor_at_CellularAutomaton_internal_6 --> -28($fp) +# local_cell_left_neighbor_at_CellularAutomaton_internal_6 = VCALL local_cell_left_neighbor_at_CellularAutomaton_internal_5 cell +# Save new self pointer in $s1 +lw $s1, -24($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 60($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -28($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_cell_left_neighbor_at_CellularAutomaton_internal_1 --> -8($fp) +# LOCAL local_cell_left_neighbor_at_CellularAutomaton_internal_6 --> -28($fp) +# local_cell_left_neighbor_at_CellularAutomaton_internal_1 = local_cell_left_neighbor_at_CellularAutomaton_internal_6 +lw $t0, -28($fp) +sw $t0, -8($fp) +# GOTO label_ENDIF_6 +j label_ENDIF_6 +label_FALSEIF_5: + # LOCAL local_cell_left_neighbor_at_CellularAutomaton_internal_15 --> -64($fp) + # local_cell_left_neighbor_at_CellularAutomaton_internal_15 = SELF + sw $s1, -64($fp) + # LOCAL local_cell_left_neighbor_at_CellularAutomaton_internal_13 --> -56($fp) + # LOCAL local_cell_left_neighbor_at_CellularAutomaton_internal_15 --> -64($fp) + # local_cell_left_neighbor_at_CellularAutomaton_internal_13 = local_cell_left_neighbor_at_CellularAutomaton_internal_15 + lw $t0, -64($fp) + sw $t0, -56($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_cell_left_neighbor_at_CellularAutomaton_internal_17 --> -72($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -72($fp) + # LOCAL local_cell_left_neighbor_at_CellularAutomaton_internal_16 --> -68($fp) + # PARAM param_cell_left_neighbor_at_CellularAutomaton_position_0 --> 0($fp) + # LOCAL local_cell_left_neighbor_at_CellularAutomaton_internal_17 --> -72($fp) + # local_cell_left_neighbor_at_CellularAutomaton_internal_16 = PARAM param_cell_left_neighbor_at_CellularAutomaton_position_0 - local_cell_left_neighbor_at_CellularAutomaton_internal_17 + lw $t1, 0($fp) + lw $t0, 12($t1) + lw $t1, -72($fp) + lw $t2, 12($t1) + sub $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -68($fp) + # ARG local_cell_left_neighbor_at_CellularAutomaton_internal_16 + # LOCAL local_cell_left_neighbor_at_CellularAutomaton_internal_16 --> -68($fp) + lw $t0, -68($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_cell_left_neighbor_at_CellularAutomaton_internal_13 --> -56($fp) + # LOCAL local_cell_left_neighbor_at_CellularAutomaton_internal_14 --> -60($fp) + # local_cell_left_neighbor_at_CellularAutomaton_internal_14 = VCALL local_cell_left_neighbor_at_CellularAutomaton_internal_13 cell + # Save new self pointer in $s1 + lw $s1, -56($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 60($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -60($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_cell_left_neighbor_at_CellularAutomaton_internal_1 --> -8($fp) + # LOCAL local_cell_left_neighbor_at_CellularAutomaton_internal_14 --> -60($fp) + # local_cell_left_neighbor_at_CellularAutomaton_internal_1 = local_cell_left_neighbor_at_CellularAutomaton_internal_14 + lw $t0, -60($fp) + sw $t0, -8($fp) + label_ENDIF_6: +# RETURN local_cell_left_neighbor_at_CellularAutomaton_internal_1 +lw $v0, -8($fp) +# Deallocate stack frame for function function_cell_left_neighbor_at_CellularAutomaton. +# Restore $ra +lw $ra, 4($sp) +# Restore $fp +lw $fp, 0($sp) +# Restore Stack pointer $sp +addu $sp, $sp, 80 +# Deallocate function args +addu $sp, $sp, 4 +jr $ra +# Function END + + +# function_cell_right_neighbor_at_CellularAutomaton implementation. +# @Params: +# 0($fp) = param_cell_right_neighbor_at_CellularAutomaton_position_0 +function_cell_right_neighbor_at_CellularAutomaton: + # Allocate stack frame for function function_cell_right_neighbor_at_CellularAutomaton. + subu $sp, $sp, 80 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 80 + # LOCAL local_cell_right_neighbor_at_CellularAutomaton_internal_7 --> -32($fp) + # local_cell_right_neighbor_at_CellularAutomaton_internal_7 = SELF + sw $s1, -32($fp) + # LOCAL local_cell_right_neighbor_at_CellularAutomaton_internal_5 --> -24($fp) + # LOCAL local_cell_right_neighbor_at_CellularAutomaton_internal_7 --> -32($fp) + # local_cell_right_neighbor_at_CellularAutomaton_internal_5 = local_cell_right_neighbor_at_CellularAutomaton_internal_7 + lw $t0, -32($fp) + sw $t0, -24($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_cell_right_neighbor_at_CellularAutomaton_internal_5 --> -24($fp) + # LOCAL local_cell_right_neighbor_at_CellularAutomaton_internal_6 --> -28($fp) + # local_cell_right_neighbor_at_CellularAutomaton_internal_6 = VCALL local_cell_right_neighbor_at_CellularAutomaton_internal_5 num_cells + # Save new self pointer in $s1 + lw $s1, -24($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 4($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -28($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_cell_right_neighbor_at_CellularAutomaton_internal_8 --> -36($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -36($fp) + # LOCAL local_cell_right_neighbor_at_CellularAutomaton_internal_4 --> -20($fp) + # LOCAL local_cell_right_neighbor_at_CellularAutomaton_internal_6 --> -28($fp) + # LOCAL local_cell_right_neighbor_at_CellularAutomaton_internal_8 --> -36($fp) + # local_cell_right_neighbor_at_CellularAutomaton_internal_4 = local_cell_right_neighbor_at_CellularAutomaton_internal_6 - local_cell_right_neighbor_at_CellularAutomaton_internal_8 + lw $t1, -28($fp) + lw $t0, 12($t1) + lw $t1, -36($fp) + lw $t2, 12($t1) + sub $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -20($fp) + # IF_ZERO param_cell_right_neighbor_at_CellularAutomaton_position_0 GOTO label_FALSE_17 + # IF_ZERO param_cell_right_neighbor_at_CellularAutomaton_position_0 GOTO label_FALSE_17 + lw $t0, 0($fp) + beq $t0, 0, label_FALSE_17 + # IF_ZERO local_cell_right_neighbor_at_CellularAutomaton_internal_4 GOTO label_FALSE_17 + # IF_ZERO local_cell_right_neighbor_at_CellularAutomaton_internal_4 GOTO label_FALSE_17 + lw $t0, -20($fp) + beq $t0, 0, label_FALSE_17 + # LOCAL local_cell_right_neighbor_at_CellularAutomaton_internal_3 --> -16($fp) + # PARAM param_cell_right_neighbor_at_CellularAutomaton_position_0 --> 0($fp) + # Comparing 0($fp) type with String + la $v0, String + lw $a0, 0($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -16($fp) + # IF_ZERO local_cell_right_neighbor_at_CellularAutomaton_internal_3 GOTO label_COMPARE_STRING_20 + # IF_ZERO local_cell_right_neighbor_at_CellularAutomaton_internal_3 GOTO label_COMPARE_STRING_20 + lw $t0, -16($fp) + beq $t0, 0, label_COMPARE_STRING_20 + # LOCAL local_cell_right_neighbor_at_CellularAutomaton_internal_3 --> -16($fp) + # PARAM param_cell_right_neighbor_at_CellularAutomaton_position_0 --> 0($fp) + # Comparing 0($fp) type with Bool + la $v0, Bool + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -16($fp) + # IF_ZERO local_cell_right_neighbor_at_CellularAutomaton_internal_3 GOTO label_COMPARE_BY_VALUE_21 + # IF_ZERO local_cell_right_neighbor_at_CellularAutomaton_internal_3 GOTO label_COMPARE_BY_VALUE_21 + lw $t0, -16($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_21 + # LOCAL local_cell_right_neighbor_at_CellularAutomaton_internal_3 --> -16($fp) + # PARAM param_cell_right_neighbor_at_CellularAutomaton_position_0 --> 0($fp) + # Comparing 0($fp) type with Int + la $v0, Int + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -16($fp) + # IF_ZERO local_cell_right_neighbor_at_CellularAutomaton_internal_3 GOTO label_COMPARE_BY_VALUE_21 + # IF_ZERO local_cell_right_neighbor_at_CellularAutomaton_internal_3 GOTO label_COMPARE_BY_VALUE_21 + lw $t0, -16($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_21 + # LOCAL local_cell_right_neighbor_at_CellularAutomaton_internal_3 --> -16($fp) + # PARAM param_cell_right_neighbor_at_CellularAutomaton_position_0 --> 0($fp) + # LOCAL local_cell_right_neighbor_at_CellularAutomaton_internal_4 --> -20($fp) + # Load pointers and SUB + lw $a0, 0($fp) + lw $a1, -20($fp) + sub $a0, $a0, $a1 + sw $a0, -16($fp) + # IF_ZERO local_cell_right_neighbor_at_CellularAutomaton_internal_3 GOTO label_TRUE_18 + # IF_ZERO local_cell_right_neighbor_at_CellularAutomaton_internal_3 GOTO label_TRUE_18 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_18 + # GOTO label_FALSE_17 + j label_FALSE_17 + label_COMPARE_BY_VALUE_21: + # LOCAL local_cell_right_neighbor_at_CellularAutomaton_internal_3 --> -16($fp) + # PARAM param_cell_right_neighbor_at_CellularAutomaton_position_0 --> 0($fp) + # LOCAL local_cell_right_neighbor_at_CellularAutomaton_internal_4 --> -20($fp) + lw $a0, 0($fp) + lw $a1, -20($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -16($fp) + # IF_ZERO local_cell_right_neighbor_at_CellularAutomaton_internal_3 GOTO label_TRUE_18 + # IF_ZERO local_cell_right_neighbor_at_CellularAutomaton_internal_3 GOTO label_TRUE_18 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_18 + # GOTO label_FALSE_17 + j label_FALSE_17 + label_COMPARE_STRING_20: + # LOCAL local_cell_right_neighbor_at_CellularAutomaton_internal_3 --> -16($fp) + # PARAM param_cell_right_neighbor_at_CellularAutomaton_position_0 --> 0($fp) + # LOCAL local_cell_right_neighbor_at_CellularAutomaton_internal_4 --> -20($fp) + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -20($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -16($fp) + # IF_ZERO local_cell_right_neighbor_at_CellularAutomaton_internal_3 GOTO label_CONTINUE_22 + # IF_ZERO local_cell_right_neighbor_at_CellularAutomaton_internal_3 GOTO label_CONTINUE_22 + lw $t0, -16($fp) + beq $t0, 0, label_CONTINUE_22 + # GOTO label_FALSE_17 + j label_FALSE_17 + label_CONTINUE_22: + # LOCAL local_cell_right_neighbor_at_CellularAutomaton_internal_3 --> -16($fp) + # PARAM param_cell_right_neighbor_at_CellularAutomaton_position_0 --> 0($fp) + # LOCAL local_cell_right_neighbor_at_CellularAutomaton_internal_4 --> -20($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -20($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_23: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_24 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_23 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_24: + # Store result + sw $a2, -16($fp) + # IF_ZERO local_cell_right_neighbor_at_CellularAutomaton_internal_3 GOTO label_TRUE_18 + # IF_ZERO local_cell_right_neighbor_at_CellularAutomaton_internal_3 GOTO label_TRUE_18 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_18 + label_FALSE_17: + # LOCAL local_cell_right_neighbor_at_CellularAutomaton_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -12($fp) + # GOTO label_END_19 +j label_END_19 +label_TRUE_18: + # LOCAL local_cell_right_neighbor_at_CellularAutomaton_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -12($fp) + label_END_19: +# LOCAL local_cell_right_neighbor_at_CellularAutomaton_internal_0 --> -4($fp) +# LOCAL local_cell_right_neighbor_at_CellularAutomaton_internal_2 --> -12($fp) +# Obtain value from -12($fp) +lw $v0, -12($fp) +lw $v0, 12($v0) +sw $v0, -4($fp) +# IF_ZERO local_cell_right_neighbor_at_CellularAutomaton_internal_0 GOTO label_FALSEIF_15 +# IF_ZERO local_cell_right_neighbor_at_CellularAutomaton_internal_0 GOTO label_FALSEIF_15 +lw $t0, -4($fp) +beq $t0, 0, label_FALSEIF_15 +# LOCAL local_cell_right_neighbor_at_CellularAutomaton_internal_11 --> -48($fp) +# local_cell_right_neighbor_at_CellularAutomaton_internal_11 = SELF +sw $s1, -48($fp) +# LOCAL local_cell_right_neighbor_at_CellularAutomaton_internal_9 --> -40($fp) +# LOCAL local_cell_right_neighbor_at_CellularAutomaton_internal_11 --> -48($fp) +# local_cell_right_neighbor_at_CellularAutomaton_internal_9 = local_cell_right_neighbor_at_CellularAutomaton_internal_11 +lw $t0, -48($fp) +sw $t0, -40($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_cell_right_neighbor_at_CellularAutomaton_internal_12 --> -52($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 0 +sw $t0, 12($v0) +sw $v0, -52($fp) +# ARG local_cell_right_neighbor_at_CellularAutomaton_internal_12 +# LOCAL local_cell_right_neighbor_at_CellularAutomaton_internal_12 --> -52($fp) +lw $t0, -52($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_cell_right_neighbor_at_CellularAutomaton_internal_9 --> -40($fp) +# LOCAL local_cell_right_neighbor_at_CellularAutomaton_internal_10 --> -44($fp) +# local_cell_right_neighbor_at_CellularAutomaton_internal_10 = VCALL local_cell_right_neighbor_at_CellularAutomaton_internal_9 cell +# Save new self pointer in $s1 +lw $s1, -40($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 60($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -44($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_cell_right_neighbor_at_CellularAutomaton_internal_1 --> -8($fp) +# LOCAL local_cell_right_neighbor_at_CellularAutomaton_internal_10 --> -44($fp) +# local_cell_right_neighbor_at_CellularAutomaton_internal_1 = local_cell_right_neighbor_at_CellularAutomaton_internal_10 +lw $t0, -44($fp) +sw $t0, -8($fp) +# GOTO label_ENDIF_16 +j label_ENDIF_16 +label_FALSEIF_15: + # LOCAL local_cell_right_neighbor_at_CellularAutomaton_internal_15 --> -64($fp) + # local_cell_right_neighbor_at_CellularAutomaton_internal_15 = SELF + sw $s1, -64($fp) + # LOCAL local_cell_right_neighbor_at_CellularAutomaton_internal_13 --> -56($fp) + # LOCAL local_cell_right_neighbor_at_CellularAutomaton_internal_15 --> -64($fp) + # local_cell_right_neighbor_at_CellularAutomaton_internal_13 = local_cell_right_neighbor_at_CellularAutomaton_internal_15 + lw $t0, -64($fp) + sw $t0, -56($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_cell_right_neighbor_at_CellularAutomaton_internal_17 --> -72($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -72($fp) + # LOCAL local_cell_right_neighbor_at_CellularAutomaton_internal_16 --> -68($fp) + # PARAM param_cell_right_neighbor_at_CellularAutomaton_position_0 --> 0($fp) + # LOCAL local_cell_right_neighbor_at_CellularAutomaton_internal_17 --> -72($fp) + # local_cell_right_neighbor_at_CellularAutomaton_internal_16 = PARAM param_cell_right_neighbor_at_CellularAutomaton_position_0 + local_cell_right_neighbor_at_CellularAutomaton_internal_17 + lw $t1, 0($fp) + lw $t0, 12($t1) + lw $t1, -72($fp) + lw $t2, 12($t1) + add $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -68($fp) + # ARG local_cell_right_neighbor_at_CellularAutomaton_internal_16 + # LOCAL local_cell_right_neighbor_at_CellularAutomaton_internal_16 --> -68($fp) + lw $t0, -68($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_cell_right_neighbor_at_CellularAutomaton_internal_13 --> -56($fp) + # LOCAL local_cell_right_neighbor_at_CellularAutomaton_internal_14 --> -60($fp) + # local_cell_right_neighbor_at_CellularAutomaton_internal_14 = VCALL local_cell_right_neighbor_at_CellularAutomaton_internal_13 cell + # Save new self pointer in $s1 + lw $s1, -56($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 60($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -60($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_cell_right_neighbor_at_CellularAutomaton_internal_1 --> -8($fp) + # LOCAL local_cell_right_neighbor_at_CellularAutomaton_internal_14 --> -60($fp) + # local_cell_right_neighbor_at_CellularAutomaton_internal_1 = local_cell_right_neighbor_at_CellularAutomaton_internal_14 + lw $t0, -60($fp) + sw $t0, -8($fp) + label_ENDIF_16: +# RETURN local_cell_right_neighbor_at_CellularAutomaton_internal_1 +lw $v0, -8($fp) +# Deallocate stack frame for function function_cell_right_neighbor_at_CellularAutomaton. +# Restore $ra +lw $ra, 4($sp) +# Restore $fp +lw $fp, 0($sp) +# Restore Stack pointer $sp +addu $sp, $sp, 80 +# Deallocate function args +addu $sp, $sp, 4 +jr $ra +# Function END + + +# function_cell_at_next_evolution_at_CellularAutomaton implementation. +# @Params: +# 0($fp) = param_cell_at_next_evolution_at_CellularAutomaton_position_0 +function_cell_at_next_evolution_at_CellularAutomaton: + # Allocate stack frame for function function_cell_at_next_evolution_at_CellularAutomaton. + subu $sp, $sp, 164 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 164 + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_12 --> -52($fp) + # local_cell_at_next_evolution_at_CellularAutomaton_internal_12 = SELF + sw $s1, -52($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_10 --> -44($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_12 --> -52($fp) + # local_cell_at_next_evolution_at_CellularAutomaton_internal_10 = local_cell_at_next_evolution_at_CellularAutomaton_internal_12 + lw $t0, -52($fp) + sw $t0, -44($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # ARG param_cell_at_next_evolution_at_CellularAutomaton_position_0 + # PARAM param_cell_at_next_evolution_at_CellularAutomaton_position_0 --> 0($fp) + lw $t0, 0($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_10 --> -44($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_11 --> -48($fp) + # local_cell_at_next_evolution_at_CellularAutomaton_internal_11 = VCALL local_cell_at_next_evolution_at_CellularAutomaton_internal_10 cell + # Save new self pointer in $s1 + lw $s1, -44($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 60($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -48($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_13 --> -56($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_6 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -56($fp) + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_11 GOTO label_FALSE_29 + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_11 GOTO label_FALSE_29 + lw $t0, -48($fp) + beq $t0, 0, label_FALSE_29 + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_13 GOTO label_FALSE_29 + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_13 GOTO label_FALSE_29 + lw $t0, -56($fp) + beq $t0, 0, label_FALSE_29 + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_9 --> -40($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_11 --> -48($fp) + # Comparing -48($fp) type with String + la $v0, String + lw $a0, -48($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -40($fp) + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_9 GOTO label_COMPARE_STRING_32 + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_9 GOTO label_COMPARE_STRING_32 + lw $t0, -40($fp) + beq $t0, 0, label_COMPARE_STRING_32 + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_9 --> -40($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_11 --> -48($fp) + # Comparing -48($fp) type with Bool + la $v0, Bool + lw $a0, -48($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -40($fp) + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_9 GOTO label_COMPARE_BY_VALUE_33 + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_9 GOTO label_COMPARE_BY_VALUE_33 + lw $t0, -40($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_33 + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_9 --> -40($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_11 --> -48($fp) + # Comparing -48($fp) type with Int + la $v0, Int + lw $a0, -48($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -40($fp) + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_9 GOTO label_COMPARE_BY_VALUE_33 + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_9 GOTO label_COMPARE_BY_VALUE_33 + lw $t0, -40($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_33 + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_9 --> -40($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_11 --> -48($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_13 --> -56($fp) + # Load pointers and SUB + lw $a0, -48($fp) + lw $a1, -56($fp) + sub $a0, $a0, $a1 + sw $a0, -40($fp) + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_9 GOTO label_TRUE_30 + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_9 GOTO label_TRUE_30 + lw $t0, -40($fp) + beq $t0, 0, label_TRUE_30 + # GOTO label_FALSE_29 + j label_FALSE_29 + label_COMPARE_BY_VALUE_33: + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_9 --> -40($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_11 --> -48($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_13 --> -56($fp) + lw $a0, -48($fp) + lw $a1, -56($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -40($fp) + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_9 GOTO label_TRUE_30 + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_9 GOTO label_TRUE_30 + lw $t0, -40($fp) + beq $t0, 0, label_TRUE_30 + # GOTO label_FALSE_29 + j label_FALSE_29 + label_COMPARE_STRING_32: + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_9 --> -40($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_11 --> -48($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_13 --> -56($fp) + # Load strings for comparison + lw $v0, -48($fp) + lw $v1, -56($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -40($fp) + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_9 GOTO label_CONTINUE_34 + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_9 GOTO label_CONTINUE_34 + lw $t0, -40($fp) + beq $t0, 0, label_CONTINUE_34 + # GOTO label_FALSE_29 + j label_FALSE_29 + label_CONTINUE_34: + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_9 --> -40($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_11 --> -48($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_13 --> -56($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -48($fp) + lw $v1, -56($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_35: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_36 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_35 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_36: + # Store result + sw $a2, -40($fp) + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_9 GOTO label_TRUE_30 + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_9 GOTO label_TRUE_30 + lw $t0, -40($fp) + beq $t0, 0, label_TRUE_30 + label_FALSE_29: + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_8 --> -36($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -36($fp) + # GOTO label_END_31 +j label_END_31 +label_TRUE_30: + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_8 --> -36($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -36($fp) + label_END_31: +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_6 --> -28($fp) +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_8 --> -36($fp) +# Obtain value from -36($fp) +lw $v0, -36($fp) +lw $v0, 12($v0) +sw $v0, -28($fp) +# IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_6 GOTO label_FALSEIF_27 +# IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_6 GOTO label_FALSEIF_27 +lw $t0, -28($fp) +beq $t0, 0, label_FALSEIF_27 +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_14 --> -60($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 1 +sw $t0, 12($v0) +sw $v0, -60($fp) +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_7 --> -32($fp) +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_14 --> -60($fp) +# local_cell_at_next_evolution_at_CellularAutomaton_internal_7 = local_cell_at_next_evolution_at_CellularAutomaton_internal_14 +lw $t0, -60($fp) +sw $t0, -32($fp) +# GOTO label_ENDIF_28 +j label_ENDIF_28 +label_FALSEIF_27: + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_15 --> -64($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -64($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_7 --> -32($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_15 --> -64($fp) + # local_cell_at_next_evolution_at_CellularAutomaton_internal_7 = local_cell_at_next_evolution_at_CellularAutomaton_internal_15 + lw $t0, -64($fp) + sw $t0, -32($fp) + label_ENDIF_28: +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_22 --> -92($fp) +# local_cell_at_next_evolution_at_CellularAutomaton_internal_22 = SELF +sw $s1, -92($fp) +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_20 --> -84($fp) +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_22 --> -92($fp) +# local_cell_at_next_evolution_at_CellularAutomaton_internal_20 = local_cell_at_next_evolution_at_CellularAutomaton_internal_22 +lw $t0, -92($fp) +sw $t0, -84($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# ARG param_cell_at_next_evolution_at_CellularAutomaton_position_0 +# PARAM param_cell_at_next_evolution_at_CellularAutomaton_position_0 --> 0($fp) +lw $t0, 0($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_20 --> -84($fp) +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_21 --> -88($fp) +# local_cell_at_next_evolution_at_CellularAutomaton_internal_21 = VCALL local_cell_at_next_evolution_at_CellularAutomaton_internal_20 cell_left_neighbor +# Save new self pointer in $s1 +lw $s1, -84($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 44($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -88($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_23 --> -96($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_7 +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +sw $v0, -96($fp) +# IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_21 GOTO label_FALSE_39 +# IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_21 GOTO label_FALSE_39 +lw $t0, -88($fp) +beq $t0, 0, label_FALSE_39 +# IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_23 GOTO label_FALSE_39 +# IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_23 GOTO label_FALSE_39 +lw $t0, -96($fp) +beq $t0, 0, label_FALSE_39 +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_19 --> -80($fp) +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_21 --> -88($fp) +# Comparing -88($fp) type with String +la $v0, String +lw $a0, -88($fp) +lw $a0, 0($a0) +sub $a0, $a0, $v0 +sw $a0, -80($fp) +# IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_19 GOTO label_COMPARE_STRING_42 +# IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_19 GOTO label_COMPARE_STRING_42 +lw $t0, -80($fp) +beq $t0, 0, label_COMPARE_STRING_42 +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_19 --> -80($fp) +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_21 --> -88($fp) +# Comparing -88($fp) type with Bool +la $v0, Bool +lw $a0, -88($fp) +lw $a0, 0($a0) +lw $a0, 12($a0) +sub $a0, $a0, $v0 +sw $a0, -80($fp) +# IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_19 GOTO label_COMPARE_BY_VALUE_43 +# IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_19 GOTO label_COMPARE_BY_VALUE_43 +lw $t0, -80($fp) +beq $t0, 0, label_COMPARE_BY_VALUE_43 +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_19 --> -80($fp) +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_21 --> -88($fp) +# Comparing -88($fp) type with Int +la $v0, Int +lw $a0, -88($fp) +lw $a0, 0($a0) +lw $a0, 12($a0) +sub $a0, $a0, $v0 +sw $a0, -80($fp) +# IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_19 GOTO label_COMPARE_BY_VALUE_43 +# IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_19 GOTO label_COMPARE_BY_VALUE_43 +lw $t0, -80($fp) +beq $t0, 0, label_COMPARE_BY_VALUE_43 +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_19 --> -80($fp) +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_21 --> -88($fp) +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_23 --> -96($fp) +# Load pointers and SUB +lw $a0, -88($fp) +lw $a1, -96($fp) +sub $a0, $a0, $a1 +sw $a0, -80($fp) +# IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_19 GOTO label_TRUE_40 +# IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_19 GOTO label_TRUE_40 +lw $t0, -80($fp) +beq $t0, 0, label_TRUE_40 +# GOTO label_FALSE_39 +j label_FALSE_39 +label_COMPARE_BY_VALUE_43: + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_19 --> -80($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_21 --> -88($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_23 --> -96($fp) + lw $a0, -88($fp) + lw $a1, -96($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -80($fp) + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_19 GOTO label_TRUE_40 + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_19 GOTO label_TRUE_40 + lw $t0, -80($fp) + beq $t0, 0, label_TRUE_40 + # GOTO label_FALSE_39 + j label_FALSE_39 + label_COMPARE_STRING_42: + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_19 --> -80($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_21 --> -88($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_23 --> -96($fp) + # Load strings for comparison + lw $v0, -88($fp) + lw $v1, -96($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -80($fp) + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_19 GOTO label_CONTINUE_44 + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_19 GOTO label_CONTINUE_44 + lw $t0, -80($fp) + beq $t0, 0, label_CONTINUE_44 + # GOTO label_FALSE_39 + j label_FALSE_39 + label_CONTINUE_44: + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_19 --> -80($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_21 --> -88($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_23 --> -96($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -88($fp) + lw $v1, -96($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_45: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_46 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_45 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_46: + # Store result + sw $a2, -80($fp) + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_19 GOTO label_TRUE_40 + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_19 GOTO label_TRUE_40 + lw $t0, -80($fp) + beq $t0, 0, label_TRUE_40 + label_FALSE_39: + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_18 --> -76($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -76($fp) + # GOTO label_END_41 +j label_END_41 +label_TRUE_40: + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_18 --> -76($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -76($fp) + label_END_41: +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_16 --> -68($fp) +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_18 --> -76($fp) +# Obtain value from -76($fp) +lw $v0, -76($fp) +lw $v0, 12($v0) +sw $v0, -68($fp) +# IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_16 GOTO label_FALSEIF_37 +# IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_16 GOTO label_FALSEIF_37 +lw $t0, -68($fp) +beq $t0, 0, label_FALSEIF_37 +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_24 --> -100($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 1 +sw $t0, 12($v0) +sw $v0, -100($fp) +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_17 --> -72($fp) +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_24 --> -100($fp) +# local_cell_at_next_evolution_at_CellularAutomaton_internal_17 = local_cell_at_next_evolution_at_CellularAutomaton_internal_24 +lw $t0, -100($fp) +sw $t0, -72($fp) +# GOTO label_ENDIF_38 +j label_ENDIF_38 +label_FALSEIF_37: + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_25 --> -104($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -104($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_17 --> -72($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_25 --> -104($fp) + # local_cell_at_next_evolution_at_CellularAutomaton_internal_17 = local_cell_at_next_evolution_at_CellularAutomaton_internal_25 + lw $t0, -104($fp) + sw $t0, -72($fp) + label_ENDIF_38: +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_5 --> -24($fp) +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_7 --> -32($fp) +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_17 --> -72($fp) +# local_cell_at_next_evolution_at_CellularAutomaton_internal_5 = local_cell_at_next_evolution_at_CellularAutomaton_internal_7 + local_cell_at_next_evolution_at_CellularAutomaton_internal_17 +lw $t1, -32($fp) +lw $t0, 12($t1) +lw $t1, -72($fp) +lw $t2, 12($t1) +add $t0, $t0, $t2 +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t1, String +sw $t1, 0($v0) +la $t1, String_start +sw $t1, 4($v0) +# Load type offset +li $t1, 8 +sw $t1, 8($v0) +la $t1, Int +sw $t1, 12($v0) +li $t1, 3 +sw $t1, 16($v0) +move $t1, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t1, 0($v0) +la $t1, Int_start +sw $t1, 4($v0) +# Load type offset +li $t1, 16 +sw $t1, 8($v0) +sw $t0, 12($v0) +sw $v0, -24($fp) +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_32 --> -132($fp) +# local_cell_at_next_evolution_at_CellularAutomaton_internal_32 = SELF +sw $s1, -132($fp) +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_30 --> -124($fp) +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_32 --> -132($fp) +# local_cell_at_next_evolution_at_CellularAutomaton_internal_30 = local_cell_at_next_evolution_at_CellularAutomaton_internal_32 +lw $t0, -132($fp) +sw $t0, -124($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# ARG param_cell_at_next_evolution_at_CellularAutomaton_position_0 +# PARAM param_cell_at_next_evolution_at_CellularAutomaton_position_0 --> 0($fp) +lw $t0, 0($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_30 --> -124($fp) +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_31 --> -128($fp) +# local_cell_at_next_evolution_at_CellularAutomaton_internal_31 = VCALL local_cell_at_next_evolution_at_CellularAutomaton_internal_30 cell_right_neighbor +# Save new self pointer in $s1 +lw $s1, -124($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 48($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -128($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_33 --> -136($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_8 +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +sw $v0, -136($fp) +# IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_31 GOTO label_FALSE_49 +# IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_31 GOTO label_FALSE_49 +lw $t0, -128($fp) +beq $t0, 0, label_FALSE_49 +# IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_33 GOTO label_FALSE_49 +# IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_33 GOTO label_FALSE_49 +lw $t0, -136($fp) +beq $t0, 0, label_FALSE_49 +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_29 --> -120($fp) +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_31 --> -128($fp) +# Comparing -128($fp) type with String +la $v0, String +lw $a0, -128($fp) +lw $a0, 0($a0) +sub $a0, $a0, $v0 +sw $a0, -120($fp) +# IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_29 GOTO label_COMPARE_STRING_52 +# IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_29 GOTO label_COMPARE_STRING_52 +lw $t0, -120($fp) +beq $t0, 0, label_COMPARE_STRING_52 +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_29 --> -120($fp) +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_31 --> -128($fp) +# Comparing -128($fp) type with Bool +la $v0, Bool +lw $a0, -128($fp) +lw $a0, 0($a0) +lw $a0, 12($a0) +sub $a0, $a0, $v0 +sw $a0, -120($fp) +# IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_29 GOTO label_COMPARE_BY_VALUE_53 +# IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_29 GOTO label_COMPARE_BY_VALUE_53 +lw $t0, -120($fp) +beq $t0, 0, label_COMPARE_BY_VALUE_53 +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_29 --> -120($fp) +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_31 --> -128($fp) +# Comparing -128($fp) type with Int +la $v0, Int +lw $a0, -128($fp) +lw $a0, 0($a0) +lw $a0, 12($a0) +sub $a0, $a0, $v0 +sw $a0, -120($fp) +# IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_29 GOTO label_COMPARE_BY_VALUE_53 +# IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_29 GOTO label_COMPARE_BY_VALUE_53 +lw $t0, -120($fp) +beq $t0, 0, label_COMPARE_BY_VALUE_53 +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_29 --> -120($fp) +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_31 --> -128($fp) +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_33 --> -136($fp) +# Load pointers and SUB +lw $a0, -128($fp) +lw $a1, -136($fp) +sub $a0, $a0, $a1 +sw $a0, -120($fp) +# IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_29 GOTO label_TRUE_50 +# IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_29 GOTO label_TRUE_50 +lw $t0, -120($fp) +beq $t0, 0, label_TRUE_50 +# GOTO label_FALSE_49 +j label_FALSE_49 +label_COMPARE_BY_VALUE_53: + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_29 --> -120($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_31 --> -128($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_33 --> -136($fp) + lw $a0, -128($fp) + lw $a1, -136($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -120($fp) + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_29 GOTO label_TRUE_50 + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_29 GOTO label_TRUE_50 + lw $t0, -120($fp) + beq $t0, 0, label_TRUE_50 + # GOTO label_FALSE_49 + j label_FALSE_49 + label_COMPARE_STRING_52: + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_29 --> -120($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_31 --> -128($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_33 --> -136($fp) + # Load strings for comparison + lw $v0, -128($fp) + lw $v1, -136($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -120($fp) + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_29 GOTO label_CONTINUE_54 + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_29 GOTO label_CONTINUE_54 + lw $t0, -120($fp) + beq $t0, 0, label_CONTINUE_54 + # GOTO label_FALSE_49 + j label_FALSE_49 + label_CONTINUE_54: + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_29 --> -120($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_31 --> -128($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_33 --> -136($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -128($fp) + lw $v1, -136($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_55: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_56 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_55 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_56: + # Store result + sw $a2, -120($fp) + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_29 GOTO label_TRUE_50 + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_29 GOTO label_TRUE_50 + lw $t0, -120($fp) + beq $t0, 0, label_TRUE_50 + label_FALSE_49: + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_28 --> -116($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -116($fp) + # GOTO label_END_51 +j label_END_51 +label_TRUE_50: + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_28 --> -116($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -116($fp) + label_END_51: +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_26 --> -108($fp) +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_28 --> -116($fp) +# Obtain value from -116($fp) +lw $v0, -116($fp) +lw $v0, 12($v0) +sw $v0, -108($fp) +# IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_26 GOTO label_FALSEIF_47 +# IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_26 GOTO label_FALSEIF_47 +lw $t0, -108($fp) +beq $t0, 0, label_FALSEIF_47 +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_34 --> -140($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 1 +sw $t0, 12($v0) +sw $v0, -140($fp) +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_27 --> -112($fp) +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_34 --> -140($fp) +# local_cell_at_next_evolution_at_CellularAutomaton_internal_27 = local_cell_at_next_evolution_at_CellularAutomaton_internal_34 +lw $t0, -140($fp) +sw $t0, -112($fp) +# GOTO label_ENDIF_48 +j label_ENDIF_48 +label_FALSEIF_47: + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_35 --> -144($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -144($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_27 --> -112($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_35 --> -144($fp) + # local_cell_at_next_evolution_at_CellularAutomaton_internal_27 = local_cell_at_next_evolution_at_CellularAutomaton_internal_35 + lw $t0, -144($fp) + sw $t0, -112($fp) + label_ENDIF_48: +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_4 --> -20($fp) +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_5 --> -24($fp) +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_27 --> -112($fp) +# local_cell_at_next_evolution_at_CellularAutomaton_internal_4 = local_cell_at_next_evolution_at_CellularAutomaton_internal_5 + local_cell_at_next_evolution_at_CellularAutomaton_internal_27 +lw $t1, -24($fp) +lw $t0, 12($t1) +lw $t1, -112($fp) +lw $t2, 12($t1) +add $t0, $t0, $t2 +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t1, String +sw $t1, 0($v0) +la $t1, String_start +sw $t1, 4($v0) +# Load type offset +li $t1, 8 +sw $t1, 8($v0) +la $t1, Int +sw $t1, 12($v0) +li $t1, 3 +sw $t1, 16($v0) +move $t1, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t1, 0($v0) +la $t1, Int_start +sw $t1, 4($v0) +# Load type offset +li $t1, 16 +sw $t1, 8($v0) +sw $t0, 12($v0) +sw $v0, -20($fp) +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_36 --> -148($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 1 +sw $t0, 12($v0) +sw $v0, -148($fp) +# IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_4 GOTO label_FALSE_57 +# IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_4 GOTO label_FALSE_57 +lw $t0, -20($fp) +beq $t0, 0, label_FALSE_57 +# IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_36 GOTO label_FALSE_57 +# IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_36 GOTO label_FALSE_57 +lw $t0, -148($fp) +beq $t0, 0, label_FALSE_57 +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_3 --> -16($fp) +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_4 --> -20($fp) +# Comparing -20($fp) type with String +la $v0, String +lw $a0, -20($fp) +lw $a0, 0($a0) +sub $a0, $a0, $v0 +sw $a0, -16($fp) +# IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_3 GOTO label_COMPARE_STRING_60 +# IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_3 GOTO label_COMPARE_STRING_60 +lw $t0, -16($fp) +beq $t0, 0, label_COMPARE_STRING_60 +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_3 --> -16($fp) +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_4 --> -20($fp) +# Comparing -20($fp) type with Bool +la $v0, Bool +lw $a0, -20($fp) +lw $a0, 0($a0) +lw $a0, 12($a0) +sub $a0, $a0, $v0 +sw $a0, -16($fp) +# IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_3 GOTO label_COMPARE_BY_VALUE_61 +# IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_3 GOTO label_COMPARE_BY_VALUE_61 +lw $t0, -16($fp) +beq $t0, 0, label_COMPARE_BY_VALUE_61 +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_3 --> -16($fp) +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_4 --> -20($fp) +# Comparing -20($fp) type with Int +la $v0, Int +lw $a0, -20($fp) +lw $a0, 0($a0) +lw $a0, 12($a0) +sub $a0, $a0, $v0 +sw $a0, -16($fp) +# IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_3 GOTO label_COMPARE_BY_VALUE_61 +# IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_3 GOTO label_COMPARE_BY_VALUE_61 +lw $t0, -16($fp) +beq $t0, 0, label_COMPARE_BY_VALUE_61 +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_3 --> -16($fp) +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_4 --> -20($fp) +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_36 --> -148($fp) +# Load pointers and SUB +lw $a0, -20($fp) +lw $a1, -148($fp) +sub $a0, $a0, $a1 +sw $a0, -16($fp) +# IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_3 GOTO label_TRUE_58 +# IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_3 GOTO label_TRUE_58 +lw $t0, -16($fp) +beq $t0, 0, label_TRUE_58 +# GOTO label_FALSE_57 +j label_FALSE_57 +label_COMPARE_BY_VALUE_61: + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_3 --> -16($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_4 --> -20($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_36 --> -148($fp) + lw $a0, -20($fp) + lw $a1, -148($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -16($fp) + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_3 GOTO label_TRUE_58 + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_3 GOTO label_TRUE_58 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_58 + # GOTO label_FALSE_57 + j label_FALSE_57 + label_COMPARE_STRING_60: + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_3 --> -16($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_4 --> -20($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_36 --> -148($fp) + # Load strings for comparison + lw $v0, -20($fp) + lw $v1, -148($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -16($fp) + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_3 GOTO label_CONTINUE_62 + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_3 GOTO label_CONTINUE_62 + lw $t0, -16($fp) + beq $t0, 0, label_CONTINUE_62 + # GOTO label_FALSE_57 + j label_FALSE_57 + label_CONTINUE_62: + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_3 --> -16($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_4 --> -20($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_36 --> -148($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -20($fp) + lw $v1, -148($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_63: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_64 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_63 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_64: + # Store result + sw $a2, -16($fp) + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_3 GOTO label_TRUE_58 + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_3 GOTO label_TRUE_58 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_58 + label_FALSE_57: + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -12($fp) + # GOTO label_END_59 +j label_END_59 +label_TRUE_58: + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -12($fp) + label_END_59: +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_0 --> -4($fp) +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_2 --> -12($fp) +# Obtain value from -12($fp) +lw $v0, -12($fp) +lw $v0, 12($v0) +sw $v0, -4($fp) +# IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_0 GOTO label_FALSEIF_25 +# IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_0 GOTO label_FALSEIF_25 +lw $t0, -4($fp) +beq $t0, 0, label_FALSEIF_25 +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_37 --> -152($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_9 +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +sw $v0, -152($fp) +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_1 --> -8($fp) +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_37 --> -152($fp) +# local_cell_at_next_evolution_at_CellularAutomaton_internal_1 = local_cell_at_next_evolution_at_CellularAutomaton_internal_37 +lw $t0, -152($fp) +sw $t0, -8($fp) +# GOTO label_ENDIF_26 +j label_ENDIF_26 +label_FALSEIF_25: + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_38 --> -156($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_10 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -156($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_1 --> -8($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_38 --> -156($fp) + # local_cell_at_next_evolution_at_CellularAutomaton_internal_1 = local_cell_at_next_evolution_at_CellularAutomaton_internal_38 + lw $t0, -156($fp) + sw $t0, -8($fp) + label_ENDIF_26: +# RETURN local_cell_at_next_evolution_at_CellularAutomaton_internal_1 +lw $v0, -8($fp) +# Deallocate stack frame for function function_cell_at_next_evolution_at_CellularAutomaton. +# Restore $ra +lw $ra, 4($sp) +# Restore $fp +lw $fp, 0($sp) +# Restore Stack pointer $sp +addu $sp, $sp, 164 +# Deallocate function args +addu $sp, $sp, 4 +jr $ra +# Function END + + +# function_evolve_at_CellularAutomaton implementation. +# @Params: +function_evolve_at_CellularAutomaton: + # Allocate stack frame for function function_evolve_at_CellularAutomaton. + subu $sp, $sp, 72 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 72 + # LOCAL local_evolve_at_CellularAutomaton_position_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -4($fp) + # LOCAL local_evolve_at_CellularAutomaton_num_1 --> -8($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -8($fp) + # LOCAL local_evolve_at_CellularAutomaton_internal_4 --> -20($fp) + # local_evolve_at_CellularAutomaton_internal_4 = SELF + sw $s1, -20($fp) + # LOCAL local_evolve_at_CellularAutomaton_internal_2 --> -12($fp) + # LOCAL local_evolve_at_CellularAutomaton_internal_4 --> -20($fp) + # local_evolve_at_CellularAutomaton_internal_2 = local_evolve_at_CellularAutomaton_internal_4 + lw $t0, -20($fp) + sw $t0, -12($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_evolve_at_CellularAutomaton_internal_2 --> -12($fp) + # LOCAL local_evolve_at_CellularAutomaton_internal_3 --> -16($fp) + # local_evolve_at_CellularAutomaton_internal_3 = VCALL local_evolve_at_CellularAutomaton_internal_2 num_cells + # Save new self pointer in $s1 + lw $s1, -12($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 4($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -16($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_evolve_at_CellularAutomaton_num_1 --> -8($fp) + # LOCAL local_evolve_at_CellularAutomaton_internal_3 --> -16($fp) + # local_evolve_at_CellularAutomaton_num_1 = local_evolve_at_CellularAutomaton_internal_3 + lw $t0, -16($fp) + sw $t0, -8($fp) + # LOCAL local_evolve_at_CellularAutomaton_temp_5 --> -24($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_0 + sw $t0, 12($v0) + li $t0, 0 + sw $t0, 16($v0) + sw $v0, -24($fp) + label_WHILE_65: + # LOCAL local_evolve_at_CellularAutomaton_internal_7 --> -32($fp) + # LOCAL local_evolve_at_CellularAutomaton_position_0 --> -4($fp) + # LOCAL local_evolve_at_CellularAutomaton_num_1 --> -8($fp) + lw $a0, -4($fp) + lw $a1, -8($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -32($fp) + # IF_GREATER_ZERO local_evolve_at_CellularAutomaton_internal_7 GOTO label_FALSE_67 + # IF_GREATER_ZERO local_evolve_at_CellularAutomaton_internal_7 GOTO label_FALSE_67 + lw $t0, -32($fp) + bgt $t0, 0, label_FALSE_67 + # IF_ZERO local_evolve_at_CellularAutomaton_internal_7 GOTO label_FALSE_67 + # IF_ZERO local_evolve_at_CellularAutomaton_internal_7 GOTO label_FALSE_67 + lw $t0, -32($fp) + beq $t0, 0, label_FALSE_67 + # LOCAL local_evolve_at_CellularAutomaton_internal_7 --> -32($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -32($fp) + # GOTO label_END_68 +j label_END_68 +label_FALSE_67: + # LOCAL local_evolve_at_CellularAutomaton_internal_7 --> -32($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -32($fp) + label_END_68: +# LOCAL local_evolve_at_CellularAutomaton_internal_6 --> -28($fp) +# LOCAL local_evolve_at_CellularAutomaton_internal_7 --> -32($fp) +# Obtain value from -32($fp) +lw $v0, -32($fp) +lw $v0, 12($v0) +sw $v0, -28($fp) +# IF_ZERO local_evolve_at_CellularAutomaton_internal_6 GOTO label_WHILE_END_66 +# IF_ZERO local_evolve_at_CellularAutomaton_internal_6 GOTO label_WHILE_END_66 +lw $t0, -28($fp) +beq $t0, 0, label_WHILE_END_66 +# LOCAL local_evolve_at_CellularAutomaton_internal_8 --> -36($fp) +# LOCAL local_evolve_at_CellularAutomaton_temp_5 --> -24($fp) +# local_evolve_at_CellularAutomaton_internal_8 = local_evolve_at_CellularAutomaton_temp_5 +lw $t0, -24($fp) +sw $t0, -36($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_evolve_at_CellularAutomaton_internal_12 --> -52($fp) +# local_evolve_at_CellularAutomaton_internal_12 = SELF +sw $s1, -52($fp) +# LOCAL local_evolve_at_CellularAutomaton_internal_10 --> -44($fp) +# LOCAL local_evolve_at_CellularAutomaton_internal_12 --> -52($fp) +# local_evolve_at_CellularAutomaton_internal_10 = local_evolve_at_CellularAutomaton_internal_12 +lw $t0, -52($fp) +sw $t0, -44($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# ARG local_evolve_at_CellularAutomaton_position_0 +# LOCAL local_evolve_at_CellularAutomaton_position_0 --> -4($fp) +lw $t0, -4($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_evolve_at_CellularAutomaton_internal_10 --> -44($fp) +# LOCAL local_evolve_at_CellularAutomaton_internal_11 --> -48($fp) +# local_evolve_at_CellularAutomaton_internal_11 = VCALL local_evolve_at_CellularAutomaton_internal_10 cell_at_next_evolution +# Save new self pointer in $s1 +lw $s1, -44($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 24($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -48($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# ARG local_evolve_at_CellularAutomaton_internal_11 +# LOCAL local_evolve_at_CellularAutomaton_internal_11 --> -48($fp) +lw $t0, -48($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_evolve_at_CellularAutomaton_internal_8 --> -36($fp) +# LOCAL local_evolve_at_CellularAutomaton_internal_9 --> -40($fp) +# local_evolve_at_CellularAutomaton_internal_9 = VCALL local_evolve_at_CellularAutomaton_internal_8 concat +# Save new self pointer in $s1 +lw $s1, -36($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 56($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -40($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_evolve_at_CellularAutomaton_temp_5 --> -24($fp) +# LOCAL local_evolve_at_CellularAutomaton_internal_9 --> -40($fp) +# local_evolve_at_CellularAutomaton_temp_5 = local_evolve_at_CellularAutomaton_internal_9 +lw $t0, -40($fp) +sw $t0, -24($fp) +# LOCAL local_evolve_at_CellularAutomaton_internal_14 --> -60($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 1 +sw $t0, 12($v0) +sw $v0, -60($fp) +# LOCAL local_evolve_at_CellularAutomaton_internal_13 --> -56($fp) +# LOCAL local_evolve_at_CellularAutomaton_position_0 --> -4($fp) +# LOCAL local_evolve_at_CellularAutomaton_internal_14 --> -60($fp) +# local_evolve_at_CellularAutomaton_internal_13 = local_evolve_at_CellularAutomaton_position_0 + local_evolve_at_CellularAutomaton_internal_14 +lw $t1, -4($fp) +lw $t0, 12($t1) +lw $t1, -60($fp) +lw $t2, 12($t1) +add $t0, $t0, $t2 +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t1, String +sw $t1, 0($v0) +la $t1, String_start +sw $t1, 4($v0) +# Load type offset +li $t1, 8 +sw $t1, 8($v0) +la $t1, Int +sw $t1, 12($v0) +li $t1, 3 +sw $t1, 16($v0) +move $t1, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t1, 0($v0) +la $t1, Int_start +sw $t1, 4($v0) +# Load type offset +li $t1, 16 +sw $t1, 8($v0) +sw $t0, 12($v0) +sw $v0, -56($fp) +# LOCAL local_evolve_at_CellularAutomaton_position_0 --> -4($fp) +# LOCAL local_evolve_at_CellularAutomaton_internal_13 --> -56($fp) +# local_evolve_at_CellularAutomaton_position_0 = local_evolve_at_CellularAutomaton_internal_13 +lw $t0, -56($fp) +sw $t0, -4($fp) +# GOTO label_WHILE_65 +j label_WHILE_65 +label_WHILE_END_66: + # + # LOCAL local_evolve_at_CellularAutomaton_temp_5 --> -24($fp) + lw $t0, -24($fp) + sw $t0, 12($s1) + # LOCAL local_evolve_at_CellularAutomaton_internal_15 --> -64($fp) + # local_evolve_at_CellularAutomaton_internal_15 = SELF + sw $s1, -64($fp) + # RETURN local_evolve_at_CellularAutomaton_internal_15 + lw $v0, -64($fp) + # Deallocate stack frame for function function_evolve_at_CellularAutomaton. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 72 + jr $ra + # Function END + diff --git a/tests/codegen/complex.mips b/tests/codegen/complex.mips new file mode 100644 index 00000000..52e67683 --- /dev/null +++ b/tests/codegen/complex.mips @@ -0,0 +1,3339 @@ + +# Code generated by PyCoolc. +# Eliane Puerta, Liset Alfaro, Adrian Gonzalez --- Mon Dec 14 11:08:38 2020 +# School of Math and Computer Science, University of Havana +# + +.data +dummy: .word 0 +IO: .asciiz "IO" +# Function END +Object: .asciiz "Object" +# Function END +String: .asciiz "String" +# Function END +Bool: .asciiz "Bool" +# Function END +Int: .asciiz "Int" +# Function END +Complex: .asciiz "Complex" +# Function END +Main: .asciiz "Main" +# Function END +# + + +# **** VTABLE for type IO **** +IO_vtable: .word function_type_name_at_Object, function_out_string_at_IO, dummy, dummy, dummy, dummy, dummy, dummy, function_copy_at_Object, dummy, function_abort_at_Object, function_in_string_at_IO, function_in_int_at_IO, dummy, function_out_int_at_IO, dummy +# Function END +# + + +# **** Type RECORD for type IO **** +IO_start: + IO_vtable_pointer: .word IO_vtable + # Function END +IO_end: +# + + +# **** VTABLE for type Object **** +Object_vtable: .word function_type_name_at_Object, dummy, dummy, dummy, dummy, dummy, dummy, dummy, function_copy_at_Object, dummy, function_abort_at_Object, dummy, dummy, dummy, dummy, dummy +# Function END +# + + +# **** Type RECORD for type Object **** +Object_start: + Object_vtable_pointer: .word Object_vtable + # Function END +Object_end: +# + + +# **** VTABLE for type String **** +String_vtable: .word function_type_name_at_Object, dummy, dummy, dummy, dummy, dummy, function_length_at_String, function_substr_at_String, function_copy_at_Object, dummy, function_abort_at_Object, dummy, dummy, function_concat_at_String, dummy, dummy +# Function END +# + + +# **** Type RECORD for type String **** +String_start: + String_vtable_pointer: .word String_vtable + # Function END +String_end: +# + + +# **** VTABLE for type Bool **** +Bool_vtable: .word function_type_name_at_Object, dummy, dummy, dummy, dummy, dummy, dummy, dummy, function_copy_at_Object, dummy, function_abort_at_Object, dummy, dummy, dummy, dummy, dummy +# Function END +# + + +# **** Type RECORD for type Bool **** +Bool_start: + Bool_vtable_pointer: .word Bool_vtable + # Function END +Bool_end: +# + + +# **** VTABLE for type Int **** +Int_vtable: .word function_type_name_at_Object, dummy, dummy, dummy, dummy, dummy, dummy, dummy, function_copy_at_Object, dummy, function_abort_at_Object, dummy, dummy, dummy, dummy, dummy +# Function END +# + + +# **** Type RECORD for type Int **** +Int_start: + Int_vtable_pointer: .word Int_vtable + # Function END +Int_end: +# + + +# **** VTABLE for type Complex **** +Complex_vtable: .word function_type_name_at_Object, function_out_string_at_IO, function_print_at_Complex, function_reflect_0_at_Complex, dummy, function_reflect_X_at_Complex, dummy, dummy, function_copy_at_Object, function_init_at_Complex, function_abort_at_Object, function_in_string_at_IO, function_in_int_at_IO, dummy, function_out_int_at_IO, function_reflect_Y_at_Complex +# Function END +# + + +# **** Type RECORD for type Complex **** +Complex_start: + Complex_vtable_pointer: .word Complex_vtable + # Function END +Complex_end: +# + + +# **** VTABLE for type Main **** +Main_vtable: .word function_type_name_at_Object, function_out_string_at_IO, dummy, dummy, function_main_at_Main, dummy, dummy, dummy, function_copy_at_Object, dummy, function_abort_at_Object, function_in_string_at_IO, function_in_int_at_IO, dummy, function_out_int_at_IO, dummy +# Function END +# + + +# **** Type RECORD for type Main **** +Main_start: + Main_vtable_pointer: .word Main_vtable + # Function END +Main_end: +# + + +data_0: .asciiz "" +# + + +data_1: .asciiz "Abort called from class " +# + + +data_2: .asciiz "\n" +# + + +IO__TDT: .word 0, -1, -1, -1, -1, 1, 1 +Object__TDT: .word 1, 0, 1, 1, 1, 2, 2 +String__TDT: .word -1, -1, 0, -1, -1, -1, -1 +Bool__TDT: .word -1, -1, -1, 0, -1, -1, -1 +Int__TDT: .word -1, -1, -1, -1, 0, -1, -1 +Complex__TDT: .word -1, -1, -1, -1, -1, 0, -1 +Main__TDT: .word -1, -1, -1, -1, -1, -1, 0 +# + + +data_4: .asciiz "+" +# + + +data_5: .asciiz "I" +# + + +data_6: .asciiz "=)\n" +# + + +data_7: .asciiz "=(\n" +# + + +.text +main: + jal entry + # syscall code 10 is for exit + li $v0, 10 + syscall + # Function END + +# function_in_string_at_IO implementation. +# @Params: +function_in_string_at_IO: + # Allocate stack frame for function function_in_string_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_in_string_at_IO_internal_0 --> -4($fp) + # Allocating 1024 bytes of memory + li $a0, 1024 + li $v0, 9 + syscall + move $t0, $v0 + move $a0, $v0 + li $a1, 1024 + li $v0, 8 + syscall + move $t2, $zero + move $t3, $zero + move $t1, $t0 + lb $t3, 0($t1) + beqz $t3, end_loop + read_length_loop: + lb $t3, 0($t1) + beqz $t3, end_read_length_loop + addu $t1, $t1, 1 + addu $t2, $t2, 1 + j read_length_loop + end_read_length_loop: + subu $t1, $t1, 1 + sb $zero, 0($t1) + subu $t2, $t2, 1 + end_loop: + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $t2, 16($v0) + sw $v0, -4($fp) + # RETURN local_in_string_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_in_string_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_out_int_at_IO implementation. +# @Params: +# 0($fp) = param_out_int_at_IO_x_0 +function_out_int_at_IO: + # Allocate stack frame for function function_out_int_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # PRINT_INT param_out_int_at_IO_x_0 + # PARAM param_out_int_at_IO_x_0 --> 0($fp) + lw $v0, 0($fp) + lw $a0, 12($v0) + li $v0, 1 + syscall + # LOCAL local_out_int_at_IO_internal_0 --> -4($fp) + # local_out_int_at_IO_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_out_int_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_out_int_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_out_string_at_IO implementation. +# @Params: +# 0($fp) = param_out_string_at_IO_x_0 +function_out_string_at_IO: + # Allocate stack frame for function function_out_string_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # PARAM param_out_string_at_IO_x_0 --> 0($fp) + # PRINT_STR param_out_string_at_IO_x_0 + lw $v0, 0($fp) + lw $a0, 12($v0) + li $v0, 4 + syscall + # LOCAL local_out_string_at_IO_internal_0 --> -4($fp) + # local_out_string_at_IO_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_out_string_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_out_string_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_in_int_at_IO implementation. +# @Params: +function_in_int_at_IO: + # Allocate stack frame for function function_in_int_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_in_int_at_IO_internal_0 --> -4($fp) + # local_in_int_at_IO_internal_0 = READ_INT + li $v0, 5 + syscall + move $a2, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + sw $a2, 12($v0) + sw $v0, -4($fp) + # RETURN local_in_int_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_in_int_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_abort_at_Object implementation. +# @Params: +function_abort_at_Object: + # Allocate stack frame for function function_abort_at_Object. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_abort_at_Object_internal_0 --> -4($fp) + lw $t0, 0($s1) + sw $t0, -4($fp) + # LOCAL local_abort_at_Object_internal_0 --> -4($fp) + la $a0, data_1 + li $v0, 4 + syscall + lw $a0, -4($fp) + li $v0, 4 + syscall + la $a0, data_2 + li $v0, 4 + syscall + li $v0, 10 + syscall + # Function END + + +# function_copy_at_Object implementation. +# @Params: +function_copy_at_Object: + # Allocate stack frame for function function_copy_at_Object. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_copy_at_Object_internal_0 --> -4($fp) + # local_copy_at_Object_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_copy_at_Object_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function function_copy_at_Object. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_type_name_at_Object implementation. +# @Params: +function_type_name_at_Object: + # Allocate stack frame for function function_type_name_at_Object. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_type_name_at_Object_internal_0 --> -4($fp) + lw $t0, 0($s1) + sw $t0, -4($fp) + # RETURN local_type_name_at_Object_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_type_name_at_Object. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_concat_at_String implementation. +# @Params: +# 0($fp) = param_concat_at_String_s_0 +function_concat_at_String: + # Allocate stack frame for function function_concat_at_String. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_concat_at_String_internal_0 = self.CONCAT + # LOCAL local_concat_at_String_internal_0 --> -4($fp) + # PARAM param_concat_at_String_s_0 --> 0($fp) + # Get first string length from self + lw $t0, 16($s1) + # Get second string length from param + lw $v0, 0($fp) + lw $t1, 16($v0) + # Save new string length in a0 for memory allocation + addu $a0, $t0, $t1 + move $t3, $a0 + # Get first string from self + lw $t0, 12($s1) + # Get second string from param + lw $t1, 12($v0) + addu $a0, $a0, 4 + li $v0, 9 + syscall + move $t2, $v0 + move $t4, $zero + concat_loop1: + # Compare t0 with \0 + lb $t4, 0($t0) + beqz $t4, concat_loop1_end + # Copy 1 byte + sb $t4, 0($t2) + addu $t2, $t2, 1 + addu $t0, $t0, 1 + j concat_loop1 + concat_loop1_end: + # Copy second string + concat_loop2: + # Compare t1 with \0 + lb $t4, 0($t1) + beqz $t4, concat_loop2_end + # Copy 1 byte + sb $t4, 0($t2) + addu $t2, $t2, 1 + addu $t1, $t1, 1 + j concat_loop2 + concat_loop2_end: + sb $zero, 0($t2) + # v0 contains resulting string + move $t1, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + sw $t1, 12($v0) + sw $t3, 16($v0) + sw $v0, -4($fp) + # RETURN local_concat_at_String_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_concat_at_String. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_substr_at_String implementation. +# @Params: +# 0($fp) = param_substr_at_String_l_0 +# 4($fp) = param_substr_at_String_r_1 +function_substr_at_String: + # Allocate stack frame for function function_substr_at_String. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_substr_at_String_internal_0 --> -4($fp) + # PARAM param_substr_at_String_l_0 --> 4($fp) + # PARAM param_substr_at_String_r_1 --> 0($fp) + lw $t0, 12($s1) + lw $t2, 4($fp) + lw $t2, 12($t2) + addu $t0, $t0, $t2 + lw $a0, 0($fp) + lw $a0, 12($a0) + move $t3, $a0 + move $t1, $a0 + addu $a0, $a0, 1 + li $v0, 9 + syscall + move $t2, $v0 + substr_loop: + beqz $t1, substr_end + lb $a0, 0($t0) + sb $a0, 0($t2) + addu $t0, $t0, 1 + addu $t2, $t2, 1 + subu $t1, $t1, 1 + j substr_loop + substr_end: + sb $zero, 0($t2) + move $t1, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + sw $t1, 12($v0) + sw $t3, 16($v0) + sw $v0, -4($fp) + # RETURN local_substr_at_String_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_substr_at_String. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 8 + jr $ra + # Function END + + +# function_length_at_String implementation. +# @Params: +function_length_at_String: + # Allocate stack frame for function function_length_at_String. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_length_at_String_internal_0 = GETATTRIBUTE length String + # LOCAL local_length_at_String_internal_0 --> -4($fp) + lw $t0, 16($s1) + sw $t0, -4($fp) + # LOCAL local_length_at_String_internal_1 --> -8($fp) + # LOCAL local_length_at_String_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + lw $t0, -4($fp) + sw $t0, 12($v0) + sw $v0, -8($fp) + # RETURN local_length_at_String_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function function_length_at_String. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# entry implementation. +# @Params: +entry: + # Allocate stack frame for function entry. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local__internal_0 --> -4($fp) + # local__internal_0 = ALLOCATE Main + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Main + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 12 bytes of memory + li $a0, 12 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Main_start + sw $t0, 4($v0) + # Load type offset + li $t0, 24 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -4($fp) + # LOCAL local__internal_0 --> -4($fp) + lw $s1, -4($fp) + # local__internal_1 = CALL main + # LOCAL local__internal_1 --> -8($fp) + # LOCAL local__internal_0 --> -4($fp) + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type's VTABLE + la $t0, Main_vtable + # Get pointer to function address + lw $t1, 16($t0) + # Call function. Result is on $v0 + jalr $t1 + sw $v0, -8($fp) + # RETURN 0 + li $v0, 0 + # Deallocate stack frame for function entry. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# __Complex__attrib__x__init implementation. +# @Params: +__Complex__attrib__x__init: + # Allocate stack frame for function __Complex__attrib__x__init. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local___attrib__x__init_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -4($fp) + # RETURN local___attrib__x__init_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function __Complex__attrib__x__init. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# __Complex__attrib__y__init implementation. +# @Params: +__Complex__attrib__y__init: + # Allocate stack frame for function __Complex__attrib__y__init. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local___attrib__y__init_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -4($fp) + # RETURN local___attrib__y__init_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function __Complex__attrib__y__init. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_init_at_Complex implementation. +# @Params: +# 0($fp) = param_init_at_Complex_a_0 +# 4($fp) = param_init_at_Complex_b_1 +function_init_at_Complex: + # Allocate stack frame for function function_init_at_Complex. + subu $sp, $sp, 36 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 36 + # local_init_at_Complex_internal_2 = GETATTRIBUTE x Complex + # LOCAL local_init_at_Complex_internal_2 --> -12($fp) + lw $t0, 12($s1) + sw $t0, -12($fp) + # IF_ZERO local_init_at_Complex_internal_2 GOTO label_FALSE_1 + # IF_ZERO local_init_at_Complex_internal_2 GOTO label_FALSE_1 + lw $t0, -12($fp) + beq $t0, 0, label_FALSE_1 + # IF_ZERO param_init_at_Complex_a_0 GOTO label_FALSE_1 + # IF_ZERO param_init_at_Complex_a_0 GOTO label_FALSE_1 + lw $t0, 4($fp) + beq $t0, 0, label_FALSE_1 + # LOCAL local_init_at_Complex_internal_1 --> -8($fp) + # LOCAL local_init_at_Complex_internal_2 --> -12($fp) + # Comparing -12($fp) type with String + la $v0, String + lw $a0, -12($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -8($fp) + # IF_ZERO local_init_at_Complex_internal_1 GOTO label_COMPARE_STRING_4 + # IF_ZERO local_init_at_Complex_internal_1 GOTO label_COMPARE_STRING_4 + lw $t0, -8($fp) + beq $t0, 0, label_COMPARE_STRING_4 + # LOCAL local_init_at_Complex_internal_1 --> -8($fp) + # LOCAL local_init_at_Complex_internal_2 --> -12($fp) + # Comparing -12($fp) type with Bool + la $v0, Bool + lw $a0, -12($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -8($fp) + # IF_ZERO local_init_at_Complex_internal_1 GOTO label_COMPARE_BY_VALUE_5 + # IF_ZERO local_init_at_Complex_internal_1 GOTO label_COMPARE_BY_VALUE_5 + lw $t0, -8($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_5 + # LOCAL local_init_at_Complex_internal_1 --> -8($fp) + # LOCAL local_init_at_Complex_internal_2 --> -12($fp) + # Comparing -12($fp) type with Int + la $v0, Int + lw $a0, -12($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -8($fp) + # IF_ZERO local_init_at_Complex_internal_1 GOTO label_COMPARE_BY_VALUE_5 + # IF_ZERO local_init_at_Complex_internal_1 GOTO label_COMPARE_BY_VALUE_5 + lw $t0, -8($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_5 + # LOCAL local_init_at_Complex_internal_1 --> -8($fp) + # LOCAL local_init_at_Complex_internal_2 --> -12($fp) + # PARAM param_init_at_Complex_a_0 --> 4($fp) + # Load pointers and SUB + lw $a0, -12($fp) + lw $a1, 4($fp) + sub $a0, $a0, $a1 + sw $a0, -8($fp) + # IF_ZERO local_init_at_Complex_internal_1 GOTO label_TRUE_2 + # IF_ZERO local_init_at_Complex_internal_1 GOTO label_TRUE_2 + lw $t0, -8($fp) + beq $t0, 0, label_TRUE_2 + # GOTO label_FALSE_1 + j label_FALSE_1 + label_COMPARE_BY_VALUE_5: + # LOCAL local_init_at_Complex_internal_1 --> -8($fp) + # LOCAL local_init_at_Complex_internal_2 --> -12($fp) + # PARAM param_init_at_Complex_a_0 --> 4($fp) + lw $a0, -12($fp) + lw $a1, 4($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -8($fp) + # IF_ZERO local_init_at_Complex_internal_1 GOTO label_TRUE_2 + # IF_ZERO local_init_at_Complex_internal_1 GOTO label_TRUE_2 + lw $t0, -8($fp) + beq $t0, 0, label_TRUE_2 + # GOTO label_FALSE_1 + j label_FALSE_1 + label_COMPARE_STRING_4: + # LOCAL local_init_at_Complex_internal_1 --> -8($fp) + # LOCAL local_init_at_Complex_internal_2 --> -12($fp) + # PARAM param_init_at_Complex_a_0 --> 4($fp) + # Load strings for comparison + lw $v0, -12($fp) + lw $v1, 4($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -8($fp) + # IF_ZERO local_init_at_Complex_internal_1 GOTO label_CONTINUE_6 + # IF_ZERO local_init_at_Complex_internal_1 GOTO label_CONTINUE_6 + lw $t0, -8($fp) + beq $t0, 0, label_CONTINUE_6 + # GOTO label_FALSE_1 + j label_FALSE_1 + label_CONTINUE_6: + # LOCAL local_init_at_Complex_internal_1 --> -8($fp) + # LOCAL local_init_at_Complex_internal_2 --> -12($fp) + # PARAM param_init_at_Complex_a_0 --> 4($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -12($fp) + lw $v1, 4($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_7: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_8 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_7 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_8: + # Store result + sw $a2, -8($fp) + # IF_ZERO local_init_at_Complex_internal_1 GOTO label_TRUE_2 + # IF_ZERO local_init_at_Complex_internal_1 GOTO label_TRUE_2 + lw $t0, -8($fp) + beq $t0, 0, label_TRUE_2 + label_FALSE_1: + # LOCAL local_init_at_Complex_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -4($fp) + # GOTO label_END_3 +j label_END_3 +label_TRUE_2: + # LOCAL local_init_at_Complex_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -4($fp) + label_END_3: +# local_init_at_Complex_internal_5 = GETATTRIBUTE y Complex +# LOCAL local_init_at_Complex_internal_5 --> -24($fp) +lw $t0, 16($s1) +sw $t0, -24($fp) +# IF_ZERO local_init_at_Complex_internal_5 GOTO label_FALSE_9 +# IF_ZERO local_init_at_Complex_internal_5 GOTO label_FALSE_9 +lw $t0, -24($fp) +beq $t0, 0, label_FALSE_9 +# IF_ZERO param_init_at_Complex_b_1 GOTO label_FALSE_9 +# IF_ZERO param_init_at_Complex_b_1 GOTO label_FALSE_9 +lw $t0, 0($fp) +beq $t0, 0, label_FALSE_9 +# LOCAL local_init_at_Complex_internal_4 --> -20($fp) +# LOCAL local_init_at_Complex_internal_5 --> -24($fp) +# Comparing -24($fp) type with String +la $v0, String +lw $a0, -24($fp) +lw $a0, 0($a0) +sub $a0, $a0, $v0 +sw $a0, -20($fp) +# IF_ZERO local_init_at_Complex_internal_4 GOTO label_COMPARE_STRING_12 +# IF_ZERO local_init_at_Complex_internal_4 GOTO label_COMPARE_STRING_12 +lw $t0, -20($fp) +beq $t0, 0, label_COMPARE_STRING_12 +# LOCAL local_init_at_Complex_internal_4 --> -20($fp) +# LOCAL local_init_at_Complex_internal_5 --> -24($fp) +# Comparing -24($fp) type with Bool +la $v0, Bool +lw $a0, -24($fp) +lw $a0, 0($a0) +lw $a0, 12($a0) +sub $a0, $a0, $v0 +sw $a0, -20($fp) +# IF_ZERO local_init_at_Complex_internal_4 GOTO label_COMPARE_BY_VALUE_13 +# IF_ZERO local_init_at_Complex_internal_4 GOTO label_COMPARE_BY_VALUE_13 +lw $t0, -20($fp) +beq $t0, 0, label_COMPARE_BY_VALUE_13 +# LOCAL local_init_at_Complex_internal_4 --> -20($fp) +# LOCAL local_init_at_Complex_internal_5 --> -24($fp) +# Comparing -24($fp) type with Int +la $v0, Int +lw $a0, -24($fp) +lw $a0, 0($a0) +lw $a0, 12($a0) +sub $a0, $a0, $v0 +sw $a0, -20($fp) +# IF_ZERO local_init_at_Complex_internal_4 GOTO label_COMPARE_BY_VALUE_13 +# IF_ZERO local_init_at_Complex_internal_4 GOTO label_COMPARE_BY_VALUE_13 +lw $t0, -20($fp) +beq $t0, 0, label_COMPARE_BY_VALUE_13 +# LOCAL local_init_at_Complex_internal_4 --> -20($fp) +# LOCAL local_init_at_Complex_internal_5 --> -24($fp) +# PARAM param_init_at_Complex_b_1 --> 0($fp) +# Load pointers and SUB +lw $a0, -24($fp) +lw $a1, 0($fp) +sub $a0, $a0, $a1 +sw $a0, -20($fp) +# IF_ZERO local_init_at_Complex_internal_4 GOTO label_TRUE_10 +# IF_ZERO local_init_at_Complex_internal_4 GOTO label_TRUE_10 +lw $t0, -20($fp) +beq $t0, 0, label_TRUE_10 +# GOTO label_FALSE_9 +j label_FALSE_9 +label_COMPARE_BY_VALUE_13: + # LOCAL local_init_at_Complex_internal_4 --> -20($fp) + # LOCAL local_init_at_Complex_internal_5 --> -24($fp) + # PARAM param_init_at_Complex_b_1 --> 0($fp) + lw $a0, -24($fp) + lw $a1, 0($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -20($fp) + # IF_ZERO local_init_at_Complex_internal_4 GOTO label_TRUE_10 + # IF_ZERO local_init_at_Complex_internal_4 GOTO label_TRUE_10 + lw $t0, -20($fp) + beq $t0, 0, label_TRUE_10 + # GOTO label_FALSE_9 + j label_FALSE_9 + label_COMPARE_STRING_12: + # LOCAL local_init_at_Complex_internal_4 --> -20($fp) + # LOCAL local_init_at_Complex_internal_5 --> -24($fp) + # PARAM param_init_at_Complex_b_1 --> 0($fp) + # Load strings for comparison + lw $v0, -24($fp) + lw $v1, 0($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -20($fp) + # IF_ZERO local_init_at_Complex_internal_4 GOTO label_CONTINUE_14 + # IF_ZERO local_init_at_Complex_internal_4 GOTO label_CONTINUE_14 + lw $t0, -20($fp) + beq $t0, 0, label_CONTINUE_14 + # GOTO label_FALSE_9 + j label_FALSE_9 + label_CONTINUE_14: + # LOCAL local_init_at_Complex_internal_4 --> -20($fp) + # LOCAL local_init_at_Complex_internal_5 --> -24($fp) + # PARAM param_init_at_Complex_b_1 --> 0($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -24($fp) + lw $v1, 0($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_15: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_16 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_15 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_16: + # Store result + sw $a2, -20($fp) + # IF_ZERO local_init_at_Complex_internal_4 GOTO label_TRUE_10 + # IF_ZERO local_init_at_Complex_internal_4 GOTO label_TRUE_10 + lw $t0, -20($fp) + beq $t0, 0, label_TRUE_10 + label_FALSE_9: + # LOCAL local_init_at_Complex_internal_3 --> -16($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -16($fp) + # GOTO label_END_11 +j label_END_11 +label_TRUE_10: + # LOCAL local_init_at_Complex_internal_3 --> -16($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -16($fp) + label_END_11: +# LOCAL local_init_at_Complex_internal_6 --> -28($fp) +# local_init_at_Complex_internal_6 = SELF +sw $s1, -28($fp) +# RETURN local_init_at_Complex_internal_6 +lw $v0, -28($fp) +# Deallocate stack frame for function function_init_at_Complex. +# Restore $ra +lw $ra, 4($sp) +# Restore $fp +lw $fp, 0($sp) +# Restore Stack pointer $sp +addu $sp, $sp, 36 +# Deallocate function args +addu $sp, $sp, 8 +jr $ra +# Function END + + +# function_print_at_Complex implementation. +# @Params: +function_print_at_Complex: + # Allocate stack frame for function function_print_at_Complex. + subu $sp, $sp, 100 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 100 + # local_print_at_Complex_internal_4 = GETATTRIBUTE y Complex + # LOCAL local_print_at_Complex_internal_4 --> -20($fp) + lw $t0, 16($s1) + sw $t0, -20($fp) + # LOCAL local_print_at_Complex_internal_5 --> -24($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -24($fp) + # IF_ZERO local_print_at_Complex_internal_4 GOTO label_FALSE_19 + # IF_ZERO local_print_at_Complex_internal_4 GOTO label_FALSE_19 + lw $t0, -20($fp) + beq $t0, 0, label_FALSE_19 + # IF_ZERO local_print_at_Complex_internal_5 GOTO label_FALSE_19 + # IF_ZERO local_print_at_Complex_internal_5 GOTO label_FALSE_19 + lw $t0, -24($fp) + beq $t0, 0, label_FALSE_19 + # LOCAL local_print_at_Complex_internal_3 --> -16($fp) + # LOCAL local_print_at_Complex_internal_4 --> -20($fp) + # Comparing -20($fp) type with String + la $v0, String + lw $a0, -20($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -16($fp) + # IF_ZERO local_print_at_Complex_internal_3 GOTO label_COMPARE_STRING_22 + # IF_ZERO local_print_at_Complex_internal_3 GOTO label_COMPARE_STRING_22 + lw $t0, -16($fp) + beq $t0, 0, label_COMPARE_STRING_22 + # LOCAL local_print_at_Complex_internal_3 --> -16($fp) + # LOCAL local_print_at_Complex_internal_4 --> -20($fp) + # Comparing -20($fp) type with Bool + la $v0, Bool + lw $a0, -20($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -16($fp) + # IF_ZERO local_print_at_Complex_internal_3 GOTO label_COMPARE_BY_VALUE_23 + # IF_ZERO local_print_at_Complex_internal_3 GOTO label_COMPARE_BY_VALUE_23 + lw $t0, -16($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_23 + # LOCAL local_print_at_Complex_internal_3 --> -16($fp) + # LOCAL local_print_at_Complex_internal_4 --> -20($fp) + # Comparing -20($fp) type with Int + la $v0, Int + lw $a0, -20($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -16($fp) + # IF_ZERO local_print_at_Complex_internal_3 GOTO label_COMPARE_BY_VALUE_23 + # IF_ZERO local_print_at_Complex_internal_3 GOTO label_COMPARE_BY_VALUE_23 + lw $t0, -16($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_23 + # LOCAL local_print_at_Complex_internal_3 --> -16($fp) + # LOCAL local_print_at_Complex_internal_4 --> -20($fp) + # LOCAL local_print_at_Complex_internal_5 --> -24($fp) + # Load pointers and SUB + lw $a0, -20($fp) + lw $a1, -24($fp) + sub $a0, $a0, $a1 + sw $a0, -16($fp) + # IF_ZERO local_print_at_Complex_internal_3 GOTO label_TRUE_20 + # IF_ZERO local_print_at_Complex_internal_3 GOTO label_TRUE_20 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_20 + # GOTO label_FALSE_19 + j label_FALSE_19 + label_COMPARE_BY_VALUE_23: + # LOCAL local_print_at_Complex_internal_3 --> -16($fp) + # LOCAL local_print_at_Complex_internal_4 --> -20($fp) + # LOCAL local_print_at_Complex_internal_5 --> -24($fp) + lw $a0, -20($fp) + lw $a1, -24($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -16($fp) + # IF_ZERO local_print_at_Complex_internal_3 GOTO label_TRUE_20 + # IF_ZERO local_print_at_Complex_internal_3 GOTO label_TRUE_20 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_20 + # GOTO label_FALSE_19 + j label_FALSE_19 + label_COMPARE_STRING_22: + # LOCAL local_print_at_Complex_internal_3 --> -16($fp) + # LOCAL local_print_at_Complex_internal_4 --> -20($fp) + # LOCAL local_print_at_Complex_internal_5 --> -24($fp) + # Load strings for comparison + lw $v0, -20($fp) + lw $v1, -24($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -16($fp) + # IF_ZERO local_print_at_Complex_internal_3 GOTO label_CONTINUE_24 + # IF_ZERO local_print_at_Complex_internal_3 GOTO label_CONTINUE_24 + lw $t0, -16($fp) + beq $t0, 0, label_CONTINUE_24 + # GOTO label_FALSE_19 + j label_FALSE_19 + label_CONTINUE_24: + # LOCAL local_print_at_Complex_internal_3 --> -16($fp) + # LOCAL local_print_at_Complex_internal_4 --> -20($fp) + # LOCAL local_print_at_Complex_internal_5 --> -24($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -20($fp) + lw $v1, -24($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_25: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_26 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_25 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_26: + # Store result + sw $a2, -16($fp) + # IF_ZERO local_print_at_Complex_internal_3 GOTO label_TRUE_20 + # IF_ZERO local_print_at_Complex_internal_3 GOTO label_TRUE_20 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_20 + label_FALSE_19: + # LOCAL local_print_at_Complex_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -12($fp) + # GOTO label_END_21 +j label_END_21 +label_TRUE_20: + # LOCAL local_print_at_Complex_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -12($fp) + label_END_21: +# LOCAL local_print_at_Complex_internal_0 --> -4($fp) +# LOCAL local_print_at_Complex_internal_2 --> -12($fp) +# Obtain value from -12($fp) +lw $v0, -12($fp) +lw $v0, 12($v0) +sw $v0, -4($fp) +# IF_ZERO local_print_at_Complex_internal_0 GOTO label_FALSEIF_17 +# IF_ZERO local_print_at_Complex_internal_0 GOTO label_FALSEIF_17 +lw $t0, -4($fp) +beq $t0, 0, label_FALSEIF_17 +# LOCAL local_print_at_Complex_internal_8 --> -36($fp) +# local_print_at_Complex_internal_8 = SELF +sw $s1, -36($fp) +# LOCAL local_print_at_Complex_internal_6 --> -28($fp) +# LOCAL local_print_at_Complex_internal_8 --> -36($fp) +# local_print_at_Complex_internal_6 = local_print_at_Complex_internal_8 +lw $t0, -36($fp) +sw $t0, -28($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# local_print_at_Complex_internal_9 = GETATTRIBUTE x Complex +# LOCAL local_print_at_Complex_internal_9 --> -40($fp) +lw $t0, 12($s1) +sw $t0, -40($fp) +# ARG local_print_at_Complex_internal_9 +# LOCAL local_print_at_Complex_internal_9 --> -40($fp) +lw $t0, -40($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_print_at_Complex_internal_6 --> -28($fp) +# LOCAL local_print_at_Complex_internal_7 --> -32($fp) +# local_print_at_Complex_internal_7 = VCALL local_print_at_Complex_internal_6 out_int +# Save new self pointer in $s1 +lw $s1, -28($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 56($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -32($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_print_at_Complex_internal_1 --> -8($fp) +# LOCAL local_print_at_Complex_internal_7 --> -32($fp) +# local_print_at_Complex_internal_1 = local_print_at_Complex_internal_7 +lw $t0, -32($fp) +sw $t0, -8($fp) +# GOTO label_ENDIF_18 +j label_ENDIF_18 +label_FALSEIF_17: + # LOCAL local_print_at_Complex_internal_18 --> -76($fp) + # local_print_at_Complex_internal_18 = SELF + sw $s1, -76($fp) + # LOCAL local_print_at_Complex_internal_16 --> -68($fp) + # LOCAL local_print_at_Complex_internal_18 --> -76($fp) + # local_print_at_Complex_internal_16 = local_print_at_Complex_internal_18 + lw $t0, -76($fp) + sw $t0, -68($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # local_print_at_Complex_internal_19 = GETATTRIBUTE x Complex + # LOCAL local_print_at_Complex_internal_19 --> -80($fp) + lw $t0, 12($s1) + sw $t0, -80($fp) + # ARG local_print_at_Complex_internal_19 + # LOCAL local_print_at_Complex_internal_19 --> -80($fp) + lw $t0, -80($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_print_at_Complex_internal_16 --> -68($fp) + # LOCAL local_print_at_Complex_internal_17 --> -72($fp) + # local_print_at_Complex_internal_17 = VCALL local_print_at_Complex_internal_16 out_int + # Save new self pointer in $s1 + lw $s1, -68($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 56($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -72($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_print_at_Complex_internal_14 --> -60($fp) + # LOCAL local_print_at_Complex_internal_17 --> -72($fp) + # local_print_at_Complex_internal_14 = local_print_at_Complex_internal_17 + lw $t0, -72($fp) + sw $t0, -60($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_print_at_Complex_internal_20 --> -84($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_4 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -84($fp) + # ARG local_print_at_Complex_internal_20 + # LOCAL local_print_at_Complex_internal_20 --> -84($fp) + lw $t0, -84($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_print_at_Complex_internal_14 --> -60($fp) + # LOCAL local_print_at_Complex_internal_15 --> -64($fp) + # local_print_at_Complex_internal_15 = VCALL local_print_at_Complex_internal_14 out_string + # Save new self pointer in $s1 + lw $s1, -60($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 4($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -64($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_print_at_Complex_internal_12 --> -52($fp) + # LOCAL local_print_at_Complex_internal_15 --> -64($fp) + # local_print_at_Complex_internal_12 = local_print_at_Complex_internal_15 + lw $t0, -64($fp) + sw $t0, -52($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # local_print_at_Complex_internal_21 = GETATTRIBUTE y Complex + # LOCAL local_print_at_Complex_internal_21 --> -88($fp) + lw $t0, 16($s1) + sw $t0, -88($fp) + # ARG local_print_at_Complex_internal_21 + # LOCAL local_print_at_Complex_internal_21 --> -88($fp) + lw $t0, -88($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_print_at_Complex_internal_12 --> -52($fp) + # LOCAL local_print_at_Complex_internal_13 --> -56($fp) + # local_print_at_Complex_internal_13 = VCALL local_print_at_Complex_internal_12 out_int + # Save new self pointer in $s1 + lw $s1, -52($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 56($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -56($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_print_at_Complex_internal_10 --> -44($fp) + # LOCAL local_print_at_Complex_internal_13 --> -56($fp) + # local_print_at_Complex_internal_10 = local_print_at_Complex_internal_13 + lw $t0, -56($fp) + sw $t0, -44($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_print_at_Complex_internal_22 --> -92($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_5 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -92($fp) + # ARG local_print_at_Complex_internal_22 + # LOCAL local_print_at_Complex_internal_22 --> -92($fp) + lw $t0, -92($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_print_at_Complex_internal_10 --> -44($fp) + # LOCAL local_print_at_Complex_internal_11 --> -48($fp) + # local_print_at_Complex_internal_11 = VCALL local_print_at_Complex_internal_10 out_string + # Save new self pointer in $s1 + lw $s1, -44($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 4($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -48($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_print_at_Complex_internal_1 --> -8($fp) + # LOCAL local_print_at_Complex_internal_11 --> -48($fp) + # local_print_at_Complex_internal_1 = local_print_at_Complex_internal_11 + lw $t0, -48($fp) + sw $t0, -8($fp) + label_ENDIF_18: +# RETURN local_print_at_Complex_internal_1 +lw $v0, -8($fp) +# Deallocate stack frame for function function_print_at_Complex. +# Restore $ra +lw $ra, 4($sp) +# Restore $fp +lw $fp, 0($sp) +# Restore Stack pointer $sp +addu $sp, $sp, 100 +jr $ra +# Function END + + +# function_reflect_0_at_Complex implementation. +# @Params: +function_reflect_0_at_Complex: + # Allocate stack frame for function function_reflect_0_at_Complex. + subu $sp, $sp, 52 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 52 + # local_reflect_0_at_Complex_internal_2 = GETATTRIBUTE x Complex + # LOCAL local_reflect_0_at_Complex_internal_2 --> -12($fp) + lw $t0, 12($s1) + sw $t0, -12($fp) + # local_reflect_0_at_Complex_internal_4 = GETATTRIBUTE x Complex + # LOCAL local_reflect_0_at_Complex_internal_4 --> -20($fp) + lw $t0, 12($s1) + sw $t0, -20($fp) + # LOCAL local_reflect_0_at_Complex_internal_3 --> -16($fp) + # LOCAL local_reflect_0_at_Complex_internal_4 --> -20($fp) + lw $t0, -20($fp) + lw $t0, 12($t0) + not $t0, $t0 + add $t0, $t0, 1 + sw $t0, -16($fp) + # LOCAL local_reflect_0_at_Complex_internal_3 --> -16($fp) + # LOCAL local_reflect_0_at_Complex_internal_3 --> -16($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + lw $t0, -16($fp) + sw $t0, 12($v0) + sw $v0, -16($fp) + # IF_ZERO local_reflect_0_at_Complex_internal_2 GOTO label_FALSE_27 + # IF_ZERO local_reflect_0_at_Complex_internal_2 GOTO label_FALSE_27 + lw $t0, -12($fp) + beq $t0, 0, label_FALSE_27 + # IF_ZERO local_reflect_0_at_Complex_internal_3 GOTO label_FALSE_27 + # IF_ZERO local_reflect_0_at_Complex_internal_3 GOTO label_FALSE_27 + lw $t0, -16($fp) + beq $t0, 0, label_FALSE_27 + # LOCAL local_reflect_0_at_Complex_internal_1 --> -8($fp) + # LOCAL local_reflect_0_at_Complex_internal_2 --> -12($fp) + # Comparing -12($fp) type with String + la $v0, String + lw $a0, -12($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -8($fp) + # IF_ZERO local_reflect_0_at_Complex_internal_1 GOTO label_COMPARE_STRING_30 + # IF_ZERO local_reflect_0_at_Complex_internal_1 GOTO label_COMPARE_STRING_30 + lw $t0, -8($fp) + beq $t0, 0, label_COMPARE_STRING_30 + # LOCAL local_reflect_0_at_Complex_internal_1 --> -8($fp) + # LOCAL local_reflect_0_at_Complex_internal_2 --> -12($fp) + # Comparing -12($fp) type with Bool + la $v0, Bool + lw $a0, -12($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -8($fp) + # IF_ZERO local_reflect_0_at_Complex_internal_1 GOTO label_COMPARE_BY_VALUE_31 + # IF_ZERO local_reflect_0_at_Complex_internal_1 GOTO label_COMPARE_BY_VALUE_31 + lw $t0, -8($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_31 + # LOCAL local_reflect_0_at_Complex_internal_1 --> -8($fp) + # LOCAL local_reflect_0_at_Complex_internal_2 --> -12($fp) + # Comparing -12($fp) type with Int + la $v0, Int + lw $a0, -12($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -8($fp) + # IF_ZERO local_reflect_0_at_Complex_internal_1 GOTO label_COMPARE_BY_VALUE_31 + # IF_ZERO local_reflect_0_at_Complex_internal_1 GOTO label_COMPARE_BY_VALUE_31 + lw $t0, -8($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_31 + # LOCAL local_reflect_0_at_Complex_internal_1 --> -8($fp) + # LOCAL local_reflect_0_at_Complex_internal_2 --> -12($fp) + # LOCAL local_reflect_0_at_Complex_internal_3 --> -16($fp) + # Load pointers and SUB + lw $a0, -12($fp) + lw $a1, -16($fp) + sub $a0, $a0, $a1 + sw $a0, -8($fp) + # IF_ZERO local_reflect_0_at_Complex_internal_1 GOTO label_TRUE_28 + # IF_ZERO local_reflect_0_at_Complex_internal_1 GOTO label_TRUE_28 + lw $t0, -8($fp) + beq $t0, 0, label_TRUE_28 + # GOTO label_FALSE_27 + j label_FALSE_27 + label_COMPARE_BY_VALUE_31: + # LOCAL local_reflect_0_at_Complex_internal_1 --> -8($fp) + # LOCAL local_reflect_0_at_Complex_internal_2 --> -12($fp) + # LOCAL local_reflect_0_at_Complex_internal_3 --> -16($fp) + lw $a0, -12($fp) + lw $a1, -16($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -8($fp) + # IF_ZERO local_reflect_0_at_Complex_internal_1 GOTO label_TRUE_28 + # IF_ZERO local_reflect_0_at_Complex_internal_1 GOTO label_TRUE_28 + lw $t0, -8($fp) + beq $t0, 0, label_TRUE_28 + # GOTO label_FALSE_27 + j label_FALSE_27 + label_COMPARE_STRING_30: + # LOCAL local_reflect_0_at_Complex_internal_1 --> -8($fp) + # LOCAL local_reflect_0_at_Complex_internal_2 --> -12($fp) + # LOCAL local_reflect_0_at_Complex_internal_3 --> -16($fp) + # Load strings for comparison + lw $v0, -12($fp) + lw $v1, -16($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -8($fp) + # IF_ZERO local_reflect_0_at_Complex_internal_1 GOTO label_CONTINUE_32 + # IF_ZERO local_reflect_0_at_Complex_internal_1 GOTO label_CONTINUE_32 + lw $t0, -8($fp) + beq $t0, 0, label_CONTINUE_32 + # GOTO label_FALSE_27 + j label_FALSE_27 + label_CONTINUE_32: + # LOCAL local_reflect_0_at_Complex_internal_1 --> -8($fp) + # LOCAL local_reflect_0_at_Complex_internal_2 --> -12($fp) + # LOCAL local_reflect_0_at_Complex_internal_3 --> -16($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -12($fp) + lw $v1, -16($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_33: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_34 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_33 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_34: + # Store result + sw $a2, -8($fp) + # IF_ZERO local_reflect_0_at_Complex_internal_1 GOTO label_TRUE_28 + # IF_ZERO local_reflect_0_at_Complex_internal_1 GOTO label_TRUE_28 + lw $t0, -8($fp) + beq $t0, 0, label_TRUE_28 + label_FALSE_27: + # LOCAL local_reflect_0_at_Complex_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -4($fp) + # GOTO label_END_29 +j label_END_29 +label_TRUE_28: + # LOCAL local_reflect_0_at_Complex_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -4($fp) + label_END_29: +# local_reflect_0_at_Complex_internal_7 = GETATTRIBUTE y Complex +# LOCAL local_reflect_0_at_Complex_internal_7 --> -32($fp) +lw $t0, 16($s1) +sw $t0, -32($fp) +# local_reflect_0_at_Complex_internal_9 = GETATTRIBUTE y Complex +# LOCAL local_reflect_0_at_Complex_internal_9 --> -40($fp) +lw $t0, 16($s1) +sw $t0, -40($fp) +# LOCAL local_reflect_0_at_Complex_internal_8 --> -36($fp) +# LOCAL local_reflect_0_at_Complex_internal_9 --> -40($fp) +lw $t0, -40($fp) +lw $t0, 12($t0) +not $t0, $t0 +add $t0, $t0, 1 +sw $t0, -36($fp) +# LOCAL local_reflect_0_at_Complex_internal_8 --> -36($fp) +# LOCAL local_reflect_0_at_Complex_internal_8 --> -36($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +lw $t0, -36($fp) +sw $t0, 12($v0) +sw $v0, -36($fp) +# IF_ZERO local_reflect_0_at_Complex_internal_7 GOTO label_FALSE_35 +# IF_ZERO local_reflect_0_at_Complex_internal_7 GOTO label_FALSE_35 +lw $t0, -32($fp) +beq $t0, 0, label_FALSE_35 +# IF_ZERO local_reflect_0_at_Complex_internal_8 GOTO label_FALSE_35 +# IF_ZERO local_reflect_0_at_Complex_internal_8 GOTO label_FALSE_35 +lw $t0, -36($fp) +beq $t0, 0, label_FALSE_35 +# LOCAL local_reflect_0_at_Complex_internal_6 --> -28($fp) +# LOCAL local_reflect_0_at_Complex_internal_7 --> -32($fp) +# Comparing -32($fp) type with String +la $v0, String +lw $a0, -32($fp) +lw $a0, 0($a0) +sub $a0, $a0, $v0 +sw $a0, -28($fp) +# IF_ZERO local_reflect_0_at_Complex_internal_6 GOTO label_COMPARE_STRING_38 +# IF_ZERO local_reflect_0_at_Complex_internal_6 GOTO label_COMPARE_STRING_38 +lw $t0, -28($fp) +beq $t0, 0, label_COMPARE_STRING_38 +# LOCAL local_reflect_0_at_Complex_internal_6 --> -28($fp) +# LOCAL local_reflect_0_at_Complex_internal_7 --> -32($fp) +# Comparing -32($fp) type with Bool +la $v0, Bool +lw $a0, -32($fp) +lw $a0, 0($a0) +lw $a0, 12($a0) +sub $a0, $a0, $v0 +sw $a0, -28($fp) +# IF_ZERO local_reflect_0_at_Complex_internal_6 GOTO label_COMPARE_BY_VALUE_39 +# IF_ZERO local_reflect_0_at_Complex_internal_6 GOTO label_COMPARE_BY_VALUE_39 +lw $t0, -28($fp) +beq $t0, 0, label_COMPARE_BY_VALUE_39 +# LOCAL local_reflect_0_at_Complex_internal_6 --> -28($fp) +# LOCAL local_reflect_0_at_Complex_internal_7 --> -32($fp) +# Comparing -32($fp) type with Int +la $v0, Int +lw $a0, -32($fp) +lw $a0, 0($a0) +lw $a0, 12($a0) +sub $a0, $a0, $v0 +sw $a0, -28($fp) +# IF_ZERO local_reflect_0_at_Complex_internal_6 GOTO label_COMPARE_BY_VALUE_39 +# IF_ZERO local_reflect_0_at_Complex_internal_6 GOTO label_COMPARE_BY_VALUE_39 +lw $t0, -28($fp) +beq $t0, 0, label_COMPARE_BY_VALUE_39 +# LOCAL local_reflect_0_at_Complex_internal_6 --> -28($fp) +# LOCAL local_reflect_0_at_Complex_internal_7 --> -32($fp) +# LOCAL local_reflect_0_at_Complex_internal_8 --> -36($fp) +# Load pointers and SUB +lw $a0, -32($fp) +lw $a1, -36($fp) +sub $a0, $a0, $a1 +sw $a0, -28($fp) +# IF_ZERO local_reflect_0_at_Complex_internal_6 GOTO label_TRUE_36 +# IF_ZERO local_reflect_0_at_Complex_internal_6 GOTO label_TRUE_36 +lw $t0, -28($fp) +beq $t0, 0, label_TRUE_36 +# GOTO label_FALSE_35 +j label_FALSE_35 +label_COMPARE_BY_VALUE_39: + # LOCAL local_reflect_0_at_Complex_internal_6 --> -28($fp) + # LOCAL local_reflect_0_at_Complex_internal_7 --> -32($fp) + # LOCAL local_reflect_0_at_Complex_internal_8 --> -36($fp) + lw $a0, -32($fp) + lw $a1, -36($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -28($fp) + # IF_ZERO local_reflect_0_at_Complex_internal_6 GOTO label_TRUE_36 + # IF_ZERO local_reflect_0_at_Complex_internal_6 GOTO label_TRUE_36 + lw $t0, -28($fp) + beq $t0, 0, label_TRUE_36 + # GOTO label_FALSE_35 + j label_FALSE_35 + label_COMPARE_STRING_38: + # LOCAL local_reflect_0_at_Complex_internal_6 --> -28($fp) + # LOCAL local_reflect_0_at_Complex_internal_7 --> -32($fp) + # LOCAL local_reflect_0_at_Complex_internal_8 --> -36($fp) + # Load strings for comparison + lw $v0, -32($fp) + lw $v1, -36($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -28($fp) + # IF_ZERO local_reflect_0_at_Complex_internal_6 GOTO label_CONTINUE_40 + # IF_ZERO local_reflect_0_at_Complex_internal_6 GOTO label_CONTINUE_40 + lw $t0, -28($fp) + beq $t0, 0, label_CONTINUE_40 + # GOTO label_FALSE_35 + j label_FALSE_35 + label_CONTINUE_40: + # LOCAL local_reflect_0_at_Complex_internal_6 --> -28($fp) + # LOCAL local_reflect_0_at_Complex_internal_7 --> -32($fp) + # LOCAL local_reflect_0_at_Complex_internal_8 --> -36($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -32($fp) + lw $v1, -36($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_41: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_42 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_41 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_42: + # Store result + sw $a2, -28($fp) + # IF_ZERO local_reflect_0_at_Complex_internal_6 GOTO label_TRUE_36 + # IF_ZERO local_reflect_0_at_Complex_internal_6 GOTO label_TRUE_36 + lw $t0, -28($fp) + beq $t0, 0, label_TRUE_36 + label_FALSE_35: + # LOCAL local_reflect_0_at_Complex_internal_5 --> -24($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -24($fp) + # GOTO label_END_37 +j label_END_37 +label_TRUE_36: + # LOCAL local_reflect_0_at_Complex_internal_5 --> -24($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -24($fp) + label_END_37: +# LOCAL local_reflect_0_at_Complex_internal_10 --> -44($fp) +# local_reflect_0_at_Complex_internal_10 = SELF +sw $s1, -44($fp) +# RETURN local_reflect_0_at_Complex_internal_10 +lw $v0, -44($fp) +# Deallocate stack frame for function function_reflect_0_at_Complex. +# Restore $ra +lw $ra, 4($sp) +# Restore $fp +lw $fp, 0($sp) +# Restore Stack pointer $sp +addu $sp, $sp, 52 +jr $ra +# Function END + + +# function_reflect_X_at_Complex implementation. +# @Params: +function_reflect_X_at_Complex: + # Allocate stack frame for function function_reflect_X_at_Complex. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_reflect_X_at_Complex_internal_2 = GETATTRIBUTE y Complex + # LOCAL local_reflect_X_at_Complex_internal_2 --> -12($fp) + lw $t0, 16($s1) + sw $t0, -12($fp) + # local_reflect_X_at_Complex_internal_4 = GETATTRIBUTE y Complex + # LOCAL local_reflect_X_at_Complex_internal_4 --> -20($fp) + lw $t0, 16($s1) + sw $t0, -20($fp) + # LOCAL local_reflect_X_at_Complex_internal_3 --> -16($fp) + # LOCAL local_reflect_X_at_Complex_internal_4 --> -20($fp) + lw $t0, -20($fp) + lw $t0, 12($t0) + not $t0, $t0 + add $t0, $t0, 1 + sw $t0, -16($fp) + # LOCAL local_reflect_X_at_Complex_internal_3 --> -16($fp) + # LOCAL local_reflect_X_at_Complex_internal_3 --> -16($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + lw $t0, -16($fp) + sw $t0, 12($v0) + sw $v0, -16($fp) + # IF_ZERO local_reflect_X_at_Complex_internal_2 GOTO label_FALSE_43 + # IF_ZERO local_reflect_X_at_Complex_internal_2 GOTO label_FALSE_43 + lw $t0, -12($fp) + beq $t0, 0, label_FALSE_43 + # IF_ZERO local_reflect_X_at_Complex_internal_3 GOTO label_FALSE_43 + # IF_ZERO local_reflect_X_at_Complex_internal_3 GOTO label_FALSE_43 + lw $t0, -16($fp) + beq $t0, 0, label_FALSE_43 + # LOCAL local_reflect_X_at_Complex_internal_1 --> -8($fp) + # LOCAL local_reflect_X_at_Complex_internal_2 --> -12($fp) + # Comparing -12($fp) type with String + la $v0, String + lw $a0, -12($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -8($fp) + # IF_ZERO local_reflect_X_at_Complex_internal_1 GOTO label_COMPARE_STRING_46 + # IF_ZERO local_reflect_X_at_Complex_internal_1 GOTO label_COMPARE_STRING_46 + lw $t0, -8($fp) + beq $t0, 0, label_COMPARE_STRING_46 + # LOCAL local_reflect_X_at_Complex_internal_1 --> -8($fp) + # LOCAL local_reflect_X_at_Complex_internal_2 --> -12($fp) + # Comparing -12($fp) type with Bool + la $v0, Bool + lw $a0, -12($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -8($fp) + # IF_ZERO local_reflect_X_at_Complex_internal_1 GOTO label_COMPARE_BY_VALUE_47 + # IF_ZERO local_reflect_X_at_Complex_internal_1 GOTO label_COMPARE_BY_VALUE_47 + lw $t0, -8($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_47 + # LOCAL local_reflect_X_at_Complex_internal_1 --> -8($fp) + # LOCAL local_reflect_X_at_Complex_internal_2 --> -12($fp) + # Comparing -12($fp) type with Int + la $v0, Int + lw $a0, -12($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -8($fp) + # IF_ZERO local_reflect_X_at_Complex_internal_1 GOTO label_COMPARE_BY_VALUE_47 + # IF_ZERO local_reflect_X_at_Complex_internal_1 GOTO label_COMPARE_BY_VALUE_47 + lw $t0, -8($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_47 + # LOCAL local_reflect_X_at_Complex_internal_1 --> -8($fp) + # LOCAL local_reflect_X_at_Complex_internal_2 --> -12($fp) + # LOCAL local_reflect_X_at_Complex_internal_3 --> -16($fp) + # Load pointers and SUB + lw $a0, -12($fp) + lw $a1, -16($fp) + sub $a0, $a0, $a1 + sw $a0, -8($fp) + # IF_ZERO local_reflect_X_at_Complex_internal_1 GOTO label_TRUE_44 + # IF_ZERO local_reflect_X_at_Complex_internal_1 GOTO label_TRUE_44 + lw $t0, -8($fp) + beq $t0, 0, label_TRUE_44 + # GOTO label_FALSE_43 + j label_FALSE_43 + label_COMPARE_BY_VALUE_47: + # LOCAL local_reflect_X_at_Complex_internal_1 --> -8($fp) + # LOCAL local_reflect_X_at_Complex_internal_2 --> -12($fp) + # LOCAL local_reflect_X_at_Complex_internal_3 --> -16($fp) + lw $a0, -12($fp) + lw $a1, -16($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -8($fp) + # IF_ZERO local_reflect_X_at_Complex_internal_1 GOTO label_TRUE_44 + # IF_ZERO local_reflect_X_at_Complex_internal_1 GOTO label_TRUE_44 + lw $t0, -8($fp) + beq $t0, 0, label_TRUE_44 + # GOTO label_FALSE_43 + j label_FALSE_43 + label_COMPARE_STRING_46: + # LOCAL local_reflect_X_at_Complex_internal_1 --> -8($fp) + # LOCAL local_reflect_X_at_Complex_internal_2 --> -12($fp) + # LOCAL local_reflect_X_at_Complex_internal_3 --> -16($fp) + # Load strings for comparison + lw $v0, -12($fp) + lw $v1, -16($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -8($fp) + # IF_ZERO local_reflect_X_at_Complex_internal_1 GOTO label_CONTINUE_48 + # IF_ZERO local_reflect_X_at_Complex_internal_1 GOTO label_CONTINUE_48 + lw $t0, -8($fp) + beq $t0, 0, label_CONTINUE_48 + # GOTO label_FALSE_43 + j label_FALSE_43 + label_CONTINUE_48: + # LOCAL local_reflect_X_at_Complex_internal_1 --> -8($fp) + # LOCAL local_reflect_X_at_Complex_internal_2 --> -12($fp) + # LOCAL local_reflect_X_at_Complex_internal_3 --> -16($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -12($fp) + lw $v1, -16($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_49: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_50 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_49 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_50: + # Store result + sw $a2, -8($fp) + # IF_ZERO local_reflect_X_at_Complex_internal_1 GOTO label_TRUE_44 + # IF_ZERO local_reflect_X_at_Complex_internal_1 GOTO label_TRUE_44 + lw $t0, -8($fp) + beq $t0, 0, label_TRUE_44 + label_FALSE_43: + # LOCAL local_reflect_X_at_Complex_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -4($fp) + # GOTO label_END_45 +j label_END_45 +label_TRUE_44: + # LOCAL local_reflect_X_at_Complex_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -4($fp) + label_END_45: +# LOCAL local_reflect_X_at_Complex_internal_5 --> -24($fp) +# local_reflect_X_at_Complex_internal_5 = SELF +sw $s1, -24($fp) +# RETURN local_reflect_X_at_Complex_internal_5 +lw $v0, -24($fp) +# Deallocate stack frame for function function_reflect_X_at_Complex. +# Restore $ra +lw $ra, 4($sp) +# Restore $fp +lw $fp, 0($sp) +# Restore Stack pointer $sp +addu $sp, $sp, 32 +jr $ra +# Function END + + +# function_reflect_Y_at_Complex implementation. +# @Params: +function_reflect_Y_at_Complex: + # Allocate stack frame for function function_reflect_Y_at_Complex. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_reflect_Y_at_Complex_internal_2 = GETATTRIBUTE x Complex + # LOCAL local_reflect_Y_at_Complex_internal_2 --> -12($fp) + lw $t0, 12($s1) + sw $t0, -12($fp) + # local_reflect_Y_at_Complex_internal_4 = GETATTRIBUTE x Complex + # LOCAL local_reflect_Y_at_Complex_internal_4 --> -20($fp) + lw $t0, 12($s1) + sw $t0, -20($fp) + # LOCAL local_reflect_Y_at_Complex_internal_3 --> -16($fp) + # LOCAL local_reflect_Y_at_Complex_internal_4 --> -20($fp) + lw $t0, -20($fp) + lw $t0, 12($t0) + not $t0, $t0 + add $t0, $t0, 1 + sw $t0, -16($fp) + # LOCAL local_reflect_Y_at_Complex_internal_3 --> -16($fp) + # LOCAL local_reflect_Y_at_Complex_internal_3 --> -16($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + lw $t0, -16($fp) + sw $t0, 12($v0) + sw $v0, -16($fp) + # IF_ZERO local_reflect_Y_at_Complex_internal_2 GOTO label_FALSE_51 + # IF_ZERO local_reflect_Y_at_Complex_internal_2 GOTO label_FALSE_51 + lw $t0, -12($fp) + beq $t0, 0, label_FALSE_51 + # IF_ZERO local_reflect_Y_at_Complex_internal_3 GOTO label_FALSE_51 + # IF_ZERO local_reflect_Y_at_Complex_internal_3 GOTO label_FALSE_51 + lw $t0, -16($fp) + beq $t0, 0, label_FALSE_51 + # LOCAL local_reflect_Y_at_Complex_internal_1 --> -8($fp) + # LOCAL local_reflect_Y_at_Complex_internal_2 --> -12($fp) + # Comparing -12($fp) type with String + la $v0, String + lw $a0, -12($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -8($fp) + # IF_ZERO local_reflect_Y_at_Complex_internal_1 GOTO label_COMPARE_STRING_54 + # IF_ZERO local_reflect_Y_at_Complex_internal_1 GOTO label_COMPARE_STRING_54 + lw $t0, -8($fp) + beq $t0, 0, label_COMPARE_STRING_54 + # LOCAL local_reflect_Y_at_Complex_internal_1 --> -8($fp) + # LOCAL local_reflect_Y_at_Complex_internal_2 --> -12($fp) + # Comparing -12($fp) type with Bool + la $v0, Bool + lw $a0, -12($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -8($fp) + # IF_ZERO local_reflect_Y_at_Complex_internal_1 GOTO label_COMPARE_BY_VALUE_55 + # IF_ZERO local_reflect_Y_at_Complex_internal_1 GOTO label_COMPARE_BY_VALUE_55 + lw $t0, -8($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_55 + # LOCAL local_reflect_Y_at_Complex_internal_1 --> -8($fp) + # LOCAL local_reflect_Y_at_Complex_internal_2 --> -12($fp) + # Comparing -12($fp) type with Int + la $v0, Int + lw $a0, -12($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -8($fp) + # IF_ZERO local_reflect_Y_at_Complex_internal_1 GOTO label_COMPARE_BY_VALUE_55 + # IF_ZERO local_reflect_Y_at_Complex_internal_1 GOTO label_COMPARE_BY_VALUE_55 + lw $t0, -8($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_55 + # LOCAL local_reflect_Y_at_Complex_internal_1 --> -8($fp) + # LOCAL local_reflect_Y_at_Complex_internal_2 --> -12($fp) + # LOCAL local_reflect_Y_at_Complex_internal_3 --> -16($fp) + # Load pointers and SUB + lw $a0, -12($fp) + lw $a1, -16($fp) + sub $a0, $a0, $a1 + sw $a0, -8($fp) + # IF_ZERO local_reflect_Y_at_Complex_internal_1 GOTO label_TRUE_52 + # IF_ZERO local_reflect_Y_at_Complex_internal_1 GOTO label_TRUE_52 + lw $t0, -8($fp) + beq $t0, 0, label_TRUE_52 + # GOTO label_FALSE_51 + j label_FALSE_51 + label_COMPARE_BY_VALUE_55: + # LOCAL local_reflect_Y_at_Complex_internal_1 --> -8($fp) + # LOCAL local_reflect_Y_at_Complex_internal_2 --> -12($fp) + # LOCAL local_reflect_Y_at_Complex_internal_3 --> -16($fp) + lw $a0, -12($fp) + lw $a1, -16($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -8($fp) + # IF_ZERO local_reflect_Y_at_Complex_internal_1 GOTO label_TRUE_52 + # IF_ZERO local_reflect_Y_at_Complex_internal_1 GOTO label_TRUE_52 + lw $t0, -8($fp) + beq $t0, 0, label_TRUE_52 + # GOTO label_FALSE_51 + j label_FALSE_51 + label_COMPARE_STRING_54: + # LOCAL local_reflect_Y_at_Complex_internal_1 --> -8($fp) + # LOCAL local_reflect_Y_at_Complex_internal_2 --> -12($fp) + # LOCAL local_reflect_Y_at_Complex_internal_3 --> -16($fp) + # Load strings for comparison + lw $v0, -12($fp) + lw $v1, -16($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -8($fp) + # IF_ZERO local_reflect_Y_at_Complex_internal_1 GOTO label_CONTINUE_56 + # IF_ZERO local_reflect_Y_at_Complex_internal_1 GOTO label_CONTINUE_56 + lw $t0, -8($fp) + beq $t0, 0, label_CONTINUE_56 + # GOTO label_FALSE_51 + j label_FALSE_51 + label_CONTINUE_56: + # LOCAL local_reflect_Y_at_Complex_internal_1 --> -8($fp) + # LOCAL local_reflect_Y_at_Complex_internal_2 --> -12($fp) + # LOCAL local_reflect_Y_at_Complex_internal_3 --> -16($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -12($fp) + lw $v1, -16($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_57: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_58 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_57 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_58: + # Store result + sw $a2, -8($fp) + # IF_ZERO local_reflect_Y_at_Complex_internal_1 GOTO label_TRUE_52 + # IF_ZERO local_reflect_Y_at_Complex_internal_1 GOTO label_TRUE_52 + lw $t0, -8($fp) + beq $t0, 0, label_TRUE_52 + label_FALSE_51: + # LOCAL local_reflect_Y_at_Complex_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -4($fp) + # GOTO label_END_53 +j label_END_53 +label_TRUE_52: + # LOCAL local_reflect_Y_at_Complex_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -4($fp) + label_END_53: +# LOCAL local_reflect_Y_at_Complex_internal_5 --> -24($fp) +# local_reflect_Y_at_Complex_internal_5 = SELF +sw $s1, -24($fp) +# RETURN local_reflect_Y_at_Complex_internal_5 +lw $v0, -24($fp) +# Deallocate stack frame for function function_reflect_Y_at_Complex. +# Restore $ra +lw $ra, 4($sp) +# Restore $fp +lw $fp, 0($sp) +# Restore Stack pointer $sp +addu $sp, $sp, 32 +jr $ra +# Function END + + +# function_main_at_Main implementation. +# @Params: +function_main_at_Main: + # Allocate stack frame for function function_main_at_Main. + subu $sp, $sp, 104 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 104 + # LOCAL local_main_at_Main_c_0 --> -4($fp) + # local_main_at_Main_c_0 = 0 + li $t0, 0 + sw $t0, -4($fp) + # LOCAL local_main_at_Main_internal_3 --> -16($fp) + # local_main_at_Main_internal_3 = ALLOCATE Complex + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Complex + sw $t0, 12($v0) + li $t0, 7 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Complex_start + sw $t0, 4($v0) + # Load type offset + li $t0, 20 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Complex__attrib__x__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 12($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Complex__attrib__y__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 16($t1) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -16($fp) + # LOCAL local_main_at_Main_internal_1 --> -8($fp) + # LOCAL local_main_at_Main_internal_3 --> -16($fp) + # local_main_at_Main_internal_1 = local_main_at_Main_internal_3 + lw $t0, -16($fp) + sw $t0, -8($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_4 --> -20($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -20($fp) + # ARG local_main_at_Main_internal_4 + # LOCAL local_main_at_Main_internal_4 --> -20($fp) + lw $t0, -20($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_main_at_Main_internal_5 --> -24($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -24($fp) + # ARG local_main_at_Main_internal_5 + # LOCAL local_main_at_Main_internal_5 --> -24($fp) + lw $t0, -24($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_main_at_Main_internal_1 --> -8($fp) + # LOCAL local_main_at_Main_internal_2 --> -12($fp) + # local_main_at_Main_internal_2 = VCALL local_main_at_Main_internal_1 init + # Save new self pointer in $s1 + lw $s1, -8($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 36($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -12($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_main_at_Main_c_0 --> -4($fp) + # LOCAL local_main_at_Main_internal_2 --> -12($fp) + # local_main_at_Main_c_0 = local_main_at_Main_internal_2 + lw $t0, -12($fp) + sw $t0, -4($fp) + # LOCAL local_main_at_Main_internal_12 --> -52($fp) + # LOCAL local_main_at_Main_c_0 --> -4($fp) + # local_main_at_Main_internal_12 = local_main_at_Main_c_0 + lw $t0, -4($fp) + sw $t0, -52($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_12 --> -52($fp) + # LOCAL local_main_at_Main_internal_13 --> -56($fp) + # local_main_at_Main_internal_13 = VCALL local_main_at_Main_internal_12 reflect_X + # Save new self pointer in $s1 + lw $s1, -52($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 20($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -56($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_main_at_Main_internal_10 --> -44($fp) + # LOCAL local_main_at_Main_internal_13 --> -56($fp) + # local_main_at_Main_internal_10 = local_main_at_Main_internal_13 + lw $t0, -56($fp) + sw $t0, -44($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_10 --> -44($fp) + # LOCAL local_main_at_Main_internal_11 --> -48($fp) + # local_main_at_Main_internal_11 = VCALL local_main_at_Main_internal_10 reflect_Y + # Save new self pointer in $s1 + lw $s1, -44($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 60($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -48($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_main_at_Main_internal_14 --> -60($fp) + # LOCAL local_main_at_Main_c_0 --> -4($fp) + # local_main_at_Main_internal_14 = local_main_at_Main_c_0 + lw $t0, -4($fp) + sw $t0, -60($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_14 --> -60($fp) + # LOCAL local_main_at_Main_internal_15 --> -64($fp) + # local_main_at_Main_internal_15 = VCALL local_main_at_Main_internal_14 reflect_0 + # Save new self pointer in $s1 + lw $s1, -60($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 12($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -64($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # IF_ZERO local_main_at_Main_internal_11 GOTO label_FALSE_61 + # IF_ZERO local_main_at_Main_internal_11 GOTO label_FALSE_61 + lw $t0, -48($fp) + beq $t0, 0, label_FALSE_61 + # IF_ZERO local_main_at_Main_internal_15 GOTO label_FALSE_61 + # IF_ZERO local_main_at_Main_internal_15 GOTO label_FALSE_61 + lw $t0, -64($fp) + beq $t0, 0, label_FALSE_61 + # LOCAL local_main_at_Main_internal_9 --> -40($fp) + # LOCAL local_main_at_Main_internal_11 --> -48($fp) + # Comparing -48($fp) type with String + la $v0, String + lw $a0, -48($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -40($fp) + # IF_ZERO local_main_at_Main_internal_9 GOTO label_COMPARE_STRING_64 + # IF_ZERO local_main_at_Main_internal_9 GOTO label_COMPARE_STRING_64 + lw $t0, -40($fp) + beq $t0, 0, label_COMPARE_STRING_64 + # LOCAL local_main_at_Main_internal_9 --> -40($fp) + # LOCAL local_main_at_Main_internal_11 --> -48($fp) + # Comparing -48($fp) type with Bool + la $v0, Bool + lw $a0, -48($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -40($fp) + # IF_ZERO local_main_at_Main_internal_9 GOTO label_COMPARE_BY_VALUE_65 + # IF_ZERO local_main_at_Main_internal_9 GOTO label_COMPARE_BY_VALUE_65 + lw $t0, -40($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_65 + # LOCAL local_main_at_Main_internal_9 --> -40($fp) + # LOCAL local_main_at_Main_internal_11 --> -48($fp) + # Comparing -48($fp) type with Int + la $v0, Int + lw $a0, -48($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -40($fp) + # IF_ZERO local_main_at_Main_internal_9 GOTO label_COMPARE_BY_VALUE_65 + # IF_ZERO local_main_at_Main_internal_9 GOTO label_COMPARE_BY_VALUE_65 + lw $t0, -40($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_65 + # LOCAL local_main_at_Main_internal_9 --> -40($fp) + # LOCAL local_main_at_Main_internal_11 --> -48($fp) + # LOCAL local_main_at_Main_internal_15 --> -64($fp) + # Load pointers and SUB + lw $a0, -48($fp) + lw $a1, -64($fp) + sub $a0, $a0, $a1 + sw $a0, -40($fp) + # IF_ZERO local_main_at_Main_internal_9 GOTO label_TRUE_62 + # IF_ZERO local_main_at_Main_internal_9 GOTO label_TRUE_62 + lw $t0, -40($fp) + beq $t0, 0, label_TRUE_62 + # GOTO label_FALSE_61 + j label_FALSE_61 + label_COMPARE_BY_VALUE_65: + # LOCAL local_main_at_Main_internal_9 --> -40($fp) + # LOCAL local_main_at_Main_internal_11 --> -48($fp) + # LOCAL local_main_at_Main_internal_15 --> -64($fp) + lw $a0, -48($fp) + lw $a1, -64($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -40($fp) + # IF_ZERO local_main_at_Main_internal_9 GOTO label_TRUE_62 + # IF_ZERO local_main_at_Main_internal_9 GOTO label_TRUE_62 + lw $t0, -40($fp) + beq $t0, 0, label_TRUE_62 + # GOTO label_FALSE_61 + j label_FALSE_61 + label_COMPARE_STRING_64: + # LOCAL local_main_at_Main_internal_9 --> -40($fp) + # LOCAL local_main_at_Main_internal_11 --> -48($fp) + # LOCAL local_main_at_Main_internal_15 --> -64($fp) + # Load strings for comparison + lw $v0, -48($fp) + lw $v1, -64($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -40($fp) + # IF_ZERO local_main_at_Main_internal_9 GOTO label_CONTINUE_66 + # IF_ZERO local_main_at_Main_internal_9 GOTO label_CONTINUE_66 + lw $t0, -40($fp) + beq $t0, 0, label_CONTINUE_66 + # GOTO label_FALSE_61 + j label_FALSE_61 + label_CONTINUE_66: + # LOCAL local_main_at_Main_internal_9 --> -40($fp) + # LOCAL local_main_at_Main_internal_11 --> -48($fp) + # LOCAL local_main_at_Main_internal_15 --> -64($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -48($fp) + lw $v1, -64($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_67: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_68 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_67 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_68: + # Store result + sw $a2, -40($fp) + # IF_ZERO local_main_at_Main_internal_9 GOTO label_TRUE_62 + # IF_ZERO local_main_at_Main_internal_9 GOTO label_TRUE_62 + lw $t0, -40($fp) + beq $t0, 0, label_TRUE_62 + label_FALSE_61: + # LOCAL local_main_at_Main_internal_8 --> -36($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -36($fp) + # GOTO label_END_63 +j label_END_63 +label_TRUE_62: + # LOCAL local_main_at_Main_internal_8 --> -36($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -36($fp) + label_END_63: +# LOCAL local_main_at_Main_internal_6 --> -28($fp) +# LOCAL local_main_at_Main_internal_8 --> -36($fp) +# Obtain value from -36($fp) +lw $v0, -36($fp) +lw $v0, 12($v0) +sw $v0, -28($fp) +# IF_ZERO local_main_at_Main_internal_6 GOTO label_FALSEIF_59 +# IF_ZERO local_main_at_Main_internal_6 GOTO label_FALSEIF_59 +lw $t0, -28($fp) +beq $t0, 0, label_FALSEIF_59 +# LOCAL local_main_at_Main_internal_18 --> -76($fp) +# local_main_at_Main_internal_18 = SELF +sw $s1, -76($fp) +# LOCAL local_main_at_Main_internal_16 --> -68($fp) +# LOCAL local_main_at_Main_internal_18 --> -76($fp) +# local_main_at_Main_internal_16 = local_main_at_Main_internal_18 +lw $t0, -76($fp) +sw $t0, -68($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_main_at_Main_internal_19 --> -80($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_6 +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +sw $v0, -80($fp) +# ARG local_main_at_Main_internal_19 +# LOCAL local_main_at_Main_internal_19 --> -80($fp) +lw $t0, -80($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_main_at_Main_internal_16 --> -68($fp) +# LOCAL local_main_at_Main_internal_17 --> -72($fp) +# local_main_at_Main_internal_17 = VCALL local_main_at_Main_internal_16 out_string +# Save new self pointer in $s1 +lw $s1, -68($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 4($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -72($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_main_at_Main_internal_7 --> -32($fp) +# LOCAL local_main_at_Main_internal_17 --> -72($fp) +# local_main_at_Main_internal_7 = local_main_at_Main_internal_17 +lw $t0, -72($fp) +sw $t0, -32($fp) +# GOTO label_ENDIF_60 +j label_ENDIF_60 +label_FALSEIF_59: + # LOCAL local_main_at_Main_internal_22 --> -92($fp) + # local_main_at_Main_internal_22 = SELF + sw $s1, -92($fp) + # LOCAL local_main_at_Main_internal_20 --> -84($fp) + # LOCAL local_main_at_Main_internal_22 --> -92($fp) + # local_main_at_Main_internal_20 = local_main_at_Main_internal_22 + lw $t0, -92($fp) + sw $t0, -84($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_23 --> -96($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_7 + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + sw $v0, -96($fp) + # ARG local_main_at_Main_internal_23 + # LOCAL local_main_at_Main_internal_23 --> -96($fp) + lw $t0, -96($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_main_at_Main_internal_20 --> -84($fp) + # LOCAL local_main_at_Main_internal_21 --> -88($fp) + # local_main_at_Main_internal_21 = VCALL local_main_at_Main_internal_20 out_string + # Save new self pointer in $s1 + lw $s1, -84($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 4($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -88($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_main_at_Main_internal_7 --> -32($fp) + # LOCAL local_main_at_Main_internal_21 --> -88($fp) + # local_main_at_Main_internal_7 = local_main_at_Main_internal_21 + lw $t0, -88($fp) + sw $t0, -32($fp) + label_ENDIF_60: +# RETURN local_main_at_Main_internal_7 +lw $v0, -32($fp) +# Deallocate stack frame for function function_main_at_Main. +# Restore $ra +lw $ra, 4($sp) +# Restore $fp +lw $fp, 0($sp) +# Restore Stack pointer $sp +addu $sp, $sp, 104 +jr $ra +# Function END + diff --git a/tests/codegen/fib.mips b/tests/codegen/fib.mips new file mode 100644 index 00000000..d7f71110 --- /dev/null +++ b/tests/codegen/fib.mips @@ -0,0 +1,1568 @@ + +# Code generated by PyCoolc. +# Eliane Puerta, Liset Alfaro, Adrian Gonzalez --- Mon Dec 14 11:08:38 2020 +# School of Math and Computer Science, University of Havana +# + +.data +dummy: .word 0 +IO: .asciiz "IO" +# Function END +Object: .asciiz "Object" +# Function END +String: .asciiz "String" +# Function END +Bool: .asciiz "Bool" +# Function END +Int: .asciiz "Int" +# Function END +Main: .asciiz "Main" +# Function END +# + + +# **** VTABLE for type IO **** +IO_vtable: .word dummy, function_out_string_at_IO, dummy, function_out_int_at_IO, function_abort_at_Object, dummy, dummy, function_in_string_at_IO, function_copy_at_Object, dummy, function_type_name_at_Object, function_in_int_at_IO +# Function END +# + + +# **** Type RECORD for type IO **** +IO_start: + IO_vtable_pointer: .word IO_vtable + # Function END +IO_end: +# + + +# **** VTABLE for type Object **** +Object_vtable: .word dummy, dummy, dummy, dummy, function_abort_at_Object, dummy, dummy, dummy, function_copy_at_Object, dummy, function_type_name_at_Object, dummy +# Function END +# + + +# **** Type RECORD for type Object **** +Object_start: + Object_vtable_pointer: .word Object_vtable + # Function END +Object_end: +# + + +# **** VTABLE for type String **** +String_vtable: .word dummy, dummy, function_substr_at_String, dummy, function_abort_at_Object, dummy, function_length_at_String, dummy, function_copy_at_Object, function_concat_at_String, function_type_name_at_Object, dummy +# Function END +# + + +# **** Type RECORD for type String **** +String_start: + String_vtable_pointer: .word String_vtable + # Function END +String_end: +# + + +# **** VTABLE for type Bool **** +Bool_vtable: .word dummy, dummy, dummy, dummy, function_abort_at_Object, dummy, dummy, dummy, function_copy_at_Object, dummy, function_type_name_at_Object, dummy +# Function END +# + + +# **** Type RECORD for type Bool **** +Bool_start: + Bool_vtable_pointer: .word Bool_vtable + # Function END +Bool_end: +# + + +# **** VTABLE for type Int **** +Int_vtable: .word dummy, dummy, dummy, dummy, function_abort_at_Object, dummy, dummy, dummy, function_copy_at_Object, dummy, function_type_name_at_Object, dummy +# Function END +# + + +# **** Type RECORD for type Int **** +Int_start: + Int_vtable_pointer: .word Int_vtable + # Function END +Int_end: +# + + +# **** VTABLE for type Main **** +Main_vtable: .word function_fib_at_Main, function_out_string_at_IO, dummy, function_out_int_at_IO, function_abort_at_Object, function_main_at_Main, dummy, function_in_string_at_IO, function_copy_at_Object, dummy, function_type_name_at_Object, function_in_int_at_IO +# Function END +# + + +# **** Type RECORD for type Main **** +Main_start: + Main_vtable_pointer: .word Main_vtable + # Function END +Main_end: +# + + +data_0: .asciiz "" +# + + +data_1: .asciiz "Abort called from class " +# + + +data_2: .asciiz "\n" +# + + +IO__TDT: .word 0, -1, -1, -1, -1, 1 +Object__TDT: .word 1, 0, 1, 1, 1, 2 +String__TDT: .word -1, -1, 0, -1, -1, -1 +Bool__TDT: .word -1, -1, -1, 0, -1, -1 +Int__TDT: .word -1, -1, -1, -1, 0, -1 +Main__TDT: .word -1, -1, -1, -1, -1, 0 +# + + +data_4: .asciiz "Enter n to find nth fibonacci number!\n" +# + + +data_5: .asciiz "\n" +# + + +.text +main: + jal entry + # syscall code 10 is for exit + li $v0, 10 + syscall + # Function END + +# function_in_string_at_IO implementation. +# @Params: +function_in_string_at_IO: + # Allocate stack frame for function function_in_string_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_in_string_at_IO_internal_0 --> -4($fp) + # Allocating 1024 bytes of memory + li $a0, 1024 + li $v0, 9 + syscall + move $t0, $v0 + move $a0, $v0 + li $a1, 1024 + li $v0, 8 + syscall + move $t2, $zero + move $t3, $zero + move $t1, $t0 + lb $t3, 0($t1) + beqz $t3, end_loop + read_length_loop: + lb $t3, 0($t1) + beqz $t3, end_read_length_loop + addu $t1, $t1, 1 + addu $t2, $t2, 1 + j read_length_loop + end_read_length_loop: + subu $t1, $t1, 1 + sb $zero, 0($t1) + subu $t2, $t2, 1 + end_loop: + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $t2, 16($v0) + sw $v0, -4($fp) + # RETURN local_in_string_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_in_string_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_out_int_at_IO implementation. +# @Params: +# 0($fp) = param_out_int_at_IO_x_0 +function_out_int_at_IO: + # Allocate stack frame for function function_out_int_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # PRINT_INT param_out_int_at_IO_x_0 + # PARAM param_out_int_at_IO_x_0 --> 0($fp) + lw $v0, 0($fp) + lw $a0, 12($v0) + li $v0, 1 + syscall + # LOCAL local_out_int_at_IO_internal_0 --> -4($fp) + # local_out_int_at_IO_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_out_int_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_out_int_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_out_string_at_IO implementation. +# @Params: +# 0($fp) = param_out_string_at_IO_x_0 +function_out_string_at_IO: + # Allocate stack frame for function function_out_string_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # PARAM param_out_string_at_IO_x_0 --> 0($fp) + # PRINT_STR param_out_string_at_IO_x_0 + lw $v0, 0($fp) + lw $a0, 12($v0) + li $v0, 4 + syscall + # LOCAL local_out_string_at_IO_internal_0 --> -4($fp) + # local_out_string_at_IO_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_out_string_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_out_string_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_in_int_at_IO implementation. +# @Params: +function_in_int_at_IO: + # Allocate stack frame for function function_in_int_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_in_int_at_IO_internal_0 --> -4($fp) + # local_in_int_at_IO_internal_0 = READ_INT + li $v0, 5 + syscall + move $a2, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + sw $a2, 12($v0) + sw $v0, -4($fp) + # RETURN local_in_int_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_in_int_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_abort_at_Object implementation. +# @Params: +function_abort_at_Object: + # Allocate stack frame for function function_abort_at_Object. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_abort_at_Object_internal_0 --> -4($fp) + lw $t0, 0($s1) + sw $t0, -4($fp) + # LOCAL local_abort_at_Object_internal_0 --> -4($fp) + la $a0, data_1 + li $v0, 4 + syscall + lw $a0, -4($fp) + li $v0, 4 + syscall + la $a0, data_2 + li $v0, 4 + syscall + li $v0, 10 + syscall + # Function END + + +# function_copy_at_Object implementation. +# @Params: +function_copy_at_Object: + # Allocate stack frame for function function_copy_at_Object. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_copy_at_Object_internal_0 --> -4($fp) + # local_copy_at_Object_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_copy_at_Object_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function function_copy_at_Object. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_type_name_at_Object implementation. +# @Params: +function_type_name_at_Object: + # Allocate stack frame for function function_type_name_at_Object. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_type_name_at_Object_internal_0 --> -4($fp) + lw $t0, 0($s1) + sw $t0, -4($fp) + # RETURN local_type_name_at_Object_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_type_name_at_Object. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_concat_at_String implementation. +# @Params: +# 0($fp) = param_concat_at_String_s_0 +function_concat_at_String: + # Allocate stack frame for function function_concat_at_String. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_concat_at_String_internal_0 = self.CONCAT + # LOCAL local_concat_at_String_internal_0 --> -4($fp) + # PARAM param_concat_at_String_s_0 --> 0($fp) + # Get first string length from self + lw $t0, 16($s1) + # Get second string length from param + lw $v0, 0($fp) + lw $t1, 16($v0) + # Save new string length in a0 for memory allocation + addu $a0, $t0, $t1 + move $t3, $a0 + # Get first string from self + lw $t0, 12($s1) + # Get second string from param + lw $t1, 12($v0) + addu $a0, $a0, 4 + li $v0, 9 + syscall + move $t2, $v0 + move $t4, $zero + concat_loop1: + # Compare t0 with \0 + lb $t4, 0($t0) + beqz $t4, concat_loop1_end + # Copy 1 byte + sb $t4, 0($t2) + addu $t2, $t2, 1 + addu $t0, $t0, 1 + j concat_loop1 + concat_loop1_end: + # Copy second string + concat_loop2: + # Compare t1 with \0 + lb $t4, 0($t1) + beqz $t4, concat_loop2_end + # Copy 1 byte + sb $t4, 0($t2) + addu $t2, $t2, 1 + addu $t1, $t1, 1 + j concat_loop2 + concat_loop2_end: + sb $zero, 0($t2) + # v0 contains resulting string + move $t1, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + sw $t1, 12($v0) + sw $t3, 16($v0) + sw $v0, -4($fp) + # RETURN local_concat_at_String_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_concat_at_String. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_substr_at_String implementation. +# @Params: +# 0($fp) = param_substr_at_String_l_0 +# 4($fp) = param_substr_at_String_r_1 +function_substr_at_String: + # Allocate stack frame for function function_substr_at_String. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_substr_at_String_internal_0 --> -4($fp) + # PARAM param_substr_at_String_l_0 --> 4($fp) + # PARAM param_substr_at_String_r_1 --> 0($fp) + lw $t0, 12($s1) + lw $t2, 4($fp) + lw $t2, 12($t2) + addu $t0, $t0, $t2 + lw $a0, 0($fp) + lw $a0, 12($a0) + move $t3, $a0 + move $t1, $a0 + addu $a0, $a0, 1 + li $v0, 9 + syscall + move $t2, $v0 + substr_loop: + beqz $t1, substr_end + lb $a0, 0($t0) + sb $a0, 0($t2) + addu $t0, $t0, 1 + addu $t2, $t2, 1 + subu $t1, $t1, 1 + j substr_loop + substr_end: + sb $zero, 0($t2) + move $t1, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + sw $t1, 12($v0) + sw $t3, 16($v0) + sw $v0, -4($fp) + # RETURN local_substr_at_String_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_substr_at_String. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 8 + jr $ra + # Function END + + +# function_length_at_String implementation. +# @Params: +function_length_at_String: + # Allocate stack frame for function function_length_at_String. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_length_at_String_internal_0 = GETATTRIBUTE length String + # LOCAL local_length_at_String_internal_0 --> -4($fp) + lw $t0, 16($s1) + sw $t0, -4($fp) + # LOCAL local_length_at_String_internal_1 --> -8($fp) + # LOCAL local_length_at_String_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + lw $t0, -4($fp) + sw $t0, 12($v0) + sw $v0, -8($fp) + # RETURN local_length_at_String_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function function_length_at_String. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# entry implementation. +# @Params: +entry: + # Allocate stack frame for function entry. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local__internal_0 --> -4($fp) + # local__internal_0 = ALLOCATE Main + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Main + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 12 bytes of memory + li $a0, 12 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Main_start + sw $t0, 4($v0) + # Load type offset + li $t0, 20 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -4($fp) + # LOCAL local__internal_0 --> -4($fp) + lw $s1, -4($fp) + # local__internal_1 = CALL main + # LOCAL local__internal_1 --> -8($fp) + # LOCAL local__internal_0 --> -4($fp) + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type's VTABLE + la $t0, Main_vtable + # Get pointer to function address + lw $t1, 20($t0) + # Call function. Result is on $v0 + jalr $t1 + sw $v0, -8($fp) + # RETURN 0 + li $v0, 0 + # Deallocate stack frame for function entry. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_main_at_Main implementation. +# @Params: +function_main_at_Main: + # Allocate stack frame for function function_main_at_Main. + subu $sp, $sp, 76 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 76 + # LOCAL local_main_at_Main_internal_2 --> -12($fp) + # local_main_at_Main_internal_2 = SELF + sw $s1, -12($fp) + # LOCAL local_main_at_Main_internal_0 --> -4($fp) + # LOCAL local_main_at_Main_internal_2 --> -12($fp) + # local_main_at_Main_internal_0 = local_main_at_Main_internal_2 + lw $t0, -12($fp) + sw $t0, -4($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_3 --> -16($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_4 + sw $t0, 12($v0) + li $t0, 38 + sw $t0, 16($v0) + sw $v0, -16($fp) + # ARG local_main_at_Main_internal_3 + # LOCAL local_main_at_Main_internal_3 --> -16($fp) + lw $t0, -16($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_main_at_Main_internal_0 --> -4($fp) + # LOCAL local_main_at_Main_internal_1 --> -8($fp) + # local_main_at_Main_internal_1 = VCALL local_main_at_Main_internal_0 out_string + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 4($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -8($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_main_at_Main_internal_6 --> -28($fp) + # local_main_at_Main_internal_6 = SELF + sw $s1, -28($fp) + # LOCAL local_main_at_Main_internal_4 --> -20($fp) + # LOCAL local_main_at_Main_internal_6 --> -28($fp) + # local_main_at_Main_internal_4 = local_main_at_Main_internal_6 + lw $t0, -28($fp) + sw $t0, -20($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_9 --> -40($fp) + # local_main_at_Main_internal_9 = SELF + sw $s1, -40($fp) + # LOCAL local_main_at_Main_internal_7 --> -32($fp) + # LOCAL local_main_at_Main_internal_9 --> -40($fp) + # local_main_at_Main_internal_7 = local_main_at_Main_internal_9 + lw $t0, -40($fp) + sw $t0, -32($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_12 --> -52($fp) + # local_main_at_Main_internal_12 = SELF + sw $s1, -52($fp) + # LOCAL local_main_at_Main_internal_10 --> -44($fp) + # LOCAL local_main_at_Main_internal_12 --> -52($fp) + # local_main_at_Main_internal_10 = local_main_at_Main_internal_12 + lw $t0, -52($fp) + sw $t0, -44($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_10 --> -44($fp) + # LOCAL local_main_at_Main_internal_11 --> -48($fp) + # local_main_at_Main_internal_11 = VCALL local_main_at_Main_internal_10 in_int + # Save new self pointer in $s1 + lw $s1, -44($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 44($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -48($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # ARG local_main_at_Main_internal_11 + # LOCAL local_main_at_Main_internal_11 --> -48($fp) + lw $t0, -48($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_main_at_Main_internal_7 --> -32($fp) + # LOCAL local_main_at_Main_internal_8 --> -36($fp) + # local_main_at_Main_internal_8 = VCALL local_main_at_Main_internal_7 fib + # Save new self pointer in $s1 + lw $s1, -32($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 0($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -36($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # ARG local_main_at_Main_internal_8 + # LOCAL local_main_at_Main_internal_8 --> -36($fp) + lw $t0, -36($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_main_at_Main_internal_4 --> -20($fp) + # LOCAL local_main_at_Main_internal_5 --> -24($fp) + # local_main_at_Main_internal_5 = VCALL local_main_at_Main_internal_4 out_int + # Save new self pointer in $s1 + lw $s1, -20($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 12($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -24($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_main_at_Main_internal_15 --> -64($fp) + # local_main_at_Main_internal_15 = SELF + sw $s1, -64($fp) + # LOCAL local_main_at_Main_internal_13 --> -56($fp) + # LOCAL local_main_at_Main_internal_15 --> -64($fp) + # local_main_at_Main_internal_13 = local_main_at_Main_internal_15 + lw $t0, -64($fp) + sw $t0, -56($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_16 --> -68($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_5 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -68($fp) + # ARG local_main_at_Main_internal_16 + # LOCAL local_main_at_Main_internal_16 --> -68($fp) + lw $t0, -68($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_main_at_Main_internal_13 --> -56($fp) + # LOCAL local_main_at_Main_internal_14 --> -60($fp) + # local_main_at_Main_internal_14 = VCALL local_main_at_Main_internal_13 out_string + # Save new self pointer in $s1 + lw $s1, -56($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 4($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -60($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # RETURN local_main_at_Main_internal_14 + lw $v0, -60($fp) + # Deallocate stack frame for function function_main_at_Main. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 76 + jr $ra + # Function END + + +# function_fib_at_Main implementation. +# @Params: +# 0($fp) = param_fib_at_Main_i_0 +function_fib_at_Main: + # Allocate stack frame for function function_fib_at_Main. + subu $sp, $sp, 64 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 64 + # LOCAL local_fib_at_Main_a_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -4($fp) + # LOCAL local_fib_at_Main_internal_1 --> -8($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -8($fp) + # LOCAL local_fib_at_Main_a_0 --> -4($fp) + # LOCAL local_fib_at_Main_internal_1 --> -8($fp) + # local_fib_at_Main_a_0 = local_fib_at_Main_internal_1 + lw $t0, -8($fp) + sw $t0, -4($fp) + # LOCAL local_fib_at_Main_b_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -12($fp) + # LOCAL local_fib_at_Main_internal_3 --> -16($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -16($fp) + # LOCAL local_fib_at_Main_b_2 --> -12($fp) + # LOCAL local_fib_at_Main_internal_3 --> -16($fp) + # local_fib_at_Main_b_2 = local_fib_at_Main_internal_3 + lw $t0, -16($fp) + sw $t0, -12($fp) + # LOCAL local_fib_at_Main_c_4 --> -20($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -20($fp) + # LOCAL local_fib_at_Main_internal_5 --> -24($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -24($fp) + # LOCAL local_fib_at_Main_c_4 --> -20($fp) + # LOCAL local_fib_at_Main_internal_5 --> -24($fp) + # local_fib_at_Main_c_4 = local_fib_at_Main_internal_5 + lw $t0, -24($fp) + sw $t0, -20($fp) + label_WHILE_1: + # LOCAL local_fib_at_Main_internal_9 --> -40($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -40($fp) + # IF_ZERO param_fib_at_Main_i_0 GOTO label_FALSE_3 + # IF_ZERO param_fib_at_Main_i_0 GOTO label_FALSE_3 + lw $t0, 0($fp) + beq $t0, 0, label_FALSE_3 + # IF_ZERO local_fib_at_Main_internal_9 GOTO label_FALSE_3 + # IF_ZERO local_fib_at_Main_internal_9 GOTO label_FALSE_3 + lw $t0, -40($fp) + beq $t0, 0, label_FALSE_3 + # LOCAL local_fib_at_Main_internal_8 --> -36($fp) + # PARAM param_fib_at_Main_i_0 --> 0($fp) + # Comparing 0($fp) type with String + la $v0, String + lw $a0, 0($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -36($fp) + # IF_ZERO local_fib_at_Main_internal_8 GOTO label_COMPARE_STRING_6 + # IF_ZERO local_fib_at_Main_internal_8 GOTO label_COMPARE_STRING_6 + lw $t0, -36($fp) + beq $t0, 0, label_COMPARE_STRING_6 + # LOCAL local_fib_at_Main_internal_8 --> -36($fp) + # PARAM param_fib_at_Main_i_0 --> 0($fp) + # Comparing 0($fp) type with Bool + la $v0, Bool + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -36($fp) + # IF_ZERO local_fib_at_Main_internal_8 GOTO label_COMPARE_BY_VALUE_7 + # IF_ZERO local_fib_at_Main_internal_8 GOTO label_COMPARE_BY_VALUE_7 + lw $t0, -36($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_7 + # LOCAL local_fib_at_Main_internal_8 --> -36($fp) + # PARAM param_fib_at_Main_i_0 --> 0($fp) + # Comparing 0($fp) type with Int + la $v0, Int + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -36($fp) + # IF_ZERO local_fib_at_Main_internal_8 GOTO label_COMPARE_BY_VALUE_7 + # IF_ZERO local_fib_at_Main_internal_8 GOTO label_COMPARE_BY_VALUE_7 + lw $t0, -36($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_7 + # LOCAL local_fib_at_Main_internal_8 --> -36($fp) + # PARAM param_fib_at_Main_i_0 --> 0($fp) + # LOCAL local_fib_at_Main_internal_9 --> -40($fp) + # Load pointers and SUB + lw $a0, 0($fp) + lw $a1, -40($fp) + sub $a0, $a0, $a1 + sw $a0, -36($fp) + # IF_ZERO local_fib_at_Main_internal_8 GOTO label_TRUE_4 + # IF_ZERO local_fib_at_Main_internal_8 GOTO label_TRUE_4 + lw $t0, -36($fp) + beq $t0, 0, label_TRUE_4 + # GOTO label_FALSE_3 + j label_FALSE_3 + label_COMPARE_BY_VALUE_7: + # LOCAL local_fib_at_Main_internal_8 --> -36($fp) + # PARAM param_fib_at_Main_i_0 --> 0($fp) + # LOCAL local_fib_at_Main_internal_9 --> -40($fp) + lw $a0, 0($fp) + lw $a1, -40($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -36($fp) + # IF_ZERO local_fib_at_Main_internal_8 GOTO label_TRUE_4 + # IF_ZERO local_fib_at_Main_internal_8 GOTO label_TRUE_4 + lw $t0, -36($fp) + beq $t0, 0, label_TRUE_4 + # GOTO label_FALSE_3 + j label_FALSE_3 + label_COMPARE_STRING_6: + # LOCAL local_fib_at_Main_internal_8 --> -36($fp) + # PARAM param_fib_at_Main_i_0 --> 0($fp) + # LOCAL local_fib_at_Main_internal_9 --> -40($fp) + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -40($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -36($fp) + # IF_ZERO local_fib_at_Main_internal_8 GOTO label_CONTINUE_8 + # IF_ZERO local_fib_at_Main_internal_8 GOTO label_CONTINUE_8 + lw $t0, -36($fp) + beq $t0, 0, label_CONTINUE_8 + # GOTO label_FALSE_3 + j label_FALSE_3 + label_CONTINUE_8: + # LOCAL local_fib_at_Main_internal_8 --> -36($fp) + # PARAM param_fib_at_Main_i_0 --> 0($fp) + # LOCAL local_fib_at_Main_internal_9 --> -40($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -40($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_9: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_10 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_9 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_10: + # Store result + sw $a2, -36($fp) + # IF_ZERO local_fib_at_Main_internal_8 GOTO label_TRUE_4 + # IF_ZERO local_fib_at_Main_internal_8 GOTO label_TRUE_4 + lw $t0, -36($fp) + beq $t0, 0, label_TRUE_4 + label_FALSE_3: + # LOCAL local_fib_at_Main_internal_7 --> -32($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -32($fp) + # GOTO label_END_5 +j label_END_5 +label_TRUE_4: + # LOCAL local_fib_at_Main_internal_7 --> -32($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -32($fp) + label_END_5: +# LOCAL local_fib_at_Main_internal_7 --> -32($fp) +# LOCAL local_fib_at_Main_internal_7 --> -32($fp) +# Obtain value from -32($fp) +lw $v0, -32($fp) +lw $v0, 12($v0) +sw $v0, -32($fp) +# IF_ZERO local_fib_at_Main_internal_7 GOTO label_FALSE_11 +# IF_ZERO local_fib_at_Main_internal_7 GOTO label_FALSE_11 +lw $t0, -32($fp) +beq $t0, 0, label_FALSE_11 +# LOCAL local_fib_at_Main_internal_10 --> -44($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Bool +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Bool +sw $t0, 12($v0) +li $t0, 4 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Bool_start +sw $t0, 4($v0) +# Load type offset +li $t0, 12 +sw $t0, 8($v0) +li $t0, 0 +sw $t0, 12($v0) +sw $v0, -44($fp) +# GOTO label_NOT_END_12 +j label_NOT_END_12 +label_FALSE_11: + # LOCAL local_fib_at_Main_internal_10 --> -44($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -44($fp) + label_NOT_END_12: + # LOCAL local_fib_at_Main_internal_6 --> -28($fp) + # LOCAL local_fib_at_Main_internal_10 --> -44($fp) + # Obtain value from -44($fp) + lw $v0, -44($fp) + lw $v0, 12($v0) + sw $v0, -28($fp) + # IF_ZERO local_fib_at_Main_internal_6 GOTO label_WHILE_END_2 + # IF_ZERO local_fib_at_Main_internal_6 GOTO label_WHILE_END_2 + lw $t0, -28($fp) + beq $t0, 0, label_WHILE_END_2 + # LOCAL local_fib_at_Main_internal_11 --> -48($fp) + # LOCAL local_fib_at_Main_a_0 --> -4($fp) + # LOCAL local_fib_at_Main_b_2 --> -12($fp) + # local_fib_at_Main_internal_11 = local_fib_at_Main_a_0 + local_fib_at_Main_b_2 + lw $t1, -4($fp) + lw $t0, 12($t1) + lw $t1, -12($fp) + lw $t2, 12($t1) + add $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -48($fp) + # LOCAL local_fib_at_Main_c_4 --> -20($fp) + # LOCAL local_fib_at_Main_internal_11 --> -48($fp) + # local_fib_at_Main_c_4 = local_fib_at_Main_internal_11 + lw $t0, -48($fp) + sw $t0, -20($fp) + # LOCAL local_fib_at_Main_internal_13 --> -56($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -56($fp) + # LOCAL local_fib_at_Main_internal_12 --> -52($fp) + # PARAM param_fib_at_Main_i_0 --> 0($fp) + # LOCAL local_fib_at_Main_internal_13 --> -56($fp) + # local_fib_at_Main_internal_12 = PARAM param_fib_at_Main_i_0 - local_fib_at_Main_internal_13 + lw $t1, 0($fp) + lw $t0, 12($t1) + lw $t1, -56($fp) + lw $t2, 12($t1) + sub $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -52($fp) + # PARAM param_fib_at_Main_i_0 --> 0($fp) + # LOCAL local_fib_at_Main_internal_12 --> -52($fp) + # PARAM param_fib_at_Main_i_0 = local_fib_at_Main_internal_12 + lw $t0, -52($fp) + sw $t0, 0($fp) + # LOCAL local_fib_at_Main_b_2 --> -12($fp) + # LOCAL local_fib_at_Main_a_0 --> -4($fp) + # local_fib_at_Main_b_2 = local_fib_at_Main_a_0 + lw $t0, -4($fp) + sw $t0, -12($fp) + # LOCAL local_fib_at_Main_a_0 --> -4($fp) + # LOCAL local_fib_at_Main_c_4 --> -20($fp) + # local_fib_at_Main_a_0 = local_fib_at_Main_c_4 + lw $t0, -20($fp) + sw $t0, -4($fp) + # GOTO label_WHILE_1 + j label_WHILE_1 + label_WHILE_END_2: + # RETURN local_fib_at_Main_c_4 + lw $v0, -20($fp) + # Deallocate stack frame for function function_fib_at_Main. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 64 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + diff --git a/tests/codegen/graph.mips b/tests/codegen/graph.mips new file mode 100644 index 00000000..2a08740f --- /dev/null +++ b/tests/codegen/graph.mips @@ -0,0 +1,11753 @@ + +# Code generated by PyCoolc. +# Eliane Puerta, Liset Alfaro, Adrian Gonzalez --- Mon Dec 14 11:08:39 2020 +# School of Math and Computer Science, University of Havana +# + +.data +dummy: .word 0 +IO: .asciiz "IO" +# Function END +Object: .asciiz "Object" +# Function END +String: .asciiz "String" +# Function END +Bool: .asciiz "Bool" +# Function END +Int: .asciiz "Int" +# Function END +BoolOp: .asciiz "BoolOp" +# Function END +Graph: .asciiz "Graph" +# Function END +Parse: .asciiz "Parse" +# Function END +Main: .asciiz "Main" +# Function END +VList: .asciiz "VList" +# Function END +VCons: .asciiz "VCons" +# Function END +EList: .asciiz "EList" +# Function END +ECons: .asciiz "ECons" +# Function END +Edge: .asciiz "Edge" +# Function END +Vertice: .asciiz "Vertice" +# Function END +# + + +# **** VTABLE for type IO **** +IO_vtable: .word function_type_name_at_Object, function_in_int_at_IO, dummy, function_copy_at_Object, function_abort_at_Object, function_out_int_at_IO, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, function_in_string_at_IO, dummy, dummy, dummy, dummy, dummy, dummy, dummy, function_out_string_at_IO, dummy, dummy, dummy, dummy +# Function END +# + + +# **** Type RECORD for type IO **** +IO_start: + IO_vtable_pointer: .word IO_vtable + # Function END +IO_end: +# + + +# **** VTABLE for type Object **** +Object_vtable: .word function_type_name_at_Object, dummy, dummy, function_copy_at_Object, function_abort_at_Object, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy +# Function END +# + + +# **** Type RECORD for type Object **** +Object_start: + Object_vtable_pointer: .word Object_vtable + # Function END +Object_end: +# + + +# **** VTABLE for type String **** +String_vtable: .word function_type_name_at_Object, dummy, dummy, function_copy_at_Object, function_abort_at_Object, dummy, dummy, dummy, dummy, function_length_at_String, dummy, dummy, dummy, dummy, dummy, dummy, function_substr_at_String, dummy, dummy, dummy, dummy, dummy, function_concat_at_String, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy +# Function END +# + + +# **** Type RECORD for type String **** +String_start: + String_vtable_pointer: .word String_vtable + # Function END +String_end: +# + + +# **** VTABLE for type Bool **** +Bool_vtable: .word function_type_name_at_Object, dummy, dummy, function_copy_at_Object, function_abort_at_Object, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy +# Function END +# + + +# **** Type RECORD for type Bool **** +Bool_start: + Bool_vtable_pointer: .word Bool_vtable + # Function END +Bool_end: +# + + +# **** VTABLE for type Int **** +Int_vtable: .word function_type_name_at_Object, dummy, dummy, function_copy_at_Object, function_abort_at_Object, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy +# Function END +# + + +# **** Type RECORD for type Int **** +Int_start: + Int_vtable_pointer: .word Int_vtable + # Function END +Int_end: +# + + +# **** VTABLE for type BoolOp **** +BoolOp_vtable: .word function_type_name_at_Object, dummy, dummy, function_copy_at_Object, function_abort_at_Object, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, function_and_at_BoolOp, dummy, dummy, dummy, dummy, dummy, dummy, dummy, function_or_at_BoolOp, dummy, dummy, dummy +# Function END +# + + +# **** Type RECORD for type BoolOp **** +BoolOp_start: + BoolOp_vtable_pointer: .word BoolOp_vtable + # Function END +BoolOp_end: +# + + +# **** VTABLE for type Graph **** +Graph_vtable: .word function_type_name_at_Object, dummy, dummy, function_copy_at_Object, function_abort_at_Object, dummy, dummy, function_print_V_at_Graph, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, function_print_E_at_Graph, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, function_add_vertice_at_Graph +# Function END +# + + +# **** Type RECORD for type Graph **** +Graph_start: + Graph_vtable_pointer: .word Graph_vtable + # Function END +Graph_end: +# + + +# **** VTABLE for type Parse **** +Parse_vtable: .word function_type_name_at_Object, function_in_int_at_IO, dummy, function_copy_at_Object, function_abort_at_Object, function_out_int_at_IO, dummy, dummy, function_parse_line_at_Parse, dummy, dummy, function_a2i_at_Parse, dummy, dummy, dummy, dummy, dummy, function_read_input_at_Parse, function_in_string_at_IO, dummy, dummy, dummy, dummy, dummy, dummy, function_a2i_aux_at_Parse, function_out_string_at_IO, dummy, dummy, function_c2i_at_Parse, dummy +# Function END +# + + +# **** Type RECORD for type Parse **** +Parse_start: + Parse_vtable_pointer: .word Parse_vtable + # Function END +Parse_end: +# + + +# **** VTABLE for type Main **** +Main_vtable: .word function_type_name_at_Object, function_in_int_at_IO, dummy, function_copy_at_Object, function_abort_at_Object, function_out_int_at_IO, dummy, dummy, function_parse_line_at_Parse, dummy, dummy, function_a2i_at_Parse, dummy, dummy, function_main_at_Main, dummy, dummy, function_read_input_at_Parse, function_in_string_at_IO, dummy, dummy, dummy, dummy, dummy, dummy, function_a2i_aux_at_Parse, function_out_string_at_IO, dummy, dummy, function_c2i_at_Parse, dummy +# Function END +# + + +# **** Type RECORD for type Main **** +Main_start: + Main_vtable_pointer: .word Main_vtable + # Function END +Main_end: +# + + +# **** VTABLE for type VList **** +VList_vtable: .word function_type_name_at_Object, function_in_int_at_IO, dummy, function_copy_at_Object, function_abort_at_Object, function_out_int_at_IO, function_head_at_VList, dummy, dummy, dummy, dummy, dummy, function_cons_at_VList, dummy, dummy, dummy, dummy, dummy, function_in_string_at_IO, dummy, dummy, function_tail_at_VList, dummy, function_print_at_VList, function_isNil_at_VList, dummy, function_out_string_at_IO, dummy, dummy, dummy, dummy +# Function END +# + + +# **** Type RECORD for type VList **** +VList_start: + VList_vtable_pointer: .word VList_vtable + # Function END +VList_end: +# + + +# **** VTABLE for type VCons **** +VCons_vtable: .word function_type_name_at_Object, function_in_int_at_IO, function_init_at_VCons, function_copy_at_Object, function_abort_at_Object, function_out_int_at_IO, function_head_at_VCons, dummy, dummy, dummy, dummy, dummy, function_cons_at_VList, dummy, dummy, dummy, dummy, dummy, function_in_string_at_IO, dummy, dummy, function_tail_at_VCons, dummy, function_print_at_VCons, function_isNil_at_VCons, dummy, function_out_string_at_IO, dummy, dummy, dummy, dummy +# Function END +# + + +# **** Type RECORD for type VCons **** +VCons_start: + VCons_vtable_pointer: .word VCons_vtable + # Function END +VCons_end: +# + + +# **** VTABLE for type EList **** +EList_vtable: .word function_type_name_at_Object, function_in_int_at_IO, dummy, function_copy_at_Object, function_abort_at_Object, function_out_int_at_IO, function_head_at_EList, dummy, dummy, dummy, function_append_at_EList, dummy, function_cons_at_EList, dummy, dummy, dummy, dummy, dummy, function_in_string_at_IO, dummy, dummy, function_tail_at_EList, dummy, function_print_at_EList, function_isNil_at_EList, dummy, function_out_string_at_IO, dummy, dummy, dummy, dummy +# Function END +# + + +# **** Type RECORD for type EList **** +EList_start: + EList_vtable_pointer: .word EList_vtable + # Function END +EList_end: +# + + +# **** VTABLE for type ECons **** +ECons_vtable: .word function_type_name_at_Object, function_in_int_at_IO, function_init_at_ECons, function_copy_at_Object, function_abort_at_Object, function_out_int_at_IO, function_head_at_ECons, dummy, dummy, dummy, function_append_at_EList, dummy, function_cons_at_EList, dummy, dummy, dummy, dummy, dummy, function_in_string_at_IO, dummy, dummy, function_tail_at_ECons, dummy, function_print_at_ECons, function_isNil_at_ECons, dummy, function_out_string_at_IO, dummy, dummy, dummy, dummy +# Function END +# + + +# **** Type RECORD for type ECons **** +ECons_start: + ECons_vtable_pointer: .word ECons_vtable + # Function END +ECons_end: +# + + +# **** VTABLE for type Edge **** +Edge_vtable: .word function_type_name_at_Object, function_in_int_at_IO, function_init_at_Edge, function_copy_at_Object, function_abort_at_Object, function_out_int_at_IO, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, function_in_string_at_IO, dummy, dummy, dummy, dummy, function_print_at_Edge, dummy, dummy, function_out_string_at_IO, dummy, dummy, dummy, dummy +# Function END +# + + +# **** Type RECORD for type Edge **** +Edge_start: + Edge_vtable_pointer: .word Edge_vtable + # Function END +Edge_end: +# + + +# **** VTABLE for type Vertice **** +Vertice_vtable: .word function_type_name_at_Object, function_in_int_at_IO, function_init_at_Vertice, function_copy_at_Object, function_abort_at_Object, function_out_int_at_IO, dummy, dummy, dummy, dummy, dummy, dummy, dummy, function_number_at_Vertice, dummy, function_outgoing_at_Vertice, dummy, dummy, function_in_string_at_IO, dummy, dummy, dummy, dummy, function_print_at_Vertice, dummy, dummy, function_out_string_at_IO, dummy, function_add_out_at_Vertice, dummy, dummy +# Function END +# + + +# **** Type RECORD for type Vertice **** +Vertice_start: + Vertice_vtable_pointer: .word Vertice_vtable + # Function END +Vertice_end: +# + + +data_0: .asciiz "" +# + + +data_1: .asciiz "Abort called from class " +# + + +data_2: .asciiz "\n" +# + + +IO__TDT: .word 0, -1, -1, -1, -1, -1, -1, 1, 2, 1, 2, 1, 2, 1, 1 +Object__TDT: .word 1, 0, 1, 1, 1, 1, 1, 2, 3, 2, 3, 2, 3, 2, 2 +String__TDT: .word -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 +Bool__TDT: .word -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 +Int__TDT: .word -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 +BoolOp__TDT: .word -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1 +Graph__TDT: .word -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1 +Parse__TDT: .word -1, -1, -1, -1, -1, -1, -1, 0, 1, -1, -1, -1, -1, -1, -1 +Main__TDT: .word -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1 +VList__TDT: .word -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, -1, -1, -1, -1 +VCons__TDT: .word -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1 +EList__TDT: .word -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, -1, -1 +ECons__TDT: .word -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1 +Edge__TDT: .word -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1 +Vertice__TDT: .word -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0 +# + + +data_4: .asciiz "\n" +# + + +data_5: .asciiz "" +# + + +data_6: .asciiz "0" +# + + +data_7: .asciiz "1" +# + + +data_8: .asciiz "2" +# + + +data_9: .asciiz "3" +# + + +data_10: .asciiz "4" +# + + +data_11: .asciiz "5" +# + + +data_12: .asciiz "6" +# + + +data_13: .asciiz "7" +# + + +data_14: .asciiz "8" +# + + +data_15: .asciiz "9" +# + + +data_16: .asciiz "-" +# + + +data_17: .asciiz " " +# + + +data_18: .asciiz " " +# + + +data_19: .asciiz "," +# + + +data_20: .asciiz "" +# + + +data_21: .asciiz "" +# + + +data_22: .asciiz "\n" +# + + +data_23: .asciiz "\n" +# + + +data_24: .asciiz " (" +# + + +data_25: .asciiz "," +# + + +data_26: .asciiz ")" +# + + +.text +main: + jal entry + # syscall code 10 is for exit + li $v0, 10 + syscall + # Function END + +# function_in_string_at_IO implementation. +# @Params: +function_in_string_at_IO: + # Allocate stack frame for function function_in_string_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_in_string_at_IO_internal_0 --> -4($fp) + # Allocating 1024 bytes of memory + li $a0, 1024 + li $v0, 9 + syscall + move $t0, $v0 + move $a0, $v0 + li $a1, 1024 + li $v0, 8 + syscall + move $t2, $zero + move $t3, $zero + move $t1, $t0 + lb $t3, 0($t1) + beqz $t3, end_loop + read_length_loop: + lb $t3, 0($t1) + beqz $t3, end_read_length_loop + addu $t1, $t1, 1 + addu $t2, $t2, 1 + j read_length_loop + end_read_length_loop: + subu $t1, $t1, 1 + sb $zero, 0($t1) + subu $t2, $t2, 1 + end_loop: + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $t2, 16($v0) + sw $v0, -4($fp) + # RETURN local_in_string_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_in_string_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_out_int_at_IO implementation. +# @Params: +# 0($fp) = param_out_int_at_IO_x_0 +function_out_int_at_IO: + # Allocate stack frame for function function_out_int_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # PRINT_INT param_out_int_at_IO_x_0 + # PARAM param_out_int_at_IO_x_0 --> 0($fp) + lw $v0, 0($fp) + lw $a0, 12($v0) + li $v0, 1 + syscall + # LOCAL local_out_int_at_IO_internal_0 --> -4($fp) + # local_out_int_at_IO_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_out_int_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_out_int_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_out_string_at_IO implementation. +# @Params: +# 0($fp) = param_out_string_at_IO_x_0 +function_out_string_at_IO: + # Allocate stack frame for function function_out_string_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # PARAM param_out_string_at_IO_x_0 --> 0($fp) + # PRINT_STR param_out_string_at_IO_x_0 + lw $v0, 0($fp) + lw $a0, 12($v0) + li $v0, 4 + syscall + # LOCAL local_out_string_at_IO_internal_0 --> -4($fp) + # local_out_string_at_IO_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_out_string_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_out_string_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_in_int_at_IO implementation. +# @Params: +function_in_int_at_IO: + # Allocate stack frame for function function_in_int_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_in_int_at_IO_internal_0 --> -4($fp) + # local_in_int_at_IO_internal_0 = READ_INT + li $v0, 5 + syscall + move $a2, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + sw $a2, 12($v0) + sw $v0, -4($fp) + # RETURN local_in_int_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_in_int_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_abort_at_Object implementation. +# @Params: +function_abort_at_Object: + # Allocate stack frame for function function_abort_at_Object. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_abort_at_Object_internal_0 --> -4($fp) + lw $t0, 0($s1) + sw $t0, -4($fp) + # LOCAL local_abort_at_Object_internal_0 --> -4($fp) + la $a0, data_1 + li $v0, 4 + syscall + lw $a0, -4($fp) + li $v0, 4 + syscall + la $a0, data_2 + li $v0, 4 + syscall + li $v0, 10 + syscall + # Function END + + +# function_copy_at_Object implementation. +# @Params: +function_copy_at_Object: + # Allocate stack frame for function function_copy_at_Object. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_copy_at_Object_internal_0 --> -4($fp) + # local_copy_at_Object_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_copy_at_Object_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function function_copy_at_Object. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_type_name_at_Object implementation. +# @Params: +function_type_name_at_Object: + # Allocate stack frame for function function_type_name_at_Object. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_type_name_at_Object_internal_0 --> -4($fp) + lw $t0, 0($s1) + sw $t0, -4($fp) + # RETURN local_type_name_at_Object_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_type_name_at_Object. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_concat_at_String implementation. +# @Params: +# 0($fp) = param_concat_at_String_s_0 +function_concat_at_String: + # Allocate stack frame for function function_concat_at_String. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_concat_at_String_internal_0 = self.CONCAT + # LOCAL local_concat_at_String_internal_0 --> -4($fp) + # PARAM param_concat_at_String_s_0 --> 0($fp) + # Get first string length from self + lw $t0, 16($s1) + # Get second string length from param + lw $v0, 0($fp) + lw $t1, 16($v0) + # Save new string length in a0 for memory allocation + addu $a0, $t0, $t1 + move $t3, $a0 + # Get first string from self + lw $t0, 12($s1) + # Get second string from param + lw $t1, 12($v0) + addu $a0, $a0, 4 + li $v0, 9 + syscall + move $t2, $v0 + move $t4, $zero + concat_loop1: + # Compare t0 with \0 + lb $t4, 0($t0) + beqz $t4, concat_loop1_end + # Copy 1 byte + sb $t4, 0($t2) + addu $t2, $t2, 1 + addu $t0, $t0, 1 + j concat_loop1 + concat_loop1_end: + # Copy second string + concat_loop2: + # Compare t1 with \0 + lb $t4, 0($t1) + beqz $t4, concat_loop2_end + # Copy 1 byte + sb $t4, 0($t2) + addu $t2, $t2, 1 + addu $t1, $t1, 1 + j concat_loop2 + concat_loop2_end: + sb $zero, 0($t2) + # v0 contains resulting string + move $t1, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + sw $t1, 12($v0) + sw $t3, 16($v0) + sw $v0, -4($fp) + # RETURN local_concat_at_String_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_concat_at_String. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_substr_at_String implementation. +# @Params: +# 0($fp) = param_substr_at_String_l_0 +# 4($fp) = param_substr_at_String_r_1 +function_substr_at_String: + # Allocate stack frame for function function_substr_at_String. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_substr_at_String_internal_0 --> -4($fp) + # PARAM param_substr_at_String_l_0 --> 4($fp) + # PARAM param_substr_at_String_r_1 --> 0($fp) + lw $t0, 12($s1) + lw $t2, 4($fp) + lw $t2, 12($t2) + addu $t0, $t0, $t2 + lw $a0, 0($fp) + lw $a0, 12($a0) + move $t3, $a0 + move $t1, $a0 + addu $a0, $a0, 1 + li $v0, 9 + syscall + move $t2, $v0 + substr_loop: + beqz $t1, substr_end + lb $a0, 0($t0) + sb $a0, 0($t2) + addu $t0, $t0, 1 + addu $t2, $t2, 1 + subu $t1, $t1, 1 + j substr_loop + substr_end: + sb $zero, 0($t2) + move $t1, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + sw $t1, 12($v0) + sw $t3, 16($v0) + sw $v0, -4($fp) + # RETURN local_substr_at_String_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_substr_at_String. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 8 + jr $ra + # Function END + + +# function_length_at_String implementation. +# @Params: +function_length_at_String: + # Allocate stack frame for function function_length_at_String. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_length_at_String_internal_0 = GETATTRIBUTE length String + # LOCAL local_length_at_String_internal_0 --> -4($fp) + lw $t0, 16($s1) + sw $t0, -4($fp) + # LOCAL local_length_at_String_internal_1 --> -8($fp) + # LOCAL local_length_at_String_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + lw $t0, -4($fp) + sw $t0, 12($v0) + sw $v0, -8($fp) + # RETURN local_length_at_String_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function function_length_at_String. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# entry implementation. +# @Params: +entry: + # Allocate stack frame for function entry. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local__internal_0 --> -4($fp) + # local__internal_0 = ALLOCATE Main + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Main + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 24 bytes of memory + li $a0, 24 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Main_start + sw $t0, 4($v0) + # Load type offset + li $t0, 32 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Parse__attrib__boolop__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 12($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Parse__attrib__rest__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 16($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Main__attrib__g__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 20($t1) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -4($fp) + # LOCAL local__internal_0 --> -4($fp) + lw $s1, -4($fp) + # local__internal_1 = CALL main + # LOCAL local__internal_1 --> -8($fp) + # LOCAL local__internal_0 --> -4($fp) + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type's VTABLE + la $t0, Main_vtable + # Get pointer to function address + lw $t1, 56($t0) + # Call function. Result is on $v0 + jalr $t1 + sw $v0, -8($fp) + # RETURN 0 + li $v0, 0 + # Deallocate stack frame for function entry. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_and_at_BoolOp implementation. +# @Params: +# 0($fp) = param_and_at_BoolOp_b1_0 +# 4($fp) = param_and_at_BoolOp_b2_1 +function_and_at_BoolOp: + # Allocate stack frame for function function_and_at_BoolOp. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_and_at_BoolOp_internal_0 --> -4($fp) + # PARAM param_and_at_BoolOp_b1_0 --> 4($fp) + # Obtain value from 4($fp) + lw $v0, 4($fp) + lw $v0, 12($v0) + sw $v0, -4($fp) + # IF_ZERO local_and_at_BoolOp_internal_0 GOTO label_FALSEIF_1 + # IF_ZERO local_and_at_BoolOp_internal_0 GOTO label_FALSEIF_1 + lw $t0, -4($fp) + beq $t0, 0, label_FALSEIF_1 + # LOCAL local_and_at_BoolOp_internal_1 --> -8($fp) + # PARAM param_and_at_BoolOp_b2_1 --> 0($fp) + # local_and_at_BoolOp_internal_1 = PARAM param_and_at_BoolOp_b2_1 + lw $t0, 0($fp) + sw $t0, -8($fp) + # GOTO label_ENDIF_2 +j label_ENDIF_2 +label_FALSEIF_1: + # LOCAL local_and_at_BoolOp_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -12($fp) + # LOCAL local_and_at_BoolOp_internal_1 --> -8($fp) + # LOCAL local_and_at_BoolOp_internal_2 --> -12($fp) + # local_and_at_BoolOp_internal_1 = local_and_at_BoolOp_internal_2 + lw $t0, -12($fp) + sw $t0, -8($fp) + label_ENDIF_2: +# RETURN local_and_at_BoolOp_internal_1 +lw $v0, -8($fp) +# Deallocate stack frame for function function_and_at_BoolOp. +# Restore $ra +lw $ra, 4($sp) +# Restore $fp +lw $fp, 0($sp) +# Restore Stack pointer $sp +addu $sp, $sp, 32 +# Deallocate function args +addu $sp, $sp, 8 +jr $ra +# Function END + + +# function_or_at_BoolOp implementation. +# @Params: +# 0($fp) = param_or_at_BoolOp_b1_0 +# 4($fp) = param_or_at_BoolOp_b2_1 +function_or_at_BoolOp: + # Allocate stack frame for function function_or_at_BoolOp. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_or_at_BoolOp_internal_0 --> -4($fp) + # PARAM param_or_at_BoolOp_b1_0 --> 4($fp) + # Obtain value from 4($fp) + lw $v0, 4($fp) + lw $v0, 12($v0) + sw $v0, -4($fp) + # IF_ZERO local_or_at_BoolOp_internal_0 GOTO label_FALSEIF_3 + # IF_ZERO local_or_at_BoolOp_internal_0 GOTO label_FALSEIF_3 + lw $t0, -4($fp) + beq $t0, 0, label_FALSEIF_3 + # LOCAL local_or_at_BoolOp_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -12($fp) + # LOCAL local_or_at_BoolOp_internal_1 --> -8($fp) + # LOCAL local_or_at_BoolOp_internal_2 --> -12($fp) + # local_or_at_BoolOp_internal_1 = local_or_at_BoolOp_internal_2 + lw $t0, -12($fp) + sw $t0, -8($fp) + # GOTO label_ENDIF_4 +j label_ENDIF_4 +label_FALSEIF_3: + # LOCAL local_or_at_BoolOp_internal_1 --> -8($fp) + # PARAM param_or_at_BoolOp_b2_1 --> 0($fp) + # local_or_at_BoolOp_internal_1 = PARAM param_or_at_BoolOp_b2_1 + lw $t0, 0($fp) + sw $t0, -8($fp) + label_ENDIF_4: +# RETURN local_or_at_BoolOp_internal_1 +lw $v0, -8($fp) +# Deallocate stack frame for function function_or_at_BoolOp. +# Restore $ra +lw $ra, 4($sp) +# Restore $fp +lw $fp, 0($sp) +# Restore Stack pointer $sp +addu $sp, $sp, 32 +# Deallocate function args +addu $sp, $sp, 8 +jr $ra +# Function END + + +# __Graph__attrib__vertices__init implementation. +# @Params: +__Graph__attrib__vertices__init: + # Allocate stack frame for function __Graph__attrib__vertices__init. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_attrib__vertices__init_internal_1 --> -8($fp) + # local_attrib__vertices__init_internal_1 = ALLOCATE VList + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, VList + sw $t0, 12($v0) + li $t0, 5 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, VList_start + sw $t0, 4($v0) + # Load type offset + li $t0, 36 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __VList__attrib__car__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 12($t1) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -8($fp) + # RETURN local_attrib__vertices__init_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function __Graph__attrib__vertices__init. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# __Graph__attrib__edges__init implementation. +# @Params: +__Graph__attrib__edges__init: + # Allocate stack frame for function __Graph__attrib__edges__init. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_attrib__edges__init_internal_1 --> -8($fp) + # local_attrib__edges__init_internal_1 = ALLOCATE EList + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, EList + sw $t0, 12($v0) + li $t0, 5 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, EList_start + sw $t0, 4($v0) + # Load type offset + li $t0, 44 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __EList__attrib__car__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 12($t1) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -8($fp) + # RETURN local_attrib__edges__init_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function __Graph__attrib__edges__init. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_add_vertice_at_Graph implementation. +# @Params: +# 0($fp) = param_add_vertice_at_Graph_v_0 +function_add_vertice_at_Graph: + # Allocate stack frame for function function_add_vertice_at_Graph. + subu $sp, $sp, 40 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 40 + # LOCAL local_add_vertice_at_Graph_internal_2 --> -12($fp) + # PARAM param_add_vertice_at_Graph_v_0 --> 0($fp) + # local_add_vertice_at_Graph_internal_2 = PARAM param_add_vertice_at_Graph_v_0 + lw $t0, 0($fp) + sw $t0, -12($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_add_vertice_at_Graph_internal_2 --> -12($fp) + # LOCAL local_add_vertice_at_Graph_internal_3 --> -16($fp) + # local_add_vertice_at_Graph_internal_3 = VCALL local_add_vertice_at_Graph_internal_2 outgoing + # Save new self pointer in $s1 + lw $s1, -12($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 60($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -16($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_add_vertice_at_Graph_internal_0 --> -4($fp) + # LOCAL local_add_vertice_at_Graph_internal_3 --> -16($fp) + # local_add_vertice_at_Graph_internal_0 = local_add_vertice_at_Graph_internal_3 + lw $t0, -16($fp) + sw $t0, -4($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # local_add_vertice_at_Graph_internal_4 = GETATTRIBUTE edges Graph + # LOCAL local_add_vertice_at_Graph_internal_4 --> -20($fp) + lw $t0, 16($s1) + sw $t0, -20($fp) + # ARG local_add_vertice_at_Graph_internal_4 + # LOCAL local_add_vertice_at_Graph_internal_4 --> -20($fp) + lw $t0, -20($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_add_vertice_at_Graph_internal_0 --> -4($fp) + # LOCAL local_add_vertice_at_Graph_internal_1 --> -8($fp) + # local_add_vertice_at_Graph_internal_1 = VCALL local_add_vertice_at_Graph_internal_0 append + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 40($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -8($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # + # LOCAL local_add_vertice_at_Graph_internal_1 --> -8($fp) + lw $t0, -8($fp) + sw $t0, 16($s1) + # local_add_vertice_at_Graph_internal_7 = GETATTRIBUTE vertices Graph + # LOCAL local_add_vertice_at_Graph_internal_7 --> -32($fp) + lw $t0, 12($s1) + sw $t0, -32($fp) + # LOCAL local_add_vertice_at_Graph_internal_5 --> -24($fp) + # LOCAL local_add_vertice_at_Graph_internal_7 --> -32($fp) + # local_add_vertice_at_Graph_internal_5 = local_add_vertice_at_Graph_internal_7 + lw $t0, -32($fp) + sw $t0, -24($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # ARG param_add_vertice_at_Graph_v_0 + # PARAM param_add_vertice_at_Graph_v_0 --> 0($fp) + lw $t0, 0($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_add_vertice_at_Graph_internal_5 --> -24($fp) + # LOCAL local_add_vertice_at_Graph_internal_6 --> -28($fp) + # local_add_vertice_at_Graph_internal_6 = VCALL local_add_vertice_at_Graph_internal_5 cons + # Save new self pointer in $s1 + lw $s1, -24($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 48($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -28($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # + # LOCAL local_add_vertice_at_Graph_internal_6 --> -28($fp) + lw $t0, -28($fp) + sw $t0, 12($s1) + # RETURN + # Deallocate stack frame for function function_add_vertice_at_Graph. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 40 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_print_E_at_Graph implementation. +# @Params: +function_print_E_at_Graph: + # Allocate stack frame for function function_print_E_at_Graph. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_print_E_at_Graph_internal_2 = GETATTRIBUTE edges Graph + # LOCAL local_print_E_at_Graph_internal_2 --> -12($fp) + lw $t0, 16($s1) + sw $t0, -12($fp) + # LOCAL local_print_E_at_Graph_internal_0 --> -4($fp) + # LOCAL local_print_E_at_Graph_internal_2 --> -12($fp) + # local_print_E_at_Graph_internal_0 = local_print_E_at_Graph_internal_2 + lw $t0, -12($fp) + sw $t0, -4($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_print_E_at_Graph_internal_0 --> -4($fp) + # LOCAL local_print_E_at_Graph_internal_1 --> -8($fp) + # local_print_E_at_Graph_internal_1 = VCALL local_print_E_at_Graph_internal_0 print + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 92($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -8($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # RETURN local_print_E_at_Graph_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function function_print_E_at_Graph. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_print_V_at_Graph implementation. +# @Params: +function_print_V_at_Graph: + # Allocate stack frame for function function_print_V_at_Graph. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_print_V_at_Graph_internal_2 = GETATTRIBUTE vertices Graph + # LOCAL local_print_V_at_Graph_internal_2 --> -12($fp) + lw $t0, 12($s1) + sw $t0, -12($fp) + # LOCAL local_print_V_at_Graph_internal_0 --> -4($fp) + # LOCAL local_print_V_at_Graph_internal_2 --> -12($fp) + # local_print_V_at_Graph_internal_0 = local_print_V_at_Graph_internal_2 + lw $t0, -12($fp) + sw $t0, -4($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_print_V_at_Graph_internal_0 --> -4($fp) + # LOCAL local_print_V_at_Graph_internal_1 --> -8($fp) + # local_print_V_at_Graph_internal_1 = VCALL local_print_V_at_Graph_internal_0 print + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 92($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -8($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # RETURN local_print_V_at_Graph_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function function_print_V_at_Graph. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# __Parse__attrib__boolop__init implementation. +# @Params: +__Parse__attrib__boolop__init: + # Allocate stack frame for function __Parse__attrib__boolop__init. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_attrib__boolop__init_internal_1 --> -8($fp) + # local_attrib__boolop__init_internal_1 = ALLOCATE BoolOp + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, BoolOp + sw $t0, 12($v0) + li $t0, 6 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 12 bytes of memory + li $a0, 12 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, BoolOp_start + sw $t0, 4($v0) + # Load type offset + li $t0, 20 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -8($fp) + # RETURN local_attrib__boolop__init_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function __Parse__attrib__boolop__init. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# __Parse__attrib__rest__init implementation. +# @Params: +__Parse__attrib__rest__init: + # Allocate stack frame for function __Parse__attrib__rest__init. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_attrib__rest__init_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_0 + sw $t0, 12($v0) + li $t0, 0 + sw $t0, 16($v0) + sw $v0, -4($fp) + # RETURN local_attrib__rest__init_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function __Parse__attrib__rest__init. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_read_input_at_Parse implementation. +# @Params: +function_read_input_at_Parse: + # Allocate stack frame for function function_read_input_at_Parse. + subu $sp, $sp, 112 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 112 + # LOCAL local_read_input_at_Parse_g_0 --> -4($fp) + # local_read_input_at_Parse_g_0 = 0 + li $t0, 0 + sw $t0, -4($fp) + # LOCAL local_read_input_at_Parse_internal_1 --> -8($fp) + # local_read_input_at_Parse_internal_1 = ALLOCATE Graph + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Graph + sw $t0, 12($v0) + li $t0, 5 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Graph_start + sw $t0, 4($v0) + # Load type offset + li $t0, 24 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Graph__attrib__vertices__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 12($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Graph__attrib__edges__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 16($t1) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -8($fp) + # LOCAL local_read_input_at_Parse_g_0 --> -4($fp) + # LOCAL local_read_input_at_Parse_internal_1 --> -8($fp) + # local_read_input_at_Parse_g_0 = local_read_input_at_Parse_internal_1 + lw $t0, -8($fp) + sw $t0, -4($fp) + # LOCAL local_read_input_at_Parse_line_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_0 + sw $t0, 12($v0) + li $t0, 0 + sw $t0, 16($v0) + sw $v0, -12($fp) + # LOCAL local_read_input_at_Parse_internal_5 --> -24($fp) + # local_read_input_at_Parse_internal_5 = SELF + sw $s1, -24($fp) + # LOCAL local_read_input_at_Parse_internal_3 --> -16($fp) + # LOCAL local_read_input_at_Parse_internal_5 --> -24($fp) + # local_read_input_at_Parse_internal_3 = local_read_input_at_Parse_internal_5 + lw $t0, -24($fp) + sw $t0, -16($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_read_input_at_Parse_internal_3 --> -16($fp) + # LOCAL local_read_input_at_Parse_internal_4 --> -20($fp) + # local_read_input_at_Parse_internal_4 = VCALL local_read_input_at_Parse_internal_3 in_string + # Save new self pointer in $s1 + lw $s1, -16($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 72($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -20($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_read_input_at_Parse_line_2 --> -12($fp) + # LOCAL local_read_input_at_Parse_internal_4 --> -20($fp) + # local_read_input_at_Parse_line_2 = local_read_input_at_Parse_internal_4 + lw $t0, -20($fp) + sw $t0, -12($fp) + label_WHILE_5: + # local_read_input_at_Parse_internal_9 = GETATTRIBUTE boolop Parse + # LOCAL local_read_input_at_Parse_internal_9 --> -40($fp) + lw $t0, 12($s1) + sw $t0, -40($fp) + # LOCAL local_read_input_at_Parse_internal_7 --> -32($fp) + # LOCAL local_read_input_at_Parse_internal_9 --> -40($fp) + # local_read_input_at_Parse_internal_7 = local_read_input_at_Parse_internal_9 + lw $t0, -40($fp) + sw $t0, -32($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_read_input_at_Parse_internal_12 --> -52($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_4 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -52($fp) + # IF_ZERO local_read_input_at_Parse_line_2 GOTO label_FALSE_7 + # IF_ZERO local_read_input_at_Parse_line_2 GOTO label_FALSE_7 + lw $t0, -12($fp) + beq $t0, 0, label_FALSE_7 + # IF_ZERO local_read_input_at_Parse_internal_12 GOTO label_FALSE_7 + # IF_ZERO local_read_input_at_Parse_internal_12 GOTO label_FALSE_7 + lw $t0, -52($fp) + beq $t0, 0, label_FALSE_7 + # LOCAL local_read_input_at_Parse_internal_11 --> -48($fp) + # LOCAL local_read_input_at_Parse_line_2 --> -12($fp) + # Comparing -12($fp) type with String + la $v0, String + lw $a0, -12($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -48($fp) + # IF_ZERO local_read_input_at_Parse_internal_11 GOTO label_COMPARE_STRING_10 + # IF_ZERO local_read_input_at_Parse_internal_11 GOTO label_COMPARE_STRING_10 + lw $t0, -48($fp) + beq $t0, 0, label_COMPARE_STRING_10 + # LOCAL local_read_input_at_Parse_internal_11 --> -48($fp) + # LOCAL local_read_input_at_Parse_line_2 --> -12($fp) + # Comparing -12($fp) type with Bool + la $v0, Bool + lw $a0, -12($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -48($fp) + # IF_ZERO local_read_input_at_Parse_internal_11 GOTO label_COMPARE_BY_VALUE_11 + # IF_ZERO local_read_input_at_Parse_internal_11 GOTO label_COMPARE_BY_VALUE_11 + lw $t0, -48($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_11 + # LOCAL local_read_input_at_Parse_internal_11 --> -48($fp) + # LOCAL local_read_input_at_Parse_line_2 --> -12($fp) + # Comparing -12($fp) type with Int + la $v0, Int + lw $a0, -12($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -48($fp) + # IF_ZERO local_read_input_at_Parse_internal_11 GOTO label_COMPARE_BY_VALUE_11 + # IF_ZERO local_read_input_at_Parse_internal_11 GOTO label_COMPARE_BY_VALUE_11 + lw $t0, -48($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_11 + # LOCAL local_read_input_at_Parse_internal_11 --> -48($fp) + # LOCAL local_read_input_at_Parse_line_2 --> -12($fp) + # LOCAL local_read_input_at_Parse_internal_12 --> -52($fp) + # Load pointers and SUB + lw $a0, -12($fp) + lw $a1, -52($fp) + sub $a0, $a0, $a1 + sw $a0, -48($fp) + # IF_ZERO local_read_input_at_Parse_internal_11 GOTO label_TRUE_8 + # IF_ZERO local_read_input_at_Parse_internal_11 GOTO label_TRUE_8 + lw $t0, -48($fp) + beq $t0, 0, label_TRUE_8 + # GOTO label_FALSE_7 + j label_FALSE_7 + label_COMPARE_BY_VALUE_11: + # LOCAL local_read_input_at_Parse_internal_11 --> -48($fp) + # LOCAL local_read_input_at_Parse_line_2 --> -12($fp) + # LOCAL local_read_input_at_Parse_internal_12 --> -52($fp) + lw $a0, -12($fp) + lw $a1, -52($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -48($fp) + # IF_ZERO local_read_input_at_Parse_internal_11 GOTO label_TRUE_8 + # IF_ZERO local_read_input_at_Parse_internal_11 GOTO label_TRUE_8 + lw $t0, -48($fp) + beq $t0, 0, label_TRUE_8 + # GOTO label_FALSE_7 + j label_FALSE_7 + label_COMPARE_STRING_10: + # LOCAL local_read_input_at_Parse_internal_11 --> -48($fp) + # LOCAL local_read_input_at_Parse_line_2 --> -12($fp) + # LOCAL local_read_input_at_Parse_internal_12 --> -52($fp) + # Load strings for comparison + lw $v0, -12($fp) + lw $v1, -52($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -48($fp) + # IF_ZERO local_read_input_at_Parse_internal_11 GOTO label_CONTINUE_12 + # IF_ZERO local_read_input_at_Parse_internal_11 GOTO label_CONTINUE_12 + lw $t0, -48($fp) + beq $t0, 0, label_CONTINUE_12 + # GOTO label_FALSE_7 + j label_FALSE_7 + label_CONTINUE_12: + # LOCAL local_read_input_at_Parse_internal_11 --> -48($fp) + # LOCAL local_read_input_at_Parse_line_2 --> -12($fp) + # LOCAL local_read_input_at_Parse_internal_12 --> -52($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -12($fp) + lw $v1, -52($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_13: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_14 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_13 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_14: + # Store result + sw $a2, -48($fp) + # IF_ZERO local_read_input_at_Parse_internal_11 GOTO label_TRUE_8 + # IF_ZERO local_read_input_at_Parse_internal_11 GOTO label_TRUE_8 + lw $t0, -48($fp) + beq $t0, 0, label_TRUE_8 + label_FALSE_7: + # LOCAL local_read_input_at_Parse_internal_10 --> -44($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -44($fp) + # GOTO label_END_9 +j label_END_9 +label_TRUE_8: + # LOCAL local_read_input_at_Parse_internal_10 --> -44($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -44($fp) + label_END_9: +# LOCAL local_read_input_at_Parse_internal_10 --> -44($fp) +# LOCAL local_read_input_at_Parse_internal_10 --> -44($fp) +# Obtain value from -44($fp) +lw $v0, -44($fp) +lw $v0, 12($v0) +sw $v0, -44($fp) +# IF_ZERO local_read_input_at_Parse_internal_10 GOTO label_FALSE_15 +# IF_ZERO local_read_input_at_Parse_internal_10 GOTO label_FALSE_15 +lw $t0, -44($fp) +beq $t0, 0, label_FALSE_15 +# LOCAL local_read_input_at_Parse_internal_13 --> -56($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Bool +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Bool +sw $t0, 12($v0) +li $t0, 4 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Bool_start +sw $t0, 4($v0) +# Load type offset +li $t0, 12 +sw $t0, 8($v0) +li $t0, 0 +sw $t0, 12($v0) +sw $v0, -56($fp) +# GOTO label_NOT_END_16 +j label_NOT_END_16 +label_FALSE_15: + # LOCAL local_read_input_at_Parse_internal_13 --> -56($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -56($fp) + label_NOT_END_16: + # ARG local_read_input_at_Parse_internal_13 + # LOCAL local_read_input_at_Parse_internal_13 --> -56($fp) + lw $t0, -56($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_read_input_at_Parse_internal_16 --> -68($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_5 + sw $t0, 12($v0) + li $t0, 0 + sw $t0, 16($v0) + sw $v0, -68($fp) + # IF_ZERO local_read_input_at_Parse_line_2 GOTO label_FALSE_17 + # IF_ZERO local_read_input_at_Parse_line_2 GOTO label_FALSE_17 + lw $t0, -12($fp) + beq $t0, 0, label_FALSE_17 + # IF_ZERO local_read_input_at_Parse_internal_16 GOTO label_FALSE_17 + # IF_ZERO local_read_input_at_Parse_internal_16 GOTO label_FALSE_17 + lw $t0, -68($fp) + beq $t0, 0, label_FALSE_17 + # LOCAL local_read_input_at_Parse_internal_15 --> -64($fp) + # LOCAL local_read_input_at_Parse_line_2 --> -12($fp) + # Comparing -12($fp) type with String + la $v0, String + lw $a0, -12($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -64($fp) + # IF_ZERO local_read_input_at_Parse_internal_15 GOTO label_COMPARE_STRING_20 + # IF_ZERO local_read_input_at_Parse_internal_15 GOTO label_COMPARE_STRING_20 + lw $t0, -64($fp) + beq $t0, 0, label_COMPARE_STRING_20 + # LOCAL local_read_input_at_Parse_internal_15 --> -64($fp) + # LOCAL local_read_input_at_Parse_line_2 --> -12($fp) + # Comparing -12($fp) type with Bool + la $v0, Bool + lw $a0, -12($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -64($fp) + # IF_ZERO local_read_input_at_Parse_internal_15 GOTO label_COMPARE_BY_VALUE_21 + # IF_ZERO local_read_input_at_Parse_internal_15 GOTO label_COMPARE_BY_VALUE_21 + lw $t0, -64($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_21 + # LOCAL local_read_input_at_Parse_internal_15 --> -64($fp) + # LOCAL local_read_input_at_Parse_line_2 --> -12($fp) + # Comparing -12($fp) type with Int + la $v0, Int + lw $a0, -12($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -64($fp) + # IF_ZERO local_read_input_at_Parse_internal_15 GOTO label_COMPARE_BY_VALUE_21 + # IF_ZERO local_read_input_at_Parse_internal_15 GOTO label_COMPARE_BY_VALUE_21 + lw $t0, -64($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_21 + # LOCAL local_read_input_at_Parse_internal_15 --> -64($fp) + # LOCAL local_read_input_at_Parse_line_2 --> -12($fp) + # LOCAL local_read_input_at_Parse_internal_16 --> -68($fp) + # Load pointers and SUB + lw $a0, -12($fp) + lw $a1, -68($fp) + sub $a0, $a0, $a1 + sw $a0, -64($fp) + # IF_ZERO local_read_input_at_Parse_internal_15 GOTO label_TRUE_18 + # IF_ZERO local_read_input_at_Parse_internal_15 GOTO label_TRUE_18 + lw $t0, -64($fp) + beq $t0, 0, label_TRUE_18 + # GOTO label_FALSE_17 + j label_FALSE_17 + label_COMPARE_BY_VALUE_21: + # LOCAL local_read_input_at_Parse_internal_15 --> -64($fp) + # LOCAL local_read_input_at_Parse_line_2 --> -12($fp) + # LOCAL local_read_input_at_Parse_internal_16 --> -68($fp) + lw $a0, -12($fp) + lw $a1, -68($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -64($fp) + # IF_ZERO local_read_input_at_Parse_internal_15 GOTO label_TRUE_18 + # IF_ZERO local_read_input_at_Parse_internal_15 GOTO label_TRUE_18 + lw $t0, -64($fp) + beq $t0, 0, label_TRUE_18 + # GOTO label_FALSE_17 + j label_FALSE_17 + label_COMPARE_STRING_20: + # LOCAL local_read_input_at_Parse_internal_15 --> -64($fp) + # LOCAL local_read_input_at_Parse_line_2 --> -12($fp) + # LOCAL local_read_input_at_Parse_internal_16 --> -68($fp) + # Load strings for comparison + lw $v0, -12($fp) + lw $v1, -68($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -64($fp) + # IF_ZERO local_read_input_at_Parse_internal_15 GOTO label_CONTINUE_22 + # IF_ZERO local_read_input_at_Parse_internal_15 GOTO label_CONTINUE_22 + lw $t0, -64($fp) + beq $t0, 0, label_CONTINUE_22 + # GOTO label_FALSE_17 + j label_FALSE_17 + label_CONTINUE_22: + # LOCAL local_read_input_at_Parse_internal_15 --> -64($fp) + # LOCAL local_read_input_at_Parse_line_2 --> -12($fp) + # LOCAL local_read_input_at_Parse_internal_16 --> -68($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -12($fp) + lw $v1, -68($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_23: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_24 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_23 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_24: + # Store result + sw $a2, -64($fp) + # IF_ZERO local_read_input_at_Parse_internal_15 GOTO label_TRUE_18 + # IF_ZERO local_read_input_at_Parse_internal_15 GOTO label_TRUE_18 + lw $t0, -64($fp) + beq $t0, 0, label_TRUE_18 + label_FALSE_17: + # LOCAL local_read_input_at_Parse_internal_14 --> -60($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -60($fp) + # GOTO label_END_19 +j label_END_19 +label_TRUE_18: + # LOCAL local_read_input_at_Parse_internal_14 --> -60($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -60($fp) + label_END_19: +# LOCAL local_read_input_at_Parse_internal_14 --> -60($fp) +# LOCAL local_read_input_at_Parse_internal_14 --> -60($fp) +# Obtain value from -60($fp) +lw $v0, -60($fp) +lw $v0, 12($v0) +sw $v0, -60($fp) +# IF_ZERO local_read_input_at_Parse_internal_14 GOTO label_FALSE_25 +# IF_ZERO local_read_input_at_Parse_internal_14 GOTO label_FALSE_25 +lw $t0, -60($fp) +beq $t0, 0, label_FALSE_25 +# LOCAL local_read_input_at_Parse_internal_17 --> -72($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Bool +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Bool +sw $t0, 12($v0) +li $t0, 4 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Bool_start +sw $t0, 4($v0) +# Load type offset +li $t0, 12 +sw $t0, 8($v0) +li $t0, 0 +sw $t0, 12($v0) +sw $v0, -72($fp) +# GOTO label_NOT_END_26 +j label_NOT_END_26 +label_FALSE_25: + # LOCAL local_read_input_at_Parse_internal_17 --> -72($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -72($fp) + label_NOT_END_26: + # ARG local_read_input_at_Parse_internal_17 + # LOCAL local_read_input_at_Parse_internal_17 --> -72($fp) + lw $t0, -72($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_read_input_at_Parse_internal_7 --> -32($fp) + # LOCAL local_read_input_at_Parse_internal_8 --> -36($fp) + # local_read_input_at_Parse_internal_8 = VCALL local_read_input_at_Parse_internal_7 and + # Save new self pointer in $s1 + lw $s1, -32($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 76($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -36($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_read_input_at_Parse_internal_6 --> -28($fp) + # LOCAL local_read_input_at_Parse_internal_8 --> -36($fp) + # Obtain value from -36($fp) + lw $v0, -36($fp) + lw $v0, 12($v0) + sw $v0, -28($fp) + # IF_ZERO local_read_input_at_Parse_internal_6 GOTO label_WHILE_END_6 + # IF_ZERO local_read_input_at_Parse_internal_6 GOTO label_WHILE_END_6 + lw $t0, -28($fp) + beq $t0, 0, label_WHILE_END_6 + # LOCAL local_read_input_at_Parse_internal_18 --> -76($fp) + # LOCAL local_read_input_at_Parse_g_0 --> -4($fp) + # local_read_input_at_Parse_internal_18 = local_read_input_at_Parse_g_0 + lw $t0, -4($fp) + sw $t0, -76($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_read_input_at_Parse_internal_22 --> -92($fp) + # local_read_input_at_Parse_internal_22 = SELF + sw $s1, -92($fp) + # LOCAL local_read_input_at_Parse_internal_20 --> -84($fp) + # LOCAL local_read_input_at_Parse_internal_22 --> -92($fp) + # local_read_input_at_Parse_internal_20 = local_read_input_at_Parse_internal_22 + lw $t0, -92($fp) + sw $t0, -84($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # ARG local_read_input_at_Parse_line_2 + # LOCAL local_read_input_at_Parse_line_2 --> -12($fp) + lw $t0, -12($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_read_input_at_Parse_internal_20 --> -84($fp) + # LOCAL local_read_input_at_Parse_internal_21 --> -88($fp) + # local_read_input_at_Parse_internal_21 = VCALL local_read_input_at_Parse_internal_20 parse_line + # Save new self pointer in $s1 + lw $s1, -84($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 32($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -88($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # ARG local_read_input_at_Parse_internal_21 + # LOCAL local_read_input_at_Parse_internal_21 --> -88($fp) + lw $t0, -88($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_read_input_at_Parse_internal_18 --> -76($fp) + # LOCAL local_read_input_at_Parse_internal_19 --> -80($fp) + # local_read_input_at_Parse_internal_19 = VCALL local_read_input_at_Parse_internal_18 add_vertice + # Save new self pointer in $s1 + lw $s1, -76($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 120($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -80($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_read_input_at_Parse_internal_25 --> -104($fp) + # local_read_input_at_Parse_internal_25 = SELF + sw $s1, -104($fp) + # LOCAL local_read_input_at_Parse_internal_23 --> -96($fp) + # LOCAL local_read_input_at_Parse_internal_25 --> -104($fp) + # local_read_input_at_Parse_internal_23 = local_read_input_at_Parse_internal_25 + lw $t0, -104($fp) + sw $t0, -96($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_read_input_at_Parse_internal_23 --> -96($fp) + # LOCAL local_read_input_at_Parse_internal_24 --> -100($fp) + # local_read_input_at_Parse_internal_24 = VCALL local_read_input_at_Parse_internal_23 in_string + # Save new self pointer in $s1 + lw $s1, -96($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 72($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -100($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_read_input_at_Parse_line_2 --> -12($fp) + # LOCAL local_read_input_at_Parse_internal_24 --> -100($fp) + # local_read_input_at_Parse_line_2 = local_read_input_at_Parse_internal_24 + lw $t0, -100($fp) + sw $t0, -12($fp) + # GOTO label_WHILE_5 + j label_WHILE_5 + label_WHILE_END_6: + # RETURN local_read_input_at_Parse_g_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_read_input_at_Parse. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 112 + jr $ra + # Function END + + +# function_parse_line_at_Parse implementation. +# @Params: +# 0($fp) = param_parse_line_at_Parse_s_0 +function_parse_line_at_Parse: + # Allocate stack frame for function function_parse_line_at_Parse. + subu $sp, $sp, 136 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 136 + # LOCAL local_parse_line_at_Parse_v_0 --> -4($fp) + # local_parse_line_at_Parse_v_0 = 0 + li $t0, 0 + sw $t0, -4($fp) + # LOCAL local_parse_line_at_Parse_internal_3 --> -16($fp) + # local_parse_line_at_Parse_internal_3 = ALLOCATE Vertice + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Vertice + sw $t0, 12($v0) + li $t0, 7 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Vertice_start + sw $t0, 4($v0) + # Load type offset + li $t0, 56 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Vertice__attrib__num__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 12($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Vertice__attrib__out__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 16($t1) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -16($fp) + # LOCAL local_parse_line_at_Parse_internal_1 --> -8($fp) + # LOCAL local_parse_line_at_Parse_internal_3 --> -16($fp) + # local_parse_line_at_Parse_internal_1 = local_parse_line_at_Parse_internal_3 + lw $t0, -16($fp) + sw $t0, -8($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_parse_line_at_Parse_internal_6 --> -28($fp) + # local_parse_line_at_Parse_internal_6 = SELF + sw $s1, -28($fp) + # LOCAL local_parse_line_at_Parse_internal_4 --> -20($fp) + # LOCAL local_parse_line_at_Parse_internal_6 --> -28($fp) + # local_parse_line_at_Parse_internal_4 = local_parse_line_at_Parse_internal_6 + lw $t0, -28($fp) + sw $t0, -20($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # ARG param_parse_line_at_Parse_s_0 + # PARAM param_parse_line_at_Parse_s_0 --> 0($fp) + lw $t0, 0($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_parse_line_at_Parse_internal_4 --> -20($fp) + # LOCAL local_parse_line_at_Parse_internal_5 --> -24($fp) + # local_parse_line_at_Parse_internal_5 = VCALL local_parse_line_at_Parse_internal_4 a2i + # Save new self pointer in $s1 + lw $s1, -20($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 44($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -24($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # ARG local_parse_line_at_Parse_internal_5 + # LOCAL local_parse_line_at_Parse_internal_5 --> -24($fp) + lw $t0, -24($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_parse_line_at_Parse_internal_1 --> -8($fp) + # LOCAL local_parse_line_at_Parse_internal_2 --> -12($fp) + # local_parse_line_at_Parse_internal_2 = VCALL local_parse_line_at_Parse_internal_1 init + # Save new self pointer in $s1 + lw $s1, -8($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 8($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -12($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_parse_line_at_Parse_v_0 --> -4($fp) + # LOCAL local_parse_line_at_Parse_internal_2 --> -12($fp) + # local_parse_line_at_Parse_v_0 = local_parse_line_at_Parse_internal_2 + lw $t0, -12($fp) + sw $t0, -4($fp) + label_WHILE_27: + # local_parse_line_at_Parse_internal_12 = GETATTRIBUTE rest Parse + # LOCAL local_parse_line_at_Parse_internal_12 --> -52($fp) + lw $t0, 16($s1) + sw $t0, -52($fp) + # LOCAL local_parse_line_at_Parse_internal_10 --> -44($fp) + # LOCAL local_parse_line_at_Parse_internal_12 --> -52($fp) + # local_parse_line_at_Parse_internal_10 = local_parse_line_at_Parse_internal_12 + lw $t0, -52($fp) + sw $t0, -44($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_parse_line_at_Parse_internal_10 --> -44($fp) + # LOCAL local_parse_line_at_Parse_internal_11 --> -48($fp) + # local_parse_line_at_Parse_internal_11 = VCALL local_parse_line_at_Parse_internal_10 length + # Save new self pointer in $s1 + lw $s1, -44($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 36($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -48($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_parse_line_at_Parse_internal_13 --> -56($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -56($fp) + # IF_ZERO local_parse_line_at_Parse_internal_11 GOTO label_FALSE_29 + # IF_ZERO local_parse_line_at_Parse_internal_11 GOTO label_FALSE_29 + lw $t0, -48($fp) + beq $t0, 0, label_FALSE_29 + # IF_ZERO local_parse_line_at_Parse_internal_13 GOTO label_FALSE_29 + # IF_ZERO local_parse_line_at_Parse_internal_13 GOTO label_FALSE_29 + lw $t0, -56($fp) + beq $t0, 0, label_FALSE_29 + # LOCAL local_parse_line_at_Parse_internal_9 --> -40($fp) + # LOCAL local_parse_line_at_Parse_internal_11 --> -48($fp) + # Comparing -48($fp) type with String + la $v0, String + lw $a0, -48($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -40($fp) + # IF_ZERO local_parse_line_at_Parse_internal_9 GOTO label_COMPARE_STRING_32 + # IF_ZERO local_parse_line_at_Parse_internal_9 GOTO label_COMPARE_STRING_32 + lw $t0, -40($fp) + beq $t0, 0, label_COMPARE_STRING_32 + # LOCAL local_parse_line_at_Parse_internal_9 --> -40($fp) + # LOCAL local_parse_line_at_Parse_internal_11 --> -48($fp) + # Comparing -48($fp) type with Bool + la $v0, Bool + lw $a0, -48($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -40($fp) + # IF_ZERO local_parse_line_at_Parse_internal_9 GOTO label_COMPARE_BY_VALUE_33 + # IF_ZERO local_parse_line_at_Parse_internal_9 GOTO label_COMPARE_BY_VALUE_33 + lw $t0, -40($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_33 + # LOCAL local_parse_line_at_Parse_internal_9 --> -40($fp) + # LOCAL local_parse_line_at_Parse_internal_11 --> -48($fp) + # Comparing -48($fp) type with Int + la $v0, Int + lw $a0, -48($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -40($fp) + # IF_ZERO local_parse_line_at_Parse_internal_9 GOTO label_COMPARE_BY_VALUE_33 + # IF_ZERO local_parse_line_at_Parse_internal_9 GOTO label_COMPARE_BY_VALUE_33 + lw $t0, -40($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_33 + # LOCAL local_parse_line_at_Parse_internal_9 --> -40($fp) + # LOCAL local_parse_line_at_Parse_internal_11 --> -48($fp) + # LOCAL local_parse_line_at_Parse_internal_13 --> -56($fp) + # Load pointers and SUB + lw $a0, -48($fp) + lw $a1, -56($fp) + sub $a0, $a0, $a1 + sw $a0, -40($fp) + # IF_ZERO local_parse_line_at_Parse_internal_9 GOTO label_TRUE_30 + # IF_ZERO local_parse_line_at_Parse_internal_9 GOTO label_TRUE_30 + lw $t0, -40($fp) + beq $t0, 0, label_TRUE_30 + # GOTO label_FALSE_29 + j label_FALSE_29 + label_COMPARE_BY_VALUE_33: + # LOCAL local_parse_line_at_Parse_internal_9 --> -40($fp) + # LOCAL local_parse_line_at_Parse_internal_11 --> -48($fp) + # LOCAL local_parse_line_at_Parse_internal_13 --> -56($fp) + lw $a0, -48($fp) + lw $a1, -56($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -40($fp) + # IF_ZERO local_parse_line_at_Parse_internal_9 GOTO label_TRUE_30 + # IF_ZERO local_parse_line_at_Parse_internal_9 GOTO label_TRUE_30 + lw $t0, -40($fp) + beq $t0, 0, label_TRUE_30 + # GOTO label_FALSE_29 + j label_FALSE_29 + label_COMPARE_STRING_32: + # LOCAL local_parse_line_at_Parse_internal_9 --> -40($fp) + # LOCAL local_parse_line_at_Parse_internal_11 --> -48($fp) + # LOCAL local_parse_line_at_Parse_internal_13 --> -56($fp) + # Load strings for comparison + lw $v0, -48($fp) + lw $v1, -56($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -40($fp) + # IF_ZERO local_parse_line_at_Parse_internal_9 GOTO label_CONTINUE_34 + # IF_ZERO local_parse_line_at_Parse_internal_9 GOTO label_CONTINUE_34 + lw $t0, -40($fp) + beq $t0, 0, label_CONTINUE_34 + # GOTO label_FALSE_29 + j label_FALSE_29 + label_CONTINUE_34: + # LOCAL local_parse_line_at_Parse_internal_9 --> -40($fp) + # LOCAL local_parse_line_at_Parse_internal_11 --> -48($fp) + # LOCAL local_parse_line_at_Parse_internal_13 --> -56($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -48($fp) + lw $v1, -56($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_35: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_36 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_35 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_36: + # Store result + sw $a2, -40($fp) + # IF_ZERO local_parse_line_at_Parse_internal_9 GOTO label_TRUE_30 + # IF_ZERO local_parse_line_at_Parse_internal_9 GOTO label_TRUE_30 + lw $t0, -40($fp) + beq $t0, 0, label_TRUE_30 + label_FALSE_29: + # LOCAL local_parse_line_at_Parse_internal_8 --> -36($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -36($fp) + # GOTO label_END_31 +j label_END_31 +label_TRUE_30: + # LOCAL local_parse_line_at_Parse_internal_8 --> -36($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -36($fp) + label_END_31: +# LOCAL local_parse_line_at_Parse_internal_8 --> -36($fp) +# LOCAL local_parse_line_at_Parse_internal_8 --> -36($fp) +# Obtain value from -36($fp) +lw $v0, -36($fp) +lw $v0, 12($v0) +sw $v0, -36($fp) +# IF_ZERO local_parse_line_at_Parse_internal_8 GOTO label_FALSE_37 +# IF_ZERO local_parse_line_at_Parse_internal_8 GOTO label_FALSE_37 +lw $t0, -36($fp) +beq $t0, 0, label_FALSE_37 +# LOCAL local_parse_line_at_Parse_internal_14 --> -60($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Bool +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Bool +sw $t0, 12($v0) +li $t0, 4 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Bool_start +sw $t0, 4($v0) +# Load type offset +li $t0, 12 +sw $t0, 8($v0) +li $t0, 0 +sw $t0, 12($v0) +sw $v0, -60($fp) +# GOTO label_NOT_END_38 +j label_NOT_END_38 +label_FALSE_37: + # LOCAL local_parse_line_at_Parse_internal_14 --> -60($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -60($fp) + label_NOT_END_38: + # LOCAL local_parse_line_at_Parse_internal_7 --> -32($fp) + # LOCAL local_parse_line_at_Parse_internal_14 --> -60($fp) + # Obtain value from -60($fp) + lw $v0, -60($fp) + lw $v0, 12($v0) + sw $v0, -32($fp) + # IF_ZERO local_parse_line_at_Parse_internal_7 GOTO label_WHILE_END_28 + # IF_ZERO local_parse_line_at_Parse_internal_7 GOTO label_WHILE_END_28 + lw $t0, -32($fp) + beq $t0, 0, label_WHILE_END_28 + # LOCAL local_parse_line_at_Parse_succ_15 --> -64($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -64($fp) + # LOCAL local_parse_line_at_Parse_internal_18 --> -76($fp) + # local_parse_line_at_Parse_internal_18 = SELF + sw $s1, -76($fp) + # LOCAL local_parse_line_at_Parse_internal_16 --> -68($fp) + # LOCAL local_parse_line_at_Parse_internal_18 --> -76($fp) + # local_parse_line_at_Parse_internal_16 = local_parse_line_at_Parse_internal_18 + lw $t0, -76($fp) + sw $t0, -68($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # local_parse_line_at_Parse_internal_19 = GETATTRIBUTE rest Parse + # LOCAL local_parse_line_at_Parse_internal_19 --> -80($fp) + lw $t0, 16($s1) + sw $t0, -80($fp) + # ARG local_parse_line_at_Parse_internal_19 + # LOCAL local_parse_line_at_Parse_internal_19 --> -80($fp) + lw $t0, -80($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_parse_line_at_Parse_internal_16 --> -68($fp) + # LOCAL local_parse_line_at_Parse_internal_17 --> -72($fp) + # local_parse_line_at_Parse_internal_17 = VCALL local_parse_line_at_Parse_internal_16 a2i + # Save new self pointer in $s1 + lw $s1, -68($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 44($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -72($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_parse_line_at_Parse_succ_15 --> -64($fp) + # LOCAL local_parse_line_at_Parse_internal_17 --> -72($fp) + # local_parse_line_at_Parse_succ_15 = local_parse_line_at_Parse_internal_17 + lw $t0, -72($fp) + sw $t0, -64($fp) + # LOCAL local_parse_line_at_Parse_weight_20 --> -84($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -84($fp) + # LOCAL local_parse_line_at_Parse_internal_23 --> -96($fp) + # local_parse_line_at_Parse_internal_23 = SELF + sw $s1, -96($fp) + # LOCAL local_parse_line_at_Parse_internal_21 --> -88($fp) + # LOCAL local_parse_line_at_Parse_internal_23 --> -96($fp) + # local_parse_line_at_Parse_internal_21 = local_parse_line_at_Parse_internal_23 + lw $t0, -96($fp) + sw $t0, -88($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # local_parse_line_at_Parse_internal_24 = GETATTRIBUTE rest Parse + # LOCAL local_parse_line_at_Parse_internal_24 --> -100($fp) + lw $t0, 16($s1) + sw $t0, -100($fp) + # ARG local_parse_line_at_Parse_internal_24 + # LOCAL local_parse_line_at_Parse_internal_24 --> -100($fp) + lw $t0, -100($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_parse_line_at_Parse_internal_21 --> -88($fp) + # LOCAL local_parse_line_at_Parse_internal_22 --> -92($fp) + # local_parse_line_at_Parse_internal_22 = VCALL local_parse_line_at_Parse_internal_21 a2i + # Save new self pointer in $s1 + lw $s1, -88($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 44($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -92($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_parse_line_at_Parse_weight_20 --> -84($fp) + # LOCAL local_parse_line_at_Parse_internal_22 --> -92($fp) + # local_parse_line_at_Parse_weight_20 = local_parse_line_at_Parse_internal_22 + lw $t0, -92($fp) + sw $t0, -84($fp) + # LOCAL local_parse_line_at_Parse_internal_25 --> -104($fp) + # LOCAL local_parse_line_at_Parse_v_0 --> -4($fp) + # local_parse_line_at_Parse_internal_25 = local_parse_line_at_Parse_v_0 + lw $t0, -4($fp) + sw $t0, -104($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_parse_line_at_Parse_internal_29 --> -120($fp) + # local_parse_line_at_Parse_internal_29 = ALLOCATE Edge + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Edge + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 24 bytes of memory + li $a0, 24 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Edge_start + sw $t0, 4($v0) + # Load type offset + li $t0, 52 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Edge__attrib__from__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 12($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Edge__attrib__to__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 16($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Edge__attrib__weight__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 20($t1) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -120($fp) + # LOCAL local_parse_line_at_Parse_internal_27 --> -112($fp) + # LOCAL local_parse_line_at_Parse_internal_29 --> -120($fp) + # local_parse_line_at_Parse_internal_27 = local_parse_line_at_Parse_internal_29 + lw $t0, -120($fp) + sw $t0, -112($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_parse_line_at_Parse_internal_30 --> -124($fp) + # LOCAL local_parse_line_at_Parse_v_0 --> -4($fp) + # local_parse_line_at_Parse_internal_30 = local_parse_line_at_Parse_v_0 + lw $t0, -4($fp) + sw $t0, -124($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_parse_line_at_Parse_internal_30 --> -124($fp) + # LOCAL local_parse_line_at_Parse_internal_31 --> -128($fp) + # local_parse_line_at_Parse_internal_31 = VCALL local_parse_line_at_Parse_internal_30 number + # Save new self pointer in $s1 + lw $s1, -124($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 52($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -128($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # ARG local_parse_line_at_Parse_internal_31 + # LOCAL local_parse_line_at_Parse_internal_31 --> -128($fp) + lw $t0, -128($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # ARG local_parse_line_at_Parse_succ_15 + # LOCAL local_parse_line_at_Parse_succ_15 --> -64($fp) + lw $t0, -64($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # ARG local_parse_line_at_Parse_weight_20 + # LOCAL local_parse_line_at_Parse_weight_20 --> -84($fp) + lw $t0, -84($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_parse_line_at_Parse_internal_27 --> -112($fp) + # LOCAL local_parse_line_at_Parse_internal_28 --> -116($fp) + # local_parse_line_at_Parse_internal_28 = VCALL local_parse_line_at_Parse_internal_27 init + # Save new self pointer in $s1 + lw $s1, -112($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 8($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -116($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # ARG local_parse_line_at_Parse_internal_28 + # LOCAL local_parse_line_at_Parse_internal_28 --> -116($fp) + lw $t0, -116($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_parse_line_at_Parse_internal_25 --> -104($fp) + # LOCAL local_parse_line_at_Parse_internal_26 --> -108($fp) + # local_parse_line_at_Parse_internal_26 = VCALL local_parse_line_at_Parse_internal_25 add_out + # Save new self pointer in $s1 + lw $s1, -104($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 112($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -108($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # GOTO label_WHILE_27 + j label_WHILE_27 + label_WHILE_END_28: + # RETURN local_parse_line_at_Parse_v_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_parse_line_at_Parse. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 136 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_c2i_at_Parse implementation. +# @Params: +# 0($fp) = param_c2i_at_Parse_char_0 +function_c2i_at_Parse: + # Allocate stack frame for function function_c2i_at_Parse. + subu $sp, $sp, 264 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 264 + # LOCAL local_c2i_at_Parse_internal_4 --> -20($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_6 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -20($fp) + # IF_ZERO param_c2i_at_Parse_char_0 GOTO label_FALSE_41 + # IF_ZERO param_c2i_at_Parse_char_0 GOTO label_FALSE_41 + lw $t0, 0($fp) + beq $t0, 0, label_FALSE_41 + # IF_ZERO local_c2i_at_Parse_internal_4 GOTO label_FALSE_41 + # IF_ZERO local_c2i_at_Parse_internal_4 GOTO label_FALSE_41 + lw $t0, -20($fp) + beq $t0, 0, label_FALSE_41 + # LOCAL local_c2i_at_Parse_internal_3 --> -16($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # Comparing 0($fp) type with String + la $v0, String + lw $a0, 0($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -16($fp) + # IF_ZERO local_c2i_at_Parse_internal_3 GOTO label_COMPARE_STRING_44 + # IF_ZERO local_c2i_at_Parse_internal_3 GOTO label_COMPARE_STRING_44 + lw $t0, -16($fp) + beq $t0, 0, label_COMPARE_STRING_44 + # LOCAL local_c2i_at_Parse_internal_3 --> -16($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # Comparing 0($fp) type with Bool + la $v0, Bool + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -16($fp) + # IF_ZERO local_c2i_at_Parse_internal_3 GOTO label_COMPARE_BY_VALUE_45 + # IF_ZERO local_c2i_at_Parse_internal_3 GOTO label_COMPARE_BY_VALUE_45 + lw $t0, -16($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_45 + # LOCAL local_c2i_at_Parse_internal_3 --> -16($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # Comparing 0($fp) type with Int + la $v0, Int + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -16($fp) + # IF_ZERO local_c2i_at_Parse_internal_3 GOTO label_COMPARE_BY_VALUE_45 + # IF_ZERO local_c2i_at_Parse_internal_3 GOTO label_COMPARE_BY_VALUE_45 + lw $t0, -16($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_45 + # LOCAL local_c2i_at_Parse_internal_3 --> -16($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # LOCAL local_c2i_at_Parse_internal_4 --> -20($fp) + # Load pointers and SUB + lw $a0, 0($fp) + lw $a1, -20($fp) + sub $a0, $a0, $a1 + sw $a0, -16($fp) + # IF_ZERO local_c2i_at_Parse_internal_3 GOTO label_TRUE_42 + # IF_ZERO local_c2i_at_Parse_internal_3 GOTO label_TRUE_42 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_42 + # GOTO label_FALSE_41 + j label_FALSE_41 + label_COMPARE_BY_VALUE_45: + # LOCAL local_c2i_at_Parse_internal_3 --> -16($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # LOCAL local_c2i_at_Parse_internal_4 --> -20($fp) + lw $a0, 0($fp) + lw $a1, -20($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -16($fp) + # IF_ZERO local_c2i_at_Parse_internal_3 GOTO label_TRUE_42 + # IF_ZERO local_c2i_at_Parse_internal_3 GOTO label_TRUE_42 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_42 + # GOTO label_FALSE_41 + j label_FALSE_41 + label_COMPARE_STRING_44: + # LOCAL local_c2i_at_Parse_internal_3 --> -16($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # LOCAL local_c2i_at_Parse_internal_4 --> -20($fp) + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -20($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -16($fp) + # IF_ZERO local_c2i_at_Parse_internal_3 GOTO label_CONTINUE_46 + # IF_ZERO local_c2i_at_Parse_internal_3 GOTO label_CONTINUE_46 + lw $t0, -16($fp) + beq $t0, 0, label_CONTINUE_46 + # GOTO label_FALSE_41 + j label_FALSE_41 + label_CONTINUE_46: + # LOCAL local_c2i_at_Parse_internal_3 --> -16($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # LOCAL local_c2i_at_Parse_internal_4 --> -20($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -20($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_47: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_48 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_47 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_48: + # Store result + sw $a2, -16($fp) + # IF_ZERO local_c2i_at_Parse_internal_3 GOTO label_TRUE_42 + # IF_ZERO local_c2i_at_Parse_internal_3 GOTO label_TRUE_42 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_42 + label_FALSE_41: + # LOCAL local_c2i_at_Parse_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -12($fp) + # GOTO label_END_43 +j label_END_43 +label_TRUE_42: + # LOCAL local_c2i_at_Parse_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -12($fp) + label_END_43: +# LOCAL local_c2i_at_Parse_internal_0 --> -4($fp) +# LOCAL local_c2i_at_Parse_internal_2 --> -12($fp) +# Obtain value from -12($fp) +lw $v0, -12($fp) +lw $v0, 12($v0) +sw $v0, -4($fp) +# IF_ZERO local_c2i_at_Parse_internal_0 GOTO label_FALSEIF_39 +# IF_ZERO local_c2i_at_Parse_internal_0 GOTO label_FALSEIF_39 +lw $t0, -4($fp) +beq $t0, 0, label_FALSEIF_39 +# LOCAL local_c2i_at_Parse_internal_5 --> -24($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 0 +sw $t0, 12($v0) +sw $v0, -24($fp) +# LOCAL local_c2i_at_Parse_internal_1 --> -8($fp) +# LOCAL local_c2i_at_Parse_internal_5 --> -24($fp) +# local_c2i_at_Parse_internal_1 = local_c2i_at_Parse_internal_5 +lw $t0, -24($fp) +sw $t0, -8($fp) +# GOTO label_ENDIF_40 +j label_ENDIF_40 +label_FALSEIF_39: + # LOCAL local_c2i_at_Parse_internal_10 --> -44($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_7 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -44($fp) + # IF_ZERO param_c2i_at_Parse_char_0 GOTO label_FALSE_51 + # IF_ZERO param_c2i_at_Parse_char_0 GOTO label_FALSE_51 + lw $t0, 0($fp) + beq $t0, 0, label_FALSE_51 + # IF_ZERO local_c2i_at_Parse_internal_10 GOTO label_FALSE_51 + # IF_ZERO local_c2i_at_Parse_internal_10 GOTO label_FALSE_51 + lw $t0, -44($fp) + beq $t0, 0, label_FALSE_51 + # LOCAL local_c2i_at_Parse_internal_9 --> -40($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # Comparing 0($fp) type with String + la $v0, String + lw $a0, 0($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -40($fp) + # IF_ZERO local_c2i_at_Parse_internal_9 GOTO label_COMPARE_STRING_54 + # IF_ZERO local_c2i_at_Parse_internal_9 GOTO label_COMPARE_STRING_54 + lw $t0, -40($fp) + beq $t0, 0, label_COMPARE_STRING_54 + # LOCAL local_c2i_at_Parse_internal_9 --> -40($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # Comparing 0($fp) type with Bool + la $v0, Bool + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -40($fp) + # IF_ZERO local_c2i_at_Parse_internal_9 GOTO label_COMPARE_BY_VALUE_55 + # IF_ZERO local_c2i_at_Parse_internal_9 GOTO label_COMPARE_BY_VALUE_55 + lw $t0, -40($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_55 + # LOCAL local_c2i_at_Parse_internal_9 --> -40($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # Comparing 0($fp) type with Int + la $v0, Int + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -40($fp) + # IF_ZERO local_c2i_at_Parse_internal_9 GOTO label_COMPARE_BY_VALUE_55 + # IF_ZERO local_c2i_at_Parse_internal_9 GOTO label_COMPARE_BY_VALUE_55 + lw $t0, -40($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_55 + # LOCAL local_c2i_at_Parse_internal_9 --> -40($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # LOCAL local_c2i_at_Parse_internal_10 --> -44($fp) + # Load pointers and SUB + lw $a0, 0($fp) + lw $a1, -44($fp) + sub $a0, $a0, $a1 + sw $a0, -40($fp) + # IF_ZERO local_c2i_at_Parse_internal_9 GOTO label_TRUE_52 + # IF_ZERO local_c2i_at_Parse_internal_9 GOTO label_TRUE_52 + lw $t0, -40($fp) + beq $t0, 0, label_TRUE_52 + # GOTO label_FALSE_51 + j label_FALSE_51 + label_COMPARE_BY_VALUE_55: + # LOCAL local_c2i_at_Parse_internal_9 --> -40($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # LOCAL local_c2i_at_Parse_internal_10 --> -44($fp) + lw $a0, 0($fp) + lw $a1, -44($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -40($fp) + # IF_ZERO local_c2i_at_Parse_internal_9 GOTO label_TRUE_52 + # IF_ZERO local_c2i_at_Parse_internal_9 GOTO label_TRUE_52 + lw $t0, -40($fp) + beq $t0, 0, label_TRUE_52 + # GOTO label_FALSE_51 + j label_FALSE_51 + label_COMPARE_STRING_54: + # LOCAL local_c2i_at_Parse_internal_9 --> -40($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # LOCAL local_c2i_at_Parse_internal_10 --> -44($fp) + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -44($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -40($fp) + # IF_ZERO local_c2i_at_Parse_internal_9 GOTO label_CONTINUE_56 + # IF_ZERO local_c2i_at_Parse_internal_9 GOTO label_CONTINUE_56 + lw $t0, -40($fp) + beq $t0, 0, label_CONTINUE_56 + # GOTO label_FALSE_51 + j label_FALSE_51 + label_CONTINUE_56: + # LOCAL local_c2i_at_Parse_internal_9 --> -40($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # LOCAL local_c2i_at_Parse_internal_10 --> -44($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -44($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_57: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_58 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_57 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_58: + # Store result + sw $a2, -40($fp) + # IF_ZERO local_c2i_at_Parse_internal_9 GOTO label_TRUE_52 + # IF_ZERO local_c2i_at_Parse_internal_9 GOTO label_TRUE_52 + lw $t0, -40($fp) + beq $t0, 0, label_TRUE_52 + label_FALSE_51: + # LOCAL local_c2i_at_Parse_internal_8 --> -36($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -36($fp) + # GOTO label_END_53 +j label_END_53 +label_TRUE_52: + # LOCAL local_c2i_at_Parse_internal_8 --> -36($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -36($fp) + label_END_53: +# LOCAL local_c2i_at_Parse_internal_6 --> -28($fp) +# LOCAL local_c2i_at_Parse_internal_8 --> -36($fp) +# Obtain value from -36($fp) +lw $v0, -36($fp) +lw $v0, 12($v0) +sw $v0, -28($fp) +# IF_ZERO local_c2i_at_Parse_internal_6 GOTO label_FALSEIF_49 +# IF_ZERO local_c2i_at_Parse_internal_6 GOTO label_FALSEIF_49 +lw $t0, -28($fp) +beq $t0, 0, label_FALSEIF_49 +# LOCAL local_c2i_at_Parse_internal_11 --> -48($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 1 +sw $t0, 12($v0) +sw $v0, -48($fp) +# LOCAL local_c2i_at_Parse_internal_7 --> -32($fp) +# LOCAL local_c2i_at_Parse_internal_11 --> -48($fp) +# local_c2i_at_Parse_internal_7 = local_c2i_at_Parse_internal_11 +lw $t0, -48($fp) +sw $t0, -32($fp) +# GOTO label_ENDIF_50 +j label_ENDIF_50 +label_FALSEIF_49: + # LOCAL local_c2i_at_Parse_internal_16 --> -68($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_8 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -68($fp) + # IF_ZERO param_c2i_at_Parse_char_0 GOTO label_FALSE_61 + # IF_ZERO param_c2i_at_Parse_char_0 GOTO label_FALSE_61 + lw $t0, 0($fp) + beq $t0, 0, label_FALSE_61 + # IF_ZERO local_c2i_at_Parse_internal_16 GOTO label_FALSE_61 + # IF_ZERO local_c2i_at_Parse_internal_16 GOTO label_FALSE_61 + lw $t0, -68($fp) + beq $t0, 0, label_FALSE_61 + # LOCAL local_c2i_at_Parse_internal_15 --> -64($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # Comparing 0($fp) type with String + la $v0, String + lw $a0, 0($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -64($fp) + # IF_ZERO local_c2i_at_Parse_internal_15 GOTO label_COMPARE_STRING_64 + # IF_ZERO local_c2i_at_Parse_internal_15 GOTO label_COMPARE_STRING_64 + lw $t0, -64($fp) + beq $t0, 0, label_COMPARE_STRING_64 + # LOCAL local_c2i_at_Parse_internal_15 --> -64($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # Comparing 0($fp) type with Bool + la $v0, Bool + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -64($fp) + # IF_ZERO local_c2i_at_Parse_internal_15 GOTO label_COMPARE_BY_VALUE_65 + # IF_ZERO local_c2i_at_Parse_internal_15 GOTO label_COMPARE_BY_VALUE_65 + lw $t0, -64($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_65 + # LOCAL local_c2i_at_Parse_internal_15 --> -64($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # Comparing 0($fp) type with Int + la $v0, Int + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -64($fp) + # IF_ZERO local_c2i_at_Parse_internal_15 GOTO label_COMPARE_BY_VALUE_65 + # IF_ZERO local_c2i_at_Parse_internal_15 GOTO label_COMPARE_BY_VALUE_65 + lw $t0, -64($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_65 + # LOCAL local_c2i_at_Parse_internal_15 --> -64($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # LOCAL local_c2i_at_Parse_internal_16 --> -68($fp) + # Load pointers and SUB + lw $a0, 0($fp) + lw $a1, -68($fp) + sub $a0, $a0, $a1 + sw $a0, -64($fp) + # IF_ZERO local_c2i_at_Parse_internal_15 GOTO label_TRUE_62 + # IF_ZERO local_c2i_at_Parse_internal_15 GOTO label_TRUE_62 + lw $t0, -64($fp) + beq $t0, 0, label_TRUE_62 + # GOTO label_FALSE_61 + j label_FALSE_61 + label_COMPARE_BY_VALUE_65: + # LOCAL local_c2i_at_Parse_internal_15 --> -64($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # LOCAL local_c2i_at_Parse_internal_16 --> -68($fp) + lw $a0, 0($fp) + lw $a1, -68($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -64($fp) + # IF_ZERO local_c2i_at_Parse_internal_15 GOTO label_TRUE_62 + # IF_ZERO local_c2i_at_Parse_internal_15 GOTO label_TRUE_62 + lw $t0, -64($fp) + beq $t0, 0, label_TRUE_62 + # GOTO label_FALSE_61 + j label_FALSE_61 + label_COMPARE_STRING_64: + # LOCAL local_c2i_at_Parse_internal_15 --> -64($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # LOCAL local_c2i_at_Parse_internal_16 --> -68($fp) + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -68($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -64($fp) + # IF_ZERO local_c2i_at_Parse_internal_15 GOTO label_CONTINUE_66 + # IF_ZERO local_c2i_at_Parse_internal_15 GOTO label_CONTINUE_66 + lw $t0, -64($fp) + beq $t0, 0, label_CONTINUE_66 + # GOTO label_FALSE_61 + j label_FALSE_61 + label_CONTINUE_66: + # LOCAL local_c2i_at_Parse_internal_15 --> -64($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # LOCAL local_c2i_at_Parse_internal_16 --> -68($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -68($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_67: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_68 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_67 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_68: + # Store result + sw $a2, -64($fp) + # IF_ZERO local_c2i_at_Parse_internal_15 GOTO label_TRUE_62 + # IF_ZERO local_c2i_at_Parse_internal_15 GOTO label_TRUE_62 + lw $t0, -64($fp) + beq $t0, 0, label_TRUE_62 + label_FALSE_61: + # LOCAL local_c2i_at_Parse_internal_14 --> -60($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -60($fp) + # GOTO label_END_63 +j label_END_63 +label_TRUE_62: + # LOCAL local_c2i_at_Parse_internal_14 --> -60($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -60($fp) + label_END_63: +# LOCAL local_c2i_at_Parse_internal_12 --> -52($fp) +# LOCAL local_c2i_at_Parse_internal_14 --> -60($fp) +# Obtain value from -60($fp) +lw $v0, -60($fp) +lw $v0, 12($v0) +sw $v0, -52($fp) +# IF_ZERO local_c2i_at_Parse_internal_12 GOTO label_FALSEIF_59 +# IF_ZERO local_c2i_at_Parse_internal_12 GOTO label_FALSEIF_59 +lw $t0, -52($fp) +beq $t0, 0, label_FALSEIF_59 +# LOCAL local_c2i_at_Parse_internal_17 --> -72($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 2 +sw $t0, 12($v0) +sw $v0, -72($fp) +# LOCAL local_c2i_at_Parse_internal_13 --> -56($fp) +# LOCAL local_c2i_at_Parse_internal_17 --> -72($fp) +# local_c2i_at_Parse_internal_13 = local_c2i_at_Parse_internal_17 +lw $t0, -72($fp) +sw $t0, -56($fp) +# GOTO label_ENDIF_60 +j label_ENDIF_60 +label_FALSEIF_59: + # LOCAL local_c2i_at_Parse_internal_22 --> -92($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_9 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -92($fp) + # IF_ZERO param_c2i_at_Parse_char_0 GOTO label_FALSE_71 + # IF_ZERO param_c2i_at_Parse_char_0 GOTO label_FALSE_71 + lw $t0, 0($fp) + beq $t0, 0, label_FALSE_71 + # IF_ZERO local_c2i_at_Parse_internal_22 GOTO label_FALSE_71 + # IF_ZERO local_c2i_at_Parse_internal_22 GOTO label_FALSE_71 + lw $t0, -92($fp) + beq $t0, 0, label_FALSE_71 + # LOCAL local_c2i_at_Parse_internal_21 --> -88($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # Comparing 0($fp) type with String + la $v0, String + lw $a0, 0($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -88($fp) + # IF_ZERO local_c2i_at_Parse_internal_21 GOTO label_COMPARE_STRING_74 + # IF_ZERO local_c2i_at_Parse_internal_21 GOTO label_COMPARE_STRING_74 + lw $t0, -88($fp) + beq $t0, 0, label_COMPARE_STRING_74 + # LOCAL local_c2i_at_Parse_internal_21 --> -88($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # Comparing 0($fp) type with Bool + la $v0, Bool + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -88($fp) + # IF_ZERO local_c2i_at_Parse_internal_21 GOTO label_COMPARE_BY_VALUE_75 + # IF_ZERO local_c2i_at_Parse_internal_21 GOTO label_COMPARE_BY_VALUE_75 + lw $t0, -88($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_75 + # LOCAL local_c2i_at_Parse_internal_21 --> -88($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # Comparing 0($fp) type with Int + la $v0, Int + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -88($fp) + # IF_ZERO local_c2i_at_Parse_internal_21 GOTO label_COMPARE_BY_VALUE_75 + # IF_ZERO local_c2i_at_Parse_internal_21 GOTO label_COMPARE_BY_VALUE_75 + lw $t0, -88($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_75 + # LOCAL local_c2i_at_Parse_internal_21 --> -88($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # LOCAL local_c2i_at_Parse_internal_22 --> -92($fp) + # Load pointers and SUB + lw $a0, 0($fp) + lw $a1, -92($fp) + sub $a0, $a0, $a1 + sw $a0, -88($fp) + # IF_ZERO local_c2i_at_Parse_internal_21 GOTO label_TRUE_72 + # IF_ZERO local_c2i_at_Parse_internal_21 GOTO label_TRUE_72 + lw $t0, -88($fp) + beq $t0, 0, label_TRUE_72 + # GOTO label_FALSE_71 + j label_FALSE_71 + label_COMPARE_BY_VALUE_75: + # LOCAL local_c2i_at_Parse_internal_21 --> -88($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # LOCAL local_c2i_at_Parse_internal_22 --> -92($fp) + lw $a0, 0($fp) + lw $a1, -92($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -88($fp) + # IF_ZERO local_c2i_at_Parse_internal_21 GOTO label_TRUE_72 + # IF_ZERO local_c2i_at_Parse_internal_21 GOTO label_TRUE_72 + lw $t0, -88($fp) + beq $t0, 0, label_TRUE_72 + # GOTO label_FALSE_71 + j label_FALSE_71 + label_COMPARE_STRING_74: + # LOCAL local_c2i_at_Parse_internal_21 --> -88($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # LOCAL local_c2i_at_Parse_internal_22 --> -92($fp) + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -92($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -88($fp) + # IF_ZERO local_c2i_at_Parse_internal_21 GOTO label_CONTINUE_76 + # IF_ZERO local_c2i_at_Parse_internal_21 GOTO label_CONTINUE_76 + lw $t0, -88($fp) + beq $t0, 0, label_CONTINUE_76 + # GOTO label_FALSE_71 + j label_FALSE_71 + label_CONTINUE_76: + # LOCAL local_c2i_at_Parse_internal_21 --> -88($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # LOCAL local_c2i_at_Parse_internal_22 --> -92($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -92($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_77: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_78 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_77 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_78: + # Store result + sw $a2, -88($fp) + # IF_ZERO local_c2i_at_Parse_internal_21 GOTO label_TRUE_72 + # IF_ZERO local_c2i_at_Parse_internal_21 GOTO label_TRUE_72 + lw $t0, -88($fp) + beq $t0, 0, label_TRUE_72 + label_FALSE_71: + # LOCAL local_c2i_at_Parse_internal_20 --> -84($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -84($fp) + # GOTO label_END_73 +j label_END_73 +label_TRUE_72: + # LOCAL local_c2i_at_Parse_internal_20 --> -84($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -84($fp) + label_END_73: +# LOCAL local_c2i_at_Parse_internal_18 --> -76($fp) +# LOCAL local_c2i_at_Parse_internal_20 --> -84($fp) +# Obtain value from -84($fp) +lw $v0, -84($fp) +lw $v0, 12($v0) +sw $v0, -76($fp) +# IF_ZERO local_c2i_at_Parse_internal_18 GOTO label_FALSEIF_69 +# IF_ZERO local_c2i_at_Parse_internal_18 GOTO label_FALSEIF_69 +lw $t0, -76($fp) +beq $t0, 0, label_FALSEIF_69 +# LOCAL local_c2i_at_Parse_internal_23 --> -96($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 3 +sw $t0, 12($v0) +sw $v0, -96($fp) +# LOCAL local_c2i_at_Parse_internal_19 --> -80($fp) +# LOCAL local_c2i_at_Parse_internal_23 --> -96($fp) +# local_c2i_at_Parse_internal_19 = local_c2i_at_Parse_internal_23 +lw $t0, -96($fp) +sw $t0, -80($fp) +# GOTO label_ENDIF_70 +j label_ENDIF_70 +label_FALSEIF_69: + # LOCAL local_c2i_at_Parse_internal_28 --> -116($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_10 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -116($fp) + # IF_ZERO param_c2i_at_Parse_char_0 GOTO label_FALSE_81 + # IF_ZERO param_c2i_at_Parse_char_0 GOTO label_FALSE_81 + lw $t0, 0($fp) + beq $t0, 0, label_FALSE_81 + # IF_ZERO local_c2i_at_Parse_internal_28 GOTO label_FALSE_81 + # IF_ZERO local_c2i_at_Parse_internal_28 GOTO label_FALSE_81 + lw $t0, -116($fp) + beq $t0, 0, label_FALSE_81 + # LOCAL local_c2i_at_Parse_internal_27 --> -112($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # Comparing 0($fp) type with String + la $v0, String + lw $a0, 0($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -112($fp) + # IF_ZERO local_c2i_at_Parse_internal_27 GOTO label_COMPARE_STRING_84 + # IF_ZERO local_c2i_at_Parse_internal_27 GOTO label_COMPARE_STRING_84 + lw $t0, -112($fp) + beq $t0, 0, label_COMPARE_STRING_84 + # LOCAL local_c2i_at_Parse_internal_27 --> -112($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # Comparing 0($fp) type with Bool + la $v0, Bool + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -112($fp) + # IF_ZERO local_c2i_at_Parse_internal_27 GOTO label_COMPARE_BY_VALUE_85 + # IF_ZERO local_c2i_at_Parse_internal_27 GOTO label_COMPARE_BY_VALUE_85 + lw $t0, -112($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_85 + # LOCAL local_c2i_at_Parse_internal_27 --> -112($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # Comparing 0($fp) type with Int + la $v0, Int + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -112($fp) + # IF_ZERO local_c2i_at_Parse_internal_27 GOTO label_COMPARE_BY_VALUE_85 + # IF_ZERO local_c2i_at_Parse_internal_27 GOTO label_COMPARE_BY_VALUE_85 + lw $t0, -112($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_85 + # LOCAL local_c2i_at_Parse_internal_27 --> -112($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # LOCAL local_c2i_at_Parse_internal_28 --> -116($fp) + # Load pointers and SUB + lw $a0, 0($fp) + lw $a1, -116($fp) + sub $a0, $a0, $a1 + sw $a0, -112($fp) + # IF_ZERO local_c2i_at_Parse_internal_27 GOTO label_TRUE_82 + # IF_ZERO local_c2i_at_Parse_internal_27 GOTO label_TRUE_82 + lw $t0, -112($fp) + beq $t0, 0, label_TRUE_82 + # GOTO label_FALSE_81 + j label_FALSE_81 + label_COMPARE_BY_VALUE_85: + # LOCAL local_c2i_at_Parse_internal_27 --> -112($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # LOCAL local_c2i_at_Parse_internal_28 --> -116($fp) + lw $a0, 0($fp) + lw $a1, -116($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -112($fp) + # IF_ZERO local_c2i_at_Parse_internal_27 GOTO label_TRUE_82 + # IF_ZERO local_c2i_at_Parse_internal_27 GOTO label_TRUE_82 + lw $t0, -112($fp) + beq $t0, 0, label_TRUE_82 + # GOTO label_FALSE_81 + j label_FALSE_81 + label_COMPARE_STRING_84: + # LOCAL local_c2i_at_Parse_internal_27 --> -112($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # LOCAL local_c2i_at_Parse_internal_28 --> -116($fp) + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -116($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -112($fp) + # IF_ZERO local_c2i_at_Parse_internal_27 GOTO label_CONTINUE_86 + # IF_ZERO local_c2i_at_Parse_internal_27 GOTO label_CONTINUE_86 + lw $t0, -112($fp) + beq $t0, 0, label_CONTINUE_86 + # GOTO label_FALSE_81 + j label_FALSE_81 + label_CONTINUE_86: + # LOCAL local_c2i_at_Parse_internal_27 --> -112($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # LOCAL local_c2i_at_Parse_internal_28 --> -116($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -116($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_87: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_88 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_87 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_88: + # Store result + sw $a2, -112($fp) + # IF_ZERO local_c2i_at_Parse_internal_27 GOTO label_TRUE_82 + # IF_ZERO local_c2i_at_Parse_internal_27 GOTO label_TRUE_82 + lw $t0, -112($fp) + beq $t0, 0, label_TRUE_82 + label_FALSE_81: + # LOCAL local_c2i_at_Parse_internal_26 --> -108($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -108($fp) + # GOTO label_END_83 +j label_END_83 +label_TRUE_82: + # LOCAL local_c2i_at_Parse_internal_26 --> -108($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -108($fp) + label_END_83: +# LOCAL local_c2i_at_Parse_internal_24 --> -100($fp) +# LOCAL local_c2i_at_Parse_internal_26 --> -108($fp) +# Obtain value from -108($fp) +lw $v0, -108($fp) +lw $v0, 12($v0) +sw $v0, -100($fp) +# IF_ZERO local_c2i_at_Parse_internal_24 GOTO label_FALSEIF_79 +# IF_ZERO local_c2i_at_Parse_internal_24 GOTO label_FALSEIF_79 +lw $t0, -100($fp) +beq $t0, 0, label_FALSEIF_79 +# LOCAL local_c2i_at_Parse_internal_29 --> -120($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 4 +sw $t0, 12($v0) +sw $v0, -120($fp) +# LOCAL local_c2i_at_Parse_internal_25 --> -104($fp) +# LOCAL local_c2i_at_Parse_internal_29 --> -120($fp) +# local_c2i_at_Parse_internal_25 = local_c2i_at_Parse_internal_29 +lw $t0, -120($fp) +sw $t0, -104($fp) +# GOTO label_ENDIF_80 +j label_ENDIF_80 +label_FALSEIF_79: + # LOCAL local_c2i_at_Parse_internal_34 --> -140($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_11 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -140($fp) + # IF_ZERO param_c2i_at_Parse_char_0 GOTO label_FALSE_91 + # IF_ZERO param_c2i_at_Parse_char_0 GOTO label_FALSE_91 + lw $t0, 0($fp) + beq $t0, 0, label_FALSE_91 + # IF_ZERO local_c2i_at_Parse_internal_34 GOTO label_FALSE_91 + # IF_ZERO local_c2i_at_Parse_internal_34 GOTO label_FALSE_91 + lw $t0, -140($fp) + beq $t0, 0, label_FALSE_91 + # LOCAL local_c2i_at_Parse_internal_33 --> -136($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # Comparing 0($fp) type with String + la $v0, String + lw $a0, 0($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -136($fp) + # IF_ZERO local_c2i_at_Parse_internal_33 GOTO label_COMPARE_STRING_94 + # IF_ZERO local_c2i_at_Parse_internal_33 GOTO label_COMPARE_STRING_94 + lw $t0, -136($fp) + beq $t0, 0, label_COMPARE_STRING_94 + # LOCAL local_c2i_at_Parse_internal_33 --> -136($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # Comparing 0($fp) type with Bool + la $v0, Bool + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -136($fp) + # IF_ZERO local_c2i_at_Parse_internal_33 GOTO label_COMPARE_BY_VALUE_95 + # IF_ZERO local_c2i_at_Parse_internal_33 GOTO label_COMPARE_BY_VALUE_95 + lw $t0, -136($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_95 + # LOCAL local_c2i_at_Parse_internal_33 --> -136($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # Comparing 0($fp) type with Int + la $v0, Int + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -136($fp) + # IF_ZERO local_c2i_at_Parse_internal_33 GOTO label_COMPARE_BY_VALUE_95 + # IF_ZERO local_c2i_at_Parse_internal_33 GOTO label_COMPARE_BY_VALUE_95 + lw $t0, -136($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_95 + # LOCAL local_c2i_at_Parse_internal_33 --> -136($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # LOCAL local_c2i_at_Parse_internal_34 --> -140($fp) + # Load pointers and SUB + lw $a0, 0($fp) + lw $a1, -140($fp) + sub $a0, $a0, $a1 + sw $a0, -136($fp) + # IF_ZERO local_c2i_at_Parse_internal_33 GOTO label_TRUE_92 + # IF_ZERO local_c2i_at_Parse_internal_33 GOTO label_TRUE_92 + lw $t0, -136($fp) + beq $t0, 0, label_TRUE_92 + # GOTO label_FALSE_91 + j label_FALSE_91 + label_COMPARE_BY_VALUE_95: + # LOCAL local_c2i_at_Parse_internal_33 --> -136($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # LOCAL local_c2i_at_Parse_internal_34 --> -140($fp) + lw $a0, 0($fp) + lw $a1, -140($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -136($fp) + # IF_ZERO local_c2i_at_Parse_internal_33 GOTO label_TRUE_92 + # IF_ZERO local_c2i_at_Parse_internal_33 GOTO label_TRUE_92 + lw $t0, -136($fp) + beq $t0, 0, label_TRUE_92 + # GOTO label_FALSE_91 + j label_FALSE_91 + label_COMPARE_STRING_94: + # LOCAL local_c2i_at_Parse_internal_33 --> -136($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # LOCAL local_c2i_at_Parse_internal_34 --> -140($fp) + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -140($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -136($fp) + # IF_ZERO local_c2i_at_Parse_internal_33 GOTO label_CONTINUE_96 + # IF_ZERO local_c2i_at_Parse_internal_33 GOTO label_CONTINUE_96 + lw $t0, -136($fp) + beq $t0, 0, label_CONTINUE_96 + # GOTO label_FALSE_91 + j label_FALSE_91 + label_CONTINUE_96: + # LOCAL local_c2i_at_Parse_internal_33 --> -136($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # LOCAL local_c2i_at_Parse_internal_34 --> -140($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -140($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_97: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_98 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_97 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_98: + # Store result + sw $a2, -136($fp) + # IF_ZERO local_c2i_at_Parse_internal_33 GOTO label_TRUE_92 + # IF_ZERO local_c2i_at_Parse_internal_33 GOTO label_TRUE_92 + lw $t0, -136($fp) + beq $t0, 0, label_TRUE_92 + label_FALSE_91: + # LOCAL local_c2i_at_Parse_internal_32 --> -132($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -132($fp) + # GOTO label_END_93 +j label_END_93 +label_TRUE_92: + # LOCAL local_c2i_at_Parse_internal_32 --> -132($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -132($fp) + label_END_93: +# LOCAL local_c2i_at_Parse_internal_30 --> -124($fp) +# LOCAL local_c2i_at_Parse_internal_32 --> -132($fp) +# Obtain value from -132($fp) +lw $v0, -132($fp) +lw $v0, 12($v0) +sw $v0, -124($fp) +# IF_ZERO local_c2i_at_Parse_internal_30 GOTO label_FALSEIF_89 +# IF_ZERO local_c2i_at_Parse_internal_30 GOTO label_FALSEIF_89 +lw $t0, -124($fp) +beq $t0, 0, label_FALSEIF_89 +# LOCAL local_c2i_at_Parse_internal_35 --> -144($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 5 +sw $t0, 12($v0) +sw $v0, -144($fp) +# LOCAL local_c2i_at_Parse_internal_31 --> -128($fp) +# LOCAL local_c2i_at_Parse_internal_35 --> -144($fp) +# local_c2i_at_Parse_internal_31 = local_c2i_at_Parse_internal_35 +lw $t0, -144($fp) +sw $t0, -128($fp) +# GOTO label_ENDIF_90 +j label_ENDIF_90 +label_FALSEIF_89: + # LOCAL local_c2i_at_Parse_internal_40 --> -164($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_12 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -164($fp) + # IF_ZERO param_c2i_at_Parse_char_0 GOTO label_FALSE_101 + # IF_ZERO param_c2i_at_Parse_char_0 GOTO label_FALSE_101 + lw $t0, 0($fp) + beq $t0, 0, label_FALSE_101 + # IF_ZERO local_c2i_at_Parse_internal_40 GOTO label_FALSE_101 + # IF_ZERO local_c2i_at_Parse_internal_40 GOTO label_FALSE_101 + lw $t0, -164($fp) + beq $t0, 0, label_FALSE_101 + # LOCAL local_c2i_at_Parse_internal_39 --> -160($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # Comparing 0($fp) type with String + la $v0, String + lw $a0, 0($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -160($fp) + # IF_ZERO local_c2i_at_Parse_internal_39 GOTO label_COMPARE_STRING_104 + # IF_ZERO local_c2i_at_Parse_internal_39 GOTO label_COMPARE_STRING_104 + lw $t0, -160($fp) + beq $t0, 0, label_COMPARE_STRING_104 + # LOCAL local_c2i_at_Parse_internal_39 --> -160($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # Comparing 0($fp) type with Bool + la $v0, Bool + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -160($fp) + # IF_ZERO local_c2i_at_Parse_internal_39 GOTO label_COMPARE_BY_VALUE_105 + # IF_ZERO local_c2i_at_Parse_internal_39 GOTO label_COMPARE_BY_VALUE_105 + lw $t0, -160($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_105 + # LOCAL local_c2i_at_Parse_internal_39 --> -160($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # Comparing 0($fp) type with Int + la $v0, Int + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -160($fp) + # IF_ZERO local_c2i_at_Parse_internal_39 GOTO label_COMPARE_BY_VALUE_105 + # IF_ZERO local_c2i_at_Parse_internal_39 GOTO label_COMPARE_BY_VALUE_105 + lw $t0, -160($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_105 + # LOCAL local_c2i_at_Parse_internal_39 --> -160($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # LOCAL local_c2i_at_Parse_internal_40 --> -164($fp) + # Load pointers and SUB + lw $a0, 0($fp) + lw $a1, -164($fp) + sub $a0, $a0, $a1 + sw $a0, -160($fp) + # IF_ZERO local_c2i_at_Parse_internal_39 GOTO label_TRUE_102 + # IF_ZERO local_c2i_at_Parse_internal_39 GOTO label_TRUE_102 + lw $t0, -160($fp) + beq $t0, 0, label_TRUE_102 + # GOTO label_FALSE_101 + j label_FALSE_101 + label_COMPARE_BY_VALUE_105: + # LOCAL local_c2i_at_Parse_internal_39 --> -160($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # LOCAL local_c2i_at_Parse_internal_40 --> -164($fp) + lw $a0, 0($fp) + lw $a1, -164($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -160($fp) + # IF_ZERO local_c2i_at_Parse_internal_39 GOTO label_TRUE_102 + # IF_ZERO local_c2i_at_Parse_internal_39 GOTO label_TRUE_102 + lw $t0, -160($fp) + beq $t0, 0, label_TRUE_102 + # GOTO label_FALSE_101 + j label_FALSE_101 + label_COMPARE_STRING_104: + # LOCAL local_c2i_at_Parse_internal_39 --> -160($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # LOCAL local_c2i_at_Parse_internal_40 --> -164($fp) + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -164($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -160($fp) + # IF_ZERO local_c2i_at_Parse_internal_39 GOTO label_CONTINUE_106 + # IF_ZERO local_c2i_at_Parse_internal_39 GOTO label_CONTINUE_106 + lw $t0, -160($fp) + beq $t0, 0, label_CONTINUE_106 + # GOTO label_FALSE_101 + j label_FALSE_101 + label_CONTINUE_106: + # LOCAL local_c2i_at_Parse_internal_39 --> -160($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # LOCAL local_c2i_at_Parse_internal_40 --> -164($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -164($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_107: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_108 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_107 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_108: + # Store result + sw $a2, -160($fp) + # IF_ZERO local_c2i_at_Parse_internal_39 GOTO label_TRUE_102 + # IF_ZERO local_c2i_at_Parse_internal_39 GOTO label_TRUE_102 + lw $t0, -160($fp) + beq $t0, 0, label_TRUE_102 + label_FALSE_101: + # LOCAL local_c2i_at_Parse_internal_38 --> -156($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -156($fp) + # GOTO label_END_103 +j label_END_103 +label_TRUE_102: + # LOCAL local_c2i_at_Parse_internal_38 --> -156($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -156($fp) + label_END_103: +# LOCAL local_c2i_at_Parse_internal_36 --> -148($fp) +# LOCAL local_c2i_at_Parse_internal_38 --> -156($fp) +# Obtain value from -156($fp) +lw $v0, -156($fp) +lw $v0, 12($v0) +sw $v0, -148($fp) +# IF_ZERO local_c2i_at_Parse_internal_36 GOTO label_FALSEIF_99 +# IF_ZERO local_c2i_at_Parse_internal_36 GOTO label_FALSEIF_99 +lw $t0, -148($fp) +beq $t0, 0, label_FALSEIF_99 +# LOCAL local_c2i_at_Parse_internal_41 --> -168($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 6 +sw $t0, 12($v0) +sw $v0, -168($fp) +# LOCAL local_c2i_at_Parse_internal_37 --> -152($fp) +# LOCAL local_c2i_at_Parse_internal_41 --> -168($fp) +# local_c2i_at_Parse_internal_37 = local_c2i_at_Parse_internal_41 +lw $t0, -168($fp) +sw $t0, -152($fp) +# GOTO label_ENDIF_100 +j label_ENDIF_100 +label_FALSEIF_99: + # LOCAL local_c2i_at_Parse_internal_46 --> -188($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_13 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -188($fp) + # IF_ZERO param_c2i_at_Parse_char_0 GOTO label_FALSE_111 + # IF_ZERO param_c2i_at_Parse_char_0 GOTO label_FALSE_111 + lw $t0, 0($fp) + beq $t0, 0, label_FALSE_111 + # IF_ZERO local_c2i_at_Parse_internal_46 GOTO label_FALSE_111 + # IF_ZERO local_c2i_at_Parse_internal_46 GOTO label_FALSE_111 + lw $t0, -188($fp) + beq $t0, 0, label_FALSE_111 + # LOCAL local_c2i_at_Parse_internal_45 --> -184($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # Comparing 0($fp) type with String + la $v0, String + lw $a0, 0($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -184($fp) + # IF_ZERO local_c2i_at_Parse_internal_45 GOTO label_COMPARE_STRING_114 + # IF_ZERO local_c2i_at_Parse_internal_45 GOTO label_COMPARE_STRING_114 + lw $t0, -184($fp) + beq $t0, 0, label_COMPARE_STRING_114 + # LOCAL local_c2i_at_Parse_internal_45 --> -184($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # Comparing 0($fp) type with Bool + la $v0, Bool + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -184($fp) + # IF_ZERO local_c2i_at_Parse_internal_45 GOTO label_COMPARE_BY_VALUE_115 + # IF_ZERO local_c2i_at_Parse_internal_45 GOTO label_COMPARE_BY_VALUE_115 + lw $t0, -184($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_115 + # LOCAL local_c2i_at_Parse_internal_45 --> -184($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # Comparing 0($fp) type with Int + la $v0, Int + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -184($fp) + # IF_ZERO local_c2i_at_Parse_internal_45 GOTO label_COMPARE_BY_VALUE_115 + # IF_ZERO local_c2i_at_Parse_internal_45 GOTO label_COMPARE_BY_VALUE_115 + lw $t0, -184($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_115 + # LOCAL local_c2i_at_Parse_internal_45 --> -184($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # LOCAL local_c2i_at_Parse_internal_46 --> -188($fp) + # Load pointers and SUB + lw $a0, 0($fp) + lw $a1, -188($fp) + sub $a0, $a0, $a1 + sw $a0, -184($fp) + # IF_ZERO local_c2i_at_Parse_internal_45 GOTO label_TRUE_112 + # IF_ZERO local_c2i_at_Parse_internal_45 GOTO label_TRUE_112 + lw $t0, -184($fp) + beq $t0, 0, label_TRUE_112 + # GOTO label_FALSE_111 + j label_FALSE_111 + label_COMPARE_BY_VALUE_115: + # LOCAL local_c2i_at_Parse_internal_45 --> -184($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # LOCAL local_c2i_at_Parse_internal_46 --> -188($fp) + lw $a0, 0($fp) + lw $a1, -188($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -184($fp) + # IF_ZERO local_c2i_at_Parse_internal_45 GOTO label_TRUE_112 + # IF_ZERO local_c2i_at_Parse_internal_45 GOTO label_TRUE_112 + lw $t0, -184($fp) + beq $t0, 0, label_TRUE_112 + # GOTO label_FALSE_111 + j label_FALSE_111 + label_COMPARE_STRING_114: + # LOCAL local_c2i_at_Parse_internal_45 --> -184($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # LOCAL local_c2i_at_Parse_internal_46 --> -188($fp) + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -188($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -184($fp) + # IF_ZERO local_c2i_at_Parse_internal_45 GOTO label_CONTINUE_116 + # IF_ZERO local_c2i_at_Parse_internal_45 GOTO label_CONTINUE_116 + lw $t0, -184($fp) + beq $t0, 0, label_CONTINUE_116 + # GOTO label_FALSE_111 + j label_FALSE_111 + label_CONTINUE_116: + # LOCAL local_c2i_at_Parse_internal_45 --> -184($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # LOCAL local_c2i_at_Parse_internal_46 --> -188($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -188($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_117: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_118 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_117 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_118: + # Store result + sw $a2, -184($fp) + # IF_ZERO local_c2i_at_Parse_internal_45 GOTO label_TRUE_112 + # IF_ZERO local_c2i_at_Parse_internal_45 GOTO label_TRUE_112 + lw $t0, -184($fp) + beq $t0, 0, label_TRUE_112 + label_FALSE_111: + # LOCAL local_c2i_at_Parse_internal_44 --> -180($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -180($fp) + # GOTO label_END_113 +j label_END_113 +label_TRUE_112: + # LOCAL local_c2i_at_Parse_internal_44 --> -180($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -180($fp) + label_END_113: +# LOCAL local_c2i_at_Parse_internal_42 --> -172($fp) +# LOCAL local_c2i_at_Parse_internal_44 --> -180($fp) +# Obtain value from -180($fp) +lw $v0, -180($fp) +lw $v0, 12($v0) +sw $v0, -172($fp) +# IF_ZERO local_c2i_at_Parse_internal_42 GOTO label_FALSEIF_109 +# IF_ZERO local_c2i_at_Parse_internal_42 GOTO label_FALSEIF_109 +lw $t0, -172($fp) +beq $t0, 0, label_FALSEIF_109 +# LOCAL local_c2i_at_Parse_internal_47 --> -192($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 7 +sw $t0, 12($v0) +sw $v0, -192($fp) +# LOCAL local_c2i_at_Parse_internal_43 --> -176($fp) +# LOCAL local_c2i_at_Parse_internal_47 --> -192($fp) +# local_c2i_at_Parse_internal_43 = local_c2i_at_Parse_internal_47 +lw $t0, -192($fp) +sw $t0, -176($fp) +# GOTO label_ENDIF_110 +j label_ENDIF_110 +label_FALSEIF_109: + # LOCAL local_c2i_at_Parse_internal_52 --> -212($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_14 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -212($fp) + # IF_ZERO param_c2i_at_Parse_char_0 GOTO label_FALSE_121 + # IF_ZERO param_c2i_at_Parse_char_0 GOTO label_FALSE_121 + lw $t0, 0($fp) + beq $t0, 0, label_FALSE_121 + # IF_ZERO local_c2i_at_Parse_internal_52 GOTO label_FALSE_121 + # IF_ZERO local_c2i_at_Parse_internal_52 GOTO label_FALSE_121 + lw $t0, -212($fp) + beq $t0, 0, label_FALSE_121 + # LOCAL local_c2i_at_Parse_internal_51 --> -208($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # Comparing 0($fp) type with String + la $v0, String + lw $a0, 0($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -208($fp) + # IF_ZERO local_c2i_at_Parse_internal_51 GOTO label_COMPARE_STRING_124 + # IF_ZERO local_c2i_at_Parse_internal_51 GOTO label_COMPARE_STRING_124 + lw $t0, -208($fp) + beq $t0, 0, label_COMPARE_STRING_124 + # LOCAL local_c2i_at_Parse_internal_51 --> -208($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # Comparing 0($fp) type with Bool + la $v0, Bool + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -208($fp) + # IF_ZERO local_c2i_at_Parse_internal_51 GOTO label_COMPARE_BY_VALUE_125 + # IF_ZERO local_c2i_at_Parse_internal_51 GOTO label_COMPARE_BY_VALUE_125 + lw $t0, -208($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_125 + # LOCAL local_c2i_at_Parse_internal_51 --> -208($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # Comparing 0($fp) type with Int + la $v0, Int + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -208($fp) + # IF_ZERO local_c2i_at_Parse_internal_51 GOTO label_COMPARE_BY_VALUE_125 + # IF_ZERO local_c2i_at_Parse_internal_51 GOTO label_COMPARE_BY_VALUE_125 + lw $t0, -208($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_125 + # LOCAL local_c2i_at_Parse_internal_51 --> -208($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # LOCAL local_c2i_at_Parse_internal_52 --> -212($fp) + # Load pointers and SUB + lw $a0, 0($fp) + lw $a1, -212($fp) + sub $a0, $a0, $a1 + sw $a0, -208($fp) + # IF_ZERO local_c2i_at_Parse_internal_51 GOTO label_TRUE_122 + # IF_ZERO local_c2i_at_Parse_internal_51 GOTO label_TRUE_122 + lw $t0, -208($fp) + beq $t0, 0, label_TRUE_122 + # GOTO label_FALSE_121 + j label_FALSE_121 + label_COMPARE_BY_VALUE_125: + # LOCAL local_c2i_at_Parse_internal_51 --> -208($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # LOCAL local_c2i_at_Parse_internal_52 --> -212($fp) + lw $a0, 0($fp) + lw $a1, -212($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -208($fp) + # IF_ZERO local_c2i_at_Parse_internal_51 GOTO label_TRUE_122 + # IF_ZERO local_c2i_at_Parse_internal_51 GOTO label_TRUE_122 + lw $t0, -208($fp) + beq $t0, 0, label_TRUE_122 + # GOTO label_FALSE_121 + j label_FALSE_121 + label_COMPARE_STRING_124: + # LOCAL local_c2i_at_Parse_internal_51 --> -208($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # LOCAL local_c2i_at_Parse_internal_52 --> -212($fp) + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -212($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -208($fp) + # IF_ZERO local_c2i_at_Parse_internal_51 GOTO label_CONTINUE_126 + # IF_ZERO local_c2i_at_Parse_internal_51 GOTO label_CONTINUE_126 + lw $t0, -208($fp) + beq $t0, 0, label_CONTINUE_126 + # GOTO label_FALSE_121 + j label_FALSE_121 + label_CONTINUE_126: + # LOCAL local_c2i_at_Parse_internal_51 --> -208($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # LOCAL local_c2i_at_Parse_internal_52 --> -212($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -212($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_127: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_128 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_127 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_128: + # Store result + sw $a2, -208($fp) + # IF_ZERO local_c2i_at_Parse_internal_51 GOTO label_TRUE_122 + # IF_ZERO local_c2i_at_Parse_internal_51 GOTO label_TRUE_122 + lw $t0, -208($fp) + beq $t0, 0, label_TRUE_122 + label_FALSE_121: + # LOCAL local_c2i_at_Parse_internal_50 --> -204($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -204($fp) + # GOTO label_END_123 +j label_END_123 +label_TRUE_122: + # LOCAL local_c2i_at_Parse_internal_50 --> -204($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -204($fp) + label_END_123: +# LOCAL local_c2i_at_Parse_internal_48 --> -196($fp) +# LOCAL local_c2i_at_Parse_internal_50 --> -204($fp) +# Obtain value from -204($fp) +lw $v0, -204($fp) +lw $v0, 12($v0) +sw $v0, -196($fp) +# IF_ZERO local_c2i_at_Parse_internal_48 GOTO label_FALSEIF_119 +# IF_ZERO local_c2i_at_Parse_internal_48 GOTO label_FALSEIF_119 +lw $t0, -196($fp) +beq $t0, 0, label_FALSEIF_119 +# LOCAL local_c2i_at_Parse_internal_53 --> -216($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 8 +sw $t0, 12($v0) +sw $v0, -216($fp) +# LOCAL local_c2i_at_Parse_internal_49 --> -200($fp) +# LOCAL local_c2i_at_Parse_internal_53 --> -216($fp) +# local_c2i_at_Parse_internal_49 = local_c2i_at_Parse_internal_53 +lw $t0, -216($fp) +sw $t0, -200($fp) +# GOTO label_ENDIF_120 +j label_ENDIF_120 +label_FALSEIF_119: + # LOCAL local_c2i_at_Parse_internal_58 --> -236($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_15 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -236($fp) + # IF_ZERO param_c2i_at_Parse_char_0 GOTO label_FALSE_131 + # IF_ZERO param_c2i_at_Parse_char_0 GOTO label_FALSE_131 + lw $t0, 0($fp) + beq $t0, 0, label_FALSE_131 + # IF_ZERO local_c2i_at_Parse_internal_58 GOTO label_FALSE_131 + # IF_ZERO local_c2i_at_Parse_internal_58 GOTO label_FALSE_131 + lw $t0, -236($fp) + beq $t0, 0, label_FALSE_131 + # LOCAL local_c2i_at_Parse_internal_57 --> -232($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # Comparing 0($fp) type with String + la $v0, String + lw $a0, 0($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -232($fp) + # IF_ZERO local_c2i_at_Parse_internal_57 GOTO label_COMPARE_STRING_134 + # IF_ZERO local_c2i_at_Parse_internal_57 GOTO label_COMPARE_STRING_134 + lw $t0, -232($fp) + beq $t0, 0, label_COMPARE_STRING_134 + # LOCAL local_c2i_at_Parse_internal_57 --> -232($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # Comparing 0($fp) type with Bool + la $v0, Bool + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -232($fp) + # IF_ZERO local_c2i_at_Parse_internal_57 GOTO label_COMPARE_BY_VALUE_135 + # IF_ZERO local_c2i_at_Parse_internal_57 GOTO label_COMPARE_BY_VALUE_135 + lw $t0, -232($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_135 + # LOCAL local_c2i_at_Parse_internal_57 --> -232($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # Comparing 0($fp) type with Int + la $v0, Int + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -232($fp) + # IF_ZERO local_c2i_at_Parse_internal_57 GOTO label_COMPARE_BY_VALUE_135 + # IF_ZERO local_c2i_at_Parse_internal_57 GOTO label_COMPARE_BY_VALUE_135 + lw $t0, -232($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_135 + # LOCAL local_c2i_at_Parse_internal_57 --> -232($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # LOCAL local_c2i_at_Parse_internal_58 --> -236($fp) + # Load pointers and SUB + lw $a0, 0($fp) + lw $a1, -236($fp) + sub $a0, $a0, $a1 + sw $a0, -232($fp) + # IF_ZERO local_c2i_at_Parse_internal_57 GOTO label_TRUE_132 + # IF_ZERO local_c2i_at_Parse_internal_57 GOTO label_TRUE_132 + lw $t0, -232($fp) + beq $t0, 0, label_TRUE_132 + # GOTO label_FALSE_131 + j label_FALSE_131 + label_COMPARE_BY_VALUE_135: + # LOCAL local_c2i_at_Parse_internal_57 --> -232($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # LOCAL local_c2i_at_Parse_internal_58 --> -236($fp) + lw $a0, 0($fp) + lw $a1, -236($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -232($fp) + # IF_ZERO local_c2i_at_Parse_internal_57 GOTO label_TRUE_132 + # IF_ZERO local_c2i_at_Parse_internal_57 GOTO label_TRUE_132 + lw $t0, -232($fp) + beq $t0, 0, label_TRUE_132 + # GOTO label_FALSE_131 + j label_FALSE_131 + label_COMPARE_STRING_134: + # LOCAL local_c2i_at_Parse_internal_57 --> -232($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # LOCAL local_c2i_at_Parse_internal_58 --> -236($fp) + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -236($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -232($fp) + # IF_ZERO local_c2i_at_Parse_internal_57 GOTO label_CONTINUE_136 + # IF_ZERO local_c2i_at_Parse_internal_57 GOTO label_CONTINUE_136 + lw $t0, -232($fp) + beq $t0, 0, label_CONTINUE_136 + # GOTO label_FALSE_131 + j label_FALSE_131 + label_CONTINUE_136: + # LOCAL local_c2i_at_Parse_internal_57 --> -232($fp) + # PARAM param_c2i_at_Parse_char_0 --> 0($fp) + # LOCAL local_c2i_at_Parse_internal_58 --> -236($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -236($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_137: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_138 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_137 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_138: + # Store result + sw $a2, -232($fp) + # IF_ZERO local_c2i_at_Parse_internal_57 GOTO label_TRUE_132 + # IF_ZERO local_c2i_at_Parse_internal_57 GOTO label_TRUE_132 + lw $t0, -232($fp) + beq $t0, 0, label_TRUE_132 + label_FALSE_131: + # LOCAL local_c2i_at_Parse_internal_56 --> -228($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -228($fp) + # GOTO label_END_133 +j label_END_133 +label_TRUE_132: + # LOCAL local_c2i_at_Parse_internal_56 --> -228($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -228($fp) + label_END_133: +# LOCAL local_c2i_at_Parse_internal_54 --> -220($fp) +# LOCAL local_c2i_at_Parse_internal_56 --> -228($fp) +# Obtain value from -228($fp) +lw $v0, -228($fp) +lw $v0, 12($v0) +sw $v0, -220($fp) +# IF_ZERO local_c2i_at_Parse_internal_54 GOTO label_FALSEIF_129 +# IF_ZERO local_c2i_at_Parse_internal_54 GOTO label_FALSEIF_129 +lw $t0, -220($fp) +beq $t0, 0, label_FALSEIF_129 +# LOCAL local_c2i_at_Parse_internal_59 --> -240($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 9 +sw $t0, 12($v0) +sw $v0, -240($fp) +# LOCAL local_c2i_at_Parse_internal_55 --> -224($fp) +# LOCAL local_c2i_at_Parse_internal_59 --> -240($fp) +# local_c2i_at_Parse_internal_55 = local_c2i_at_Parse_internal_59 +lw $t0, -240($fp) +sw $t0, -224($fp) +# GOTO label_ENDIF_130 +j label_ENDIF_130 +label_FALSEIF_129: + # LOCAL local_c2i_at_Parse_internal_62 --> -252($fp) + # local_c2i_at_Parse_internal_62 = SELF + sw $s1, -252($fp) + # LOCAL local_c2i_at_Parse_internal_60 --> -244($fp) + # LOCAL local_c2i_at_Parse_internal_62 --> -252($fp) + # local_c2i_at_Parse_internal_60 = local_c2i_at_Parse_internal_62 + lw $t0, -252($fp) + sw $t0, -244($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_c2i_at_Parse_internal_60 --> -244($fp) + # LOCAL local_c2i_at_Parse_internal_61 --> -248($fp) + # local_c2i_at_Parse_internal_61 = VCALL local_c2i_at_Parse_internal_60 abort + # Save new self pointer in $s1 + lw $s1, -244($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 16($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -248($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_c2i_at_Parse_internal_63 --> -256($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -256($fp) + # LOCAL local_c2i_at_Parse_internal_55 --> -224($fp) + # LOCAL local_c2i_at_Parse_internal_63 --> -256($fp) + # local_c2i_at_Parse_internal_55 = local_c2i_at_Parse_internal_63 + lw $t0, -256($fp) + sw $t0, -224($fp) + label_ENDIF_130: +# LOCAL local_c2i_at_Parse_internal_49 --> -200($fp) +# LOCAL local_c2i_at_Parse_internal_55 --> -224($fp) +# local_c2i_at_Parse_internal_49 = local_c2i_at_Parse_internal_55 +lw $t0, -224($fp) +sw $t0, -200($fp) +label_ENDIF_120: +# LOCAL local_c2i_at_Parse_internal_43 --> -176($fp) +# LOCAL local_c2i_at_Parse_internal_49 --> -200($fp) +# local_c2i_at_Parse_internal_43 = local_c2i_at_Parse_internal_49 +lw $t0, -200($fp) +sw $t0, -176($fp) +label_ENDIF_110: +# LOCAL local_c2i_at_Parse_internal_37 --> -152($fp) +# LOCAL local_c2i_at_Parse_internal_43 --> -176($fp) +# local_c2i_at_Parse_internal_37 = local_c2i_at_Parse_internal_43 +lw $t0, -176($fp) +sw $t0, -152($fp) +label_ENDIF_100: +# LOCAL local_c2i_at_Parse_internal_31 --> -128($fp) +# LOCAL local_c2i_at_Parse_internal_37 --> -152($fp) +# local_c2i_at_Parse_internal_31 = local_c2i_at_Parse_internal_37 +lw $t0, -152($fp) +sw $t0, -128($fp) +label_ENDIF_90: +# LOCAL local_c2i_at_Parse_internal_25 --> -104($fp) +# LOCAL local_c2i_at_Parse_internal_31 --> -128($fp) +# local_c2i_at_Parse_internal_25 = local_c2i_at_Parse_internal_31 +lw $t0, -128($fp) +sw $t0, -104($fp) +label_ENDIF_80: +# LOCAL local_c2i_at_Parse_internal_19 --> -80($fp) +# LOCAL local_c2i_at_Parse_internal_25 --> -104($fp) +# local_c2i_at_Parse_internal_19 = local_c2i_at_Parse_internal_25 +lw $t0, -104($fp) +sw $t0, -80($fp) +label_ENDIF_70: +# LOCAL local_c2i_at_Parse_internal_13 --> -56($fp) +# LOCAL local_c2i_at_Parse_internal_19 --> -80($fp) +# local_c2i_at_Parse_internal_13 = local_c2i_at_Parse_internal_19 +lw $t0, -80($fp) +sw $t0, -56($fp) +label_ENDIF_60: +# LOCAL local_c2i_at_Parse_internal_7 --> -32($fp) +# LOCAL local_c2i_at_Parse_internal_13 --> -56($fp) +# local_c2i_at_Parse_internal_7 = local_c2i_at_Parse_internal_13 +lw $t0, -56($fp) +sw $t0, -32($fp) +label_ENDIF_50: +# LOCAL local_c2i_at_Parse_internal_1 --> -8($fp) +# LOCAL local_c2i_at_Parse_internal_7 --> -32($fp) +# local_c2i_at_Parse_internal_1 = local_c2i_at_Parse_internal_7 +lw $t0, -32($fp) +sw $t0, -8($fp) +label_ENDIF_40: +# RETURN local_c2i_at_Parse_internal_1 +lw $v0, -8($fp) +# Deallocate stack frame for function function_c2i_at_Parse. +# Restore $ra +lw $ra, 4($sp) +# Restore $fp +lw $fp, 0($sp) +# Restore Stack pointer $sp +addu $sp, $sp, 264 +# Deallocate function args +addu $sp, $sp, 4 +jr $ra +# Function END + + +# function_a2i_at_Parse implementation. +# @Params: +# 0($fp) = param_a2i_at_Parse_s_0 +function_a2i_at_Parse: + # Allocate stack frame for function function_a2i_at_Parse. + subu $sp, $sp, 208 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 208 + # LOCAL local_a2i_at_Parse_internal_4 --> -20($fp) + # PARAM param_a2i_at_Parse_s_0 --> 0($fp) + # local_a2i_at_Parse_internal_4 = PARAM param_a2i_at_Parse_s_0 + lw $t0, 0($fp) + sw $t0, -20($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_a2i_at_Parse_internal_4 --> -20($fp) + # LOCAL local_a2i_at_Parse_internal_5 --> -24($fp) + # local_a2i_at_Parse_internal_5 = VCALL local_a2i_at_Parse_internal_4 length + # Save new self pointer in $s1 + lw $s1, -20($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 36($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -24($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_a2i_at_Parse_internal_6 --> -28($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -28($fp) + # IF_ZERO local_a2i_at_Parse_internal_5 GOTO label_FALSE_141 + # IF_ZERO local_a2i_at_Parse_internal_5 GOTO label_FALSE_141 + lw $t0, -24($fp) + beq $t0, 0, label_FALSE_141 + # IF_ZERO local_a2i_at_Parse_internal_6 GOTO label_FALSE_141 + # IF_ZERO local_a2i_at_Parse_internal_6 GOTO label_FALSE_141 + lw $t0, -28($fp) + beq $t0, 0, label_FALSE_141 + # LOCAL local_a2i_at_Parse_internal_3 --> -16($fp) + # LOCAL local_a2i_at_Parse_internal_5 --> -24($fp) + # Comparing -24($fp) type with String + la $v0, String + lw $a0, -24($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -16($fp) + # IF_ZERO local_a2i_at_Parse_internal_3 GOTO label_COMPARE_STRING_144 + # IF_ZERO local_a2i_at_Parse_internal_3 GOTO label_COMPARE_STRING_144 + lw $t0, -16($fp) + beq $t0, 0, label_COMPARE_STRING_144 + # LOCAL local_a2i_at_Parse_internal_3 --> -16($fp) + # LOCAL local_a2i_at_Parse_internal_5 --> -24($fp) + # Comparing -24($fp) type with Bool + la $v0, Bool + lw $a0, -24($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -16($fp) + # IF_ZERO local_a2i_at_Parse_internal_3 GOTO label_COMPARE_BY_VALUE_145 + # IF_ZERO local_a2i_at_Parse_internal_3 GOTO label_COMPARE_BY_VALUE_145 + lw $t0, -16($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_145 + # LOCAL local_a2i_at_Parse_internal_3 --> -16($fp) + # LOCAL local_a2i_at_Parse_internal_5 --> -24($fp) + # Comparing -24($fp) type with Int + la $v0, Int + lw $a0, -24($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -16($fp) + # IF_ZERO local_a2i_at_Parse_internal_3 GOTO label_COMPARE_BY_VALUE_145 + # IF_ZERO local_a2i_at_Parse_internal_3 GOTO label_COMPARE_BY_VALUE_145 + lw $t0, -16($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_145 + # LOCAL local_a2i_at_Parse_internal_3 --> -16($fp) + # LOCAL local_a2i_at_Parse_internal_5 --> -24($fp) + # LOCAL local_a2i_at_Parse_internal_6 --> -28($fp) + # Load pointers and SUB + lw $a0, -24($fp) + lw $a1, -28($fp) + sub $a0, $a0, $a1 + sw $a0, -16($fp) + # IF_ZERO local_a2i_at_Parse_internal_3 GOTO label_TRUE_142 + # IF_ZERO local_a2i_at_Parse_internal_3 GOTO label_TRUE_142 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_142 + # GOTO label_FALSE_141 + j label_FALSE_141 + label_COMPARE_BY_VALUE_145: + # LOCAL local_a2i_at_Parse_internal_3 --> -16($fp) + # LOCAL local_a2i_at_Parse_internal_5 --> -24($fp) + # LOCAL local_a2i_at_Parse_internal_6 --> -28($fp) + lw $a0, -24($fp) + lw $a1, -28($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -16($fp) + # IF_ZERO local_a2i_at_Parse_internal_3 GOTO label_TRUE_142 + # IF_ZERO local_a2i_at_Parse_internal_3 GOTO label_TRUE_142 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_142 + # GOTO label_FALSE_141 + j label_FALSE_141 + label_COMPARE_STRING_144: + # LOCAL local_a2i_at_Parse_internal_3 --> -16($fp) + # LOCAL local_a2i_at_Parse_internal_5 --> -24($fp) + # LOCAL local_a2i_at_Parse_internal_6 --> -28($fp) + # Load strings for comparison + lw $v0, -24($fp) + lw $v1, -28($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -16($fp) + # IF_ZERO local_a2i_at_Parse_internal_3 GOTO label_CONTINUE_146 + # IF_ZERO local_a2i_at_Parse_internal_3 GOTO label_CONTINUE_146 + lw $t0, -16($fp) + beq $t0, 0, label_CONTINUE_146 + # GOTO label_FALSE_141 + j label_FALSE_141 + label_CONTINUE_146: + # LOCAL local_a2i_at_Parse_internal_3 --> -16($fp) + # LOCAL local_a2i_at_Parse_internal_5 --> -24($fp) + # LOCAL local_a2i_at_Parse_internal_6 --> -28($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -24($fp) + lw $v1, -28($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_147: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_148 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_147 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_148: + # Store result + sw $a2, -16($fp) + # IF_ZERO local_a2i_at_Parse_internal_3 GOTO label_TRUE_142 + # IF_ZERO local_a2i_at_Parse_internal_3 GOTO label_TRUE_142 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_142 + label_FALSE_141: + # LOCAL local_a2i_at_Parse_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -12($fp) + # GOTO label_END_143 +j label_END_143 +label_TRUE_142: + # LOCAL local_a2i_at_Parse_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -12($fp) + label_END_143: +# LOCAL local_a2i_at_Parse_internal_0 --> -4($fp) +# LOCAL local_a2i_at_Parse_internal_2 --> -12($fp) +# Obtain value from -12($fp) +lw $v0, -12($fp) +lw $v0, 12($v0) +sw $v0, -4($fp) +# IF_ZERO local_a2i_at_Parse_internal_0 GOTO label_FALSEIF_139 +# IF_ZERO local_a2i_at_Parse_internal_0 GOTO label_FALSEIF_139 +lw $t0, -4($fp) +beq $t0, 0, label_FALSEIF_139 +# LOCAL local_a2i_at_Parse_internal_7 --> -32($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 0 +sw $t0, 12($v0) +sw $v0, -32($fp) +# LOCAL local_a2i_at_Parse_internal_1 --> -8($fp) +# LOCAL local_a2i_at_Parse_internal_7 --> -32($fp) +# local_a2i_at_Parse_internal_1 = local_a2i_at_Parse_internal_7 +lw $t0, -32($fp) +sw $t0, -8($fp) +# GOTO label_ENDIF_140 +j label_ENDIF_140 +label_FALSEIF_139: + # LOCAL local_a2i_at_Parse_internal_12 --> -52($fp) + # PARAM param_a2i_at_Parse_s_0 --> 0($fp) + # local_a2i_at_Parse_internal_12 = PARAM param_a2i_at_Parse_s_0 + lw $t0, 0($fp) + sw $t0, -52($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_a2i_at_Parse_internal_14 --> -60($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -60($fp) + # ARG local_a2i_at_Parse_internal_14 + # LOCAL local_a2i_at_Parse_internal_14 --> -60($fp) + lw $t0, -60($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_a2i_at_Parse_internal_15 --> -64($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -64($fp) + # ARG local_a2i_at_Parse_internal_15 + # LOCAL local_a2i_at_Parse_internal_15 --> -64($fp) + lw $t0, -64($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_a2i_at_Parse_internal_12 --> -52($fp) + # LOCAL local_a2i_at_Parse_internal_13 --> -56($fp) + # local_a2i_at_Parse_internal_13 = VCALL local_a2i_at_Parse_internal_12 substr + # Save new self pointer in $s1 + lw $s1, -52($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 64($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -56($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_a2i_at_Parse_internal_16 --> -68($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_16 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -68($fp) + # IF_ZERO local_a2i_at_Parse_internal_13 GOTO label_FALSE_151 + # IF_ZERO local_a2i_at_Parse_internal_13 GOTO label_FALSE_151 + lw $t0, -56($fp) + beq $t0, 0, label_FALSE_151 + # IF_ZERO local_a2i_at_Parse_internal_16 GOTO label_FALSE_151 + # IF_ZERO local_a2i_at_Parse_internal_16 GOTO label_FALSE_151 + lw $t0, -68($fp) + beq $t0, 0, label_FALSE_151 + # LOCAL local_a2i_at_Parse_internal_11 --> -48($fp) + # LOCAL local_a2i_at_Parse_internal_13 --> -56($fp) + # Comparing -56($fp) type with String + la $v0, String + lw $a0, -56($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -48($fp) + # IF_ZERO local_a2i_at_Parse_internal_11 GOTO label_COMPARE_STRING_154 + # IF_ZERO local_a2i_at_Parse_internal_11 GOTO label_COMPARE_STRING_154 + lw $t0, -48($fp) + beq $t0, 0, label_COMPARE_STRING_154 + # LOCAL local_a2i_at_Parse_internal_11 --> -48($fp) + # LOCAL local_a2i_at_Parse_internal_13 --> -56($fp) + # Comparing -56($fp) type with Bool + la $v0, Bool + lw $a0, -56($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -48($fp) + # IF_ZERO local_a2i_at_Parse_internal_11 GOTO label_COMPARE_BY_VALUE_155 + # IF_ZERO local_a2i_at_Parse_internal_11 GOTO label_COMPARE_BY_VALUE_155 + lw $t0, -48($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_155 + # LOCAL local_a2i_at_Parse_internal_11 --> -48($fp) + # LOCAL local_a2i_at_Parse_internal_13 --> -56($fp) + # Comparing -56($fp) type with Int + la $v0, Int + lw $a0, -56($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -48($fp) + # IF_ZERO local_a2i_at_Parse_internal_11 GOTO label_COMPARE_BY_VALUE_155 + # IF_ZERO local_a2i_at_Parse_internal_11 GOTO label_COMPARE_BY_VALUE_155 + lw $t0, -48($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_155 + # LOCAL local_a2i_at_Parse_internal_11 --> -48($fp) + # LOCAL local_a2i_at_Parse_internal_13 --> -56($fp) + # LOCAL local_a2i_at_Parse_internal_16 --> -68($fp) + # Load pointers and SUB + lw $a0, -56($fp) + lw $a1, -68($fp) + sub $a0, $a0, $a1 + sw $a0, -48($fp) + # IF_ZERO local_a2i_at_Parse_internal_11 GOTO label_TRUE_152 + # IF_ZERO local_a2i_at_Parse_internal_11 GOTO label_TRUE_152 + lw $t0, -48($fp) + beq $t0, 0, label_TRUE_152 + # GOTO label_FALSE_151 + j label_FALSE_151 + label_COMPARE_BY_VALUE_155: + # LOCAL local_a2i_at_Parse_internal_11 --> -48($fp) + # LOCAL local_a2i_at_Parse_internal_13 --> -56($fp) + # LOCAL local_a2i_at_Parse_internal_16 --> -68($fp) + lw $a0, -56($fp) + lw $a1, -68($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -48($fp) + # IF_ZERO local_a2i_at_Parse_internal_11 GOTO label_TRUE_152 + # IF_ZERO local_a2i_at_Parse_internal_11 GOTO label_TRUE_152 + lw $t0, -48($fp) + beq $t0, 0, label_TRUE_152 + # GOTO label_FALSE_151 + j label_FALSE_151 + label_COMPARE_STRING_154: + # LOCAL local_a2i_at_Parse_internal_11 --> -48($fp) + # LOCAL local_a2i_at_Parse_internal_13 --> -56($fp) + # LOCAL local_a2i_at_Parse_internal_16 --> -68($fp) + # Load strings for comparison + lw $v0, -56($fp) + lw $v1, -68($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -48($fp) + # IF_ZERO local_a2i_at_Parse_internal_11 GOTO label_CONTINUE_156 + # IF_ZERO local_a2i_at_Parse_internal_11 GOTO label_CONTINUE_156 + lw $t0, -48($fp) + beq $t0, 0, label_CONTINUE_156 + # GOTO label_FALSE_151 + j label_FALSE_151 + label_CONTINUE_156: + # LOCAL local_a2i_at_Parse_internal_11 --> -48($fp) + # LOCAL local_a2i_at_Parse_internal_13 --> -56($fp) + # LOCAL local_a2i_at_Parse_internal_16 --> -68($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -56($fp) + lw $v1, -68($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_157: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_158 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_157 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_158: + # Store result + sw $a2, -48($fp) + # IF_ZERO local_a2i_at_Parse_internal_11 GOTO label_TRUE_152 + # IF_ZERO local_a2i_at_Parse_internal_11 GOTO label_TRUE_152 + lw $t0, -48($fp) + beq $t0, 0, label_TRUE_152 + label_FALSE_151: + # LOCAL local_a2i_at_Parse_internal_10 --> -44($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -44($fp) + # GOTO label_END_153 +j label_END_153 +label_TRUE_152: + # LOCAL local_a2i_at_Parse_internal_10 --> -44($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -44($fp) + label_END_153: +# LOCAL local_a2i_at_Parse_internal_8 --> -36($fp) +# LOCAL local_a2i_at_Parse_internal_10 --> -44($fp) +# Obtain value from -44($fp) +lw $v0, -44($fp) +lw $v0, 12($v0) +sw $v0, -36($fp) +# IF_ZERO local_a2i_at_Parse_internal_8 GOTO label_FALSEIF_149 +# IF_ZERO local_a2i_at_Parse_internal_8 GOTO label_FALSEIF_149 +lw $t0, -36($fp) +beq $t0, 0, label_FALSEIF_149 +# LOCAL local_a2i_at_Parse_internal_20 --> -84($fp) +# local_a2i_at_Parse_internal_20 = SELF +sw $s1, -84($fp) +# LOCAL local_a2i_at_Parse_internal_18 --> -76($fp) +# LOCAL local_a2i_at_Parse_internal_20 --> -84($fp) +# local_a2i_at_Parse_internal_18 = local_a2i_at_Parse_internal_20 +lw $t0, -84($fp) +sw $t0, -76($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_a2i_at_Parse_internal_21 --> -88($fp) +# PARAM param_a2i_at_Parse_s_0 --> 0($fp) +# local_a2i_at_Parse_internal_21 = PARAM param_a2i_at_Parse_s_0 +lw $t0, 0($fp) +sw $t0, -88($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_a2i_at_Parse_internal_23 --> -96($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 1 +sw $t0, 12($v0) +sw $v0, -96($fp) +# ARG local_a2i_at_Parse_internal_23 +# LOCAL local_a2i_at_Parse_internal_23 --> -96($fp) +lw $t0, -96($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_a2i_at_Parse_internal_25 --> -104($fp) +# PARAM param_a2i_at_Parse_s_0 --> 0($fp) +# local_a2i_at_Parse_internal_25 = PARAM param_a2i_at_Parse_s_0 +lw $t0, 0($fp) +sw $t0, -104($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_a2i_at_Parse_internal_25 --> -104($fp) +# LOCAL local_a2i_at_Parse_internal_26 --> -108($fp) +# local_a2i_at_Parse_internal_26 = VCALL local_a2i_at_Parse_internal_25 length +# Save new self pointer in $s1 +lw $s1, -104($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 36($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -108($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_a2i_at_Parse_internal_27 --> -112($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 1 +sw $t0, 12($v0) +sw $v0, -112($fp) +# LOCAL local_a2i_at_Parse_internal_24 --> -100($fp) +# LOCAL local_a2i_at_Parse_internal_26 --> -108($fp) +# LOCAL local_a2i_at_Parse_internal_27 --> -112($fp) +# local_a2i_at_Parse_internal_24 = local_a2i_at_Parse_internal_26 - local_a2i_at_Parse_internal_27 +lw $t1, -108($fp) +lw $t0, 12($t1) +lw $t1, -112($fp) +lw $t2, 12($t1) +sub $t0, $t0, $t2 +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t1, String +sw $t1, 0($v0) +la $t1, String_start +sw $t1, 4($v0) +# Load type offset +li $t1, 8 +sw $t1, 8($v0) +la $t1, Int +sw $t1, 12($v0) +li $t1, 3 +sw $t1, 16($v0) +move $t1, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t1, 0($v0) +la $t1, Int_start +sw $t1, 4($v0) +# Load type offset +li $t1, 16 +sw $t1, 8($v0) +sw $t0, 12($v0) +sw $v0, -100($fp) +# ARG local_a2i_at_Parse_internal_24 +# LOCAL local_a2i_at_Parse_internal_24 --> -100($fp) +lw $t0, -100($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_a2i_at_Parse_internal_21 --> -88($fp) +# LOCAL local_a2i_at_Parse_internal_22 --> -92($fp) +# local_a2i_at_Parse_internal_22 = VCALL local_a2i_at_Parse_internal_21 substr +# Save new self pointer in $s1 +lw $s1, -88($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 64($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -92($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# ARG local_a2i_at_Parse_internal_22 +# LOCAL local_a2i_at_Parse_internal_22 --> -92($fp) +lw $t0, -92($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_a2i_at_Parse_internal_18 --> -76($fp) +# LOCAL local_a2i_at_Parse_internal_19 --> -80($fp) +# local_a2i_at_Parse_internal_19 = VCALL local_a2i_at_Parse_internal_18 a2i_aux +# Save new self pointer in $s1 +lw $s1, -76($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 100($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -80($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_a2i_at_Parse_internal_17 --> -72($fp) +# LOCAL local_a2i_at_Parse_internal_19 --> -80($fp) +lw $t0, -80($fp) +lw $t0, 12($t0) +not $t0, $t0 +add $t0, $t0, 1 +sw $t0, -72($fp) +# LOCAL local_a2i_at_Parse_internal_17 --> -72($fp) +# LOCAL local_a2i_at_Parse_internal_17 --> -72($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +lw $t0, -72($fp) +sw $t0, 12($v0) +sw $v0, -72($fp) +# LOCAL local_a2i_at_Parse_internal_9 --> -40($fp) +# LOCAL local_a2i_at_Parse_internal_17 --> -72($fp) +# local_a2i_at_Parse_internal_9 = local_a2i_at_Parse_internal_17 +lw $t0, -72($fp) +sw $t0, -40($fp) +# GOTO label_ENDIF_150 +j label_ENDIF_150 +label_FALSEIF_149: + # LOCAL local_a2i_at_Parse_internal_32 --> -132($fp) + # PARAM param_a2i_at_Parse_s_0 --> 0($fp) + # local_a2i_at_Parse_internal_32 = PARAM param_a2i_at_Parse_s_0 + lw $t0, 0($fp) + sw $t0, -132($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_a2i_at_Parse_internal_34 --> -140($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -140($fp) + # ARG local_a2i_at_Parse_internal_34 + # LOCAL local_a2i_at_Parse_internal_34 --> -140($fp) + lw $t0, -140($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_a2i_at_Parse_internal_35 --> -144($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -144($fp) + # ARG local_a2i_at_Parse_internal_35 + # LOCAL local_a2i_at_Parse_internal_35 --> -144($fp) + lw $t0, -144($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_a2i_at_Parse_internal_32 --> -132($fp) + # LOCAL local_a2i_at_Parse_internal_33 --> -136($fp) + # local_a2i_at_Parse_internal_33 = VCALL local_a2i_at_Parse_internal_32 substr + # Save new self pointer in $s1 + lw $s1, -132($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 64($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -136($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_a2i_at_Parse_internal_36 --> -148($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_17 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -148($fp) + # IF_ZERO local_a2i_at_Parse_internal_33 GOTO label_FALSE_161 + # IF_ZERO local_a2i_at_Parse_internal_33 GOTO label_FALSE_161 + lw $t0, -136($fp) + beq $t0, 0, label_FALSE_161 + # IF_ZERO local_a2i_at_Parse_internal_36 GOTO label_FALSE_161 + # IF_ZERO local_a2i_at_Parse_internal_36 GOTO label_FALSE_161 + lw $t0, -148($fp) + beq $t0, 0, label_FALSE_161 + # LOCAL local_a2i_at_Parse_internal_31 --> -128($fp) + # LOCAL local_a2i_at_Parse_internal_33 --> -136($fp) + # Comparing -136($fp) type with String + la $v0, String + lw $a0, -136($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -128($fp) + # IF_ZERO local_a2i_at_Parse_internal_31 GOTO label_COMPARE_STRING_164 + # IF_ZERO local_a2i_at_Parse_internal_31 GOTO label_COMPARE_STRING_164 + lw $t0, -128($fp) + beq $t0, 0, label_COMPARE_STRING_164 + # LOCAL local_a2i_at_Parse_internal_31 --> -128($fp) + # LOCAL local_a2i_at_Parse_internal_33 --> -136($fp) + # Comparing -136($fp) type with Bool + la $v0, Bool + lw $a0, -136($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -128($fp) + # IF_ZERO local_a2i_at_Parse_internal_31 GOTO label_COMPARE_BY_VALUE_165 + # IF_ZERO local_a2i_at_Parse_internal_31 GOTO label_COMPARE_BY_VALUE_165 + lw $t0, -128($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_165 + # LOCAL local_a2i_at_Parse_internal_31 --> -128($fp) + # LOCAL local_a2i_at_Parse_internal_33 --> -136($fp) + # Comparing -136($fp) type with Int + la $v0, Int + lw $a0, -136($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -128($fp) + # IF_ZERO local_a2i_at_Parse_internal_31 GOTO label_COMPARE_BY_VALUE_165 + # IF_ZERO local_a2i_at_Parse_internal_31 GOTO label_COMPARE_BY_VALUE_165 + lw $t0, -128($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_165 + # LOCAL local_a2i_at_Parse_internal_31 --> -128($fp) + # LOCAL local_a2i_at_Parse_internal_33 --> -136($fp) + # LOCAL local_a2i_at_Parse_internal_36 --> -148($fp) + # Load pointers and SUB + lw $a0, -136($fp) + lw $a1, -148($fp) + sub $a0, $a0, $a1 + sw $a0, -128($fp) + # IF_ZERO local_a2i_at_Parse_internal_31 GOTO label_TRUE_162 + # IF_ZERO local_a2i_at_Parse_internal_31 GOTO label_TRUE_162 + lw $t0, -128($fp) + beq $t0, 0, label_TRUE_162 + # GOTO label_FALSE_161 + j label_FALSE_161 + label_COMPARE_BY_VALUE_165: + # LOCAL local_a2i_at_Parse_internal_31 --> -128($fp) + # LOCAL local_a2i_at_Parse_internal_33 --> -136($fp) + # LOCAL local_a2i_at_Parse_internal_36 --> -148($fp) + lw $a0, -136($fp) + lw $a1, -148($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -128($fp) + # IF_ZERO local_a2i_at_Parse_internal_31 GOTO label_TRUE_162 + # IF_ZERO local_a2i_at_Parse_internal_31 GOTO label_TRUE_162 + lw $t0, -128($fp) + beq $t0, 0, label_TRUE_162 + # GOTO label_FALSE_161 + j label_FALSE_161 + label_COMPARE_STRING_164: + # LOCAL local_a2i_at_Parse_internal_31 --> -128($fp) + # LOCAL local_a2i_at_Parse_internal_33 --> -136($fp) + # LOCAL local_a2i_at_Parse_internal_36 --> -148($fp) + # Load strings for comparison + lw $v0, -136($fp) + lw $v1, -148($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -128($fp) + # IF_ZERO local_a2i_at_Parse_internal_31 GOTO label_CONTINUE_166 + # IF_ZERO local_a2i_at_Parse_internal_31 GOTO label_CONTINUE_166 + lw $t0, -128($fp) + beq $t0, 0, label_CONTINUE_166 + # GOTO label_FALSE_161 + j label_FALSE_161 + label_CONTINUE_166: + # LOCAL local_a2i_at_Parse_internal_31 --> -128($fp) + # LOCAL local_a2i_at_Parse_internal_33 --> -136($fp) + # LOCAL local_a2i_at_Parse_internal_36 --> -148($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -136($fp) + lw $v1, -148($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_167: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_168 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_167 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_168: + # Store result + sw $a2, -128($fp) + # IF_ZERO local_a2i_at_Parse_internal_31 GOTO label_TRUE_162 + # IF_ZERO local_a2i_at_Parse_internal_31 GOTO label_TRUE_162 + lw $t0, -128($fp) + beq $t0, 0, label_TRUE_162 + label_FALSE_161: + # LOCAL local_a2i_at_Parse_internal_30 --> -124($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -124($fp) + # GOTO label_END_163 +j label_END_163 +label_TRUE_162: + # LOCAL local_a2i_at_Parse_internal_30 --> -124($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -124($fp) + label_END_163: +# LOCAL local_a2i_at_Parse_internal_28 --> -116($fp) +# LOCAL local_a2i_at_Parse_internal_30 --> -124($fp) +# Obtain value from -124($fp) +lw $v0, -124($fp) +lw $v0, 12($v0) +sw $v0, -116($fp) +# IF_ZERO local_a2i_at_Parse_internal_28 GOTO label_FALSEIF_159 +# IF_ZERO local_a2i_at_Parse_internal_28 GOTO label_FALSEIF_159 +lw $t0, -116($fp) +beq $t0, 0, label_FALSEIF_159 +# LOCAL local_a2i_at_Parse_internal_39 --> -160($fp) +# local_a2i_at_Parse_internal_39 = SELF +sw $s1, -160($fp) +# LOCAL local_a2i_at_Parse_internal_37 --> -152($fp) +# LOCAL local_a2i_at_Parse_internal_39 --> -160($fp) +# local_a2i_at_Parse_internal_37 = local_a2i_at_Parse_internal_39 +lw $t0, -160($fp) +sw $t0, -152($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_a2i_at_Parse_internal_40 --> -164($fp) +# PARAM param_a2i_at_Parse_s_0 --> 0($fp) +# local_a2i_at_Parse_internal_40 = PARAM param_a2i_at_Parse_s_0 +lw $t0, 0($fp) +sw $t0, -164($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_a2i_at_Parse_internal_42 --> -172($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 1 +sw $t0, 12($v0) +sw $v0, -172($fp) +# ARG local_a2i_at_Parse_internal_42 +# LOCAL local_a2i_at_Parse_internal_42 --> -172($fp) +lw $t0, -172($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_a2i_at_Parse_internal_44 --> -180($fp) +# PARAM param_a2i_at_Parse_s_0 --> 0($fp) +# local_a2i_at_Parse_internal_44 = PARAM param_a2i_at_Parse_s_0 +lw $t0, 0($fp) +sw $t0, -180($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_a2i_at_Parse_internal_44 --> -180($fp) +# LOCAL local_a2i_at_Parse_internal_45 --> -184($fp) +# local_a2i_at_Parse_internal_45 = VCALL local_a2i_at_Parse_internal_44 length +# Save new self pointer in $s1 +lw $s1, -180($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 36($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -184($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_a2i_at_Parse_internal_46 --> -188($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 1 +sw $t0, 12($v0) +sw $v0, -188($fp) +# LOCAL local_a2i_at_Parse_internal_43 --> -176($fp) +# LOCAL local_a2i_at_Parse_internal_45 --> -184($fp) +# LOCAL local_a2i_at_Parse_internal_46 --> -188($fp) +# local_a2i_at_Parse_internal_43 = local_a2i_at_Parse_internal_45 - local_a2i_at_Parse_internal_46 +lw $t1, -184($fp) +lw $t0, 12($t1) +lw $t1, -188($fp) +lw $t2, 12($t1) +sub $t0, $t0, $t2 +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t1, String +sw $t1, 0($v0) +la $t1, String_start +sw $t1, 4($v0) +# Load type offset +li $t1, 8 +sw $t1, 8($v0) +la $t1, Int +sw $t1, 12($v0) +li $t1, 3 +sw $t1, 16($v0) +move $t1, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t1, 0($v0) +la $t1, Int_start +sw $t1, 4($v0) +# Load type offset +li $t1, 16 +sw $t1, 8($v0) +sw $t0, 12($v0) +sw $v0, -176($fp) +# ARG local_a2i_at_Parse_internal_43 +# LOCAL local_a2i_at_Parse_internal_43 --> -176($fp) +lw $t0, -176($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_a2i_at_Parse_internal_40 --> -164($fp) +# LOCAL local_a2i_at_Parse_internal_41 --> -168($fp) +# local_a2i_at_Parse_internal_41 = VCALL local_a2i_at_Parse_internal_40 substr +# Save new self pointer in $s1 +lw $s1, -164($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 64($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -168($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# ARG local_a2i_at_Parse_internal_41 +# LOCAL local_a2i_at_Parse_internal_41 --> -168($fp) +lw $t0, -168($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_a2i_at_Parse_internal_37 --> -152($fp) +# LOCAL local_a2i_at_Parse_internal_38 --> -156($fp) +# local_a2i_at_Parse_internal_38 = VCALL local_a2i_at_Parse_internal_37 a2i +# Save new self pointer in $s1 +lw $s1, -152($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 44($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -156($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_a2i_at_Parse_internal_29 --> -120($fp) +# LOCAL local_a2i_at_Parse_internal_38 --> -156($fp) +# local_a2i_at_Parse_internal_29 = local_a2i_at_Parse_internal_38 +lw $t0, -156($fp) +sw $t0, -120($fp) +# GOTO label_ENDIF_160 +j label_ENDIF_160 +label_FALSEIF_159: + # LOCAL local_a2i_at_Parse_internal_49 --> -200($fp) + # local_a2i_at_Parse_internal_49 = SELF + sw $s1, -200($fp) + # LOCAL local_a2i_at_Parse_internal_47 --> -192($fp) + # LOCAL local_a2i_at_Parse_internal_49 --> -200($fp) + # local_a2i_at_Parse_internal_47 = local_a2i_at_Parse_internal_49 + lw $t0, -200($fp) + sw $t0, -192($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # ARG param_a2i_at_Parse_s_0 + # PARAM param_a2i_at_Parse_s_0 --> 0($fp) + lw $t0, 0($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_a2i_at_Parse_internal_47 --> -192($fp) + # LOCAL local_a2i_at_Parse_internal_48 --> -196($fp) + # local_a2i_at_Parse_internal_48 = VCALL local_a2i_at_Parse_internal_47 a2i_aux + # Save new self pointer in $s1 + lw $s1, -192($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 100($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -196($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_a2i_at_Parse_internal_29 --> -120($fp) + # LOCAL local_a2i_at_Parse_internal_48 --> -196($fp) + # local_a2i_at_Parse_internal_29 = local_a2i_at_Parse_internal_48 + lw $t0, -196($fp) + sw $t0, -120($fp) + label_ENDIF_160: +# LOCAL local_a2i_at_Parse_internal_9 --> -40($fp) +# LOCAL local_a2i_at_Parse_internal_29 --> -120($fp) +# local_a2i_at_Parse_internal_9 = local_a2i_at_Parse_internal_29 +lw $t0, -120($fp) +sw $t0, -40($fp) +label_ENDIF_150: +# LOCAL local_a2i_at_Parse_internal_1 --> -8($fp) +# LOCAL local_a2i_at_Parse_internal_9 --> -40($fp) +# local_a2i_at_Parse_internal_1 = local_a2i_at_Parse_internal_9 +lw $t0, -40($fp) +sw $t0, -8($fp) +label_ENDIF_140: +# RETURN local_a2i_at_Parse_internal_1 +lw $v0, -8($fp) +# Deallocate stack frame for function function_a2i_at_Parse. +# Restore $ra +lw $ra, 4($sp) +# Restore $fp +lw $fp, 0($sp) +# Restore Stack pointer $sp +addu $sp, $sp, 208 +# Deallocate function args +addu $sp, $sp, 4 +jr $ra +# Function END + + +# function_a2i_aux_at_Parse implementation. +# @Params: +# 0($fp) = param_a2i_aux_at_Parse_s_0 +function_a2i_aux_at_Parse: + # Allocate stack frame for function function_a2i_aux_at_Parse. + subu $sp, $sp, 240 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 240 + # LOCAL local_a2i_aux_at_Parse_int_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -4($fp) + # LOCAL local_a2i_aux_at_Parse_internal_1 --> -8($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -8($fp) + # LOCAL local_a2i_aux_at_Parse_int_0 --> -4($fp) + # LOCAL local_a2i_aux_at_Parse_internal_1 --> -8($fp) + # local_a2i_aux_at_Parse_int_0 = local_a2i_aux_at_Parse_internal_1 + lw $t0, -8($fp) + sw $t0, -4($fp) + # LOCAL local_a2i_aux_at_Parse_j_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -12($fp) + # LOCAL local_a2i_aux_at_Parse_internal_3 --> -16($fp) + # PARAM param_a2i_aux_at_Parse_s_0 --> 0($fp) + # local_a2i_aux_at_Parse_internal_3 = PARAM param_a2i_aux_at_Parse_s_0 + lw $t0, 0($fp) + sw $t0, -16($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_a2i_aux_at_Parse_internal_3 --> -16($fp) + # LOCAL local_a2i_aux_at_Parse_internal_4 --> -20($fp) + # local_a2i_aux_at_Parse_internal_4 = VCALL local_a2i_aux_at_Parse_internal_3 length + # Save new self pointer in $s1 + lw $s1, -16($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 36($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -20($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_a2i_aux_at_Parse_j_2 --> -12($fp) + # LOCAL local_a2i_aux_at_Parse_internal_4 --> -20($fp) + # local_a2i_aux_at_Parse_j_2 = local_a2i_aux_at_Parse_internal_4 + lw $t0, -20($fp) + sw $t0, -12($fp) + # LOCAL local_a2i_aux_at_Parse_i_5 --> -24($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -24($fp) + # LOCAL local_a2i_aux_at_Parse_internal_6 --> -28($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -28($fp) + # LOCAL local_a2i_aux_at_Parse_i_5 --> -24($fp) + # LOCAL local_a2i_aux_at_Parse_internal_6 --> -28($fp) + # local_a2i_aux_at_Parse_i_5 = local_a2i_aux_at_Parse_internal_6 + lw $t0, -28($fp) + sw $t0, -24($fp) + label_WHILE_169: + # LOCAL local_a2i_aux_at_Parse_internal_8 --> -36($fp) + # LOCAL local_a2i_aux_at_Parse_i_5 --> -24($fp) + # LOCAL local_a2i_aux_at_Parse_j_2 --> -12($fp) + lw $a0, -24($fp) + lw $a1, -12($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -36($fp) + # IF_GREATER_ZERO local_a2i_aux_at_Parse_internal_8 GOTO label_FALSE_171 + # IF_GREATER_ZERO local_a2i_aux_at_Parse_internal_8 GOTO label_FALSE_171 + lw $t0, -36($fp) + bgt $t0, 0, label_FALSE_171 + # IF_ZERO local_a2i_aux_at_Parse_internal_8 GOTO label_FALSE_171 + # IF_ZERO local_a2i_aux_at_Parse_internal_8 GOTO label_FALSE_171 + lw $t0, -36($fp) + beq $t0, 0, label_FALSE_171 + # LOCAL local_a2i_aux_at_Parse_internal_8 --> -36($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -36($fp) + # GOTO label_END_172 +j label_END_172 +label_FALSE_171: + # LOCAL local_a2i_aux_at_Parse_internal_8 --> -36($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -36($fp) + label_END_172: +# LOCAL local_a2i_aux_at_Parse_internal_7 --> -32($fp) +# LOCAL local_a2i_aux_at_Parse_internal_8 --> -36($fp) +# Obtain value from -36($fp) +lw $v0, -36($fp) +lw $v0, 12($v0) +sw $v0, -32($fp) +# IF_ZERO local_a2i_aux_at_Parse_internal_7 GOTO label_WHILE_END_170 +# IF_ZERO local_a2i_aux_at_Parse_internal_7 GOTO label_WHILE_END_170 +lw $t0, -32($fp) +beq $t0, 0, label_WHILE_END_170 +# LOCAL local_a2i_aux_at_Parse_c_9 --> -40($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_0 +sw $t0, 12($v0) +li $t0, 0 +sw $t0, 16($v0) +sw $v0, -40($fp) +# LOCAL local_a2i_aux_at_Parse_internal_10 --> -44($fp) +# PARAM param_a2i_aux_at_Parse_s_0 --> 0($fp) +# local_a2i_aux_at_Parse_internal_10 = PARAM param_a2i_aux_at_Parse_s_0 +lw $t0, 0($fp) +sw $t0, -44($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# ARG local_a2i_aux_at_Parse_i_5 +# LOCAL local_a2i_aux_at_Parse_i_5 --> -24($fp) +lw $t0, -24($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_a2i_aux_at_Parse_internal_12 --> -52($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 1 +sw $t0, 12($v0) +sw $v0, -52($fp) +# ARG local_a2i_aux_at_Parse_internal_12 +# LOCAL local_a2i_aux_at_Parse_internal_12 --> -52($fp) +lw $t0, -52($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_a2i_aux_at_Parse_internal_10 --> -44($fp) +# LOCAL local_a2i_aux_at_Parse_internal_11 --> -48($fp) +# local_a2i_aux_at_Parse_internal_11 = VCALL local_a2i_aux_at_Parse_internal_10 substr +# Save new self pointer in $s1 +lw $s1, -44($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 64($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -48($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_a2i_aux_at_Parse_c_9 --> -40($fp) +# LOCAL local_a2i_aux_at_Parse_internal_11 --> -48($fp) +# local_a2i_aux_at_Parse_c_9 = local_a2i_aux_at_Parse_internal_11 +lw $t0, -48($fp) +sw $t0, -40($fp) +# LOCAL local_a2i_aux_at_Parse_internal_17 --> -72($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_18 +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +sw $v0, -72($fp) +# IF_ZERO local_a2i_aux_at_Parse_c_9 GOTO label_FALSE_175 +# IF_ZERO local_a2i_aux_at_Parse_c_9 GOTO label_FALSE_175 +lw $t0, -40($fp) +beq $t0, 0, label_FALSE_175 +# IF_ZERO local_a2i_aux_at_Parse_internal_17 GOTO label_FALSE_175 +# IF_ZERO local_a2i_aux_at_Parse_internal_17 GOTO label_FALSE_175 +lw $t0, -72($fp) +beq $t0, 0, label_FALSE_175 +# LOCAL local_a2i_aux_at_Parse_internal_16 --> -68($fp) +# LOCAL local_a2i_aux_at_Parse_c_9 --> -40($fp) +# Comparing -40($fp) type with String +la $v0, String +lw $a0, -40($fp) +lw $a0, 0($a0) +sub $a0, $a0, $v0 +sw $a0, -68($fp) +# IF_ZERO local_a2i_aux_at_Parse_internal_16 GOTO label_COMPARE_STRING_178 +# IF_ZERO local_a2i_aux_at_Parse_internal_16 GOTO label_COMPARE_STRING_178 +lw $t0, -68($fp) +beq $t0, 0, label_COMPARE_STRING_178 +# LOCAL local_a2i_aux_at_Parse_internal_16 --> -68($fp) +# LOCAL local_a2i_aux_at_Parse_c_9 --> -40($fp) +# Comparing -40($fp) type with Bool +la $v0, Bool +lw $a0, -40($fp) +lw $a0, 0($a0) +lw $a0, 12($a0) +sub $a0, $a0, $v0 +sw $a0, -68($fp) +# IF_ZERO local_a2i_aux_at_Parse_internal_16 GOTO label_COMPARE_BY_VALUE_179 +# IF_ZERO local_a2i_aux_at_Parse_internal_16 GOTO label_COMPARE_BY_VALUE_179 +lw $t0, -68($fp) +beq $t0, 0, label_COMPARE_BY_VALUE_179 +# LOCAL local_a2i_aux_at_Parse_internal_16 --> -68($fp) +# LOCAL local_a2i_aux_at_Parse_c_9 --> -40($fp) +# Comparing -40($fp) type with Int +la $v0, Int +lw $a0, -40($fp) +lw $a0, 0($a0) +lw $a0, 12($a0) +sub $a0, $a0, $v0 +sw $a0, -68($fp) +# IF_ZERO local_a2i_aux_at_Parse_internal_16 GOTO label_COMPARE_BY_VALUE_179 +# IF_ZERO local_a2i_aux_at_Parse_internal_16 GOTO label_COMPARE_BY_VALUE_179 +lw $t0, -68($fp) +beq $t0, 0, label_COMPARE_BY_VALUE_179 +# LOCAL local_a2i_aux_at_Parse_internal_16 --> -68($fp) +# LOCAL local_a2i_aux_at_Parse_c_9 --> -40($fp) +# LOCAL local_a2i_aux_at_Parse_internal_17 --> -72($fp) +# Load pointers and SUB +lw $a0, -40($fp) +lw $a1, -72($fp) +sub $a0, $a0, $a1 +sw $a0, -68($fp) +# IF_ZERO local_a2i_aux_at_Parse_internal_16 GOTO label_TRUE_176 +# IF_ZERO local_a2i_aux_at_Parse_internal_16 GOTO label_TRUE_176 +lw $t0, -68($fp) +beq $t0, 0, label_TRUE_176 +# GOTO label_FALSE_175 +j label_FALSE_175 +label_COMPARE_BY_VALUE_179: + # LOCAL local_a2i_aux_at_Parse_internal_16 --> -68($fp) + # LOCAL local_a2i_aux_at_Parse_c_9 --> -40($fp) + # LOCAL local_a2i_aux_at_Parse_internal_17 --> -72($fp) + lw $a0, -40($fp) + lw $a1, -72($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -68($fp) + # IF_ZERO local_a2i_aux_at_Parse_internal_16 GOTO label_TRUE_176 + # IF_ZERO local_a2i_aux_at_Parse_internal_16 GOTO label_TRUE_176 + lw $t0, -68($fp) + beq $t0, 0, label_TRUE_176 + # GOTO label_FALSE_175 + j label_FALSE_175 + label_COMPARE_STRING_178: + # LOCAL local_a2i_aux_at_Parse_internal_16 --> -68($fp) + # LOCAL local_a2i_aux_at_Parse_c_9 --> -40($fp) + # LOCAL local_a2i_aux_at_Parse_internal_17 --> -72($fp) + # Load strings for comparison + lw $v0, -40($fp) + lw $v1, -72($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -68($fp) + # IF_ZERO local_a2i_aux_at_Parse_internal_16 GOTO label_CONTINUE_180 + # IF_ZERO local_a2i_aux_at_Parse_internal_16 GOTO label_CONTINUE_180 + lw $t0, -68($fp) + beq $t0, 0, label_CONTINUE_180 + # GOTO label_FALSE_175 + j label_FALSE_175 + label_CONTINUE_180: + # LOCAL local_a2i_aux_at_Parse_internal_16 --> -68($fp) + # LOCAL local_a2i_aux_at_Parse_c_9 --> -40($fp) + # LOCAL local_a2i_aux_at_Parse_internal_17 --> -72($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -40($fp) + lw $v1, -72($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_181: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_182 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_181 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_182: + # Store result + sw $a2, -68($fp) + # IF_ZERO local_a2i_aux_at_Parse_internal_16 GOTO label_TRUE_176 + # IF_ZERO local_a2i_aux_at_Parse_internal_16 GOTO label_TRUE_176 + lw $t0, -68($fp) + beq $t0, 0, label_TRUE_176 + label_FALSE_175: + # LOCAL local_a2i_aux_at_Parse_internal_15 --> -64($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -64($fp) + # GOTO label_END_177 +j label_END_177 +label_TRUE_176: + # LOCAL local_a2i_aux_at_Parse_internal_15 --> -64($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -64($fp) + label_END_177: +# LOCAL local_a2i_aux_at_Parse_internal_13 --> -56($fp) +# LOCAL local_a2i_aux_at_Parse_internal_15 --> -64($fp) +# Obtain value from -64($fp) +lw $v0, -64($fp) +lw $v0, 12($v0) +sw $v0, -56($fp) +# IF_ZERO local_a2i_aux_at_Parse_internal_13 GOTO label_FALSEIF_173 +# IF_ZERO local_a2i_aux_at_Parse_internal_13 GOTO label_FALSEIF_173 +lw $t0, -56($fp) +beq $t0, 0, label_FALSEIF_173 +# LOCAL local_a2i_aux_at_Parse_internal_18 --> -76($fp) +# PARAM param_a2i_aux_at_Parse_s_0 --> 0($fp) +# local_a2i_aux_at_Parse_internal_18 = PARAM param_a2i_aux_at_Parse_s_0 +lw $t0, 0($fp) +sw $t0, -76($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_a2i_aux_at_Parse_internal_21 --> -88($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 1 +sw $t0, 12($v0) +sw $v0, -88($fp) +# LOCAL local_a2i_aux_at_Parse_internal_20 --> -84($fp) +# LOCAL local_a2i_aux_at_Parse_i_5 --> -24($fp) +# LOCAL local_a2i_aux_at_Parse_internal_21 --> -88($fp) +# local_a2i_aux_at_Parse_internal_20 = local_a2i_aux_at_Parse_i_5 + local_a2i_aux_at_Parse_internal_21 +lw $t1, -24($fp) +lw $t0, 12($t1) +lw $t1, -88($fp) +lw $t2, 12($t1) +add $t0, $t0, $t2 +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t1, String +sw $t1, 0($v0) +la $t1, String_start +sw $t1, 4($v0) +# Load type offset +li $t1, 8 +sw $t1, 8($v0) +la $t1, Int +sw $t1, 12($v0) +li $t1, 3 +sw $t1, 16($v0) +move $t1, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t1, 0($v0) +la $t1, Int_start +sw $t1, 4($v0) +# Load type offset +li $t1, 16 +sw $t1, 8($v0) +sw $t0, 12($v0) +sw $v0, -84($fp) +# ARG local_a2i_aux_at_Parse_internal_20 +# LOCAL local_a2i_aux_at_Parse_internal_20 --> -84($fp) +lw $t0, -84($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_a2i_aux_at_Parse_internal_24 --> -100($fp) +# PARAM param_a2i_aux_at_Parse_s_0 --> 0($fp) +# local_a2i_aux_at_Parse_internal_24 = PARAM param_a2i_aux_at_Parse_s_0 +lw $t0, 0($fp) +sw $t0, -100($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_a2i_aux_at_Parse_internal_24 --> -100($fp) +# LOCAL local_a2i_aux_at_Parse_internal_25 --> -104($fp) +# local_a2i_aux_at_Parse_internal_25 = VCALL local_a2i_aux_at_Parse_internal_24 length +# Save new self pointer in $s1 +lw $s1, -100($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 36($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -104($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_a2i_aux_at_Parse_internal_23 --> -96($fp) +# LOCAL local_a2i_aux_at_Parse_internal_25 --> -104($fp) +# LOCAL local_a2i_aux_at_Parse_i_5 --> -24($fp) +# local_a2i_aux_at_Parse_internal_23 = local_a2i_aux_at_Parse_internal_25 - local_a2i_aux_at_Parse_i_5 +lw $t1, -104($fp) +lw $t0, 12($t1) +lw $t1, -24($fp) +lw $t2, 12($t1) +sub $t0, $t0, $t2 +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t1, String +sw $t1, 0($v0) +la $t1, String_start +sw $t1, 4($v0) +# Load type offset +li $t1, 8 +sw $t1, 8($v0) +la $t1, Int +sw $t1, 12($v0) +li $t1, 3 +sw $t1, 16($v0) +move $t1, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t1, 0($v0) +la $t1, Int_start +sw $t1, 4($v0) +# Load type offset +li $t1, 16 +sw $t1, 8($v0) +sw $t0, 12($v0) +sw $v0, -96($fp) +# LOCAL local_a2i_aux_at_Parse_internal_26 --> -108($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 1 +sw $t0, 12($v0) +sw $v0, -108($fp) +# LOCAL local_a2i_aux_at_Parse_internal_22 --> -92($fp) +# LOCAL local_a2i_aux_at_Parse_internal_23 --> -96($fp) +# LOCAL local_a2i_aux_at_Parse_internal_26 --> -108($fp) +# local_a2i_aux_at_Parse_internal_22 = local_a2i_aux_at_Parse_internal_23 - local_a2i_aux_at_Parse_internal_26 +lw $t1, -96($fp) +lw $t0, 12($t1) +lw $t1, -108($fp) +lw $t2, 12($t1) +sub $t0, $t0, $t2 +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t1, String +sw $t1, 0($v0) +la $t1, String_start +sw $t1, 4($v0) +# Load type offset +li $t1, 8 +sw $t1, 8($v0) +la $t1, Int +sw $t1, 12($v0) +li $t1, 3 +sw $t1, 16($v0) +move $t1, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t1, 0($v0) +la $t1, Int_start +sw $t1, 4($v0) +# Load type offset +li $t1, 16 +sw $t1, 8($v0) +sw $t0, 12($v0) +sw $v0, -92($fp) +# ARG local_a2i_aux_at_Parse_internal_22 +# LOCAL local_a2i_aux_at_Parse_internal_22 --> -92($fp) +lw $t0, -92($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_a2i_aux_at_Parse_internal_18 --> -76($fp) +# LOCAL local_a2i_aux_at_Parse_internal_19 --> -80($fp) +# local_a2i_aux_at_Parse_internal_19 = VCALL local_a2i_aux_at_Parse_internal_18 substr +# Save new self pointer in $s1 +lw $s1, -76($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 64($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -80($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# +# LOCAL local_a2i_aux_at_Parse_internal_19 --> -80($fp) +lw $t0, -80($fp) +sw $t0, 16($s1) +# LOCAL local_a2i_aux_at_Parse_i_5 --> -24($fp) +# LOCAL local_a2i_aux_at_Parse_j_2 --> -12($fp) +# local_a2i_aux_at_Parse_i_5 = local_a2i_aux_at_Parse_j_2 +lw $t0, -12($fp) +sw $t0, -24($fp) +# LOCAL local_a2i_aux_at_Parse_internal_14 --> -60($fp) +# local_a2i_aux_at_Parse_internal_14 = +# GOTO label_ENDIF_174 +j label_ENDIF_174 +label_FALSEIF_173: + # LOCAL local_a2i_aux_at_Parse_internal_31 --> -128($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_19 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -128($fp) + # IF_ZERO local_a2i_aux_at_Parse_c_9 GOTO label_FALSE_185 + # IF_ZERO local_a2i_aux_at_Parse_c_9 GOTO label_FALSE_185 + lw $t0, -40($fp) + beq $t0, 0, label_FALSE_185 + # IF_ZERO local_a2i_aux_at_Parse_internal_31 GOTO label_FALSE_185 + # IF_ZERO local_a2i_aux_at_Parse_internal_31 GOTO label_FALSE_185 + lw $t0, -128($fp) + beq $t0, 0, label_FALSE_185 + # LOCAL local_a2i_aux_at_Parse_internal_30 --> -124($fp) + # LOCAL local_a2i_aux_at_Parse_c_9 --> -40($fp) + # Comparing -40($fp) type with String + la $v0, String + lw $a0, -40($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -124($fp) + # IF_ZERO local_a2i_aux_at_Parse_internal_30 GOTO label_COMPARE_STRING_188 + # IF_ZERO local_a2i_aux_at_Parse_internal_30 GOTO label_COMPARE_STRING_188 + lw $t0, -124($fp) + beq $t0, 0, label_COMPARE_STRING_188 + # LOCAL local_a2i_aux_at_Parse_internal_30 --> -124($fp) + # LOCAL local_a2i_aux_at_Parse_c_9 --> -40($fp) + # Comparing -40($fp) type with Bool + la $v0, Bool + lw $a0, -40($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -124($fp) + # IF_ZERO local_a2i_aux_at_Parse_internal_30 GOTO label_COMPARE_BY_VALUE_189 + # IF_ZERO local_a2i_aux_at_Parse_internal_30 GOTO label_COMPARE_BY_VALUE_189 + lw $t0, -124($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_189 + # LOCAL local_a2i_aux_at_Parse_internal_30 --> -124($fp) + # LOCAL local_a2i_aux_at_Parse_c_9 --> -40($fp) + # Comparing -40($fp) type with Int + la $v0, Int + lw $a0, -40($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -124($fp) + # IF_ZERO local_a2i_aux_at_Parse_internal_30 GOTO label_COMPARE_BY_VALUE_189 + # IF_ZERO local_a2i_aux_at_Parse_internal_30 GOTO label_COMPARE_BY_VALUE_189 + lw $t0, -124($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_189 + # LOCAL local_a2i_aux_at_Parse_internal_30 --> -124($fp) + # LOCAL local_a2i_aux_at_Parse_c_9 --> -40($fp) + # LOCAL local_a2i_aux_at_Parse_internal_31 --> -128($fp) + # Load pointers and SUB + lw $a0, -40($fp) + lw $a1, -128($fp) + sub $a0, $a0, $a1 + sw $a0, -124($fp) + # IF_ZERO local_a2i_aux_at_Parse_internal_30 GOTO label_TRUE_186 + # IF_ZERO local_a2i_aux_at_Parse_internal_30 GOTO label_TRUE_186 + lw $t0, -124($fp) + beq $t0, 0, label_TRUE_186 + # GOTO label_FALSE_185 + j label_FALSE_185 + label_COMPARE_BY_VALUE_189: + # LOCAL local_a2i_aux_at_Parse_internal_30 --> -124($fp) + # LOCAL local_a2i_aux_at_Parse_c_9 --> -40($fp) + # LOCAL local_a2i_aux_at_Parse_internal_31 --> -128($fp) + lw $a0, -40($fp) + lw $a1, -128($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -124($fp) + # IF_ZERO local_a2i_aux_at_Parse_internal_30 GOTO label_TRUE_186 + # IF_ZERO local_a2i_aux_at_Parse_internal_30 GOTO label_TRUE_186 + lw $t0, -124($fp) + beq $t0, 0, label_TRUE_186 + # GOTO label_FALSE_185 + j label_FALSE_185 + label_COMPARE_STRING_188: + # LOCAL local_a2i_aux_at_Parse_internal_30 --> -124($fp) + # LOCAL local_a2i_aux_at_Parse_c_9 --> -40($fp) + # LOCAL local_a2i_aux_at_Parse_internal_31 --> -128($fp) + # Load strings for comparison + lw $v0, -40($fp) + lw $v1, -128($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -124($fp) + # IF_ZERO local_a2i_aux_at_Parse_internal_30 GOTO label_CONTINUE_190 + # IF_ZERO local_a2i_aux_at_Parse_internal_30 GOTO label_CONTINUE_190 + lw $t0, -124($fp) + beq $t0, 0, label_CONTINUE_190 + # GOTO label_FALSE_185 + j label_FALSE_185 + label_CONTINUE_190: + # LOCAL local_a2i_aux_at_Parse_internal_30 --> -124($fp) + # LOCAL local_a2i_aux_at_Parse_c_9 --> -40($fp) + # LOCAL local_a2i_aux_at_Parse_internal_31 --> -128($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -40($fp) + lw $v1, -128($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_191: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_192 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_191 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_192: + # Store result + sw $a2, -124($fp) + # IF_ZERO local_a2i_aux_at_Parse_internal_30 GOTO label_TRUE_186 + # IF_ZERO local_a2i_aux_at_Parse_internal_30 GOTO label_TRUE_186 + lw $t0, -124($fp) + beq $t0, 0, label_TRUE_186 + label_FALSE_185: + # LOCAL local_a2i_aux_at_Parse_internal_29 --> -120($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -120($fp) + # GOTO label_END_187 +j label_END_187 +label_TRUE_186: + # LOCAL local_a2i_aux_at_Parse_internal_29 --> -120($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -120($fp) + label_END_187: +# LOCAL local_a2i_aux_at_Parse_internal_27 --> -112($fp) +# LOCAL local_a2i_aux_at_Parse_internal_29 --> -120($fp) +# Obtain value from -120($fp) +lw $v0, -120($fp) +lw $v0, 12($v0) +sw $v0, -112($fp) +# IF_ZERO local_a2i_aux_at_Parse_internal_27 GOTO label_FALSEIF_183 +# IF_ZERO local_a2i_aux_at_Parse_internal_27 GOTO label_FALSEIF_183 +lw $t0, -112($fp) +beq $t0, 0, label_FALSEIF_183 +# LOCAL local_a2i_aux_at_Parse_internal_32 --> -132($fp) +# PARAM param_a2i_aux_at_Parse_s_0 --> 0($fp) +# local_a2i_aux_at_Parse_internal_32 = PARAM param_a2i_aux_at_Parse_s_0 +lw $t0, 0($fp) +sw $t0, -132($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_a2i_aux_at_Parse_internal_35 --> -144($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 1 +sw $t0, 12($v0) +sw $v0, -144($fp) +# LOCAL local_a2i_aux_at_Parse_internal_34 --> -140($fp) +# LOCAL local_a2i_aux_at_Parse_i_5 --> -24($fp) +# LOCAL local_a2i_aux_at_Parse_internal_35 --> -144($fp) +# local_a2i_aux_at_Parse_internal_34 = local_a2i_aux_at_Parse_i_5 + local_a2i_aux_at_Parse_internal_35 +lw $t1, -24($fp) +lw $t0, 12($t1) +lw $t1, -144($fp) +lw $t2, 12($t1) +add $t0, $t0, $t2 +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t1, String +sw $t1, 0($v0) +la $t1, String_start +sw $t1, 4($v0) +# Load type offset +li $t1, 8 +sw $t1, 8($v0) +la $t1, Int +sw $t1, 12($v0) +li $t1, 3 +sw $t1, 16($v0) +move $t1, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t1, 0($v0) +la $t1, Int_start +sw $t1, 4($v0) +# Load type offset +li $t1, 16 +sw $t1, 8($v0) +sw $t0, 12($v0) +sw $v0, -140($fp) +# ARG local_a2i_aux_at_Parse_internal_34 +# LOCAL local_a2i_aux_at_Parse_internal_34 --> -140($fp) +lw $t0, -140($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_a2i_aux_at_Parse_internal_38 --> -156($fp) +# PARAM param_a2i_aux_at_Parse_s_0 --> 0($fp) +# local_a2i_aux_at_Parse_internal_38 = PARAM param_a2i_aux_at_Parse_s_0 +lw $t0, 0($fp) +sw $t0, -156($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_a2i_aux_at_Parse_internal_38 --> -156($fp) +# LOCAL local_a2i_aux_at_Parse_internal_39 --> -160($fp) +# local_a2i_aux_at_Parse_internal_39 = VCALL local_a2i_aux_at_Parse_internal_38 length +# Save new self pointer in $s1 +lw $s1, -156($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 36($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -160($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_a2i_aux_at_Parse_internal_37 --> -152($fp) +# LOCAL local_a2i_aux_at_Parse_internal_39 --> -160($fp) +# LOCAL local_a2i_aux_at_Parse_i_5 --> -24($fp) +# local_a2i_aux_at_Parse_internal_37 = local_a2i_aux_at_Parse_internal_39 - local_a2i_aux_at_Parse_i_5 +lw $t1, -160($fp) +lw $t0, 12($t1) +lw $t1, -24($fp) +lw $t2, 12($t1) +sub $t0, $t0, $t2 +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t1, String +sw $t1, 0($v0) +la $t1, String_start +sw $t1, 4($v0) +# Load type offset +li $t1, 8 +sw $t1, 8($v0) +la $t1, Int +sw $t1, 12($v0) +li $t1, 3 +sw $t1, 16($v0) +move $t1, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t1, 0($v0) +la $t1, Int_start +sw $t1, 4($v0) +# Load type offset +li $t1, 16 +sw $t1, 8($v0) +sw $t0, 12($v0) +sw $v0, -152($fp) +# LOCAL local_a2i_aux_at_Parse_internal_40 --> -164($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 1 +sw $t0, 12($v0) +sw $v0, -164($fp) +# LOCAL local_a2i_aux_at_Parse_internal_36 --> -148($fp) +# LOCAL local_a2i_aux_at_Parse_internal_37 --> -152($fp) +# LOCAL local_a2i_aux_at_Parse_internal_40 --> -164($fp) +# local_a2i_aux_at_Parse_internal_36 = local_a2i_aux_at_Parse_internal_37 - local_a2i_aux_at_Parse_internal_40 +lw $t1, -152($fp) +lw $t0, 12($t1) +lw $t1, -164($fp) +lw $t2, 12($t1) +sub $t0, $t0, $t2 +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t1, String +sw $t1, 0($v0) +la $t1, String_start +sw $t1, 4($v0) +# Load type offset +li $t1, 8 +sw $t1, 8($v0) +la $t1, Int +sw $t1, 12($v0) +li $t1, 3 +sw $t1, 16($v0) +move $t1, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t1, 0($v0) +la $t1, Int_start +sw $t1, 4($v0) +# Load type offset +li $t1, 16 +sw $t1, 8($v0) +sw $t0, 12($v0) +sw $v0, -148($fp) +# ARG local_a2i_aux_at_Parse_internal_36 +# LOCAL local_a2i_aux_at_Parse_internal_36 --> -148($fp) +lw $t0, -148($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_a2i_aux_at_Parse_internal_32 --> -132($fp) +# LOCAL local_a2i_aux_at_Parse_internal_33 --> -136($fp) +# local_a2i_aux_at_Parse_internal_33 = VCALL local_a2i_aux_at_Parse_internal_32 substr +# Save new self pointer in $s1 +lw $s1, -132($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 64($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -136($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# +# LOCAL local_a2i_aux_at_Parse_internal_33 --> -136($fp) +lw $t0, -136($fp) +sw $t0, 16($s1) +# LOCAL local_a2i_aux_at_Parse_i_5 --> -24($fp) +# LOCAL local_a2i_aux_at_Parse_j_2 --> -12($fp) +# local_a2i_aux_at_Parse_i_5 = local_a2i_aux_at_Parse_j_2 +lw $t0, -12($fp) +sw $t0, -24($fp) +# LOCAL local_a2i_aux_at_Parse_internal_28 --> -116($fp) +# local_a2i_aux_at_Parse_internal_28 = +# GOTO label_ENDIF_184 +j label_ENDIF_184 +label_FALSEIF_183: + # LOCAL local_a2i_aux_at_Parse_internal_43 --> -176($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 10 + sw $t0, 12($v0) + sw $v0, -176($fp) + # LOCAL local_a2i_aux_at_Parse_internal_42 --> -172($fp) + # LOCAL local_a2i_aux_at_Parse_int_0 --> -4($fp) + # LOCAL local_a2i_aux_at_Parse_internal_43 --> -176($fp) + # local_a2i_aux_at_Parse_internal_42 = local_a2i_aux_at_Parse_int_0 * local_a2i_aux_at_Parse_internal_43 + lw $t1, -4($fp) + lw $t0, 12($t1) + lw $t1, -176($fp) + lw $t2, 12($t1) + mul $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -172($fp) + # LOCAL local_a2i_aux_at_Parse_internal_46 --> -188($fp) + # local_a2i_aux_at_Parse_internal_46 = SELF + sw $s1, -188($fp) + # LOCAL local_a2i_aux_at_Parse_internal_44 --> -180($fp) + # LOCAL local_a2i_aux_at_Parse_internal_46 --> -188($fp) + # local_a2i_aux_at_Parse_internal_44 = local_a2i_aux_at_Parse_internal_46 + lw $t0, -188($fp) + sw $t0, -180($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_a2i_aux_at_Parse_internal_47 --> -192($fp) + # PARAM param_a2i_aux_at_Parse_s_0 --> 0($fp) + # local_a2i_aux_at_Parse_internal_47 = PARAM param_a2i_aux_at_Parse_s_0 + lw $t0, 0($fp) + sw $t0, -192($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # ARG local_a2i_aux_at_Parse_i_5 + # LOCAL local_a2i_aux_at_Parse_i_5 --> -24($fp) + lw $t0, -24($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_a2i_aux_at_Parse_internal_49 --> -200($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -200($fp) + # ARG local_a2i_aux_at_Parse_internal_49 + # LOCAL local_a2i_aux_at_Parse_internal_49 --> -200($fp) + lw $t0, -200($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_a2i_aux_at_Parse_internal_47 --> -192($fp) + # LOCAL local_a2i_aux_at_Parse_internal_48 --> -196($fp) + # local_a2i_aux_at_Parse_internal_48 = VCALL local_a2i_aux_at_Parse_internal_47 substr + # Save new self pointer in $s1 + lw $s1, -192($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 64($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -196($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # ARG local_a2i_aux_at_Parse_internal_48 + # LOCAL local_a2i_aux_at_Parse_internal_48 --> -196($fp) + lw $t0, -196($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_a2i_aux_at_Parse_internal_44 --> -180($fp) + # LOCAL local_a2i_aux_at_Parse_internal_45 --> -184($fp) + # local_a2i_aux_at_Parse_internal_45 = VCALL local_a2i_aux_at_Parse_internal_44 c2i + # Save new self pointer in $s1 + lw $s1, -180($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 116($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -184($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_a2i_aux_at_Parse_internal_41 --> -168($fp) + # LOCAL local_a2i_aux_at_Parse_internal_42 --> -172($fp) + # LOCAL local_a2i_aux_at_Parse_internal_45 --> -184($fp) + # local_a2i_aux_at_Parse_internal_41 = local_a2i_aux_at_Parse_internal_42 + local_a2i_aux_at_Parse_internal_45 + lw $t1, -172($fp) + lw $t0, 12($t1) + lw $t1, -184($fp) + lw $t2, 12($t1) + add $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -168($fp) + # LOCAL local_a2i_aux_at_Parse_int_0 --> -4($fp) + # LOCAL local_a2i_aux_at_Parse_internal_41 --> -168($fp) + # local_a2i_aux_at_Parse_int_0 = local_a2i_aux_at_Parse_internal_41 + lw $t0, -168($fp) + sw $t0, -4($fp) + # LOCAL local_a2i_aux_at_Parse_internal_51 --> -208($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -208($fp) + # LOCAL local_a2i_aux_at_Parse_internal_50 --> -204($fp) + # LOCAL local_a2i_aux_at_Parse_i_5 --> -24($fp) + # LOCAL local_a2i_aux_at_Parse_internal_51 --> -208($fp) + # local_a2i_aux_at_Parse_internal_50 = local_a2i_aux_at_Parse_i_5 + local_a2i_aux_at_Parse_internal_51 + lw $t1, -24($fp) + lw $t0, 12($t1) + lw $t1, -208($fp) + lw $t2, 12($t1) + add $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -204($fp) + # LOCAL local_a2i_aux_at_Parse_i_5 --> -24($fp) + # LOCAL local_a2i_aux_at_Parse_internal_50 --> -204($fp) + # local_a2i_aux_at_Parse_i_5 = local_a2i_aux_at_Parse_internal_50 + lw $t0, -204($fp) + sw $t0, -24($fp) + # IF_ZERO local_a2i_aux_at_Parse_i_5 GOTO label_FALSE_195 + # IF_ZERO local_a2i_aux_at_Parse_i_5 GOTO label_FALSE_195 + lw $t0, -24($fp) + beq $t0, 0, label_FALSE_195 + # IF_ZERO local_a2i_aux_at_Parse_j_2 GOTO label_FALSE_195 + # IF_ZERO local_a2i_aux_at_Parse_j_2 GOTO label_FALSE_195 + lw $t0, -12($fp) + beq $t0, 0, label_FALSE_195 + # LOCAL local_a2i_aux_at_Parse_internal_55 --> -224($fp) + # LOCAL local_a2i_aux_at_Parse_i_5 --> -24($fp) + # Comparing -24($fp) type with String + la $v0, String + lw $a0, -24($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -224($fp) + # IF_ZERO local_a2i_aux_at_Parse_internal_55 GOTO label_COMPARE_STRING_198 + # IF_ZERO local_a2i_aux_at_Parse_internal_55 GOTO label_COMPARE_STRING_198 + lw $t0, -224($fp) + beq $t0, 0, label_COMPARE_STRING_198 + # LOCAL local_a2i_aux_at_Parse_internal_55 --> -224($fp) + # LOCAL local_a2i_aux_at_Parse_i_5 --> -24($fp) + # Comparing -24($fp) type with Bool + la $v0, Bool + lw $a0, -24($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -224($fp) + # IF_ZERO local_a2i_aux_at_Parse_internal_55 GOTO label_COMPARE_BY_VALUE_199 + # IF_ZERO local_a2i_aux_at_Parse_internal_55 GOTO label_COMPARE_BY_VALUE_199 + lw $t0, -224($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_199 + # LOCAL local_a2i_aux_at_Parse_internal_55 --> -224($fp) + # LOCAL local_a2i_aux_at_Parse_i_5 --> -24($fp) + # Comparing -24($fp) type with Int + la $v0, Int + lw $a0, -24($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -224($fp) + # IF_ZERO local_a2i_aux_at_Parse_internal_55 GOTO label_COMPARE_BY_VALUE_199 + # IF_ZERO local_a2i_aux_at_Parse_internal_55 GOTO label_COMPARE_BY_VALUE_199 + lw $t0, -224($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_199 + # LOCAL local_a2i_aux_at_Parse_internal_55 --> -224($fp) + # LOCAL local_a2i_aux_at_Parse_i_5 --> -24($fp) + # LOCAL local_a2i_aux_at_Parse_j_2 --> -12($fp) + # Load pointers and SUB + lw $a0, -24($fp) + lw $a1, -12($fp) + sub $a0, $a0, $a1 + sw $a0, -224($fp) + # IF_ZERO local_a2i_aux_at_Parse_internal_55 GOTO label_TRUE_196 + # IF_ZERO local_a2i_aux_at_Parse_internal_55 GOTO label_TRUE_196 + lw $t0, -224($fp) + beq $t0, 0, label_TRUE_196 + # GOTO label_FALSE_195 + j label_FALSE_195 + label_COMPARE_BY_VALUE_199: + # LOCAL local_a2i_aux_at_Parse_internal_55 --> -224($fp) + # LOCAL local_a2i_aux_at_Parse_i_5 --> -24($fp) + # LOCAL local_a2i_aux_at_Parse_j_2 --> -12($fp) + lw $a0, -24($fp) + lw $a1, -12($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -224($fp) + # IF_ZERO local_a2i_aux_at_Parse_internal_55 GOTO label_TRUE_196 + # IF_ZERO local_a2i_aux_at_Parse_internal_55 GOTO label_TRUE_196 + lw $t0, -224($fp) + beq $t0, 0, label_TRUE_196 + # GOTO label_FALSE_195 + j label_FALSE_195 + label_COMPARE_STRING_198: + # LOCAL local_a2i_aux_at_Parse_internal_55 --> -224($fp) + # LOCAL local_a2i_aux_at_Parse_i_5 --> -24($fp) + # LOCAL local_a2i_aux_at_Parse_j_2 --> -12($fp) + # Load strings for comparison + lw $v0, -24($fp) + lw $v1, -12($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -224($fp) + # IF_ZERO local_a2i_aux_at_Parse_internal_55 GOTO label_CONTINUE_200 + # IF_ZERO local_a2i_aux_at_Parse_internal_55 GOTO label_CONTINUE_200 + lw $t0, -224($fp) + beq $t0, 0, label_CONTINUE_200 + # GOTO label_FALSE_195 + j label_FALSE_195 + label_CONTINUE_200: + # LOCAL local_a2i_aux_at_Parse_internal_55 --> -224($fp) + # LOCAL local_a2i_aux_at_Parse_i_5 --> -24($fp) + # LOCAL local_a2i_aux_at_Parse_j_2 --> -12($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -24($fp) + lw $v1, -12($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_201: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_202 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_201 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_202: + # Store result + sw $a2, -224($fp) + # IF_ZERO local_a2i_aux_at_Parse_internal_55 GOTO label_TRUE_196 + # IF_ZERO local_a2i_aux_at_Parse_internal_55 GOTO label_TRUE_196 + lw $t0, -224($fp) + beq $t0, 0, label_TRUE_196 + label_FALSE_195: + # LOCAL local_a2i_aux_at_Parse_internal_54 --> -220($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -220($fp) + # GOTO label_END_197 +j label_END_197 +label_TRUE_196: + # LOCAL local_a2i_aux_at_Parse_internal_54 --> -220($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -220($fp) + label_END_197: +# LOCAL local_a2i_aux_at_Parse_internal_52 --> -212($fp) +# LOCAL local_a2i_aux_at_Parse_internal_54 --> -220($fp) +# Obtain value from -220($fp) +lw $v0, -220($fp) +lw $v0, 12($v0) +sw $v0, -212($fp) +# IF_ZERO local_a2i_aux_at_Parse_internal_52 GOTO label_FALSEIF_193 +# IF_ZERO local_a2i_aux_at_Parse_internal_52 GOTO label_FALSEIF_193 +lw $t0, -212($fp) +beq $t0, 0, label_FALSEIF_193 +# LOCAL local_a2i_aux_at_Parse_internal_56 --> -228($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_20 +sw $t0, 12($v0) +li $t0, 0 +sw $t0, 16($v0) +sw $v0, -228($fp) +# +# LOCAL local_a2i_aux_at_Parse_internal_56 --> -228($fp) +lw $t0, -228($fp) +sw $t0, 16($s1) +# LOCAL local_a2i_aux_at_Parse_internal_53 --> -216($fp) +# local_a2i_aux_at_Parse_internal_53 = +# GOTO label_ENDIF_194 +j label_ENDIF_194 +label_FALSEIF_193: + # LOCAL local_a2i_aux_at_Parse_internal_57 --> -232($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_21 + sw $t0, 12($v0) + li $t0, 0 + sw $t0, 16($v0) + sw $v0, -232($fp) + # LOCAL local_a2i_aux_at_Parse_internal_53 --> -216($fp) + # LOCAL local_a2i_aux_at_Parse_internal_57 --> -232($fp) + # local_a2i_aux_at_Parse_internal_53 = local_a2i_aux_at_Parse_internal_57 + lw $t0, -232($fp) + sw $t0, -216($fp) + label_ENDIF_194: +# LOCAL local_a2i_aux_at_Parse_internal_28 --> -116($fp) +# LOCAL local_a2i_aux_at_Parse_internal_53 --> -216($fp) +# local_a2i_aux_at_Parse_internal_28 = local_a2i_aux_at_Parse_internal_53 +lw $t0, -216($fp) +sw $t0, -116($fp) +label_ENDIF_184: +# LOCAL local_a2i_aux_at_Parse_internal_14 --> -60($fp) +# LOCAL local_a2i_aux_at_Parse_internal_28 --> -116($fp) +# local_a2i_aux_at_Parse_internal_14 = local_a2i_aux_at_Parse_internal_28 +lw $t0, -116($fp) +sw $t0, -60($fp) +label_ENDIF_174: +# GOTO label_WHILE_169 +j label_WHILE_169 +label_WHILE_END_170: + # RETURN local_a2i_aux_at_Parse_int_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_a2i_aux_at_Parse. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 240 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# __Main__attrib__g__init implementation. +# @Params: +__Main__attrib__g__init: + # Allocate stack frame for function __Main__attrib__g__init. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_ttrib__g__init_internal_3 --> -16($fp) + # local_ttrib__g__init_internal_3 = SELF + sw $s1, -16($fp) + # LOCAL local_ttrib__g__init_internal_1 --> -8($fp) + # LOCAL local_ttrib__g__init_internal_3 --> -16($fp) + # local_ttrib__g__init_internal_1 = local_ttrib__g__init_internal_3 + lw $t0, -16($fp) + sw $t0, -8($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_ttrib__g__init_internal_1 --> -8($fp) + # LOCAL local_ttrib__g__init_internal_2 --> -12($fp) + # local_ttrib__g__init_internal_2 = VCALL local_ttrib__g__init_internal_1 read_input + # Save new self pointer in $s1 + lw $s1, -8($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 68($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -12($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # RETURN local_ttrib__g__init_internal_2 + lw $v0, -12($fp) + # Deallocate stack frame for function __Main__attrib__g__init. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_main_at_Main implementation. +# @Params: +function_main_at_Main: + # Allocate stack frame for function function_main_at_Main. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_main_at_Main_internal_2 = GETATTRIBUTE g Main + # LOCAL local_main_at_Main_internal_2 --> -12($fp) + lw $t0, 20($s1) + sw $t0, -12($fp) + # LOCAL local_main_at_Main_internal_0 --> -4($fp) + # LOCAL local_main_at_Main_internal_2 --> -12($fp) + # local_main_at_Main_internal_0 = local_main_at_Main_internal_2 + lw $t0, -12($fp) + sw $t0, -4($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_0 --> -4($fp) + # LOCAL local_main_at_Main_internal_1 --> -8($fp) + # local_main_at_Main_internal_1 = VCALL local_main_at_Main_internal_0 print_V + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 28($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -8($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # local_main_at_Main_internal_5 = GETATTRIBUTE g Main + # LOCAL local_main_at_Main_internal_5 --> -24($fp) + lw $t0, 20($s1) + sw $t0, -24($fp) + # LOCAL local_main_at_Main_internal_3 --> -16($fp) + # LOCAL local_main_at_Main_internal_5 --> -24($fp) + # local_main_at_Main_internal_3 = local_main_at_Main_internal_5 + lw $t0, -24($fp) + sw $t0, -16($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_3 --> -16($fp) + # LOCAL local_main_at_Main_internal_4 --> -20($fp) + # local_main_at_Main_internal_4 = VCALL local_main_at_Main_internal_3 print_E + # Save new self pointer in $s1 + lw $s1, -16($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 80($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -20($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # RETURN local_main_at_Main_internal_4 + lw $v0, -20($fp) + # Deallocate stack frame for function function_main_at_Main. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# __VList__attrib__car__init implementation. +# @Params: +__VList__attrib__car__init: + # Allocate stack frame for function __VList__attrib__car__init. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # RETURN 0 + li $v0, 0 + # Deallocate stack frame for function __VList__attrib__car__init. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_isNil_at_VList implementation. +# @Params: +function_isNil_at_VList: + # Allocate stack frame for function function_isNil_at_VList. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_isNil_at_VList_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -4($fp) + # RETURN local_isNil_at_VList_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_isNil_at_VList. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_head_at_VList implementation. +# @Params: +function_head_at_VList: + # Allocate stack frame for function function_head_at_VList. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_head_at_VList_internal_2 --> -12($fp) + # local_head_at_VList_internal_2 = SELF + sw $s1, -12($fp) + # LOCAL local_head_at_VList_internal_0 --> -4($fp) + # LOCAL local_head_at_VList_internal_2 --> -12($fp) + # local_head_at_VList_internal_0 = local_head_at_VList_internal_2 + lw $t0, -12($fp) + sw $t0, -4($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_head_at_VList_internal_0 --> -4($fp) + # LOCAL local_head_at_VList_internal_1 --> -8($fp) + # local_head_at_VList_internal_1 = VCALL local_head_at_VList_internal_0 abort + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 16($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -8($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # local_head_at_VList_internal_3 = GETATTRIBUTE car VList + # LOCAL local_head_at_VList_internal_3 --> -16($fp) + lw $t0, 12($s1) + sw $t0, -16($fp) + # RETURN local_head_at_VList_internal_3 + lw $v0, -16($fp) + # Deallocate stack frame for function function_head_at_VList. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_tail_at_VList implementation. +# @Params: +function_tail_at_VList: + # Allocate stack frame for function function_tail_at_VList. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_tail_at_VList_internal_2 --> -12($fp) + # local_tail_at_VList_internal_2 = SELF + sw $s1, -12($fp) + # LOCAL local_tail_at_VList_internal_0 --> -4($fp) + # LOCAL local_tail_at_VList_internal_2 --> -12($fp) + # local_tail_at_VList_internal_0 = local_tail_at_VList_internal_2 + lw $t0, -12($fp) + sw $t0, -4($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_tail_at_VList_internal_0 --> -4($fp) + # LOCAL local_tail_at_VList_internal_1 --> -8($fp) + # local_tail_at_VList_internal_1 = VCALL local_tail_at_VList_internal_0 abort + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 16($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -8($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_tail_at_VList_internal_3 --> -16($fp) + # local_tail_at_VList_internal_3 = SELF + sw $s1, -16($fp) + # RETURN local_tail_at_VList_internal_3 + lw $v0, -16($fp) + # Deallocate stack frame for function function_tail_at_VList. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_cons_at_VList implementation. +# @Params: +# 0($fp) = param_cons_at_VList_v_0 +function_cons_at_VList: + # Allocate stack frame for function function_cons_at_VList. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_cons_at_VList_internal_2 --> -12($fp) + # local_cons_at_VList_internal_2 = ALLOCATE VCons + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, VCons + sw $t0, 12($v0) + li $t0, 5 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, VCons_start + sw $t0, 4($v0) + # Load type offset + li $t0, 40 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __VList__attrib__car__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 12($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __VCons__attrib__cdr__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 16($t1) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -12($fp) + # LOCAL local_cons_at_VList_internal_0 --> -4($fp) + # LOCAL local_cons_at_VList_internal_2 --> -12($fp) + # local_cons_at_VList_internal_0 = local_cons_at_VList_internal_2 + lw $t0, -12($fp) + sw $t0, -4($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # ARG param_cons_at_VList_v_0 + # PARAM param_cons_at_VList_v_0 --> 0($fp) + lw $t0, 0($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_cons_at_VList_internal_3 --> -16($fp) + # local_cons_at_VList_internal_3 = SELF + sw $s1, -16($fp) + # ARG local_cons_at_VList_internal_3 + # LOCAL local_cons_at_VList_internal_3 --> -16($fp) + lw $t0, -16($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_cons_at_VList_internal_0 --> -4($fp) + # LOCAL local_cons_at_VList_internal_1 --> -8($fp) + # local_cons_at_VList_internal_1 = VCALL local_cons_at_VList_internal_0 init + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 8($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -8($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # RETURN local_cons_at_VList_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function function_cons_at_VList. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_print_at_VList implementation. +# @Params: +function_print_at_VList: + # Allocate stack frame for function function_print_at_VList. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_print_at_VList_internal_2 --> -12($fp) + # local_print_at_VList_internal_2 = SELF + sw $s1, -12($fp) + # LOCAL local_print_at_VList_internal_0 --> -4($fp) + # LOCAL local_print_at_VList_internal_2 --> -12($fp) + # local_print_at_VList_internal_0 = local_print_at_VList_internal_2 + lw $t0, -12($fp) + sw $t0, -4($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_print_at_VList_internal_3 --> -16($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_22 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -16($fp) + # ARG local_print_at_VList_internal_3 + # LOCAL local_print_at_VList_internal_3 --> -16($fp) + lw $t0, -16($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_print_at_VList_internal_0 --> -4($fp) + # LOCAL local_print_at_VList_internal_1 --> -8($fp) + # local_print_at_VList_internal_1 = VCALL local_print_at_VList_internal_0 out_string + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 104($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -8($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # RETURN local_print_at_VList_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function function_print_at_VList. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# __VCons__attrib__cdr__init implementation. +# @Params: +__VCons__attrib__cdr__init: + # Allocate stack frame for function __VCons__attrib__cdr__init. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # RETURN 0 + li $v0, 0 + # Deallocate stack frame for function __VCons__attrib__cdr__init. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_isNil_at_VCons implementation. +# @Params: +function_isNil_at_VCons: + # Allocate stack frame for function function_isNil_at_VCons. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_isNil_at_VCons_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -4($fp) + # RETURN local_isNil_at_VCons_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_isNil_at_VCons. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_head_at_VCons implementation. +# @Params: +function_head_at_VCons: + # Allocate stack frame for function function_head_at_VCons. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_head_at_VCons_internal_0 = GETATTRIBUTE car VCons + # LOCAL local_head_at_VCons_internal_0 --> -4($fp) + lw $t0, 12($s1) + sw $t0, -4($fp) + # RETURN local_head_at_VCons_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_head_at_VCons. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_tail_at_VCons implementation. +# @Params: +function_tail_at_VCons: + # Allocate stack frame for function function_tail_at_VCons. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_tail_at_VCons_internal_0 = GETATTRIBUTE cdr VCons + # LOCAL local_tail_at_VCons_internal_0 --> -4($fp) + lw $t0, 16($s1) + sw $t0, -4($fp) + # RETURN local_tail_at_VCons_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_tail_at_VCons. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_init_at_VCons implementation. +# @Params: +# 0($fp) = param_init_at_VCons_v_0 +# 4($fp) = param_init_at_VCons_rest_1 +function_init_at_VCons: + # Allocate stack frame for function function_init_at_VCons. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # + # PARAM param_init_at_VCons_v_0 --> 4($fp) + lw $t0, 4($fp) + sw $t0, 12($s1) + # + # PARAM param_init_at_VCons_rest_1 --> 0($fp) + lw $t0, 0($fp) + sw $t0, 16($s1) + # LOCAL local_init_at_VCons_internal_0 --> -4($fp) + # local_init_at_VCons_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_init_at_VCons_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_init_at_VCons. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 8 + jr $ra + # Function END + + +# function_print_at_VCons implementation. +# @Params: +function_print_at_VCons: + # Allocate stack frame for function function_print_at_VCons. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_print_at_VCons_internal_2 = GETATTRIBUTE car VCons + # LOCAL local_print_at_VCons_internal_2 --> -12($fp) + lw $t0, 12($s1) + sw $t0, -12($fp) + # LOCAL local_print_at_VCons_internal_0 --> -4($fp) + # LOCAL local_print_at_VCons_internal_2 --> -12($fp) + # local_print_at_VCons_internal_0 = local_print_at_VCons_internal_2 + lw $t0, -12($fp) + sw $t0, -4($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_print_at_VCons_internal_0 --> -4($fp) + # LOCAL local_print_at_VCons_internal_1 --> -8($fp) + # local_print_at_VCons_internal_1 = VCALL local_print_at_VCons_internal_0 print + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 92($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -8($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # local_print_at_VCons_internal_5 = GETATTRIBUTE cdr VCons + # LOCAL local_print_at_VCons_internal_5 --> -24($fp) + lw $t0, 16($s1) + sw $t0, -24($fp) + # LOCAL local_print_at_VCons_internal_3 --> -16($fp) + # LOCAL local_print_at_VCons_internal_5 --> -24($fp) + # local_print_at_VCons_internal_3 = local_print_at_VCons_internal_5 + lw $t0, -24($fp) + sw $t0, -16($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_print_at_VCons_internal_3 --> -16($fp) + # LOCAL local_print_at_VCons_internal_4 --> -20($fp) + # local_print_at_VCons_internal_4 = VCALL local_print_at_VCons_internal_3 print + # Save new self pointer in $s1 + lw $s1, -16($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 92($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -20($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # RETURN local_print_at_VCons_internal_4 + lw $v0, -20($fp) + # Deallocate stack frame for function function_print_at_VCons. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# __EList__attrib__car__init implementation. +# @Params: +__EList__attrib__car__init: + # Allocate stack frame for function __EList__attrib__car__init. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # RETURN 0 + li $v0, 0 + # Deallocate stack frame for function __EList__attrib__car__init. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_isNil_at_EList implementation. +# @Params: +function_isNil_at_EList: + # Allocate stack frame for function function_isNil_at_EList. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_isNil_at_EList_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -4($fp) + # RETURN local_isNil_at_EList_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_isNil_at_EList. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_head_at_EList implementation. +# @Params: +function_head_at_EList: + # Allocate stack frame for function function_head_at_EList. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_head_at_EList_internal_2 --> -12($fp) + # local_head_at_EList_internal_2 = SELF + sw $s1, -12($fp) + # LOCAL local_head_at_EList_internal_0 --> -4($fp) + # LOCAL local_head_at_EList_internal_2 --> -12($fp) + # local_head_at_EList_internal_0 = local_head_at_EList_internal_2 + lw $t0, -12($fp) + sw $t0, -4($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_head_at_EList_internal_0 --> -4($fp) + # LOCAL local_head_at_EList_internal_1 --> -8($fp) + # local_head_at_EList_internal_1 = VCALL local_head_at_EList_internal_0 abort + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 16($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -8($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # local_head_at_EList_internal_3 = GETATTRIBUTE car EList + # LOCAL local_head_at_EList_internal_3 --> -16($fp) + lw $t0, 12($s1) + sw $t0, -16($fp) + # RETURN local_head_at_EList_internal_3 + lw $v0, -16($fp) + # Deallocate stack frame for function function_head_at_EList. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_tail_at_EList implementation. +# @Params: +function_tail_at_EList: + # Allocate stack frame for function function_tail_at_EList. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_tail_at_EList_internal_2 --> -12($fp) + # local_tail_at_EList_internal_2 = SELF + sw $s1, -12($fp) + # LOCAL local_tail_at_EList_internal_0 --> -4($fp) + # LOCAL local_tail_at_EList_internal_2 --> -12($fp) + # local_tail_at_EList_internal_0 = local_tail_at_EList_internal_2 + lw $t0, -12($fp) + sw $t0, -4($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_tail_at_EList_internal_0 --> -4($fp) + # LOCAL local_tail_at_EList_internal_1 --> -8($fp) + # local_tail_at_EList_internal_1 = VCALL local_tail_at_EList_internal_0 abort + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 16($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -8($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_tail_at_EList_internal_3 --> -16($fp) + # local_tail_at_EList_internal_3 = SELF + sw $s1, -16($fp) + # RETURN local_tail_at_EList_internal_3 + lw $v0, -16($fp) + # Deallocate stack frame for function function_tail_at_EList. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_cons_at_EList implementation. +# @Params: +# 0($fp) = param_cons_at_EList_e_0 +function_cons_at_EList: + # Allocate stack frame for function function_cons_at_EList. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_cons_at_EList_internal_2 --> -12($fp) + # local_cons_at_EList_internal_2 = ALLOCATE ECons + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, ECons + sw $t0, 12($v0) + li $t0, 5 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, ECons_start + sw $t0, 4($v0) + # Load type offset + li $t0, 48 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __EList__attrib__car__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 12($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __ECons__attrib__cdr__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 16($t1) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -12($fp) + # LOCAL local_cons_at_EList_internal_0 --> -4($fp) + # LOCAL local_cons_at_EList_internal_2 --> -12($fp) + # local_cons_at_EList_internal_0 = local_cons_at_EList_internal_2 + lw $t0, -12($fp) + sw $t0, -4($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # ARG param_cons_at_EList_e_0 + # PARAM param_cons_at_EList_e_0 --> 0($fp) + lw $t0, 0($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_cons_at_EList_internal_3 --> -16($fp) + # local_cons_at_EList_internal_3 = SELF + sw $s1, -16($fp) + # ARG local_cons_at_EList_internal_3 + # LOCAL local_cons_at_EList_internal_3 --> -16($fp) + lw $t0, -16($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_cons_at_EList_internal_0 --> -4($fp) + # LOCAL local_cons_at_EList_internal_1 --> -8($fp) + # local_cons_at_EList_internal_1 = VCALL local_cons_at_EList_internal_0 init + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 8($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -8($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # RETURN local_cons_at_EList_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function function_cons_at_EList. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_append_at_EList implementation. +# @Params: +# 0($fp) = param_append_at_EList_l_0 +function_append_at_EList: +# Allocate stack frame for function function_append_at_EList. +subu $sp, $sp, 68 +sw $ra, 4($sp) +sw $fp, 0($sp) +addu $fp, $sp, 68 +# LOCAL local_append_at_EList_internal_4 --> -20($fp) +# local_append_at_EList_internal_4 = SELF +sw $s1, -20($fp) +# LOCAL local_append_at_EList_internal_2 --> -12($fp) +# LOCAL local_append_at_EList_internal_4 --> -20($fp) +# local_append_at_EList_internal_2 = local_append_at_EList_internal_4 +lw $t0, -20($fp) +sw $t0, -12($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_append_at_EList_internal_2 --> -12($fp) +# LOCAL local_append_at_EList_internal_3 --> -16($fp) +# local_append_at_EList_internal_3 = VCALL local_append_at_EList_internal_2 isNil +# Save new self pointer in $s1 +lw $s1, -12($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 96($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -16($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_append_at_EList_internal_0 --> -4($fp) +# LOCAL local_append_at_EList_internal_3 --> -16($fp) +# Obtain value from -16($fp) +lw $v0, -16($fp) +lw $v0, 12($v0) +sw $v0, -4($fp) +# IF_ZERO local_append_at_EList_internal_0 GOTO label_FALSEIF_203 +# IF_ZERO local_append_at_EList_internal_0 GOTO label_FALSEIF_203 +lw $t0, -4($fp) +beq $t0, 0, label_FALSEIF_203 +# LOCAL local_append_at_EList_internal_1 --> -8($fp) +# PARAM param_append_at_EList_l_0 --> 0($fp) +# local_append_at_EList_internal_1 = PARAM param_append_at_EList_l_0 +lw $t0, 0($fp) +sw $t0, -8($fp) +# GOTO label_ENDIF_204 +j label_ENDIF_204 +label_FALSEIF_203: + # LOCAL local_append_at_EList_internal_11 --> -48($fp) + # local_append_at_EList_internal_11 = SELF + sw $s1, -48($fp) + # LOCAL local_append_at_EList_internal_9 --> -40($fp) + # LOCAL local_append_at_EList_internal_11 --> -48($fp) + # local_append_at_EList_internal_9 = local_append_at_EList_internal_11 + lw $t0, -48($fp) + sw $t0, -40($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_append_at_EList_internal_9 --> -40($fp) + # LOCAL local_append_at_EList_internal_10 --> -44($fp) + # local_append_at_EList_internal_10 = VCALL local_append_at_EList_internal_9 tail + # Save new self pointer in $s1 + lw $s1, -40($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 84($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -44($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_append_at_EList_internal_7 --> -32($fp) + # LOCAL local_append_at_EList_internal_10 --> -44($fp) + # local_append_at_EList_internal_7 = local_append_at_EList_internal_10 + lw $t0, -44($fp) + sw $t0, -32($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # ARG param_append_at_EList_l_0 + # PARAM param_append_at_EList_l_0 --> 0($fp) + lw $t0, 0($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_append_at_EList_internal_7 --> -32($fp) + # LOCAL local_append_at_EList_internal_8 --> -36($fp) + # local_append_at_EList_internal_8 = VCALL local_append_at_EList_internal_7 append + # Save new self pointer in $s1 + lw $s1, -32($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 40($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -36($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_append_at_EList_internal_5 --> -24($fp) + # LOCAL local_append_at_EList_internal_8 --> -36($fp) + # local_append_at_EList_internal_5 = local_append_at_EList_internal_8 + lw $t0, -36($fp) + sw $t0, -24($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_append_at_EList_internal_14 --> -60($fp) + # local_append_at_EList_internal_14 = SELF + sw $s1, -60($fp) + # LOCAL local_append_at_EList_internal_12 --> -52($fp) + # LOCAL local_append_at_EList_internal_14 --> -60($fp) + # local_append_at_EList_internal_12 = local_append_at_EList_internal_14 + lw $t0, -60($fp) + sw $t0, -52($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_append_at_EList_internal_12 --> -52($fp) + # LOCAL local_append_at_EList_internal_13 --> -56($fp) + # local_append_at_EList_internal_13 = VCALL local_append_at_EList_internal_12 head + # Save new self pointer in $s1 + lw $s1, -52($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 24($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -56($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # ARG local_append_at_EList_internal_13 + # LOCAL local_append_at_EList_internal_13 --> -56($fp) + lw $t0, -56($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_append_at_EList_internal_5 --> -24($fp) + # LOCAL local_append_at_EList_internal_6 --> -28($fp) + # local_append_at_EList_internal_6 = VCALL local_append_at_EList_internal_5 cons + # Save new self pointer in $s1 + lw $s1, -24($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 48($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -28($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_append_at_EList_internal_1 --> -8($fp) + # LOCAL local_append_at_EList_internal_6 --> -28($fp) + # local_append_at_EList_internal_1 = local_append_at_EList_internal_6 + lw $t0, -28($fp) + sw $t0, -8($fp) + label_ENDIF_204: +# RETURN local_append_at_EList_internal_1 +lw $v0, -8($fp) +# Deallocate stack frame for function function_append_at_EList. +# Restore $ra +lw $ra, 4($sp) +# Restore $fp +lw $fp, 0($sp) +# Restore Stack pointer $sp +addu $sp, $sp, 68 +# Deallocate function args +addu $sp, $sp, 4 +jr $ra +# Function END + + +# function_print_at_EList implementation. +# @Params: +function_print_at_EList: + # Allocate stack frame for function function_print_at_EList. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_print_at_EList_internal_2 --> -12($fp) + # local_print_at_EList_internal_2 = SELF + sw $s1, -12($fp) + # LOCAL local_print_at_EList_internal_0 --> -4($fp) + # LOCAL local_print_at_EList_internal_2 --> -12($fp) + # local_print_at_EList_internal_0 = local_print_at_EList_internal_2 + lw $t0, -12($fp) + sw $t0, -4($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_print_at_EList_internal_3 --> -16($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_23 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -16($fp) + # ARG local_print_at_EList_internal_3 + # LOCAL local_print_at_EList_internal_3 --> -16($fp) + lw $t0, -16($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_print_at_EList_internal_0 --> -4($fp) + # LOCAL local_print_at_EList_internal_1 --> -8($fp) + # local_print_at_EList_internal_1 = VCALL local_print_at_EList_internal_0 out_string + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 104($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -8($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # RETURN local_print_at_EList_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function function_print_at_EList. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# __ECons__attrib__cdr__init implementation. +# @Params: +__ECons__attrib__cdr__init: + # Allocate stack frame for function __ECons__attrib__cdr__init. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # RETURN 0 + li $v0, 0 + # Deallocate stack frame for function __ECons__attrib__cdr__init. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_isNil_at_ECons implementation. +# @Params: +function_isNil_at_ECons: + # Allocate stack frame for function function_isNil_at_ECons. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_isNil_at_ECons_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -4($fp) + # RETURN local_isNil_at_ECons_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_isNil_at_ECons. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_head_at_ECons implementation. +# @Params: +function_head_at_ECons: + # Allocate stack frame for function function_head_at_ECons. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_head_at_ECons_internal_0 = GETATTRIBUTE car ECons + # LOCAL local_head_at_ECons_internal_0 --> -4($fp) + lw $t0, 12($s1) + sw $t0, -4($fp) + # RETURN local_head_at_ECons_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_head_at_ECons. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_tail_at_ECons implementation. +# @Params: +function_tail_at_ECons: + # Allocate stack frame for function function_tail_at_ECons. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_tail_at_ECons_internal_0 = GETATTRIBUTE cdr ECons + # LOCAL local_tail_at_ECons_internal_0 --> -4($fp) + lw $t0, 16($s1) + sw $t0, -4($fp) + # RETURN local_tail_at_ECons_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_tail_at_ECons. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_init_at_ECons implementation. +# @Params: +# 0($fp) = param_init_at_ECons_e_0 +# 4($fp) = param_init_at_ECons_rest_1 +function_init_at_ECons: + # Allocate stack frame for function function_init_at_ECons. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # + # PARAM param_init_at_ECons_e_0 --> 4($fp) + lw $t0, 4($fp) + sw $t0, 12($s1) + # + # PARAM param_init_at_ECons_rest_1 --> 0($fp) + lw $t0, 0($fp) + sw $t0, 16($s1) + # LOCAL local_init_at_ECons_internal_0 --> -4($fp) + # local_init_at_ECons_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_init_at_ECons_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_init_at_ECons. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 8 + jr $ra + # Function END + + +# function_print_at_ECons implementation. +# @Params: +function_print_at_ECons: + # Allocate stack frame for function function_print_at_ECons. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_print_at_ECons_internal_2 = GETATTRIBUTE car ECons + # LOCAL local_print_at_ECons_internal_2 --> -12($fp) + lw $t0, 12($s1) + sw $t0, -12($fp) + # LOCAL local_print_at_ECons_internal_0 --> -4($fp) + # LOCAL local_print_at_ECons_internal_2 --> -12($fp) + # local_print_at_ECons_internal_0 = local_print_at_ECons_internal_2 + lw $t0, -12($fp) + sw $t0, -4($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_print_at_ECons_internal_0 --> -4($fp) + # LOCAL local_print_at_ECons_internal_1 --> -8($fp) + # local_print_at_ECons_internal_1 = VCALL local_print_at_ECons_internal_0 print + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 92($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -8($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # local_print_at_ECons_internal_5 = GETATTRIBUTE cdr ECons + # LOCAL local_print_at_ECons_internal_5 --> -24($fp) + lw $t0, 16($s1) + sw $t0, -24($fp) + # LOCAL local_print_at_ECons_internal_3 --> -16($fp) + # LOCAL local_print_at_ECons_internal_5 --> -24($fp) + # local_print_at_ECons_internal_3 = local_print_at_ECons_internal_5 + lw $t0, -24($fp) + sw $t0, -16($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_print_at_ECons_internal_3 --> -16($fp) + # LOCAL local_print_at_ECons_internal_4 --> -20($fp) + # local_print_at_ECons_internal_4 = VCALL local_print_at_ECons_internal_3 print + # Save new self pointer in $s1 + lw $s1, -16($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 92($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -20($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # RETURN local_print_at_ECons_internal_4 + lw $v0, -20($fp) + # Deallocate stack frame for function function_print_at_ECons. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# __Edge__attrib__from__init implementation. +# @Params: +__Edge__attrib__from__init: + # Allocate stack frame for function __Edge__attrib__from__init. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_ttrib__from__init_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -4($fp) + # RETURN local_ttrib__from__init_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function __Edge__attrib__from__init. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# __Edge__attrib__to__init implementation. +# @Params: +__Edge__attrib__to__init: + # Allocate stack frame for function __Edge__attrib__to__init. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_ttrib__to__init_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -4($fp) + # RETURN local_ttrib__to__init_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function __Edge__attrib__to__init. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# __Edge__attrib__weight__init implementation. +# @Params: +__Edge__attrib__weight__init: + # Allocate stack frame for function __Edge__attrib__weight__init. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_ttrib__weight__init_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -4($fp) + # RETURN local_ttrib__weight__init_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function __Edge__attrib__weight__init. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_init_at_Edge implementation. +# @Params: +# 0($fp) = param_init_at_Edge_f_0 +# 4($fp) = param_init_at_Edge_t_1 +# 8($fp) = param_init_at_Edge_w_2 +function_init_at_Edge: + # Allocate stack frame for function function_init_at_Edge. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # + # PARAM param_init_at_Edge_f_0 --> 8($fp) + lw $t0, 8($fp) + sw $t0, 12($s1) + # + # PARAM param_init_at_Edge_t_1 --> 4($fp) + lw $t0, 4($fp) + sw $t0, 16($s1) + # + # PARAM param_init_at_Edge_w_2 --> 0($fp) + lw $t0, 0($fp) + sw $t0, 20($s1) + # LOCAL local_init_at_Edge_internal_0 --> -4($fp) + # local_init_at_Edge_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_init_at_Edge_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_init_at_Edge. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 12 + jr $ra + # Function END + + +# function_print_at_Edge implementation. +# @Params: +function_print_at_Edge: + # Allocate stack frame for function function_print_at_Edge. + subu $sp, $sp, 104 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 104 + # LOCAL local_print_at_Edge_internal_2 --> -12($fp) + # local_print_at_Edge_internal_2 = SELF + sw $s1, -12($fp) + # LOCAL local_print_at_Edge_internal_0 --> -4($fp) + # LOCAL local_print_at_Edge_internal_2 --> -12($fp) + # local_print_at_Edge_internal_0 = local_print_at_Edge_internal_2 + lw $t0, -12($fp) + sw $t0, -4($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_print_at_Edge_internal_3 --> -16($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_24 + sw $t0, 12($v0) + li $t0, 2 + sw $t0, 16($v0) + sw $v0, -16($fp) + # ARG local_print_at_Edge_internal_3 + # LOCAL local_print_at_Edge_internal_3 --> -16($fp) + lw $t0, -16($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_print_at_Edge_internal_0 --> -4($fp) + # LOCAL local_print_at_Edge_internal_1 --> -8($fp) + # local_print_at_Edge_internal_1 = VCALL local_print_at_Edge_internal_0 out_string + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 104($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -8($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_print_at_Edge_internal_6 --> -28($fp) + # local_print_at_Edge_internal_6 = SELF + sw $s1, -28($fp) + # LOCAL local_print_at_Edge_internal_4 --> -20($fp) + # LOCAL local_print_at_Edge_internal_6 --> -28($fp) + # local_print_at_Edge_internal_4 = local_print_at_Edge_internal_6 + lw $t0, -28($fp) + sw $t0, -20($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # local_print_at_Edge_internal_7 = GETATTRIBUTE from Edge + # LOCAL local_print_at_Edge_internal_7 --> -32($fp) + lw $t0, 12($s1) + sw $t0, -32($fp) + # ARG local_print_at_Edge_internal_7 + # LOCAL local_print_at_Edge_internal_7 --> -32($fp) + lw $t0, -32($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_print_at_Edge_internal_4 --> -20($fp) + # LOCAL local_print_at_Edge_internal_5 --> -24($fp) + # local_print_at_Edge_internal_5 = VCALL local_print_at_Edge_internal_4 out_int + # Save new self pointer in $s1 + lw $s1, -20($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 20($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -24($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_print_at_Edge_internal_10 --> -44($fp) + # local_print_at_Edge_internal_10 = SELF + sw $s1, -44($fp) + # LOCAL local_print_at_Edge_internal_8 --> -36($fp) + # LOCAL local_print_at_Edge_internal_10 --> -44($fp) + # local_print_at_Edge_internal_8 = local_print_at_Edge_internal_10 + lw $t0, -44($fp) + sw $t0, -36($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_print_at_Edge_internal_11 --> -48($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_25 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -48($fp) + # ARG local_print_at_Edge_internal_11 + # LOCAL local_print_at_Edge_internal_11 --> -48($fp) + lw $t0, -48($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_print_at_Edge_internal_8 --> -36($fp) + # LOCAL local_print_at_Edge_internal_9 --> -40($fp) + # local_print_at_Edge_internal_9 = VCALL local_print_at_Edge_internal_8 out_string + # Save new self pointer in $s1 + lw $s1, -36($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 104($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -40($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_print_at_Edge_internal_14 --> -60($fp) + # local_print_at_Edge_internal_14 = SELF + sw $s1, -60($fp) + # LOCAL local_print_at_Edge_internal_12 --> -52($fp) + # LOCAL local_print_at_Edge_internal_14 --> -60($fp) + # local_print_at_Edge_internal_12 = local_print_at_Edge_internal_14 + lw $t0, -60($fp) + sw $t0, -52($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # local_print_at_Edge_internal_15 = GETATTRIBUTE to Edge + # LOCAL local_print_at_Edge_internal_15 --> -64($fp) + lw $t0, 16($s1) + sw $t0, -64($fp) + # ARG local_print_at_Edge_internal_15 + # LOCAL local_print_at_Edge_internal_15 --> -64($fp) + lw $t0, -64($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_print_at_Edge_internal_12 --> -52($fp) + # LOCAL local_print_at_Edge_internal_13 --> -56($fp) + # local_print_at_Edge_internal_13 = VCALL local_print_at_Edge_internal_12 out_int + # Save new self pointer in $s1 + lw $s1, -52($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 20($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -56($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_print_at_Edge_internal_18 --> -76($fp) + # local_print_at_Edge_internal_18 = SELF + sw $s1, -76($fp) + # LOCAL local_print_at_Edge_internal_16 --> -68($fp) + # LOCAL local_print_at_Edge_internal_18 --> -76($fp) + # local_print_at_Edge_internal_16 = local_print_at_Edge_internal_18 + lw $t0, -76($fp) + sw $t0, -68($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_print_at_Edge_internal_19 --> -80($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_26 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -80($fp) + # ARG local_print_at_Edge_internal_19 + # LOCAL local_print_at_Edge_internal_19 --> -80($fp) + lw $t0, -80($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_print_at_Edge_internal_16 --> -68($fp) + # LOCAL local_print_at_Edge_internal_17 --> -72($fp) + # local_print_at_Edge_internal_17 = VCALL local_print_at_Edge_internal_16 out_string + # Save new self pointer in $s1 + lw $s1, -68($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 104($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -72($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_print_at_Edge_internal_22 --> -92($fp) + # local_print_at_Edge_internal_22 = SELF + sw $s1, -92($fp) + # LOCAL local_print_at_Edge_internal_20 --> -84($fp) + # LOCAL local_print_at_Edge_internal_22 --> -92($fp) + # local_print_at_Edge_internal_20 = local_print_at_Edge_internal_22 + lw $t0, -92($fp) + sw $t0, -84($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # local_print_at_Edge_internal_23 = GETATTRIBUTE weight Edge + # LOCAL local_print_at_Edge_internal_23 --> -96($fp) + lw $t0, 20($s1) + sw $t0, -96($fp) + # ARG local_print_at_Edge_internal_23 + # LOCAL local_print_at_Edge_internal_23 --> -96($fp) + lw $t0, -96($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_print_at_Edge_internal_20 --> -84($fp) + # LOCAL local_print_at_Edge_internal_21 --> -88($fp) + # local_print_at_Edge_internal_21 = VCALL local_print_at_Edge_internal_20 out_int + # Save new self pointer in $s1 + lw $s1, -84($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 20($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -88($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # RETURN local_print_at_Edge_internal_21 + lw $v0, -88($fp) + # Deallocate stack frame for function function_print_at_Edge. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 104 + jr $ra + # Function END + + +# __Vertice__attrib__num__init implementation. +# @Params: +__Vertice__attrib__num__init: + # Allocate stack frame for function __Vertice__attrib__num__init. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local___attrib__num__init_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -4($fp) + # RETURN local___attrib__num__init_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function __Vertice__attrib__num__init. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# __Vertice__attrib__out__init implementation. +# @Params: +__Vertice__attrib__out__init: + # Allocate stack frame for function __Vertice__attrib__out__init. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local___attrib__out__init_internal_1 --> -8($fp) + # local___attrib__out__init_internal_1 = ALLOCATE EList + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, EList + sw $t0, 12($v0) + li $t0, 5 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, EList_start + sw $t0, 4($v0) + # Load type offset + li $t0, 44 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __EList__attrib__car__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 12($t1) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -8($fp) + # RETURN local___attrib__out__init_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function __Vertice__attrib__out__init. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_outgoing_at_Vertice implementation. +# @Params: +function_outgoing_at_Vertice: + # Allocate stack frame for function function_outgoing_at_Vertice. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_outgoing_at_Vertice_internal_0 = GETATTRIBUTE out Vertice + # LOCAL local_outgoing_at_Vertice_internal_0 --> -4($fp) + lw $t0, 16($s1) + sw $t0, -4($fp) + # RETURN local_outgoing_at_Vertice_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_outgoing_at_Vertice. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_number_at_Vertice implementation. +# @Params: +function_number_at_Vertice: + # Allocate stack frame for function function_number_at_Vertice. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_number_at_Vertice_internal_0 = GETATTRIBUTE num Vertice + # LOCAL local_number_at_Vertice_internal_0 --> -4($fp) + lw $t0, 12($s1) + sw $t0, -4($fp) + # RETURN local_number_at_Vertice_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_number_at_Vertice. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_init_at_Vertice implementation. +# @Params: +# 0($fp) = param_init_at_Vertice_n_0 +function_init_at_Vertice: + # Allocate stack frame for function function_init_at_Vertice. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # + # PARAM param_init_at_Vertice_n_0 --> 0($fp) + lw $t0, 0($fp) + sw $t0, 12($s1) + # LOCAL local_init_at_Vertice_internal_0 --> -4($fp) + # local_init_at_Vertice_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_init_at_Vertice_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_init_at_Vertice. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_add_out_at_Vertice implementation. +# @Params: +# 0($fp) = param_add_out_at_Vertice_s_0 +function_add_out_at_Vertice: + # Allocate stack frame for function function_add_out_at_Vertice. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_add_out_at_Vertice_internal_2 = GETATTRIBUTE out Vertice + # LOCAL local_add_out_at_Vertice_internal_2 --> -12($fp) + lw $t0, 16($s1) + sw $t0, -12($fp) + # LOCAL local_add_out_at_Vertice_internal_0 --> -4($fp) + # LOCAL local_add_out_at_Vertice_internal_2 --> -12($fp) + # local_add_out_at_Vertice_internal_0 = local_add_out_at_Vertice_internal_2 + lw $t0, -12($fp) + sw $t0, -4($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # ARG param_add_out_at_Vertice_s_0 + # PARAM param_add_out_at_Vertice_s_0 --> 0($fp) + lw $t0, 0($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_add_out_at_Vertice_internal_0 --> -4($fp) + # LOCAL local_add_out_at_Vertice_internal_1 --> -8($fp) + # local_add_out_at_Vertice_internal_1 = VCALL local_add_out_at_Vertice_internal_0 cons + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 48($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -8($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # + # LOCAL local_add_out_at_Vertice_internal_1 --> -8($fp) + lw $t0, -8($fp) + sw $t0, 16($s1) + # LOCAL local_add_out_at_Vertice_internal_3 --> -16($fp) + # local_add_out_at_Vertice_internal_3 = SELF + sw $s1, -16($fp) + # RETURN local_add_out_at_Vertice_internal_3 + lw $v0, -16($fp) + # Deallocate stack frame for function function_add_out_at_Vertice. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_print_at_Vertice implementation. +# @Params: +function_print_at_Vertice: + # Allocate stack frame for function function_print_at_Vertice. + subu $sp, $sp, 36 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 36 + # LOCAL local_print_at_Vertice_internal_2 --> -12($fp) + # local_print_at_Vertice_internal_2 = SELF + sw $s1, -12($fp) + # LOCAL local_print_at_Vertice_internal_0 --> -4($fp) + # LOCAL local_print_at_Vertice_internal_2 --> -12($fp) + # local_print_at_Vertice_internal_0 = local_print_at_Vertice_internal_2 + lw $t0, -12($fp) + sw $t0, -4($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # local_print_at_Vertice_internal_3 = GETATTRIBUTE num Vertice + # LOCAL local_print_at_Vertice_internal_3 --> -16($fp) + lw $t0, 12($s1) + sw $t0, -16($fp) + # ARG local_print_at_Vertice_internal_3 + # LOCAL local_print_at_Vertice_internal_3 --> -16($fp) + lw $t0, -16($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_print_at_Vertice_internal_0 --> -4($fp) + # LOCAL local_print_at_Vertice_internal_1 --> -8($fp) + # local_print_at_Vertice_internal_1 = VCALL local_print_at_Vertice_internal_0 out_int + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 20($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -8($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # local_print_at_Vertice_internal_6 = GETATTRIBUTE out Vertice + # LOCAL local_print_at_Vertice_internal_6 --> -28($fp) + lw $t0, 16($s1) + sw $t0, -28($fp) + # LOCAL local_print_at_Vertice_internal_4 --> -20($fp) + # LOCAL local_print_at_Vertice_internal_6 --> -28($fp) + # local_print_at_Vertice_internal_4 = local_print_at_Vertice_internal_6 + lw $t0, -28($fp) + sw $t0, -20($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_print_at_Vertice_internal_4 --> -20($fp) + # LOCAL local_print_at_Vertice_internal_5 --> -24($fp) + # local_print_at_Vertice_internal_5 = VCALL local_print_at_Vertice_internal_4 print + # Save new self pointer in $s1 + lw $s1, -20($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 92($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -24($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # RETURN local_print_at_Vertice_internal_5 + lw $v0, -24($fp) + # Deallocate stack frame for function function_print_at_Vertice. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 36 + jr $ra + # Function END + diff --git a/tests/codegen/hairyscary.mips b/tests/codegen/hairyscary.mips new file mode 100644 index 00000000..6a9dfe3e --- /dev/null +++ b/tests/codegen/hairyscary.mips @@ -0,0 +1,3624 @@ + +# Code generated by PyCoolc. +# Eliane Puerta, Liset Alfaro, Adrian Gonzalez --- Mon Dec 14 11:08:37 2020 +# School of Math and Computer Science, University of Havana +# + +.data +dummy: .word 0 +IO: .asciiz "IO" +# Function END +Object: .asciiz "Object" +# Function END +String: .asciiz "String" +# Function END +Bool: .asciiz "Bool" +# Function END +Int: .asciiz "Int" +# Function END +Main: .asciiz "Main" +# Function END +Bazz: .asciiz "Bazz" +# Function END +Foo: .asciiz "Foo" +# Function END +Razz: .asciiz "Razz" +# Function END +Bar: .asciiz "Bar" +# Function END +# + + +# **** VTABLE for type IO **** +IO_vtable: .word function_abort_at_Object, function_out_int_at_IO, dummy, function_copy_at_Object, function_in_int_at_IO, function_out_string_at_IO, dummy, dummy, dummy, function_in_string_at_IO, dummy, dummy, function_type_name_at_Object +# Function END +# + + +# **** Type RECORD for type IO **** +IO_start: + IO_vtable_pointer: .word IO_vtable + # Function END +IO_end: +# + + +# **** VTABLE for type Object **** +Object_vtable: .word function_abort_at_Object, dummy, dummy, function_copy_at_Object, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, function_type_name_at_Object +# Function END +# + + +# **** Type RECORD for type Object **** +Object_start: + Object_vtable_pointer: .word Object_vtable + # Function END +Object_end: +# + + +# **** VTABLE for type String **** +String_vtable: .word function_abort_at_Object, dummy, function_length_at_String, function_copy_at_Object, dummy, dummy, function_concat_at_String, dummy, dummy, dummy, function_substr_at_String, dummy, function_type_name_at_Object +# Function END +# + + +# **** Type RECORD for type String **** +String_start: + String_vtable_pointer: .word String_vtable + # Function END +String_end: +# + + +# **** VTABLE for type Bool **** +Bool_vtable: .word function_abort_at_Object, dummy, dummy, function_copy_at_Object, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, function_type_name_at_Object +# Function END +# + + +# **** Type RECORD for type Bool **** +Bool_start: + Bool_vtable_pointer: .word Bool_vtable + # Function END +Bool_end: +# + + +# **** VTABLE for type Int **** +Int_vtable: .word function_abort_at_Object, dummy, dummy, function_copy_at_Object, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, function_type_name_at_Object +# Function END +# + + +# **** Type RECORD for type Int **** +Int_start: + Int_vtable_pointer: .word Int_vtable + # Function END +Int_end: +# + + +# **** VTABLE for type Main **** +Main_vtable: .word function_abort_at_Object, dummy, dummy, function_copy_at_Object, dummy, dummy, dummy, dummy, function_main_at_Main, dummy, dummy, dummy, function_type_name_at_Object +# Function END +# + + +# **** Type RECORD for type Main **** +Main_start: + Main_vtable_pointer: .word Main_vtable + # Function END +Main_end: +# + + +# **** VTABLE for type Bazz **** +Bazz_vtable: .word function_abort_at_Object, function_out_int_at_IO, dummy, function_copy_at_Object, function_in_int_at_IO, function_out_string_at_IO, dummy, function_printh_at_Bazz, dummy, function_in_string_at_IO, dummy, function_doh_at_Bazz, function_type_name_at_Object +# Function END +# + + +# **** Type RECORD for type Bazz **** +Bazz_start: + Bazz_vtable_pointer: .word Bazz_vtable + # Function END +Bazz_end: +# + + +# **** VTABLE for type Foo **** +Foo_vtable: .word function_abort_at_Object, function_out_int_at_IO, dummy, function_copy_at_Object, function_in_int_at_IO, function_out_string_at_IO, dummy, function_printh_at_Bazz, dummy, function_in_string_at_IO, dummy, function_doh_at_Foo, function_type_name_at_Object +# Function END +# + + +# **** Type RECORD for type Foo **** +Foo_start: + Foo_vtable_pointer: .word Foo_vtable + # Function END +Foo_end: +# + + +# **** VTABLE for type Razz **** +Razz_vtable: .word function_abort_at_Object, function_out_int_at_IO, dummy, function_copy_at_Object, function_in_int_at_IO, function_out_string_at_IO, dummy, function_printh_at_Bazz, dummy, function_in_string_at_IO, dummy, function_doh_at_Foo, function_type_name_at_Object +# Function END +# + + +# **** Type RECORD for type Razz **** +Razz_start: + Razz_vtable_pointer: .word Razz_vtable + # Function END +Razz_end: +# + + +# **** VTABLE for type Bar **** +Bar_vtable: .word function_abort_at_Object, function_out_int_at_IO, dummy, function_copy_at_Object, function_in_int_at_IO, function_out_string_at_IO, dummy, function_printh_at_Bazz, dummy, function_in_string_at_IO, dummy, function_doh_at_Foo, function_type_name_at_Object +# Function END +# + + +# **** Type RECORD for type Bar **** +Bar_start: + Bar_vtable_pointer: .word Bar_vtable + # Function END +Bar_end: +# + + +data_0: .asciiz "" +# + + +data_1: .asciiz "Abort called from class " +# + + +data_2: .asciiz "\n" +# + + +IO__TDT: .word 0, -1, -1, -1, -1, -1, 1, 2, 3, 4 +Object__TDT: .word 1, 0, 1, 1, 1, 1, 2, 3, 4, 5 +String__TDT: .word -1, -1, 0, -1, -1, -1, -1, -1, -1, -1 +Bool__TDT: .word -1, -1, -1, 0, -1, -1, -1, -1, -1, -1 +Int__TDT: .word -1, -1, -1, -1, 0, -1, -1, -1, -1, -1 +Main__TDT: .word -1, -1, -1, -1, -1, 0, -1, -1, -1, -1 +Bazz__TDT: .word -1, -1, -1, -1, -1, -1, 0, 1, 2, 3 +Foo__TDT: .word -1, -1, -1, -1, -1, -1, -1, 0, 1, 2 +Razz__TDT: .word -1, -1, -1, -1, -1, -1, -1, -1, 0, 1 +Bar__TDT: .word -1, -1, -1, -1, -1, -1, -1, -1, -1, 0 +# + + +data_4: .asciiz "do nothing" +# + + +.text +main: + jal entry + # syscall code 10 is for exit + li $v0, 10 + syscall + # Function END + +# function_in_string_at_IO implementation. +# @Params: +function_in_string_at_IO: + # Allocate stack frame for function function_in_string_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_in_string_at_IO_internal_0 --> -4($fp) + # Allocating 1024 bytes of memory + li $a0, 1024 + li $v0, 9 + syscall + move $t0, $v0 + move $a0, $v0 + li $a1, 1024 + li $v0, 8 + syscall + move $t2, $zero + move $t3, $zero + move $t1, $t0 + lb $t3, 0($t1) + beqz $t3, end_loop + read_length_loop: + lb $t3, 0($t1) + beqz $t3, end_read_length_loop + addu $t1, $t1, 1 + addu $t2, $t2, 1 + j read_length_loop + end_read_length_loop: + subu $t1, $t1, 1 + sb $zero, 0($t1) + subu $t2, $t2, 1 + end_loop: + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $t2, 16($v0) + sw $v0, -4($fp) + # RETURN local_in_string_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_in_string_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_out_int_at_IO implementation. +# @Params: +# 0($fp) = param_out_int_at_IO_x_0 +function_out_int_at_IO: + # Allocate stack frame for function function_out_int_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # PRINT_INT param_out_int_at_IO_x_0 + # PARAM param_out_int_at_IO_x_0 --> 0($fp) + lw $v0, 0($fp) + lw $a0, 12($v0) + li $v0, 1 + syscall + # LOCAL local_out_int_at_IO_internal_0 --> -4($fp) + # local_out_int_at_IO_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_out_int_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_out_int_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_out_string_at_IO implementation. +# @Params: +# 0($fp) = param_out_string_at_IO_x_0 +function_out_string_at_IO: + # Allocate stack frame for function function_out_string_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # PARAM param_out_string_at_IO_x_0 --> 0($fp) + # PRINT_STR param_out_string_at_IO_x_0 + lw $v0, 0($fp) + lw $a0, 12($v0) + li $v0, 4 + syscall + # LOCAL local_out_string_at_IO_internal_0 --> -4($fp) + # local_out_string_at_IO_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_out_string_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_out_string_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_in_int_at_IO implementation. +# @Params: +function_in_int_at_IO: + # Allocate stack frame for function function_in_int_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_in_int_at_IO_internal_0 --> -4($fp) + # local_in_int_at_IO_internal_0 = READ_INT + li $v0, 5 + syscall + move $a2, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + sw $a2, 12($v0) + sw $v0, -4($fp) + # RETURN local_in_int_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_in_int_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_abort_at_Object implementation. +# @Params: +function_abort_at_Object: + # Allocate stack frame for function function_abort_at_Object. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_abort_at_Object_internal_0 --> -4($fp) + lw $t0, 0($s1) + sw $t0, -4($fp) + # LOCAL local_abort_at_Object_internal_0 --> -4($fp) + la $a0, data_1 + li $v0, 4 + syscall + lw $a0, -4($fp) + li $v0, 4 + syscall + la $a0, data_2 + li $v0, 4 + syscall + li $v0, 10 + syscall + # Function END + + +# function_copy_at_Object implementation. +# @Params: +function_copy_at_Object: + # Allocate stack frame for function function_copy_at_Object. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_copy_at_Object_internal_0 --> -4($fp) + # local_copy_at_Object_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_copy_at_Object_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function function_copy_at_Object. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_type_name_at_Object implementation. +# @Params: +function_type_name_at_Object: + # Allocate stack frame for function function_type_name_at_Object. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_type_name_at_Object_internal_0 --> -4($fp) + lw $t0, 0($s1) + sw $t0, -4($fp) + # RETURN local_type_name_at_Object_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_type_name_at_Object. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_concat_at_String implementation. +# @Params: +# 0($fp) = param_concat_at_String_s_0 +function_concat_at_String: + # Allocate stack frame for function function_concat_at_String. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_concat_at_String_internal_0 = self.CONCAT + # LOCAL local_concat_at_String_internal_0 --> -4($fp) + # PARAM param_concat_at_String_s_0 --> 0($fp) + # Get first string length from self + lw $t0, 16($s1) + # Get second string length from param + lw $v0, 0($fp) + lw $t1, 16($v0) + # Save new string length in a0 for memory allocation + addu $a0, $t0, $t1 + move $t3, $a0 + # Get first string from self + lw $t0, 12($s1) + # Get second string from param + lw $t1, 12($v0) + addu $a0, $a0, 4 + li $v0, 9 + syscall + move $t2, $v0 + move $t4, $zero + concat_loop1: + # Compare t0 with \0 + lb $t4, 0($t0) + beqz $t4, concat_loop1_end + # Copy 1 byte + sb $t4, 0($t2) + addu $t2, $t2, 1 + addu $t0, $t0, 1 + j concat_loop1 + concat_loop1_end: + # Copy second string + concat_loop2: + # Compare t1 with \0 + lb $t4, 0($t1) + beqz $t4, concat_loop2_end + # Copy 1 byte + sb $t4, 0($t2) + addu $t2, $t2, 1 + addu $t1, $t1, 1 + j concat_loop2 + concat_loop2_end: + sb $zero, 0($t2) + # v0 contains resulting string + move $t1, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + sw $t1, 12($v0) + sw $t3, 16($v0) + sw $v0, -4($fp) + # RETURN local_concat_at_String_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_concat_at_String. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_substr_at_String implementation. +# @Params: +# 0($fp) = param_substr_at_String_l_0 +# 4($fp) = param_substr_at_String_r_1 +function_substr_at_String: + # Allocate stack frame for function function_substr_at_String. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_substr_at_String_internal_0 --> -4($fp) + # PARAM param_substr_at_String_l_0 --> 4($fp) + # PARAM param_substr_at_String_r_1 --> 0($fp) + lw $t0, 12($s1) + lw $t2, 4($fp) + lw $t2, 12($t2) + addu $t0, $t0, $t2 + lw $a0, 0($fp) + lw $a0, 12($a0) + move $t3, $a0 + move $t1, $a0 + addu $a0, $a0, 1 + li $v0, 9 + syscall + move $t2, $v0 + substr_loop: + beqz $t1, substr_end + lb $a0, 0($t0) + sb $a0, 0($t2) + addu $t0, $t0, 1 + addu $t2, $t2, 1 + subu $t1, $t1, 1 + j substr_loop + substr_end: + sb $zero, 0($t2) + move $t1, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + sw $t1, 12($v0) + sw $t3, 16($v0) + sw $v0, -4($fp) + # RETURN local_substr_at_String_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_substr_at_String. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 8 + jr $ra + # Function END + + +# function_length_at_String implementation. +# @Params: +function_length_at_String: + # Allocate stack frame for function function_length_at_String. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_length_at_String_internal_0 = GETATTRIBUTE length String + # LOCAL local_length_at_String_internal_0 --> -4($fp) + lw $t0, 16($s1) + sw $t0, -4($fp) + # LOCAL local_length_at_String_internal_1 --> -8($fp) + # LOCAL local_length_at_String_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + lw $t0, -4($fp) + sw $t0, 12($v0) + sw $v0, -8($fp) + # RETURN local_length_at_String_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function function_length_at_String. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# entry implementation. +# @Params: +entry: + # Allocate stack frame for function entry. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local__internal_0 --> -4($fp) + # local__internal_0 = ALLOCATE Main + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Main + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 28 bytes of memory + li $a0, 28 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Main_start + sw $t0, 4($v0) + # Load type offset + li $t0, 20 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Main__attrib__a__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 12($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Main__attrib__b__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 16($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Main__attrib__c__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 20($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Main__attrib__d__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 24($t1) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -4($fp) + # LOCAL local__internal_0 --> -4($fp) + lw $s1, -4($fp) + # local__internal_1 = CALL main + # LOCAL local__internal_1 --> -8($fp) + # LOCAL local__internal_0 --> -4($fp) + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type's VTABLE + la $t0, Main_vtable + # Get pointer to function address + lw $t1, 32($t0) + # Call function. Result is on $v0 + jalr $t1 + sw $v0, -8($fp) + # RETURN 0 + li $v0, 0 + # Deallocate stack frame for function entry. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# __Main__attrib__a__init implementation. +# @Params: +__Main__attrib__a__init: + # Allocate stack frame for function __Main__attrib__a__init. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_ttrib__a__init_internal_1 --> -8($fp) + # local_ttrib__a__init_internal_1 = ALLOCATE Bazz + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bazz + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 24 bytes of memory + li $a0, 24 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bazz_start + sw $t0, 4($v0) + # Load type offset + li $t0, 24 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Bazz__attrib__h__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 12($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Bazz__attrib__g__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 16($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Bazz__attrib__i__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 20($t1) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -8($fp) + # RETURN local_ttrib__a__init_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function __Main__attrib__a__init. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# __Main__attrib__b__init implementation. +# @Params: +__Main__attrib__b__init: + # Allocate stack frame for function __Main__attrib__b__init. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_ttrib__b__init_internal_1 --> -8($fp) + # local_ttrib__b__init_internal_1 = ALLOCATE Foo + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Foo + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 32 bytes of memory + li $a0, 32 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Foo_start + sw $t0, 4($v0) + # Load type offset + li $t0, 28 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Bazz__attrib__h__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 12($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Bazz__attrib__g__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 16($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Bazz__attrib__i__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 20($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Foo__attrib__a__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 24($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Foo__attrib__b__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 28($t1) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -8($fp) + # RETURN local_ttrib__b__init_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function __Main__attrib__b__init. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# __Main__attrib__c__init implementation. +# @Params: +__Main__attrib__c__init: + # Allocate stack frame for function __Main__attrib__c__init. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_ttrib__c__init_internal_1 --> -8($fp) + # local_ttrib__c__init_internal_1 = ALLOCATE Razz + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Razz + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 40 bytes of memory + li $a0, 40 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Razz_start + sw $t0, 4($v0) + # Load type offset + li $t0, 32 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Bazz__attrib__h__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 12($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Bazz__attrib__g__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 16($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Bazz__attrib__i__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 20($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Foo__attrib__a__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 24($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Foo__attrib__b__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 28($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Razz__attrib__e__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 32($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Razz__attrib__f__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 36($t1) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -8($fp) + # RETURN local_ttrib__c__init_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function __Main__attrib__c__init. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# __Main__attrib__d__init implementation. +# @Params: +__Main__attrib__d__init: + # Allocate stack frame for function __Main__attrib__d__init. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_ttrib__d__init_internal_1 --> -8($fp) + # local_ttrib__d__init_internal_1 = ALLOCATE Bar + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bar + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 48 bytes of memory + li $a0, 48 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bar_start + sw $t0, 4($v0) + # Load type offset + li $t0, 36 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Bazz__attrib__h__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 12($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Bazz__attrib__g__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 16($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Bazz__attrib__i__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 20($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Foo__attrib__a__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 24($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Foo__attrib__b__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 28($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Razz__attrib__e__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 32($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Razz__attrib__f__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 36($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Bar__attrib__c__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 40($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Bar__attrib__d__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 44($t1) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -8($fp) + # RETURN local_ttrib__d__init_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function __Main__attrib__d__init. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_main_at_Main implementation. +# @Params: +function_main_at_Main: + # Allocate stack frame for function function_main_at_Main. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_main_at_Main_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_4 + sw $t0, 12($v0) + li $t0, 10 + sw $t0, 16($v0) + sw $v0, -4($fp) + # RETURN local_main_at_Main_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_main_at_Main. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# __Bazz__attrib__h__init implementation. +# @Params: +__Bazz__attrib__h__init: + # Allocate stack frame for function __Bazz__attrib__h__init. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_ttrib__h__init_internal_1 --> -8($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -8($fp) + # RETURN local_ttrib__h__init_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function __Bazz__attrib__h__init. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# __Bazz__attrib__g__init implementation. +# @Params: +__Bazz__attrib__g__init: + # Allocate stack frame for function __Bazz__attrib__g__init. + subu $sp, $sp, 64 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 64 + # LOCAL local_ttrib__g__init_internal_1 --> -8($fp) + # local_ttrib__g__init_internal_1 = SELF + sw $s1, -8($fp) + # LOCAL local_ttrib__g__init_internal_1 --> -8($fp) + # LOCAL local_ttrib__g__init_internal_2 --> -12($fp) + # local_ttrib__g__init_internal_2 = TYPEOF local_ttrib__g__init_internal_1 + lw $t0, -8($fp) + # Load pointer to type offset + lw $t1, 8($t0) + sw $t1, -12($fp) + # LOCAL local_ttrib__g__init_internal_5 --> -24($fp) + # local_ttrib__g__init_internal_5 = 13 + li $t0, 13 + sw $t0, -24($fp) + # local_ttrib__g__init_internal_6 = TYPE_DISTANCE Bazz + # LOCAL local_ttrib__g__init_internal_6 --> -28($fp) + # LOCAL local_ttrib__g__init_internal_2 --> -12($fp) + # Load TDT pointer to type Bazz + la $t0, Bazz__TDT + lw $t1, -12($fp) + addu $t0, $t0, $t1 + # Save distance + lw $t1, 0($t0) + sw $t1, -28($fp) + # LOCAL local_ttrib__g__init_internal_6 --> -28($fp) + # LOCAL local_ttrib__g__init_internal_5 --> -24($fp) + # Update min if 8 < 9 + lw $t0, -28($fp) + lw $t1, -24($fp) + bgtu $t0, $t1, label_Not_min0_1 + # LOCAL local_ttrib__g__init_internal_5 --> -24($fp) + # LOCAL local_ttrib__g__init_internal_6 --> -28($fp) + # local_ttrib__g__init_internal_5 = local_ttrib__g__init_internal_6 + lw $t0, -28($fp) + sw $t0, -24($fp) + label_Not_min0_1: + # local_ttrib__g__init_internal_6 = TYPE_DISTANCE Razz + # LOCAL local_ttrib__g__init_internal_6 --> -28($fp) + # LOCAL local_ttrib__g__init_internal_2 --> -12($fp) + # Load TDT pointer to type Razz + la $t0, Razz__TDT + lw $t1, -12($fp) + addu $t0, $t0, $t1 + # Save distance + lw $t1, 0($t0) + sw $t1, -28($fp) + # LOCAL local_ttrib__g__init_internal_6 --> -28($fp) + # LOCAL local_ttrib__g__init_internal_5 --> -24($fp) + # Update min if 8 < 9 + lw $t0, -28($fp) + lw $t1, -24($fp) + bgtu $t0, $t1, label_Not_min1_2 + # LOCAL local_ttrib__g__init_internal_5 --> -24($fp) + # LOCAL local_ttrib__g__init_internal_6 --> -28($fp) + # local_ttrib__g__init_internal_5 = local_ttrib__g__init_internal_6 + lw $t0, -28($fp) + sw $t0, -24($fp) + label_Not_min1_2: + # local_ttrib__g__init_internal_6 = TYPE_DISTANCE Foo + # LOCAL local_ttrib__g__init_internal_6 --> -28($fp) + # LOCAL local_ttrib__g__init_internal_2 --> -12($fp) + # Load TDT pointer to type Foo + la $t0, Foo__TDT + lw $t1, -12($fp) + addu $t0, $t0, $t1 + # Save distance + lw $t1, 0($t0) + sw $t1, -28($fp) + # LOCAL local_ttrib__g__init_internal_6 --> -28($fp) + # LOCAL local_ttrib__g__init_internal_5 --> -24($fp) + # Update min if 8 < 9 + lw $t0, -28($fp) + lw $t1, -24($fp) + bgtu $t0, $t1, label_Not_min2_3 + # LOCAL local_ttrib__g__init_internal_5 --> -24($fp) + # LOCAL local_ttrib__g__init_internal_6 --> -28($fp) + # local_ttrib__g__init_internal_5 = local_ttrib__g__init_internal_6 + lw $t0, -28($fp) + sw $t0, -24($fp) + label_Not_min2_3: + # local_ttrib__g__init_internal_6 = TYPE_DISTANCE Bar + # LOCAL local_ttrib__g__init_internal_6 --> -28($fp) + # LOCAL local_ttrib__g__init_internal_2 --> -12($fp) + # Load TDT pointer to type Bar + la $t0, Bar__TDT + lw $t1, -12($fp) + addu $t0, $t0, $t1 + # Save distance + lw $t1, 0($t0) + sw $t1, -28($fp) + # LOCAL local_ttrib__g__init_internal_6 --> -28($fp) + # LOCAL local_ttrib__g__init_internal_5 --> -24($fp) + # Update min if 8 < 9 + lw $t0, -28($fp) + lw $t1, -24($fp) + bgtu $t0, $t1, label_Not_min3_4 + # LOCAL local_ttrib__g__init_internal_5 --> -24($fp) + # LOCAL local_ttrib__g__init_internal_6 --> -28($fp) + # local_ttrib__g__init_internal_5 = local_ttrib__g__init_internal_6 + lw $t0, -28($fp) + sw $t0, -24($fp) + label_Not_min3_4: + # LOCAL local_ttrib__g__init_internal_6 --> -28($fp) + # local_ttrib__g__init_internal_6 = 13 + li $t0, 13 + sw $t0, -28($fp) + # LOCAL local_ttrib__g__init_internal_3 --> -16($fp) + # LOCAL local_ttrib__g__init_internal_6 --> -28($fp) + # LOCAL local_ttrib__g__init_internal_5 --> -24($fp) + # Load pointers and SUB + lw $a0, -28($fp) + lw $a1, -24($fp) + sub $a0, $a0, $a1 + sw $a0, -16($fp) + # IF_ZERO local_ttrib__g__init_internal_3 GOTO label_ERROR_5 + # IF_ZERO local_ttrib__g__init_internal_3 GOTO label_ERROR_5 + lw $t0, -16($fp) + beq $t0, 0, label_ERROR_5 + # local_ttrib__g__init_internal_6 = TYPE_DISTANCE Bazz + # LOCAL local_ttrib__g__init_internal_6 --> -28($fp) + # LOCAL local_ttrib__g__init_internal_2 --> -12($fp) + # Load TDT pointer to type Bazz + la $t0, Bazz__TDT + lw $t1, -12($fp) + addu $t0, $t0, $t1 + # Save distance + lw $t1, 0($t0) + sw $t1, -28($fp) + # LOCAL local_ttrib__g__init_internal_6 --> -28($fp) + # LOCAL local_ttrib__g__init_internal_5 --> -24($fp) + # Update min if 8 < 9 + lw $t0, -28($fp) + lw $t1, -24($fp) + bgtu $t0, $t1, label_NEXT0_7 + # LOCAL local_ttrib__g__init_n_7 --> -32($fp) + # LOCAL local_ttrib__g__init_internal_1 --> -8($fp) + # local_ttrib__g__init_n_7 = local_ttrib__g__init_internal_1 + lw $t0, -8($fp) + sw $t0, -32($fp) + # LOCAL local_ttrib__g__init_internal_8 --> -36($fp) + # local_ttrib__g__init_internal_8 = ALLOCATE Foo + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Foo + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 32 bytes of memory + li $a0, 32 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Foo_start + sw $t0, 4($v0) + # Load type offset + li $t0, 28 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Bazz__attrib__h__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 12($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Bazz__attrib__g__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 16($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Bazz__attrib__i__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 20($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Foo__attrib__a__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 24($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Foo__attrib__b__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 28($t1) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -36($fp) + # LOCAL local_ttrib__g__init_internal_4 --> -20($fp) + # LOCAL local_ttrib__g__init_internal_8 --> -36($fp) + # local_ttrib__g__init_internal_4 = local_ttrib__g__init_internal_8 + lw $t0, -36($fp) + sw $t0, -20($fp) + # GOTO label_END_6 +j label_END_6 +label_NEXT0_7: + # local_ttrib__g__init_internal_6 = TYPE_DISTANCE Razz + # LOCAL local_ttrib__g__init_internal_6 --> -28($fp) + # LOCAL local_ttrib__g__init_internal_2 --> -12($fp) + # Load TDT pointer to type Razz + la $t0, Razz__TDT + lw $t1, -12($fp) + addu $t0, $t0, $t1 + # Save distance + lw $t1, 0($t0) + sw $t1, -28($fp) + # LOCAL local_ttrib__g__init_internal_6 --> -28($fp) + # LOCAL local_ttrib__g__init_internal_5 --> -24($fp) + # Update min if 8 < 9 + lw $t0, -28($fp) + lw $t1, -24($fp) + bgtu $t0, $t1, label_NEXT1_8 + # LOCAL local_ttrib__g__init_n_9 --> -40($fp) + # LOCAL local_ttrib__g__init_internal_1 --> -8($fp) + # local_ttrib__g__init_n_9 = local_ttrib__g__init_internal_1 + lw $t0, -8($fp) + sw $t0, -40($fp) + # LOCAL local_ttrib__g__init_internal_10 --> -44($fp) + # local_ttrib__g__init_internal_10 = ALLOCATE Bar + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bar + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 48 bytes of memory + li $a0, 48 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bar_start + sw $t0, 4($v0) + # Load type offset + li $t0, 36 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Bazz__attrib__h__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 12($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Bazz__attrib__g__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 16($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Bazz__attrib__i__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 20($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Foo__attrib__a__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 24($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Foo__attrib__b__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 28($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Razz__attrib__e__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 32($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Razz__attrib__f__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 36($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Bar__attrib__c__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 40($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Bar__attrib__d__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 44($t1) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -44($fp) + # LOCAL local_ttrib__g__init_internal_4 --> -20($fp) + # LOCAL local_ttrib__g__init_internal_10 --> -44($fp) + # local_ttrib__g__init_internal_4 = local_ttrib__g__init_internal_10 + lw $t0, -44($fp) + sw $t0, -20($fp) + # GOTO label_END_6 +j label_END_6 +label_NEXT1_8: + # local_ttrib__g__init_internal_6 = TYPE_DISTANCE Foo + # LOCAL local_ttrib__g__init_internal_6 --> -28($fp) + # LOCAL local_ttrib__g__init_internal_2 --> -12($fp) + # Load TDT pointer to type Foo + la $t0, Foo__TDT + lw $t1, -12($fp) + addu $t0, $t0, $t1 + # Save distance + lw $t1, 0($t0) + sw $t1, -28($fp) + # LOCAL local_ttrib__g__init_internal_6 --> -28($fp) + # LOCAL local_ttrib__g__init_internal_5 --> -24($fp) + # Update min if 8 < 9 + lw $t0, -28($fp) + lw $t1, -24($fp) + bgtu $t0, $t1, label_NEXT2_9 + # LOCAL local_ttrib__g__init_n_11 --> -48($fp) + # LOCAL local_ttrib__g__init_internal_1 --> -8($fp) + # local_ttrib__g__init_n_11 = local_ttrib__g__init_internal_1 + lw $t0, -8($fp) + sw $t0, -48($fp) + # LOCAL local_ttrib__g__init_internal_12 --> -52($fp) + # local_ttrib__g__init_internal_12 = ALLOCATE Razz + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Razz + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 40 bytes of memory + li $a0, 40 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Razz_start + sw $t0, 4($v0) + # Load type offset + li $t0, 32 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Bazz__attrib__h__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 12($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Bazz__attrib__g__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 16($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Bazz__attrib__i__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 20($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Foo__attrib__a__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 24($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Foo__attrib__b__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 28($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Razz__attrib__e__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 32($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Razz__attrib__f__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 36($t1) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -52($fp) + # LOCAL local_ttrib__g__init_internal_4 --> -20($fp) + # LOCAL local_ttrib__g__init_internal_12 --> -52($fp) + # local_ttrib__g__init_internal_4 = local_ttrib__g__init_internal_12 + lw $t0, -52($fp) + sw $t0, -20($fp) + # GOTO label_END_6 +j label_END_6 +label_NEXT2_9: + # local_ttrib__g__init_internal_6 = TYPE_DISTANCE Bar + # LOCAL local_ttrib__g__init_internal_6 --> -28($fp) + # LOCAL local_ttrib__g__init_internal_2 --> -12($fp) + # Load TDT pointer to type Bar + la $t0, Bar__TDT + lw $t1, -12($fp) + addu $t0, $t0, $t1 + # Save distance + lw $t1, 0($t0) + sw $t1, -28($fp) + # LOCAL local_ttrib__g__init_internal_6 --> -28($fp) + # LOCAL local_ttrib__g__init_internal_5 --> -24($fp) + # Update min if 8 < 9 + lw $t0, -28($fp) + lw $t1, -24($fp) + bgtu $t0, $t1, label_NEXT3_10 + # LOCAL local_ttrib__g__init_n_13 --> -56($fp) + # LOCAL local_ttrib__g__init_internal_1 --> -8($fp) + # local_ttrib__g__init_n_13 = local_ttrib__g__init_internal_1 + lw $t0, -8($fp) + sw $t0, -56($fp) + # LOCAL local_ttrib__g__init_internal_4 --> -20($fp) + # LOCAL local_ttrib__g__init_n_13 --> -56($fp) + # local_ttrib__g__init_internal_4 = local_ttrib__g__init_n_13 + lw $t0, -56($fp) + sw $t0, -20($fp) + # GOTO label_END_6 +j label_END_6 +label_NEXT3_10: + label_ERROR_5: + # LOCAL local_ttrib__g__init_internal_1 --> -8($fp) + lw $t0, 0($s1) + sw $t0, -8($fp) + # LOCAL local_ttrib__g__init_internal_1 --> -8($fp) + la $a0, data_1 + li $v0, 4 + syscall + lw $a0, -8($fp) + li $v0, 4 + syscall + la $a0, data_2 + li $v0, 4 + syscall + li $v0, 10 + syscall + label_END_6: +# RETURN local_ttrib__g__init_internal_4 +lw $v0, -20($fp) +# Deallocate stack frame for function __Bazz__attrib__g__init. +# Restore $ra +lw $ra, 4($sp) +# Restore $fp +lw $fp, 0($sp) +# Restore Stack pointer $sp +addu $sp, $sp, 64 +jr $ra +# Function END + + +# __Bazz__attrib__i__init implementation. +# @Params: +__Bazz__attrib__i__init: + # Allocate stack frame for function __Bazz__attrib__i__init. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_ttrib__i__init_internal_3 --> -16($fp) + # local_ttrib__i__init_internal_3 = SELF + sw $s1, -16($fp) + # LOCAL local_ttrib__i__init_internal_1 --> -8($fp) + # LOCAL local_ttrib__i__init_internal_3 --> -16($fp) + # local_ttrib__i__init_internal_1 = local_ttrib__i__init_internal_3 + lw $t0, -16($fp) + sw $t0, -8($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_ttrib__i__init_internal_1 --> -8($fp) + # LOCAL local_ttrib__i__init_internal_2 --> -12($fp) + # local_ttrib__i__init_internal_2 = VCALL local_ttrib__i__init_internal_1 printh + # Save new self pointer in $s1 + lw $s1, -8($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 28($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -12($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # RETURN local_ttrib__i__init_internal_2 + lw $v0, -12($fp) + # Deallocate stack frame for function __Bazz__attrib__i__init. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_printh_at_Bazz implementation. +# @Params: +function_printh_at_Bazz: + # Allocate stack frame for function function_printh_at_Bazz. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_printh_at_Bazz_internal_2 --> -12($fp) + # local_printh_at_Bazz_internal_2 = SELF + sw $s1, -12($fp) + # LOCAL local_printh_at_Bazz_internal_0 --> -4($fp) + # LOCAL local_printh_at_Bazz_internal_2 --> -12($fp) + # local_printh_at_Bazz_internal_0 = local_printh_at_Bazz_internal_2 + lw $t0, -12($fp) + sw $t0, -4($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # local_printh_at_Bazz_internal_3 = GETATTRIBUTE h Bazz + # LOCAL local_printh_at_Bazz_internal_3 --> -16($fp) + lw $t0, 12($s1) + sw $t0, -16($fp) + # ARG local_printh_at_Bazz_internal_3 + # LOCAL local_printh_at_Bazz_internal_3 --> -16($fp) + lw $t0, -16($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_printh_at_Bazz_internal_0 --> -4($fp) + # LOCAL local_printh_at_Bazz_internal_1 --> -8($fp) + # local_printh_at_Bazz_internal_1 = VCALL local_printh_at_Bazz_internal_0 out_int + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 4($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -8($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_printh_at_Bazz_internal_4 --> -20($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -20($fp) + # RETURN local_printh_at_Bazz_internal_4 + lw $v0, -20($fp) + # Deallocate stack frame for function function_printh_at_Bazz. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_doh_at_Bazz implementation. +# @Params: +function_doh_at_Bazz: + # Allocate stack frame for function function_doh_at_Bazz. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_doh_at_Bazz_i_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -4($fp) + # local_doh_at_Bazz_internal_1 = GETATTRIBUTE h Bazz + # LOCAL local_doh_at_Bazz_internal_1 --> -8($fp) + lw $t0, 12($s1) + sw $t0, -8($fp) + # LOCAL local_doh_at_Bazz_i_0 --> -4($fp) + # LOCAL local_doh_at_Bazz_internal_1 --> -8($fp) + # local_doh_at_Bazz_i_0 = local_doh_at_Bazz_internal_1 + lw $t0, -8($fp) + sw $t0, -4($fp) + # local_doh_at_Bazz_internal_3 = GETATTRIBUTE h Bazz + # LOCAL local_doh_at_Bazz_internal_3 --> -16($fp) + lw $t0, 12($s1) + sw $t0, -16($fp) + # LOCAL local_doh_at_Bazz_internal_4 --> -20($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -20($fp) + # LOCAL local_doh_at_Bazz_internal_2 --> -12($fp) + # LOCAL local_doh_at_Bazz_internal_3 --> -16($fp) + # LOCAL local_doh_at_Bazz_internal_4 --> -20($fp) + # local_doh_at_Bazz_internal_2 = local_doh_at_Bazz_internal_3 + local_doh_at_Bazz_internal_4 + lw $t1, -16($fp) + lw $t0, 12($t1) + lw $t1, -20($fp) + lw $t2, 12($t1) + add $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -12($fp) + # + # LOCAL local_doh_at_Bazz_internal_2 --> -12($fp) + lw $t0, -12($fp) + sw $t0, 12($s1) + # RETURN local_doh_at_Bazz_i_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_doh_at_Bazz. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# __Foo__attrib__a__init implementation. +# @Params: +__Foo__attrib__a__init: + # Allocate stack frame for function __Foo__attrib__a__init. + subu $sp, $sp, 56 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 56 + # LOCAL local_trib__a__init_internal_1 --> -8($fp) + # local_trib__a__init_internal_1 = SELF + sw $s1, -8($fp) + # LOCAL local_trib__a__init_internal_1 --> -8($fp) + # LOCAL local_trib__a__init_internal_2 --> -12($fp) + # local_trib__a__init_internal_2 = TYPEOF local_trib__a__init_internal_1 + lw $t0, -8($fp) + # Load pointer to type offset + lw $t1, 8($t0) + sw $t1, -12($fp) + # LOCAL local_trib__a__init_internal_5 --> -24($fp) + # local_trib__a__init_internal_5 = 13 + li $t0, 13 + sw $t0, -24($fp) + # local_trib__a__init_internal_6 = TYPE_DISTANCE Razz + # LOCAL local_trib__a__init_internal_6 --> -28($fp) + # LOCAL local_trib__a__init_internal_2 --> -12($fp) + # Load TDT pointer to type Razz + la $t0, Razz__TDT + lw $t1, -12($fp) + addu $t0, $t0, $t1 + # Save distance + lw $t1, 0($t0) + sw $t1, -28($fp) + # LOCAL local_trib__a__init_internal_6 --> -28($fp) + # LOCAL local_trib__a__init_internal_5 --> -24($fp) + # Update min if 8 < 9 + lw $t0, -28($fp) + lw $t1, -24($fp) + bgtu $t0, $t1, label_Not_min0_11 + # LOCAL local_trib__a__init_internal_5 --> -24($fp) + # LOCAL local_trib__a__init_internal_6 --> -28($fp) + # local_trib__a__init_internal_5 = local_trib__a__init_internal_6 + lw $t0, -28($fp) + sw $t0, -24($fp) + label_Not_min0_11: + # local_trib__a__init_internal_6 = TYPE_DISTANCE Foo + # LOCAL local_trib__a__init_internal_6 --> -28($fp) + # LOCAL local_trib__a__init_internal_2 --> -12($fp) + # Load TDT pointer to type Foo + la $t0, Foo__TDT + lw $t1, -12($fp) + addu $t0, $t0, $t1 + # Save distance + lw $t1, 0($t0) + sw $t1, -28($fp) + # LOCAL local_trib__a__init_internal_6 --> -28($fp) + # LOCAL local_trib__a__init_internal_5 --> -24($fp) + # Update min if 8 < 9 + lw $t0, -28($fp) + lw $t1, -24($fp) + bgtu $t0, $t1, label_Not_min1_12 + # LOCAL local_trib__a__init_internal_5 --> -24($fp) + # LOCAL local_trib__a__init_internal_6 --> -28($fp) + # local_trib__a__init_internal_5 = local_trib__a__init_internal_6 + lw $t0, -28($fp) + sw $t0, -24($fp) + label_Not_min1_12: + # local_trib__a__init_internal_6 = TYPE_DISTANCE Bar + # LOCAL local_trib__a__init_internal_6 --> -28($fp) + # LOCAL local_trib__a__init_internal_2 --> -12($fp) + # Load TDT pointer to type Bar + la $t0, Bar__TDT + lw $t1, -12($fp) + addu $t0, $t0, $t1 + # Save distance + lw $t1, 0($t0) + sw $t1, -28($fp) + # LOCAL local_trib__a__init_internal_6 --> -28($fp) + # LOCAL local_trib__a__init_internal_5 --> -24($fp) + # Update min if 8 < 9 + lw $t0, -28($fp) + lw $t1, -24($fp) + bgtu $t0, $t1, label_Not_min2_13 + # LOCAL local_trib__a__init_internal_5 --> -24($fp) + # LOCAL local_trib__a__init_internal_6 --> -28($fp) + # local_trib__a__init_internal_5 = local_trib__a__init_internal_6 + lw $t0, -28($fp) + sw $t0, -24($fp) + label_Not_min2_13: + # LOCAL local_trib__a__init_internal_6 --> -28($fp) + # local_trib__a__init_internal_6 = 13 + li $t0, 13 + sw $t0, -28($fp) + # LOCAL local_trib__a__init_internal_3 --> -16($fp) + # LOCAL local_trib__a__init_internal_6 --> -28($fp) + # LOCAL local_trib__a__init_internal_5 --> -24($fp) + # Load pointers and SUB + lw $a0, -28($fp) + lw $a1, -24($fp) + sub $a0, $a0, $a1 + sw $a0, -16($fp) + # IF_ZERO local_trib__a__init_internal_3 GOTO label_ERROR_14 + # IF_ZERO local_trib__a__init_internal_3 GOTO label_ERROR_14 + lw $t0, -16($fp) + beq $t0, 0, label_ERROR_14 + # local_trib__a__init_internal_6 = TYPE_DISTANCE Razz + # LOCAL local_trib__a__init_internal_6 --> -28($fp) + # LOCAL local_trib__a__init_internal_2 --> -12($fp) + # Load TDT pointer to type Razz + la $t0, Razz__TDT + lw $t1, -12($fp) + addu $t0, $t0, $t1 + # Save distance + lw $t1, 0($t0) + sw $t1, -28($fp) + # LOCAL local_trib__a__init_internal_6 --> -28($fp) + # LOCAL local_trib__a__init_internal_5 --> -24($fp) + # Update min if 8 < 9 + lw $t0, -28($fp) + lw $t1, -24($fp) + bgtu $t0, $t1, label_NEXT0_16 + # LOCAL local_trib__a__init_n_7 --> -32($fp) + # LOCAL local_trib__a__init_internal_1 --> -8($fp) + # local_trib__a__init_n_7 = local_trib__a__init_internal_1 + lw $t0, -8($fp) + sw $t0, -32($fp) + # LOCAL local_trib__a__init_internal_8 --> -36($fp) + # local_trib__a__init_internal_8 = ALLOCATE Bar + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bar + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 48 bytes of memory + li $a0, 48 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bar_start + sw $t0, 4($v0) + # Load type offset + li $t0, 36 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Bazz__attrib__h__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 12($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Bazz__attrib__g__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 16($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Bazz__attrib__i__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 20($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Foo__attrib__a__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 24($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Foo__attrib__b__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 28($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Razz__attrib__e__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 32($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Razz__attrib__f__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 36($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Bar__attrib__c__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 40($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Bar__attrib__d__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 44($t1) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -36($fp) + # LOCAL local_trib__a__init_internal_4 --> -20($fp) + # LOCAL local_trib__a__init_internal_8 --> -36($fp) + # local_trib__a__init_internal_4 = local_trib__a__init_internal_8 + lw $t0, -36($fp) + sw $t0, -20($fp) + # GOTO label_END_15 +j label_END_15 +label_NEXT0_16: + # local_trib__a__init_internal_6 = TYPE_DISTANCE Foo + # LOCAL local_trib__a__init_internal_6 --> -28($fp) + # LOCAL local_trib__a__init_internal_2 --> -12($fp) + # Load TDT pointer to type Foo + la $t0, Foo__TDT + lw $t1, -12($fp) + addu $t0, $t0, $t1 + # Save distance + lw $t1, 0($t0) + sw $t1, -28($fp) + # LOCAL local_trib__a__init_internal_6 --> -28($fp) + # LOCAL local_trib__a__init_internal_5 --> -24($fp) + # Update min if 8 < 9 + lw $t0, -28($fp) + lw $t1, -24($fp) + bgtu $t0, $t1, label_NEXT1_17 + # LOCAL local_trib__a__init_n_9 --> -40($fp) + # LOCAL local_trib__a__init_internal_1 --> -8($fp) + # local_trib__a__init_n_9 = local_trib__a__init_internal_1 + lw $t0, -8($fp) + sw $t0, -40($fp) + # LOCAL local_trib__a__init_internal_10 --> -44($fp) + # local_trib__a__init_internal_10 = ALLOCATE Razz + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Razz + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 40 bytes of memory + li $a0, 40 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Razz_start + sw $t0, 4($v0) + # Load type offset + li $t0, 32 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Bazz__attrib__h__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 12($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Bazz__attrib__g__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 16($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Bazz__attrib__i__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 20($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Foo__attrib__a__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 24($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Foo__attrib__b__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 28($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Razz__attrib__e__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 32($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Razz__attrib__f__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 36($t1) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -44($fp) + # LOCAL local_trib__a__init_internal_4 --> -20($fp) + # LOCAL local_trib__a__init_internal_10 --> -44($fp) + # local_trib__a__init_internal_4 = local_trib__a__init_internal_10 + lw $t0, -44($fp) + sw $t0, -20($fp) + # GOTO label_END_15 +j label_END_15 +label_NEXT1_17: + # local_trib__a__init_internal_6 = TYPE_DISTANCE Bar + # LOCAL local_trib__a__init_internal_6 --> -28($fp) + # LOCAL local_trib__a__init_internal_2 --> -12($fp) + # Load TDT pointer to type Bar + la $t0, Bar__TDT + lw $t1, -12($fp) + addu $t0, $t0, $t1 + # Save distance + lw $t1, 0($t0) + sw $t1, -28($fp) + # LOCAL local_trib__a__init_internal_6 --> -28($fp) + # LOCAL local_trib__a__init_internal_5 --> -24($fp) + # Update min if 8 < 9 + lw $t0, -28($fp) + lw $t1, -24($fp) + bgtu $t0, $t1, label_NEXT2_18 + # LOCAL local_trib__a__init_n_11 --> -48($fp) + # LOCAL local_trib__a__init_internal_1 --> -8($fp) + # local_trib__a__init_n_11 = local_trib__a__init_internal_1 + lw $t0, -8($fp) + sw $t0, -48($fp) + # LOCAL local_trib__a__init_internal_4 --> -20($fp) + # LOCAL local_trib__a__init_n_11 --> -48($fp) + # local_trib__a__init_internal_4 = local_trib__a__init_n_11 + lw $t0, -48($fp) + sw $t0, -20($fp) + # GOTO label_END_15 +j label_END_15 +label_NEXT2_18: + label_ERROR_14: + # LOCAL local_trib__a__init_internal_1 --> -8($fp) + lw $t0, 0($s1) + sw $t0, -8($fp) + # LOCAL local_trib__a__init_internal_1 --> -8($fp) + la $a0, data_1 + li $v0, 4 + syscall + lw $a0, -8($fp) + li $v0, 4 + syscall + la $a0, data_2 + li $v0, 4 + syscall + li $v0, 10 + syscall + label_END_15: +# RETURN local_trib__a__init_internal_4 +lw $v0, -20($fp) +# Deallocate stack frame for function __Foo__attrib__a__init. +# Restore $ra +lw $ra, 4($sp) +# Restore $fp +lw $fp, 0($sp) +# Restore Stack pointer $sp +addu $sp, $sp, 56 +jr $ra +# Function END + + +# __Foo__attrib__b__init implementation. +# @Params: +__Foo__attrib__b__init: + # Allocate stack frame for function __Foo__attrib__b__init. + subu $sp, $sp, 72 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 72 + # local_trib__b__init_internal_6 = GETATTRIBUTE a Foo + # LOCAL local_trib__b__init_internal_6 --> -28($fp) + lw $t0, 24($s1) + sw $t0, -28($fp) + # LOCAL local_trib__b__init_internal_4 --> -20($fp) + # LOCAL local_trib__b__init_internal_6 --> -28($fp) + # local_trib__b__init_internal_4 = local_trib__b__init_internal_6 + lw $t0, -28($fp) + sw $t0, -20($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_trib__b__init_internal_4 --> -20($fp) + # LOCAL local_trib__b__init_internal_5 --> -24($fp) + # local_trib__b__init_internal_5 = VCALL local_trib__b__init_internal_4 doh + # Save new self pointer in $s1 + lw $s1, -20($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 44($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -24($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # local_trib__b__init_internal_9 = GETATTRIBUTE g Foo + # LOCAL local_trib__b__init_internal_9 --> -40($fp) + lw $t0, 16($s1) + sw $t0, -40($fp) + # LOCAL local_trib__b__init_internal_7 --> -32($fp) + # LOCAL local_trib__b__init_internal_9 --> -40($fp) + # local_trib__b__init_internal_7 = local_trib__b__init_internal_9 + lw $t0, -40($fp) + sw $t0, -32($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_trib__b__init_internal_7 --> -32($fp) + # LOCAL local_trib__b__init_internal_8 --> -36($fp) + # local_trib__b__init_internal_8 = VCALL local_trib__b__init_internal_7 doh + # Save new self pointer in $s1 + lw $s1, -32($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 44($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -36($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_trib__b__init_internal_3 --> -16($fp) + # LOCAL local_trib__b__init_internal_5 --> -24($fp) + # LOCAL local_trib__b__init_internal_8 --> -36($fp) + # local_trib__b__init_internal_3 = local_trib__b__init_internal_5 + local_trib__b__init_internal_8 + lw $t1, -24($fp) + lw $t0, 12($t1) + lw $t1, -36($fp) + lw $t2, 12($t1) + add $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -16($fp) + # LOCAL local_trib__b__init_internal_12 --> -52($fp) + # local_trib__b__init_internal_12 = SELF + sw $s1, -52($fp) + # LOCAL local_trib__b__init_internal_10 --> -44($fp) + # LOCAL local_trib__b__init_internal_12 --> -52($fp) + # local_trib__b__init_internal_10 = local_trib__b__init_internal_12 + lw $t0, -52($fp) + sw $t0, -44($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_trib__b__init_internal_10 --> -44($fp) + # LOCAL local_trib__b__init_internal_11 --> -48($fp) + # local_trib__b__init_internal_11 = VCALL local_trib__b__init_internal_10 doh + # Save new self pointer in $s1 + lw $s1, -44($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 44($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -48($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_trib__b__init_internal_2 --> -12($fp) + # LOCAL local_trib__b__init_internal_3 --> -16($fp) + # LOCAL local_trib__b__init_internal_11 --> -48($fp) + # local_trib__b__init_internal_2 = local_trib__b__init_internal_3 + local_trib__b__init_internal_11 + lw $t1, -16($fp) + lw $t0, 12($t1) + lw $t1, -48($fp) + lw $t2, 12($t1) + add $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -12($fp) + # LOCAL local_trib__b__init_internal_15 --> -64($fp) + # local_trib__b__init_internal_15 = SELF + sw $s1, -64($fp) + # LOCAL local_trib__b__init_internal_13 --> -56($fp) + # LOCAL local_trib__b__init_internal_15 --> -64($fp) + # local_trib__b__init_internal_13 = local_trib__b__init_internal_15 + lw $t0, -64($fp) + sw $t0, -56($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_trib__b__init_internal_13 --> -56($fp) + # LOCAL local_trib__b__init_internal_14 --> -60($fp) + # local_trib__b__init_internal_14 = VCALL local_trib__b__init_internal_13 printh + # Save new self pointer in $s1 + lw $s1, -56($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 28($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -60($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_trib__b__init_internal_1 --> -8($fp) + # LOCAL local_trib__b__init_internal_2 --> -12($fp) + # LOCAL local_trib__b__init_internal_14 --> -60($fp) + # local_trib__b__init_internal_1 = local_trib__b__init_internal_2 + local_trib__b__init_internal_14 + lw $t1, -12($fp) + lw $t0, 12($t1) + lw $t1, -60($fp) + lw $t2, 12($t1) + add $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -8($fp) + # RETURN local_trib__b__init_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function __Foo__attrib__b__init. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 72 + jr $ra + # Function END + + +# function_doh_at_Foo implementation. +# @Params: +function_doh_at_Foo: + # Allocate stack frame for function function_doh_at_Foo. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_doh_at_Foo_i_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -4($fp) + # local_doh_at_Foo_internal_1 = GETATTRIBUTE h Foo + # LOCAL local_doh_at_Foo_internal_1 --> -8($fp) + lw $t0, 12($s1) + sw $t0, -8($fp) + # LOCAL local_doh_at_Foo_i_0 --> -4($fp) + # LOCAL local_doh_at_Foo_internal_1 --> -8($fp) + # local_doh_at_Foo_i_0 = local_doh_at_Foo_internal_1 + lw $t0, -8($fp) + sw $t0, -4($fp) + # local_doh_at_Foo_internal_3 = GETATTRIBUTE h Foo + # LOCAL local_doh_at_Foo_internal_3 --> -16($fp) + lw $t0, 12($s1) + sw $t0, -16($fp) + # LOCAL local_doh_at_Foo_internal_4 --> -20($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 2 + sw $t0, 12($v0) + sw $v0, -20($fp) + # LOCAL local_doh_at_Foo_internal_2 --> -12($fp) + # LOCAL local_doh_at_Foo_internal_3 --> -16($fp) + # LOCAL local_doh_at_Foo_internal_4 --> -20($fp) + # local_doh_at_Foo_internal_2 = local_doh_at_Foo_internal_3 + local_doh_at_Foo_internal_4 + lw $t1, -16($fp) + lw $t0, 12($t1) + lw $t1, -20($fp) + lw $t2, 12($t1) + add $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -12($fp) + # + # LOCAL local_doh_at_Foo_internal_2 --> -12($fp) + lw $t0, -12($fp) + sw $t0, 12($s1) + # RETURN local_doh_at_Foo_i_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_doh_at_Foo. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# __Razz__attrib__e__init implementation. +# @Params: +__Razz__attrib__e__init: + # Allocate stack frame for function __Razz__attrib__e__init. + subu $sp, $sp, 48 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 48 + # LOCAL local_ttrib__e__init_internal_1 --> -8($fp) + # local_ttrib__e__init_internal_1 = SELF + sw $s1, -8($fp) + # LOCAL local_ttrib__e__init_internal_1 --> -8($fp) + # LOCAL local_ttrib__e__init_internal_2 --> -12($fp) + # local_ttrib__e__init_internal_2 = TYPEOF local_ttrib__e__init_internal_1 + lw $t0, -8($fp) + # Load pointer to type offset + lw $t1, 8($t0) + sw $t1, -12($fp) + # LOCAL local_ttrib__e__init_internal_5 --> -24($fp) + # local_ttrib__e__init_internal_5 = 13 + li $t0, 13 + sw $t0, -24($fp) + # local_ttrib__e__init_internal_6 = TYPE_DISTANCE Razz + # LOCAL local_ttrib__e__init_internal_6 --> -28($fp) + # LOCAL local_ttrib__e__init_internal_2 --> -12($fp) + # Load TDT pointer to type Razz + la $t0, Razz__TDT + lw $t1, -12($fp) + addu $t0, $t0, $t1 + # Save distance + lw $t1, 0($t0) + sw $t1, -28($fp) + # LOCAL local_ttrib__e__init_internal_6 --> -28($fp) + # LOCAL local_ttrib__e__init_internal_5 --> -24($fp) + # Update min if 8 < 9 + lw $t0, -28($fp) + lw $t1, -24($fp) + bgtu $t0, $t1, label_Not_min0_19 + # LOCAL local_ttrib__e__init_internal_5 --> -24($fp) + # LOCAL local_ttrib__e__init_internal_6 --> -28($fp) + # local_ttrib__e__init_internal_5 = local_ttrib__e__init_internal_6 + lw $t0, -28($fp) + sw $t0, -24($fp) + label_Not_min0_19: + # local_ttrib__e__init_internal_6 = TYPE_DISTANCE Bar + # LOCAL local_ttrib__e__init_internal_6 --> -28($fp) + # LOCAL local_ttrib__e__init_internal_2 --> -12($fp) + # Load TDT pointer to type Bar + la $t0, Bar__TDT + lw $t1, -12($fp) + addu $t0, $t0, $t1 + # Save distance + lw $t1, 0($t0) + sw $t1, -28($fp) + # LOCAL local_ttrib__e__init_internal_6 --> -28($fp) + # LOCAL local_ttrib__e__init_internal_5 --> -24($fp) + # Update min if 8 < 9 + lw $t0, -28($fp) + lw $t1, -24($fp) + bgtu $t0, $t1, label_Not_min1_20 + # LOCAL local_ttrib__e__init_internal_5 --> -24($fp) + # LOCAL local_ttrib__e__init_internal_6 --> -28($fp) + # local_ttrib__e__init_internal_5 = local_ttrib__e__init_internal_6 + lw $t0, -28($fp) + sw $t0, -24($fp) + label_Not_min1_20: + # LOCAL local_ttrib__e__init_internal_6 --> -28($fp) + # local_ttrib__e__init_internal_6 = 13 + li $t0, 13 + sw $t0, -28($fp) + # LOCAL local_ttrib__e__init_internal_3 --> -16($fp) + # LOCAL local_ttrib__e__init_internal_6 --> -28($fp) + # LOCAL local_ttrib__e__init_internal_5 --> -24($fp) + # Load pointers and SUB + lw $a0, -28($fp) + lw $a1, -24($fp) + sub $a0, $a0, $a1 + sw $a0, -16($fp) + # IF_ZERO local_ttrib__e__init_internal_3 GOTO label_ERROR_21 + # IF_ZERO local_ttrib__e__init_internal_3 GOTO label_ERROR_21 + lw $t0, -16($fp) + beq $t0, 0, label_ERROR_21 + # local_ttrib__e__init_internal_6 = TYPE_DISTANCE Razz + # LOCAL local_ttrib__e__init_internal_6 --> -28($fp) + # LOCAL local_ttrib__e__init_internal_2 --> -12($fp) + # Load TDT pointer to type Razz + la $t0, Razz__TDT + lw $t1, -12($fp) + addu $t0, $t0, $t1 + # Save distance + lw $t1, 0($t0) + sw $t1, -28($fp) + # LOCAL local_ttrib__e__init_internal_6 --> -28($fp) + # LOCAL local_ttrib__e__init_internal_5 --> -24($fp) + # Update min if 8 < 9 + lw $t0, -28($fp) + lw $t1, -24($fp) + bgtu $t0, $t1, label_NEXT0_23 + # LOCAL local_ttrib__e__init_n_7 --> -32($fp) + # LOCAL local_ttrib__e__init_internal_1 --> -8($fp) + # local_ttrib__e__init_n_7 = local_ttrib__e__init_internal_1 + lw $t0, -8($fp) + sw $t0, -32($fp) + # LOCAL local_ttrib__e__init_internal_8 --> -36($fp) + # local_ttrib__e__init_internal_8 = ALLOCATE Bar + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bar + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 48 bytes of memory + li $a0, 48 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bar_start + sw $t0, 4($v0) + # Load type offset + li $t0, 36 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Bazz__attrib__h__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 12($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Bazz__attrib__g__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 16($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Bazz__attrib__i__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 20($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Foo__attrib__a__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 24($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Foo__attrib__b__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 28($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Razz__attrib__e__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 32($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Razz__attrib__f__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 36($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Bar__attrib__c__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 40($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Bar__attrib__d__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 44($t1) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -36($fp) + # LOCAL local_ttrib__e__init_internal_4 --> -20($fp) + # LOCAL local_ttrib__e__init_internal_8 --> -36($fp) + # local_ttrib__e__init_internal_4 = local_ttrib__e__init_internal_8 + lw $t0, -36($fp) + sw $t0, -20($fp) + # GOTO label_END_22 +j label_END_22 +label_NEXT0_23: + # local_ttrib__e__init_internal_6 = TYPE_DISTANCE Bar + # LOCAL local_ttrib__e__init_internal_6 --> -28($fp) + # LOCAL local_ttrib__e__init_internal_2 --> -12($fp) + # Load TDT pointer to type Bar + la $t0, Bar__TDT + lw $t1, -12($fp) + addu $t0, $t0, $t1 + # Save distance + lw $t1, 0($t0) + sw $t1, -28($fp) + # LOCAL local_ttrib__e__init_internal_6 --> -28($fp) + # LOCAL local_ttrib__e__init_internal_5 --> -24($fp) + # Update min if 8 < 9 + lw $t0, -28($fp) + lw $t1, -24($fp) + bgtu $t0, $t1, label_NEXT1_24 + # LOCAL local_ttrib__e__init_n_9 --> -40($fp) + # LOCAL local_ttrib__e__init_internal_1 --> -8($fp) + # local_ttrib__e__init_n_9 = local_ttrib__e__init_internal_1 + lw $t0, -8($fp) + sw $t0, -40($fp) + # LOCAL local_ttrib__e__init_internal_4 --> -20($fp) + # LOCAL local_ttrib__e__init_n_9 --> -40($fp) + # local_ttrib__e__init_internal_4 = local_ttrib__e__init_n_9 + lw $t0, -40($fp) + sw $t0, -20($fp) + # GOTO label_END_22 +j label_END_22 +label_NEXT1_24: + label_ERROR_21: + # LOCAL local_ttrib__e__init_internal_1 --> -8($fp) + lw $t0, 0($s1) + sw $t0, -8($fp) + # LOCAL local_ttrib__e__init_internal_1 --> -8($fp) + la $a0, data_1 + li $v0, 4 + syscall + lw $a0, -8($fp) + li $v0, 4 + syscall + la $a0, data_2 + li $v0, 4 + syscall + li $v0, 10 + syscall + label_END_22: +# RETURN local_ttrib__e__init_internal_4 +lw $v0, -20($fp) +# Deallocate stack frame for function __Razz__attrib__e__init. +# Restore $ra +lw $ra, 4($sp) +# Restore $fp +lw $fp, 0($sp) +# Restore Stack pointer $sp +addu $sp, $sp, 48 +jr $ra +# Function END + + +# __Razz__attrib__f__init implementation. +# @Params: +__Razz__attrib__f__init: + # Allocate stack frame for function __Razz__attrib__f__init. + subu $sp, $sp, 84 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 84 + # local_ttrib__f__init_internal_6 = GETATTRIBUTE a Razz + # LOCAL local_ttrib__f__init_internal_6 --> -28($fp) + lw $t0, 24($s1) + sw $t0, -28($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # local_ttrib__f__init_internal_5 = CALL doh + # LOCAL local_ttrib__f__init_internal_5 --> -24($fp) + # LOCAL local_ttrib__f__init_internal_6 --> -28($fp) + # Save new self pointer in $s1 + lw $s1, -28($fp) + # Get pointer to type's VTABLE + la $t0, Bazz_vtable + # Get pointer to function address + lw $t1, 44($t0) + # Call function. Result is on $v0 + jalr $t1 + sw $v0, -24($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # local_ttrib__f__init_internal_9 = GETATTRIBUTE g Razz + # LOCAL local_ttrib__f__init_internal_9 --> -40($fp) + lw $t0, 16($s1) + sw $t0, -40($fp) + # LOCAL local_ttrib__f__init_internal_7 --> -32($fp) + # LOCAL local_ttrib__f__init_internal_9 --> -40($fp) + # local_ttrib__f__init_internal_7 = local_ttrib__f__init_internal_9 + lw $t0, -40($fp) + sw $t0, -32($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_ttrib__f__init_internal_7 --> -32($fp) + # LOCAL local_ttrib__f__init_internal_8 --> -36($fp) + # local_ttrib__f__init_internal_8 = VCALL local_ttrib__f__init_internal_7 doh + # Save new self pointer in $s1 + lw $s1, -32($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 44($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -36($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_ttrib__f__init_internal_4 --> -20($fp) + # LOCAL local_ttrib__f__init_internal_5 --> -24($fp) + # LOCAL local_ttrib__f__init_internal_8 --> -36($fp) + # local_ttrib__f__init_internal_4 = local_ttrib__f__init_internal_5 + local_ttrib__f__init_internal_8 + lw $t1, -24($fp) + lw $t0, 12($t1) + lw $t1, -36($fp) + lw $t2, 12($t1) + add $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -20($fp) + # local_ttrib__f__init_internal_12 = GETATTRIBUTE e Razz + # LOCAL local_ttrib__f__init_internal_12 --> -52($fp) + lw $t0, 32($s1) + sw $t0, -52($fp) + # LOCAL local_ttrib__f__init_internal_10 --> -44($fp) + # LOCAL local_ttrib__f__init_internal_12 --> -52($fp) + # local_ttrib__f__init_internal_10 = local_ttrib__f__init_internal_12 + lw $t0, -52($fp) + sw $t0, -44($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_ttrib__f__init_internal_10 --> -44($fp) + # LOCAL local_ttrib__f__init_internal_11 --> -48($fp) + # local_ttrib__f__init_internal_11 = VCALL local_ttrib__f__init_internal_10 doh + # Save new self pointer in $s1 + lw $s1, -44($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 44($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -48($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_ttrib__f__init_internal_3 --> -16($fp) + # LOCAL local_ttrib__f__init_internal_4 --> -20($fp) + # LOCAL local_ttrib__f__init_internal_11 --> -48($fp) + # local_ttrib__f__init_internal_3 = local_ttrib__f__init_internal_4 + local_ttrib__f__init_internal_11 + lw $t1, -20($fp) + lw $t0, 12($t1) + lw $t1, -48($fp) + lw $t2, 12($t1) + add $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -16($fp) + # LOCAL local_ttrib__f__init_internal_15 --> -64($fp) + # local_ttrib__f__init_internal_15 = SELF + sw $s1, -64($fp) + # LOCAL local_ttrib__f__init_internal_13 --> -56($fp) + # LOCAL local_ttrib__f__init_internal_15 --> -64($fp) + # local_ttrib__f__init_internal_13 = local_ttrib__f__init_internal_15 + lw $t0, -64($fp) + sw $t0, -56($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_ttrib__f__init_internal_13 --> -56($fp) + # LOCAL local_ttrib__f__init_internal_14 --> -60($fp) + # local_ttrib__f__init_internal_14 = VCALL local_ttrib__f__init_internal_13 doh + # Save new self pointer in $s1 + lw $s1, -56($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 44($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -60($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_ttrib__f__init_internal_2 --> -12($fp) + # LOCAL local_ttrib__f__init_internal_3 --> -16($fp) + # LOCAL local_ttrib__f__init_internal_14 --> -60($fp) + # local_ttrib__f__init_internal_2 = local_ttrib__f__init_internal_3 + local_ttrib__f__init_internal_14 + lw $t1, -16($fp) + lw $t0, 12($t1) + lw $t1, -60($fp) + lw $t2, 12($t1) + add $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -12($fp) + # LOCAL local_ttrib__f__init_internal_18 --> -76($fp) + # local_ttrib__f__init_internal_18 = SELF + sw $s1, -76($fp) + # LOCAL local_ttrib__f__init_internal_16 --> -68($fp) + # LOCAL local_ttrib__f__init_internal_18 --> -76($fp) + # local_ttrib__f__init_internal_16 = local_ttrib__f__init_internal_18 + lw $t0, -76($fp) + sw $t0, -68($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_ttrib__f__init_internal_16 --> -68($fp) + # LOCAL local_ttrib__f__init_internal_17 --> -72($fp) + # local_ttrib__f__init_internal_17 = VCALL local_ttrib__f__init_internal_16 printh + # Save new self pointer in $s1 + lw $s1, -68($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 28($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -72($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_ttrib__f__init_internal_1 --> -8($fp) + # LOCAL local_ttrib__f__init_internal_2 --> -12($fp) + # LOCAL local_ttrib__f__init_internal_17 --> -72($fp) + # local_ttrib__f__init_internal_1 = local_ttrib__f__init_internal_2 + local_ttrib__f__init_internal_17 + lw $t1, -12($fp) + lw $t0, 12($t1) + lw $t1, -72($fp) + lw $t2, 12($t1) + add $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -8($fp) + # RETURN local_ttrib__f__init_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function __Razz__attrib__f__init. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 84 + jr $ra + # Function END + + +# __Bar__attrib__c__init implementation. +# @Params: +__Bar__attrib__c__init: + # Allocate stack frame for function __Bar__attrib__c__init. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_trib__c__init_internal_3 --> -16($fp) + # local_trib__c__init_internal_3 = SELF + sw $s1, -16($fp) + # LOCAL local_trib__c__init_internal_1 --> -8($fp) + # LOCAL local_trib__c__init_internal_3 --> -16($fp) + # local_trib__c__init_internal_1 = local_trib__c__init_internal_3 + lw $t0, -16($fp) + sw $t0, -8($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_trib__c__init_internal_1 --> -8($fp) + # LOCAL local_trib__c__init_internal_2 --> -12($fp) + # local_trib__c__init_internal_2 = VCALL local_trib__c__init_internal_1 doh + # Save new self pointer in $s1 + lw $s1, -8($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 44($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -12($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # RETURN local_trib__c__init_internal_2 + lw $v0, -12($fp) + # Deallocate stack frame for function __Bar__attrib__c__init. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# __Bar__attrib__d__init implementation. +# @Params: +__Bar__attrib__d__init: + # Allocate stack frame for function __Bar__attrib__d__init. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_trib__d__init_internal_3 --> -16($fp) + # local_trib__d__init_internal_3 = SELF + sw $s1, -16($fp) + # LOCAL local_trib__d__init_internal_1 --> -8($fp) + # LOCAL local_trib__d__init_internal_3 --> -16($fp) + # local_trib__d__init_internal_1 = local_trib__d__init_internal_3 + lw $t0, -16($fp) + sw $t0, -8($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_trib__d__init_internal_1 --> -8($fp) + # LOCAL local_trib__d__init_internal_2 --> -12($fp) + # local_trib__d__init_internal_2 = VCALL local_trib__d__init_internal_1 printh + # Save new self pointer in $s1 + lw $s1, -8($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 28($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -12($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # RETURN local_trib__d__init_internal_2 + lw $v0, -12($fp) + # Deallocate stack frame for function __Bar__attrib__d__init. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + diff --git a/tests/codegen/hello_world.mips b/tests/codegen/hello_world.mips new file mode 100644 index 00000000..245ffb19 --- /dev/null +++ b/tests/codegen/hello_world.mips @@ -0,0 +1,748 @@ + +# Code generated by PyCoolc. +# Eliane Puerta, Liset Alfaro, Adrian Gonzalez --- Mon Dec 14 11:08:37 2020 +# School of Math and Computer Science, University of Havana +# + +.data +dummy: .word 0 +IO: .asciiz "IO" +# Function END +Object: .asciiz "Object" +# Function END +String: .asciiz "String" +# Function END +Bool: .asciiz "Bool" +# Function END +Int: .asciiz "Int" +# Function END +Main: .asciiz "Main" +# Function END +# + + +# **** VTABLE for type IO **** +IO_vtable: .word function_in_string_at_IO, dummy, dummy, function_abort_at_Object, function_out_int_at_IO, function_copy_at_Object, function_type_name_at_Object, dummy, dummy, function_out_string_at_IO, function_in_int_at_IO +# Function END +# + + +# **** Type RECORD for type IO **** +IO_start: + IO_vtable_pointer: .word IO_vtable + # Function END +IO_end: +# + + +# **** VTABLE for type Object **** +Object_vtable: .word dummy, dummy, dummy, function_abort_at_Object, dummy, function_copy_at_Object, function_type_name_at_Object, dummy, dummy, dummy, dummy +# Function END +# + + +# **** Type RECORD for type Object **** +Object_start: + Object_vtable_pointer: .word Object_vtable + # Function END +Object_end: +# + + +# **** VTABLE for type String **** +String_vtable: .word dummy, function_length_at_String, dummy, function_abort_at_Object, dummy, function_copy_at_Object, function_type_name_at_Object, function_concat_at_String, function_substr_at_String, dummy, dummy +# Function END +# + + +# **** Type RECORD for type String **** +String_start: + String_vtable_pointer: .word String_vtable + # Function END +String_end: +# + + +# **** VTABLE for type Bool **** +Bool_vtable: .word dummy, dummy, dummy, function_abort_at_Object, dummy, function_copy_at_Object, function_type_name_at_Object, dummy, dummy, dummy, dummy +# Function END +# + + +# **** Type RECORD for type Bool **** +Bool_start: + Bool_vtable_pointer: .word Bool_vtable + # Function END +Bool_end: +# + + +# **** VTABLE for type Int **** +Int_vtable: .word dummy, dummy, dummy, function_abort_at_Object, dummy, function_copy_at_Object, function_type_name_at_Object, dummy, dummy, dummy, dummy +# Function END +# + + +# **** Type RECORD for type Int **** +Int_start: + Int_vtable_pointer: .word Int_vtable + # Function END +Int_end: +# + + +# **** VTABLE for type Main **** +Main_vtable: .word function_in_string_at_IO, dummy, function_main_at_Main, function_abort_at_Object, function_out_int_at_IO, function_copy_at_Object, function_type_name_at_Object, dummy, dummy, function_out_string_at_IO, function_in_int_at_IO +# Function END +# + + +# **** Type RECORD for type Main **** +Main_start: + Main_vtable_pointer: .word Main_vtable + # Function END +Main_end: +# + + +data_0: .asciiz "" +# + + +data_1: .asciiz "Abort called from class " +# + + +data_2: .asciiz "\n" +# + + +IO__TDT: .word 0, -1, -1, -1, -1, 1 +Object__TDT: .word 1, 0, 1, 1, 1, 2 +String__TDT: .word -1, -1, 0, -1, -1, -1 +Bool__TDT: .word -1, -1, -1, 0, -1, -1 +Int__TDT: .word -1, -1, -1, -1, 0, -1 +Main__TDT: .word -1, -1, -1, -1, -1, 0 +# + + +data_4: .asciiz "Hello, World.\n" +# + + +.text +main: + jal entry + # syscall code 10 is for exit + li $v0, 10 + syscall + # Function END + +# function_in_string_at_IO implementation. +# @Params: +function_in_string_at_IO: + # Allocate stack frame for function function_in_string_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_in_string_at_IO_internal_0 --> -4($fp) + # Allocating 1024 bytes of memory + li $a0, 1024 + li $v0, 9 + syscall + move $t0, $v0 + move $a0, $v0 + li $a1, 1024 + li $v0, 8 + syscall + move $t2, $zero + move $t3, $zero + move $t1, $t0 + lb $t3, 0($t1) + beqz $t3, end_loop + read_length_loop: + lb $t3, 0($t1) + beqz $t3, end_read_length_loop + addu $t1, $t1, 1 + addu $t2, $t2, 1 + j read_length_loop + end_read_length_loop: + subu $t1, $t1, 1 + sb $zero, 0($t1) + subu $t2, $t2, 1 + end_loop: + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $t2, 16($v0) + sw $v0, -4($fp) + # RETURN local_in_string_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_in_string_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_out_int_at_IO implementation. +# @Params: +# 0($fp) = param_out_int_at_IO_x_0 +function_out_int_at_IO: + # Allocate stack frame for function function_out_int_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # PRINT_INT param_out_int_at_IO_x_0 + # PARAM param_out_int_at_IO_x_0 --> 0($fp) + lw $v0, 0($fp) + lw $a0, 12($v0) + li $v0, 1 + syscall + # LOCAL local_out_int_at_IO_internal_0 --> -4($fp) + # local_out_int_at_IO_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_out_int_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_out_int_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_out_string_at_IO implementation. +# @Params: +# 0($fp) = param_out_string_at_IO_x_0 +function_out_string_at_IO: + # Allocate stack frame for function function_out_string_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # PARAM param_out_string_at_IO_x_0 --> 0($fp) + # PRINT_STR param_out_string_at_IO_x_0 + lw $v0, 0($fp) + lw $a0, 12($v0) + li $v0, 4 + syscall + # LOCAL local_out_string_at_IO_internal_0 --> -4($fp) + # local_out_string_at_IO_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_out_string_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_out_string_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_in_int_at_IO implementation. +# @Params: +function_in_int_at_IO: + # Allocate stack frame for function function_in_int_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_in_int_at_IO_internal_0 --> -4($fp) + # local_in_int_at_IO_internal_0 = READ_INT + li $v0, 5 + syscall + move $a2, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + sw $a2, 12($v0) + sw $v0, -4($fp) + # RETURN local_in_int_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_in_int_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_abort_at_Object implementation. +# @Params: +function_abort_at_Object: + # Allocate stack frame for function function_abort_at_Object. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_abort_at_Object_internal_0 --> -4($fp) + lw $t0, 0($s1) + sw $t0, -4($fp) + # LOCAL local_abort_at_Object_internal_0 --> -4($fp) + la $a0, data_1 + li $v0, 4 + syscall + lw $a0, -4($fp) + li $v0, 4 + syscall + la $a0, data_2 + li $v0, 4 + syscall + li $v0, 10 + syscall + # Function END + + +# function_copy_at_Object implementation. +# @Params: +function_copy_at_Object: + # Allocate stack frame for function function_copy_at_Object. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_copy_at_Object_internal_0 --> -4($fp) + # local_copy_at_Object_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_copy_at_Object_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function function_copy_at_Object. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_type_name_at_Object implementation. +# @Params: +function_type_name_at_Object: + # Allocate stack frame for function function_type_name_at_Object. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_type_name_at_Object_internal_0 --> -4($fp) + lw $t0, 0($s1) + sw $t0, -4($fp) + # RETURN local_type_name_at_Object_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_type_name_at_Object. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_concat_at_String implementation. +# @Params: +# 0($fp) = param_concat_at_String_s_0 +function_concat_at_String: + # Allocate stack frame for function function_concat_at_String. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_concat_at_String_internal_0 = self.CONCAT + # LOCAL local_concat_at_String_internal_0 --> -4($fp) + # PARAM param_concat_at_String_s_0 --> 0($fp) + # Get first string length from self + lw $t0, 16($s1) + # Get second string length from param + lw $v0, 0($fp) + lw $t1, 16($v0) + # Save new string length in a0 for memory allocation + addu $a0, $t0, $t1 + move $t3, $a0 + # Get first string from self + lw $t0, 12($s1) + # Get second string from param + lw $t1, 12($v0) + addu $a0, $a0, 4 + li $v0, 9 + syscall + move $t2, $v0 + move $t4, $zero + concat_loop1: + # Compare t0 with \0 + lb $t4, 0($t0) + beqz $t4, concat_loop1_end + # Copy 1 byte + sb $t4, 0($t2) + addu $t2, $t2, 1 + addu $t0, $t0, 1 + j concat_loop1 + concat_loop1_end: + # Copy second string + concat_loop2: + # Compare t1 with \0 + lb $t4, 0($t1) + beqz $t4, concat_loop2_end + # Copy 1 byte + sb $t4, 0($t2) + addu $t2, $t2, 1 + addu $t1, $t1, 1 + j concat_loop2 + concat_loop2_end: + sb $zero, 0($t2) + # v0 contains resulting string + move $t1, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + sw $t1, 12($v0) + sw $t3, 16($v0) + sw $v0, -4($fp) + # RETURN local_concat_at_String_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_concat_at_String. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_substr_at_String implementation. +# @Params: +# 0($fp) = param_substr_at_String_l_0 +# 4($fp) = param_substr_at_String_r_1 +function_substr_at_String: + # Allocate stack frame for function function_substr_at_String. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_substr_at_String_internal_0 --> -4($fp) + # PARAM param_substr_at_String_l_0 --> 4($fp) + # PARAM param_substr_at_String_r_1 --> 0($fp) + lw $t0, 12($s1) + lw $t2, 4($fp) + lw $t2, 12($t2) + addu $t0, $t0, $t2 + lw $a0, 0($fp) + lw $a0, 12($a0) + move $t3, $a0 + move $t1, $a0 + addu $a0, $a0, 1 + li $v0, 9 + syscall + move $t2, $v0 + substr_loop: + beqz $t1, substr_end + lb $a0, 0($t0) + sb $a0, 0($t2) + addu $t0, $t0, 1 + addu $t2, $t2, 1 + subu $t1, $t1, 1 + j substr_loop + substr_end: + sb $zero, 0($t2) + move $t1, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + sw $t1, 12($v0) + sw $t3, 16($v0) + sw $v0, -4($fp) + # RETURN local_substr_at_String_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_substr_at_String. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 8 + jr $ra + # Function END + + +# function_length_at_String implementation. +# @Params: +function_length_at_String: + # Allocate stack frame for function function_length_at_String. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_length_at_String_internal_0 = GETATTRIBUTE length String + # LOCAL local_length_at_String_internal_0 --> -4($fp) + lw $t0, 16($s1) + sw $t0, -4($fp) + # LOCAL local_length_at_String_internal_1 --> -8($fp) + # LOCAL local_length_at_String_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + lw $t0, -4($fp) + sw $t0, 12($v0) + sw $v0, -8($fp) + # RETURN local_length_at_String_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function function_length_at_String. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# entry implementation. +# @Params: +entry: + # Allocate stack frame for function entry. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local__internal_0 --> -4($fp) + # local__internal_0 = ALLOCATE Main + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Main + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 12 bytes of memory + li $a0, 12 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Main_start + sw $t0, 4($v0) + # Load type offset + li $t0, 20 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -4($fp) + # LOCAL local__internal_0 --> -4($fp) + lw $s1, -4($fp) + # local__internal_1 = CALL main + # LOCAL local__internal_1 --> -8($fp) + # LOCAL local__internal_0 --> -4($fp) + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type's VTABLE + la $t0, Main_vtable + # Get pointer to function address + lw $t1, 8($t0) + # Call function. Result is on $v0 + jalr $t1 + sw $v0, -8($fp) + # RETURN 0 + li $v0, 0 + # Deallocate stack frame for function entry. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_main_at_Main implementation. +# @Params: +function_main_at_Main: + # Allocate stack frame for function function_main_at_Main. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_main_at_Main_internal_2 --> -12($fp) + # local_main_at_Main_internal_2 = SELF + sw $s1, -12($fp) + # LOCAL local_main_at_Main_internal_0 --> -4($fp) + # LOCAL local_main_at_Main_internal_2 --> -12($fp) + # local_main_at_Main_internal_0 = local_main_at_Main_internal_2 + lw $t0, -12($fp) + sw $t0, -4($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_3 --> -16($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_4 + sw $t0, 12($v0) + li $t0, 14 + sw $t0, 16($v0) + sw $v0, -16($fp) + # ARG local_main_at_Main_internal_3 + # LOCAL local_main_at_Main_internal_3 --> -16($fp) + lw $t0, -16($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_main_at_Main_internal_0 --> -4($fp) + # LOCAL local_main_at_Main_internal_1 --> -8($fp) + # local_main_at_Main_internal_1 = VCALL local_main_at_Main_internal_0 out_string + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 36($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -8($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # RETURN local_main_at_Main_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function function_main_at_Main. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + diff --git a/tests/codegen/io.mips b/tests/codegen/io.mips new file mode 100644 index 00000000..576fa886 --- /dev/null +++ b/tests/codegen/io.mips @@ -0,0 +1,1453 @@ + +# Code generated by PyCoolc. +# Eliane Puerta, Liset Alfaro, Adrian Gonzalez --- Mon Dec 14 11:08:38 2020 +# School of Math and Computer Science, University of Havana +# + +.data +dummy: .word 0 +IO: .asciiz "IO" +# Function END +Object: .asciiz "Object" +# Function END +String: .asciiz "String" +# Function END +Bool: .asciiz "Bool" +# Function END +Int: .asciiz "Int" +# Function END +A: .asciiz "A" +# Function END +B: .asciiz "B" +# Function END +Main: .asciiz "Main" +# Function END +C: .asciiz "C" +# Function END +D: .asciiz "D" +# Function END +# + + +# **** VTABLE for type IO **** +IO_vtable: .word function_out_string_at_IO, dummy, dummy, dummy, dummy, function_in_string_at_IO, dummy, dummy, function_type_name_at_Object, dummy, function_abort_at_Object, function_in_int_at_IO, function_copy_at_Object, function_out_int_at_IO, dummy +# Function END +# + + +# **** Type RECORD for type IO **** +IO_start: + IO_vtable_pointer: .word IO_vtable + # Function END +IO_end: +# + + +# **** VTABLE for type Object **** +Object_vtable: .word dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, function_type_name_at_Object, dummy, function_abort_at_Object, dummy, function_copy_at_Object, dummy, dummy +# Function END +# + + +# **** Type RECORD for type Object **** +Object_start: + Object_vtable_pointer: .word Object_vtable + # Function END +Object_end: +# + + +# **** VTABLE for type String **** +String_vtable: .word dummy, function_length_at_String, dummy, dummy, dummy, dummy, function_concat_at_String, function_substr_at_String, function_type_name_at_Object, dummy, function_abort_at_Object, dummy, function_copy_at_Object, dummy, dummy +# Function END +# + + +# **** Type RECORD for type String **** +String_start: + String_vtable_pointer: .word String_vtable + # Function END +String_end: +# + + +# **** VTABLE for type Bool **** +Bool_vtable: .word dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, function_type_name_at_Object, dummy, function_abort_at_Object, dummy, function_copy_at_Object, dummy, dummy +# Function END +# + + +# **** Type RECORD for type Bool **** +Bool_start: + Bool_vtable_pointer: .word Bool_vtable + # Function END +Bool_end: +# + + +# **** VTABLE for type Int **** +Int_vtable: .word dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, function_type_name_at_Object, dummy, function_abort_at_Object, dummy, function_copy_at_Object, dummy, dummy +# Function END +# + + +# **** Type RECORD for type Int **** +Int_start: + Int_vtable_pointer: .word Int_vtable + # Function END +Int_end: +# + + +# **** VTABLE for type A **** +A_vtable: .word dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, function_type_name_at_Object, dummy, function_abort_at_Object, dummy, function_copy_at_Object, dummy, function_out_a_at_A +# Function END +# + + +# **** Type RECORD for type A **** +A_start: + A_vtable_pointer: .word A_vtable + # Function END +A_end: +# + + +# **** VTABLE for type B **** +B_vtable: .word dummy, dummy, dummy, dummy, function_out_b_at_B, dummy, dummy, dummy, function_type_name_at_Object, dummy, function_abort_at_Object, dummy, function_copy_at_Object, dummy, function_out_a_at_A +# Function END +# + + +# **** Type RECORD for type B **** +B_start: + B_vtable_pointer: .word B_vtable + # Function END +B_end: +# + + +# **** VTABLE for type Main **** +Main_vtable: .word function_out_string_at_IO, dummy, function_main_at_Main, dummy, dummy, function_in_string_at_IO, dummy, dummy, function_type_name_at_Object, dummy, function_abort_at_Object, function_in_int_at_IO, function_copy_at_Object, function_out_int_at_IO, dummy +# Function END +# + + +# **** Type RECORD for type Main **** +Main_start: + Main_vtable_pointer: .word Main_vtable + # Function END +Main_end: +# + + +# **** VTABLE for type C **** +C_vtable: .word function_out_string_at_IO, dummy, dummy, dummy, dummy, function_in_string_at_IO, dummy, dummy, function_type_name_at_Object, function_out_c_at_C, function_abort_at_Object, function_in_int_at_IO, function_copy_at_Object, function_out_int_at_IO, dummy +# Function END +# + + +# **** Type RECORD for type C **** +C_start: + C_vtable_pointer: .word C_vtable + # Function END +C_end: +# + + +# **** VTABLE for type D **** +D_vtable: .word function_out_string_at_IO, dummy, dummy, function_out_d_at_D, dummy, function_in_string_at_IO, dummy, dummy, function_type_name_at_Object, function_out_c_at_C, function_abort_at_Object, function_in_int_at_IO, function_copy_at_Object, function_out_int_at_IO, dummy +# Function END +# + + +# **** Type RECORD for type D **** +D_start: + D_vtable_pointer: .word D_vtable + # Function END +D_end: +# + + +data_0: .asciiz "" +# + + +data_1: .asciiz "Abort called from class " +# + + +data_2: .asciiz "\n" +# + + +IO__TDT: .word 0, -1, -1, -1, -1, -1, -1, 1, 1, 2 +Object__TDT: .word 1, 0, 1, 1, 1, 1, 2, 2, 2, 3 +String__TDT: .word -1, -1, 0, -1, -1, -1, -1, -1, -1, -1 +Bool__TDT: .word -1, -1, -1, 0, -1, -1, -1, -1, -1, -1 +Int__TDT: .word -1, -1, -1, -1, 0, -1, -1, -1, -1, -1 +A__TDT: .word -1, -1, -1, -1, -1, 0, 1, -1, -1, -1 +B__TDT: .word -1, -1, -1, -1, -1, -1, 0, -1, -1, -1 +Main__TDT: .word -1, -1, -1, -1, -1, -1, -1, 0, -1, -1 +C__TDT: .word -1, -1, -1, -1, -1, -1, -1, -1, 0, 1 +D__TDT: .word -1, -1, -1, -1, -1, -1, -1, -1, -1, 0 +# + + +data_4: .asciiz "A: Hello world\n" +# + + +data_5: .asciiz "B: Hello world\n" +# + + +data_6: .asciiz "Done.\n" +# + + +data_7: .asciiz "C: Hello world\n" +# + + +data_8: .asciiz "D: Hello world\n" +# + + +.text +main: + jal entry + # syscall code 10 is for exit + li $v0, 10 + syscall + # Function END + +# function_in_string_at_IO implementation. +# @Params: +function_in_string_at_IO: + # Allocate stack frame for function function_in_string_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_in_string_at_IO_internal_0 --> -4($fp) + # Allocating 1024 bytes of memory + li $a0, 1024 + li $v0, 9 + syscall + move $t0, $v0 + move $a0, $v0 + li $a1, 1024 + li $v0, 8 + syscall + move $t2, $zero + move $t3, $zero + move $t1, $t0 + lb $t3, 0($t1) + beqz $t3, end_loop + read_length_loop: + lb $t3, 0($t1) + beqz $t3, end_read_length_loop + addu $t1, $t1, 1 + addu $t2, $t2, 1 + j read_length_loop + end_read_length_loop: + subu $t1, $t1, 1 + sb $zero, 0($t1) + subu $t2, $t2, 1 + end_loop: + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $t2, 16($v0) + sw $v0, -4($fp) + # RETURN local_in_string_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_in_string_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_out_int_at_IO implementation. +# @Params: +# 0($fp) = param_out_int_at_IO_x_0 +function_out_int_at_IO: + # Allocate stack frame for function function_out_int_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # PRINT_INT param_out_int_at_IO_x_0 + # PARAM param_out_int_at_IO_x_0 --> 0($fp) + lw $v0, 0($fp) + lw $a0, 12($v0) + li $v0, 1 + syscall + # LOCAL local_out_int_at_IO_internal_0 --> -4($fp) + # local_out_int_at_IO_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_out_int_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_out_int_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_out_string_at_IO implementation. +# @Params: +# 0($fp) = param_out_string_at_IO_x_0 +function_out_string_at_IO: + # Allocate stack frame for function function_out_string_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # PARAM param_out_string_at_IO_x_0 --> 0($fp) + # PRINT_STR param_out_string_at_IO_x_0 + lw $v0, 0($fp) + lw $a0, 12($v0) + li $v0, 4 + syscall + # LOCAL local_out_string_at_IO_internal_0 --> -4($fp) + # local_out_string_at_IO_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_out_string_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_out_string_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_in_int_at_IO implementation. +# @Params: +function_in_int_at_IO: + # Allocate stack frame for function function_in_int_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_in_int_at_IO_internal_0 --> -4($fp) + # local_in_int_at_IO_internal_0 = READ_INT + li $v0, 5 + syscall + move $a2, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + sw $a2, 12($v0) + sw $v0, -4($fp) + # RETURN local_in_int_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_in_int_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_abort_at_Object implementation. +# @Params: +function_abort_at_Object: + # Allocate stack frame for function function_abort_at_Object. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_abort_at_Object_internal_0 --> -4($fp) + lw $t0, 0($s1) + sw $t0, -4($fp) + # LOCAL local_abort_at_Object_internal_0 --> -4($fp) + la $a0, data_1 + li $v0, 4 + syscall + lw $a0, -4($fp) + li $v0, 4 + syscall + la $a0, data_2 + li $v0, 4 + syscall + li $v0, 10 + syscall + # Function END + + +# function_copy_at_Object implementation. +# @Params: +function_copy_at_Object: + # Allocate stack frame for function function_copy_at_Object. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_copy_at_Object_internal_0 --> -4($fp) + # local_copy_at_Object_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_copy_at_Object_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function function_copy_at_Object. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_type_name_at_Object implementation. +# @Params: +function_type_name_at_Object: + # Allocate stack frame for function function_type_name_at_Object. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_type_name_at_Object_internal_0 --> -4($fp) + lw $t0, 0($s1) + sw $t0, -4($fp) + # RETURN local_type_name_at_Object_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_type_name_at_Object. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_concat_at_String implementation. +# @Params: +# 0($fp) = param_concat_at_String_s_0 +function_concat_at_String: + # Allocate stack frame for function function_concat_at_String. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_concat_at_String_internal_0 = self.CONCAT + # LOCAL local_concat_at_String_internal_0 --> -4($fp) + # PARAM param_concat_at_String_s_0 --> 0($fp) + # Get first string length from self + lw $t0, 16($s1) + # Get second string length from param + lw $v0, 0($fp) + lw $t1, 16($v0) + # Save new string length in a0 for memory allocation + addu $a0, $t0, $t1 + move $t3, $a0 + # Get first string from self + lw $t0, 12($s1) + # Get second string from param + lw $t1, 12($v0) + addu $a0, $a0, 4 + li $v0, 9 + syscall + move $t2, $v0 + move $t4, $zero + concat_loop1: + # Compare t0 with \0 + lb $t4, 0($t0) + beqz $t4, concat_loop1_end + # Copy 1 byte + sb $t4, 0($t2) + addu $t2, $t2, 1 + addu $t0, $t0, 1 + j concat_loop1 + concat_loop1_end: + # Copy second string + concat_loop2: + # Compare t1 with \0 + lb $t4, 0($t1) + beqz $t4, concat_loop2_end + # Copy 1 byte + sb $t4, 0($t2) + addu $t2, $t2, 1 + addu $t1, $t1, 1 + j concat_loop2 + concat_loop2_end: + sb $zero, 0($t2) + # v0 contains resulting string + move $t1, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + sw $t1, 12($v0) + sw $t3, 16($v0) + sw $v0, -4($fp) + # RETURN local_concat_at_String_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_concat_at_String. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_substr_at_String implementation. +# @Params: +# 0($fp) = param_substr_at_String_l_0 +# 4($fp) = param_substr_at_String_r_1 +function_substr_at_String: + # Allocate stack frame for function function_substr_at_String. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_substr_at_String_internal_0 --> -4($fp) + # PARAM param_substr_at_String_l_0 --> 4($fp) + # PARAM param_substr_at_String_r_1 --> 0($fp) + lw $t0, 12($s1) + lw $t2, 4($fp) + lw $t2, 12($t2) + addu $t0, $t0, $t2 + lw $a0, 0($fp) + lw $a0, 12($a0) + move $t3, $a0 + move $t1, $a0 + addu $a0, $a0, 1 + li $v0, 9 + syscall + move $t2, $v0 + substr_loop: + beqz $t1, substr_end + lb $a0, 0($t0) + sb $a0, 0($t2) + addu $t0, $t0, 1 + addu $t2, $t2, 1 + subu $t1, $t1, 1 + j substr_loop + substr_end: + sb $zero, 0($t2) + move $t1, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + sw $t1, 12($v0) + sw $t3, 16($v0) + sw $v0, -4($fp) + # RETURN local_substr_at_String_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_substr_at_String. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 8 + jr $ra + # Function END + + +# function_length_at_String implementation. +# @Params: +function_length_at_String: + # Allocate stack frame for function function_length_at_String. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_length_at_String_internal_0 = GETATTRIBUTE length String + # LOCAL local_length_at_String_internal_0 --> -4($fp) + lw $t0, 16($s1) + sw $t0, -4($fp) + # LOCAL local_length_at_String_internal_1 --> -8($fp) + # LOCAL local_length_at_String_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + lw $t0, -4($fp) + sw $t0, 12($v0) + sw $v0, -8($fp) + # RETURN local_length_at_String_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function function_length_at_String. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# entry implementation. +# @Params: +entry: + # Allocate stack frame for function entry. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local__internal_0 --> -4($fp) + # local__internal_0 = ALLOCATE Main + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Main + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 12 bytes of memory + li $a0, 12 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Main_start + sw $t0, 4($v0) + # Load type offset + li $t0, 28 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -4($fp) + # LOCAL local__internal_0 --> -4($fp) + lw $s1, -4($fp) + # local__internal_1 = CALL main + # LOCAL local__internal_1 --> -8($fp) + # LOCAL local__internal_0 --> -4($fp) + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type's VTABLE + la $t0, Main_vtable + # Get pointer to function address + lw $t1, 8($t0) + # Call function. Result is on $v0 + jalr $t1 + sw $v0, -8($fp) + # RETURN 0 + li $v0, 0 + # Deallocate stack frame for function entry. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# __A__attrib__io__init implementation. +# @Params: +__A__attrib__io__init: + # Allocate stack frame for function __A__attrib__io__init. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_ib__io__init_internal_1 --> -8($fp) + # local_ib__io__init_internal_1 = ALLOCATE IO + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, IO + sw $t0, 12($v0) + li $t0, 2 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 12 bytes of memory + li $a0, 12 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, IO_start + sw $t0, 4($v0) + # Load type offset + li $t0, 0 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -8($fp) + # RETURN local_ib__io__init_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function __A__attrib__io__init. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_out_a_at_A implementation. +# @Params: +function_out_a_at_A: + # Allocate stack frame for function function_out_a_at_A. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_out_a_at_A_internal_2 = GETATTRIBUTE io A + # LOCAL local_out_a_at_A_internal_2 --> -12($fp) + lw $t0, 12($s1) + sw $t0, -12($fp) + # LOCAL local_out_a_at_A_internal_0 --> -4($fp) + # LOCAL local_out_a_at_A_internal_2 --> -12($fp) + # local_out_a_at_A_internal_0 = local_out_a_at_A_internal_2 + lw $t0, -12($fp) + sw $t0, -4($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_out_a_at_A_internal_3 --> -16($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_4 + sw $t0, 12($v0) + li $t0, 15 + sw $t0, 16($v0) + sw $v0, -16($fp) + # ARG local_out_a_at_A_internal_3 + # LOCAL local_out_a_at_A_internal_3 --> -16($fp) + lw $t0, -16($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_out_a_at_A_internal_0 --> -4($fp) + # LOCAL local_out_a_at_A_internal_1 --> -8($fp) + # local_out_a_at_A_internal_1 = VCALL local_out_a_at_A_internal_0 out_string + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 0($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -8($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # RETURN local_out_a_at_A_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function function_out_a_at_A. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_out_b_at_B implementation. +# @Params: +function_out_b_at_B: + # Allocate stack frame for function function_out_b_at_B. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_out_b_at_B_internal_2 = GETATTRIBUTE io B + # LOCAL local_out_b_at_B_internal_2 --> -12($fp) + lw $t0, 12($s1) + sw $t0, -12($fp) + # LOCAL local_out_b_at_B_internal_0 --> -4($fp) + # LOCAL local_out_b_at_B_internal_2 --> -12($fp) + # local_out_b_at_B_internal_0 = local_out_b_at_B_internal_2 + lw $t0, -12($fp) + sw $t0, -4($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_out_b_at_B_internal_3 --> -16($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_5 + sw $t0, 12($v0) + li $t0, 15 + sw $t0, 16($v0) + sw $v0, -16($fp) + # ARG local_out_b_at_B_internal_3 + # LOCAL local_out_b_at_B_internal_3 --> -16($fp) + lw $t0, -16($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_out_b_at_B_internal_0 --> -4($fp) + # LOCAL local_out_b_at_B_internal_1 --> -8($fp) + # local_out_b_at_B_internal_1 = VCALL local_out_b_at_B_internal_0 out_string + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 0($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -8($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # RETURN local_out_b_at_B_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function function_out_b_at_B. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_main_at_Main implementation. +# @Params: +function_main_at_Main: + # Allocate stack frame for function function_main_at_Main. + subu $sp, $sp, 72 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 72 + # LOCAL local_main_at_Main_internal_2 --> -12($fp) + # local_main_at_Main_internal_2 = ALLOCATE A + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, A + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, A_start + sw $t0, 4($v0) + # Load type offset + li $t0, 20 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __A__attrib__io__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 12($t1) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -12($fp) + # LOCAL local_main_at_Main_internal_0 --> -4($fp) + # LOCAL local_main_at_Main_internal_2 --> -12($fp) + # local_main_at_Main_internal_0 = local_main_at_Main_internal_2 + lw $t0, -12($fp) + sw $t0, -4($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_0 --> -4($fp) + # LOCAL local_main_at_Main_internal_1 --> -8($fp) + # local_main_at_Main_internal_1 = VCALL local_main_at_Main_internal_0 out_a + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 56($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -8($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_main_at_Main_internal_5 --> -24($fp) + # local_main_at_Main_internal_5 = ALLOCATE B + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, B + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, B_start + sw $t0, 4($v0) + # Load type offset + li $t0, 24 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __A__attrib__io__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 12($t1) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -24($fp) + # LOCAL local_main_at_Main_internal_3 --> -16($fp) + # LOCAL local_main_at_Main_internal_5 --> -24($fp) + # local_main_at_Main_internal_3 = local_main_at_Main_internal_5 + lw $t0, -24($fp) + sw $t0, -16($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_3 --> -16($fp) + # LOCAL local_main_at_Main_internal_4 --> -20($fp) + # local_main_at_Main_internal_4 = VCALL local_main_at_Main_internal_3 out_b + # Save new self pointer in $s1 + lw $s1, -16($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 16($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -20($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_main_at_Main_internal_8 --> -36($fp) + # local_main_at_Main_internal_8 = ALLOCATE C + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, C + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 12 bytes of memory + li $a0, 12 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, C_start + sw $t0, 4($v0) + # Load type offset + li $t0, 32 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -36($fp) + # LOCAL local_main_at_Main_internal_6 --> -28($fp) + # LOCAL local_main_at_Main_internal_8 --> -36($fp) + # local_main_at_Main_internal_6 = local_main_at_Main_internal_8 + lw $t0, -36($fp) + sw $t0, -28($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_6 --> -28($fp) + # LOCAL local_main_at_Main_internal_7 --> -32($fp) + # local_main_at_Main_internal_7 = VCALL local_main_at_Main_internal_6 out_c + # Save new self pointer in $s1 + lw $s1, -28($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 36($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -32($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_main_at_Main_internal_11 --> -48($fp) + # local_main_at_Main_internal_11 = ALLOCATE D + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, D + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 12 bytes of memory + li $a0, 12 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, D_start + sw $t0, 4($v0) + # Load type offset + li $t0, 36 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -48($fp) + # LOCAL local_main_at_Main_internal_9 --> -40($fp) + # LOCAL local_main_at_Main_internal_11 --> -48($fp) + # local_main_at_Main_internal_9 = local_main_at_Main_internal_11 + lw $t0, -48($fp) + sw $t0, -40($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_9 --> -40($fp) + # LOCAL local_main_at_Main_internal_10 --> -44($fp) + # local_main_at_Main_internal_10 = VCALL local_main_at_Main_internal_9 out_d + # Save new self pointer in $s1 + lw $s1, -40($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 12($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -44($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_main_at_Main_internal_14 --> -60($fp) + # local_main_at_Main_internal_14 = SELF + sw $s1, -60($fp) + # LOCAL local_main_at_Main_internal_12 --> -52($fp) + # LOCAL local_main_at_Main_internal_14 --> -60($fp) + # local_main_at_Main_internal_12 = local_main_at_Main_internal_14 + lw $t0, -60($fp) + sw $t0, -52($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_15 --> -64($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_6 + sw $t0, 12($v0) + li $t0, 6 + sw $t0, 16($v0) + sw $v0, -64($fp) + # ARG local_main_at_Main_internal_15 + # LOCAL local_main_at_Main_internal_15 --> -64($fp) + lw $t0, -64($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_main_at_Main_internal_12 --> -52($fp) + # LOCAL local_main_at_Main_internal_13 --> -56($fp) + # local_main_at_Main_internal_13 = VCALL local_main_at_Main_internal_12 out_string + # Save new self pointer in $s1 + lw $s1, -52($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 0($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -56($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # RETURN local_main_at_Main_internal_13 + lw $v0, -56($fp) + # Deallocate stack frame for function function_main_at_Main. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 72 + jr $ra + # Function END + + +# function_out_c_at_C implementation. +# @Params: +function_out_c_at_C: + # Allocate stack frame for function function_out_c_at_C. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_out_c_at_C_internal_2 --> -12($fp) + # local_out_c_at_C_internal_2 = SELF + sw $s1, -12($fp) + # LOCAL local_out_c_at_C_internal_0 --> -4($fp) + # LOCAL local_out_c_at_C_internal_2 --> -12($fp) + # local_out_c_at_C_internal_0 = local_out_c_at_C_internal_2 + lw $t0, -12($fp) + sw $t0, -4($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_out_c_at_C_internal_3 --> -16($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_7 + sw $t0, 12($v0) + li $t0, 15 + sw $t0, 16($v0) + sw $v0, -16($fp) + # ARG local_out_c_at_C_internal_3 + # LOCAL local_out_c_at_C_internal_3 --> -16($fp) + lw $t0, -16($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_out_c_at_C_internal_0 --> -4($fp) + # LOCAL local_out_c_at_C_internal_1 --> -8($fp) + # local_out_c_at_C_internal_1 = VCALL local_out_c_at_C_internal_0 out_string + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 0($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -8($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # RETURN local_out_c_at_C_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function function_out_c_at_C. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_out_d_at_D implementation. +# @Params: +function_out_d_at_D: + # Allocate stack frame for function function_out_d_at_D. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_out_d_at_D_internal_2 --> -12($fp) + # local_out_d_at_D_internal_2 = SELF + sw $s1, -12($fp) + # LOCAL local_out_d_at_D_internal_0 --> -4($fp) + # LOCAL local_out_d_at_D_internal_2 --> -12($fp) + # local_out_d_at_D_internal_0 = local_out_d_at_D_internal_2 + lw $t0, -12($fp) + sw $t0, -4($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_out_d_at_D_internal_3 --> -16($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_8 + sw $t0, 12($v0) + li $t0, 15 + sw $t0, 16($v0) + sw $v0, -16($fp) + # ARG local_out_d_at_D_internal_3 + # LOCAL local_out_d_at_D_internal_3 --> -16($fp) + lw $t0, -16($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_out_d_at_D_internal_0 --> -4($fp) + # LOCAL local_out_d_at_D_internal_1 --> -8($fp) + # local_out_d_at_D_internal_1 = VCALL local_out_d_at_D_internal_0 out_string + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 0($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -8($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # RETURN local_out_d_at_D_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function function_out_d_at_D. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + diff --git a/tests/codegen/life.mips b/tests/codegen/life.mips new file mode 100644 index 00000000..1e2df77b --- /dev/null +++ b/tests/codegen/life.mips @@ -0,0 +1,21981 @@ + +# Code generated by PyCoolc. +# Eliane Puerta, Liset Alfaro, Adrian Gonzalez --- Mon Dec 14 11:08:40 2020 +# School of Math and Computer Science, University of Havana +# + +.data +dummy: .word 0 +IO: .asciiz "IO" +# Function END +Object: .asciiz "Object" +# Function END +String: .asciiz "String" +# Function END +Bool: .asciiz "Bool" +# Function END +Int: .asciiz "Int" +# Function END +Board: .asciiz "Board" +# Function END +CellularAutomaton: .asciiz "CellularAutomaton" +# Function END +Main: .asciiz "Main" +# Function END +# + + +# **** VTABLE for type IO **** +IO_vtable: .word function_in_int_at_IO, dummy, dummy, dummy, function_in_string_at_IO, dummy, dummy, dummy, dummy, function_out_int_at_IO, dummy, dummy, dummy, dummy, function_copy_at_Object, dummy, dummy, dummy, dummy, dummy, dummy, function_abort_at_Object, dummy, function_out_string_at_IO, dummy, dummy, dummy, dummy, dummy, function_type_name_at_Object, dummy +# Function END +# + + +# **** Type RECORD for type IO **** +IO_start: + IO_vtable_pointer: .word IO_vtable + # Function END +IO_end: +# + + +# **** VTABLE for type Object **** +Object_vtable: .word dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, function_copy_at_Object, dummy, dummy, dummy, dummy, dummy, dummy, function_abort_at_Object, dummy, dummy, dummy, dummy, dummy, dummy, dummy, function_type_name_at_Object, dummy +# Function END +# + + +# **** Type RECORD for type Object **** +Object_start: + Object_vtable_pointer: .word Object_vtable + # Function END +Object_end: +# + + +# **** VTABLE for type String **** +String_vtable: .word dummy, dummy, dummy, dummy, dummy, function_substr_at_String, dummy, dummy, dummy, dummy, function_length_at_String, function_concat_at_String, dummy, dummy, function_copy_at_Object, dummy, dummy, dummy, dummy, dummy, dummy, function_abort_at_Object, dummy, dummy, dummy, dummy, dummy, dummy, dummy, function_type_name_at_Object, dummy +# Function END +# + + +# **** Type RECORD for type String **** +String_start: + String_vtable_pointer: .word String_vtable + # Function END +String_end: +# + + +# **** VTABLE for type Bool **** +Bool_vtable: .word dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, function_copy_at_Object, dummy, dummy, dummy, dummy, dummy, dummy, function_abort_at_Object, dummy, dummy, dummy, dummy, dummy, dummy, dummy, function_type_name_at_Object, dummy +# Function END +# + + +# **** Type RECORD for type Bool **** +Bool_start: + Bool_vtable_pointer: .word Bool_vtable + # Function END +Bool_end: +# + + +# **** VTABLE for type Int **** +Int_vtable: .word dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, function_copy_at_Object, dummy, dummy, dummy, dummy, dummy, dummy, function_abort_at_Object, dummy, dummy, dummy, dummy, dummy, dummy, dummy, function_type_name_at_Object, dummy +# Function END +# + + +# **** Type RECORD for type Int **** +Int_start: + Int_vtable_pointer: .word Int_vtable + # Function END +Int_end: +# + + +# **** VTABLE for type Board **** +Board_vtable: .word function_in_int_at_IO, function_board_init_at_Board, dummy, dummy, function_in_string_at_IO, dummy, dummy, function_size_of_board_at_Board, dummy, function_out_int_at_IO, dummy, dummy, dummy, dummy, function_copy_at_Object, dummy, dummy, dummy, dummy, dummy, dummy, function_abort_at_Object, dummy, function_out_string_at_IO, dummy, dummy, dummy, dummy, dummy, function_type_name_at_Object, dummy +# Function END +# + + +# **** Type RECORD for type Board **** +Board_start: + Board_vtable_pointer: .word Board_vtable + # Function END +Board_end: +# + + +# **** VTABLE for type CellularAutomaton **** +CellularAutomaton_vtable: .word function_in_int_at_IO, function_board_init_at_Board, function_southwest_at_CellularAutomaton, function_cell_at_next_evolution_at_CellularAutomaton, function_in_string_at_IO, dummy, function_prompt_at_CellularAutomaton, function_size_of_board_at_Board, function_west_at_CellularAutomaton, function_out_int_at_IO, dummy, dummy, function_southeast_at_CellularAutomaton, function_northeast_at_CellularAutomaton, function_copy_at_Object, function_num_cells_at_CellularAutomaton, function_northwest_at_CellularAutomaton, function_init_at_CellularAutomaton, function_south_at_CellularAutomaton, function_east_at_CellularAutomaton, function_print_at_CellularAutomaton, function_abort_at_Object, function_north_at_CellularAutomaton, function_out_string_at_IO, function_option_at_CellularAutomaton, function_cell_at_CellularAutomaton, function_neighbors_at_CellularAutomaton, function_prompt2_at_CellularAutomaton, dummy, function_type_name_at_Object, function_evolve_at_CellularAutomaton +# Function END +# + + +# **** Type RECORD for type CellularAutomaton **** +CellularAutomaton_start: + CellularAutomaton_vtable_pointer: .word CellularAutomaton_vtable + # Function END +CellularAutomaton_end: +# + + +# **** VTABLE for type Main **** +Main_vtable: .word function_in_int_at_IO, function_board_init_at_Board, function_southwest_at_CellularAutomaton, function_cell_at_next_evolution_at_CellularAutomaton, function_in_string_at_IO, dummy, function_prompt_at_CellularAutomaton, function_size_of_board_at_Board, function_west_at_CellularAutomaton, function_out_int_at_IO, dummy, dummy, function_southeast_at_CellularAutomaton, function_northeast_at_CellularAutomaton, function_copy_at_Object, function_num_cells_at_CellularAutomaton, function_northwest_at_CellularAutomaton, function_init_at_CellularAutomaton, function_south_at_CellularAutomaton, function_east_at_CellularAutomaton, function_print_at_CellularAutomaton, function_abort_at_Object, function_north_at_CellularAutomaton, function_out_string_at_IO, function_option_at_CellularAutomaton, function_cell_at_CellularAutomaton, function_neighbors_at_CellularAutomaton, function_prompt2_at_CellularAutomaton, function_main_at_Main, function_type_name_at_Object, function_evolve_at_CellularAutomaton +# Function END +# + + +# **** Type RECORD for type Main **** +Main_start: + Main_vtable_pointer: .word Main_vtable + # Function END +Main_end: +# + + +data_0: .asciiz "" +# + + +data_1: .asciiz "Abort called from class " +# + + +data_2: .asciiz "\n" +# + + +IO__TDT: .word 0, -1, -1, -1, -1, 1, 2, 3 +Object__TDT: .word 1, 0, 1, 1, 1, 2, 3, 4 +String__TDT: .word -1, -1, 0, -1, -1, -1, -1, -1 +Bool__TDT: .word -1, -1, -1, 0, -1, -1, -1, -1 +Int__TDT: .word -1, -1, -1, -1, 0, -1, -1, -1 +Board__TDT: .word -1, -1, -1, -1, -1, 0, 1, 2 +CellularAutomaton__TDT: .word -1, -1, -1, -1, -1, -1, 0, 1 +Main__TDT: .word -1, -1, -1, -1, -1, -1, -1, 0 +# + + +data_4: .asciiz "\n" +# + + +data_5: .asciiz "\n" +# + + +data_6: .asciiz "\n" +# + + +data_7: .asciiz " " +# + + +data_8: .asciiz " " +# + + +data_9: .asciiz " " +# + + +data_10: .asciiz " " +# + + +data_11: .asciiz " " +# + + +data_12: .asciiz " " +# + + +data_13: .asciiz " " +# + + +data_14: .asciiz " " +# + + +data_15: .asciiz " " +# + + +data_16: .asciiz " " +# + + +data_17: .asciiz " " +# + + +data_18: .asciiz " " +# + + +data_19: .asciiz " " +# + + +data_20: .asciiz " " +# + + +data_21: .asciiz "X" +# + + +data_22: .asciiz "X" +# + + +data_23: .asciiz "X" +# + + +data_24: .asciiz "X" +# + + +data_25: .asciiz "X" +# + + +data_26: .asciiz "X" +# + + +data_27: .asciiz "X" +# + + +data_28: .asciiz "X" +# + + +data_29: .asciiz "X" +# + + +data_30: .asciiz "X" +# + + +data_31: .asciiz "X" +# + + +data_32: .asciiz "-" +# + + +data_33: .asciiz "-" +# + + +data_34: .asciiz "\nPlease chose a number:\n" +# + + +data_35: .asciiz "\t1: A cross\n" +# + + +data_36: .asciiz "\t2: A slash from the upper left to lower right\n" +# + + +data_37: .asciiz "\t3: A slash from the upper right to lower left\n" +# + + +data_38: .asciiz "\t4: An X\n" +# + + +data_39: .asciiz "\t5: A greater than sign \n" +# + + +data_40: .asciiz "\t6: A less than sign\n" +# + + +data_41: .asciiz "\t7: Two greater than signs\n" +# + + +data_42: .asciiz "\t8: Two less than signs\n" +# + + +data_43: .asciiz "\t9: A 'V'\n" +# + + +data_44: .asciiz "\t10: An inverse 'V'\n" +# + + +data_45: .asciiz "\t11: Numbers 9 and 10 combined\n" +# + + +data_46: .asciiz "\t12: A full grid\n" +# + + +data_47: .asciiz "\t13: A 'T'\n" +# + + +data_48: .asciiz "\t14: A plus '+'\n" +# + + +data_49: .asciiz "\t15: A 'W'\n" +# + + +data_50: .asciiz "\t16: An 'M'\n" +# + + +data_51: .asciiz "\t17: An 'E'\n" +# + + +data_52: .asciiz "\t18: A '3'\n" +# + + +data_53: .asciiz "\t19: An 'O'\n" +# + + +data_54: .asciiz "\t20: An '8'\n" +# + + +data_55: .asciiz "\t21: An 'S'\n" +# + + +data_56: .asciiz "Your choice => " +# + + +data_57: .asciiz "\n" +# + + +data_58: .asciiz " XX XXXX XXXX XX " +# + + +data_59: .asciiz " X X X X X " +# + + +data_60: .asciiz "X X X X X" +# + + +data_61: .asciiz "X X X X X X X X X" +# + + +data_62: .asciiz "X X X X X " +# + + +data_63: .asciiz " X X X X X" +# + + +data_64: .asciiz "X X X XX X " +# + + +data_65: .asciiz " X XX X X X " +# + + +data_66: .asciiz "X X X X X " +# + + +data_67: .asciiz " X X X X X" +# + + +data_68: .asciiz "X X X X X X X X" +# + + +data_69: .asciiz "XXXXXXXXXXXXXXXXXXXXXXXXX" +# + + +data_70: .asciiz "XXXXX X X X X " +# + + +data_71: .asciiz " X X XXXXX X X " +# + + +data_72: .asciiz "X X X X X X X " +# + + +data_73: .asciiz " X X X X X X X" +# + + +data_74: .asciiz "XXXXX X XXXXX X XXXX" +# + + +data_75: .asciiz "XXX X X X X XXXX " +# + + +data_76: .asciiz " XX X XX X XX " +# + + +data_77: .asciiz " XX X XX X XX X XX X XX " +# + + +data_78: .asciiz " XXXX X XX X XXXX " +# + + +data_79: .asciiz " " +# + + +data_80: .asciiz "Would you like to continue with the next generation? \n" +# + + +data_81: .asciiz "Please use lowercase y or n for your answer [y]: " +# + + +data_82: .asciiz "\n" +# + + +data_83: .asciiz "n" +# + + +data_84: .asciiz "\n\n" +# + + +data_85: .asciiz "Would you like to choose a background pattern? \n" +# + + +data_86: .asciiz "Please use lowercase y or n for your answer [n]: " +# + + +data_87: .asciiz "y" +# + + +data_88: .asciiz "Welcome to the Game of Life.\n" +# + + +data_89: .asciiz "There are many initial states to choose from. \n" +# + + +.text +main: + jal entry + # syscall code 10 is for exit + li $v0, 10 + syscall + # Function END + +# function_in_string_at_IO implementation. +# @Params: +function_in_string_at_IO: + # Allocate stack frame for function function_in_string_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_in_string_at_IO_internal_0 --> -4($fp) + # Allocating 1024 bytes of memory + li $a0, 1024 + li $v0, 9 + syscall + move $t0, $v0 + move $a0, $v0 + li $a1, 1024 + li $v0, 8 + syscall + move $t2, $zero + move $t3, $zero + move $t1, $t0 + lb $t3, 0($t1) + beqz $t3, end_loop + read_length_loop: + lb $t3, 0($t1) + beqz $t3, end_read_length_loop + addu $t1, $t1, 1 + addu $t2, $t2, 1 + j read_length_loop + end_read_length_loop: + subu $t1, $t1, 1 + sb $zero, 0($t1) + subu $t2, $t2, 1 + end_loop: + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $t2, 16($v0) + sw $v0, -4($fp) + # RETURN local_in_string_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_in_string_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_out_int_at_IO implementation. +# @Params: +# 0($fp) = param_out_int_at_IO_x_0 +function_out_int_at_IO: + # Allocate stack frame for function function_out_int_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # PRINT_INT param_out_int_at_IO_x_0 + # PARAM param_out_int_at_IO_x_0 --> 0($fp) + lw $v0, 0($fp) + lw $a0, 12($v0) + li $v0, 1 + syscall + # LOCAL local_out_int_at_IO_internal_0 --> -4($fp) + # local_out_int_at_IO_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_out_int_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_out_int_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_out_string_at_IO implementation. +# @Params: +# 0($fp) = param_out_string_at_IO_x_0 +function_out_string_at_IO: + # Allocate stack frame for function function_out_string_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # PARAM param_out_string_at_IO_x_0 --> 0($fp) + # PRINT_STR param_out_string_at_IO_x_0 + lw $v0, 0($fp) + lw $a0, 12($v0) + li $v0, 4 + syscall + # LOCAL local_out_string_at_IO_internal_0 --> -4($fp) + # local_out_string_at_IO_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_out_string_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_out_string_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_in_int_at_IO implementation. +# @Params: +function_in_int_at_IO: + # Allocate stack frame for function function_in_int_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_in_int_at_IO_internal_0 --> -4($fp) + # local_in_int_at_IO_internal_0 = READ_INT + li $v0, 5 + syscall + move $a2, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + sw $a2, 12($v0) + sw $v0, -4($fp) + # RETURN local_in_int_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_in_int_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_abort_at_Object implementation. +# @Params: +function_abort_at_Object: + # Allocate stack frame for function function_abort_at_Object. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_abort_at_Object_internal_0 --> -4($fp) + lw $t0, 0($s1) + sw $t0, -4($fp) + # LOCAL local_abort_at_Object_internal_0 --> -4($fp) + la $a0, data_1 + li $v0, 4 + syscall + lw $a0, -4($fp) + li $v0, 4 + syscall + la $a0, data_2 + li $v0, 4 + syscall + li $v0, 10 + syscall + # Function END + + +# function_copy_at_Object implementation. +# @Params: +function_copy_at_Object: + # Allocate stack frame for function function_copy_at_Object. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_copy_at_Object_internal_0 --> -4($fp) + # local_copy_at_Object_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_copy_at_Object_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function function_copy_at_Object. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_type_name_at_Object implementation. +# @Params: +function_type_name_at_Object: + # Allocate stack frame for function function_type_name_at_Object. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_type_name_at_Object_internal_0 --> -4($fp) + lw $t0, 0($s1) + sw $t0, -4($fp) + # RETURN local_type_name_at_Object_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_type_name_at_Object. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_concat_at_String implementation. +# @Params: +# 0($fp) = param_concat_at_String_s_0 +function_concat_at_String: + # Allocate stack frame for function function_concat_at_String. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_concat_at_String_internal_0 = self.CONCAT + # LOCAL local_concat_at_String_internal_0 --> -4($fp) + # PARAM param_concat_at_String_s_0 --> 0($fp) + # Get first string length from self + lw $t0, 16($s1) + # Get second string length from param + lw $v0, 0($fp) + lw $t1, 16($v0) + # Save new string length in a0 for memory allocation + addu $a0, $t0, $t1 + move $t3, $a0 + # Get first string from self + lw $t0, 12($s1) + # Get second string from param + lw $t1, 12($v0) + addu $a0, $a0, 4 + li $v0, 9 + syscall + move $t2, $v0 + move $t4, $zero + concat_loop1: + # Compare t0 with \0 + lb $t4, 0($t0) + beqz $t4, concat_loop1_end + # Copy 1 byte + sb $t4, 0($t2) + addu $t2, $t2, 1 + addu $t0, $t0, 1 + j concat_loop1 + concat_loop1_end: + # Copy second string + concat_loop2: + # Compare t1 with \0 + lb $t4, 0($t1) + beqz $t4, concat_loop2_end + # Copy 1 byte + sb $t4, 0($t2) + addu $t2, $t2, 1 + addu $t1, $t1, 1 + j concat_loop2 + concat_loop2_end: + sb $zero, 0($t2) + # v0 contains resulting string + move $t1, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + sw $t1, 12($v0) + sw $t3, 16($v0) + sw $v0, -4($fp) + # RETURN local_concat_at_String_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_concat_at_String. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_substr_at_String implementation. +# @Params: +# 0($fp) = param_substr_at_String_l_0 +# 4($fp) = param_substr_at_String_r_1 +function_substr_at_String: + # Allocate stack frame for function function_substr_at_String. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_substr_at_String_internal_0 --> -4($fp) + # PARAM param_substr_at_String_l_0 --> 4($fp) + # PARAM param_substr_at_String_r_1 --> 0($fp) + lw $t0, 12($s1) + lw $t2, 4($fp) + lw $t2, 12($t2) + addu $t0, $t0, $t2 + lw $a0, 0($fp) + lw $a0, 12($a0) + move $t3, $a0 + move $t1, $a0 + addu $a0, $a0, 1 + li $v0, 9 + syscall + move $t2, $v0 + substr_loop: + beqz $t1, substr_end + lb $a0, 0($t0) + sb $a0, 0($t2) + addu $t0, $t0, 1 + addu $t2, $t2, 1 + subu $t1, $t1, 1 + j substr_loop + substr_end: + sb $zero, 0($t2) + move $t1, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + sw $t1, 12($v0) + sw $t3, 16($v0) + sw $v0, -4($fp) + # RETURN local_substr_at_String_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_substr_at_String. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 8 + jr $ra + # Function END + + +# function_length_at_String implementation. +# @Params: +function_length_at_String: + # Allocate stack frame for function function_length_at_String. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_length_at_String_internal_0 = GETATTRIBUTE length String + # LOCAL local_length_at_String_internal_0 --> -4($fp) + lw $t0, 16($s1) + sw $t0, -4($fp) + # LOCAL local_length_at_String_internal_1 --> -8($fp) + # LOCAL local_length_at_String_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + lw $t0, -4($fp) + sw $t0, 12($v0) + sw $v0, -8($fp) + # RETURN local_length_at_String_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function function_length_at_String. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# entry implementation. +# @Params: +entry: + # Allocate stack frame for function entry. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local__internal_0 --> -4($fp) + # local__internal_0 = ALLOCATE Main + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Main + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 32 bytes of memory + li $a0, 32 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Main_start + sw $t0, 4($v0) + # Load type offset + li $t0, 28 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Board__attrib__rows__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 12($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Board__attrib__columns__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 16($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Board__attrib__board_size__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 20($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __CellularAutomaton__attrib__population_map__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 24($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Main__attrib__cells__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 28($t1) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -4($fp) + # LOCAL local__internal_0 --> -4($fp) + lw $s1, -4($fp) + # local__internal_1 = CALL main + # LOCAL local__internal_1 --> -8($fp) + # LOCAL local__internal_0 --> -4($fp) + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type's VTABLE + la $t0, Main_vtable + # Get pointer to function address + lw $t1, 112($t0) + # Call function. Result is on $v0 + jalr $t1 + sw $v0, -8($fp) + # RETURN 0 + li $v0, 0 + # Deallocate stack frame for function entry. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# __Board__attrib__rows__init implementation. +# @Params: +__Board__attrib__rows__init: + # Allocate stack frame for function __Board__attrib__rows__init. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_attrib__rows__init_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -4($fp) + # RETURN local_attrib__rows__init_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function __Board__attrib__rows__init. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# __Board__attrib__columns__init implementation. +# @Params: +__Board__attrib__columns__init: + # Allocate stack frame for function __Board__attrib__columns__init. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_attrib__columns__init_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -4($fp) + # RETURN local_attrib__columns__init_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function __Board__attrib__columns__init. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# __Board__attrib__board_size__init implementation. +# @Params: +__Board__attrib__board_size__init: + # Allocate stack frame for function __Board__attrib__board_size__init. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_attrib__board_size__init_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -4($fp) + # RETURN local_attrib__board_size__init_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function __Board__attrib__board_size__init. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_size_of_board_at_Board implementation. +# @Params: +# 0($fp) = param_size_of_board_at_Board_initial_0 +function_size_of_board_at_Board: + # Allocate stack frame for function function_size_of_board_at_Board. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_size_of_board_at_Board_internal_0 --> -4($fp) + # PARAM param_size_of_board_at_Board_initial_0 --> 0($fp) + # local_size_of_board_at_Board_internal_0 = PARAM param_size_of_board_at_Board_initial_0 + lw $t0, 0($fp) + sw $t0, -4($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_size_of_board_at_Board_internal_0 --> -4($fp) + # LOCAL local_size_of_board_at_Board_internal_1 --> -8($fp) + # local_size_of_board_at_Board_internal_1 = VCALL local_size_of_board_at_Board_internal_0 length + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 40($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -8($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # RETURN local_size_of_board_at_Board_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function function_size_of_board_at_Board. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_board_init_at_Board implementation. +# @Params: +# 0($fp) = param_board_init_at_Board_start_0 +function_board_init_at_Board: + # Allocate stack frame for function function_board_init_at_Board. + subu $sp, $sp, 204 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 204 + # LOCAL local_board_init_at_Board_size_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -4($fp) + # LOCAL local_board_init_at_Board_internal_3 --> -16($fp) + # local_board_init_at_Board_internal_3 = SELF + sw $s1, -16($fp) + # LOCAL local_board_init_at_Board_internal_1 --> -8($fp) + # LOCAL local_board_init_at_Board_internal_3 --> -16($fp) + # local_board_init_at_Board_internal_1 = local_board_init_at_Board_internal_3 + lw $t0, -16($fp) + sw $t0, -8($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # ARG param_board_init_at_Board_start_0 + # PARAM param_board_init_at_Board_start_0 --> 0($fp) + lw $t0, 0($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_board_init_at_Board_internal_1 --> -8($fp) + # LOCAL local_board_init_at_Board_internal_2 --> -12($fp) + # local_board_init_at_Board_internal_2 = VCALL local_board_init_at_Board_internal_1 size_of_board + # Save new self pointer in $s1 + lw $s1, -8($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 28($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -12($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_board_init_at_Board_size_0 --> -4($fp) + # LOCAL local_board_init_at_Board_internal_2 --> -12($fp) + # local_board_init_at_Board_size_0 = local_board_init_at_Board_internal_2 + lw $t0, -12($fp) + sw $t0, -4($fp) + # LOCAL local_board_init_at_Board_internal_8 --> -36($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 15 + sw $t0, 12($v0) + sw $v0, -36($fp) + # IF_ZERO local_board_init_at_Board_size_0 GOTO label_FALSE_3 + # IF_ZERO local_board_init_at_Board_size_0 GOTO label_FALSE_3 + lw $t0, -4($fp) + beq $t0, 0, label_FALSE_3 + # IF_ZERO local_board_init_at_Board_internal_8 GOTO label_FALSE_3 + # IF_ZERO local_board_init_at_Board_internal_8 GOTO label_FALSE_3 + lw $t0, -36($fp) + beq $t0, 0, label_FALSE_3 + # LOCAL local_board_init_at_Board_internal_7 --> -32($fp) + # LOCAL local_board_init_at_Board_size_0 --> -4($fp) + # Comparing -4($fp) type with String + la $v0, String + lw $a0, -4($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -32($fp) + # IF_ZERO local_board_init_at_Board_internal_7 GOTO label_COMPARE_STRING_6 + # IF_ZERO local_board_init_at_Board_internal_7 GOTO label_COMPARE_STRING_6 + lw $t0, -32($fp) + beq $t0, 0, label_COMPARE_STRING_6 + # LOCAL local_board_init_at_Board_internal_7 --> -32($fp) + # LOCAL local_board_init_at_Board_size_0 --> -4($fp) + # Comparing -4($fp) type with Bool + la $v0, Bool + lw $a0, -4($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -32($fp) + # IF_ZERO local_board_init_at_Board_internal_7 GOTO label_COMPARE_BY_VALUE_7 + # IF_ZERO local_board_init_at_Board_internal_7 GOTO label_COMPARE_BY_VALUE_7 + lw $t0, -32($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_7 + # LOCAL local_board_init_at_Board_internal_7 --> -32($fp) + # LOCAL local_board_init_at_Board_size_0 --> -4($fp) + # Comparing -4($fp) type with Int + la $v0, Int + lw $a0, -4($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -32($fp) + # IF_ZERO local_board_init_at_Board_internal_7 GOTO label_COMPARE_BY_VALUE_7 + # IF_ZERO local_board_init_at_Board_internal_7 GOTO label_COMPARE_BY_VALUE_7 + lw $t0, -32($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_7 + # LOCAL local_board_init_at_Board_internal_7 --> -32($fp) + # LOCAL local_board_init_at_Board_size_0 --> -4($fp) + # LOCAL local_board_init_at_Board_internal_8 --> -36($fp) + # Load pointers and SUB + lw $a0, -4($fp) + lw $a1, -36($fp) + sub $a0, $a0, $a1 + sw $a0, -32($fp) + # IF_ZERO local_board_init_at_Board_internal_7 GOTO label_TRUE_4 + # IF_ZERO local_board_init_at_Board_internal_7 GOTO label_TRUE_4 + lw $t0, -32($fp) + beq $t0, 0, label_TRUE_4 + # GOTO label_FALSE_3 + j label_FALSE_3 + label_COMPARE_BY_VALUE_7: + # LOCAL local_board_init_at_Board_internal_7 --> -32($fp) + # LOCAL local_board_init_at_Board_size_0 --> -4($fp) + # LOCAL local_board_init_at_Board_internal_8 --> -36($fp) + lw $a0, -4($fp) + lw $a1, -36($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -32($fp) + # IF_ZERO local_board_init_at_Board_internal_7 GOTO label_TRUE_4 + # IF_ZERO local_board_init_at_Board_internal_7 GOTO label_TRUE_4 + lw $t0, -32($fp) + beq $t0, 0, label_TRUE_4 + # GOTO label_FALSE_3 + j label_FALSE_3 + label_COMPARE_STRING_6: + # LOCAL local_board_init_at_Board_internal_7 --> -32($fp) + # LOCAL local_board_init_at_Board_size_0 --> -4($fp) + # LOCAL local_board_init_at_Board_internal_8 --> -36($fp) + # Load strings for comparison + lw $v0, -4($fp) + lw $v1, -36($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -32($fp) + # IF_ZERO local_board_init_at_Board_internal_7 GOTO label_CONTINUE_8 + # IF_ZERO local_board_init_at_Board_internal_7 GOTO label_CONTINUE_8 + lw $t0, -32($fp) + beq $t0, 0, label_CONTINUE_8 + # GOTO label_FALSE_3 + j label_FALSE_3 + label_CONTINUE_8: + # LOCAL local_board_init_at_Board_internal_7 --> -32($fp) + # LOCAL local_board_init_at_Board_size_0 --> -4($fp) + # LOCAL local_board_init_at_Board_internal_8 --> -36($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -4($fp) + lw $v1, -36($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_9: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_10 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_9 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_10: + # Store result + sw $a2, -32($fp) + # IF_ZERO local_board_init_at_Board_internal_7 GOTO label_TRUE_4 + # IF_ZERO local_board_init_at_Board_internal_7 GOTO label_TRUE_4 + lw $t0, -32($fp) + beq $t0, 0, label_TRUE_4 + label_FALSE_3: + # LOCAL local_board_init_at_Board_internal_6 --> -28($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -28($fp) + # GOTO label_END_5 +j label_END_5 +label_TRUE_4: + # LOCAL local_board_init_at_Board_internal_6 --> -28($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -28($fp) + label_END_5: +# LOCAL local_board_init_at_Board_internal_4 --> -20($fp) +# LOCAL local_board_init_at_Board_internal_6 --> -28($fp) +# Obtain value from -28($fp) +lw $v0, -28($fp) +lw $v0, 12($v0) +sw $v0, -20($fp) +# IF_ZERO local_board_init_at_Board_internal_4 GOTO label_FALSEIF_1 +# IF_ZERO local_board_init_at_Board_internal_4 GOTO label_FALSEIF_1 +lw $t0, -20($fp) +beq $t0, 0, label_FALSEIF_1 +# LOCAL local_board_init_at_Board_internal_9 --> -40($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 3 +sw $t0, 12($v0) +sw $v0, -40($fp) +# +# LOCAL local_board_init_at_Board_internal_9 --> -40($fp) +lw $t0, -40($fp) +sw $t0, 12($s1) +# LOCAL local_board_init_at_Board_internal_10 --> -44($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 5 +sw $t0, 12($v0) +sw $v0, -44($fp) +# +# LOCAL local_board_init_at_Board_internal_10 --> -44($fp) +lw $t0, -44($fp) +sw $t0, 16($s1) +# +# LOCAL local_board_init_at_Board_size_0 --> -4($fp) +lw $t0, -4($fp) +sw $t0, 20($s1) +# LOCAL local_board_init_at_Board_internal_5 --> -24($fp) +# local_board_init_at_Board_internal_5 = +# GOTO label_ENDIF_2 +j label_ENDIF_2 +label_FALSEIF_1: + # LOCAL local_board_init_at_Board_internal_15 --> -64($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 16 + sw $t0, 12($v0) + sw $v0, -64($fp) + # IF_ZERO local_board_init_at_Board_size_0 GOTO label_FALSE_13 + # IF_ZERO local_board_init_at_Board_size_0 GOTO label_FALSE_13 + lw $t0, -4($fp) + beq $t0, 0, label_FALSE_13 + # IF_ZERO local_board_init_at_Board_internal_15 GOTO label_FALSE_13 + # IF_ZERO local_board_init_at_Board_internal_15 GOTO label_FALSE_13 + lw $t0, -64($fp) + beq $t0, 0, label_FALSE_13 + # LOCAL local_board_init_at_Board_internal_14 --> -60($fp) + # LOCAL local_board_init_at_Board_size_0 --> -4($fp) + # Comparing -4($fp) type with String + la $v0, String + lw $a0, -4($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -60($fp) + # IF_ZERO local_board_init_at_Board_internal_14 GOTO label_COMPARE_STRING_16 + # IF_ZERO local_board_init_at_Board_internal_14 GOTO label_COMPARE_STRING_16 + lw $t0, -60($fp) + beq $t0, 0, label_COMPARE_STRING_16 + # LOCAL local_board_init_at_Board_internal_14 --> -60($fp) + # LOCAL local_board_init_at_Board_size_0 --> -4($fp) + # Comparing -4($fp) type with Bool + la $v0, Bool + lw $a0, -4($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -60($fp) + # IF_ZERO local_board_init_at_Board_internal_14 GOTO label_COMPARE_BY_VALUE_17 + # IF_ZERO local_board_init_at_Board_internal_14 GOTO label_COMPARE_BY_VALUE_17 + lw $t0, -60($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_17 + # LOCAL local_board_init_at_Board_internal_14 --> -60($fp) + # LOCAL local_board_init_at_Board_size_0 --> -4($fp) + # Comparing -4($fp) type with Int + la $v0, Int + lw $a0, -4($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -60($fp) + # IF_ZERO local_board_init_at_Board_internal_14 GOTO label_COMPARE_BY_VALUE_17 + # IF_ZERO local_board_init_at_Board_internal_14 GOTO label_COMPARE_BY_VALUE_17 + lw $t0, -60($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_17 + # LOCAL local_board_init_at_Board_internal_14 --> -60($fp) + # LOCAL local_board_init_at_Board_size_0 --> -4($fp) + # LOCAL local_board_init_at_Board_internal_15 --> -64($fp) + # Load pointers and SUB + lw $a0, -4($fp) + lw $a1, -64($fp) + sub $a0, $a0, $a1 + sw $a0, -60($fp) + # IF_ZERO local_board_init_at_Board_internal_14 GOTO label_TRUE_14 + # IF_ZERO local_board_init_at_Board_internal_14 GOTO label_TRUE_14 + lw $t0, -60($fp) + beq $t0, 0, label_TRUE_14 + # GOTO label_FALSE_13 + j label_FALSE_13 + label_COMPARE_BY_VALUE_17: + # LOCAL local_board_init_at_Board_internal_14 --> -60($fp) + # LOCAL local_board_init_at_Board_size_0 --> -4($fp) + # LOCAL local_board_init_at_Board_internal_15 --> -64($fp) + lw $a0, -4($fp) + lw $a1, -64($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -60($fp) + # IF_ZERO local_board_init_at_Board_internal_14 GOTO label_TRUE_14 + # IF_ZERO local_board_init_at_Board_internal_14 GOTO label_TRUE_14 + lw $t0, -60($fp) + beq $t0, 0, label_TRUE_14 + # GOTO label_FALSE_13 + j label_FALSE_13 + label_COMPARE_STRING_16: + # LOCAL local_board_init_at_Board_internal_14 --> -60($fp) + # LOCAL local_board_init_at_Board_size_0 --> -4($fp) + # LOCAL local_board_init_at_Board_internal_15 --> -64($fp) + # Load strings for comparison + lw $v0, -4($fp) + lw $v1, -64($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -60($fp) + # IF_ZERO local_board_init_at_Board_internal_14 GOTO label_CONTINUE_18 + # IF_ZERO local_board_init_at_Board_internal_14 GOTO label_CONTINUE_18 + lw $t0, -60($fp) + beq $t0, 0, label_CONTINUE_18 + # GOTO label_FALSE_13 + j label_FALSE_13 + label_CONTINUE_18: + # LOCAL local_board_init_at_Board_internal_14 --> -60($fp) + # LOCAL local_board_init_at_Board_size_0 --> -4($fp) + # LOCAL local_board_init_at_Board_internal_15 --> -64($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -4($fp) + lw $v1, -64($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_19: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_20 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_19 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_20: + # Store result + sw $a2, -60($fp) + # IF_ZERO local_board_init_at_Board_internal_14 GOTO label_TRUE_14 + # IF_ZERO local_board_init_at_Board_internal_14 GOTO label_TRUE_14 + lw $t0, -60($fp) + beq $t0, 0, label_TRUE_14 + label_FALSE_13: + # LOCAL local_board_init_at_Board_internal_13 --> -56($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -56($fp) + # GOTO label_END_15 +j label_END_15 +label_TRUE_14: + # LOCAL local_board_init_at_Board_internal_13 --> -56($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -56($fp) + label_END_15: +# LOCAL local_board_init_at_Board_internal_11 --> -48($fp) +# LOCAL local_board_init_at_Board_internal_13 --> -56($fp) +# Obtain value from -56($fp) +lw $v0, -56($fp) +lw $v0, 12($v0) +sw $v0, -48($fp) +# IF_ZERO local_board_init_at_Board_internal_11 GOTO label_FALSEIF_11 +# IF_ZERO local_board_init_at_Board_internal_11 GOTO label_FALSEIF_11 +lw $t0, -48($fp) +beq $t0, 0, label_FALSEIF_11 +# LOCAL local_board_init_at_Board_internal_16 --> -68($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 4 +sw $t0, 12($v0) +sw $v0, -68($fp) +# +# LOCAL local_board_init_at_Board_internal_16 --> -68($fp) +lw $t0, -68($fp) +sw $t0, 12($s1) +# LOCAL local_board_init_at_Board_internal_17 --> -72($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 4 +sw $t0, 12($v0) +sw $v0, -72($fp) +# +# LOCAL local_board_init_at_Board_internal_17 --> -72($fp) +lw $t0, -72($fp) +sw $t0, 16($s1) +# +# LOCAL local_board_init_at_Board_size_0 --> -4($fp) +lw $t0, -4($fp) +sw $t0, 20($s1) +# LOCAL local_board_init_at_Board_internal_12 --> -52($fp) +# local_board_init_at_Board_internal_12 = +# GOTO label_ENDIF_12 +j label_ENDIF_12 +label_FALSEIF_11: + # LOCAL local_board_init_at_Board_internal_22 --> -92($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 20 + sw $t0, 12($v0) + sw $v0, -92($fp) + # IF_ZERO local_board_init_at_Board_size_0 GOTO label_FALSE_23 + # IF_ZERO local_board_init_at_Board_size_0 GOTO label_FALSE_23 + lw $t0, -4($fp) + beq $t0, 0, label_FALSE_23 + # IF_ZERO local_board_init_at_Board_internal_22 GOTO label_FALSE_23 + # IF_ZERO local_board_init_at_Board_internal_22 GOTO label_FALSE_23 + lw $t0, -92($fp) + beq $t0, 0, label_FALSE_23 + # LOCAL local_board_init_at_Board_internal_21 --> -88($fp) + # LOCAL local_board_init_at_Board_size_0 --> -4($fp) + # Comparing -4($fp) type with String + la $v0, String + lw $a0, -4($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -88($fp) + # IF_ZERO local_board_init_at_Board_internal_21 GOTO label_COMPARE_STRING_26 + # IF_ZERO local_board_init_at_Board_internal_21 GOTO label_COMPARE_STRING_26 + lw $t0, -88($fp) + beq $t0, 0, label_COMPARE_STRING_26 + # LOCAL local_board_init_at_Board_internal_21 --> -88($fp) + # LOCAL local_board_init_at_Board_size_0 --> -4($fp) + # Comparing -4($fp) type with Bool + la $v0, Bool + lw $a0, -4($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -88($fp) + # IF_ZERO local_board_init_at_Board_internal_21 GOTO label_COMPARE_BY_VALUE_27 + # IF_ZERO local_board_init_at_Board_internal_21 GOTO label_COMPARE_BY_VALUE_27 + lw $t0, -88($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_27 + # LOCAL local_board_init_at_Board_internal_21 --> -88($fp) + # LOCAL local_board_init_at_Board_size_0 --> -4($fp) + # Comparing -4($fp) type with Int + la $v0, Int + lw $a0, -4($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -88($fp) + # IF_ZERO local_board_init_at_Board_internal_21 GOTO label_COMPARE_BY_VALUE_27 + # IF_ZERO local_board_init_at_Board_internal_21 GOTO label_COMPARE_BY_VALUE_27 + lw $t0, -88($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_27 + # LOCAL local_board_init_at_Board_internal_21 --> -88($fp) + # LOCAL local_board_init_at_Board_size_0 --> -4($fp) + # LOCAL local_board_init_at_Board_internal_22 --> -92($fp) + # Load pointers and SUB + lw $a0, -4($fp) + lw $a1, -92($fp) + sub $a0, $a0, $a1 + sw $a0, -88($fp) + # IF_ZERO local_board_init_at_Board_internal_21 GOTO label_TRUE_24 + # IF_ZERO local_board_init_at_Board_internal_21 GOTO label_TRUE_24 + lw $t0, -88($fp) + beq $t0, 0, label_TRUE_24 + # GOTO label_FALSE_23 + j label_FALSE_23 + label_COMPARE_BY_VALUE_27: + # LOCAL local_board_init_at_Board_internal_21 --> -88($fp) + # LOCAL local_board_init_at_Board_size_0 --> -4($fp) + # LOCAL local_board_init_at_Board_internal_22 --> -92($fp) + lw $a0, -4($fp) + lw $a1, -92($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -88($fp) + # IF_ZERO local_board_init_at_Board_internal_21 GOTO label_TRUE_24 + # IF_ZERO local_board_init_at_Board_internal_21 GOTO label_TRUE_24 + lw $t0, -88($fp) + beq $t0, 0, label_TRUE_24 + # GOTO label_FALSE_23 + j label_FALSE_23 + label_COMPARE_STRING_26: + # LOCAL local_board_init_at_Board_internal_21 --> -88($fp) + # LOCAL local_board_init_at_Board_size_0 --> -4($fp) + # LOCAL local_board_init_at_Board_internal_22 --> -92($fp) + # Load strings for comparison + lw $v0, -4($fp) + lw $v1, -92($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -88($fp) + # IF_ZERO local_board_init_at_Board_internal_21 GOTO label_CONTINUE_28 + # IF_ZERO local_board_init_at_Board_internal_21 GOTO label_CONTINUE_28 + lw $t0, -88($fp) + beq $t0, 0, label_CONTINUE_28 + # GOTO label_FALSE_23 + j label_FALSE_23 + label_CONTINUE_28: + # LOCAL local_board_init_at_Board_internal_21 --> -88($fp) + # LOCAL local_board_init_at_Board_size_0 --> -4($fp) + # LOCAL local_board_init_at_Board_internal_22 --> -92($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -4($fp) + lw $v1, -92($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_29: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_30 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_29 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_30: + # Store result + sw $a2, -88($fp) + # IF_ZERO local_board_init_at_Board_internal_21 GOTO label_TRUE_24 + # IF_ZERO local_board_init_at_Board_internal_21 GOTO label_TRUE_24 + lw $t0, -88($fp) + beq $t0, 0, label_TRUE_24 + label_FALSE_23: + # LOCAL local_board_init_at_Board_internal_20 --> -84($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -84($fp) + # GOTO label_END_25 +j label_END_25 +label_TRUE_24: + # LOCAL local_board_init_at_Board_internal_20 --> -84($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -84($fp) + label_END_25: +# LOCAL local_board_init_at_Board_internal_18 --> -76($fp) +# LOCAL local_board_init_at_Board_internal_20 --> -84($fp) +# Obtain value from -84($fp) +lw $v0, -84($fp) +lw $v0, 12($v0) +sw $v0, -76($fp) +# IF_ZERO local_board_init_at_Board_internal_18 GOTO label_FALSEIF_21 +# IF_ZERO local_board_init_at_Board_internal_18 GOTO label_FALSEIF_21 +lw $t0, -76($fp) +beq $t0, 0, label_FALSEIF_21 +# LOCAL local_board_init_at_Board_internal_23 --> -96($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 4 +sw $t0, 12($v0) +sw $v0, -96($fp) +# +# LOCAL local_board_init_at_Board_internal_23 --> -96($fp) +lw $t0, -96($fp) +sw $t0, 12($s1) +# LOCAL local_board_init_at_Board_internal_24 --> -100($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 5 +sw $t0, 12($v0) +sw $v0, -100($fp) +# +# LOCAL local_board_init_at_Board_internal_24 --> -100($fp) +lw $t0, -100($fp) +sw $t0, 16($s1) +# +# LOCAL local_board_init_at_Board_size_0 --> -4($fp) +lw $t0, -4($fp) +sw $t0, 20($s1) +# LOCAL local_board_init_at_Board_internal_19 --> -80($fp) +# local_board_init_at_Board_internal_19 = +# GOTO label_ENDIF_22 +j label_ENDIF_22 +label_FALSEIF_21: + # LOCAL local_board_init_at_Board_internal_29 --> -120($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 21 + sw $t0, 12($v0) + sw $v0, -120($fp) + # IF_ZERO local_board_init_at_Board_size_0 GOTO label_FALSE_33 + # IF_ZERO local_board_init_at_Board_size_0 GOTO label_FALSE_33 + lw $t0, -4($fp) + beq $t0, 0, label_FALSE_33 + # IF_ZERO local_board_init_at_Board_internal_29 GOTO label_FALSE_33 + # IF_ZERO local_board_init_at_Board_internal_29 GOTO label_FALSE_33 + lw $t0, -120($fp) + beq $t0, 0, label_FALSE_33 + # LOCAL local_board_init_at_Board_internal_28 --> -116($fp) + # LOCAL local_board_init_at_Board_size_0 --> -4($fp) + # Comparing -4($fp) type with String + la $v0, String + lw $a0, -4($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -116($fp) + # IF_ZERO local_board_init_at_Board_internal_28 GOTO label_COMPARE_STRING_36 + # IF_ZERO local_board_init_at_Board_internal_28 GOTO label_COMPARE_STRING_36 + lw $t0, -116($fp) + beq $t0, 0, label_COMPARE_STRING_36 + # LOCAL local_board_init_at_Board_internal_28 --> -116($fp) + # LOCAL local_board_init_at_Board_size_0 --> -4($fp) + # Comparing -4($fp) type with Bool + la $v0, Bool + lw $a0, -4($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -116($fp) + # IF_ZERO local_board_init_at_Board_internal_28 GOTO label_COMPARE_BY_VALUE_37 + # IF_ZERO local_board_init_at_Board_internal_28 GOTO label_COMPARE_BY_VALUE_37 + lw $t0, -116($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_37 + # LOCAL local_board_init_at_Board_internal_28 --> -116($fp) + # LOCAL local_board_init_at_Board_size_0 --> -4($fp) + # Comparing -4($fp) type with Int + la $v0, Int + lw $a0, -4($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -116($fp) + # IF_ZERO local_board_init_at_Board_internal_28 GOTO label_COMPARE_BY_VALUE_37 + # IF_ZERO local_board_init_at_Board_internal_28 GOTO label_COMPARE_BY_VALUE_37 + lw $t0, -116($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_37 + # LOCAL local_board_init_at_Board_internal_28 --> -116($fp) + # LOCAL local_board_init_at_Board_size_0 --> -4($fp) + # LOCAL local_board_init_at_Board_internal_29 --> -120($fp) + # Load pointers and SUB + lw $a0, -4($fp) + lw $a1, -120($fp) + sub $a0, $a0, $a1 + sw $a0, -116($fp) + # IF_ZERO local_board_init_at_Board_internal_28 GOTO label_TRUE_34 + # IF_ZERO local_board_init_at_Board_internal_28 GOTO label_TRUE_34 + lw $t0, -116($fp) + beq $t0, 0, label_TRUE_34 + # GOTO label_FALSE_33 + j label_FALSE_33 + label_COMPARE_BY_VALUE_37: + # LOCAL local_board_init_at_Board_internal_28 --> -116($fp) + # LOCAL local_board_init_at_Board_size_0 --> -4($fp) + # LOCAL local_board_init_at_Board_internal_29 --> -120($fp) + lw $a0, -4($fp) + lw $a1, -120($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -116($fp) + # IF_ZERO local_board_init_at_Board_internal_28 GOTO label_TRUE_34 + # IF_ZERO local_board_init_at_Board_internal_28 GOTO label_TRUE_34 + lw $t0, -116($fp) + beq $t0, 0, label_TRUE_34 + # GOTO label_FALSE_33 + j label_FALSE_33 + label_COMPARE_STRING_36: + # LOCAL local_board_init_at_Board_internal_28 --> -116($fp) + # LOCAL local_board_init_at_Board_size_0 --> -4($fp) + # LOCAL local_board_init_at_Board_internal_29 --> -120($fp) + # Load strings for comparison + lw $v0, -4($fp) + lw $v1, -120($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -116($fp) + # IF_ZERO local_board_init_at_Board_internal_28 GOTO label_CONTINUE_38 + # IF_ZERO local_board_init_at_Board_internal_28 GOTO label_CONTINUE_38 + lw $t0, -116($fp) + beq $t0, 0, label_CONTINUE_38 + # GOTO label_FALSE_33 + j label_FALSE_33 + label_CONTINUE_38: + # LOCAL local_board_init_at_Board_internal_28 --> -116($fp) + # LOCAL local_board_init_at_Board_size_0 --> -4($fp) + # LOCAL local_board_init_at_Board_internal_29 --> -120($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -4($fp) + lw $v1, -120($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_39: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_40 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_39 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_40: + # Store result + sw $a2, -116($fp) + # IF_ZERO local_board_init_at_Board_internal_28 GOTO label_TRUE_34 + # IF_ZERO local_board_init_at_Board_internal_28 GOTO label_TRUE_34 + lw $t0, -116($fp) + beq $t0, 0, label_TRUE_34 + label_FALSE_33: + # LOCAL local_board_init_at_Board_internal_27 --> -112($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -112($fp) + # GOTO label_END_35 +j label_END_35 +label_TRUE_34: + # LOCAL local_board_init_at_Board_internal_27 --> -112($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -112($fp) + label_END_35: +# LOCAL local_board_init_at_Board_internal_25 --> -104($fp) +# LOCAL local_board_init_at_Board_internal_27 --> -112($fp) +# Obtain value from -112($fp) +lw $v0, -112($fp) +lw $v0, 12($v0) +sw $v0, -104($fp) +# IF_ZERO local_board_init_at_Board_internal_25 GOTO label_FALSEIF_31 +# IF_ZERO local_board_init_at_Board_internal_25 GOTO label_FALSEIF_31 +lw $t0, -104($fp) +beq $t0, 0, label_FALSEIF_31 +# LOCAL local_board_init_at_Board_internal_30 --> -124($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 3 +sw $t0, 12($v0) +sw $v0, -124($fp) +# +# LOCAL local_board_init_at_Board_internal_30 --> -124($fp) +lw $t0, -124($fp) +sw $t0, 12($s1) +# LOCAL local_board_init_at_Board_internal_31 --> -128($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 7 +sw $t0, 12($v0) +sw $v0, -128($fp) +# +# LOCAL local_board_init_at_Board_internal_31 --> -128($fp) +lw $t0, -128($fp) +sw $t0, 16($s1) +# +# LOCAL local_board_init_at_Board_size_0 --> -4($fp) +lw $t0, -4($fp) +sw $t0, 20($s1) +# LOCAL local_board_init_at_Board_internal_26 --> -108($fp) +# local_board_init_at_Board_internal_26 = +# GOTO label_ENDIF_32 +j label_ENDIF_32 +label_FALSEIF_31: + # LOCAL local_board_init_at_Board_internal_36 --> -148($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 25 + sw $t0, 12($v0) + sw $v0, -148($fp) + # IF_ZERO local_board_init_at_Board_size_0 GOTO label_FALSE_43 + # IF_ZERO local_board_init_at_Board_size_0 GOTO label_FALSE_43 + lw $t0, -4($fp) + beq $t0, 0, label_FALSE_43 + # IF_ZERO local_board_init_at_Board_internal_36 GOTO label_FALSE_43 + # IF_ZERO local_board_init_at_Board_internal_36 GOTO label_FALSE_43 + lw $t0, -148($fp) + beq $t0, 0, label_FALSE_43 + # LOCAL local_board_init_at_Board_internal_35 --> -144($fp) + # LOCAL local_board_init_at_Board_size_0 --> -4($fp) + # Comparing -4($fp) type with String + la $v0, String + lw $a0, -4($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -144($fp) + # IF_ZERO local_board_init_at_Board_internal_35 GOTO label_COMPARE_STRING_46 + # IF_ZERO local_board_init_at_Board_internal_35 GOTO label_COMPARE_STRING_46 + lw $t0, -144($fp) + beq $t0, 0, label_COMPARE_STRING_46 + # LOCAL local_board_init_at_Board_internal_35 --> -144($fp) + # LOCAL local_board_init_at_Board_size_0 --> -4($fp) + # Comparing -4($fp) type with Bool + la $v0, Bool + lw $a0, -4($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -144($fp) + # IF_ZERO local_board_init_at_Board_internal_35 GOTO label_COMPARE_BY_VALUE_47 + # IF_ZERO local_board_init_at_Board_internal_35 GOTO label_COMPARE_BY_VALUE_47 + lw $t0, -144($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_47 + # LOCAL local_board_init_at_Board_internal_35 --> -144($fp) + # LOCAL local_board_init_at_Board_size_0 --> -4($fp) + # Comparing -4($fp) type with Int + la $v0, Int + lw $a0, -4($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -144($fp) + # IF_ZERO local_board_init_at_Board_internal_35 GOTO label_COMPARE_BY_VALUE_47 + # IF_ZERO local_board_init_at_Board_internal_35 GOTO label_COMPARE_BY_VALUE_47 + lw $t0, -144($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_47 + # LOCAL local_board_init_at_Board_internal_35 --> -144($fp) + # LOCAL local_board_init_at_Board_size_0 --> -4($fp) + # LOCAL local_board_init_at_Board_internal_36 --> -148($fp) + # Load pointers and SUB + lw $a0, -4($fp) + lw $a1, -148($fp) + sub $a0, $a0, $a1 + sw $a0, -144($fp) + # IF_ZERO local_board_init_at_Board_internal_35 GOTO label_TRUE_44 + # IF_ZERO local_board_init_at_Board_internal_35 GOTO label_TRUE_44 + lw $t0, -144($fp) + beq $t0, 0, label_TRUE_44 + # GOTO label_FALSE_43 + j label_FALSE_43 + label_COMPARE_BY_VALUE_47: + # LOCAL local_board_init_at_Board_internal_35 --> -144($fp) + # LOCAL local_board_init_at_Board_size_0 --> -4($fp) + # LOCAL local_board_init_at_Board_internal_36 --> -148($fp) + lw $a0, -4($fp) + lw $a1, -148($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -144($fp) + # IF_ZERO local_board_init_at_Board_internal_35 GOTO label_TRUE_44 + # IF_ZERO local_board_init_at_Board_internal_35 GOTO label_TRUE_44 + lw $t0, -144($fp) + beq $t0, 0, label_TRUE_44 + # GOTO label_FALSE_43 + j label_FALSE_43 + label_COMPARE_STRING_46: + # LOCAL local_board_init_at_Board_internal_35 --> -144($fp) + # LOCAL local_board_init_at_Board_size_0 --> -4($fp) + # LOCAL local_board_init_at_Board_internal_36 --> -148($fp) + # Load strings for comparison + lw $v0, -4($fp) + lw $v1, -148($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -144($fp) + # IF_ZERO local_board_init_at_Board_internal_35 GOTO label_CONTINUE_48 + # IF_ZERO local_board_init_at_Board_internal_35 GOTO label_CONTINUE_48 + lw $t0, -144($fp) + beq $t0, 0, label_CONTINUE_48 + # GOTO label_FALSE_43 + j label_FALSE_43 + label_CONTINUE_48: + # LOCAL local_board_init_at_Board_internal_35 --> -144($fp) + # LOCAL local_board_init_at_Board_size_0 --> -4($fp) + # LOCAL local_board_init_at_Board_internal_36 --> -148($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -4($fp) + lw $v1, -148($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_49: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_50 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_49 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_50: + # Store result + sw $a2, -144($fp) + # IF_ZERO local_board_init_at_Board_internal_35 GOTO label_TRUE_44 + # IF_ZERO local_board_init_at_Board_internal_35 GOTO label_TRUE_44 + lw $t0, -144($fp) + beq $t0, 0, label_TRUE_44 + label_FALSE_43: + # LOCAL local_board_init_at_Board_internal_34 --> -140($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -140($fp) + # GOTO label_END_45 +j label_END_45 +label_TRUE_44: + # LOCAL local_board_init_at_Board_internal_34 --> -140($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -140($fp) + label_END_45: +# LOCAL local_board_init_at_Board_internal_32 --> -132($fp) +# LOCAL local_board_init_at_Board_internal_34 --> -140($fp) +# Obtain value from -140($fp) +lw $v0, -140($fp) +lw $v0, 12($v0) +sw $v0, -132($fp) +# IF_ZERO local_board_init_at_Board_internal_32 GOTO label_FALSEIF_41 +# IF_ZERO local_board_init_at_Board_internal_32 GOTO label_FALSEIF_41 +lw $t0, -132($fp) +beq $t0, 0, label_FALSEIF_41 +# LOCAL local_board_init_at_Board_internal_37 --> -152($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 5 +sw $t0, 12($v0) +sw $v0, -152($fp) +# +# LOCAL local_board_init_at_Board_internal_37 --> -152($fp) +lw $t0, -152($fp) +sw $t0, 12($s1) +# LOCAL local_board_init_at_Board_internal_38 --> -156($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 5 +sw $t0, 12($v0) +sw $v0, -156($fp) +# +# LOCAL local_board_init_at_Board_internal_38 --> -156($fp) +lw $t0, -156($fp) +sw $t0, 16($s1) +# +# LOCAL local_board_init_at_Board_size_0 --> -4($fp) +lw $t0, -4($fp) +sw $t0, 20($s1) +# LOCAL local_board_init_at_Board_internal_33 --> -136($fp) +# local_board_init_at_Board_internal_33 = +# GOTO label_ENDIF_42 +j label_ENDIF_42 +label_FALSEIF_41: + # LOCAL local_board_init_at_Board_internal_43 --> -176($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 28 + sw $t0, 12($v0) + sw $v0, -176($fp) + # IF_ZERO local_board_init_at_Board_size_0 GOTO label_FALSE_53 + # IF_ZERO local_board_init_at_Board_size_0 GOTO label_FALSE_53 + lw $t0, -4($fp) + beq $t0, 0, label_FALSE_53 + # IF_ZERO local_board_init_at_Board_internal_43 GOTO label_FALSE_53 + # IF_ZERO local_board_init_at_Board_internal_43 GOTO label_FALSE_53 + lw $t0, -176($fp) + beq $t0, 0, label_FALSE_53 + # LOCAL local_board_init_at_Board_internal_42 --> -172($fp) + # LOCAL local_board_init_at_Board_size_0 --> -4($fp) + # Comparing -4($fp) type with String + la $v0, String + lw $a0, -4($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -172($fp) + # IF_ZERO local_board_init_at_Board_internal_42 GOTO label_COMPARE_STRING_56 + # IF_ZERO local_board_init_at_Board_internal_42 GOTO label_COMPARE_STRING_56 + lw $t0, -172($fp) + beq $t0, 0, label_COMPARE_STRING_56 + # LOCAL local_board_init_at_Board_internal_42 --> -172($fp) + # LOCAL local_board_init_at_Board_size_0 --> -4($fp) + # Comparing -4($fp) type with Bool + la $v0, Bool + lw $a0, -4($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -172($fp) + # IF_ZERO local_board_init_at_Board_internal_42 GOTO label_COMPARE_BY_VALUE_57 + # IF_ZERO local_board_init_at_Board_internal_42 GOTO label_COMPARE_BY_VALUE_57 + lw $t0, -172($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_57 + # LOCAL local_board_init_at_Board_internal_42 --> -172($fp) + # LOCAL local_board_init_at_Board_size_0 --> -4($fp) + # Comparing -4($fp) type with Int + la $v0, Int + lw $a0, -4($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -172($fp) + # IF_ZERO local_board_init_at_Board_internal_42 GOTO label_COMPARE_BY_VALUE_57 + # IF_ZERO local_board_init_at_Board_internal_42 GOTO label_COMPARE_BY_VALUE_57 + lw $t0, -172($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_57 + # LOCAL local_board_init_at_Board_internal_42 --> -172($fp) + # LOCAL local_board_init_at_Board_size_0 --> -4($fp) + # LOCAL local_board_init_at_Board_internal_43 --> -176($fp) + # Load pointers and SUB + lw $a0, -4($fp) + lw $a1, -176($fp) + sub $a0, $a0, $a1 + sw $a0, -172($fp) + # IF_ZERO local_board_init_at_Board_internal_42 GOTO label_TRUE_54 + # IF_ZERO local_board_init_at_Board_internal_42 GOTO label_TRUE_54 + lw $t0, -172($fp) + beq $t0, 0, label_TRUE_54 + # GOTO label_FALSE_53 + j label_FALSE_53 + label_COMPARE_BY_VALUE_57: + # LOCAL local_board_init_at_Board_internal_42 --> -172($fp) + # LOCAL local_board_init_at_Board_size_0 --> -4($fp) + # LOCAL local_board_init_at_Board_internal_43 --> -176($fp) + lw $a0, -4($fp) + lw $a1, -176($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -172($fp) + # IF_ZERO local_board_init_at_Board_internal_42 GOTO label_TRUE_54 + # IF_ZERO local_board_init_at_Board_internal_42 GOTO label_TRUE_54 + lw $t0, -172($fp) + beq $t0, 0, label_TRUE_54 + # GOTO label_FALSE_53 + j label_FALSE_53 + label_COMPARE_STRING_56: + # LOCAL local_board_init_at_Board_internal_42 --> -172($fp) + # LOCAL local_board_init_at_Board_size_0 --> -4($fp) + # LOCAL local_board_init_at_Board_internal_43 --> -176($fp) + # Load strings for comparison + lw $v0, -4($fp) + lw $v1, -176($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -172($fp) + # IF_ZERO local_board_init_at_Board_internal_42 GOTO label_CONTINUE_58 + # IF_ZERO local_board_init_at_Board_internal_42 GOTO label_CONTINUE_58 + lw $t0, -172($fp) + beq $t0, 0, label_CONTINUE_58 + # GOTO label_FALSE_53 + j label_FALSE_53 + label_CONTINUE_58: + # LOCAL local_board_init_at_Board_internal_42 --> -172($fp) + # LOCAL local_board_init_at_Board_size_0 --> -4($fp) + # LOCAL local_board_init_at_Board_internal_43 --> -176($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -4($fp) + lw $v1, -176($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_59: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_60 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_59 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_60: + # Store result + sw $a2, -172($fp) + # IF_ZERO local_board_init_at_Board_internal_42 GOTO label_TRUE_54 + # IF_ZERO local_board_init_at_Board_internal_42 GOTO label_TRUE_54 + lw $t0, -172($fp) + beq $t0, 0, label_TRUE_54 + label_FALSE_53: + # LOCAL local_board_init_at_Board_internal_41 --> -168($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -168($fp) + # GOTO label_END_55 +j label_END_55 +label_TRUE_54: + # LOCAL local_board_init_at_Board_internal_41 --> -168($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -168($fp) + label_END_55: +# LOCAL local_board_init_at_Board_internal_39 --> -160($fp) +# LOCAL local_board_init_at_Board_internal_41 --> -168($fp) +# Obtain value from -168($fp) +lw $v0, -168($fp) +lw $v0, 12($v0) +sw $v0, -160($fp) +# IF_ZERO local_board_init_at_Board_internal_39 GOTO label_FALSEIF_51 +# IF_ZERO local_board_init_at_Board_internal_39 GOTO label_FALSEIF_51 +lw $t0, -160($fp) +beq $t0, 0, label_FALSEIF_51 +# LOCAL local_board_init_at_Board_internal_44 --> -180($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 7 +sw $t0, 12($v0) +sw $v0, -180($fp) +# +# LOCAL local_board_init_at_Board_internal_44 --> -180($fp) +lw $t0, -180($fp) +sw $t0, 12($s1) +# LOCAL local_board_init_at_Board_internal_45 --> -184($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 4 +sw $t0, 12($v0) +sw $v0, -184($fp) +# +# LOCAL local_board_init_at_Board_internal_45 --> -184($fp) +lw $t0, -184($fp) +sw $t0, 16($s1) +# +# LOCAL local_board_init_at_Board_size_0 --> -4($fp) +lw $t0, -4($fp) +sw $t0, 20($s1) +# LOCAL local_board_init_at_Board_internal_40 --> -164($fp) +# local_board_init_at_Board_internal_40 = +# GOTO label_ENDIF_52 +j label_ENDIF_52 +label_FALSEIF_51: + # LOCAL local_board_init_at_Board_internal_46 --> -188($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 5 + sw $t0, 12($v0) + sw $v0, -188($fp) + # + # LOCAL local_board_init_at_Board_internal_46 --> -188($fp) + lw $t0, -188($fp) + sw $t0, 12($s1) + # LOCAL local_board_init_at_Board_internal_47 --> -192($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 5 + sw $t0, 12($v0) + sw $v0, -192($fp) + # + # LOCAL local_board_init_at_Board_internal_47 --> -192($fp) + lw $t0, -192($fp) + sw $t0, 16($s1) + # + # LOCAL local_board_init_at_Board_size_0 --> -4($fp) + lw $t0, -4($fp) + sw $t0, 20($s1) + # LOCAL local_board_init_at_Board_internal_40 --> -164($fp) + # local_board_init_at_Board_internal_40 = + label_ENDIF_52: +# LOCAL local_board_init_at_Board_internal_33 --> -136($fp) +# LOCAL local_board_init_at_Board_internal_40 --> -164($fp) +# local_board_init_at_Board_internal_33 = local_board_init_at_Board_internal_40 +lw $t0, -164($fp) +sw $t0, -136($fp) +label_ENDIF_42: +# LOCAL local_board_init_at_Board_internal_26 --> -108($fp) +# LOCAL local_board_init_at_Board_internal_33 --> -136($fp) +# local_board_init_at_Board_internal_26 = local_board_init_at_Board_internal_33 +lw $t0, -136($fp) +sw $t0, -108($fp) +label_ENDIF_32: +# LOCAL local_board_init_at_Board_internal_19 --> -80($fp) +# LOCAL local_board_init_at_Board_internal_26 --> -108($fp) +# local_board_init_at_Board_internal_19 = local_board_init_at_Board_internal_26 +lw $t0, -108($fp) +sw $t0, -80($fp) +label_ENDIF_22: +# LOCAL local_board_init_at_Board_internal_12 --> -52($fp) +# LOCAL local_board_init_at_Board_internal_19 --> -80($fp) +# local_board_init_at_Board_internal_12 = local_board_init_at_Board_internal_19 +lw $t0, -80($fp) +sw $t0, -52($fp) +label_ENDIF_12: +# LOCAL local_board_init_at_Board_internal_5 --> -24($fp) +# LOCAL local_board_init_at_Board_internal_12 --> -52($fp) +# local_board_init_at_Board_internal_5 = local_board_init_at_Board_internal_12 +lw $t0, -52($fp) +sw $t0, -24($fp) +label_ENDIF_2: +# LOCAL local_board_init_at_Board_internal_48 --> -196($fp) +# local_board_init_at_Board_internal_48 = SELF +sw $s1, -196($fp) +# RETURN local_board_init_at_Board_internal_48 +lw $v0, -196($fp) +# Deallocate stack frame for function function_board_init_at_Board. +# Restore $ra +lw $ra, 4($sp) +# Restore $fp +lw $fp, 0($sp) +# Restore Stack pointer $sp +addu $sp, $sp, 204 +# Deallocate function args +addu $sp, $sp, 4 +jr $ra +# Function END + + +# __CellularAutomaton__attrib__population_map__init implementation. +# @Params: +__CellularAutomaton__attrib__population_map__init: + # Allocate stack frame for function __CellularAutomaton__attrib__population_map__init. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_rAutomaton__attrib__population_map__init_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_0 + sw $t0, 12($v0) + li $t0, 0 + sw $t0, 16($v0) + sw $v0, -4($fp) + # RETURN local_rAutomaton__attrib__population_map__init_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function __CellularAutomaton__attrib__population_map__init. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_init_at_CellularAutomaton implementation. +# @Params: +# 0($fp) = param_init_at_CellularAutomaton_map_0 +function_init_at_CellularAutomaton: + # Allocate stack frame for function function_init_at_CellularAutomaton. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # + # PARAM param_init_at_CellularAutomaton_map_0 --> 0($fp) + lw $t0, 0($fp) + sw $t0, 24($s1) + # LOCAL local_init_at_CellularAutomaton_internal_2 --> -12($fp) + # local_init_at_CellularAutomaton_internal_2 = SELF + sw $s1, -12($fp) + # LOCAL local_init_at_CellularAutomaton_internal_0 --> -4($fp) + # LOCAL local_init_at_CellularAutomaton_internal_2 --> -12($fp) + # local_init_at_CellularAutomaton_internal_0 = local_init_at_CellularAutomaton_internal_2 + lw $t0, -12($fp) + sw $t0, -4($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # ARG param_init_at_CellularAutomaton_map_0 + # PARAM param_init_at_CellularAutomaton_map_0 --> 0($fp) + lw $t0, 0($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_init_at_CellularAutomaton_internal_0 --> -4($fp) + # LOCAL local_init_at_CellularAutomaton_internal_1 --> -8($fp) + # local_init_at_CellularAutomaton_internal_1 = VCALL local_init_at_CellularAutomaton_internal_0 board_init + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 4($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -8($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_init_at_CellularAutomaton_internal_3 --> -16($fp) + # local_init_at_CellularAutomaton_internal_3 = SELF + sw $s1, -16($fp) + # RETURN local_init_at_CellularAutomaton_internal_3 + lw $v0, -16($fp) + # Deallocate stack frame for function function_init_at_CellularAutomaton. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_print_at_CellularAutomaton implementation. +# @Params: +function_print_at_CellularAutomaton: + # Allocate stack frame for function function_print_at_CellularAutomaton. + subu $sp, $sp, 120 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 120 + # LOCAL local_print_at_CellularAutomaton_i_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -4($fp) + # LOCAL local_print_at_CellularAutomaton_internal_1 --> -8($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -8($fp) + # LOCAL local_print_at_CellularAutomaton_i_0 --> -4($fp) + # LOCAL local_print_at_CellularAutomaton_internal_1 --> -8($fp) + # local_print_at_CellularAutomaton_i_0 = local_print_at_CellularAutomaton_internal_1 + lw $t0, -8($fp) + sw $t0, -4($fp) + # LOCAL local_print_at_CellularAutomaton_num_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -12($fp) + # local_print_at_CellularAutomaton_internal_3 = GETATTRIBUTE board_size CellularAutomaton + # LOCAL local_print_at_CellularAutomaton_internal_3 --> -16($fp) + lw $t0, 20($s1) + sw $t0, -16($fp) + # LOCAL local_print_at_CellularAutomaton_num_2 --> -12($fp) + # LOCAL local_print_at_CellularAutomaton_internal_3 --> -16($fp) + # local_print_at_CellularAutomaton_num_2 = local_print_at_CellularAutomaton_internal_3 + lw $t0, -16($fp) + sw $t0, -12($fp) + # LOCAL local_print_at_CellularAutomaton_internal_6 --> -28($fp) + # local_print_at_CellularAutomaton_internal_6 = SELF + sw $s1, -28($fp) + # LOCAL local_print_at_CellularAutomaton_internal_4 --> -20($fp) + # LOCAL local_print_at_CellularAutomaton_internal_6 --> -28($fp) + # local_print_at_CellularAutomaton_internal_4 = local_print_at_CellularAutomaton_internal_6 + lw $t0, -28($fp) + sw $t0, -20($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_print_at_CellularAutomaton_internal_7 --> -32($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_4 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -32($fp) + # ARG local_print_at_CellularAutomaton_internal_7 + # LOCAL local_print_at_CellularAutomaton_internal_7 --> -32($fp) + lw $t0, -32($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_print_at_CellularAutomaton_internal_4 --> -20($fp) + # LOCAL local_print_at_CellularAutomaton_internal_5 --> -24($fp) + # local_print_at_CellularAutomaton_internal_5 = VCALL local_print_at_CellularAutomaton_internal_4 out_string + # Save new self pointer in $s1 + lw $s1, -20($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 92($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -24($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + label_WHILE_61: + # LOCAL local_print_at_CellularAutomaton_internal_9 --> -40($fp) + # LOCAL local_print_at_CellularAutomaton_i_0 --> -4($fp) + # LOCAL local_print_at_CellularAutomaton_num_2 --> -12($fp) + lw $a0, -4($fp) + lw $a1, -12($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -40($fp) + # IF_GREATER_ZERO local_print_at_CellularAutomaton_internal_9 GOTO label_FALSE_63 + # IF_GREATER_ZERO local_print_at_CellularAutomaton_internal_9 GOTO label_FALSE_63 + lw $t0, -40($fp) + bgt $t0, 0, label_FALSE_63 + # IF_ZERO local_print_at_CellularAutomaton_internal_9 GOTO label_FALSE_63 + # IF_ZERO local_print_at_CellularAutomaton_internal_9 GOTO label_FALSE_63 + lw $t0, -40($fp) + beq $t0, 0, label_FALSE_63 + # LOCAL local_print_at_CellularAutomaton_internal_9 --> -40($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -40($fp) + # GOTO label_END_64 +j label_END_64 +label_FALSE_63: + # LOCAL local_print_at_CellularAutomaton_internal_9 --> -40($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -40($fp) + label_END_64: +# LOCAL local_print_at_CellularAutomaton_internal_8 --> -36($fp) +# LOCAL local_print_at_CellularAutomaton_internal_9 --> -40($fp) +# Obtain value from -40($fp) +lw $v0, -40($fp) +lw $v0, 12($v0) +sw $v0, -36($fp) +# IF_ZERO local_print_at_CellularAutomaton_internal_8 GOTO label_WHILE_END_62 +# IF_ZERO local_print_at_CellularAutomaton_internal_8 GOTO label_WHILE_END_62 +lw $t0, -36($fp) +beq $t0, 0, label_WHILE_END_62 +# LOCAL local_print_at_CellularAutomaton_internal_12 --> -52($fp) +# local_print_at_CellularAutomaton_internal_12 = SELF +sw $s1, -52($fp) +# LOCAL local_print_at_CellularAutomaton_internal_10 --> -44($fp) +# LOCAL local_print_at_CellularAutomaton_internal_12 --> -52($fp) +# local_print_at_CellularAutomaton_internal_10 = local_print_at_CellularAutomaton_internal_12 +lw $t0, -52($fp) +sw $t0, -44($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# local_print_at_CellularAutomaton_internal_15 = GETATTRIBUTE population_map CellularAutomaton +# LOCAL local_print_at_CellularAutomaton_internal_15 --> -64($fp) +lw $t0, 24($s1) +sw $t0, -64($fp) +# LOCAL local_print_at_CellularAutomaton_internal_13 --> -56($fp) +# LOCAL local_print_at_CellularAutomaton_internal_15 --> -64($fp) +# local_print_at_CellularAutomaton_internal_13 = local_print_at_CellularAutomaton_internal_15 +lw $t0, -64($fp) +sw $t0, -56($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# ARG local_print_at_CellularAutomaton_i_0 +# LOCAL local_print_at_CellularAutomaton_i_0 --> -4($fp) +lw $t0, -4($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# local_print_at_CellularAutomaton_internal_16 = GETATTRIBUTE columns CellularAutomaton +# LOCAL local_print_at_CellularAutomaton_internal_16 --> -68($fp) +lw $t0, 16($s1) +sw $t0, -68($fp) +# ARG local_print_at_CellularAutomaton_internal_16 +# LOCAL local_print_at_CellularAutomaton_internal_16 --> -68($fp) +lw $t0, -68($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_print_at_CellularAutomaton_internal_13 --> -56($fp) +# LOCAL local_print_at_CellularAutomaton_internal_14 --> -60($fp) +# local_print_at_CellularAutomaton_internal_14 = VCALL local_print_at_CellularAutomaton_internal_13 substr +# Save new self pointer in $s1 +lw $s1, -56($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 20($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -60($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# ARG local_print_at_CellularAutomaton_internal_14 +# LOCAL local_print_at_CellularAutomaton_internal_14 --> -60($fp) +lw $t0, -60($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_print_at_CellularAutomaton_internal_10 --> -44($fp) +# LOCAL local_print_at_CellularAutomaton_internal_11 --> -48($fp) +# local_print_at_CellularAutomaton_internal_11 = VCALL local_print_at_CellularAutomaton_internal_10 out_string +# Save new self pointer in $s1 +lw $s1, -44($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 92($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -48($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_print_at_CellularAutomaton_internal_19 --> -80($fp) +# local_print_at_CellularAutomaton_internal_19 = SELF +sw $s1, -80($fp) +# LOCAL local_print_at_CellularAutomaton_internal_17 --> -72($fp) +# LOCAL local_print_at_CellularAutomaton_internal_19 --> -80($fp) +# local_print_at_CellularAutomaton_internal_17 = local_print_at_CellularAutomaton_internal_19 +lw $t0, -80($fp) +sw $t0, -72($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_print_at_CellularAutomaton_internal_20 --> -84($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_5 +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +sw $v0, -84($fp) +# ARG local_print_at_CellularAutomaton_internal_20 +# LOCAL local_print_at_CellularAutomaton_internal_20 --> -84($fp) +lw $t0, -84($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_print_at_CellularAutomaton_internal_17 --> -72($fp) +# LOCAL local_print_at_CellularAutomaton_internal_18 --> -76($fp) +# local_print_at_CellularAutomaton_internal_18 = VCALL local_print_at_CellularAutomaton_internal_17 out_string +# Save new self pointer in $s1 +lw $s1, -72($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 92($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -76($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# local_print_at_CellularAutomaton_internal_22 = GETATTRIBUTE columns CellularAutomaton +# LOCAL local_print_at_CellularAutomaton_internal_22 --> -92($fp) +lw $t0, 16($s1) +sw $t0, -92($fp) +# LOCAL local_print_at_CellularAutomaton_internal_21 --> -88($fp) +# LOCAL local_print_at_CellularAutomaton_i_0 --> -4($fp) +# LOCAL local_print_at_CellularAutomaton_internal_22 --> -92($fp) +# local_print_at_CellularAutomaton_internal_21 = local_print_at_CellularAutomaton_i_0 + local_print_at_CellularAutomaton_internal_22 +lw $t1, -4($fp) +lw $t0, 12($t1) +lw $t1, -92($fp) +lw $t2, 12($t1) +add $t0, $t0, $t2 +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t1, String +sw $t1, 0($v0) +la $t1, String_start +sw $t1, 4($v0) +# Load type offset +li $t1, 8 +sw $t1, 8($v0) +la $t1, Int +sw $t1, 12($v0) +li $t1, 3 +sw $t1, 16($v0) +move $t1, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t1, 0($v0) +la $t1, Int_start +sw $t1, 4($v0) +# Load type offset +li $t1, 16 +sw $t1, 8($v0) +sw $t0, 12($v0) +sw $v0, -88($fp) +# LOCAL local_print_at_CellularAutomaton_i_0 --> -4($fp) +# LOCAL local_print_at_CellularAutomaton_internal_21 --> -88($fp) +# local_print_at_CellularAutomaton_i_0 = local_print_at_CellularAutomaton_internal_21 +lw $t0, -88($fp) +sw $t0, -4($fp) +# GOTO label_WHILE_61 +j label_WHILE_61 +label_WHILE_END_62: + # LOCAL local_print_at_CellularAutomaton_internal_25 --> -104($fp) + # local_print_at_CellularAutomaton_internal_25 = SELF + sw $s1, -104($fp) + # LOCAL local_print_at_CellularAutomaton_internal_23 --> -96($fp) + # LOCAL local_print_at_CellularAutomaton_internal_25 --> -104($fp) + # local_print_at_CellularAutomaton_internal_23 = local_print_at_CellularAutomaton_internal_25 + lw $t0, -104($fp) + sw $t0, -96($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_print_at_CellularAutomaton_internal_26 --> -108($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_6 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -108($fp) + # ARG local_print_at_CellularAutomaton_internal_26 + # LOCAL local_print_at_CellularAutomaton_internal_26 --> -108($fp) + lw $t0, -108($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_print_at_CellularAutomaton_internal_23 --> -96($fp) + # LOCAL local_print_at_CellularAutomaton_internal_24 --> -100($fp) + # local_print_at_CellularAutomaton_internal_24 = VCALL local_print_at_CellularAutomaton_internal_23 out_string + # Save new self pointer in $s1 + lw $s1, -96($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 92($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -100($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_print_at_CellularAutomaton_internal_27 --> -112($fp) + # local_print_at_CellularAutomaton_internal_27 = SELF + sw $s1, -112($fp) + # RETURN local_print_at_CellularAutomaton_internal_27 + lw $v0, -112($fp) + # Deallocate stack frame for function function_print_at_CellularAutomaton. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 120 + jr $ra + # Function END + + +# function_num_cells_at_CellularAutomaton implementation. +# @Params: +function_num_cells_at_CellularAutomaton: + # Allocate stack frame for function function_num_cells_at_CellularAutomaton. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_num_cells_at_CellularAutomaton_internal_2 = GETATTRIBUTE population_map CellularAutomaton + # LOCAL local_num_cells_at_CellularAutomaton_internal_2 --> -12($fp) + lw $t0, 24($s1) + sw $t0, -12($fp) + # LOCAL local_num_cells_at_CellularAutomaton_internal_0 --> -4($fp) + # LOCAL local_num_cells_at_CellularAutomaton_internal_2 --> -12($fp) + # local_num_cells_at_CellularAutomaton_internal_0 = local_num_cells_at_CellularAutomaton_internal_2 + lw $t0, -12($fp) + sw $t0, -4($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_num_cells_at_CellularAutomaton_internal_0 --> -4($fp) + # LOCAL local_num_cells_at_CellularAutomaton_internal_1 --> -8($fp) + # local_num_cells_at_CellularAutomaton_internal_1 = VCALL local_num_cells_at_CellularAutomaton_internal_0 length + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 40($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -8($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # RETURN local_num_cells_at_CellularAutomaton_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function function_num_cells_at_CellularAutomaton. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_cell_at_CellularAutomaton implementation. +# @Params: +# 0($fp) = param_cell_at_CellularAutomaton_position_0 +function_cell_at_CellularAutomaton: + # Allocate stack frame for function function_cell_at_CellularAutomaton. + subu $sp, $sp, 52 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 52 + # local_cell_at_CellularAutomaton_internal_4 = GETATTRIBUTE board_size CellularAutomaton + # LOCAL local_cell_at_CellularAutomaton_internal_4 --> -20($fp) + lw $t0, 20($s1) + sw $t0, -20($fp) + # LOCAL local_cell_at_CellularAutomaton_internal_5 --> -24($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -24($fp) + # LOCAL local_cell_at_CellularAutomaton_internal_3 --> -16($fp) + # LOCAL local_cell_at_CellularAutomaton_internal_4 --> -20($fp) + # LOCAL local_cell_at_CellularAutomaton_internal_5 --> -24($fp) + # local_cell_at_CellularAutomaton_internal_3 = local_cell_at_CellularAutomaton_internal_4 - local_cell_at_CellularAutomaton_internal_5 + lw $t1, -20($fp) + lw $t0, 12($t1) + lw $t1, -24($fp) + lw $t2, 12($t1) + sub $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -16($fp) + # LOCAL local_cell_at_CellularAutomaton_internal_2 --> -12($fp) + # LOCAL local_cell_at_CellularAutomaton_internal_3 --> -16($fp) + # PARAM param_cell_at_CellularAutomaton_position_0 --> 0($fp) + lw $a0, -16($fp) + lw $a1, 0($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -12($fp) + # IF_GREATER_ZERO local_cell_at_CellularAutomaton_internal_2 GOTO label_FALSE_67 + # IF_GREATER_ZERO local_cell_at_CellularAutomaton_internal_2 GOTO label_FALSE_67 + lw $t0, -12($fp) + bgt $t0, 0, label_FALSE_67 + # IF_ZERO local_cell_at_CellularAutomaton_internal_2 GOTO label_FALSE_67 + # IF_ZERO local_cell_at_CellularAutomaton_internal_2 GOTO label_FALSE_67 + lw $t0, -12($fp) + beq $t0, 0, label_FALSE_67 + # LOCAL local_cell_at_CellularAutomaton_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -12($fp) + # GOTO label_END_68 +j label_END_68 +label_FALSE_67: + # LOCAL local_cell_at_CellularAutomaton_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -12($fp) + label_END_68: +# LOCAL local_cell_at_CellularAutomaton_internal_0 --> -4($fp) +# LOCAL local_cell_at_CellularAutomaton_internal_2 --> -12($fp) +# Obtain value from -12($fp) +lw $v0, -12($fp) +lw $v0, 12($v0) +sw $v0, -4($fp) +# IF_ZERO local_cell_at_CellularAutomaton_internal_0 GOTO label_FALSEIF_65 +# IF_ZERO local_cell_at_CellularAutomaton_internal_0 GOTO label_FALSEIF_65 +lw $t0, -4($fp) +beq $t0, 0, label_FALSEIF_65 +# LOCAL local_cell_at_CellularAutomaton_internal_6 --> -28($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_7 +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +sw $v0, -28($fp) +# LOCAL local_cell_at_CellularAutomaton_internal_1 --> -8($fp) +# LOCAL local_cell_at_CellularAutomaton_internal_6 --> -28($fp) +# local_cell_at_CellularAutomaton_internal_1 = local_cell_at_CellularAutomaton_internal_6 +lw $t0, -28($fp) +sw $t0, -8($fp) +# GOTO label_ENDIF_66 +j label_ENDIF_66 +label_FALSEIF_65: + # local_cell_at_CellularAutomaton_internal_9 = GETATTRIBUTE population_map CellularAutomaton + # LOCAL local_cell_at_CellularAutomaton_internal_9 --> -40($fp) + lw $t0, 24($s1) + sw $t0, -40($fp) + # LOCAL local_cell_at_CellularAutomaton_internal_7 --> -32($fp) + # LOCAL local_cell_at_CellularAutomaton_internal_9 --> -40($fp) + # local_cell_at_CellularAutomaton_internal_7 = local_cell_at_CellularAutomaton_internal_9 + lw $t0, -40($fp) + sw $t0, -32($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # ARG param_cell_at_CellularAutomaton_position_0 + # PARAM param_cell_at_CellularAutomaton_position_0 --> 0($fp) + lw $t0, 0($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_cell_at_CellularAutomaton_internal_10 --> -44($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -44($fp) + # ARG local_cell_at_CellularAutomaton_internal_10 + # LOCAL local_cell_at_CellularAutomaton_internal_10 --> -44($fp) + lw $t0, -44($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_cell_at_CellularAutomaton_internal_7 --> -32($fp) + # LOCAL local_cell_at_CellularAutomaton_internal_8 --> -36($fp) + # local_cell_at_CellularAutomaton_internal_8 = VCALL local_cell_at_CellularAutomaton_internal_7 substr + # Save new self pointer in $s1 + lw $s1, -32($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 20($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -36($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_cell_at_CellularAutomaton_internal_1 --> -8($fp) + # LOCAL local_cell_at_CellularAutomaton_internal_8 --> -36($fp) + # local_cell_at_CellularAutomaton_internal_1 = local_cell_at_CellularAutomaton_internal_8 + lw $t0, -36($fp) + sw $t0, -8($fp) + label_ENDIF_66: +# RETURN local_cell_at_CellularAutomaton_internal_1 +lw $v0, -8($fp) +# Deallocate stack frame for function function_cell_at_CellularAutomaton. +# Restore $ra +lw $ra, 4($sp) +# Restore $fp +lw $fp, 0($sp) +# Restore Stack pointer $sp +addu $sp, $sp, 52 +# Deallocate function args +addu $sp, $sp, 4 +jr $ra +# Function END + + +# function_north_at_CellularAutomaton implementation. +# @Params: +# 0($fp) = param_north_at_CellularAutomaton_position_0 +function_north_at_CellularAutomaton: + # Allocate stack frame for function function_north_at_CellularAutomaton. + subu $sp, $sp, 56 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 56 + # local_north_at_CellularAutomaton_internal_4 = GETATTRIBUTE columns CellularAutomaton + # LOCAL local_north_at_CellularAutomaton_internal_4 --> -20($fp) + lw $t0, 16($s1) + sw $t0, -20($fp) + # LOCAL local_north_at_CellularAutomaton_internal_3 --> -16($fp) + # PARAM param_north_at_CellularAutomaton_position_0 --> 0($fp) + # LOCAL local_north_at_CellularAutomaton_internal_4 --> -20($fp) + # local_north_at_CellularAutomaton_internal_3 = PARAM param_north_at_CellularAutomaton_position_0 - local_north_at_CellularAutomaton_internal_4 + lw $t1, 0($fp) + lw $t0, 12($t1) + lw $t1, -20($fp) + lw $t2, 12($t1) + sub $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -16($fp) + # LOCAL local_north_at_CellularAutomaton_internal_5 --> -24($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -24($fp) + # LOCAL local_north_at_CellularAutomaton_internal_2 --> -12($fp) + # LOCAL local_north_at_CellularAutomaton_internal_3 --> -16($fp) + # LOCAL local_north_at_CellularAutomaton_internal_5 --> -24($fp) + lw $a0, -16($fp) + lw $a1, -24($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -12($fp) + # IF_GREATER_ZERO local_north_at_CellularAutomaton_internal_2 GOTO label_FALSE_71 + # IF_GREATER_ZERO local_north_at_CellularAutomaton_internal_2 GOTO label_FALSE_71 + lw $t0, -12($fp) + bgt $t0, 0, label_FALSE_71 + # IF_ZERO local_north_at_CellularAutomaton_internal_2 GOTO label_FALSE_71 + # IF_ZERO local_north_at_CellularAutomaton_internal_2 GOTO label_FALSE_71 + lw $t0, -12($fp) + beq $t0, 0, label_FALSE_71 + # LOCAL local_north_at_CellularAutomaton_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -12($fp) + # GOTO label_END_72 +j label_END_72 +label_FALSE_71: + # LOCAL local_north_at_CellularAutomaton_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -12($fp) + label_END_72: +# LOCAL local_north_at_CellularAutomaton_internal_0 --> -4($fp) +# LOCAL local_north_at_CellularAutomaton_internal_2 --> -12($fp) +# Obtain value from -12($fp) +lw $v0, -12($fp) +lw $v0, 12($v0) +sw $v0, -4($fp) +# IF_ZERO local_north_at_CellularAutomaton_internal_0 GOTO label_FALSEIF_69 +# IF_ZERO local_north_at_CellularAutomaton_internal_0 GOTO label_FALSEIF_69 +lw $t0, -4($fp) +beq $t0, 0, label_FALSEIF_69 +# LOCAL local_north_at_CellularAutomaton_internal_6 --> -28($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_8 +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +sw $v0, -28($fp) +# LOCAL local_north_at_CellularAutomaton_internal_1 --> -8($fp) +# LOCAL local_north_at_CellularAutomaton_internal_6 --> -28($fp) +# local_north_at_CellularAutomaton_internal_1 = local_north_at_CellularAutomaton_internal_6 +lw $t0, -28($fp) +sw $t0, -8($fp) +# GOTO label_ENDIF_70 +j label_ENDIF_70 +label_FALSEIF_69: + # LOCAL local_north_at_CellularAutomaton_internal_9 --> -40($fp) + # local_north_at_CellularAutomaton_internal_9 = SELF + sw $s1, -40($fp) + # LOCAL local_north_at_CellularAutomaton_internal_7 --> -32($fp) + # LOCAL local_north_at_CellularAutomaton_internal_9 --> -40($fp) + # local_north_at_CellularAutomaton_internal_7 = local_north_at_CellularAutomaton_internal_9 + lw $t0, -40($fp) + sw $t0, -32($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # local_north_at_CellularAutomaton_internal_11 = GETATTRIBUTE columns CellularAutomaton + # LOCAL local_north_at_CellularAutomaton_internal_11 --> -48($fp) + lw $t0, 16($s1) + sw $t0, -48($fp) + # LOCAL local_north_at_CellularAutomaton_internal_10 --> -44($fp) + # PARAM param_north_at_CellularAutomaton_position_0 --> 0($fp) + # LOCAL local_north_at_CellularAutomaton_internal_11 --> -48($fp) + # local_north_at_CellularAutomaton_internal_10 = PARAM param_north_at_CellularAutomaton_position_0 - local_north_at_CellularAutomaton_internal_11 + lw $t1, 0($fp) + lw $t0, 12($t1) + lw $t1, -48($fp) + lw $t2, 12($t1) + sub $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -44($fp) + # ARG local_north_at_CellularAutomaton_internal_10 + # LOCAL local_north_at_CellularAutomaton_internal_10 --> -44($fp) + lw $t0, -44($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_north_at_CellularAutomaton_internal_7 --> -32($fp) + # LOCAL local_north_at_CellularAutomaton_internal_8 --> -36($fp) + # local_north_at_CellularAutomaton_internal_8 = VCALL local_north_at_CellularAutomaton_internal_7 cell + # Save new self pointer in $s1 + lw $s1, -32($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 100($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -36($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_north_at_CellularAutomaton_internal_1 --> -8($fp) + # LOCAL local_north_at_CellularAutomaton_internal_8 --> -36($fp) + # local_north_at_CellularAutomaton_internal_1 = local_north_at_CellularAutomaton_internal_8 + lw $t0, -36($fp) + sw $t0, -8($fp) + label_ENDIF_70: +# RETURN local_north_at_CellularAutomaton_internal_1 +lw $v0, -8($fp) +# Deallocate stack frame for function function_north_at_CellularAutomaton. +# Restore $ra +lw $ra, 4($sp) +# Restore $fp +lw $fp, 0($sp) +# Restore Stack pointer $sp +addu $sp, $sp, 56 +# Deallocate function args +addu $sp, $sp, 4 +jr $ra +# Function END + + +# function_south_at_CellularAutomaton implementation. +# @Params: +# 0($fp) = param_south_at_CellularAutomaton_position_0 +function_south_at_CellularAutomaton: + # Allocate stack frame for function function_south_at_CellularAutomaton. + subu $sp, $sp, 56 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 56 + # local_south_at_CellularAutomaton_internal_3 = GETATTRIBUTE board_size CellularAutomaton + # LOCAL local_south_at_CellularAutomaton_internal_3 --> -16($fp) + lw $t0, 20($s1) + sw $t0, -16($fp) + # local_south_at_CellularAutomaton_internal_5 = GETATTRIBUTE columns CellularAutomaton + # LOCAL local_south_at_CellularAutomaton_internal_5 --> -24($fp) + lw $t0, 16($s1) + sw $t0, -24($fp) + # LOCAL local_south_at_CellularAutomaton_internal_4 --> -20($fp) + # PARAM param_south_at_CellularAutomaton_position_0 --> 0($fp) + # LOCAL local_south_at_CellularAutomaton_internal_5 --> -24($fp) + # local_south_at_CellularAutomaton_internal_4 = PARAM param_south_at_CellularAutomaton_position_0 + local_south_at_CellularAutomaton_internal_5 + lw $t1, 0($fp) + lw $t0, 12($t1) + lw $t1, -24($fp) + lw $t2, 12($t1) + add $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -20($fp) + # LOCAL local_south_at_CellularAutomaton_internal_2 --> -12($fp) + # LOCAL local_south_at_CellularAutomaton_internal_3 --> -16($fp) + # LOCAL local_south_at_CellularAutomaton_internal_4 --> -20($fp) + lw $a0, -16($fp) + lw $a1, -20($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -12($fp) + # IF_GREATER_ZERO local_south_at_CellularAutomaton_internal_2 GOTO label_FALSE_75 + # IF_GREATER_ZERO local_south_at_CellularAutomaton_internal_2 GOTO label_FALSE_75 + lw $t0, -12($fp) + bgt $t0, 0, label_FALSE_75 + # IF_ZERO local_south_at_CellularAutomaton_internal_2 GOTO label_FALSE_75 + # IF_ZERO local_south_at_CellularAutomaton_internal_2 GOTO label_FALSE_75 + lw $t0, -12($fp) + beq $t0, 0, label_FALSE_75 + # LOCAL local_south_at_CellularAutomaton_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -12($fp) + # GOTO label_END_76 +j label_END_76 +label_FALSE_75: + # LOCAL local_south_at_CellularAutomaton_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -12($fp) + label_END_76: +# LOCAL local_south_at_CellularAutomaton_internal_0 --> -4($fp) +# LOCAL local_south_at_CellularAutomaton_internal_2 --> -12($fp) +# Obtain value from -12($fp) +lw $v0, -12($fp) +lw $v0, 12($v0) +sw $v0, -4($fp) +# IF_ZERO local_south_at_CellularAutomaton_internal_0 GOTO label_FALSEIF_73 +# IF_ZERO local_south_at_CellularAutomaton_internal_0 GOTO label_FALSEIF_73 +lw $t0, -4($fp) +beq $t0, 0, label_FALSEIF_73 +# LOCAL local_south_at_CellularAutomaton_internal_6 --> -28($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_9 +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +sw $v0, -28($fp) +# LOCAL local_south_at_CellularAutomaton_internal_1 --> -8($fp) +# LOCAL local_south_at_CellularAutomaton_internal_6 --> -28($fp) +# local_south_at_CellularAutomaton_internal_1 = local_south_at_CellularAutomaton_internal_6 +lw $t0, -28($fp) +sw $t0, -8($fp) +# GOTO label_ENDIF_74 +j label_ENDIF_74 +label_FALSEIF_73: + # LOCAL local_south_at_CellularAutomaton_internal_9 --> -40($fp) + # local_south_at_CellularAutomaton_internal_9 = SELF + sw $s1, -40($fp) + # LOCAL local_south_at_CellularAutomaton_internal_7 --> -32($fp) + # LOCAL local_south_at_CellularAutomaton_internal_9 --> -40($fp) + # local_south_at_CellularAutomaton_internal_7 = local_south_at_CellularAutomaton_internal_9 + lw $t0, -40($fp) + sw $t0, -32($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # local_south_at_CellularAutomaton_internal_11 = GETATTRIBUTE columns CellularAutomaton + # LOCAL local_south_at_CellularAutomaton_internal_11 --> -48($fp) + lw $t0, 16($s1) + sw $t0, -48($fp) + # LOCAL local_south_at_CellularAutomaton_internal_10 --> -44($fp) + # PARAM param_south_at_CellularAutomaton_position_0 --> 0($fp) + # LOCAL local_south_at_CellularAutomaton_internal_11 --> -48($fp) + # local_south_at_CellularAutomaton_internal_10 = PARAM param_south_at_CellularAutomaton_position_0 + local_south_at_CellularAutomaton_internal_11 + lw $t1, 0($fp) + lw $t0, 12($t1) + lw $t1, -48($fp) + lw $t2, 12($t1) + add $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -44($fp) + # ARG local_south_at_CellularAutomaton_internal_10 + # LOCAL local_south_at_CellularAutomaton_internal_10 --> -44($fp) + lw $t0, -44($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_south_at_CellularAutomaton_internal_7 --> -32($fp) + # LOCAL local_south_at_CellularAutomaton_internal_8 --> -36($fp) + # local_south_at_CellularAutomaton_internal_8 = VCALL local_south_at_CellularAutomaton_internal_7 cell + # Save new self pointer in $s1 + lw $s1, -32($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 100($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -36($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_south_at_CellularAutomaton_internal_1 --> -8($fp) + # LOCAL local_south_at_CellularAutomaton_internal_8 --> -36($fp) + # local_south_at_CellularAutomaton_internal_1 = local_south_at_CellularAutomaton_internal_8 + lw $t0, -36($fp) + sw $t0, -8($fp) + label_ENDIF_74: +# RETURN local_south_at_CellularAutomaton_internal_1 +lw $v0, -8($fp) +# Deallocate stack frame for function function_south_at_CellularAutomaton. +# Restore $ra +lw $ra, 4($sp) +# Restore $fp +lw $fp, 0($sp) +# Restore Stack pointer $sp +addu $sp, $sp, 56 +# Deallocate function args +addu $sp, $sp, 4 +jr $ra +# Function END + + +# function_east_at_CellularAutomaton implementation. +# @Params: +# 0($fp) = param_east_at_CellularAutomaton_position_0 +function_east_at_CellularAutomaton: + # Allocate stack frame for function function_east_at_CellularAutomaton. + subu $sp, $sp, 80 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 80 + # LOCAL local_east_at_CellularAutomaton_internal_7 --> -32($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -32($fp) + # LOCAL local_east_at_CellularAutomaton_internal_6 --> -28($fp) + # PARAM param_east_at_CellularAutomaton_position_0 --> 0($fp) + # LOCAL local_east_at_CellularAutomaton_internal_7 --> -32($fp) + # local_east_at_CellularAutomaton_internal_6 = PARAM param_east_at_CellularAutomaton_position_0 + local_east_at_CellularAutomaton_internal_7 + lw $t1, 0($fp) + lw $t0, 12($t1) + lw $t1, -32($fp) + lw $t2, 12($t1) + add $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -28($fp) + # local_east_at_CellularAutomaton_internal_8 = GETATTRIBUTE columns CellularAutomaton + # LOCAL local_east_at_CellularAutomaton_internal_8 --> -36($fp) + lw $t0, 16($s1) + sw $t0, -36($fp) + # LOCAL local_east_at_CellularAutomaton_internal_5 --> -24($fp) + # LOCAL local_east_at_CellularAutomaton_internal_6 --> -28($fp) + # LOCAL local_east_at_CellularAutomaton_internal_8 --> -36($fp) + # local_east_at_CellularAutomaton_internal_5 = local_east_at_CellularAutomaton_internal_6 / local_east_at_CellularAutomaton_internal_8 + lw $t1, -28($fp) + lw $t0, 12($t1) + lw $t1, -36($fp) + lw $t2, 12($t1) + div $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -24($fp) + # local_east_at_CellularAutomaton_internal_9 = GETATTRIBUTE columns CellularAutomaton + # LOCAL local_east_at_CellularAutomaton_internal_9 --> -40($fp) + lw $t0, 16($s1) + sw $t0, -40($fp) + # LOCAL local_east_at_CellularAutomaton_internal_4 --> -20($fp) + # LOCAL local_east_at_CellularAutomaton_internal_5 --> -24($fp) + # LOCAL local_east_at_CellularAutomaton_internal_9 --> -40($fp) + # local_east_at_CellularAutomaton_internal_4 = local_east_at_CellularAutomaton_internal_5 * local_east_at_CellularAutomaton_internal_9 + lw $t1, -24($fp) + lw $t0, 12($t1) + lw $t1, -40($fp) + lw $t2, 12($t1) + mul $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -20($fp) + # LOCAL local_east_at_CellularAutomaton_internal_11 --> -48($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -48($fp) + # LOCAL local_east_at_CellularAutomaton_internal_10 --> -44($fp) + # PARAM param_east_at_CellularAutomaton_position_0 --> 0($fp) + # LOCAL local_east_at_CellularAutomaton_internal_11 --> -48($fp) + # local_east_at_CellularAutomaton_internal_10 = PARAM param_east_at_CellularAutomaton_position_0 + local_east_at_CellularAutomaton_internal_11 + lw $t1, 0($fp) + lw $t0, 12($t1) + lw $t1, -48($fp) + lw $t2, 12($t1) + add $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -44($fp) + # IF_ZERO local_east_at_CellularAutomaton_internal_4 GOTO label_FALSE_79 + # IF_ZERO local_east_at_CellularAutomaton_internal_4 GOTO label_FALSE_79 + lw $t0, -20($fp) + beq $t0, 0, label_FALSE_79 + # IF_ZERO local_east_at_CellularAutomaton_internal_10 GOTO label_FALSE_79 + # IF_ZERO local_east_at_CellularAutomaton_internal_10 GOTO label_FALSE_79 + lw $t0, -44($fp) + beq $t0, 0, label_FALSE_79 + # LOCAL local_east_at_CellularAutomaton_internal_3 --> -16($fp) + # LOCAL local_east_at_CellularAutomaton_internal_4 --> -20($fp) + # Comparing -20($fp) type with String + la $v0, String + lw $a0, -20($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -16($fp) + # IF_ZERO local_east_at_CellularAutomaton_internal_3 GOTO label_COMPARE_STRING_82 + # IF_ZERO local_east_at_CellularAutomaton_internal_3 GOTO label_COMPARE_STRING_82 + lw $t0, -16($fp) + beq $t0, 0, label_COMPARE_STRING_82 + # LOCAL local_east_at_CellularAutomaton_internal_3 --> -16($fp) + # LOCAL local_east_at_CellularAutomaton_internal_4 --> -20($fp) + # Comparing -20($fp) type with Bool + la $v0, Bool + lw $a0, -20($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -16($fp) + # IF_ZERO local_east_at_CellularAutomaton_internal_3 GOTO label_COMPARE_BY_VALUE_83 + # IF_ZERO local_east_at_CellularAutomaton_internal_3 GOTO label_COMPARE_BY_VALUE_83 + lw $t0, -16($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_83 + # LOCAL local_east_at_CellularAutomaton_internal_3 --> -16($fp) + # LOCAL local_east_at_CellularAutomaton_internal_4 --> -20($fp) + # Comparing -20($fp) type with Int + la $v0, Int + lw $a0, -20($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -16($fp) + # IF_ZERO local_east_at_CellularAutomaton_internal_3 GOTO label_COMPARE_BY_VALUE_83 + # IF_ZERO local_east_at_CellularAutomaton_internal_3 GOTO label_COMPARE_BY_VALUE_83 + lw $t0, -16($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_83 + # LOCAL local_east_at_CellularAutomaton_internal_3 --> -16($fp) + # LOCAL local_east_at_CellularAutomaton_internal_4 --> -20($fp) + # LOCAL local_east_at_CellularAutomaton_internal_10 --> -44($fp) + # Load pointers and SUB + lw $a0, -20($fp) + lw $a1, -44($fp) + sub $a0, $a0, $a1 + sw $a0, -16($fp) + # IF_ZERO local_east_at_CellularAutomaton_internal_3 GOTO label_TRUE_80 + # IF_ZERO local_east_at_CellularAutomaton_internal_3 GOTO label_TRUE_80 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_80 + # GOTO label_FALSE_79 + j label_FALSE_79 + label_COMPARE_BY_VALUE_83: + # LOCAL local_east_at_CellularAutomaton_internal_3 --> -16($fp) + # LOCAL local_east_at_CellularAutomaton_internal_4 --> -20($fp) + # LOCAL local_east_at_CellularAutomaton_internal_10 --> -44($fp) + lw $a0, -20($fp) + lw $a1, -44($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -16($fp) + # IF_ZERO local_east_at_CellularAutomaton_internal_3 GOTO label_TRUE_80 + # IF_ZERO local_east_at_CellularAutomaton_internal_3 GOTO label_TRUE_80 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_80 + # GOTO label_FALSE_79 + j label_FALSE_79 + label_COMPARE_STRING_82: + # LOCAL local_east_at_CellularAutomaton_internal_3 --> -16($fp) + # LOCAL local_east_at_CellularAutomaton_internal_4 --> -20($fp) + # LOCAL local_east_at_CellularAutomaton_internal_10 --> -44($fp) + # Load strings for comparison + lw $v0, -20($fp) + lw $v1, -44($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -16($fp) + # IF_ZERO local_east_at_CellularAutomaton_internal_3 GOTO label_CONTINUE_84 + # IF_ZERO local_east_at_CellularAutomaton_internal_3 GOTO label_CONTINUE_84 + lw $t0, -16($fp) + beq $t0, 0, label_CONTINUE_84 + # GOTO label_FALSE_79 + j label_FALSE_79 + label_CONTINUE_84: + # LOCAL local_east_at_CellularAutomaton_internal_3 --> -16($fp) + # LOCAL local_east_at_CellularAutomaton_internal_4 --> -20($fp) + # LOCAL local_east_at_CellularAutomaton_internal_10 --> -44($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -20($fp) + lw $v1, -44($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_85: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_86 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_85 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_86: + # Store result + sw $a2, -16($fp) + # IF_ZERO local_east_at_CellularAutomaton_internal_3 GOTO label_TRUE_80 + # IF_ZERO local_east_at_CellularAutomaton_internal_3 GOTO label_TRUE_80 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_80 + label_FALSE_79: + # LOCAL local_east_at_CellularAutomaton_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -12($fp) + # GOTO label_END_81 +j label_END_81 +label_TRUE_80: + # LOCAL local_east_at_CellularAutomaton_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -12($fp) + label_END_81: +# LOCAL local_east_at_CellularAutomaton_internal_0 --> -4($fp) +# LOCAL local_east_at_CellularAutomaton_internal_2 --> -12($fp) +# Obtain value from -12($fp) +lw $v0, -12($fp) +lw $v0, 12($v0) +sw $v0, -4($fp) +# IF_ZERO local_east_at_CellularAutomaton_internal_0 GOTO label_FALSEIF_77 +# IF_ZERO local_east_at_CellularAutomaton_internal_0 GOTO label_FALSEIF_77 +lw $t0, -4($fp) +beq $t0, 0, label_FALSEIF_77 +# LOCAL local_east_at_CellularAutomaton_internal_12 --> -52($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_10 +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +sw $v0, -52($fp) +# LOCAL local_east_at_CellularAutomaton_internal_1 --> -8($fp) +# LOCAL local_east_at_CellularAutomaton_internal_12 --> -52($fp) +# local_east_at_CellularAutomaton_internal_1 = local_east_at_CellularAutomaton_internal_12 +lw $t0, -52($fp) +sw $t0, -8($fp) +# GOTO label_ENDIF_78 +j label_ENDIF_78 +label_FALSEIF_77: + # LOCAL local_east_at_CellularAutomaton_internal_15 --> -64($fp) + # local_east_at_CellularAutomaton_internal_15 = SELF + sw $s1, -64($fp) + # LOCAL local_east_at_CellularAutomaton_internal_13 --> -56($fp) + # LOCAL local_east_at_CellularAutomaton_internal_15 --> -64($fp) + # local_east_at_CellularAutomaton_internal_13 = local_east_at_CellularAutomaton_internal_15 + lw $t0, -64($fp) + sw $t0, -56($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_east_at_CellularAutomaton_internal_17 --> -72($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -72($fp) + # LOCAL local_east_at_CellularAutomaton_internal_16 --> -68($fp) + # PARAM param_east_at_CellularAutomaton_position_0 --> 0($fp) + # LOCAL local_east_at_CellularAutomaton_internal_17 --> -72($fp) + # local_east_at_CellularAutomaton_internal_16 = PARAM param_east_at_CellularAutomaton_position_0 + local_east_at_CellularAutomaton_internal_17 + lw $t1, 0($fp) + lw $t0, 12($t1) + lw $t1, -72($fp) + lw $t2, 12($t1) + add $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -68($fp) + # ARG local_east_at_CellularAutomaton_internal_16 + # LOCAL local_east_at_CellularAutomaton_internal_16 --> -68($fp) + lw $t0, -68($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_east_at_CellularAutomaton_internal_13 --> -56($fp) + # LOCAL local_east_at_CellularAutomaton_internal_14 --> -60($fp) + # local_east_at_CellularAutomaton_internal_14 = VCALL local_east_at_CellularAutomaton_internal_13 cell + # Save new self pointer in $s1 + lw $s1, -56($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 100($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -60($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_east_at_CellularAutomaton_internal_1 --> -8($fp) + # LOCAL local_east_at_CellularAutomaton_internal_14 --> -60($fp) + # local_east_at_CellularAutomaton_internal_1 = local_east_at_CellularAutomaton_internal_14 + lw $t0, -60($fp) + sw $t0, -8($fp) + label_ENDIF_78: +# RETURN local_east_at_CellularAutomaton_internal_1 +lw $v0, -8($fp) +# Deallocate stack frame for function function_east_at_CellularAutomaton. +# Restore $ra +lw $ra, 4($sp) +# Restore $fp +lw $fp, 0($sp) +# Restore Stack pointer $sp +addu $sp, $sp, 80 +# Deallocate function args +addu $sp, $sp, 4 +jr $ra +# Function END + + +# function_west_at_CellularAutomaton implementation. +# @Params: +# 0($fp) = param_west_at_CellularAutomaton_position_0 +function_west_at_CellularAutomaton: + # Allocate stack frame for function function_west_at_CellularAutomaton. + subu $sp, $sp, 88 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 88 + # LOCAL local_west_at_CellularAutomaton_internal_4 --> -20($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -20($fp) + # IF_ZERO param_west_at_CellularAutomaton_position_0 GOTO label_FALSE_89 + # IF_ZERO param_west_at_CellularAutomaton_position_0 GOTO label_FALSE_89 + lw $t0, 0($fp) + beq $t0, 0, label_FALSE_89 + # IF_ZERO local_west_at_CellularAutomaton_internal_4 GOTO label_FALSE_89 + # IF_ZERO local_west_at_CellularAutomaton_internal_4 GOTO label_FALSE_89 + lw $t0, -20($fp) + beq $t0, 0, label_FALSE_89 + # LOCAL local_west_at_CellularAutomaton_internal_3 --> -16($fp) + # PARAM param_west_at_CellularAutomaton_position_0 --> 0($fp) + # Comparing 0($fp) type with String + la $v0, String + lw $a0, 0($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -16($fp) + # IF_ZERO local_west_at_CellularAutomaton_internal_3 GOTO label_COMPARE_STRING_92 + # IF_ZERO local_west_at_CellularAutomaton_internal_3 GOTO label_COMPARE_STRING_92 + lw $t0, -16($fp) + beq $t0, 0, label_COMPARE_STRING_92 + # LOCAL local_west_at_CellularAutomaton_internal_3 --> -16($fp) + # PARAM param_west_at_CellularAutomaton_position_0 --> 0($fp) + # Comparing 0($fp) type with Bool + la $v0, Bool + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -16($fp) + # IF_ZERO local_west_at_CellularAutomaton_internal_3 GOTO label_COMPARE_BY_VALUE_93 + # IF_ZERO local_west_at_CellularAutomaton_internal_3 GOTO label_COMPARE_BY_VALUE_93 + lw $t0, -16($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_93 + # LOCAL local_west_at_CellularAutomaton_internal_3 --> -16($fp) + # PARAM param_west_at_CellularAutomaton_position_0 --> 0($fp) + # Comparing 0($fp) type with Int + la $v0, Int + lw $a0, 0($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -16($fp) + # IF_ZERO local_west_at_CellularAutomaton_internal_3 GOTO label_COMPARE_BY_VALUE_93 + # IF_ZERO local_west_at_CellularAutomaton_internal_3 GOTO label_COMPARE_BY_VALUE_93 + lw $t0, -16($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_93 + # LOCAL local_west_at_CellularAutomaton_internal_3 --> -16($fp) + # PARAM param_west_at_CellularAutomaton_position_0 --> 0($fp) + # LOCAL local_west_at_CellularAutomaton_internal_4 --> -20($fp) + # Load pointers and SUB + lw $a0, 0($fp) + lw $a1, -20($fp) + sub $a0, $a0, $a1 + sw $a0, -16($fp) + # IF_ZERO local_west_at_CellularAutomaton_internal_3 GOTO label_TRUE_90 + # IF_ZERO local_west_at_CellularAutomaton_internal_3 GOTO label_TRUE_90 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_90 + # GOTO label_FALSE_89 + j label_FALSE_89 + label_COMPARE_BY_VALUE_93: + # LOCAL local_west_at_CellularAutomaton_internal_3 --> -16($fp) + # PARAM param_west_at_CellularAutomaton_position_0 --> 0($fp) + # LOCAL local_west_at_CellularAutomaton_internal_4 --> -20($fp) + lw $a0, 0($fp) + lw $a1, -20($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -16($fp) + # IF_ZERO local_west_at_CellularAutomaton_internal_3 GOTO label_TRUE_90 + # IF_ZERO local_west_at_CellularAutomaton_internal_3 GOTO label_TRUE_90 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_90 + # GOTO label_FALSE_89 + j label_FALSE_89 + label_COMPARE_STRING_92: + # LOCAL local_west_at_CellularAutomaton_internal_3 --> -16($fp) + # PARAM param_west_at_CellularAutomaton_position_0 --> 0($fp) + # LOCAL local_west_at_CellularAutomaton_internal_4 --> -20($fp) + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -20($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -16($fp) + # IF_ZERO local_west_at_CellularAutomaton_internal_3 GOTO label_CONTINUE_94 + # IF_ZERO local_west_at_CellularAutomaton_internal_3 GOTO label_CONTINUE_94 + lw $t0, -16($fp) + beq $t0, 0, label_CONTINUE_94 + # GOTO label_FALSE_89 + j label_FALSE_89 + label_CONTINUE_94: + # LOCAL local_west_at_CellularAutomaton_internal_3 --> -16($fp) + # PARAM param_west_at_CellularAutomaton_position_0 --> 0($fp) + # LOCAL local_west_at_CellularAutomaton_internal_4 --> -20($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, 0($fp) + lw $v1, -20($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_95: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_96 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_95 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_96: + # Store result + sw $a2, -16($fp) + # IF_ZERO local_west_at_CellularAutomaton_internal_3 GOTO label_TRUE_90 + # IF_ZERO local_west_at_CellularAutomaton_internal_3 GOTO label_TRUE_90 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_90 + label_FALSE_89: + # LOCAL local_west_at_CellularAutomaton_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -12($fp) + # GOTO label_END_91 +j label_END_91 +label_TRUE_90: + # LOCAL local_west_at_CellularAutomaton_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -12($fp) + label_END_91: +# LOCAL local_west_at_CellularAutomaton_internal_0 --> -4($fp) +# LOCAL local_west_at_CellularAutomaton_internal_2 --> -12($fp) +# Obtain value from -12($fp) +lw $v0, -12($fp) +lw $v0, 12($v0) +sw $v0, -4($fp) +# IF_ZERO local_west_at_CellularAutomaton_internal_0 GOTO label_FALSEIF_87 +# IF_ZERO local_west_at_CellularAutomaton_internal_0 GOTO label_FALSEIF_87 +lw $t0, -4($fp) +beq $t0, 0, label_FALSEIF_87 +# LOCAL local_west_at_CellularAutomaton_internal_5 --> -24($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_11 +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +sw $v0, -24($fp) +# LOCAL local_west_at_CellularAutomaton_internal_1 --> -8($fp) +# LOCAL local_west_at_CellularAutomaton_internal_5 --> -24($fp) +# local_west_at_CellularAutomaton_internal_1 = local_west_at_CellularAutomaton_internal_5 +lw $t0, -24($fp) +sw $t0, -8($fp) +# GOTO label_ENDIF_88 +j label_ENDIF_88 +label_FALSEIF_87: + # local_west_at_CellularAutomaton_internal_12 = GETATTRIBUTE columns CellularAutomaton + # LOCAL local_west_at_CellularAutomaton_internal_12 --> -52($fp) + lw $t0, 16($s1) + sw $t0, -52($fp) + # LOCAL local_west_at_CellularAutomaton_internal_11 --> -48($fp) + # PARAM param_west_at_CellularAutomaton_position_0 --> 0($fp) + # LOCAL local_west_at_CellularAutomaton_internal_12 --> -52($fp) + # local_west_at_CellularAutomaton_internal_11 = PARAM param_west_at_CellularAutomaton_position_0 / local_west_at_CellularAutomaton_internal_12 + lw $t1, 0($fp) + lw $t0, 12($t1) + lw $t1, -52($fp) + lw $t2, 12($t1) + div $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -48($fp) + # local_west_at_CellularAutomaton_internal_13 = GETATTRIBUTE columns CellularAutomaton + # LOCAL local_west_at_CellularAutomaton_internal_13 --> -56($fp) + lw $t0, 16($s1) + sw $t0, -56($fp) + # LOCAL local_west_at_CellularAutomaton_internal_10 --> -44($fp) + # LOCAL local_west_at_CellularAutomaton_internal_11 --> -48($fp) + # LOCAL local_west_at_CellularAutomaton_internal_13 --> -56($fp) + # local_west_at_CellularAutomaton_internal_10 = local_west_at_CellularAutomaton_internal_11 * local_west_at_CellularAutomaton_internal_13 + lw $t1, -48($fp) + lw $t0, 12($t1) + lw $t1, -56($fp) + lw $t2, 12($t1) + mul $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -44($fp) + # IF_ZERO local_west_at_CellularAutomaton_internal_10 GOTO label_FALSE_99 + # IF_ZERO local_west_at_CellularAutomaton_internal_10 GOTO label_FALSE_99 + lw $t0, -44($fp) + beq $t0, 0, label_FALSE_99 + # IF_ZERO param_west_at_CellularAutomaton_position_0 GOTO label_FALSE_99 + # IF_ZERO param_west_at_CellularAutomaton_position_0 GOTO label_FALSE_99 + lw $t0, 0($fp) + beq $t0, 0, label_FALSE_99 + # LOCAL local_west_at_CellularAutomaton_internal_9 --> -40($fp) + # LOCAL local_west_at_CellularAutomaton_internal_10 --> -44($fp) + # Comparing -44($fp) type with String + la $v0, String + lw $a0, -44($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -40($fp) + # IF_ZERO local_west_at_CellularAutomaton_internal_9 GOTO label_COMPARE_STRING_102 + # IF_ZERO local_west_at_CellularAutomaton_internal_9 GOTO label_COMPARE_STRING_102 + lw $t0, -40($fp) + beq $t0, 0, label_COMPARE_STRING_102 + # LOCAL local_west_at_CellularAutomaton_internal_9 --> -40($fp) + # LOCAL local_west_at_CellularAutomaton_internal_10 --> -44($fp) + # Comparing -44($fp) type with Bool + la $v0, Bool + lw $a0, -44($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -40($fp) + # IF_ZERO local_west_at_CellularAutomaton_internal_9 GOTO label_COMPARE_BY_VALUE_103 + # IF_ZERO local_west_at_CellularAutomaton_internal_9 GOTO label_COMPARE_BY_VALUE_103 + lw $t0, -40($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_103 + # LOCAL local_west_at_CellularAutomaton_internal_9 --> -40($fp) + # LOCAL local_west_at_CellularAutomaton_internal_10 --> -44($fp) + # Comparing -44($fp) type with Int + la $v0, Int + lw $a0, -44($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -40($fp) + # IF_ZERO local_west_at_CellularAutomaton_internal_9 GOTO label_COMPARE_BY_VALUE_103 + # IF_ZERO local_west_at_CellularAutomaton_internal_9 GOTO label_COMPARE_BY_VALUE_103 + lw $t0, -40($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_103 + # LOCAL local_west_at_CellularAutomaton_internal_9 --> -40($fp) + # LOCAL local_west_at_CellularAutomaton_internal_10 --> -44($fp) + # PARAM param_west_at_CellularAutomaton_position_0 --> 0($fp) + # Load pointers and SUB + lw $a0, -44($fp) + lw $a1, 0($fp) + sub $a0, $a0, $a1 + sw $a0, -40($fp) + # IF_ZERO local_west_at_CellularAutomaton_internal_9 GOTO label_TRUE_100 + # IF_ZERO local_west_at_CellularAutomaton_internal_9 GOTO label_TRUE_100 + lw $t0, -40($fp) + beq $t0, 0, label_TRUE_100 + # GOTO label_FALSE_99 + j label_FALSE_99 + label_COMPARE_BY_VALUE_103: + # LOCAL local_west_at_CellularAutomaton_internal_9 --> -40($fp) + # LOCAL local_west_at_CellularAutomaton_internal_10 --> -44($fp) + # PARAM param_west_at_CellularAutomaton_position_0 --> 0($fp) + lw $a0, -44($fp) + lw $a1, 0($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -40($fp) + # IF_ZERO local_west_at_CellularAutomaton_internal_9 GOTO label_TRUE_100 + # IF_ZERO local_west_at_CellularAutomaton_internal_9 GOTO label_TRUE_100 + lw $t0, -40($fp) + beq $t0, 0, label_TRUE_100 + # GOTO label_FALSE_99 + j label_FALSE_99 + label_COMPARE_STRING_102: + # LOCAL local_west_at_CellularAutomaton_internal_9 --> -40($fp) + # LOCAL local_west_at_CellularAutomaton_internal_10 --> -44($fp) + # PARAM param_west_at_CellularAutomaton_position_0 --> 0($fp) + # Load strings for comparison + lw $v0, -44($fp) + lw $v1, 0($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -40($fp) + # IF_ZERO local_west_at_CellularAutomaton_internal_9 GOTO label_CONTINUE_104 + # IF_ZERO local_west_at_CellularAutomaton_internal_9 GOTO label_CONTINUE_104 + lw $t0, -40($fp) + beq $t0, 0, label_CONTINUE_104 + # GOTO label_FALSE_99 + j label_FALSE_99 + label_CONTINUE_104: + # LOCAL local_west_at_CellularAutomaton_internal_9 --> -40($fp) + # LOCAL local_west_at_CellularAutomaton_internal_10 --> -44($fp) + # PARAM param_west_at_CellularAutomaton_position_0 --> 0($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -44($fp) + lw $v1, 0($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_105: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_106 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_105 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_106: + # Store result + sw $a2, -40($fp) + # IF_ZERO local_west_at_CellularAutomaton_internal_9 GOTO label_TRUE_100 + # IF_ZERO local_west_at_CellularAutomaton_internal_9 GOTO label_TRUE_100 + lw $t0, -40($fp) + beq $t0, 0, label_TRUE_100 + label_FALSE_99: + # LOCAL local_west_at_CellularAutomaton_internal_8 --> -36($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -36($fp) + # GOTO label_END_101 +j label_END_101 +label_TRUE_100: + # LOCAL local_west_at_CellularAutomaton_internal_8 --> -36($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -36($fp) + label_END_101: +# LOCAL local_west_at_CellularAutomaton_internal_6 --> -28($fp) +# LOCAL local_west_at_CellularAutomaton_internal_8 --> -36($fp) +# Obtain value from -36($fp) +lw $v0, -36($fp) +lw $v0, 12($v0) +sw $v0, -28($fp) +# IF_ZERO local_west_at_CellularAutomaton_internal_6 GOTO label_FALSEIF_97 +# IF_ZERO local_west_at_CellularAutomaton_internal_6 GOTO label_FALSEIF_97 +lw $t0, -28($fp) +beq $t0, 0, label_FALSEIF_97 +# LOCAL local_west_at_CellularAutomaton_internal_14 --> -60($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_12 +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +sw $v0, -60($fp) +# LOCAL local_west_at_CellularAutomaton_internal_7 --> -32($fp) +# LOCAL local_west_at_CellularAutomaton_internal_14 --> -60($fp) +# local_west_at_CellularAutomaton_internal_7 = local_west_at_CellularAutomaton_internal_14 +lw $t0, -60($fp) +sw $t0, -32($fp) +# GOTO label_ENDIF_98 +j label_ENDIF_98 +label_FALSEIF_97: + # LOCAL local_west_at_CellularAutomaton_internal_17 --> -72($fp) + # local_west_at_CellularAutomaton_internal_17 = SELF + sw $s1, -72($fp) + # LOCAL local_west_at_CellularAutomaton_internal_15 --> -64($fp) + # LOCAL local_west_at_CellularAutomaton_internal_17 --> -72($fp) + # local_west_at_CellularAutomaton_internal_15 = local_west_at_CellularAutomaton_internal_17 + lw $t0, -72($fp) + sw $t0, -64($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_west_at_CellularAutomaton_internal_19 --> -80($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -80($fp) + # LOCAL local_west_at_CellularAutomaton_internal_18 --> -76($fp) + # PARAM param_west_at_CellularAutomaton_position_0 --> 0($fp) + # LOCAL local_west_at_CellularAutomaton_internal_19 --> -80($fp) + # local_west_at_CellularAutomaton_internal_18 = PARAM param_west_at_CellularAutomaton_position_0 - local_west_at_CellularAutomaton_internal_19 + lw $t1, 0($fp) + lw $t0, 12($t1) + lw $t1, -80($fp) + lw $t2, 12($t1) + sub $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -76($fp) + # ARG local_west_at_CellularAutomaton_internal_18 + # LOCAL local_west_at_CellularAutomaton_internal_18 --> -76($fp) + lw $t0, -76($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_west_at_CellularAutomaton_internal_15 --> -64($fp) + # LOCAL local_west_at_CellularAutomaton_internal_16 --> -68($fp) + # local_west_at_CellularAutomaton_internal_16 = VCALL local_west_at_CellularAutomaton_internal_15 cell + # Save new self pointer in $s1 + lw $s1, -64($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 100($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -68($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_west_at_CellularAutomaton_internal_7 --> -32($fp) + # LOCAL local_west_at_CellularAutomaton_internal_16 --> -68($fp) + # local_west_at_CellularAutomaton_internal_7 = local_west_at_CellularAutomaton_internal_16 + lw $t0, -68($fp) + sw $t0, -32($fp) + label_ENDIF_98: +# LOCAL local_west_at_CellularAutomaton_internal_1 --> -8($fp) +# LOCAL local_west_at_CellularAutomaton_internal_7 --> -32($fp) +# local_west_at_CellularAutomaton_internal_1 = local_west_at_CellularAutomaton_internal_7 +lw $t0, -32($fp) +sw $t0, -8($fp) +label_ENDIF_88: +# RETURN local_west_at_CellularAutomaton_internal_1 +lw $v0, -8($fp) +# Deallocate stack frame for function function_west_at_CellularAutomaton. +# Restore $ra +lw $ra, 4($sp) +# Restore $fp +lw $fp, 0($sp) +# Restore Stack pointer $sp +addu $sp, $sp, 88 +# Deallocate function args +addu $sp, $sp, 4 +jr $ra +# Function END + + +# function_northwest_at_CellularAutomaton implementation. +# @Params: +# 0($fp) = param_northwest_at_CellularAutomaton_position_0 +function_northwest_at_CellularAutomaton: + # Allocate stack frame for function function_northwest_at_CellularAutomaton. + subu $sp, $sp, 92 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 92 + # local_northwest_at_CellularAutomaton_internal_4 = GETATTRIBUTE columns CellularAutomaton + # LOCAL local_northwest_at_CellularAutomaton_internal_4 --> -20($fp) + lw $t0, 16($s1) + sw $t0, -20($fp) + # LOCAL local_northwest_at_CellularAutomaton_internal_3 --> -16($fp) + # PARAM param_northwest_at_CellularAutomaton_position_0 --> 0($fp) + # LOCAL local_northwest_at_CellularAutomaton_internal_4 --> -20($fp) + # local_northwest_at_CellularAutomaton_internal_3 = PARAM param_northwest_at_CellularAutomaton_position_0 - local_northwest_at_CellularAutomaton_internal_4 + lw $t1, 0($fp) + lw $t0, 12($t1) + lw $t1, -20($fp) + lw $t2, 12($t1) + sub $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -16($fp) + # LOCAL local_northwest_at_CellularAutomaton_internal_5 --> -24($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -24($fp) + # LOCAL local_northwest_at_CellularAutomaton_internal_2 --> -12($fp) + # LOCAL local_northwest_at_CellularAutomaton_internal_3 --> -16($fp) + # LOCAL local_northwest_at_CellularAutomaton_internal_5 --> -24($fp) + lw $a0, -16($fp) + lw $a1, -24($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -12($fp) + # IF_GREATER_ZERO local_northwest_at_CellularAutomaton_internal_2 GOTO label_FALSE_109 + # IF_GREATER_ZERO local_northwest_at_CellularAutomaton_internal_2 GOTO label_FALSE_109 + lw $t0, -12($fp) + bgt $t0, 0, label_FALSE_109 + # IF_ZERO local_northwest_at_CellularAutomaton_internal_2 GOTO label_FALSE_109 + # IF_ZERO local_northwest_at_CellularAutomaton_internal_2 GOTO label_FALSE_109 + lw $t0, -12($fp) + beq $t0, 0, label_FALSE_109 + # LOCAL local_northwest_at_CellularAutomaton_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -12($fp) + # GOTO label_END_110 +j label_END_110 +label_FALSE_109: + # LOCAL local_northwest_at_CellularAutomaton_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -12($fp) + label_END_110: +# LOCAL local_northwest_at_CellularAutomaton_internal_0 --> -4($fp) +# LOCAL local_northwest_at_CellularAutomaton_internal_2 --> -12($fp) +# Obtain value from -12($fp) +lw $v0, -12($fp) +lw $v0, 12($v0) +sw $v0, -4($fp) +# IF_ZERO local_northwest_at_CellularAutomaton_internal_0 GOTO label_FALSEIF_107 +# IF_ZERO local_northwest_at_CellularAutomaton_internal_0 GOTO label_FALSEIF_107 +lw $t0, -4($fp) +beq $t0, 0, label_FALSEIF_107 +# LOCAL local_northwest_at_CellularAutomaton_internal_6 --> -28($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_13 +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +sw $v0, -28($fp) +# LOCAL local_northwest_at_CellularAutomaton_internal_1 --> -8($fp) +# LOCAL local_northwest_at_CellularAutomaton_internal_6 --> -28($fp) +# local_northwest_at_CellularAutomaton_internal_1 = local_northwest_at_CellularAutomaton_internal_6 +lw $t0, -28($fp) +sw $t0, -8($fp) +# GOTO label_ENDIF_108 +j label_ENDIF_108 +label_FALSEIF_107: + # local_northwest_at_CellularAutomaton_internal_13 = GETATTRIBUTE columns CellularAutomaton + # LOCAL local_northwest_at_CellularAutomaton_internal_13 --> -56($fp) + lw $t0, 16($s1) + sw $t0, -56($fp) + # LOCAL local_northwest_at_CellularAutomaton_internal_12 --> -52($fp) + # PARAM param_northwest_at_CellularAutomaton_position_0 --> 0($fp) + # LOCAL local_northwest_at_CellularAutomaton_internal_13 --> -56($fp) + # local_northwest_at_CellularAutomaton_internal_12 = PARAM param_northwest_at_CellularAutomaton_position_0 / local_northwest_at_CellularAutomaton_internal_13 + lw $t1, 0($fp) + lw $t0, 12($t1) + lw $t1, -56($fp) + lw $t2, 12($t1) + div $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -52($fp) + # local_northwest_at_CellularAutomaton_internal_14 = GETATTRIBUTE columns CellularAutomaton + # LOCAL local_northwest_at_CellularAutomaton_internal_14 --> -60($fp) + lw $t0, 16($s1) + sw $t0, -60($fp) + # LOCAL local_northwest_at_CellularAutomaton_internal_11 --> -48($fp) + # LOCAL local_northwest_at_CellularAutomaton_internal_12 --> -52($fp) + # LOCAL local_northwest_at_CellularAutomaton_internal_14 --> -60($fp) + # local_northwest_at_CellularAutomaton_internal_11 = local_northwest_at_CellularAutomaton_internal_12 * local_northwest_at_CellularAutomaton_internal_14 + lw $t1, -52($fp) + lw $t0, 12($t1) + lw $t1, -60($fp) + lw $t2, 12($t1) + mul $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -48($fp) + # IF_ZERO local_northwest_at_CellularAutomaton_internal_11 GOTO label_FALSE_113 + # IF_ZERO local_northwest_at_CellularAutomaton_internal_11 GOTO label_FALSE_113 + lw $t0, -48($fp) + beq $t0, 0, label_FALSE_113 + # IF_ZERO param_northwest_at_CellularAutomaton_position_0 GOTO label_FALSE_113 + # IF_ZERO param_northwest_at_CellularAutomaton_position_0 GOTO label_FALSE_113 + lw $t0, 0($fp) + beq $t0, 0, label_FALSE_113 + # LOCAL local_northwest_at_CellularAutomaton_internal_10 --> -44($fp) + # LOCAL local_northwest_at_CellularAutomaton_internal_11 --> -48($fp) + # Comparing -48($fp) type with String + la $v0, String + lw $a0, -48($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -44($fp) + # IF_ZERO local_northwest_at_CellularAutomaton_internal_10 GOTO label_COMPARE_STRING_116 + # IF_ZERO local_northwest_at_CellularAutomaton_internal_10 GOTO label_COMPARE_STRING_116 + lw $t0, -44($fp) + beq $t0, 0, label_COMPARE_STRING_116 + # LOCAL local_northwest_at_CellularAutomaton_internal_10 --> -44($fp) + # LOCAL local_northwest_at_CellularAutomaton_internal_11 --> -48($fp) + # Comparing -48($fp) type with Bool + la $v0, Bool + lw $a0, -48($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -44($fp) + # IF_ZERO local_northwest_at_CellularAutomaton_internal_10 GOTO label_COMPARE_BY_VALUE_117 + # IF_ZERO local_northwest_at_CellularAutomaton_internal_10 GOTO label_COMPARE_BY_VALUE_117 + lw $t0, -44($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_117 + # LOCAL local_northwest_at_CellularAutomaton_internal_10 --> -44($fp) + # LOCAL local_northwest_at_CellularAutomaton_internal_11 --> -48($fp) + # Comparing -48($fp) type with Int + la $v0, Int + lw $a0, -48($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -44($fp) + # IF_ZERO local_northwest_at_CellularAutomaton_internal_10 GOTO label_COMPARE_BY_VALUE_117 + # IF_ZERO local_northwest_at_CellularAutomaton_internal_10 GOTO label_COMPARE_BY_VALUE_117 + lw $t0, -44($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_117 + # LOCAL local_northwest_at_CellularAutomaton_internal_10 --> -44($fp) + # LOCAL local_northwest_at_CellularAutomaton_internal_11 --> -48($fp) + # PARAM param_northwest_at_CellularAutomaton_position_0 --> 0($fp) + # Load pointers and SUB + lw $a0, -48($fp) + lw $a1, 0($fp) + sub $a0, $a0, $a1 + sw $a0, -44($fp) + # IF_ZERO local_northwest_at_CellularAutomaton_internal_10 GOTO label_TRUE_114 + # IF_ZERO local_northwest_at_CellularAutomaton_internal_10 GOTO label_TRUE_114 + lw $t0, -44($fp) + beq $t0, 0, label_TRUE_114 + # GOTO label_FALSE_113 + j label_FALSE_113 + label_COMPARE_BY_VALUE_117: + # LOCAL local_northwest_at_CellularAutomaton_internal_10 --> -44($fp) + # LOCAL local_northwest_at_CellularAutomaton_internal_11 --> -48($fp) + # PARAM param_northwest_at_CellularAutomaton_position_0 --> 0($fp) + lw $a0, -48($fp) + lw $a1, 0($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -44($fp) + # IF_ZERO local_northwest_at_CellularAutomaton_internal_10 GOTO label_TRUE_114 + # IF_ZERO local_northwest_at_CellularAutomaton_internal_10 GOTO label_TRUE_114 + lw $t0, -44($fp) + beq $t0, 0, label_TRUE_114 + # GOTO label_FALSE_113 + j label_FALSE_113 + label_COMPARE_STRING_116: + # LOCAL local_northwest_at_CellularAutomaton_internal_10 --> -44($fp) + # LOCAL local_northwest_at_CellularAutomaton_internal_11 --> -48($fp) + # PARAM param_northwest_at_CellularAutomaton_position_0 --> 0($fp) + # Load strings for comparison + lw $v0, -48($fp) + lw $v1, 0($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -44($fp) + # IF_ZERO local_northwest_at_CellularAutomaton_internal_10 GOTO label_CONTINUE_118 + # IF_ZERO local_northwest_at_CellularAutomaton_internal_10 GOTO label_CONTINUE_118 + lw $t0, -44($fp) + beq $t0, 0, label_CONTINUE_118 + # GOTO label_FALSE_113 + j label_FALSE_113 + label_CONTINUE_118: + # LOCAL local_northwest_at_CellularAutomaton_internal_10 --> -44($fp) + # LOCAL local_northwest_at_CellularAutomaton_internal_11 --> -48($fp) + # PARAM param_northwest_at_CellularAutomaton_position_0 --> 0($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -48($fp) + lw $v1, 0($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_119: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_120 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_119 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_120: + # Store result + sw $a2, -44($fp) + # IF_ZERO local_northwest_at_CellularAutomaton_internal_10 GOTO label_TRUE_114 + # IF_ZERO local_northwest_at_CellularAutomaton_internal_10 GOTO label_TRUE_114 + lw $t0, -44($fp) + beq $t0, 0, label_TRUE_114 + label_FALSE_113: + # LOCAL local_northwest_at_CellularAutomaton_internal_9 --> -40($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -40($fp) + # GOTO label_END_115 +j label_END_115 +label_TRUE_114: + # LOCAL local_northwest_at_CellularAutomaton_internal_9 --> -40($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -40($fp) + label_END_115: +# LOCAL local_northwest_at_CellularAutomaton_internal_7 --> -32($fp) +# LOCAL local_northwest_at_CellularAutomaton_internal_9 --> -40($fp) +# Obtain value from -40($fp) +lw $v0, -40($fp) +lw $v0, 12($v0) +sw $v0, -32($fp) +# IF_ZERO local_northwest_at_CellularAutomaton_internal_7 GOTO label_FALSEIF_111 +# IF_ZERO local_northwest_at_CellularAutomaton_internal_7 GOTO label_FALSEIF_111 +lw $t0, -32($fp) +beq $t0, 0, label_FALSEIF_111 +# LOCAL local_northwest_at_CellularAutomaton_internal_15 --> -64($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_14 +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +sw $v0, -64($fp) +# LOCAL local_northwest_at_CellularAutomaton_internal_8 --> -36($fp) +# LOCAL local_northwest_at_CellularAutomaton_internal_15 --> -64($fp) +# local_northwest_at_CellularAutomaton_internal_8 = local_northwest_at_CellularAutomaton_internal_15 +lw $t0, -64($fp) +sw $t0, -36($fp) +# GOTO label_ENDIF_112 +j label_ENDIF_112 +label_FALSEIF_111: + # LOCAL local_northwest_at_CellularAutomaton_internal_18 --> -76($fp) + # local_northwest_at_CellularAutomaton_internal_18 = SELF + sw $s1, -76($fp) + # LOCAL local_northwest_at_CellularAutomaton_internal_16 --> -68($fp) + # LOCAL local_northwest_at_CellularAutomaton_internal_18 --> -76($fp) + # local_northwest_at_CellularAutomaton_internal_16 = local_northwest_at_CellularAutomaton_internal_18 + lw $t0, -76($fp) + sw $t0, -68($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_northwest_at_CellularAutomaton_internal_20 --> -84($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -84($fp) + # LOCAL local_northwest_at_CellularAutomaton_internal_19 --> -80($fp) + # PARAM param_northwest_at_CellularAutomaton_position_0 --> 0($fp) + # LOCAL local_northwest_at_CellularAutomaton_internal_20 --> -84($fp) + # local_northwest_at_CellularAutomaton_internal_19 = PARAM param_northwest_at_CellularAutomaton_position_0 - local_northwest_at_CellularAutomaton_internal_20 + lw $t1, 0($fp) + lw $t0, 12($t1) + lw $t1, -84($fp) + lw $t2, 12($t1) + sub $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -80($fp) + # ARG local_northwest_at_CellularAutomaton_internal_19 + # LOCAL local_northwest_at_CellularAutomaton_internal_19 --> -80($fp) + lw $t0, -80($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_northwest_at_CellularAutomaton_internal_16 --> -68($fp) + # LOCAL local_northwest_at_CellularAutomaton_internal_17 --> -72($fp) + # local_northwest_at_CellularAutomaton_internal_17 = VCALL local_northwest_at_CellularAutomaton_internal_16 north + # Save new self pointer in $s1 + lw $s1, -68($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 88($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -72($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_northwest_at_CellularAutomaton_internal_8 --> -36($fp) + # LOCAL local_northwest_at_CellularAutomaton_internal_17 --> -72($fp) + # local_northwest_at_CellularAutomaton_internal_8 = local_northwest_at_CellularAutomaton_internal_17 + lw $t0, -72($fp) + sw $t0, -36($fp) + label_ENDIF_112: +# LOCAL local_northwest_at_CellularAutomaton_internal_1 --> -8($fp) +# LOCAL local_northwest_at_CellularAutomaton_internal_8 --> -36($fp) +# local_northwest_at_CellularAutomaton_internal_1 = local_northwest_at_CellularAutomaton_internal_8 +lw $t0, -36($fp) +sw $t0, -8($fp) +label_ENDIF_108: +# RETURN local_northwest_at_CellularAutomaton_internal_1 +lw $v0, -8($fp) +# Deallocate stack frame for function function_northwest_at_CellularAutomaton. +# Restore $ra +lw $ra, 4($sp) +# Restore $fp +lw $fp, 0($sp) +# Restore Stack pointer $sp +addu $sp, $sp, 92 +# Deallocate function args +addu $sp, $sp, 4 +jr $ra +# Function END + + +# function_northeast_at_CellularAutomaton implementation. +# @Params: +# 0($fp) = param_northeast_at_CellularAutomaton_position_0 +function_northeast_at_CellularAutomaton: + # Allocate stack frame for function function_northeast_at_CellularAutomaton. + subu $sp, $sp, 108 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 108 + # local_northeast_at_CellularAutomaton_internal_4 = GETATTRIBUTE columns CellularAutomaton + # LOCAL local_northeast_at_CellularAutomaton_internal_4 --> -20($fp) + lw $t0, 16($s1) + sw $t0, -20($fp) + # LOCAL local_northeast_at_CellularAutomaton_internal_3 --> -16($fp) + # PARAM param_northeast_at_CellularAutomaton_position_0 --> 0($fp) + # LOCAL local_northeast_at_CellularAutomaton_internal_4 --> -20($fp) + # local_northeast_at_CellularAutomaton_internal_3 = PARAM param_northeast_at_CellularAutomaton_position_0 - local_northeast_at_CellularAutomaton_internal_4 + lw $t1, 0($fp) + lw $t0, 12($t1) + lw $t1, -20($fp) + lw $t2, 12($t1) + sub $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -16($fp) + # LOCAL local_northeast_at_CellularAutomaton_internal_5 --> -24($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -24($fp) + # LOCAL local_northeast_at_CellularAutomaton_internal_2 --> -12($fp) + # LOCAL local_northeast_at_CellularAutomaton_internal_3 --> -16($fp) + # LOCAL local_northeast_at_CellularAutomaton_internal_5 --> -24($fp) + lw $a0, -16($fp) + lw $a1, -24($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -12($fp) + # IF_GREATER_ZERO local_northeast_at_CellularAutomaton_internal_2 GOTO label_FALSE_123 + # IF_GREATER_ZERO local_northeast_at_CellularAutomaton_internal_2 GOTO label_FALSE_123 + lw $t0, -12($fp) + bgt $t0, 0, label_FALSE_123 + # IF_ZERO local_northeast_at_CellularAutomaton_internal_2 GOTO label_FALSE_123 + # IF_ZERO local_northeast_at_CellularAutomaton_internal_2 GOTO label_FALSE_123 + lw $t0, -12($fp) + beq $t0, 0, label_FALSE_123 + # LOCAL local_northeast_at_CellularAutomaton_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -12($fp) + # GOTO label_END_124 +j label_END_124 +label_FALSE_123: + # LOCAL local_northeast_at_CellularAutomaton_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -12($fp) + label_END_124: +# LOCAL local_northeast_at_CellularAutomaton_internal_0 --> -4($fp) +# LOCAL local_northeast_at_CellularAutomaton_internal_2 --> -12($fp) +# Obtain value from -12($fp) +lw $v0, -12($fp) +lw $v0, 12($v0) +sw $v0, -4($fp) +# IF_ZERO local_northeast_at_CellularAutomaton_internal_0 GOTO label_FALSEIF_121 +# IF_ZERO local_northeast_at_CellularAutomaton_internal_0 GOTO label_FALSEIF_121 +lw $t0, -4($fp) +beq $t0, 0, label_FALSEIF_121 +# LOCAL local_northeast_at_CellularAutomaton_internal_6 --> -28($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_15 +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +sw $v0, -28($fp) +# LOCAL local_northeast_at_CellularAutomaton_internal_1 --> -8($fp) +# LOCAL local_northeast_at_CellularAutomaton_internal_6 --> -28($fp) +# local_northeast_at_CellularAutomaton_internal_1 = local_northeast_at_CellularAutomaton_internal_6 +lw $t0, -28($fp) +sw $t0, -8($fp) +# GOTO label_ENDIF_122 +j label_ENDIF_122 +label_FALSEIF_121: + # LOCAL local_northeast_at_CellularAutomaton_internal_14 --> -60($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -60($fp) + # LOCAL local_northeast_at_CellularAutomaton_internal_13 --> -56($fp) + # PARAM param_northeast_at_CellularAutomaton_position_0 --> 0($fp) + # LOCAL local_northeast_at_CellularAutomaton_internal_14 --> -60($fp) + # local_northeast_at_CellularAutomaton_internal_13 = PARAM param_northeast_at_CellularAutomaton_position_0 + local_northeast_at_CellularAutomaton_internal_14 + lw $t1, 0($fp) + lw $t0, 12($t1) + lw $t1, -60($fp) + lw $t2, 12($t1) + add $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -56($fp) + # local_northeast_at_CellularAutomaton_internal_15 = GETATTRIBUTE columns CellularAutomaton + # LOCAL local_northeast_at_CellularAutomaton_internal_15 --> -64($fp) + lw $t0, 16($s1) + sw $t0, -64($fp) + # LOCAL local_northeast_at_CellularAutomaton_internal_12 --> -52($fp) + # LOCAL local_northeast_at_CellularAutomaton_internal_13 --> -56($fp) + # LOCAL local_northeast_at_CellularAutomaton_internal_15 --> -64($fp) + # local_northeast_at_CellularAutomaton_internal_12 = local_northeast_at_CellularAutomaton_internal_13 / local_northeast_at_CellularAutomaton_internal_15 + lw $t1, -56($fp) + lw $t0, 12($t1) + lw $t1, -64($fp) + lw $t2, 12($t1) + div $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -52($fp) + # local_northeast_at_CellularAutomaton_internal_16 = GETATTRIBUTE columns CellularAutomaton + # LOCAL local_northeast_at_CellularAutomaton_internal_16 --> -68($fp) + lw $t0, 16($s1) + sw $t0, -68($fp) + # LOCAL local_northeast_at_CellularAutomaton_internal_11 --> -48($fp) + # LOCAL local_northeast_at_CellularAutomaton_internal_12 --> -52($fp) + # LOCAL local_northeast_at_CellularAutomaton_internal_16 --> -68($fp) + # local_northeast_at_CellularAutomaton_internal_11 = local_northeast_at_CellularAutomaton_internal_12 * local_northeast_at_CellularAutomaton_internal_16 + lw $t1, -52($fp) + lw $t0, 12($t1) + lw $t1, -68($fp) + lw $t2, 12($t1) + mul $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -48($fp) + # LOCAL local_northeast_at_CellularAutomaton_internal_18 --> -76($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -76($fp) + # LOCAL local_northeast_at_CellularAutomaton_internal_17 --> -72($fp) + # PARAM param_northeast_at_CellularAutomaton_position_0 --> 0($fp) + # LOCAL local_northeast_at_CellularAutomaton_internal_18 --> -76($fp) + # local_northeast_at_CellularAutomaton_internal_17 = PARAM param_northeast_at_CellularAutomaton_position_0 + local_northeast_at_CellularAutomaton_internal_18 + lw $t1, 0($fp) + lw $t0, 12($t1) + lw $t1, -76($fp) + lw $t2, 12($t1) + add $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -72($fp) + # IF_ZERO local_northeast_at_CellularAutomaton_internal_11 GOTO label_FALSE_127 + # IF_ZERO local_northeast_at_CellularAutomaton_internal_11 GOTO label_FALSE_127 + lw $t0, -48($fp) + beq $t0, 0, label_FALSE_127 + # IF_ZERO local_northeast_at_CellularAutomaton_internal_17 GOTO label_FALSE_127 + # IF_ZERO local_northeast_at_CellularAutomaton_internal_17 GOTO label_FALSE_127 + lw $t0, -72($fp) + beq $t0, 0, label_FALSE_127 + # LOCAL local_northeast_at_CellularAutomaton_internal_10 --> -44($fp) + # LOCAL local_northeast_at_CellularAutomaton_internal_11 --> -48($fp) + # Comparing -48($fp) type with String + la $v0, String + lw $a0, -48($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -44($fp) + # IF_ZERO local_northeast_at_CellularAutomaton_internal_10 GOTO label_COMPARE_STRING_130 + # IF_ZERO local_northeast_at_CellularAutomaton_internal_10 GOTO label_COMPARE_STRING_130 + lw $t0, -44($fp) + beq $t0, 0, label_COMPARE_STRING_130 + # LOCAL local_northeast_at_CellularAutomaton_internal_10 --> -44($fp) + # LOCAL local_northeast_at_CellularAutomaton_internal_11 --> -48($fp) + # Comparing -48($fp) type with Bool + la $v0, Bool + lw $a0, -48($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -44($fp) + # IF_ZERO local_northeast_at_CellularAutomaton_internal_10 GOTO label_COMPARE_BY_VALUE_131 + # IF_ZERO local_northeast_at_CellularAutomaton_internal_10 GOTO label_COMPARE_BY_VALUE_131 + lw $t0, -44($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_131 + # LOCAL local_northeast_at_CellularAutomaton_internal_10 --> -44($fp) + # LOCAL local_northeast_at_CellularAutomaton_internal_11 --> -48($fp) + # Comparing -48($fp) type with Int + la $v0, Int + lw $a0, -48($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -44($fp) + # IF_ZERO local_northeast_at_CellularAutomaton_internal_10 GOTO label_COMPARE_BY_VALUE_131 + # IF_ZERO local_northeast_at_CellularAutomaton_internal_10 GOTO label_COMPARE_BY_VALUE_131 + lw $t0, -44($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_131 + # LOCAL local_northeast_at_CellularAutomaton_internal_10 --> -44($fp) + # LOCAL local_northeast_at_CellularAutomaton_internal_11 --> -48($fp) + # LOCAL local_northeast_at_CellularAutomaton_internal_17 --> -72($fp) + # Load pointers and SUB + lw $a0, -48($fp) + lw $a1, -72($fp) + sub $a0, $a0, $a1 + sw $a0, -44($fp) + # IF_ZERO local_northeast_at_CellularAutomaton_internal_10 GOTO label_TRUE_128 + # IF_ZERO local_northeast_at_CellularAutomaton_internal_10 GOTO label_TRUE_128 + lw $t0, -44($fp) + beq $t0, 0, label_TRUE_128 + # GOTO label_FALSE_127 + j label_FALSE_127 + label_COMPARE_BY_VALUE_131: + # LOCAL local_northeast_at_CellularAutomaton_internal_10 --> -44($fp) + # LOCAL local_northeast_at_CellularAutomaton_internal_11 --> -48($fp) + # LOCAL local_northeast_at_CellularAutomaton_internal_17 --> -72($fp) + lw $a0, -48($fp) + lw $a1, -72($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -44($fp) + # IF_ZERO local_northeast_at_CellularAutomaton_internal_10 GOTO label_TRUE_128 + # IF_ZERO local_northeast_at_CellularAutomaton_internal_10 GOTO label_TRUE_128 + lw $t0, -44($fp) + beq $t0, 0, label_TRUE_128 + # GOTO label_FALSE_127 + j label_FALSE_127 + label_COMPARE_STRING_130: + # LOCAL local_northeast_at_CellularAutomaton_internal_10 --> -44($fp) + # LOCAL local_northeast_at_CellularAutomaton_internal_11 --> -48($fp) + # LOCAL local_northeast_at_CellularAutomaton_internal_17 --> -72($fp) + # Load strings for comparison + lw $v0, -48($fp) + lw $v1, -72($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -44($fp) + # IF_ZERO local_northeast_at_CellularAutomaton_internal_10 GOTO label_CONTINUE_132 + # IF_ZERO local_northeast_at_CellularAutomaton_internal_10 GOTO label_CONTINUE_132 + lw $t0, -44($fp) + beq $t0, 0, label_CONTINUE_132 + # GOTO label_FALSE_127 + j label_FALSE_127 + label_CONTINUE_132: + # LOCAL local_northeast_at_CellularAutomaton_internal_10 --> -44($fp) + # LOCAL local_northeast_at_CellularAutomaton_internal_11 --> -48($fp) + # LOCAL local_northeast_at_CellularAutomaton_internal_17 --> -72($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -48($fp) + lw $v1, -72($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_133: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_134 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_133 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_134: + # Store result + sw $a2, -44($fp) + # IF_ZERO local_northeast_at_CellularAutomaton_internal_10 GOTO label_TRUE_128 + # IF_ZERO local_northeast_at_CellularAutomaton_internal_10 GOTO label_TRUE_128 + lw $t0, -44($fp) + beq $t0, 0, label_TRUE_128 + label_FALSE_127: + # LOCAL local_northeast_at_CellularAutomaton_internal_9 --> -40($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -40($fp) + # GOTO label_END_129 +j label_END_129 +label_TRUE_128: + # LOCAL local_northeast_at_CellularAutomaton_internal_9 --> -40($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -40($fp) + label_END_129: +# LOCAL local_northeast_at_CellularAutomaton_internal_7 --> -32($fp) +# LOCAL local_northeast_at_CellularAutomaton_internal_9 --> -40($fp) +# Obtain value from -40($fp) +lw $v0, -40($fp) +lw $v0, 12($v0) +sw $v0, -32($fp) +# IF_ZERO local_northeast_at_CellularAutomaton_internal_7 GOTO label_FALSEIF_125 +# IF_ZERO local_northeast_at_CellularAutomaton_internal_7 GOTO label_FALSEIF_125 +lw $t0, -32($fp) +beq $t0, 0, label_FALSEIF_125 +# LOCAL local_northeast_at_CellularAutomaton_internal_19 --> -80($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_16 +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +sw $v0, -80($fp) +# LOCAL local_northeast_at_CellularAutomaton_internal_8 --> -36($fp) +# LOCAL local_northeast_at_CellularAutomaton_internal_19 --> -80($fp) +# local_northeast_at_CellularAutomaton_internal_8 = local_northeast_at_CellularAutomaton_internal_19 +lw $t0, -80($fp) +sw $t0, -36($fp) +# GOTO label_ENDIF_126 +j label_ENDIF_126 +label_FALSEIF_125: + # LOCAL local_northeast_at_CellularAutomaton_internal_22 --> -92($fp) + # local_northeast_at_CellularAutomaton_internal_22 = SELF + sw $s1, -92($fp) + # LOCAL local_northeast_at_CellularAutomaton_internal_20 --> -84($fp) + # LOCAL local_northeast_at_CellularAutomaton_internal_22 --> -92($fp) + # local_northeast_at_CellularAutomaton_internal_20 = local_northeast_at_CellularAutomaton_internal_22 + lw $t0, -92($fp) + sw $t0, -84($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_northeast_at_CellularAutomaton_internal_24 --> -100($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -100($fp) + # LOCAL local_northeast_at_CellularAutomaton_internal_23 --> -96($fp) + # PARAM param_northeast_at_CellularAutomaton_position_0 --> 0($fp) + # LOCAL local_northeast_at_CellularAutomaton_internal_24 --> -100($fp) + # local_northeast_at_CellularAutomaton_internal_23 = PARAM param_northeast_at_CellularAutomaton_position_0 + local_northeast_at_CellularAutomaton_internal_24 + lw $t1, 0($fp) + lw $t0, 12($t1) + lw $t1, -100($fp) + lw $t2, 12($t1) + add $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -96($fp) + # ARG local_northeast_at_CellularAutomaton_internal_23 + # LOCAL local_northeast_at_CellularAutomaton_internal_23 --> -96($fp) + lw $t0, -96($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_northeast_at_CellularAutomaton_internal_20 --> -84($fp) + # LOCAL local_northeast_at_CellularAutomaton_internal_21 --> -88($fp) + # local_northeast_at_CellularAutomaton_internal_21 = VCALL local_northeast_at_CellularAutomaton_internal_20 north + # Save new self pointer in $s1 + lw $s1, -84($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 88($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -88($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_northeast_at_CellularAutomaton_internal_8 --> -36($fp) + # LOCAL local_northeast_at_CellularAutomaton_internal_21 --> -88($fp) + # local_northeast_at_CellularAutomaton_internal_8 = local_northeast_at_CellularAutomaton_internal_21 + lw $t0, -88($fp) + sw $t0, -36($fp) + label_ENDIF_126: +# LOCAL local_northeast_at_CellularAutomaton_internal_1 --> -8($fp) +# LOCAL local_northeast_at_CellularAutomaton_internal_8 --> -36($fp) +# local_northeast_at_CellularAutomaton_internal_1 = local_northeast_at_CellularAutomaton_internal_8 +lw $t0, -36($fp) +sw $t0, -8($fp) +label_ENDIF_122: +# RETURN local_northeast_at_CellularAutomaton_internal_1 +lw $v0, -8($fp) +# Deallocate stack frame for function function_northeast_at_CellularAutomaton. +# Restore $ra +lw $ra, 4($sp) +# Restore $fp +lw $fp, 0($sp) +# Restore Stack pointer $sp +addu $sp, $sp, 108 +# Deallocate function args +addu $sp, $sp, 4 +jr $ra +# Function END + + +# function_southeast_at_CellularAutomaton implementation. +# @Params: +# 0($fp) = param_southeast_at_CellularAutomaton_position_0 +function_southeast_at_CellularAutomaton: + # Allocate stack frame for function function_southeast_at_CellularAutomaton. + subu $sp, $sp, 108 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 108 + # local_southeast_at_CellularAutomaton_internal_3 = GETATTRIBUTE board_size CellularAutomaton + # LOCAL local_southeast_at_CellularAutomaton_internal_3 --> -16($fp) + lw $t0, 20($s1) + sw $t0, -16($fp) + # local_southeast_at_CellularAutomaton_internal_5 = GETATTRIBUTE columns CellularAutomaton + # LOCAL local_southeast_at_CellularAutomaton_internal_5 --> -24($fp) + lw $t0, 16($s1) + sw $t0, -24($fp) + # LOCAL local_southeast_at_CellularAutomaton_internal_4 --> -20($fp) + # PARAM param_southeast_at_CellularAutomaton_position_0 --> 0($fp) + # LOCAL local_southeast_at_CellularAutomaton_internal_5 --> -24($fp) + # local_southeast_at_CellularAutomaton_internal_4 = PARAM param_southeast_at_CellularAutomaton_position_0 + local_southeast_at_CellularAutomaton_internal_5 + lw $t1, 0($fp) + lw $t0, 12($t1) + lw $t1, -24($fp) + lw $t2, 12($t1) + add $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -20($fp) + # LOCAL local_southeast_at_CellularAutomaton_internal_2 --> -12($fp) + # LOCAL local_southeast_at_CellularAutomaton_internal_3 --> -16($fp) + # LOCAL local_southeast_at_CellularAutomaton_internal_4 --> -20($fp) + lw $a0, -16($fp) + lw $a1, -20($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -12($fp) + # IF_GREATER_ZERO local_southeast_at_CellularAutomaton_internal_2 GOTO label_FALSE_137 + # IF_GREATER_ZERO local_southeast_at_CellularAutomaton_internal_2 GOTO label_FALSE_137 + lw $t0, -12($fp) + bgt $t0, 0, label_FALSE_137 + # IF_ZERO local_southeast_at_CellularAutomaton_internal_2 GOTO label_FALSE_137 + # IF_ZERO local_southeast_at_CellularAutomaton_internal_2 GOTO label_FALSE_137 + lw $t0, -12($fp) + beq $t0, 0, label_FALSE_137 + # LOCAL local_southeast_at_CellularAutomaton_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -12($fp) + # GOTO label_END_138 +j label_END_138 +label_FALSE_137: + # LOCAL local_southeast_at_CellularAutomaton_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -12($fp) + label_END_138: +# LOCAL local_southeast_at_CellularAutomaton_internal_0 --> -4($fp) +# LOCAL local_southeast_at_CellularAutomaton_internal_2 --> -12($fp) +# Obtain value from -12($fp) +lw $v0, -12($fp) +lw $v0, 12($v0) +sw $v0, -4($fp) +# IF_ZERO local_southeast_at_CellularAutomaton_internal_0 GOTO label_FALSEIF_135 +# IF_ZERO local_southeast_at_CellularAutomaton_internal_0 GOTO label_FALSEIF_135 +lw $t0, -4($fp) +beq $t0, 0, label_FALSEIF_135 +# LOCAL local_southeast_at_CellularAutomaton_internal_6 --> -28($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_17 +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +sw $v0, -28($fp) +# LOCAL local_southeast_at_CellularAutomaton_internal_1 --> -8($fp) +# LOCAL local_southeast_at_CellularAutomaton_internal_6 --> -28($fp) +# local_southeast_at_CellularAutomaton_internal_1 = local_southeast_at_CellularAutomaton_internal_6 +lw $t0, -28($fp) +sw $t0, -8($fp) +# GOTO label_ENDIF_136 +j label_ENDIF_136 +label_FALSEIF_135: + # LOCAL local_southeast_at_CellularAutomaton_internal_14 --> -60($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -60($fp) + # LOCAL local_southeast_at_CellularAutomaton_internal_13 --> -56($fp) + # PARAM param_southeast_at_CellularAutomaton_position_0 --> 0($fp) + # LOCAL local_southeast_at_CellularAutomaton_internal_14 --> -60($fp) + # local_southeast_at_CellularAutomaton_internal_13 = PARAM param_southeast_at_CellularAutomaton_position_0 + local_southeast_at_CellularAutomaton_internal_14 + lw $t1, 0($fp) + lw $t0, 12($t1) + lw $t1, -60($fp) + lw $t2, 12($t1) + add $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -56($fp) + # local_southeast_at_CellularAutomaton_internal_15 = GETATTRIBUTE columns CellularAutomaton + # LOCAL local_southeast_at_CellularAutomaton_internal_15 --> -64($fp) + lw $t0, 16($s1) + sw $t0, -64($fp) + # LOCAL local_southeast_at_CellularAutomaton_internal_12 --> -52($fp) + # LOCAL local_southeast_at_CellularAutomaton_internal_13 --> -56($fp) + # LOCAL local_southeast_at_CellularAutomaton_internal_15 --> -64($fp) + # local_southeast_at_CellularAutomaton_internal_12 = local_southeast_at_CellularAutomaton_internal_13 / local_southeast_at_CellularAutomaton_internal_15 + lw $t1, -56($fp) + lw $t0, 12($t1) + lw $t1, -64($fp) + lw $t2, 12($t1) + div $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -52($fp) + # local_southeast_at_CellularAutomaton_internal_16 = GETATTRIBUTE columns CellularAutomaton + # LOCAL local_southeast_at_CellularAutomaton_internal_16 --> -68($fp) + lw $t0, 16($s1) + sw $t0, -68($fp) + # LOCAL local_southeast_at_CellularAutomaton_internal_11 --> -48($fp) + # LOCAL local_southeast_at_CellularAutomaton_internal_12 --> -52($fp) + # LOCAL local_southeast_at_CellularAutomaton_internal_16 --> -68($fp) + # local_southeast_at_CellularAutomaton_internal_11 = local_southeast_at_CellularAutomaton_internal_12 * local_southeast_at_CellularAutomaton_internal_16 + lw $t1, -52($fp) + lw $t0, 12($t1) + lw $t1, -68($fp) + lw $t2, 12($t1) + mul $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -48($fp) + # LOCAL local_southeast_at_CellularAutomaton_internal_18 --> -76($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -76($fp) + # LOCAL local_southeast_at_CellularAutomaton_internal_17 --> -72($fp) + # PARAM param_southeast_at_CellularAutomaton_position_0 --> 0($fp) + # LOCAL local_southeast_at_CellularAutomaton_internal_18 --> -76($fp) + # local_southeast_at_CellularAutomaton_internal_17 = PARAM param_southeast_at_CellularAutomaton_position_0 + local_southeast_at_CellularAutomaton_internal_18 + lw $t1, 0($fp) + lw $t0, 12($t1) + lw $t1, -76($fp) + lw $t2, 12($t1) + add $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -72($fp) + # IF_ZERO local_southeast_at_CellularAutomaton_internal_11 GOTO label_FALSE_141 + # IF_ZERO local_southeast_at_CellularAutomaton_internal_11 GOTO label_FALSE_141 + lw $t0, -48($fp) + beq $t0, 0, label_FALSE_141 + # IF_ZERO local_southeast_at_CellularAutomaton_internal_17 GOTO label_FALSE_141 + # IF_ZERO local_southeast_at_CellularAutomaton_internal_17 GOTO label_FALSE_141 + lw $t0, -72($fp) + beq $t0, 0, label_FALSE_141 + # LOCAL local_southeast_at_CellularAutomaton_internal_10 --> -44($fp) + # LOCAL local_southeast_at_CellularAutomaton_internal_11 --> -48($fp) + # Comparing -48($fp) type with String + la $v0, String + lw $a0, -48($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -44($fp) + # IF_ZERO local_southeast_at_CellularAutomaton_internal_10 GOTO label_COMPARE_STRING_144 + # IF_ZERO local_southeast_at_CellularAutomaton_internal_10 GOTO label_COMPARE_STRING_144 + lw $t0, -44($fp) + beq $t0, 0, label_COMPARE_STRING_144 + # LOCAL local_southeast_at_CellularAutomaton_internal_10 --> -44($fp) + # LOCAL local_southeast_at_CellularAutomaton_internal_11 --> -48($fp) + # Comparing -48($fp) type with Bool + la $v0, Bool + lw $a0, -48($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -44($fp) + # IF_ZERO local_southeast_at_CellularAutomaton_internal_10 GOTO label_COMPARE_BY_VALUE_145 + # IF_ZERO local_southeast_at_CellularAutomaton_internal_10 GOTO label_COMPARE_BY_VALUE_145 + lw $t0, -44($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_145 + # LOCAL local_southeast_at_CellularAutomaton_internal_10 --> -44($fp) + # LOCAL local_southeast_at_CellularAutomaton_internal_11 --> -48($fp) + # Comparing -48($fp) type with Int + la $v0, Int + lw $a0, -48($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -44($fp) + # IF_ZERO local_southeast_at_CellularAutomaton_internal_10 GOTO label_COMPARE_BY_VALUE_145 + # IF_ZERO local_southeast_at_CellularAutomaton_internal_10 GOTO label_COMPARE_BY_VALUE_145 + lw $t0, -44($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_145 + # LOCAL local_southeast_at_CellularAutomaton_internal_10 --> -44($fp) + # LOCAL local_southeast_at_CellularAutomaton_internal_11 --> -48($fp) + # LOCAL local_southeast_at_CellularAutomaton_internal_17 --> -72($fp) + # Load pointers and SUB + lw $a0, -48($fp) + lw $a1, -72($fp) + sub $a0, $a0, $a1 + sw $a0, -44($fp) + # IF_ZERO local_southeast_at_CellularAutomaton_internal_10 GOTO label_TRUE_142 + # IF_ZERO local_southeast_at_CellularAutomaton_internal_10 GOTO label_TRUE_142 + lw $t0, -44($fp) + beq $t0, 0, label_TRUE_142 + # GOTO label_FALSE_141 + j label_FALSE_141 + label_COMPARE_BY_VALUE_145: + # LOCAL local_southeast_at_CellularAutomaton_internal_10 --> -44($fp) + # LOCAL local_southeast_at_CellularAutomaton_internal_11 --> -48($fp) + # LOCAL local_southeast_at_CellularAutomaton_internal_17 --> -72($fp) + lw $a0, -48($fp) + lw $a1, -72($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -44($fp) + # IF_ZERO local_southeast_at_CellularAutomaton_internal_10 GOTO label_TRUE_142 + # IF_ZERO local_southeast_at_CellularAutomaton_internal_10 GOTO label_TRUE_142 + lw $t0, -44($fp) + beq $t0, 0, label_TRUE_142 + # GOTO label_FALSE_141 + j label_FALSE_141 + label_COMPARE_STRING_144: + # LOCAL local_southeast_at_CellularAutomaton_internal_10 --> -44($fp) + # LOCAL local_southeast_at_CellularAutomaton_internal_11 --> -48($fp) + # LOCAL local_southeast_at_CellularAutomaton_internal_17 --> -72($fp) + # Load strings for comparison + lw $v0, -48($fp) + lw $v1, -72($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -44($fp) + # IF_ZERO local_southeast_at_CellularAutomaton_internal_10 GOTO label_CONTINUE_146 + # IF_ZERO local_southeast_at_CellularAutomaton_internal_10 GOTO label_CONTINUE_146 + lw $t0, -44($fp) + beq $t0, 0, label_CONTINUE_146 + # GOTO label_FALSE_141 + j label_FALSE_141 + label_CONTINUE_146: + # LOCAL local_southeast_at_CellularAutomaton_internal_10 --> -44($fp) + # LOCAL local_southeast_at_CellularAutomaton_internal_11 --> -48($fp) + # LOCAL local_southeast_at_CellularAutomaton_internal_17 --> -72($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -48($fp) + lw $v1, -72($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_147: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_148 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_147 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_148: + # Store result + sw $a2, -44($fp) + # IF_ZERO local_southeast_at_CellularAutomaton_internal_10 GOTO label_TRUE_142 + # IF_ZERO local_southeast_at_CellularAutomaton_internal_10 GOTO label_TRUE_142 + lw $t0, -44($fp) + beq $t0, 0, label_TRUE_142 + label_FALSE_141: + # LOCAL local_southeast_at_CellularAutomaton_internal_9 --> -40($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -40($fp) + # GOTO label_END_143 +j label_END_143 +label_TRUE_142: + # LOCAL local_southeast_at_CellularAutomaton_internal_9 --> -40($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -40($fp) + label_END_143: +# LOCAL local_southeast_at_CellularAutomaton_internal_7 --> -32($fp) +# LOCAL local_southeast_at_CellularAutomaton_internal_9 --> -40($fp) +# Obtain value from -40($fp) +lw $v0, -40($fp) +lw $v0, 12($v0) +sw $v0, -32($fp) +# IF_ZERO local_southeast_at_CellularAutomaton_internal_7 GOTO label_FALSEIF_139 +# IF_ZERO local_southeast_at_CellularAutomaton_internal_7 GOTO label_FALSEIF_139 +lw $t0, -32($fp) +beq $t0, 0, label_FALSEIF_139 +# LOCAL local_southeast_at_CellularAutomaton_internal_19 --> -80($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_18 +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +sw $v0, -80($fp) +# LOCAL local_southeast_at_CellularAutomaton_internal_8 --> -36($fp) +# LOCAL local_southeast_at_CellularAutomaton_internal_19 --> -80($fp) +# local_southeast_at_CellularAutomaton_internal_8 = local_southeast_at_CellularAutomaton_internal_19 +lw $t0, -80($fp) +sw $t0, -36($fp) +# GOTO label_ENDIF_140 +j label_ENDIF_140 +label_FALSEIF_139: + # LOCAL local_southeast_at_CellularAutomaton_internal_22 --> -92($fp) + # local_southeast_at_CellularAutomaton_internal_22 = SELF + sw $s1, -92($fp) + # LOCAL local_southeast_at_CellularAutomaton_internal_20 --> -84($fp) + # LOCAL local_southeast_at_CellularAutomaton_internal_22 --> -92($fp) + # local_southeast_at_CellularAutomaton_internal_20 = local_southeast_at_CellularAutomaton_internal_22 + lw $t0, -92($fp) + sw $t0, -84($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_southeast_at_CellularAutomaton_internal_24 --> -100($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -100($fp) + # LOCAL local_southeast_at_CellularAutomaton_internal_23 --> -96($fp) + # PARAM param_southeast_at_CellularAutomaton_position_0 --> 0($fp) + # LOCAL local_southeast_at_CellularAutomaton_internal_24 --> -100($fp) + # local_southeast_at_CellularAutomaton_internal_23 = PARAM param_southeast_at_CellularAutomaton_position_0 + local_southeast_at_CellularAutomaton_internal_24 + lw $t1, 0($fp) + lw $t0, 12($t1) + lw $t1, -100($fp) + lw $t2, 12($t1) + add $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -96($fp) + # ARG local_southeast_at_CellularAutomaton_internal_23 + # LOCAL local_southeast_at_CellularAutomaton_internal_23 --> -96($fp) + lw $t0, -96($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_southeast_at_CellularAutomaton_internal_20 --> -84($fp) + # LOCAL local_southeast_at_CellularAutomaton_internal_21 --> -88($fp) + # local_southeast_at_CellularAutomaton_internal_21 = VCALL local_southeast_at_CellularAutomaton_internal_20 south + # Save new self pointer in $s1 + lw $s1, -84($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 72($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -88($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_southeast_at_CellularAutomaton_internal_8 --> -36($fp) + # LOCAL local_southeast_at_CellularAutomaton_internal_21 --> -88($fp) + # local_southeast_at_CellularAutomaton_internal_8 = local_southeast_at_CellularAutomaton_internal_21 + lw $t0, -88($fp) + sw $t0, -36($fp) + label_ENDIF_140: +# LOCAL local_southeast_at_CellularAutomaton_internal_1 --> -8($fp) +# LOCAL local_southeast_at_CellularAutomaton_internal_8 --> -36($fp) +# local_southeast_at_CellularAutomaton_internal_1 = local_southeast_at_CellularAutomaton_internal_8 +lw $t0, -36($fp) +sw $t0, -8($fp) +label_ENDIF_136: +# RETURN local_southeast_at_CellularAutomaton_internal_1 +lw $v0, -8($fp) +# Deallocate stack frame for function function_southeast_at_CellularAutomaton. +# Restore $ra +lw $ra, 4($sp) +# Restore $fp +lw $fp, 0($sp) +# Restore Stack pointer $sp +addu $sp, $sp, 108 +# Deallocate function args +addu $sp, $sp, 4 +jr $ra +# Function END + + +# function_southwest_at_CellularAutomaton implementation. +# @Params: +# 0($fp) = param_southwest_at_CellularAutomaton_position_0 +function_southwest_at_CellularAutomaton: + # Allocate stack frame for function function_southwest_at_CellularAutomaton. + subu $sp, $sp, 92 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 92 + # local_southwest_at_CellularAutomaton_internal_3 = GETATTRIBUTE board_size CellularAutomaton + # LOCAL local_southwest_at_CellularAutomaton_internal_3 --> -16($fp) + lw $t0, 20($s1) + sw $t0, -16($fp) + # local_southwest_at_CellularAutomaton_internal_5 = GETATTRIBUTE columns CellularAutomaton + # LOCAL local_southwest_at_CellularAutomaton_internal_5 --> -24($fp) + lw $t0, 16($s1) + sw $t0, -24($fp) + # LOCAL local_southwest_at_CellularAutomaton_internal_4 --> -20($fp) + # PARAM param_southwest_at_CellularAutomaton_position_0 --> 0($fp) + # LOCAL local_southwest_at_CellularAutomaton_internal_5 --> -24($fp) + # local_southwest_at_CellularAutomaton_internal_4 = PARAM param_southwest_at_CellularAutomaton_position_0 + local_southwest_at_CellularAutomaton_internal_5 + lw $t1, 0($fp) + lw $t0, 12($t1) + lw $t1, -24($fp) + lw $t2, 12($t1) + add $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -20($fp) + # LOCAL local_southwest_at_CellularAutomaton_internal_2 --> -12($fp) + # LOCAL local_southwest_at_CellularAutomaton_internal_3 --> -16($fp) + # LOCAL local_southwest_at_CellularAutomaton_internal_4 --> -20($fp) + lw $a0, -16($fp) + lw $a1, -20($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -12($fp) + # IF_GREATER_ZERO local_southwest_at_CellularAutomaton_internal_2 GOTO label_FALSE_151 + # IF_GREATER_ZERO local_southwest_at_CellularAutomaton_internal_2 GOTO label_FALSE_151 + lw $t0, -12($fp) + bgt $t0, 0, label_FALSE_151 + # IF_ZERO local_southwest_at_CellularAutomaton_internal_2 GOTO label_FALSE_151 + # IF_ZERO local_southwest_at_CellularAutomaton_internal_2 GOTO label_FALSE_151 + lw $t0, -12($fp) + beq $t0, 0, label_FALSE_151 + # LOCAL local_southwest_at_CellularAutomaton_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -12($fp) + # GOTO label_END_152 +j label_END_152 +label_FALSE_151: + # LOCAL local_southwest_at_CellularAutomaton_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -12($fp) + label_END_152: +# LOCAL local_southwest_at_CellularAutomaton_internal_0 --> -4($fp) +# LOCAL local_southwest_at_CellularAutomaton_internal_2 --> -12($fp) +# Obtain value from -12($fp) +lw $v0, -12($fp) +lw $v0, 12($v0) +sw $v0, -4($fp) +# IF_ZERO local_southwest_at_CellularAutomaton_internal_0 GOTO label_FALSEIF_149 +# IF_ZERO local_southwest_at_CellularAutomaton_internal_0 GOTO label_FALSEIF_149 +lw $t0, -4($fp) +beq $t0, 0, label_FALSEIF_149 +# LOCAL local_southwest_at_CellularAutomaton_internal_6 --> -28($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_19 +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +sw $v0, -28($fp) +# LOCAL local_southwest_at_CellularAutomaton_internal_1 --> -8($fp) +# LOCAL local_southwest_at_CellularAutomaton_internal_6 --> -28($fp) +# local_southwest_at_CellularAutomaton_internal_1 = local_southwest_at_CellularAutomaton_internal_6 +lw $t0, -28($fp) +sw $t0, -8($fp) +# GOTO label_ENDIF_150 +j label_ENDIF_150 +label_FALSEIF_149: + # local_southwest_at_CellularAutomaton_internal_13 = GETATTRIBUTE columns CellularAutomaton + # LOCAL local_southwest_at_CellularAutomaton_internal_13 --> -56($fp) + lw $t0, 16($s1) + sw $t0, -56($fp) + # LOCAL local_southwest_at_CellularAutomaton_internal_12 --> -52($fp) + # PARAM param_southwest_at_CellularAutomaton_position_0 --> 0($fp) + # LOCAL local_southwest_at_CellularAutomaton_internal_13 --> -56($fp) + # local_southwest_at_CellularAutomaton_internal_12 = PARAM param_southwest_at_CellularAutomaton_position_0 / local_southwest_at_CellularAutomaton_internal_13 + lw $t1, 0($fp) + lw $t0, 12($t1) + lw $t1, -56($fp) + lw $t2, 12($t1) + div $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -52($fp) + # local_southwest_at_CellularAutomaton_internal_14 = GETATTRIBUTE columns CellularAutomaton + # LOCAL local_southwest_at_CellularAutomaton_internal_14 --> -60($fp) + lw $t0, 16($s1) + sw $t0, -60($fp) + # LOCAL local_southwest_at_CellularAutomaton_internal_11 --> -48($fp) + # LOCAL local_southwest_at_CellularAutomaton_internal_12 --> -52($fp) + # LOCAL local_southwest_at_CellularAutomaton_internal_14 --> -60($fp) + # local_southwest_at_CellularAutomaton_internal_11 = local_southwest_at_CellularAutomaton_internal_12 * local_southwest_at_CellularAutomaton_internal_14 + lw $t1, -52($fp) + lw $t0, 12($t1) + lw $t1, -60($fp) + lw $t2, 12($t1) + mul $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -48($fp) + # IF_ZERO local_southwest_at_CellularAutomaton_internal_11 GOTO label_FALSE_155 + # IF_ZERO local_southwest_at_CellularAutomaton_internal_11 GOTO label_FALSE_155 + lw $t0, -48($fp) + beq $t0, 0, label_FALSE_155 + # IF_ZERO param_southwest_at_CellularAutomaton_position_0 GOTO label_FALSE_155 + # IF_ZERO param_southwest_at_CellularAutomaton_position_0 GOTO label_FALSE_155 + lw $t0, 0($fp) + beq $t0, 0, label_FALSE_155 + # LOCAL local_southwest_at_CellularAutomaton_internal_10 --> -44($fp) + # LOCAL local_southwest_at_CellularAutomaton_internal_11 --> -48($fp) + # Comparing -48($fp) type with String + la $v0, String + lw $a0, -48($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -44($fp) + # IF_ZERO local_southwest_at_CellularAutomaton_internal_10 GOTO label_COMPARE_STRING_158 + # IF_ZERO local_southwest_at_CellularAutomaton_internal_10 GOTO label_COMPARE_STRING_158 + lw $t0, -44($fp) + beq $t0, 0, label_COMPARE_STRING_158 + # LOCAL local_southwest_at_CellularAutomaton_internal_10 --> -44($fp) + # LOCAL local_southwest_at_CellularAutomaton_internal_11 --> -48($fp) + # Comparing -48($fp) type with Bool + la $v0, Bool + lw $a0, -48($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -44($fp) + # IF_ZERO local_southwest_at_CellularAutomaton_internal_10 GOTO label_COMPARE_BY_VALUE_159 + # IF_ZERO local_southwest_at_CellularAutomaton_internal_10 GOTO label_COMPARE_BY_VALUE_159 + lw $t0, -44($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_159 + # LOCAL local_southwest_at_CellularAutomaton_internal_10 --> -44($fp) + # LOCAL local_southwest_at_CellularAutomaton_internal_11 --> -48($fp) + # Comparing -48($fp) type with Int + la $v0, Int + lw $a0, -48($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -44($fp) + # IF_ZERO local_southwest_at_CellularAutomaton_internal_10 GOTO label_COMPARE_BY_VALUE_159 + # IF_ZERO local_southwest_at_CellularAutomaton_internal_10 GOTO label_COMPARE_BY_VALUE_159 + lw $t0, -44($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_159 + # LOCAL local_southwest_at_CellularAutomaton_internal_10 --> -44($fp) + # LOCAL local_southwest_at_CellularAutomaton_internal_11 --> -48($fp) + # PARAM param_southwest_at_CellularAutomaton_position_0 --> 0($fp) + # Load pointers and SUB + lw $a0, -48($fp) + lw $a1, 0($fp) + sub $a0, $a0, $a1 + sw $a0, -44($fp) + # IF_ZERO local_southwest_at_CellularAutomaton_internal_10 GOTO label_TRUE_156 + # IF_ZERO local_southwest_at_CellularAutomaton_internal_10 GOTO label_TRUE_156 + lw $t0, -44($fp) + beq $t0, 0, label_TRUE_156 + # GOTO label_FALSE_155 + j label_FALSE_155 + label_COMPARE_BY_VALUE_159: + # LOCAL local_southwest_at_CellularAutomaton_internal_10 --> -44($fp) + # LOCAL local_southwest_at_CellularAutomaton_internal_11 --> -48($fp) + # PARAM param_southwest_at_CellularAutomaton_position_0 --> 0($fp) + lw $a0, -48($fp) + lw $a1, 0($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -44($fp) + # IF_ZERO local_southwest_at_CellularAutomaton_internal_10 GOTO label_TRUE_156 + # IF_ZERO local_southwest_at_CellularAutomaton_internal_10 GOTO label_TRUE_156 + lw $t0, -44($fp) + beq $t0, 0, label_TRUE_156 + # GOTO label_FALSE_155 + j label_FALSE_155 + label_COMPARE_STRING_158: + # LOCAL local_southwest_at_CellularAutomaton_internal_10 --> -44($fp) + # LOCAL local_southwest_at_CellularAutomaton_internal_11 --> -48($fp) + # PARAM param_southwest_at_CellularAutomaton_position_0 --> 0($fp) + # Load strings for comparison + lw $v0, -48($fp) + lw $v1, 0($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -44($fp) + # IF_ZERO local_southwest_at_CellularAutomaton_internal_10 GOTO label_CONTINUE_160 + # IF_ZERO local_southwest_at_CellularAutomaton_internal_10 GOTO label_CONTINUE_160 + lw $t0, -44($fp) + beq $t0, 0, label_CONTINUE_160 + # GOTO label_FALSE_155 + j label_FALSE_155 + label_CONTINUE_160: + # LOCAL local_southwest_at_CellularAutomaton_internal_10 --> -44($fp) + # LOCAL local_southwest_at_CellularAutomaton_internal_11 --> -48($fp) + # PARAM param_southwest_at_CellularAutomaton_position_0 --> 0($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -48($fp) + lw $v1, 0($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_161: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_162 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_161 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_162: + # Store result + sw $a2, -44($fp) + # IF_ZERO local_southwest_at_CellularAutomaton_internal_10 GOTO label_TRUE_156 + # IF_ZERO local_southwest_at_CellularAutomaton_internal_10 GOTO label_TRUE_156 + lw $t0, -44($fp) + beq $t0, 0, label_TRUE_156 + label_FALSE_155: + # LOCAL local_southwest_at_CellularAutomaton_internal_9 --> -40($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -40($fp) + # GOTO label_END_157 +j label_END_157 +label_TRUE_156: + # LOCAL local_southwest_at_CellularAutomaton_internal_9 --> -40($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -40($fp) + label_END_157: +# LOCAL local_southwest_at_CellularAutomaton_internal_7 --> -32($fp) +# LOCAL local_southwest_at_CellularAutomaton_internal_9 --> -40($fp) +# Obtain value from -40($fp) +lw $v0, -40($fp) +lw $v0, 12($v0) +sw $v0, -32($fp) +# IF_ZERO local_southwest_at_CellularAutomaton_internal_7 GOTO label_FALSEIF_153 +# IF_ZERO local_southwest_at_CellularAutomaton_internal_7 GOTO label_FALSEIF_153 +lw $t0, -32($fp) +beq $t0, 0, label_FALSEIF_153 +# LOCAL local_southwest_at_CellularAutomaton_internal_15 --> -64($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_20 +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +sw $v0, -64($fp) +# LOCAL local_southwest_at_CellularAutomaton_internal_8 --> -36($fp) +# LOCAL local_southwest_at_CellularAutomaton_internal_15 --> -64($fp) +# local_southwest_at_CellularAutomaton_internal_8 = local_southwest_at_CellularAutomaton_internal_15 +lw $t0, -64($fp) +sw $t0, -36($fp) +# GOTO label_ENDIF_154 +j label_ENDIF_154 +label_FALSEIF_153: + # LOCAL local_southwest_at_CellularAutomaton_internal_18 --> -76($fp) + # local_southwest_at_CellularAutomaton_internal_18 = SELF + sw $s1, -76($fp) + # LOCAL local_southwest_at_CellularAutomaton_internal_16 --> -68($fp) + # LOCAL local_southwest_at_CellularAutomaton_internal_18 --> -76($fp) + # local_southwest_at_CellularAutomaton_internal_16 = local_southwest_at_CellularAutomaton_internal_18 + lw $t0, -76($fp) + sw $t0, -68($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_southwest_at_CellularAutomaton_internal_20 --> -84($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -84($fp) + # LOCAL local_southwest_at_CellularAutomaton_internal_19 --> -80($fp) + # PARAM param_southwest_at_CellularAutomaton_position_0 --> 0($fp) + # LOCAL local_southwest_at_CellularAutomaton_internal_20 --> -84($fp) + # local_southwest_at_CellularAutomaton_internal_19 = PARAM param_southwest_at_CellularAutomaton_position_0 - local_southwest_at_CellularAutomaton_internal_20 + lw $t1, 0($fp) + lw $t0, 12($t1) + lw $t1, -84($fp) + lw $t2, 12($t1) + sub $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -80($fp) + # ARG local_southwest_at_CellularAutomaton_internal_19 + # LOCAL local_southwest_at_CellularAutomaton_internal_19 --> -80($fp) + lw $t0, -80($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_southwest_at_CellularAutomaton_internal_16 --> -68($fp) + # LOCAL local_southwest_at_CellularAutomaton_internal_17 --> -72($fp) + # local_southwest_at_CellularAutomaton_internal_17 = VCALL local_southwest_at_CellularAutomaton_internal_16 south + # Save new self pointer in $s1 + lw $s1, -68($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 72($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -72($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_southwest_at_CellularAutomaton_internal_8 --> -36($fp) + # LOCAL local_southwest_at_CellularAutomaton_internal_17 --> -72($fp) + # local_southwest_at_CellularAutomaton_internal_8 = local_southwest_at_CellularAutomaton_internal_17 + lw $t0, -72($fp) + sw $t0, -36($fp) + label_ENDIF_154: +# LOCAL local_southwest_at_CellularAutomaton_internal_1 --> -8($fp) +# LOCAL local_southwest_at_CellularAutomaton_internal_8 --> -36($fp) +# local_southwest_at_CellularAutomaton_internal_1 = local_southwest_at_CellularAutomaton_internal_8 +lw $t0, -36($fp) +sw $t0, -8($fp) +label_ENDIF_150: +# RETURN local_southwest_at_CellularAutomaton_internal_1 +lw $v0, -8($fp) +# Deallocate stack frame for function function_southwest_at_CellularAutomaton. +# Restore $ra +lw $ra, 4($sp) +# Restore $fp +lw $fp, 0($sp) +# Restore Stack pointer $sp +addu $sp, $sp, 92 +# Deallocate function args +addu $sp, $sp, 4 +jr $ra +# Function END + + +# function_neighbors_at_CellularAutomaton implementation. +# @Params: +# 0($fp) = param_neighbors_at_CellularAutomaton_position_0 +function_neighbors_at_CellularAutomaton: + # Allocate stack frame for function function_neighbors_at_CellularAutomaton. + subu $sp, $sp, 356 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 356 + # LOCAL local_neighbors_at_CellularAutomaton_internal_13 --> -56($fp) + # local_neighbors_at_CellularAutomaton_internal_13 = SELF + sw $s1, -56($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_11 --> -48($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_13 --> -56($fp) + # local_neighbors_at_CellularAutomaton_internal_11 = local_neighbors_at_CellularAutomaton_internal_13 + lw $t0, -56($fp) + sw $t0, -48($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # ARG param_neighbors_at_CellularAutomaton_position_0 + # PARAM param_neighbors_at_CellularAutomaton_position_0 --> 0($fp) + lw $t0, 0($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_11 --> -48($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_12 --> -52($fp) + # local_neighbors_at_CellularAutomaton_internal_12 = VCALL local_neighbors_at_CellularAutomaton_internal_11 north + # Save new self pointer in $s1 + lw $s1, -48($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 88($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -52($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_neighbors_at_CellularAutomaton_internal_14 --> -60($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_21 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -60($fp) + # IF_ZERO local_neighbors_at_CellularAutomaton_internal_12 GOTO label_FALSE_165 + # IF_ZERO local_neighbors_at_CellularAutomaton_internal_12 GOTO label_FALSE_165 + lw $t0, -52($fp) + beq $t0, 0, label_FALSE_165 + # IF_ZERO local_neighbors_at_CellularAutomaton_internal_14 GOTO label_FALSE_165 + # IF_ZERO local_neighbors_at_CellularAutomaton_internal_14 GOTO label_FALSE_165 + lw $t0, -60($fp) + beq $t0, 0, label_FALSE_165 + # LOCAL local_neighbors_at_CellularAutomaton_internal_10 --> -44($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_12 --> -52($fp) + # Comparing -52($fp) type with String + la $v0, String + lw $a0, -52($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -44($fp) + # IF_ZERO local_neighbors_at_CellularAutomaton_internal_10 GOTO label_COMPARE_STRING_168 + # IF_ZERO local_neighbors_at_CellularAutomaton_internal_10 GOTO label_COMPARE_STRING_168 + lw $t0, -44($fp) + beq $t0, 0, label_COMPARE_STRING_168 + # LOCAL local_neighbors_at_CellularAutomaton_internal_10 --> -44($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_12 --> -52($fp) + # Comparing -52($fp) type with Bool + la $v0, Bool + lw $a0, -52($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -44($fp) + # IF_ZERO local_neighbors_at_CellularAutomaton_internal_10 GOTO label_COMPARE_BY_VALUE_169 + # IF_ZERO local_neighbors_at_CellularAutomaton_internal_10 GOTO label_COMPARE_BY_VALUE_169 + lw $t0, -44($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_169 + # LOCAL local_neighbors_at_CellularAutomaton_internal_10 --> -44($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_12 --> -52($fp) + # Comparing -52($fp) type with Int + la $v0, Int + lw $a0, -52($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -44($fp) + # IF_ZERO local_neighbors_at_CellularAutomaton_internal_10 GOTO label_COMPARE_BY_VALUE_169 + # IF_ZERO local_neighbors_at_CellularAutomaton_internal_10 GOTO label_COMPARE_BY_VALUE_169 + lw $t0, -44($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_169 + # LOCAL local_neighbors_at_CellularAutomaton_internal_10 --> -44($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_12 --> -52($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_14 --> -60($fp) + # Load pointers and SUB + lw $a0, -52($fp) + lw $a1, -60($fp) + sub $a0, $a0, $a1 + sw $a0, -44($fp) + # IF_ZERO local_neighbors_at_CellularAutomaton_internal_10 GOTO label_TRUE_166 + # IF_ZERO local_neighbors_at_CellularAutomaton_internal_10 GOTO label_TRUE_166 + lw $t0, -44($fp) + beq $t0, 0, label_TRUE_166 + # GOTO label_FALSE_165 + j label_FALSE_165 + label_COMPARE_BY_VALUE_169: + # LOCAL local_neighbors_at_CellularAutomaton_internal_10 --> -44($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_12 --> -52($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_14 --> -60($fp) + lw $a0, -52($fp) + lw $a1, -60($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -44($fp) + # IF_ZERO local_neighbors_at_CellularAutomaton_internal_10 GOTO label_TRUE_166 + # IF_ZERO local_neighbors_at_CellularAutomaton_internal_10 GOTO label_TRUE_166 + lw $t0, -44($fp) + beq $t0, 0, label_TRUE_166 + # GOTO label_FALSE_165 + j label_FALSE_165 + label_COMPARE_STRING_168: + # LOCAL local_neighbors_at_CellularAutomaton_internal_10 --> -44($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_12 --> -52($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_14 --> -60($fp) + # Load strings for comparison + lw $v0, -52($fp) + lw $v1, -60($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -44($fp) + # IF_ZERO local_neighbors_at_CellularAutomaton_internal_10 GOTO label_CONTINUE_170 + # IF_ZERO local_neighbors_at_CellularAutomaton_internal_10 GOTO label_CONTINUE_170 + lw $t0, -44($fp) + beq $t0, 0, label_CONTINUE_170 + # GOTO label_FALSE_165 + j label_FALSE_165 + label_CONTINUE_170: + # LOCAL local_neighbors_at_CellularAutomaton_internal_10 --> -44($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_12 --> -52($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_14 --> -60($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -52($fp) + lw $v1, -60($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_171: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_172 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_171 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_172: + # Store result + sw $a2, -44($fp) + # IF_ZERO local_neighbors_at_CellularAutomaton_internal_10 GOTO label_TRUE_166 + # IF_ZERO local_neighbors_at_CellularAutomaton_internal_10 GOTO label_TRUE_166 + lw $t0, -44($fp) + beq $t0, 0, label_TRUE_166 + label_FALSE_165: + # LOCAL local_neighbors_at_CellularAutomaton_internal_9 --> -40($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -40($fp) + # GOTO label_END_167 +j label_END_167 +label_TRUE_166: + # LOCAL local_neighbors_at_CellularAutomaton_internal_9 --> -40($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -40($fp) + label_END_167: +# LOCAL local_neighbors_at_CellularAutomaton_internal_7 --> -32($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_9 --> -40($fp) +# Obtain value from -40($fp) +lw $v0, -40($fp) +lw $v0, 12($v0) +sw $v0, -32($fp) +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_7 GOTO label_FALSEIF_163 +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_7 GOTO label_FALSEIF_163 +lw $t0, -32($fp) +beq $t0, 0, label_FALSEIF_163 +# LOCAL local_neighbors_at_CellularAutomaton_internal_15 --> -64($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 1 +sw $t0, 12($v0) +sw $v0, -64($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_8 --> -36($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_15 --> -64($fp) +# local_neighbors_at_CellularAutomaton_internal_8 = local_neighbors_at_CellularAutomaton_internal_15 +lw $t0, -64($fp) +sw $t0, -36($fp) +# GOTO label_ENDIF_164 +j label_ENDIF_164 +label_FALSEIF_163: + # LOCAL local_neighbors_at_CellularAutomaton_internal_16 --> -68($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -68($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_8 --> -36($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_16 --> -68($fp) + # local_neighbors_at_CellularAutomaton_internal_8 = local_neighbors_at_CellularAutomaton_internal_16 + lw $t0, -68($fp) + sw $t0, -36($fp) + label_ENDIF_164: +# LOCAL local_neighbors_at_CellularAutomaton_internal_23 --> -96($fp) +# local_neighbors_at_CellularAutomaton_internal_23 = SELF +sw $s1, -96($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_21 --> -88($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_23 --> -96($fp) +# local_neighbors_at_CellularAutomaton_internal_21 = local_neighbors_at_CellularAutomaton_internal_23 +lw $t0, -96($fp) +sw $t0, -88($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# ARG param_neighbors_at_CellularAutomaton_position_0 +# PARAM param_neighbors_at_CellularAutomaton_position_0 --> 0($fp) +lw $t0, 0($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_21 --> -88($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_22 --> -92($fp) +# local_neighbors_at_CellularAutomaton_internal_22 = VCALL local_neighbors_at_CellularAutomaton_internal_21 south +# Save new self pointer in $s1 +lw $s1, -88($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 72($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -92($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_neighbors_at_CellularAutomaton_internal_24 --> -100($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_22 +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +sw $v0, -100($fp) +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_22 GOTO label_FALSE_175 +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_22 GOTO label_FALSE_175 +lw $t0, -92($fp) +beq $t0, 0, label_FALSE_175 +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_24 GOTO label_FALSE_175 +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_24 GOTO label_FALSE_175 +lw $t0, -100($fp) +beq $t0, 0, label_FALSE_175 +# LOCAL local_neighbors_at_CellularAutomaton_internal_20 --> -84($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_22 --> -92($fp) +# Comparing -92($fp) type with String +la $v0, String +lw $a0, -92($fp) +lw $a0, 0($a0) +sub $a0, $a0, $v0 +sw $a0, -84($fp) +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_20 GOTO label_COMPARE_STRING_178 +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_20 GOTO label_COMPARE_STRING_178 +lw $t0, -84($fp) +beq $t0, 0, label_COMPARE_STRING_178 +# LOCAL local_neighbors_at_CellularAutomaton_internal_20 --> -84($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_22 --> -92($fp) +# Comparing -92($fp) type with Bool +la $v0, Bool +lw $a0, -92($fp) +lw $a0, 0($a0) +lw $a0, 12($a0) +sub $a0, $a0, $v0 +sw $a0, -84($fp) +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_20 GOTO label_COMPARE_BY_VALUE_179 +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_20 GOTO label_COMPARE_BY_VALUE_179 +lw $t0, -84($fp) +beq $t0, 0, label_COMPARE_BY_VALUE_179 +# LOCAL local_neighbors_at_CellularAutomaton_internal_20 --> -84($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_22 --> -92($fp) +# Comparing -92($fp) type with Int +la $v0, Int +lw $a0, -92($fp) +lw $a0, 0($a0) +lw $a0, 12($a0) +sub $a0, $a0, $v0 +sw $a0, -84($fp) +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_20 GOTO label_COMPARE_BY_VALUE_179 +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_20 GOTO label_COMPARE_BY_VALUE_179 +lw $t0, -84($fp) +beq $t0, 0, label_COMPARE_BY_VALUE_179 +# LOCAL local_neighbors_at_CellularAutomaton_internal_20 --> -84($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_22 --> -92($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_24 --> -100($fp) +# Load pointers and SUB +lw $a0, -92($fp) +lw $a1, -100($fp) +sub $a0, $a0, $a1 +sw $a0, -84($fp) +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_20 GOTO label_TRUE_176 +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_20 GOTO label_TRUE_176 +lw $t0, -84($fp) +beq $t0, 0, label_TRUE_176 +# GOTO label_FALSE_175 +j label_FALSE_175 +label_COMPARE_BY_VALUE_179: + # LOCAL local_neighbors_at_CellularAutomaton_internal_20 --> -84($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_22 --> -92($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_24 --> -100($fp) + lw $a0, -92($fp) + lw $a1, -100($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -84($fp) + # IF_ZERO local_neighbors_at_CellularAutomaton_internal_20 GOTO label_TRUE_176 + # IF_ZERO local_neighbors_at_CellularAutomaton_internal_20 GOTO label_TRUE_176 + lw $t0, -84($fp) + beq $t0, 0, label_TRUE_176 + # GOTO label_FALSE_175 + j label_FALSE_175 + label_COMPARE_STRING_178: + # LOCAL local_neighbors_at_CellularAutomaton_internal_20 --> -84($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_22 --> -92($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_24 --> -100($fp) + # Load strings for comparison + lw $v0, -92($fp) + lw $v1, -100($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -84($fp) + # IF_ZERO local_neighbors_at_CellularAutomaton_internal_20 GOTO label_CONTINUE_180 + # IF_ZERO local_neighbors_at_CellularAutomaton_internal_20 GOTO label_CONTINUE_180 + lw $t0, -84($fp) + beq $t0, 0, label_CONTINUE_180 + # GOTO label_FALSE_175 + j label_FALSE_175 + label_CONTINUE_180: + # LOCAL local_neighbors_at_CellularAutomaton_internal_20 --> -84($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_22 --> -92($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_24 --> -100($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -92($fp) + lw $v1, -100($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_181: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_182 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_181 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_182: + # Store result + sw $a2, -84($fp) + # IF_ZERO local_neighbors_at_CellularAutomaton_internal_20 GOTO label_TRUE_176 + # IF_ZERO local_neighbors_at_CellularAutomaton_internal_20 GOTO label_TRUE_176 + lw $t0, -84($fp) + beq $t0, 0, label_TRUE_176 + label_FALSE_175: + # LOCAL local_neighbors_at_CellularAutomaton_internal_19 --> -80($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -80($fp) + # GOTO label_END_177 +j label_END_177 +label_TRUE_176: + # LOCAL local_neighbors_at_CellularAutomaton_internal_19 --> -80($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -80($fp) + label_END_177: +# LOCAL local_neighbors_at_CellularAutomaton_internal_17 --> -72($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_19 --> -80($fp) +# Obtain value from -80($fp) +lw $v0, -80($fp) +lw $v0, 12($v0) +sw $v0, -72($fp) +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_17 GOTO label_FALSEIF_173 +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_17 GOTO label_FALSEIF_173 +lw $t0, -72($fp) +beq $t0, 0, label_FALSEIF_173 +# LOCAL local_neighbors_at_CellularAutomaton_internal_25 --> -104($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 1 +sw $t0, 12($v0) +sw $v0, -104($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_18 --> -76($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_25 --> -104($fp) +# local_neighbors_at_CellularAutomaton_internal_18 = local_neighbors_at_CellularAutomaton_internal_25 +lw $t0, -104($fp) +sw $t0, -76($fp) +# GOTO label_ENDIF_174 +j label_ENDIF_174 +label_FALSEIF_173: + # LOCAL local_neighbors_at_CellularAutomaton_internal_26 --> -108($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -108($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_18 --> -76($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_26 --> -108($fp) + # local_neighbors_at_CellularAutomaton_internal_18 = local_neighbors_at_CellularAutomaton_internal_26 + lw $t0, -108($fp) + sw $t0, -76($fp) + label_ENDIF_174: +# LOCAL local_neighbors_at_CellularAutomaton_internal_6 --> -28($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_8 --> -36($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_18 --> -76($fp) +# local_neighbors_at_CellularAutomaton_internal_6 = local_neighbors_at_CellularAutomaton_internal_8 + local_neighbors_at_CellularAutomaton_internal_18 +lw $t1, -36($fp) +lw $t0, 12($t1) +lw $t1, -76($fp) +lw $t2, 12($t1) +add $t0, $t0, $t2 +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t1, String +sw $t1, 0($v0) +la $t1, String_start +sw $t1, 4($v0) +# Load type offset +li $t1, 8 +sw $t1, 8($v0) +la $t1, Int +sw $t1, 12($v0) +li $t1, 3 +sw $t1, 16($v0) +move $t1, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t1, 0($v0) +la $t1, Int_start +sw $t1, 4($v0) +# Load type offset +li $t1, 16 +sw $t1, 8($v0) +sw $t0, 12($v0) +sw $v0, -28($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_33 --> -136($fp) +# local_neighbors_at_CellularAutomaton_internal_33 = SELF +sw $s1, -136($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_31 --> -128($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_33 --> -136($fp) +# local_neighbors_at_CellularAutomaton_internal_31 = local_neighbors_at_CellularAutomaton_internal_33 +lw $t0, -136($fp) +sw $t0, -128($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# ARG param_neighbors_at_CellularAutomaton_position_0 +# PARAM param_neighbors_at_CellularAutomaton_position_0 --> 0($fp) +lw $t0, 0($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_31 --> -128($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_32 --> -132($fp) +# local_neighbors_at_CellularAutomaton_internal_32 = VCALL local_neighbors_at_CellularAutomaton_internal_31 east +# Save new self pointer in $s1 +lw $s1, -128($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 76($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -132($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_neighbors_at_CellularAutomaton_internal_34 --> -140($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_23 +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +sw $v0, -140($fp) +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_32 GOTO label_FALSE_185 +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_32 GOTO label_FALSE_185 +lw $t0, -132($fp) +beq $t0, 0, label_FALSE_185 +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_34 GOTO label_FALSE_185 +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_34 GOTO label_FALSE_185 +lw $t0, -140($fp) +beq $t0, 0, label_FALSE_185 +# LOCAL local_neighbors_at_CellularAutomaton_internal_30 --> -124($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_32 --> -132($fp) +# Comparing -132($fp) type with String +la $v0, String +lw $a0, -132($fp) +lw $a0, 0($a0) +sub $a0, $a0, $v0 +sw $a0, -124($fp) +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_30 GOTO label_COMPARE_STRING_188 +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_30 GOTO label_COMPARE_STRING_188 +lw $t0, -124($fp) +beq $t0, 0, label_COMPARE_STRING_188 +# LOCAL local_neighbors_at_CellularAutomaton_internal_30 --> -124($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_32 --> -132($fp) +# Comparing -132($fp) type with Bool +la $v0, Bool +lw $a0, -132($fp) +lw $a0, 0($a0) +lw $a0, 12($a0) +sub $a0, $a0, $v0 +sw $a0, -124($fp) +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_30 GOTO label_COMPARE_BY_VALUE_189 +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_30 GOTO label_COMPARE_BY_VALUE_189 +lw $t0, -124($fp) +beq $t0, 0, label_COMPARE_BY_VALUE_189 +# LOCAL local_neighbors_at_CellularAutomaton_internal_30 --> -124($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_32 --> -132($fp) +# Comparing -132($fp) type with Int +la $v0, Int +lw $a0, -132($fp) +lw $a0, 0($a0) +lw $a0, 12($a0) +sub $a0, $a0, $v0 +sw $a0, -124($fp) +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_30 GOTO label_COMPARE_BY_VALUE_189 +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_30 GOTO label_COMPARE_BY_VALUE_189 +lw $t0, -124($fp) +beq $t0, 0, label_COMPARE_BY_VALUE_189 +# LOCAL local_neighbors_at_CellularAutomaton_internal_30 --> -124($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_32 --> -132($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_34 --> -140($fp) +# Load pointers and SUB +lw $a0, -132($fp) +lw $a1, -140($fp) +sub $a0, $a0, $a1 +sw $a0, -124($fp) +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_30 GOTO label_TRUE_186 +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_30 GOTO label_TRUE_186 +lw $t0, -124($fp) +beq $t0, 0, label_TRUE_186 +# GOTO label_FALSE_185 +j label_FALSE_185 +label_COMPARE_BY_VALUE_189: + # LOCAL local_neighbors_at_CellularAutomaton_internal_30 --> -124($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_32 --> -132($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_34 --> -140($fp) + lw $a0, -132($fp) + lw $a1, -140($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -124($fp) + # IF_ZERO local_neighbors_at_CellularAutomaton_internal_30 GOTO label_TRUE_186 + # IF_ZERO local_neighbors_at_CellularAutomaton_internal_30 GOTO label_TRUE_186 + lw $t0, -124($fp) + beq $t0, 0, label_TRUE_186 + # GOTO label_FALSE_185 + j label_FALSE_185 + label_COMPARE_STRING_188: + # LOCAL local_neighbors_at_CellularAutomaton_internal_30 --> -124($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_32 --> -132($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_34 --> -140($fp) + # Load strings for comparison + lw $v0, -132($fp) + lw $v1, -140($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -124($fp) + # IF_ZERO local_neighbors_at_CellularAutomaton_internal_30 GOTO label_CONTINUE_190 + # IF_ZERO local_neighbors_at_CellularAutomaton_internal_30 GOTO label_CONTINUE_190 + lw $t0, -124($fp) + beq $t0, 0, label_CONTINUE_190 + # GOTO label_FALSE_185 + j label_FALSE_185 + label_CONTINUE_190: + # LOCAL local_neighbors_at_CellularAutomaton_internal_30 --> -124($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_32 --> -132($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_34 --> -140($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -132($fp) + lw $v1, -140($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_191: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_192 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_191 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_192: + # Store result + sw $a2, -124($fp) + # IF_ZERO local_neighbors_at_CellularAutomaton_internal_30 GOTO label_TRUE_186 + # IF_ZERO local_neighbors_at_CellularAutomaton_internal_30 GOTO label_TRUE_186 + lw $t0, -124($fp) + beq $t0, 0, label_TRUE_186 + label_FALSE_185: + # LOCAL local_neighbors_at_CellularAutomaton_internal_29 --> -120($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -120($fp) + # GOTO label_END_187 +j label_END_187 +label_TRUE_186: + # LOCAL local_neighbors_at_CellularAutomaton_internal_29 --> -120($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -120($fp) + label_END_187: +# LOCAL local_neighbors_at_CellularAutomaton_internal_27 --> -112($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_29 --> -120($fp) +# Obtain value from -120($fp) +lw $v0, -120($fp) +lw $v0, 12($v0) +sw $v0, -112($fp) +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_27 GOTO label_FALSEIF_183 +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_27 GOTO label_FALSEIF_183 +lw $t0, -112($fp) +beq $t0, 0, label_FALSEIF_183 +# LOCAL local_neighbors_at_CellularAutomaton_internal_35 --> -144($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 1 +sw $t0, 12($v0) +sw $v0, -144($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_28 --> -116($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_35 --> -144($fp) +# local_neighbors_at_CellularAutomaton_internal_28 = local_neighbors_at_CellularAutomaton_internal_35 +lw $t0, -144($fp) +sw $t0, -116($fp) +# GOTO label_ENDIF_184 +j label_ENDIF_184 +label_FALSEIF_183: + # LOCAL local_neighbors_at_CellularAutomaton_internal_36 --> -148($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -148($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_28 --> -116($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_36 --> -148($fp) + # local_neighbors_at_CellularAutomaton_internal_28 = local_neighbors_at_CellularAutomaton_internal_36 + lw $t0, -148($fp) + sw $t0, -116($fp) + label_ENDIF_184: +# LOCAL local_neighbors_at_CellularAutomaton_internal_5 --> -24($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_6 --> -28($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_28 --> -116($fp) +# local_neighbors_at_CellularAutomaton_internal_5 = local_neighbors_at_CellularAutomaton_internal_6 + local_neighbors_at_CellularAutomaton_internal_28 +lw $t1, -28($fp) +lw $t0, 12($t1) +lw $t1, -116($fp) +lw $t2, 12($t1) +add $t0, $t0, $t2 +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t1, String +sw $t1, 0($v0) +la $t1, String_start +sw $t1, 4($v0) +# Load type offset +li $t1, 8 +sw $t1, 8($v0) +la $t1, Int +sw $t1, 12($v0) +li $t1, 3 +sw $t1, 16($v0) +move $t1, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t1, 0($v0) +la $t1, Int_start +sw $t1, 4($v0) +# Load type offset +li $t1, 16 +sw $t1, 8($v0) +sw $t0, 12($v0) +sw $v0, -24($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_43 --> -176($fp) +# local_neighbors_at_CellularAutomaton_internal_43 = SELF +sw $s1, -176($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_41 --> -168($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_43 --> -176($fp) +# local_neighbors_at_CellularAutomaton_internal_41 = local_neighbors_at_CellularAutomaton_internal_43 +lw $t0, -176($fp) +sw $t0, -168($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# ARG param_neighbors_at_CellularAutomaton_position_0 +# PARAM param_neighbors_at_CellularAutomaton_position_0 --> 0($fp) +lw $t0, 0($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_41 --> -168($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_42 --> -172($fp) +# local_neighbors_at_CellularAutomaton_internal_42 = VCALL local_neighbors_at_CellularAutomaton_internal_41 west +# Save new self pointer in $s1 +lw $s1, -168($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 32($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -172($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_neighbors_at_CellularAutomaton_internal_44 --> -180($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_24 +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +sw $v0, -180($fp) +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_42 GOTO label_FALSE_195 +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_42 GOTO label_FALSE_195 +lw $t0, -172($fp) +beq $t0, 0, label_FALSE_195 +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_44 GOTO label_FALSE_195 +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_44 GOTO label_FALSE_195 +lw $t0, -180($fp) +beq $t0, 0, label_FALSE_195 +# LOCAL local_neighbors_at_CellularAutomaton_internal_40 --> -164($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_42 --> -172($fp) +# Comparing -172($fp) type with String +la $v0, String +lw $a0, -172($fp) +lw $a0, 0($a0) +sub $a0, $a0, $v0 +sw $a0, -164($fp) +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_40 GOTO label_COMPARE_STRING_198 +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_40 GOTO label_COMPARE_STRING_198 +lw $t0, -164($fp) +beq $t0, 0, label_COMPARE_STRING_198 +# LOCAL local_neighbors_at_CellularAutomaton_internal_40 --> -164($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_42 --> -172($fp) +# Comparing -172($fp) type with Bool +la $v0, Bool +lw $a0, -172($fp) +lw $a0, 0($a0) +lw $a0, 12($a0) +sub $a0, $a0, $v0 +sw $a0, -164($fp) +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_40 GOTO label_COMPARE_BY_VALUE_199 +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_40 GOTO label_COMPARE_BY_VALUE_199 +lw $t0, -164($fp) +beq $t0, 0, label_COMPARE_BY_VALUE_199 +# LOCAL local_neighbors_at_CellularAutomaton_internal_40 --> -164($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_42 --> -172($fp) +# Comparing -172($fp) type with Int +la $v0, Int +lw $a0, -172($fp) +lw $a0, 0($a0) +lw $a0, 12($a0) +sub $a0, $a0, $v0 +sw $a0, -164($fp) +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_40 GOTO label_COMPARE_BY_VALUE_199 +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_40 GOTO label_COMPARE_BY_VALUE_199 +lw $t0, -164($fp) +beq $t0, 0, label_COMPARE_BY_VALUE_199 +# LOCAL local_neighbors_at_CellularAutomaton_internal_40 --> -164($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_42 --> -172($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_44 --> -180($fp) +# Load pointers and SUB +lw $a0, -172($fp) +lw $a1, -180($fp) +sub $a0, $a0, $a1 +sw $a0, -164($fp) +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_40 GOTO label_TRUE_196 +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_40 GOTO label_TRUE_196 +lw $t0, -164($fp) +beq $t0, 0, label_TRUE_196 +# GOTO label_FALSE_195 +j label_FALSE_195 +label_COMPARE_BY_VALUE_199: + # LOCAL local_neighbors_at_CellularAutomaton_internal_40 --> -164($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_42 --> -172($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_44 --> -180($fp) + lw $a0, -172($fp) + lw $a1, -180($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -164($fp) + # IF_ZERO local_neighbors_at_CellularAutomaton_internal_40 GOTO label_TRUE_196 + # IF_ZERO local_neighbors_at_CellularAutomaton_internal_40 GOTO label_TRUE_196 + lw $t0, -164($fp) + beq $t0, 0, label_TRUE_196 + # GOTO label_FALSE_195 + j label_FALSE_195 + label_COMPARE_STRING_198: + # LOCAL local_neighbors_at_CellularAutomaton_internal_40 --> -164($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_42 --> -172($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_44 --> -180($fp) + # Load strings for comparison + lw $v0, -172($fp) + lw $v1, -180($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -164($fp) + # IF_ZERO local_neighbors_at_CellularAutomaton_internal_40 GOTO label_CONTINUE_200 + # IF_ZERO local_neighbors_at_CellularAutomaton_internal_40 GOTO label_CONTINUE_200 + lw $t0, -164($fp) + beq $t0, 0, label_CONTINUE_200 + # GOTO label_FALSE_195 + j label_FALSE_195 + label_CONTINUE_200: + # LOCAL local_neighbors_at_CellularAutomaton_internal_40 --> -164($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_42 --> -172($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_44 --> -180($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -172($fp) + lw $v1, -180($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_201: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_202 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_201 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_202: + # Store result + sw $a2, -164($fp) + # IF_ZERO local_neighbors_at_CellularAutomaton_internal_40 GOTO label_TRUE_196 + # IF_ZERO local_neighbors_at_CellularAutomaton_internal_40 GOTO label_TRUE_196 + lw $t0, -164($fp) + beq $t0, 0, label_TRUE_196 + label_FALSE_195: + # LOCAL local_neighbors_at_CellularAutomaton_internal_39 --> -160($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -160($fp) + # GOTO label_END_197 +j label_END_197 +label_TRUE_196: + # LOCAL local_neighbors_at_CellularAutomaton_internal_39 --> -160($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -160($fp) + label_END_197: +# LOCAL local_neighbors_at_CellularAutomaton_internal_37 --> -152($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_39 --> -160($fp) +# Obtain value from -160($fp) +lw $v0, -160($fp) +lw $v0, 12($v0) +sw $v0, -152($fp) +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_37 GOTO label_FALSEIF_193 +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_37 GOTO label_FALSEIF_193 +lw $t0, -152($fp) +beq $t0, 0, label_FALSEIF_193 +# LOCAL local_neighbors_at_CellularAutomaton_internal_45 --> -184($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 1 +sw $t0, 12($v0) +sw $v0, -184($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_38 --> -156($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_45 --> -184($fp) +# local_neighbors_at_CellularAutomaton_internal_38 = local_neighbors_at_CellularAutomaton_internal_45 +lw $t0, -184($fp) +sw $t0, -156($fp) +# GOTO label_ENDIF_194 +j label_ENDIF_194 +label_FALSEIF_193: + # LOCAL local_neighbors_at_CellularAutomaton_internal_46 --> -188($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -188($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_38 --> -156($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_46 --> -188($fp) + # local_neighbors_at_CellularAutomaton_internal_38 = local_neighbors_at_CellularAutomaton_internal_46 + lw $t0, -188($fp) + sw $t0, -156($fp) + label_ENDIF_194: +# LOCAL local_neighbors_at_CellularAutomaton_internal_4 --> -20($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_5 --> -24($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_38 --> -156($fp) +# local_neighbors_at_CellularAutomaton_internal_4 = local_neighbors_at_CellularAutomaton_internal_5 + local_neighbors_at_CellularAutomaton_internal_38 +lw $t1, -24($fp) +lw $t0, 12($t1) +lw $t1, -156($fp) +lw $t2, 12($t1) +add $t0, $t0, $t2 +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t1, String +sw $t1, 0($v0) +la $t1, String_start +sw $t1, 4($v0) +# Load type offset +li $t1, 8 +sw $t1, 8($v0) +la $t1, Int +sw $t1, 12($v0) +li $t1, 3 +sw $t1, 16($v0) +move $t1, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t1, 0($v0) +la $t1, Int_start +sw $t1, 4($v0) +# Load type offset +li $t1, 16 +sw $t1, 8($v0) +sw $t0, 12($v0) +sw $v0, -20($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_53 --> -216($fp) +# local_neighbors_at_CellularAutomaton_internal_53 = SELF +sw $s1, -216($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_51 --> -208($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_53 --> -216($fp) +# local_neighbors_at_CellularAutomaton_internal_51 = local_neighbors_at_CellularAutomaton_internal_53 +lw $t0, -216($fp) +sw $t0, -208($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# ARG param_neighbors_at_CellularAutomaton_position_0 +# PARAM param_neighbors_at_CellularAutomaton_position_0 --> 0($fp) +lw $t0, 0($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_51 --> -208($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_52 --> -212($fp) +# local_neighbors_at_CellularAutomaton_internal_52 = VCALL local_neighbors_at_CellularAutomaton_internal_51 northeast +# Save new self pointer in $s1 +lw $s1, -208($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 52($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -212($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_neighbors_at_CellularAutomaton_internal_54 --> -220($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_25 +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +sw $v0, -220($fp) +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_52 GOTO label_FALSE_205 +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_52 GOTO label_FALSE_205 +lw $t0, -212($fp) +beq $t0, 0, label_FALSE_205 +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_54 GOTO label_FALSE_205 +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_54 GOTO label_FALSE_205 +lw $t0, -220($fp) +beq $t0, 0, label_FALSE_205 +# LOCAL local_neighbors_at_CellularAutomaton_internal_50 --> -204($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_52 --> -212($fp) +# Comparing -212($fp) type with String +la $v0, String +lw $a0, -212($fp) +lw $a0, 0($a0) +sub $a0, $a0, $v0 +sw $a0, -204($fp) +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_50 GOTO label_COMPARE_STRING_208 +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_50 GOTO label_COMPARE_STRING_208 +lw $t0, -204($fp) +beq $t0, 0, label_COMPARE_STRING_208 +# LOCAL local_neighbors_at_CellularAutomaton_internal_50 --> -204($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_52 --> -212($fp) +# Comparing -212($fp) type with Bool +la $v0, Bool +lw $a0, -212($fp) +lw $a0, 0($a0) +lw $a0, 12($a0) +sub $a0, $a0, $v0 +sw $a0, -204($fp) +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_50 GOTO label_COMPARE_BY_VALUE_209 +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_50 GOTO label_COMPARE_BY_VALUE_209 +lw $t0, -204($fp) +beq $t0, 0, label_COMPARE_BY_VALUE_209 +# LOCAL local_neighbors_at_CellularAutomaton_internal_50 --> -204($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_52 --> -212($fp) +# Comparing -212($fp) type with Int +la $v0, Int +lw $a0, -212($fp) +lw $a0, 0($a0) +lw $a0, 12($a0) +sub $a0, $a0, $v0 +sw $a0, -204($fp) +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_50 GOTO label_COMPARE_BY_VALUE_209 +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_50 GOTO label_COMPARE_BY_VALUE_209 +lw $t0, -204($fp) +beq $t0, 0, label_COMPARE_BY_VALUE_209 +# LOCAL local_neighbors_at_CellularAutomaton_internal_50 --> -204($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_52 --> -212($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_54 --> -220($fp) +# Load pointers and SUB +lw $a0, -212($fp) +lw $a1, -220($fp) +sub $a0, $a0, $a1 +sw $a0, -204($fp) +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_50 GOTO label_TRUE_206 +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_50 GOTO label_TRUE_206 +lw $t0, -204($fp) +beq $t0, 0, label_TRUE_206 +# GOTO label_FALSE_205 +j label_FALSE_205 +label_COMPARE_BY_VALUE_209: + # LOCAL local_neighbors_at_CellularAutomaton_internal_50 --> -204($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_52 --> -212($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_54 --> -220($fp) + lw $a0, -212($fp) + lw $a1, -220($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -204($fp) + # IF_ZERO local_neighbors_at_CellularAutomaton_internal_50 GOTO label_TRUE_206 + # IF_ZERO local_neighbors_at_CellularAutomaton_internal_50 GOTO label_TRUE_206 + lw $t0, -204($fp) + beq $t0, 0, label_TRUE_206 + # GOTO label_FALSE_205 + j label_FALSE_205 + label_COMPARE_STRING_208: + # LOCAL local_neighbors_at_CellularAutomaton_internal_50 --> -204($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_52 --> -212($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_54 --> -220($fp) + # Load strings for comparison + lw $v0, -212($fp) + lw $v1, -220($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -204($fp) + # IF_ZERO local_neighbors_at_CellularAutomaton_internal_50 GOTO label_CONTINUE_210 + # IF_ZERO local_neighbors_at_CellularAutomaton_internal_50 GOTO label_CONTINUE_210 + lw $t0, -204($fp) + beq $t0, 0, label_CONTINUE_210 + # GOTO label_FALSE_205 + j label_FALSE_205 + label_CONTINUE_210: + # LOCAL local_neighbors_at_CellularAutomaton_internal_50 --> -204($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_52 --> -212($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_54 --> -220($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -212($fp) + lw $v1, -220($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_211: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_212 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_211 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_212: + # Store result + sw $a2, -204($fp) + # IF_ZERO local_neighbors_at_CellularAutomaton_internal_50 GOTO label_TRUE_206 + # IF_ZERO local_neighbors_at_CellularAutomaton_internal_50 GOTO label_TRUE_206 + lw $t0, -204($fp) + beq $t0, 0, label_TRUE_206 + label_FALSE_205: + # LOCAL local_neighbors_at_CellularAutomaton_internal_49 --> -200($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -200($fp) + # GOTO label_END_207 +j label_END_207 +label_TRUE_206: + # LOCAL local_neighbors_at_CellularAutomaton_internal_49 --> -200($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -200($fp) + label_END_207: +# LOCAL local_neighbors_at_CellularAutomaton_internal_47 --> -192($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_49 --> -200($fp) +# Obtain value from -200($fp) +lw $v0, -200($fp) +lw $v0, 12($v0) +sw $v0, -192($fp) +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_47 GOTO label_FALSEIF_203 +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_47 GOTO label_FALSEIF_203 +lw $t0, -192($fp) +beq $t0, 0, label_FALSEIF_203 +# LOCAL local_neighbors_at_CellularAutomaton_internal_55 --> -224($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 1 +sw $t0, 12($v0) +sw $v0, -224($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_48 --> -196($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_55 --> -224($fp) +# local_neighbors_at_CellularAutomaton_internal_48 = local_neighbors_at_CellularAutomaton_internal_55 +lw $t0, -224($fp) +sw $t0, -196($fp) +# GOTO label_ENDIF_204 +j label_ENDIF_204 +label_FALSEIF_203: + # LOCAL local_neighbors_at_CellularAutomaton_internal_56 --> -228($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -228($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_48 --> -196($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_56 --> -228($fp) + # local_neighbors_at_CellularAutomaton_internal_48 = local_neighbors_at_CellularAutomaton_internal_56 + lw $t0, -228($fp) + sw $t0, -196($fp) + label_ENDIF_204: +# LOCAL local_neighbors_at_CellularAutomaton_internal_3 --> -16($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_4 --> -20($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_48 --> -196($fp) +# local_neighbors_at_CellularAutomaton_internal_3 = local_neighbors_at_CellularAutomaton_internal_4 + local_neighbors_at_CellularAutomaton_internal_48 +lw $t1, -20($fp) +lw $t0, 12($t1) +lw $t1, -196($fp) +lw $t2, 12($t1) +add $t0, $t0, $t2 +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t1, String +sw $t1, 0($v0) +la $t1, String_start +sw $t1, 4($v0) +# Load type offset +li $t1, 8 +sw $t1, 8($v0) +la $t1, Int +sw $t1, 12($v0) +li $t1, 3 +sw $t1, 16($v0) +move $t1, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t1, 0($v0) +la $t1, Int_start +sw $t1, 4($v0) +# Load type offset +li $t1, 16 +sw $t1, 8($v0) +sw $t0, 12($v0) +sw $v0, -16($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_63 --> -256($fp) +# local_neighbors_at_CellularAutomaton_internal_63 = SELF +sw $s1, -256($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_61 --> -248($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_63 --> -256($fp) +# local_neighbors_at_CellularAutomaton_internal_61 = local_neighbors_at_CellularAutomaton_internal_63 +lw $t0, -256($fp) +sw $t0, -248($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# ARG param_neighbors_at_CellularAutomaton_position_0 +# PARAM param_neighbors_at_CellularAutomaton_position_0 --> 0($fp) +lw $t0, 0($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_61 --> -248($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_62 --> -252($fp) +# local_neighbors_at_CellularAutomaton_internal_62 = VCALL local_neighbors_at_CellularAutomaton_internal_61 northwest +# Save new self pointer in $s1 +lw $s1, -248($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 64($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -252($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_neighbors_at_CellularAutomaton_internal_64 --> -260($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_26 +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +sw $v0, -260($fp) +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_62 GOTO label_FALSE_215 +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_62 GOTO label_FALSE_215 +lw $t0, -252($fp) +beq $t0, 0, label_FALSE_215 +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_64 GOTO label_FALSE_215 +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_64 GOTO label_FALSE_215 +lw $t0, -260($fp) +beq $t0, 0, label_FALSE_215 +# LOCAL local_neighbors_at_CellularAutomaton_internal_60 --> -244($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_62 --> -252($fp) +# Comparing -252($fp) type with String +la $v0, String +lw $a0, -252($fp) +lw $a0, 0($a0) +sub $a0, $a0, $v0 +sw $a0, -244($fp) +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_60 GOTO label_COMPARE_STRING_218 +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_60 GOTO label_COMPARE_STRING_218 +lw $t0, -244($fp) +beq $t0, 0, label_COMPARE_STRING_218 +# LOCAL local_neighbors_at_CellularAutomaton_internal_60 --> -244($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_62 --> -252($fp) +# Comparing -252($fp) type with Bool +la $v0, Bool +lw $a0, -252($fp) +lw $a0, 0($a0) +lw $a0, 12($a0) +sub $a0, $a0, $v0 +sw $a0, -244($fp) +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_60 GOTO label_COMPARE_BY_VALUE_219 +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_60 GOTO label_COMPARE_BY_VALUE_219 +lw $t0, -244($fp) +beq $t0, 0, label_COMPARE_BY_VALUE_219 +# LOCAL local_neighbors_at_CellularAutomaton_internal_60 --> -244($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_62 --> -252($fp) +# Comparing -252($fp) type with Int +la $v0, Int +lw $a0, -252($fp) +lw $a0, 0($a0) +lw $a0, 12($a0) +sub $a0, $a0, $v0 +sw $a0, -244($fp) +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_60 GOTO label_COMPARE_BY_VALUE_219 +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_60 GOTO label_COMPARE_BY_VALUE_219 +lw $t0, -244($fp) +beq $t0, 0, label_COMPARE_BY_VALUE_219 +# LOCAL local_neighbors_at_CellularAutomaton_internal_60 --> -244($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_62 --> -252($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_64 --> -260($fp) +# Load pointers and SUB +lw $a0, -252($fp) +lw $a1, -260($fp) +sub $a0, $a0, $a1 +sw $a0, -244($fp) +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_60 GOTO label_TRUE_216 +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_60 GOTO label_TRUE_216 +lw $t0, -244($fp) +beq $t0, 0, label_TRUE_216 +# GOTO label_FALSE_215 +j label_FALSE_215 +label_COMPARE_BY_VALUE_219: + # LOCAL local_neighbors_at_CellularAutomaton_internal_60 --> -244($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_62 --> -252($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_64 --> -260($fp) + lw $a0, -252($fp) + lw $a1, -260($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -244($fp) + # IF_ZERO local_neighbors_at_CellularAutomaton_internal_60 GOTO label_TRUE_216 + # IF_ZERO local_neighbors_at_CellularAutomaton_internal_60 GOTO label_TRUE_216 + lw $t0, -244($fp) + beq $t0, 0, label_TRUE_216 + # GOTO label_FALSE_215 + j label_FALSE_215 + label_COMPARE_STRING_218: + # LOCAL local_neighbors_at_CellularAutomaton_internal_60 --> -244($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_62 --> -252($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_64 --> -260($fp) + # Load strings for comparison + lw $v0, -252($fp) + lw $v1, -260($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -244($fp) + # IF_ZERO local_neighbors_at_CellularAutomaton_internal_60 GOTO label_CONTINUE_220 + # IF_ZERO local_neighbors_at_CellularAutomaton_internal_60 GOTO label_CONTINUE_220 + lw $t0, -244($fp) + beq $t0, 0, label_CONTINUE_220 + # GOTO label_FALSE_215 + j label_FALSE_215 + label_CONTINUE_220: + # LOCAL local_neighbors_at_CellularAutomaton_internal_60 --> -244($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_62 --> -252($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_64 --> -260($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -252($fp) + lw $v1, -260($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_221: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_222 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_221 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_222: + # Store result + sw $a2, -244($fp) + # IF_ZERO local_neighbors_at_CellularAutomaton_internal_60 GOTO label_TRUE_216 + # IF_ZERO local_neighbors_at_CellularAutomaton_internal_60 GOTO label_TRUE_216 + lw $t0, -244($fp) + beq $t0, 0, label_TRUE_216 + label_FALSE_215: + # LOCAL local_neighbors_at_CellularAutomaton_internal_59 --> -240($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -240($fp) + # GOTO label_END_217 +j label_END_217 +label_TRUE_216: + # LOCAL local_neighbors_at_CellularAutomaton_internal_59 --> -240($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -240($fp) + label_END_217: +# LOCAL local_neighbors_at_CellularAutomaton_internal_57 --> -232($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_59 --> -240($fp) +# Obtain value from -240($fp) +lw $v0, -240($fp) +lw $v0, 12($v0) +sw $v0, -232($fp) +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_57 GOTO label_FALSEIF_213 +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_57 GOTO label_FALSEIF_213 +lw $t0, -232($fp) +beq $t0, 0, label_FALSEIF_213 +# LOCAL local_neighbors_at_CellularAutomaton_internal_65 --> -264($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 1 +sw $t0, 12($v0) +sw $v0, -264($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_58 --> -236($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_65 --> -264($fp) +# local_neighbors_at_CellularAutomaton_internal_58 = local_neighbors_at_CellularAutomaton_internal_65 +lw $t0, -264($fp) +sw $t0, -236($fp) +# GOTO label_ENDIF_214 +j label_ENDIF_214 +label_FALSEIF_213: + # LOCAL local_neighbors_at_CellularAutomaton_internal_66 --> -268($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -268($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_58 --> -236($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_66 --> -268($fp) + # local_neighbors_at_CellularAutomaton_internal_58 = local_neighbors_at_CellularAutomaton_internal_66 + lw $t0, -268($fp) + sw $t0, -236($fp) + label_ENDIF_214: +# LOCAL local_neighbors_at_CellularAutomaton_internal_2 --> -12($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_3 --> -16($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_58 --> -236($fp) +# local_neighbors_at_CellularAutomaton_internal_2 = local_neighbors_at_CellularAutomaton_internal_3 + local_neighbors_at_CellularAutomaton_internal_58 +lw $t1, -16($fp) +lw $t0, 12($t1) +lw $t1, -236($fp) +lw $t2, 12($t1) +add $t0, $t0, $t2 +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t1, String +sw $t1, 0($v0) +la $t1, String_start +sw $t1, 4($v0) +# Load type offset +li $t1, 8 +sw $t1, 8($v0) +la $t1, Int +sw $t1, 12($v0) +li $t1, 3 +sw $t1, 16($v0) +move $t1, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t1, 0($v0) +la $t1, Int_start +sw $t1, 4($v0) +# Load type offset +li $t1, 16 +sw $t1, 8($v0) +sw $t0, 12($v0) +sw $v0, -12($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_73 --> -296($fp) +# local_neighbors_at_CellularAutomaton_internal_73 = SELF +sw $s1, -296($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_71 --> -288($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_73 --> -296($fp) +# local_neighbors_at_CellularAutomaton_internal_71 = local_neighbors_at_CellularAutomaton_internal_73 +lw $t0, -296($fp) +sw $t0, -288($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# ARG param_neighbors_at_CellularAutomaton_position_0 +# PARAM param_neighbors_at_CellularAutomaton_position_0 --> 0($fp) +lw $t0, 0($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_71 --> -288($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_72 --> -292($fp) +# local_neighbors_at_CellularAutomaton_internal_72 = VCALL local_neighbors_at_CellularAutomaton_internal_71 southeast +# Save new self pointer in $s1 +lw $s1, -288($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 48($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -292($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_neighbors_at_CellularAutomaton_internal_74 --> -300($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_27 +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +sw $v0, -300($fp) +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_72 GOTO label_FALSE_225 +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_72 GOTO label_FALSE_225 +lw $t0, -292($fp) +beq $t0, 0, label_FALSE_225 +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_74 GOTO label_FALSE_225 +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_74 GOTO label_FALSE_225 +lw $t0, -300($fp) +beq $t0, 0, label_FALSE_225 +# LOCAL local_neighbors_at_CellularAutomaton_internal_70 --> -284($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_72 --> -292($fp) +# Comparing -292($fp) type with String +la $v0, String +lw $a0, -292($fp) +lw $a0, 0($a0) +sub $a0, $a0, $v0 +sw $a0, -284($fp) +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_70 GOTO label_COMPARE_STRING_228 +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_70 GOTO label_COMPARE_STRING_228 +lw $t0, -284($fp) +beq $t0, 0, label_COMPARE_STRING_228 +# LOCAL local_neighbors_at_CellularAutomaton_internal_70 --> -284($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_72 --> -292($fp) +# Comparing -292($fp) type with Bool +la $v0, Bool +lw $a0, -292($fp) +lw $a0, 0($a0) +lw $a0, 12($a0) +sub $a0, $a0, $v0 +sw $a0, -284($fp) +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_70 GOTO label_COMPARE_BY_VALUE_229 +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_70 GOTO label_COMPARE_BY_VALUE_229 +lw $t0, -284($fp) +beq $t0, 0, label_COMPARE_BY_VALUE_229 +# LOCAL local_neighbors_at_CellularAutomaton_internal_70 --> -284($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_72 --> -292($fp) +# Comparing -292($fp) type with Int +la $v0, Int +lw $a0, -292($fp) +lw $a0, 0($a0) +lw $a0, 12($a0) +sub $a0, $a0, $v0 +sw $a0, -284($fp) +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_70 GOTO label_COMPARE_BY_VALUE_229 +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_70 GOTO label_COMPARE_BY_VALUE_229 +lw $t0, -284($fp) +beq $t0, 0, label_COMPARE_BY_VALUE_229 +# LOCAL local_neighbors_at_CellularAutomaton_internal_70 --> -284($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_72 --> -292($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_74 --> -300($fp) +# Load pointers and SUB +lw $a0, -292($fp) +lw $a1, -300($fp) +sub $a0, $a0, $a1 +sw $a0, -284($fp) +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_70 GOTO label_TRUE_226 +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_70 GOTO label_TRUE_226 +lw $t0, -284($fp) +beq $t0, 0, label_TRUE_226 +# GOTO label_FALSE_225 +j label_FALSE_225 +label_COMPARE_BY_VALUE_229: + # LOCAL local_neighbors_at_CellularAutomaton_internal_70 --> -284($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_72 --> -292($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_74 --> -300($fp) + lw $a0, -292($fp) + lw $a1, -300($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -284($fp) + # IF_ZERO local_neighbors_at_CellularAutomaton_internal_70 GOTO label_TRUE_226 + # IF_ZERO local_neighbors_at_CellularAutomaton_internal_70 GOTO label_TRUE_226 + lw $t0, -284($fp) + beq $t0, 0, label_TRUE_226 + # GOTO label_FALSE_225 + j label_FALSE_225 + label_COMPARE_STRING_228: + # LOCAL local_neighbors_at_CellularAutomaton_internal_70 --> -284($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_72 --> -292($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_74 --> -300($fp) + # Load strings for comparison + lw $v0, -292($fp) + lw $v1, -300($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -284($fp) + # IF_ZERO local_neighbors_at_CellularAutomaton_internal_70 GOTO label_CONTINUE_230 + # IF_ZERO local_neighbors_at_CellularAutomaton_internal_70 GOTO label_CONTINUE_230 + lw $t0, -284($fp) + beq $t0, 0, label_CONTINUE_230 + # GOTO label_FALSE_225 + j label_FALSE_225 + label_CONTINUE_230: + # LOCAL local_neighbors_at_CellularAutomaton_internal_70 --> -284($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_72 --> -292($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_74 --> -300($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -292($fp) + lw $v1, -300($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_231: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_232 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_231 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_232: + # Store result + sw $a2, -284($fp) + # IF_ZERO local_neighbors_at_CellularAutomaton_internal_70 GOTO label_TRUE_226 + # IF_ZERO local_neighbors_at_CellularAutomaton_internal_70 GOTO label_TRUE_226 + lw $t0, -284($fp) + beq $t0, 0, label_TRUE_226 + label_FALSE_225: + # LOCAL local_neighbors_at_CellularAutomaton_internal_69 --> -280($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -280($fp) + # GOTO label_END_227 +j label_END_227 +label_TRUE_226: + # LOCAL local_neighbors_at_CellularAutomaton_internal_69 --> -280($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -280($fp) + label_END_227: +# LOCAL local_neighbors_at_CellularAutomaton_internal_67 --> -272($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_69 --> -280($fp) +# Obtain value from -280($fp) +lw $v0, -280($fp) +lw $v0, 12($v0) +sw $v0, -272($fp) +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_67 GOTO label_FALSEIF_223 +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_67 GOTO label_FALSEIF_223 +lw $t0, -272($fp) +beq $t0, 0, label_FALSEIF_223 +# LOCAL local_neighbors_at_CellularAutomaton_internal_75 --> -304($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 1 +sw $t0, 12($v0) +sw $v0, -304($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_68 --> -276($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_75 --> -304($fp) +# local_neighbors_at_CellularAutomaton_internal_68 = local_neighbors_at_CellularAutomaton_internal_75 +lw $t0, -304($fp) +sw $t0, -276($fp) +# GOTO label_ENDIF_224 +j label_ENDIF_224 +label_FALSEIF_223: + # LOCAL local_neighbors_at_CellularAutomaton_internal_76 --> -308($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -308($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_68 --> -276($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_76 --> -308($fp) + # local_neighbors_at_CellularAutomaton_internal_68 = local_neighbors_at_CellularAutomaton_internal_76 + lw $t0, -308($fp) + sw $t0, -276($fp) + label_ENDIF_224: +# LOCAL local_neighbors_at_CellularAutomaton_internal_1 --> -8($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_2 --> -12($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_68 --> -276($fp) +# local_neighbors_at_CellularAutomaton_internal_1 = local_neighbors_at_CellularAutomaton_internal_2 + local_neighbors_at_CellularAutomaton_internal_68 +lw $t1, -12($fp) +lw $t0, 12($t1) +lw $t1, -276($fp) +lw $t2, 12($t1) +add $t0, $t0, $t2 +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t1, String +sw $t1, 0($v0) +la $t1, String_start +sw $t1, 4($v0) +# Load type offset +li $t1, 8 +sw $t1, 8($v0) +la $t1, Int +sw $t1, 12($v0) +li $t1, 3 +sw $t1, 16($v0) +move $t1, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t1, 0($v0) +la $t1, Int_start +sw $t1, 4($v0) +# Load type offset +li $t1, 16 +sw $t1, 8($v0) +sw $t0, 12($v0) +sw $v0, -8($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_83 --> -336($fp) +# local_neighbors_at_CellularAutomaton_internal_83 = SELF +sw $s1, -336($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_81 --> -328($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_83 --> -336($fp) +# local_neighbors_at_CellularAutomaton_internal_81 = local_neighbors_at_CellularAutomaton_internal_83 +lw $t0, -336($fp) +sw $t0, -328($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# ARG param_neighbors_at_CellularAutomaton_position_0 +# PARAM param_neighbors_at_CellularAutomaton_position_0 --> 0($fp) +lw $t0, 0($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_81 --> -328($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_82 --> -332($fp) +# local_neighbors_at_CellularAutomaton_internal_82 = VCALL local_neighbors_at_CellularAutomaton_internal_81 southwest +# Save new self pointer in $s1 +lw $s1, -328($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 8($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -332($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_neighbors_at_CellularAutomaton_internal_84 --> -340($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_28 +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +sw $v0, -340($fp) +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_82 GOTO label_FALSE_235 +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_82 GOTO label_FALSE_235 +lw $t0, -332($fp) +beq $t0, 0, label_FALSE_235 +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_84 GOTO label_FALSE_235 +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_84 GOTO label_FALSE_235 +lw $t0, -340($fp) +beq $t0, 0, label_FALSE_235 +# LOCAL local_neighbors_at_CellularAutomaton_internal_80 --> -324($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_82 --> -332($fp) +# Comparing -332($fp) type with String +la $v0, String +lw $a0, -332($fp) +lw $a0, 0($a0) +sub $a0, $a0, $v0 +sw $a0, -324($fp) +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_80 GOTO label_COMPARE_STRING_238 +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_80 GOTO label_COMPARE_STRING_238 +lw $t0, -324($fp) +beq $t0, 0, label_COMPARE_STRING_238 +# LOCAL local_neighbors_at_CellularAutomaton_internal_80 --> -324($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_82 --> -332($fp) +# Comparing -332($fp) type with Bool +la $v0, Bool +lw $a0, -332($fp) +lw $a0, 0($a0) +lw $a0, 12($a0) +sub $a0, $a0, $v0 +sw $a0, -324($fp) +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_80 GOTO label_COMPARE_BY_VALUE_239 +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_80 GOTO label_COMPARE_BY_VALUE_239 +lw $t0, -324($fp) +beq $t0, 0, label_COMPARE_BY_VALUE_239 +# LOCAL local_neighbors_at_CellularAutomaton_internal_80 --> -324($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_82 --> -332($fp) +# Comparing -332($fp) type with Int +la $v0, Int +lw $a0, -332($fp) +lw $a0, 0($a0) +lw $a0, 12($a0) +sub $a0, $a0, $v0 +sw $a0, -324($fp) +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_80 GOTO label_COMPARE_BY_VALUE_239 +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_80 GOTO label_COMPARE_BY_VALUE_239 +lw $t0, -324($fp) +beq $t0, 0, label_COMPARE_BY_VALUE_239 +# LOCAL local_neighbors_at_CellularAutomaton_internal_80 --> -324($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_82 --> -332($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_84 --> -340($fp) +# Load pointers and SUB +lw $a0, -332($fp) +lw $a1, -340($fp) +sub $a0, $a0, $a1 +sw $a0, -324($fp) +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_80 GOTO label_TRUE_236 +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_80 GOTO label_TRUE_236 +lw $t0, -324($fp) +beq $t0, 0, label_TRUE_236 +# GOTO label_FALSE_235 +j label_FALSE_235 +label_COMPARE_BY_VALUE_239: + # LOCAL local_neighbors_at_CellularAutomaton_internal_80 --> -324($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_82 --> -332($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_84 --> -340($fp) + lw $a0, -332($fp) + lw $a1, -340($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -324($fp) + # IF_ZERO local_neighbors_at_CellularAutomaton_internal_80 GOTO label_TRUE_236 + # IF_ZERO local_neighbors_at_CellularAutomaton_internal_80 GOTO label_TRUE_236 + lw $t0, -324($fp) + beq $t0, 0, label_TRUE_236 + # GOTO label_FALSE_235 + j label_FALSE_235 + label_COMPARE_STRING_238: + # LOCAL local_neighbors_at_CellularAutomaton_internal_80 --> -324($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_82 --> -332($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_84 --> -340($fp) + # Load strings for comparison + lw $v0, -332($fp) + lw $v1, -340($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -324($fp) + # IF_ZERO local_neighbors_at_CellularAutomaton_internal_80 GOTO label_CONTINUE_240 + # IF_ZERO local_neighbors_at_CellularAutomaton_internal_80 GOTO label_CONTINUE_240 + lw $t0, -324($fp) + beq $t0, 0, label_CONTINUE_240 + # GOTO label_FALSE_235 + j label_FALSE_235 + label_CONTINUE_240: + # LOCAL local_neighbors_at_CellularAutomaton_internal_80 --> -324($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_82 --> -332($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_84 --> -340($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -332($fp) + lw $v1, -340($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_241: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_242 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_241 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_242: + # Store result + sw $a2, -324($fp) + # IF_ZERO local_neighbors_at_CellularAutomaton_internal_80 GOTO label_TRUE_236 + # IF_ZERO local_neighbors_at_CellularAutomaton_internal_80 GOTO label_TRUE_236 + lw $t0, -324($fp) + beq $t0, 0, label_TRUE_236 + label_FALSE_235: + # LOCAL local_neighbors_at_CellularAutomaton_internal_79 --> -320($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -320($fp) + # GOTO label_END_237 +j label_END_237 +label_TRUE_236: + # LOCAL local_neighbors_at_CellularAutomaton_internal_79 --> -320($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -320($fp) + label_END_237: +# LOCAL local_neighbors_at_CellularAutomaton_internal_77 --> -312($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_79 --> -320($fp) +# Obtain value from -320($fp) +lw $v0, -320($fp) +lw $v0, 12($v0) +sw $v0, -312($fp) +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_77 GOTO label_FALSEIF_233 +# IF_ZERO local_neighbors_at_CellularAutomaton_internal_77 GOTO label_FALSEIF_233 +lw $t0, -312($fp) +beq $t0, 0, label_FALSEIF_233 +# LOCAL local_neighbors_at_CellularAutomaton_internal_85 --> -344($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 1 +sw $t0, 12($v0) +sw $v0, -344($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_78 --> -316($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_85 --> -344($fp) +# local_neighbors_at_CellularAutomaton_internal_78 = local_neighbors_at_CellularAutomaton_internal_85 +lw $t0, -344($fp) +sw $t0, -316($fp) +# GOTO label_ENDIF_234 +j label_ENDIF_234 +label_FALSEIF_233: + # LOCAL local_neighbors_at_CellularAutomaton_internal_86 --> -348($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -348($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_78 --> -316($fp) + # LOCAL local_neighbors_at_CellularAutomaton_internal_86 --> -348($fp) + # local_neighbors_at_CellularAutomaton_internal_78 = local_neighbors_at_CellularAutomaton_internal_86 + lw $t0, -348($fp) + sw $t0, -316($fp) + label_ENDIF_234: +# LOCAL local_neighbors_at_CellularAutomaton_internal_0 --> -4($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_1 --> -8($fp) +# LOCAL local_neighbors_at_CellularAutomaton_internal_78 --> -316($fp) +# local_neighbors_at_CellularAutomaton_internal_0 = local_neighbors_at_CellularAutomaton_internal_1 + local_neighbors_at_CellularAutomaton_internal_78 +lw $t1, -8($fp) +lw $t0, 12($t1) +lw $t1, -316($fp) +lw $t2, 12($t1) +add $t0, $t0, $t2 +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t1, String +sw $t1, 0($v0) +la $t1, String_start +sw $t1, 4($v0) +# Load type offset +li $t1, 8 +sw $t1, 8($v0) +la $t1, Int +sw $t1, 12($v0) +li $t1, 3 +sw $t1, 16($v0) +move $t1, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t1, 0($v0) +la $t1, Int_start +sw $t1, 4($v0) +# Load type offset +li $t1, 16 +sw $t1, 8($v0) +sw $t0, 12($v0) +sw $v0, -4($fp) +# RETURN local_neighbors_at_CellularAutomaton_internal_0 +lw $v0, -4($fp) +# Deallocate stack frame for function function_neighbors_at_CellularAutomaton. +# Restore $ra +lw $ra, 4($sp) +# Restore $fp +lw $fp, 0($sp) +# Restore Stack pointer $sp +addu $sp, $sp, 356 +# Deallocate function args +addu $sp, $sp, 4 +jr $ra +# Function END + + +# function_cell_at_next_evolution_at_CellularAutomaton implementation. +# @Params: +# 0($fp) = param_cell_at_next_evolution_at_CellularAutomaton_position_0 +function_cell_at_next_evolution_at_CellularAutomaton: + # Allocate stack frame for function function_cell_at_next_evolution_at_CellularAutomaton. + subu $sp, $sp, 120 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 120 + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_6 --> -28($fp) + # local_cell_at_next_evolution_at_CellularAutomaton_internal_6 = SELF + sw $s1, -28($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_4 --> -20($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_6 --> -28($fp) + # local_cell_at_next_evolution_at_CellularAutomaton_internal_4 = local_cell_at_next_evolution_at_CellularAutomaton_internal_6 + lw $t0, -28($fp) + sw $t0, -20($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # ARG param_cell_at_next_evolution_at_CellularAutomaton_position_0 + # PARAM param_cell_at_next_evolution_at_CellularAutomaton_position_0 --> 0($fp) + lw $t0, 0($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_4 --> -20($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_5 --> -24($fp) + # local_cell_at_next_evolution_at_CellularAutomaton_internal_5 = VCALL local_cell_at_next_evolution_at_CellularAutomaton_internal_4 neighbors + # Save new self pointer in $s1 + lw $s1, -20($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 104($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -24($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_7 --> -32($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 3 + sw $t0, 12($v0) + sw $v0, -32($fp) + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_5 GOTO label_FALSE_245 + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_5 GOTO label_FALSE_245 + lw $t0, -24($fp) + beq $t0, 0, label_FALSE_245 + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_7 GOTO label_FALSE_245 + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_7 GOTO label_FALSE_245 + lw $t0, -32($fp) + beq $t0, 0, label_FALSE_245 + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_3 --> -16($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_5 --> -24($fp) + # Comparing -24($fp) type with String + la $v0, String + lw $a0, -24($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -16($fp) + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_3 GOTO label_COMPARE_STRING_248 + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_3 GOTO label_COMPARE_STRING_248 + lw $t0, -16($fp) + beq $t0, 0, label_COMPARE_STRING_248 + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_3 --> -16($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_5 --> -24($fp) + # Comparing -24($fp) type with Bool + la $v0, Bool + lw $a0, -24($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -16($fp) + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_3 GOTO label_COMPARE_BY_VALUE_249 + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_3 GOTO label_COMPARE_BY_VALUE_249 + lw $t0, -16($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_249 + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_3 --> -16($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_5 --> -24($fp) + # Comparing -24($fp) type with Int + la $v0, Int + lw $a0, -24($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -16($fp) + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_3 GOTO label_COMPARE_BY_VALUE_249 + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_3 GOTO label_COMPARE_BY_VALUE_249 + lw $t0, -16($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_249 + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_3 --> -16($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_5 --> -24($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_7 --> -32($fp) + # Load pointers and SUB + lw $a0, -24($fp) + lw $a1, -32($fp) + sub $a0, $a0, $a1 + sw $a0, -16($fp) + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_3 GOTO label_TRUE_246 + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_3 GOTO label_TRUE_246 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_246 + # GOTO label_FALSE_245 + j label_FALSE_245 + label_COMPARE_BY_VALUE_249: + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_3 --> -16($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_5 --> -24($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_7 --> -32($fp) + lw $a0, -24($fp) + lw $a1, -32($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -16($fp) + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_3 GOTO label_TRUE_246 + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_3 GOTO label_TRUE_246 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_246 + # GOTO label_FALSE_245 + j label_FALSE_245 + label_COMPARE_STRING_248: + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_3 --> -16($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_5 --> -24($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_7 --> -32($fp) + # Load strings for comparison + lw $v0, -24($fp) + lw $v1, -32($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -16($fp) + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_3 GOTO label_CONTINUE_250 + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_3 GOTO label_CONTINUE_250 + lw $t0, -16($fp) + beq $t0, 0, label_CONTINUE_250 + # GOTO label_FALSE_245 + j label_FALSE_245 + label_CONTINUE_250: + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_3 --> -16($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_5 --> -24($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_7 --> -32($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -24($fp) + lw $v1, -32($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_251: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_252 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_251 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_252: + # Store result + sw $a2, -16($fp) + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_3 GOTO label_TRUE_246 + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_3 GOTO label_TRUE_246 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_246 + label_FALSE_245: + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -12($fp) + # GOTO label_END_247 +j label_END_247 +label_TRUE_246: + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -12($fp) + label_END_247: +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_0 --> -4($fp) +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_2 --> -12($fp) +# Obtain value from -12($fp) +lw $v0, -12($fp) +lw $v0, 12($v0) +sw $v0, -4($fp) +# IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_0 GOTO label_FALSEIF_243 +# IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_0 GOTO label_FALSEIF_243 +lw $t0, -4($fp) +beq $t0, 0, label_FALSEIF_243 +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_8 --> -36($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_29 +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +sw $v0, -36($fp) +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_1 --> -8($fp) +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_8 --> -36($fp) +# local_cell_at_next_evolution_at_CellularAutomaton_internal_1 = local_cell_at_next_evolution_at_CellularAutomaton_internal_8 +lw $t0, -36($fp) +sw $t0, -8($fp) +# GOTO label_ENDIF_244 +j label_ENDIF_244 +label_FALSEIF_243: + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_15 --> -64($fp) + # local_cell_at_next_evolution_at_CellularAutomaton_internal_15 = SELF + sw $s1, -64($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_13 --> -56($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_15 --> -64($fp) + # local_cell_at_next_evolution_at_CellularAutomaton_internal_13 = local_cell_at_next_evolution_at_CellularAutomaton_internal_15 + lw $t0, -64($fp) + sw $t0, -56($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # ARG param_cell_at_next_evolution_at_CellularAutomaton_position_0 + # PARAM param_cell_at_next_evolution_at_CellularAutomaton_position_0 --> 0($fp) + lw $t0, 0($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_13 --> -56($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_14 --> -60($fp) + # local_cell_at_next_evolution_at_CellularAutomaton_internal_14 = VCALL local_cell_at_next_evolution_at_CellularAutomaton_internal_13 neighbors + # Save new self pointer in $s1 + lw $s1, -56($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 104($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -60($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_16 --> -68($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 2 + sw $t0, 12($v0) + sw $v0, -68($fp) + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_14 GOTO label_FALSE_255 + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_14 GOTO label_FALSE_255 + lw $t0, -60($fp) + beq $t0, 0, label_FALSE_255 + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_16 GOTO label_FALSE_255 + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_16 GOTO label_FALSE_255 + lw $t0, -68($fp) + beq $t0, 0, label_FALSE_255 + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_12 --> -52($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_14 --> -60($fp) + # Comparing -60($fp) type with String + la $v0, String + lw $a0, -60($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -52($fp) + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_12 GOTO label_COMPARE_STRING_258 + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_12 GOTO label_COMPARE_STRING_258 + lw $t0, -52($fp) + beq $t0, 0, label_COMPARE_STRING_258 + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_12 --> -52($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_14 --> -60($fp) + # Comparing -60($fp) type with Bool + la $v0, Bool + lw $a0, -60($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -52($fp) + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_12 GOTO label_COMPARE_BY_VALUE_259 + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_12 GOTO label_COMPARE_BY_VALUE_259 + lw $t0, -52($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_259 + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_12 --> -52($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_14 --> -60($fp) + # Comparing -60($fp) type with Int + la $v0, Int + lw $a0, -60($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -52($fp) + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_12 GOTO label_COMPARE_BY_VALUE_259 + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_12 GOTO label_COMPARE_BY_VALUE_259 + lw $t0, -52($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_259 + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_12 --> -52($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_14 --> -60($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_16 --> -68($fp) + # Load pointers and SUB + lw $a0, -60($fp) + lw $a1, -68($fp) + sub $a0, $a0, $a1 + sw $a0, -52($fp) + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_12 GOTO label_TRUE_256 + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_12 GOTO label_TRUE_256 + lw $t0, -52($fp) + beq $t0, 0, label_TRUE_256 + # GOTO label_FALSE_255 + j label_FALSE_255 + label_COMPARE_BY_VALUE_259: + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_12 --> -52($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_14 --> -60($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_16 --> -68($fp) + lw $a0, -60($fp) + lw $a1, -68($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -52($fp) + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_12 GOTO label_TRUE_256 + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_12 GOTO label_TRUE_256 + lw $t0, -52($fp) + beq $t0, 0, label_TRUE_256 + # GOTO label_FALSE_255 + j label_FALSE_255 + label_COMPARE_STRING_258: + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_12 --> -52($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_14 --> -60($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_16 --> -68($fp) + # Load strings for comparison + lw $v0, -60($fp) + lw $v1, -68($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -52($fp) + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_12 GOTO label_CONTINUE_260 + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_12 GOTO label_CONTINUE_260 + lw $t0, -52($fp) + beq $t0, 0, label_CONTINUE_260 + # GOTO label_FALSE_255 + j label_FALSE_255 + label_CONTINUE_260: + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_12 --> -52($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_14 --> -60($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_16 --> -68($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -60($fp) + lw $v1, -68($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_261: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_262 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_261 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_262: + # Store result + sw $a2, -52($fp) + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_12 GOTO label_TRUE_256 + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_12 GOTO label_TRUE_256 + lw $t0, -52($fp) + beq $t0, 0, label_TRUE_256 + label_FALSE_255: + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_11 --> -48($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -48($fp) + # GOTO label_END_257 +j label_END_257 +label_TRUE_256: + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_11 --> -48($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -48($fp) + label_END_257: +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_9 --> -40($fp) +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_11 --> -48($fp) +# Obtain value from -48($fp) +lw $v0, -48($fp) +lw $v0, 12($v0) +sw $v0, -40($fp) +# IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_9 GOTO label_FALSEIF_253 +# IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_9 GOTO label_FALSEIF_253 +lw $t0, -40($fp) +beq $t0, 0, label_FALSEIF_253 +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_23 --> -96($fp) +# local_cell_at_next_evolution_at_CellularAutomaton_internal_23 = SELF +sw $s1, -96($fp) +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_21 --> -88($fp) +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_23 --> -96($fp) +# local_cell_at_next_evolution_at_CellularAutomaton_internal_21 = local_cell_at_next_evolution_at_CellularAutomaton_internal_23 +lw $t0, -96($fp) +sw $t0, -88($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# ARG param_cell_at_next_evolution_at_CellularAutomaton_position_0 +# PARAM param_cell_at_next_evolution_at_CellularAutomaton_position_0 --> 0($fp) +lw $t0, 0($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_21 --> -88($fp) +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_22 --> -92($fp) +# local_cell_at_next_evolution_at_CellularAutomaton_internal_22 = VCALL local_cell_at_next_evolution_at_CellularAutomaton_internal_21 cell +# Save new self pointer in $s1 +lw $s1, -88($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 100($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -92($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_24 --> -100($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_30 +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +sw $v0, -100($fp) +# IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_22 GOTO label_FALSE_265 +# IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_22 GOTO label_FALSE_265 +lw $t0, -92($fp) +beq $t0, 0, label_FALSE_265 +# IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_24 GOTO label_FALSE_265 +# IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_24 GOTO label_FALSE_265 +lw $t0, -100($fp) +beq $t0, 0, label_FALSE_265 +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_20 --> -84($fp) +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_22 --> -92($fp) +# Comparing -92($fp) type with String +la $v0, String +lw $a0, -92($fp) +lw $a0, 0($a0) +sub $a0, $a0, $v0 +sw $a0, -84($fp) +# IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_20 GOTO label_COMPARE_STRING_268 +# IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_20 GOTO label_COMPARE_STRING_268 +lw $t0, -84($fp) +beq $t0, 0, label_COMPARE_STRING_268 +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_20 --> -84($fp) +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_22 --> -92($fp) +# Comparing -92($fp) type with Bool +la $v0, Bool +lw $a0, -92($fp) +lw $a0, 0($a0) +lw $a0, 12($a0) +sub $a0, $a0, $v0 +sw $a0, -84($fp) +# IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_20 GOTO label_COMPARE_BY_VALUE_269 +# IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_20 GOTO label_COMPARE_BY_VALUE_269 +lw $t0, -84($fp) +beq $t0, 0, label_COMPARE_BY_VALUE_269 +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_20 --> -84($fp) +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_22 --> -92($fp) +# Comparing -92($fp) type with Int +la $v0, Int +lw $a0, -92($fp) +lw $a0, 0($a0) +lw $a0, 12($a0) +sub $a0, $a0, $v0 +sw $a0, -84($fp) +# IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_20 GOTO label_COMPARE_BY_VALUE_269 +# IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_20 GOTO label_COMPARE_BY_VALUE_269 +lw $t0, -84($fp) +beq $t0, 0, label_COMPARE_BY_VALUE_269 +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_20 --> -84($fp) +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_22 --> -92($fp) +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_24 --> -100($fp) +# Load pointers and SUB +lw $a0, -92($fp) +lw $a1, -100($fp) +sub $a0, $a0, $a1 +sw $a0, -84($fp) +# IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_20 GOTO label_TRUE_266 +# IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_20 GOTO label_TRUE_266 +lw $t0, -84($fp) +beq $t0, 0, label_TRUE_266 +# GOTO label_FALSE_265 +j label_FALSE_265 +label_COMPARE_BY_VALUE_269: + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_20 --> -84($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_22 --> -92($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_24 --> -100($fp) + lw $a0, -92($fp) + lw $a1, -100($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -84($fp) + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_20 GOTO label_TRUE_266 + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_20 GOTO label_TRUE_266 + lw $t0, -84($fp) + beq $t0, 0, label_TRUE_266 + # GOTO label_FALSE_265 + j label_FALSE_265 + label_COMPARE_STRING_268: + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_20 --> -84($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_22 --> -92($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_24 --> -100($fp) + # Load strings for comparison + lw $v0, -92($fp) + lw $v1, -100($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -84($fp) + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_20 GOTO label_CONTINUE_270 + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_20 GOTO label_CONTINUE_270 + lw $t0, -84($fp) + beq $t0, 0, label_CONTINUE_270 + # GOTO label_FALSE_265 + j label_FALSE_265 + label_CONTINUE_270: + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_20 --> -84($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_22 --> -92($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_24 --> -100($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -92($fp) + lw $v1, -100($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_271: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_272 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_271 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_272: + # Store result + sw $a2, -84($fp) + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_20 GOTO label_TRUE_266 + # IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_20 GOTO label_TRUE_266 + lw $t0, -84($fp) + beq $t0, 0, label_TRUE_266 + label_FALSE_265: + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_19 --> -80($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -80($fp) + # GOTO label_END_267 +j label_END_267 +label_TRUE_266: + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_19 --> -80($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -80($fp) + label_END_267: +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_17 --> -72($fp) +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_19 --> -80($fp) +# Obtain value from -80($fp) +lw $v0, -80($fp) +lw $v0, 12($v0) +sw $v0, -72($fp) +# IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_17 GOTO label_FALSEIF_263 +# IF_ZERO local_cell_at_next_evolution_at_CellularAutomaton_internal_17 GOTO label_FALSEIF_263 +lw $t0, -72($fp) +beq $t0, 0, label_FALSEIF_263 +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_25 --> -104($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_31 +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +sw $v0, -104($fp) +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_18 --> -76($fp) +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_25 --> -104($fp) +# local_cell_at_next_evolution_at_CellularAutomaton_internal_18 = local_cell_at_next_evolution_at_CellularAutomaton_internal_25 +lw $t0, -104($fp) +sw $t0, -76($fp) +# GOTO label_ENDIF_264 +j label_ENDIF_264 +label_FALSEIF_263: + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_26 --> -108($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_32 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -108($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_18 --> -76($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_26 --> -108($fp) + # local_cell_at_next_evolution_at_CellularAutomaton_internal_18 = local_cell_at_next_evolution_at_CellularAutomaton_internal_26 + lw $t0, -108($fp) + sw $t0, -76($fp) + label_ENDIF_264: +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_10 --> -44($fp) +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_18 --> -76($fp) +# local_cell_at_next_evolution_at_CellularAutomaton_internal_10 = local_cell_at_next_evolution_at_CellularAutomaton_internal_18 +lw $t0, -76($fp) +sw $t0, -44($fp) +# GOTO label_ENDIF_254 +j label_ENDIF_254 +label_FALSEIF_253: + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_27 --> -112($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_33 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -112($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_10 --> -44($fp) + # LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_27 --> -112($fp) + # local_cell_at_next_evolution_at_CellularAutomaton_internal_10 = local_cell_at_next_evolution_at_CellularAutomaton_internal_27 + lw $t0, -112($fp) + sw $t0, -44($fp) + label_ENDIF_254: +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_1 --> -8($fp) +# LOCAL local_cell_at_next_evolution_at_CellularAutomaton_internal_10 --> -44($fp) +# local_cell_at_next_evolution_at_CellularAutomaton_internal_1 = local_cell_at_next_evolution_at_CellularAutomaton_internal_10 +lw $t0, -44($fp) +sw $t0, -8($fp) +label_ENDIF_244: +# RETURN local_cell_at_next_evolution_at_CellularAutomaton_internal_1 +lw $v0, -8($fp) +# Deallocate stack frame for function function_cell_at_next_evolution_at_CellularAutomaton. +# Restore $ra +lw $ra, 4($sp) +# Restore $fp +lw $fp, 0($sp) +# Restore Stack pointer $sp +addu $sp, $sp, 120 +# Deallocate function args +addu $sp, $sp, 4 +jr $ra +# Function END + + +# function_evolve_at_CellularAutomaton implementation. +# @Params: +function_evolve_at_CellularAutomaton: + # Allocate stack frame for function function_evolve_at_CellularAutomaton. + subu $sp, $sp, 76 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 76 + # LOCAL local_evolve_at_CellularAutomaton_position_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -4($fp) + # LOCAL local_evolve_at_CellularAutomaton_internal_1 --> -8($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -8($fp) + # LOCAL local_evolve_at_CellularAutomaton_position_0 --> -4($fp) + # LOCAL local_evolve_at_CellularAutomaton_internal_1 --> -8($fp) + # local_evolve_at_CellularAutomaton_position_0 = local_evolve_at_CellularAutomaton_internal_1 + lw $t0, -8($fp) + sw $t0, -4($fp) + # LOCAL local_evolve_at_CellularAutomaton_num_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -12($fp) + # LOCAL local_evolve_at_CellularAutomaton_internal_5 --> -24($fp) + # local_evolve_at_CellularAutomaton_internal_5 = SELF + sw $s1, -24($fp) + # LOCAL local_evolve_at_CellularAutomaton_internal_3 --> -16($fp) + # LOCAL local_evolve_at_CellularAutomaton_internal_5 --> -24($fp) + # local_evolve_at_CellularAutomaton_internal_3 = local_evolve_at_CellularAutomaton_internal_5 + lw $t0, -24($fp) + sw $t0, -16($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_evolve_at_CellularAutomaton_internal_3 --> -16($fp) + # LOCAL local_evolve_at_CellularAutomaton_internal_4 --> -20($fp) + # local_evolve_at_CellularAutomaton_internal_4 = VCALL local_evolve_at_CellularAutomaton_internal_3 num_cells + # Save new self pointer in $s1 + lw $s1, -16($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 60($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -20($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_evolve_at_CellularAutomaton_num_2 --> -12($fp) + # LOCAL local_evolve_at_CellularAutomaton_internal_4 --> -20($fp) + # local_evolve_at_CellularAutomaton_num_2 = local_evolve_at_CellularAutomaton_internal_4 + lw $t0, -20($fp) + sw $t0, -12($fp) + # LOCAL local_evolve_at_CellularAutomaton_temp_6 --> -28($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_0 + sw $t0, 12($v0) + li $t0, 0 + sw $t0, 16($v0) + sw $v0, -28($fp) + label_WHILE_273: + # LOCAL local_evolve_at_CellularAutomaton_internal_8 --> -36($fp) + # LOCAL local_evolve_at_CellularAutomaton_position_0 --> -4($fp) + # LOCAL local_evolve_at_CellularAutomaton_num_2 --> -12($fp) + lw $a0, -4($fp) + lw $a1, -12($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -36($fp) + # IF_GREATER_ZERO local_evolve_at_CellularAutomaton_internal_8 GOTO label_FALSE_275 + # IF_GREATER_ZERO local_evolve_at_CellularAutomaton_internal_8 GOTO label_FALSE_275 + lw $t0, -36($fp) + bgt $t0, 0, label_FALSE_275 + # IF_ZERO local_evolve_at_CellularAutomaton_internal_8 GOTO label_FALSE_275 + # IF_ZERO local_evolve_at_CellularAutomaton_internal_8 GOTO label_FALSE_275 + lw $t0, -36($fp) + beq $t0, 0, label_FALSE_275 + # LOCAL local_evolve_at_CellularAutomaton_internal_8 --> -36($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -36($fp) + # GOTO label_END_276 +j label_END_276 +label_FALSE_275: + # LOCAL local_evolve_at_CellularAutomaton_internal_8 --> -36($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -36($fp) + label_END_276: +# LOCAL local_evolve_at_CellularAutomaton_internal_7 --> -32($fp) +# LOCAL local_evolve_at_CellularAutomaton_internal_8 --> -36($fp) +# Obtain value from -36($fp) +lw $v0, -36($fp) +lw $v0, 12($v0) +sw $v0, -32($fp) +# IF_ZERO local_evolve_at_CellularAutomaton_internal_7 GOTO label_WHILE_END_274 +# IF_ZERO local_evolve_at_CellularAutomaton_internal_7 GOTO label_WHILE_END_274 +lw $t0, -32($fp) +beq $t0, 0, label_WHILE_END_274 +# LOCAL local_evolve_at_CellularAutomaton_internal_9 --> -40($fp) +# LOCAL local_evolve_at_CellularAutomaton_temp_6 --> -28($fp) +# local_evolve_at_CellularAutomaton_internal_9 = local_evolve_at_CellularAutomaton_temp_6 +lw $t0, -28($fp) +sw $t0, -40($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_evolve_at_CellularAutomaton_internal_13 --> -56($fp) +# local_evolve_at_CellularAutomaton_internal_13 = SELF +sw $s1, -56($fp) +# LOCAL local_evolve_at_CellularAutomaton_internal_11 --> -48($fp) +# LOCAL local_evolve_at_CellularAutomaton_internal_13 --> -56($fp) +# local_evolve_at_CellularAutomaton_internal_11 = local_evolve_at_CellularAutomaton_internal_13 +lw $t0, -56($fp) +sw $t0, -48($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# ARG local_evolve_at_CellularAutomaton_position_0 +# LOCAL local_evolve_at_CellularAutomaton_position_0 --> -4($fp) +lw $t0, -4($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_evolve_at_CellularAutomaton_internal_11 --> -48($fp) +# LOCAL local_evolve_at_CellularAutomaton_internal_12 --> -52($fp) +# local_evolve_at_CellularAutomaton_internal_12 = VCALL local_evolve_at_CellularAutomaton_internal_11 cell_at_next_evolution +# Save new self pointer in $s1 +lw $s1, -48($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 12($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -52($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# ARG local_evolve_at_CellularAutomaton_internal_12 +# LOCAL local_evolve_at_CellularAutomaton_internal_12 --> -52($fp) +lw $t0, -52($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_evolve_at_CellularAutomaton_internal_9 --> -40($fp) +# LOCAL local_evolve_at_CellularAutomaton_internal_10 --> -44($fp) +# local_evolve_at_CellularAutomaton_internal_10 = VCALL local_evolve_at_CellularAutomaton_internal_9 concat +# Save new self pointer in $s1 +lw $s1, -40($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 44($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -44($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_evolve_at_CellularAutomaton_temp_6 --> -28($fp) +# LOCAL local_evolve_at_CellularAutomaton_internal_10 --> -44($fp) +# local_evolve_at_CellularAutomaton_temp_6 = local_evolve_at_CellularAutomaton_internal_10 +lw $t0, -44($fp) +sw $t0, -28($fp) +# LOCAL local_evolve_at_CellularAutomaton_internal_15 --> -64($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 1 +sw $t0, 12($v0) +sw $v0, -64($fp) +# LOCAL local_evolve_at_CellularAutomaton_internal_14 --> -60($fp) +# LOCAL local_evolve_at_CellularAutomaton_position_0 --> -4($fp) +# LOCAL local_evolve_at_CellularAutomaton_internal_15 --> -64($fp) +# local_evolve_at_CellularAutomaton_internal_14 = local_evolve_at_CellularAutomaton_position_0 + local_evolve_at_CellularAutomaton_internal_15 +lw $t1, -4($fp) +lw $t0, 12($t1) +lw $t1, -64($fp) +lw $t2, 12($t1) +add $t0, $t0, $t2 +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t1, String +sw $t1, 0($v0) +la $t1, String_start +sw $t1, 4($v0) +# Load type offset +li $t1, 8 +sw $t1, 8($v0) +la $t1, Int +sw $t1, 12($v0) +li $t1, 3 +sw $t1, 16($v0) +move $t1, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t1, 0($v0) +la $t1, Int_start +sw $t1, 4($v0) +# Load type offset +li $t1, 16 +sw $t1, 8($v0) +sw $t0, 12($v0) +sw $v0, -60($fp) +# LOCAL local_evolve_at_CellularAutomaton_position_0 --> -4($fp) +# LOCAL local_evolve_at_CellularAutomaton_internal_14 --> -60($fp) +# local_evolve_at_CellularAutomaton_position_0 = local_evolve_at_CellularAutomaton_internal_14 +lw $t0, -60($fp) +sw $t0, -4($fp) +# GOTO label_WHILE_273 +j label_WHILE_273 +label_WHILE_END_274: + # + # LOCAL local_evolve_at_CellularAutomaton_temp_6 --> -28($fp) + lw $t0, -28($fp) + sw $t0, 24($s1) + # LOCAL local_evolve_at_CellularAutomaton_internal_16 --> -68($fp) + # local_evolve_at_CellularAutomaton_internal_16 = SELF + sw $s1, -68($fp) + # RETURN local_evolve_at_CellularAutomaton_internal_16 + lw $v0, -68($fp) + # Deallocate stack frame for function function_evolve_at_CellularAutomaton. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 76 + jr $ra + # Function END + + +# function_option_at_CellularAutomaton implementation. +# @Params: +function_option_at_CellularAutomaton: + # Allocate stack frame for function function_option_at_CellularAutomaton. + subu $sp, $sp, 916 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 916 + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_3 --> -16($fp) + # local_option_at_CellularAutomaton_internal_3 = SELF + sw $s1, -16($fp) + # LOCAL local_option_at_CellularAutomaton_internal_1 --> -8($fp) + # LOCAL local_option_at_CellularAutomaton_internal_3 --> -16($fp) + # local_option_at_CellularAutomaton_internal_1 = local_option_at_CellularAutomaton_internal_3 + lw $t0, -16($fp) + sw $t0, -8($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_option_at_CellularAutomaton_internal_4 --> -20($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_34 + sw $t0, 12($v0) + li $t0, 24 + sw $t0, 16($v0) + sw $v0, -20($fp) + # ARG local_option_at_CellularAutomaton_internal_4 + # LOCAL local_option_at_CellularAutomaton_internal_4 --> -20($fp) + lw $t0, -20($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_option_at_CellularAutomaton_internal_1 --> -8($fp) + # LOCAL local_option_at_CellularAutomaton_internal_2 --> -12($fp) + # local_option_at_CellularAutomaton_internal_2 = VCALL local_option_at_CellularAutomaton_internal_1 out_string + # Save new self pointer in $s1 + lw $s1, -8($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 92($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -12($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_option_at_CellularAutomaton_internal_7 --> -32($fp) + # local_option_at_CellularAutomaton_internal_7 = SELF + sw $s1, -32($fp) + # LOCAL local_option_at_CellularAutomaton_internal_5 --> -24($fp) + # LOCAL local_option_at_CellularAutomaton_internal_7 --> -32($fp) + # local_option_at_CellularAutomaton_internal_5 = local_option_at_CellularAutomaton_internal_7 + lw $t0, -32($fp) + sw $t0, -24($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_option_at_CellularAutomaton_internal_8 --> -36($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_35 + sw $t0, 12($v0) + li $t0, 13 + sw $t0, 16($v0) + sw $v0, -36($fp) + # ARG local_option_at_CellularAutomaton_internal_8 + # LOCAL local_option_at_CellularAutomaton_internal_8 --> -36($fp) + lw $t0, -36($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_option_at_CellularAutomaton_internal_5 --> -24($fp) + # LOCAL local_option_at_CellularAutomaton_internal_6 --> -28($fp) + # local_option_at_CellularAutomaton_internal_6 = VCALL local_option_at_CellularAutomaton_internal_5 out_string + # Save new self pointer in $s1 + lw $s1, -24($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 92($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -28($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_option_at_CellularAutomaton_internal_11 --> -48($fp) + # local_option_at_CellularAutomaton_internal_11 = SELF + sw $s1, -48($fp) + # LOCAL local_option_at_CellularAutomaton_internal_9 --> -40($fp) + # LOCAL local_option_at_CellularAutomaton_internal_11 --> -48($fp) + # local_option_at_CellularAutomaton_internal_9 = local_option_at_CellularAutomaton_internal_11 + lw $t0, -48($fp) + sw $t0, -40($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_option_at_CellularAutomaton_internal_12 --> -52($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_36 + sw $t0, 12($v0) + li $t0, 48 + sw $t0, 16($v0) + sw $v0, -52($fp) + # ARG local_option_at_CellularAutomaton_internal_12 + # LOCAL local_option_at_CellularAutomaton_internal_12 --> -52($fp) + lw $t0, -52($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_option_at_CellularAutomaton_internal_9 --> -40($fp) + # LOCAL local_option_at_CellularAutomaton_internal_10 --> -44($fp) + # local_option_at_CellularAutomaton_internal_10 = VCALL local_option_at_CellularAutomaton_internal_9 out_string + # Save new self pointer in $s1 + lw $s1, -40($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 92($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -44($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_option_at_CellularAutomaton_internal_15 --> -64($fp) + # local_option_at_CellularAutomaton_internal_15 = SELF + sw $s1, -64($fp) + # LOCAL local_option_at_CellularAutomaton_internal_13 --> -56($fp) + # LOCAL local_option_at_CellularAutomaton_internal_15 --> -64($fp) + # local_option_at_CellularAutomaton_internal_13 = local_option_at_CellularAutomaton_internal_15 + lw $t0, -64($fp) + sw $t0, -56($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_option_at_CellularAutomaton_internal_16 --> -68($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_37 + sw $t0, 12($v0) + li $t0, 48 + sw $t0, 16($v0) + sw $v0, -68($fp) + # ARG local_option_at_CellularAutomaton_internal_16 + # LOCAL local_option_at_CellularAutomaton_internal_16 --> -68($fp) + lw $t0, -68($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_option_at_CellularAutomaton_internal_13 --> -56($fp) + # LOCAL local_option_at_CellularAutomaton_internal_14 --> -60($fp) + # local_option_at_CellularAutomaton_internal_14 = VCALL local_option_at_CellularAutomaton_internal_13 out_string + # Save new self pointer in $s1 + lw $s1, -56($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 92($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -60($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_option_at_CellularAutomaton_internal_19 --> -80($fp) + # local_option_at_CellularAutomaton_internal_19 = SELF + sw $s1, -80($fp) + # LOCAL local_option_at_CellularAutomaton_internal_17 --> -72($fp) + # LOCAL local_option_at_CellularAutomaton_internal_19 --> -80($fp) + # local_option_at_CellularAutomaton_internal_17 = local_option_at_CellularAutomaton_internal_19 + lw $t0, -80($fp) + sw $t0, -72($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_option_at_CellularAutomaton_internal_20 --> -84($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_38 + sw $t0, 12($v0) + li $t0, 10 + sw $t0, 16($v0) + sw $v0, -84($fp) + # ARG local_option_at_CellularAutomaton_internal_20 + # LOCAL local_option_at_CellularAutomaton_internal_20 --> -84($fp) + lw $t0, -84($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_option_at_CellularAutomaton_internal_17 --> -72($fp) + # LOCAL local_option_at_CellularAutomaton_internal_18 --> -76($fp) + # local_option_at_CellularAutomaton_internal_18 = VCALL local_option_at_CellularAutomaton_internal_17 out_string + # Save new self pointer in $s1 + lw $s1, -72($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 92($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -76($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_option_at_CellularAutomaton_internal_23 --> -96($fp) + # local_option_at_CellularAutomaton_internal_23 = SELF + sw $s1, -96($fp) + # LOCAL local_option_at_CellularAutomaton_internal_21 --> -88($fp) + # LOCAL local_option_at_CellularAutomaton_internal_23 --> -96($fp) + # local_option_at_CellularAutomaton_internal_21 = local_option_at_CellularAutomaton_internal_23 + lw $t0, -96($fp) + sw $t0, -88($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_option_at_CellularAutomaton_internal_24 --> -100($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_39 + sw $t0, 12($v0) + li $t0, 26 + sw $t0, 16($v0) + sw $v0, -100($fp) + # ARG local_option_at_CellularAutomaton_internal_24 + # LOCAL local_option_at_CellularAutomaton_internal_24 --> -100($fp) + lw $t0, -100($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_option_at_CellularAutomaton_internal_21 --> -88($fp) + # LOCAL local_option_at_CellularAutomaton_internal_22 --> -92($fp) + # local_option_at_CellularAutomaton_internal_22 = VCALL local_option_at_CellularAutomaton_internal_21 out_string + # Save new self pointer in $s1 + lw $s1, -88($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 92($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -92($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_option_at_CellularAutomaton_internal_27 --> -112($fp) + # local_option_at_CellularAutomaton_internal_27 = SELF + sw $s1, -112($fp) + # LOCAL local_option_at_CellularAutomaton_internal_25 --> -104($fp) + # LOCAL local_option_at_CellularAutomaton_internal_27 --> -112($fp) + # local_option_at_CellularAutomaton_internal_25 = local_option_at_CellularAutomaton_internal_27 + lw $t0, -112($fp) + sw $t0, -104($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_option_at_CellularAutomaton_internal_28 --> -116($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_40 + sw $t0, 12($v0) + li $t0, 22 + sw $t0, 16($v0) + sw $v0, -116($fp) + # ARG local_option_at_CellularAutomaton_internal_28 + # LOCAL local_option_at_CellularAutomaton_internal_28 --> -116($fp) + lw $t0, -116($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_option_at_CellularAutomaton_internal_25 --> -104($fp) + # LOCAL local_option_at_CellularAutomaton_internal_26 --> -108($fp) + # local_option_at_CellularAutomaton_internal_26 = VCALL local_option_at_CellularAutomaton_internal_25 out_string + # Save new self pointer in $s1 + lw $s1, -104($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 92($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -108($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_option_at_CellularAutomaton_internal_31 --> -128($fp) + # local_option_at_CellularAutomaton_internal_31 = SELF + sw $s1, -128($fp) + # LOCAL local_option_at_CellularAutomaton_internal_29 --> -120($fp) + # LOCAL local_option_at_CellularAutomaton_internal_31 --> -128($fp) + # local_option_at_CellularAutomaton_internal_29 = local_option_at_CellularAutomaton_internal_31 + lw $t0, -128($fp) + sw $t0, -120($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_option_at_CellularAutomaton_internal_32 --> -132($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_41 + sw $t0, 12($v0) + li $t0, 28 + sw $t0, 16($v0) + sw $v0, -132($fp) + # ARG local_option_at_CellularAutomaton_internal_32 + # LOCAL local_option_at_CellularAutomaton_internal_32 --> -132($fp) + lw $t0, -132($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_option_at_CellularAutomaton_internal_29 --> -120($fp) + # LOCAL local_option_at_CellularAutomaton_internal_30 --> -124($fp) + # local_option_at_CellularAutomaton_internal_30 = VCALL local_option_at_CellularAutomaton_internal_29 out_string + # Save new self pointer in $s1 + lw $s1, -120($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 92($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -124($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_option_at_CellularAutomaton_internal_35 --> -144($fp) + # local_option_at_CellularAutomaton_internal_35 = SELF + sw $s1, -144($fp) + # LOCAL local_option_at_CellularAutomaton_internal_33 --> -136($fp) + # LOCAL local_option_at_CellularAutomaton_internal_35 --> -144($fp) + # local_option_at_CellularAutomaton_internal_33 = local_option_at_CellularAutomaton_internal_35 + lw $t0, -144($fp) + sw $t0, -136($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_option_at_CellularAutomaton_internal_36 --> -148($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_42 + sw $t0, 12($v0) + li $t0, 25 + sw $t0, 16($v0) + sw $v0, -148($fp) + # ARG local_option_at_CellularAutomaton_internal_36 + # LOCAL local_option_at_CellularAutomaton_internal_36 --> -148($fp) + lw $t0, -148($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_option_at_CellularAutomaton_internal_33 --> -136($fp) + # LOCAL local_option_at_CellularAutomaton_internal_34 --> -140($fp) + # local_option_at_CellularAutomaton_internal_34 = VCALL local_option_at_CellularAutomaton_internal_33 out_string + # Save new self pointer in $s1 + lw $s1, -136($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 92($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -140($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_option_at_CellularAutomaton_internal_39 --> -160($fp) + # local_option_at_CellularAutomaton_internal_39 = SELF + sw $s1, -160($fp) + # LOCAL local_option_at_CellularAutomaton_internal_37 --> -152($fp) + # LOCAL local_option_at_CellularAutomaton_internal_39 --> -160($fp) + # local_option_at_CellularAutomaton_internal_37 = local_option_at_CellularAutomaton_internal_39 + lw $t0, -160($fp) + sw $t0, -152($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_option_at_CellularAutomaton_internal_40 --> -164($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_43 + sw $t0, 12($v0) + li $t0, 11 + sw $t0, 16($v0) + sw $v0, -164($fp) + # ARG local_option_at_CellularAutomaton_internal_40 + # LOCAL local_option_at_CellularAutomaton_internal_40 --> -164($fp) + lw $t0, -164($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_option_at_CellularAutomaton_internal_37 --> -152($fp) + # LOCAL local_option_at_CellularAutomaton_internal_38 --> -156($fp) + # local_option_at_CellularAutomaton_internal_38 = VCALL local_option_at_CellularAutomaton_internal_37 out_string + # Save new self pointer in $s1 + lw $s1, -152($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 92($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -156($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_option_at_CellularAutomaton_internal_43 --> -176($fp) + # local_option_at_CellularAutomaton_internal_43 = SELF + sw $s1, -176($fp) + # LOCAL local_option_at_CellularAutomaton_internal_41 --> -168($fp) + # LOCAL local_option_at_CellularAutomaton_internal_43 --> -176($fp) + # local_option_at_CellularAutomaton_internal_41 = local_option_at_CellularAutomaton_internal_43 + lw $t0, -176($fp) + sw $t0, -168($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_option_at_CellularAutomaton_internal_44 --> -180($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_44 + sw $t0, 12($v0) + li $t0, 21 + sw $t0, 16($v0) + sw $v0, -180($fp) + # ARG local_option_at_CellularAutomaton_internal_44 + # LOCAL local_option_at_CellularAutomaton_internal_44 --> -180($fp) + lw $t0, -180($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_option_at_CellularAutomaton_internal_41 --> -168($fp) + # LOCAL local_option_at_CellularAutomaton_internal_42 --> -172($fp) + # local_option_at_CellularAutomaton_internal_42 = VCALL local_option_at_CellularAutomaton_internal_41 out_string + # Save new self pointer in $s1 + lw $s1, -168($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 92($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -172($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_option_at_CellularAutomaton_internal_47 --> -192($fp) + # local_option_at_CellularAutomaton_internal_47 = SELF + sw $s1, -192($fp) + # LOCAL local_option_at_CellularAutomaton_internal_45 --> -184($fp) + # LOCAL local_option_at_CellularAutomaton_internal_47 --> -192($fp) + # local_option_at_CellularAutomaton_internal_45 = local_option_at_CellularAutomaton_internal_47 + lw $t0, -192($fp) + sw $t0, -184($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_option_at_CellularAutomaton_internal_48 --> -196($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_45 + sw $t0, 12($v0) + li $t0, 32 + sw $t0, 16($v0) + sw $v0, -196($fp) + # ARG local_option_at_CellularAutomaton_internal_48 + # LOCAL local_option_at_CellularAutomaton_internal_48 --> -196($fp) + lw $t0, -196($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_option_at_CellularAutomaton_internal_45 --> -184($fp) + # LOCAL local_option_at_CellularAutomaton_internal_46 --> -188($fp) + # local_option_at_CellularAutomaton_internal_46 = VCALL local_option_at_CellularAutomaton_internal_45 out_string + # Save new self pointer in $s1 + lw $s1, -184($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 92($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -188($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_option_at_CellularAutomaton_internal_51 --> -208($fp) + # local_option_at_CellularAutomaton_internal_51 = SELF + sw $s1, -208($fp) + # LOCAL local_option_at_CellularAutomaton_internal_49 --> -200($fp) + # LOCAL local_option_at_CellularAutomaton_internal_51 --> -208($fp) + # local_option_at_CellularAutomaton_internal_49 = local_option_at_CellularAutomaton_internal_51 + lw $t0, -208($fp) + sw $t0, -200($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_option_at_CellularAutomaton_internal_52 --> -212($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_46 + sw $t0, 12($v0) + li $t0, 18 + sw $t0, 16($v0) + sw $v0, -212($fp) + # ARG local_option_at_CellularAutomaton_internal_52 + # LOCAL local_option_at_CellularAutomaton_internal_52 --> -212($fp) + lw $t0, -212($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_option_at_CellularAutomaton_internal_49 --> -200($fp) + # LOCAL local_option_at_CellularAutomaton_internal_50 --> -204($fp) + # local_option_at_CellularAutomaton_internal_50 = VCALL local_option_at_CellularAutomaton_internal_49 out_string + # Save new self pointer in $s1 + lw $s1, -200($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 92($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -204($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_option_at_CellularAutomaton_internal_55 --> -224($fp) + # local_option_at_CellularAutomaton_internal_55 = SELF + sw $s1, -224($fp) + # LOCAL local_option_at_CellularAutomaton_internal_53 --> -216($fp) + # LOCAL local_option_at_CellularAutomaton_internal_55 --> -224($fp) + # local_option_at_CellularAutomaton_internal_53 = local_option_at_CellularAutomaton_internal_55 + lw $t0, -224($fp) + sw $t0, -216($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_option_at_CellularAutomaton_internal_56 --> -228($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_47 + sw $t0, 12($v0) + li $t0, 12 + sw $t0, 16($v0) + sw $v0, -228($fp) + # ARG local_option_at_CellularAutomaton_internal_56 + # LOCAL local_option_at_CellularAutomaton_internal_56 --> -228($fp) + lw $t0, -228($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_option_at_CellularAutomaton_internal_53 --> -216($fp) + # LOCAL local_option_at_CellularAutomaton_internal_54 --> -220($fp) + # local_option_at_CellularAutomaton_internal_54 = VCALL local_option_at_CellularAutomaton_internal_53 out_string + # Save new self pointer in $s1 + lw $s1, -216($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 92($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -220($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_option_at_CellularAutomaton_internal_59 --> -240($fp) + # local_option_at_CellularAutomaton_internal_59 = SELF + sw $s1, -240($fp) + # LOCAL local_option_at_CellularAutomaton_internal_57 --> -232($fp) + # LOCAL local_option_at_CellularAutomaton_internal_59 --> -240($fp) + # local_option_at_CellularAutomaton_internal_57 = local_option_at_CellularAutomaton_internal_59 + lw $t0, -240($fp) + sw $t0, -232($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_option_at_CellularAutomaton_internal_60 --> -244($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_48 + sw $t0, 12($v0) + li $t0, 17 + sw $t0, 16($v0) + sw $v0, -244($fp) + # ARG local_option_at_CellularAutomaton_internal_60 + # LOCAL local_option_at_CellularAutomaton_internal_60 --> -244($fp) + lw $t0, -244($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_option_at_CellularAutomaton_internal_57 --> -232($fp) + # LOCAL local_option_at_CellularAutomaton_internal_58 --> -236($fp) + # local_option_at_CellularAutomaton_internal_58 = VCALL local_option_at_CellularAutomaton_internal_57 out_string + # Save new self pointer in $s1 + lw $s1, -232($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 92($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -236($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_option_at_CellularAutomaton_internal_63 --> -256($fp) + # local_option_at_CellularAutomaton_internal_63 = SELF + sw $s1, -256($fp) + # LOCAL local_option_at_CellularAutomaton_internal_61 --> -248($fp) + # LOCAL local_option_at_CellularAutomaton_internal_63 --> -256($fp) + # local_option_at_CellularAutomaton_internal_61 = local_option_at_CellularAutomaton_internal_63 + lw $t0, -256($fp) + sw $t0, -248($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_option_at_CellularAutomaton_internal_64 --> -260($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_49 + sw $t0, 12($v0) + li $t0, 12 + sw $t0, 16($v0) + sw $v0, -260($fp) + # ARG local_option_at_CellularAutomaton_internal_64 + # LOCAL local_option_at_CellularAutomaton_internal_64 --> -260($fp) + lw $t0, -260($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_option_at_CellularAutomaton_internal_61 --> -248($fp) + # LOCAL local_option_at_CellularAutomaton_internal_62 --> -252($fp) + # local_option_at_CellularAutomaton_internal_62 = VCALL local_option_at_CellularAutomaton_internal_61 out_string + # Save new self pointer in $s1 + lw $s1, -248($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 92($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -252($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_option_at_CellularAutomaton_internal_67 --> -272($fp) + # local_option_at_CellularAutomaton_internal_67 = SELF + sw $s1, -272($fp) + # LOCAL local_option_at_CellularAutomaton_internal_65 --> -264($fp) + # LOCAL local_option_at_CellularAutomaton_internal_67 --> -272($fp) + # local_option_at_CellularAutomaton_internal_65 = local_option_at_CellularAutomaton_internal_67 + lw $t0, -272($fp) + sw $t0, -264($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_option_at_CellularAutomaton_internal_68 --> -276($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_50 + sw $t0, 12($v0) + li $t0, 13 + sw $t0, 16($v0) + sw $v0, -276($fp) + # ARG local_option_at_CellularAutomaton_internal_68 + # LOCAL local_option_at_CellularAutomaton_internal_68 --> -276($fp) + lw $t0, -276($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_option_at_CellularAutomaton_internal_65 --> -264($fp) + # LOCAL local_option_at_CellularAutomaton_internal_66 --> -268($fp) + # local_option_at_CellularAutomaton_internal_66 = VCALL local_option_at_CellularAutomaton_internal_65 out_string + # Save new self pointer in $s1 + lw $s1, -264($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 92($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -268($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_option_at_CellularAutomaton_internal_71 --> -288($fp) + # local_option_at_CellularAutomaton_internal_71 = SELF + sw $s1, -288($fp) + # LOCAL local_option_at_CellularAutomaton_internal_69 --> -280($fp) + # LOCAL local_option_at_CellularAutomaton_internal_71 --> -288($fp) + # local_option_at_CellularAutomaton_internal_69 = local_option_at_CellularAutomaton_internal_71 + lw $t0, -288($fp) + sw $t0, -280($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_option_at_CellularAutomaton_internal_72 --> -292($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_51 + sw $t0, 12($v0) + li $t0, 13 + sw $t0, 16($v0) + sw $v0, -292($fp) + # ARG local_option_at_CellularAutomaton_internal_72 + # LOCAL local_option_at_CellularAutomaton_internal_72 --> -292($fp) + lw $t0, -292($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_option_at_CellularAutomaton_internal_69 --> -280($fp) + # LOCAL local_option_at_CellularAutomaton_internal_70 --> -284($fp) + # local_option_at_CellularAutomaton_internal_70 = VCALL local_option_at_CellularAutomaton_internal_69 out_string + # Save new self pointer in $s1 + lw $s1, -280($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 92($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -284($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_option_at_CellularAutomaton_internal_75 --> -304($fp) + # local_option_at_CellularAutomaton_internal_75 = SELF + sw $s1, -304($fp) + # LOCAL local_option_at_CellularAutomaton_internal_73 --> -296($fp) + # LOCAL local_option_at_CellularAutomaton_internal_75 --> -304($fp) + # local_option_at_CellularAutomaton_internal_73 = local_option_at_CellularAutomaton_internal_75 + lw $t0, -304($fp) + sw $t0, -296($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_option_at_CellularAutomaton_internal_76 --> -308($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_52 + sw $t0, 12($v0) + li $t0, 12 + sw $t0, 16($v0) + sw $v0, -308($fp) + # ARG local_option_at_CellularAutomaton_internal_76 + # LOCAL local_option_at_CellularAutomaton_internal_76 --> -308($fp) + lw $t0, -308($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_option_at_CellularAutomaton_internal_73 --> -296($fp) + # LOCAL local_option_at_CellularAutomaton_internal_74 --> -300($fp) + # local_option_at_CellularAutomaton_internal_74 = VCALL local_option_at_CellularAutomaton_internal_73 out_string + # Save new self pointer in $s1 + lw $s1, -296($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 92($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -300($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_option_at_CellularAutomaton_internal_79 --> -320($fp) + # local_option_at_CellularAutomaton_internal_79 = SELF + sw $s1, -320($fp) + # LOCAL local_option_at_CellularAutomaton_internal_77 --> -312($fp) + # LOCAL local_option_at_CellularAutomaton_internal_79 --> -320($fp) + # local_option_at_CellularAutomaton_internal_77 = local_option_at_CellularAutomaton_internal_79 + lw $t0, -320($fp) + sw $t0, -312($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_option_at_CellularAutomaton_internal_80 --> -324($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_53 + sw $t0, 12($v0) + li $t0, 13 + sw $t0, 16($v0) + sw $v0, -324($fp) + # ARG local_option_at_CellularAutomaton_internal_80 + # LOCAL local_option_at_CellularAutomaton_internal_80 --> -324($fp) + lw $t0, -324($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_option_at_CellularAutomaton_internal_77 --> -312($fp) + # LOCAL local_option_at_CellularAutomaton_internal_78 --> -316($fp) + # local_option_at_CellularAutomaton_internal_78 = VCALL local_option_at_CellularAutomaton_internal_77 out_string + # Save new self pointer in $s1 + lw $s1, -312($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 92($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -316($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_option_at_CellularAutomaton_internal_83 --> -336($fp) + # local_option_at_CellularAutomaton_internal_83 = SELF + sw $s1, -336($fp) + # LOCAL local_option_at_CellularAutomaton_internal_81 --> -328($fp) + # LOCAL local_option_at_CellularAutomaton_internal_83 --> -336($fp) + # local_option_at_CellularAutomaton_internal_81 = local_option_at_CellularAutomaton_internal_83 + lw $t0, -336($fp) + sw $t0, -328($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_option_at_CellularAutomaton_internal_84 --> -340($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_54 + sw $t0, 12($v0) + li $t0, 13 + sw $t0, 16($v0) + sw $v0, -340($fp) + # ARG local_option_at_CellularAutomaton_internal_84 + # LOCAL local_option_at_CellularAutomaton_internal_84 --> -340($fp) + lw $t0, -340($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_option_at_CellularAutomaton_internal_81 --> -328($fp) + # LOCAL local_option_at_CellularAutomaton_internal_82 --> -332($fp) + # local_option_at_CellularAutomaton_internal_82 = VCALL local_option_at_CellularAutomaton_internal_81 out_string + # Save new self pointer in $s1 + lw $s1, -328($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 92($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -332($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_option_at_CellularAutomaton_internal_87 --> -352($fp) + # local_option_at_CellularAutomaton_internal_87 = SELF + sw $s1, -352($fp) + # LOCAL local_option_at_CellularAutomaton_internal_85 --> -344($fp) + # LOCAL local_option_at_CellularAutomaton_internal_87 --> -352($fp) + # local_option_at_CellularAutomaton_internal_85 = local_option_at_CellularAutomaton_internal_87 + lw $t0, -352($fp) + sw $t0, -344($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_option_at_CellularAutomaton_internal_88 --> -356($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_55 + sw $t0, 12($v0) + li $t0, 13 + sw $t0, 16($v0) + sw $v0, -356($fp) + # ARG local_option_at_CellularAutomaton_internal_88 + # LOCAL local_option_at_CellularAutomaton_internal_88 --> -356($fp) + lw $t0, -356($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_option_at_CellularAutomaton_internal_85 --> -344($fp) + # LOCAL local_option_at_CellularAutomaton_internal_86 --> -348($fp) + # local_option_at_CellularAutomaton_internal_86 = VCALL local_option_at_CellularAutomaton_internal_85 out_string + # Save new self pointer in $s1 + lw $s1, -344($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 92($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -348($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_option_at_CellularAutomaton_internal_91 --> -368($fp) + # local_option_at_CellularAutomaton_internal_91 = SELF + sw $s1, -368($fp) + # LOCAL local_option_at_CellularAutomaton_internal_89 --> -360($fp) + # LOCAL local_option_at_CellularAutomaton_internal_91 --> -368($fp) + # local_option_at_CellularAutomaton_internal_89 = local_option_at_CellularAutomaton_internal_91 + lw $t0, -368($fp) + sw $t0, -360($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_option_at_CellularAutomaton_internal_92 --> -372($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_56 + sw $t0, 12($v0) + li $t0, 15 + sw $t0, 16($v0) + sw $v0, -372($fp) + # ARG local_option_at_CellularAutomaton_internal_92 + # LOCAL local_option_at_CellularAutomaton_internal_92 --> -372($fp) + lw $t0, -372($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_option_at_CellularAutomaton_internal_89 --> -360($fp) + # LOCAL local_option_at_CellularAutomaton_internal_90 --> -364($fp) + # local_option_at_CellularAutomaton_internal_90 = VCALL local_option_at_CellularAutomaton_internal_89 out_string + # Save new self pointer in $s1 + lw $s1, -360($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 92($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -364($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_option_at_CellularAutomaton_internal_95 --> -384($fp) + # local_option_at_CellularAutomaton_internal_95 = SELF + sw $s1, -384($fp) + # LOCAL local_option_at_CellularAutomaton_internal_93 --> -376($fp) + # LOCAL local_option_at_CellularAutomaton_internal_95 --> -384($fp) + # local_option_at_CellularAutomaton_internal_93 = local_option_at_CellularAutomaton_internal_95 + lw $t0, -384($fp) + sw $t0, -376($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_option_at_CellularAutomaton_internal_93 --> -376($fp) + # LOCAL local_option_at_CellularAutomaton_internal_94 --> -380($fp) + # local_option_at_CellularAutomaton_internal_94 = VCALL local_option_at_CellularAutomaton_internal_93 in_int + # Save new self pointer in $s1 + lw $s1, -376($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 0($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -380($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_94 --> -380($fp) + # local_option_at_CellularAutomaton_num_0 = local_option_at_CellularAutomaton_internal_94 + lw $t0, -380($fp) + sw $t0, -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_98 --> -396($fp) + # local_option_at_CellularAutomaton_internal_98 = SELF + sw $s1, -396($fp) + # LOCAL local_option_at_CellularAutomaton_internal_96 --> -388($fp) + # LOCAL local_option_at_CellularAutomaton_internal_98 --> -396($fp) + # local_option_at_CellularAutomaton_internal_96 = local_option_at_CellularAutomaton_internal_98 + lw $t0, -396($fp) + sw $t0, -388($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_option_at_CellularAutomaton_internal_99 --> -400($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_57 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -400($fp) + # ARG local_option_at_CellularAutomaton_internal_99 + # LOCAL local_option_at_CellularAutomaton_internal_99 --> -400($fp) + lw $t0, -400($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_option_at_CellularAutomaton_internal_96 --> -388($fp) + # LOCAL local_option_at_CellularAutomaton_internal_97 --> -392($fp) + # local_option_at_CellularAutomaton_internal_97 = VCALL local_option_at_CellularAutomaton_internal_96 out_string + # Save new self pointer in $s1 + lw $s1, -388($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 92($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -392($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_option_at_CellularAutomaton_internal_104 --> -420($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -420($fp) + # IF_ZERO local_option_at_CellularAutomaton_num_0 GOTO label_FALSE_279 + # IF_ZERO local_option_at_CellularAutomaton_num_0 GOTO label_FALSE_279 + lw $t0, -4($fp) + beq $t0, 0, label_FALSE_279 + # IF_ZERO local_option_at_CellularAutomaton_internal_104 GOTO label_FALSE_279 + # IF_ZERO local_option_at_CellularAutomaton_internal_104 GOTO label_FALSE_279 + lw $t0, -420($fp) + beq $t0, 0, label_FALSE_279 + # LOCAL local_option_at_CellularAutomaton_internal_103 --> -416($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Comparing -4($fp) type with String + la $v0, String + lw $a0, -4($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -416($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_103 GOTO label_COMPARE_STRING_282 + # IF_ZERO local_option_at_CellularAutomaton_internal_103 GOTO label_COMPARE_STRING_282 + lw $t0, -416($fp) + beq $t0, 0, label_COMPARE_STRING_282 + # LOCAL local_option_at_CellularAutomaton_internal_103 --> -416($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Comparing -4($fp) type with Bool + la $v0, Bool + lw $a0, -4($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -416($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_103 GOTO label_COMPARE_BY_VALUE_283 + # IF_ZERO local_option_at_CellularAutomaton_internal_103 GOTO label_COMPARE_BY_VALUE_283 + lw $t0, -416($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_283 + # LOCAL local_option_at_CellularAutomaton_internal_103 --> -416($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Comparing -4($fp) type with Int + la $v0, Int + lw $a0, -4($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -416($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_103 GOTO label_COMPARE_BY_VALUE_283 + # IF_ZERO local_option_at_CellularAutomaton_internal_103 GOTO label_COMPARE_BY_VALUE_283 + lw $t0, -416($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_283 + # LOCAL local_option_at_CellularAutomaton_internal_103 --> -416($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_104 --> -420($fp) + # Load pointers and SUB + lw $a0, -4($fp) + lw $a1, -420($fp) + sub $a0, $a0, $a1 + sw $a0, -416($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_103 GOTO label_TRUE_280 + # IF_ZERO local_option_at_CellularAutomaton_internal_103 GOTO label_TRUE_280 + lw $t0, -416($fp) + beq $t0, 0, label_TRUE_280 + # GOTO label_FALSE_279 + j label_FALSE_279 + label_COMPARE_BY_VALUE_283: + # LOCAL local_option_at_CellularAutomaton_internal_103 --> -416($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_104 --> -420($fp) + lw $a0, -4($fp) + lw $a1, -420($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -416($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_103 GOTO label_TRUE_280 + # IF_ZERO local_option_at_CellularAutomaton_internal_103 GOTO label_TRUE_280 + lw $t0, -416($fp) + beq $t0, 0, label_TRUE_280 + # GOTO label_FALSE_279 + j label_FALSE_279 + label_COMPARE_STRING_282: + # LOCAL local_option_at_CellularAutomaton_internal_103 --> -416($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_104 --> -420($fp) + # Load strings for comparison + lw $v0, -4($fp) + lw $v1, -420($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -416($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_103 GOTO label_CONTINUE_284 + # IF_ZERO local_option_at_CellularAutomaton_internal_103 GOTO label_CONTINUE_284 + lw $t0, -416($fp) + beq $t0, 0, label_CONTINUE_284 + # GOTO label_FALSE_279 + j label_FALSE_279 + label_CONTINUE_284: + # LOCAL local_option_at_CellularAutomaton_internal_103 --> -416($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_104 --> -420($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -4($fp) + lw $v1, -420($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_285: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_286 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_285 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_286: + # Store result + sw $a2, -416($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_103 GOTO label_TRUE_280 + # IF_ZERO local_option_at_CellularAutomaton_internal_103 GOTO label_TRUE_280 + lw $t0, -416($fp) + beq $t0, 0, label_TRUE_280 + label_FALSE_279: + # LOCAL local_option_at_CellularAutomaton_internal_102 --> -412($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -412($fp) + # GOTO label_END_281 +j label_END_281 +label_TRUE_280: + # LOCAL local_option_at_CellularAutomaton_internal_102 --> -412($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -412($fp) + label_END_281: +# LOCAL local_option_at_CellularAutomaton_internal_100 --> -404($fp) +# LOCAL local_option_at_CellularAutomaton_internal_102 --> -412($fp) +# Obtain value from -412($fp) +lw $v0, -412($fp) +lw $v0, 12($v0) +sw $v0, -404($fp) +# IF_ZERO local_option_at_CellularAutomaton_internal_100 GOTO label_FALSEIF_277 +# IF_ZERO local_option_at_CellularAutomaton_internal_100 GOTO label_FALSEIF_277 +lw $t0, -404($fp) +beq $t0, 0, label_FALSEIF_277 +# LOCAL local_option_at_CellularAutomaton_internal_105 --> -424($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_58 +sw $t0, 12($v0) +li $t0, 20 +sw $t0, 16($v0) +sw $v0, -424($fp) +# LOCAL local_option_at_CellularAutomaton_internal_101 --> -408($fp) +# LOCAL local_option_at_CellularAutomaton_internal_105 --> -424($fp) +# local_option_at_CellularAutomaton_internal_101 = local_option_at_CellularAutomaton_internal_105 +lw $t0, -424($fp) +sw $t0, -408($fp) +# GOTO label_ENDIF_278 +j label_ENDIF_278 +label_FALSEIF_277: + # LOCAL local_option_at_CellularAutomaton_internal_110 --> -444($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 2 + sw $t0, 12($v0) + sw $v0, -444($fp) + # IF_ZERO local_option_at_CellularAutomaton_num_0 GOTO label_FALSE_289 + # IF_ZERO local_option_at_CellularAutomaton_num_0 GOTO label_FALSE_289 + lw $t0, -4($fp) + beq $t0, 0, label_FALSE_289 + # IF_ZERO local_option_at_CellularAutomaton_internal_110 GOTO label_FALSE_289 + # IF_ZERO local_option_at_CellularAutomaton_internal_110 GOTO label_FALSE_289 + lw $t0, -444($fp) + beq $t0, 0, label_FALSE_289 + # LOCAL local_option_at_CellularAutomaton_internal_109 --> -440($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Comparing -4($fp) type with String + la $v0, String + lw $a0, -4($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -440($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_109 GOTO label_COMPARE_STRING_292 + # IF_ZERO local_option_at_CellularAutomaton_internal_109 GOTO label_COMPARE_STRING_292 + lw $t0, -440($fp) + beq $t0, 0, label_COMPARE_STRING_292 + # LOCAL local_option_at_CellularAutomaton_internal_109 --> -440($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Comparing -4($fp) type with Bool + la $v0, Bool + lw $a0, -4($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -440($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_109 GOTO label_COMPARE_BY_VALUE_293 + # IF_ZERO local_option_at_CellularAutomaton_internal_109 GOTO label_COMPARE_BY_VALUE_293 + lw $t0, -440($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_293 + # LOCAL local_option_at_CellularAutomaton_internal_109 --> -440($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Comparing -4($fp) type with Int + la $v0, Int + lw $a0, -4($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -440($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_109 GOTO label_COMPARE_BY_VALUE_293 + # IF_ZERO local_option_at_CellularAutomaton_internal_109 GOTO label_COMPARE_BY_VALUE_293 + lw $t0, -440($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_293 + # LOCAL local_option_at_CellularAutomaton_internal_109 --> -440($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_110 --> -444($fp) + # Load pointers and SUB + lw $a0, -4($fp) + lw $a1, -444($fp) + sub $a0, $a0, $a1 + sw $a0, -440($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_109 GOTO label_TRUE_290 + # IF_ZERO local_option_at_CellularAutomaton_internal_109 GOTO label_TRUE_290 + lw $t0, -440($fp) + beq $t0, 0, label_TRUE_290 + # GOTO label_FALSE_289 + j label_FALSE_289 + label_COMPARE_BY_VALUE_293: + # LOCAL local_option_at_CellularAutomaton_internal_109 --> -440($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_110 --> -444($fp) + lw $a0, -4($fp) + lw $a1, -444($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -440($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_109 GOTO label_TRUE_290 + # IF_ZERO local_option_at_CellularAutomaton_internal_109 GOTO label_TRUE_290 + lw $t0, -440($fp) + beq $t0, 0, label_TRUE_290 + # GOTO label_FALSE_289 + j label_FALSE_289 + label_COMPARE_STRING_292: + # LOCAL local_option_at_CellularAutomaton_internal_109 --> -440($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_110 --> -444($fp) + # Load strings for comparison + lw $v0, -4($fp) + lw $v1, -444($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -440($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_109 GOTO label_CONTINUE_294 + # IF_ZERO local_option_at_CellularAutomaton_internal_109 GOTO label_CONTINUE_294 + lw $t0, -440($fp) + beq $t0, 0, label_CONTINUE_294 + # GOTO label_FALSE_289 + j label_FALSE_289 + label_CONTINUE_294: + # LOCAL local_option_at_CellularAutomaton_internal_109 --> -440($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_110 --> -444($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -4($fp) + lw $v1, -444($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_295: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_296 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_295 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_296: + # Store result + sw $a2, -440($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_109 GOTO label_TRUE_290 + # IF_ZERO local_option_at_CellularAutomaton_internal_109 GOTO label_TRUE_290 + lw $t0, -440($fp) + beq $t0, 0, label_TRUE_290 + label_FALSE_289: + # LOCAL local_option_at_CellularAutomaton_internal_108 --> -436($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -436($fp) + # GOTO label_END_291 +j label_END_291 +label_TRUE_290: + # LOCAL local_option_at_CellularAutomaton_internal_108 --> -436($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -436($fp) + label_END_291: +# LOCAL local_option_at_CellularAutomaton_internal_106 --> -428($fp) +# LOCAL local_option_at_CellularAutomaton_internal_108 --> -436($fp) +# Obtain value from -436($fp) +lw $v0, -436($fp) +lw $v0, 12($v0) +sw $v0, -428($fp) +# IF_ZERO local_option_at_CellularAutomaton_internal_106 GOTO label_FALSEIF_287 +# IF_ZERO local_option_at_CellularAutomaton_internal_106 GOTO label_FALSEIF_287 +lw $t0, -428($fp) +beq $t0, 0, label_FALSEIF_287 +# LOCAL local_option_at_CellularAutomaton_internal_111 --> -448($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_59 +sw $t0, 12($v0) +li $t0, 25 +sw $t0, 16($v0) +sw $v0, -448($fp) +# LOCAL local_option_at_CellularAutomaton_internal_107 --> -432($fp) +# LOCAL local_option_at_CellularAutomaton_internal_111 --> -448($fp) +# local_option_at_CellularAutomaton_internal_107 = local_option_at_CellularAutomaton_internal_111 +lw $t0, -448($fp) +sw $t0, -432($fp) +# GOTO label_ENDIF_288 +j label_ENDIF_288 +label_FALSEIF_287: + # LOCAL local_option_at_CellularAutomaton_internal_116 --> -468($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 3 + sw $t0, 12($v0) + sw $v0, -468($fp) + # IF_ZERO local_option_at_CellularAutomaton_num_0 GOTO label_FALSE_299 + # IF_ZERO local_option_at_CellularAutomaton_num_0 GOTO label_FALSE_299 + lw $t0, -4($fp) + beq $t0, 0, label_FALSE_299 + # IF_ZERO local_option_at_CellularAutomaton_internal_116 GOTO label_FALSE_299 + # IF_ZERO local_option_at_CellularAutomaton_internal_116 GOTO label_FALSE_299 + lw $t0, -468($fp) + beq $t0, 0, label_FALSE_299 + # LOCAL local_option_at_CellularAutomaton_internal_115 --> -464($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Comparing -4($fp) type with String + la $v0, String + lw $a0, -4($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -464($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_115 GOTO label_COMPARE_STRING_302 + # IF_ZERO local_option_at_CellularAutomaton_internal_115 GOTO label_COMPARE_STRING_302 + lw $t0, -464($fp) + beq $t0, 0, label_COMPARE_STRING_302 + # LOCAL local_option_at_CellularAutomaton_internal_115 --> -464($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Comparing -4($fp) type with Bool + la $v0, Bool + lw $a0, -4($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -464($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_115 GOTO label_COMPARE_BY_VALUE_303 + # IF_ZERO local_option_at_CellularAutomaton_internal_115 GOTO label_COMPARE_BY_VALUE_303 + lw $t0, -464($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_303 + # LOCAL local_option_at_CellularAutomaton_internal_115 --> -464($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Comparing -4($fp) type with Int + la $v0, Int + lw $a0, -4($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -464($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_115 GOTO label_COMPARE_BY_VALUE_303 + # IF_ZERO local_option_at_CellularAutomaton_internal_115 GOTO label_COMPARE_BY_VALUE_303 + lw $t0, -464($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_303 + # LOCAL local_option_at_CellularAutomaton_internal_115 --> -464($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_116 --> -468($fp) + # Load pointers and SUB + lw $a0, -4($fp) + lw $a1, -468($fp) + sub $a0, $a0, $a1 + sw $a0, -464($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_115 GOTO label_TRUE_300 + # IF_ZERO local_option_at_CellularAutomaton_internal_115 GOTO label_TRUE_300 + lw $t0, -464($fp) + beq $t0, 0, label_TRUE_300 + # GOTO label_FALSE_299 + j label_FALSE_299 + label_COMPARE_BY_VALUE_303: + # LOCAL local_option_at_CellularAutomaton_internal_115 --> -464($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_116 --> -468($fp) + lw $a0, -4($fp) + lw $a1, -468($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -464($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_115 GOTO label_TRUE_300 + # IF_ZERO local_option_at_CellularAutomaton_internal_115 GOTO label_TRUE_300 + lw $t0, -464($fp) + beq $t0, 0, label_TRUE_300 + # GOTO label_FALSE_299 + j label_FALSE_299 + label_COMPARE_STRING_302: + # LOCAL local_option_at_CellularAutomaton_internal_115 --> -464($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_116 --> -468($fp) + # Load strings for comparison + lw $v0, -4($fp) + lw $v1, -468($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -464($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_115 GOTO label_CONTINUE_304 + # IF_ZERO local_option_at_CellularAutomaton_internal_115 GOTO label_CONTINUE_304 + lw $t0, -464($fp) + beq $t0, 0, label_CONTINUE_304 + # GOTO label_FALSE_299 + j label_FALSE_299 + label_CONTINUE_304: + # LOCAL local_option_at_CellularAutomaton_internal_115 --> -464($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_116 --> -468($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -4($fp) + lw $v1, -468($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_305: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_306 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_305 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_306: + # Store result + sw $a2, -464($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_115 GOTO label_TRUE_300 + # IF_ZERO local_option_at_CellularAutomaton_internal_115 GOTO label_TRUE_300 + lw $t0, -464($fp) + beq $t0, 0, label_TRUE_300 + label_FALSE_299: + # LOCAL local_option_at_CellularAutomaton_internal_114 --> -460($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -460($fp) + # GOTO label_END_301 +j label_END_301 +label_TRUE_300: + # LOCAL local_option_at_CellularAutomaton_internal_114 --> -460($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -460($fp) + label_END_301: +# LOCAL local_option_at_CellularAutomaton_internal_112 --> -452($fp) +# LOCAL local_option_at_CellularAutomaton_internal_114 --> -460($fp) +# Obtain value from -460($fp) +lw $v0, -460($fp) +lw $v0, 12($v0) +sw $v0, -452($fp) +# IF_ZERO local_option_at_CellularAutomaton_internal_112 GOTO label_FALSEIF_297 +# IF_ZERO local_option_at_CellularAutomaton_internal_112 GOTO label_FALSEIF_297 +lw $t0, -452($fp) +beq $t0, 0, label_FALSEIF_297 +# LOCAL local_option_at_CellularAutomaton_internal_117 --> -472($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_60 +sw $t0, 12($v0) +li $t0, 25 +sw $t0, 16($v0) +sw $v0, -472($fp) +# LOCAL local_option_at_CellularAutomaton_internal_113 --> -456($fp) +# LOCAL local_option_at_CellularAutomaton_internal_117 --> -472($fp) +# local_option_at_CellularAutomaton_internal_113 = local_option_at_CellularAutomaton_internal_117 +lw $t0, -472($fp) +sw $t0, -456($fp) +# GOTO label_ENDIF_298 +j label_ENDIF_298 +label_FALSEIF_297: + # LOCAL local_option_at_CellularAutomaton_internal_122 --> -492($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 4 + sw $t0, 12($v0) + sw $v0, -492($fp) + # IF_ZERO local_option_at_CellularAutomaton_num_0 GOTO label_FALSE_309 + # IF_ZERO local_option_at_CellularAutomaton_num_0 GOTO label_FALSE_309 + lw $t0, -4($fp) + beq $t0, 0, label_FALSE_309 + # IF_ZERO local_option_at_CellularAutomaton_internal_122 GOTO label_FALSE_309 + # IF_ZERO local_option_at_CellularAutomaton_internal_122 GOTO label_FALSE_309 + lw $t0, -492($fp) + beq $t0, 0, label_FALSE_309 + # LOCAL local_option_at_CellularAutomaton_internal_121 --> -488($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Comparing -4($fp) type with String + la $v0, String + lw $a0, -4($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -488($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_121 GOTO label_COMPARE_STRING_312 + # IF_ZERO local_option_at_CellularAutomaton_internal_121 GOTO label_COMPARE_STRING_312 + lw $t0, -488($fp) + beq $t0, 0, label_COMPARE_STRING_312 + # LOCAL local_option_at_CellularAutomaton_internal_121 --> -488($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Comparing -4($fp) type with Bool + la $v0, Bool + lw $a0, -4($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -488($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_121 GOTO label_COMPARE_BY_VALUE_313 + # IF_ZERO local_option_at_CellularAutomaton_internal_121 GOTO label_COMPARE_BY_VALUE_313 + lw $t0, -488($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_313 + # LOCAL local_option_at_CellularAutomaton_internal_121 --> -488($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Comparing -4($fp) type with Int + la $v0, Int + lw $a0, -4($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -488($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_121 GOTO label_COMPARE_BY_VALUE_313 + # IF_ZERO local_option_at_CellularAutomaton_internal_121 GOTO label_COMPARE_BY_VALUE_313 + lw $t0, -488($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_313 + # LOCAL local_option_at_CellularAutomaton_internal_121 --> -488($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_122 --> -492($fp) + # Load pointers and SUB + lw $a0, -4($fp) + lw $a1, -492($fp) + sub $a0, $a0, $a1 + sw $a0, -488($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_121 GOTO label_TRUE_310 + # IF_ZERO local_option_at_CellularAutomaton_internal_121 GOTO label_TRUE_310 + lw $t0, -488($fp) + beq $t0, 0, label_TRUE_310 + # GOTO label_FALSE_309 + j label_FALSE_309 + label_COMPARE_BY_VALUE_313: + # LOCAL local_option_at_CellularAutomaton_internal_121 --> -488($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_122 --> -492($fp) + lw $a0, -4($fp) + lw $a1, -492($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -488($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_121 GOTO label_TRUE_310 + # IF_ZERO local_option_at_CellularAutomaton_internal_121 GOTO label_TRUE_310 + lw $t0, -488($fp) + beq $t0, 0, label_TRUE_310 + # GOTO label_FALSE_309 + j label_FALSE_309 + label_COMPARE_STRING_312: + # LOCAL local_option_at_CellularAutomaton_internal_121 --> -488($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_122 --> -492($fp) + # Load strings for comparison + lw $v0, -4($fp) + lw $v1, -492($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -488($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_121 GOTO label_CONTINUE_314 + # IF_ZERO local_option_at_CellularAutomaton_internal_121 GOTO label_CONTINUE_314 + lw $t0, -488($fp) + beq $t0, 0, label_CONTINUE_314 + # GOTO label_FALSE_309 + j label_FALSE_309 + label_CONTINUE_314: + # LOCAL local_option_at_CellularAutomaton_internal_121 --> -488($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_122 --> -492($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -4($fp) + lw $v1, -492($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_315: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_316 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_315 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_316: + # Store result + sw $a2, -488($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_121 GOTO label_TRUE_310 + # IF_ZERO local_option_at_CellularAutomaton_internal_121 GOTO label_TRUE_310 + lw $t0, -488($fp) + beq $t0, 0, label_TRUE_310 + label_FALSE_309: + # LOCAL local_option_at_CellularAutomaton_internal_120 --> -484($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -484($fp) + # GOTO label_END_311 +j label_END_311 +label_TRUE_310: + # LOCAL local_option_at_CellularAutomaton_internal_120 --> -484($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -484($fp) + label_END_311: +# LOCAL local_option_at_CellularAutomaton_internal_118 --> -476($fp) +# LOCAL local_option_at_CellularAutomaton_internal_120 --> -484($fp) +# Obtain value from -484($fp) +lw $v0, -484($fp) +lw $v0, 12($v0) +sw $v0, -476($fp) +# IF_ZERO local_option_at_CellularAutomaton_internal_118 GOTO label_FALSEIF_307 +# IF_ZERO local_option_at_CellularAutomaton_internal_118 GOTO label_FALSEIF_307 +lw $t0, -476($fp) +beq $t0, 0, label_FALSEIF_307 +# LOCAL local_option_at_CellularAutomaton_internal_123 --> -496($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_61 +sw $t0, 12($v0) +li $t0, 25 +sw $t0, 16($v0) +sw $v0, -496($fp) +# LOCAL local_option_at_CellularAutomaton_internal_119 --> -480($fp) +# LOCAL local_option_at_CellularAutomaton_internal_123 --> -496($fp) +# local_option_at_CellularAutomaton_internal_119 = local_option_at_CellularAutomaton_internal_123 +lw $t0, -496($fp) +sw $t0, -480($fp) +# GOTO label_ENDIF_308 +j label_ENDIF_308 +label_FALSEIF_307: + # LOCAL local_option_at_CellularAutomaton_internal_128 --> -516($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 5 + sw $t0, 12($v0) + sw $v0, -516($fp) + # IF_ZERO local_option_at_CellularAutomaton_num_0 GOTO label_FALSE_319 + # IF_ZERO local_option_at_CellularAutomaton_num_0 GOTO label_FALSE_319 + lw $t0, -4($fp) + beq $t0, 0, label_FALSE_319 + # IF_ZERO local_option_at_CellularAutomaton_internal_128 GOTO label_FALSE_319 + # IF_ZERO local_option_at_CellularAutomaton_internal_128 GOTO label_FALSE_319 + lw $t0, -516($fp) + beq $t0, 0, label_FALSE_319 + # LOCAL local_option_at_CellularAutomaton_internal_127 --> -512($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Comparing -4($fp) type with String + la $v0, String + lw $a0, -4($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -512($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_127 GOTO label_COMPARE_STRING_322 + # IF_ZERO local_option_at_CellularAutomaton_internal_127 GOTO label_COMPARE_STRING_322 + lw $t0, -512($fp) + beq $t0, 0, label_COMPARE_STRING_322 + # LOCAL local_option_at_CellularAutomaton_internal_127 --> -512($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Comparing -4($fp) type with Bool + la $v0, Bool + lw $a0, -4($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -512($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_127 GOTO label_COMPARE_BY_VALUE_323 + # IF_ZERO local_option_at_CellularAutomaton_internal_127 GOTO label_COMPARE_BY_VALUE_323 + lw $t0, -512($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_323 + # LOCAL local_option_at_CellularAutomaton_internal_127 --> -512($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Comparing -4($fp) type with Int + la $v0, Int + lw $a0, -4($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -512($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_127 GOTO label_COMPARE_BY_VALUE_323 + # IF_ZERO local_option_at_CellularAutomaton_internal_127 GOTO label_COMPARE_BY_VALUE_323 + lw $t0, -512($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_323 + # LOCAL local_option_at_CellularAutomaton_internal_127 --> -512($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_128 --> -516($fp) + # Load pointers and SUB + lw $a0, -4($fp) + lw $a1, -516($fp) + sub $a0, $a0, $a1 + sw $a0, -512($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_127 GOTO label_TRUE_320 + # IF_ZERO local_option_at_CellularAutomaton_internal_127 GOTO label_TRUE_320 + lw $t0, -512($fp) + beq $t0, 0, label_TRUE_320 + # GOTO label_FALSE_319 + j label_FALSE_319 + label_COMPARE_BY_VALUE_323: + # LOCAL local_option_at_CellularAutomaton_internal_127 --> -512($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_128 --> -516($fp) + lw $a0, -4($fp) + lw $a1, -516($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -512($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_127 GOTO label_TRUE_320 + # IF_ZERO local_option_at_CellularAutomaton_internal_127 GOTO label_TRUE_320 + lw $t0, -512($fp) + beq $t0, 0, label_TRUE_320 + # GOTO label_FALSE_319 + j label_FALSE_319 + label_COMPARE_STRING_322: + # LOCAL local_option_at_CellularAutomaton_internal_127 --> -512($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_128 --> -516($fp) + # Load strings for comparison + lw $v0, -4($fp) + lw $v1, -516($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -512($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_127 GOTO label_CONTINUE_324 + # IF_ZERO local_option_at_CellularAutomaton_internal_127 GOTO label_CONTINUE_324 + lw $t0, -512($fp) + beq $t0, 0, label_CONTINUE_324 + # GOTO label_FALSE_319 + j label_FALSE_319 + label_CONTINUE_324: + # LOCAL local_option_at_CellularAutomaton_internal_127 --> -512($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_128 --> -516($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -4($fp) + lw $v1, -516($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_325: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_326 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_325 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_326: + # Store result + sw $a2, -512($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_127 GOTO label_TRUE_320 + # IF_ZERO local_option_at_CellularAutomaton_internal_127 GOTO label_TRUE_320 + lw $t0, -512($fp) + beq $t0, 0, label_TRUE_320 + label_FALSE_319: + # LOCAL local_option_at_CellularAutomaton_internal_126 --> -508($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -508($fp) + # GOTO label_END_321 +j label_END_321 +label_TRUE_320: + # LOCAL local_option_at_CellularAutomaton_internal_126 --> -508($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -508($fp) + label_END_321: +# LOCAL local_option_at_CellularAutomaton_internal_124 --> -500($fp) +# LOCAL local_option_at_CellularAutomaton_internal_126 --> -508($fp) +# Obtain value from -508($fp) +lw $v0, -508($fp) +lw $v0, 12($v0) +sw $v0, -500($fp) +# IF_ZERO local_option_at_CellularAutomaton_internal_124 GOTO label_FALSEIF_317 +# IF_ZERO local_option_at_CellularAutomaton_internal_124 GOTO label_FALSEIF_317 +lw $t0, -500($fp) +beq $t0, 0, label_FALSEIF_317 +# LOCAL local_option_at_CellularAutomaton_internal_129 --> -520($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_62 +sw $t0, 12($v0) +li $t0, 25 +sw $t0, 16($v0) +sw $v0, -520($fp) +# LOCAL local_option_at_CellularAutomaton_internal_125 --> -504($fp) +# LOCAL local_option_at_CellularAutomaton_internal_129 --> -520($fp) +# local_option_at_CellularAutomaton_internal_125 = local_option_at_CellularAutomaton_internal_129 +lw $t0, -520($fp) +sw $t0, -504($fp) +# GOTO label_ENDIF_318 +j label_ENDIF_318 +label_FALSEIF_317: + # LOCAL local_option_at_CellularAutomaton_internal_134 --> -540($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 6 + sw $t0, 12($v0) + sw $v0, -540($fp) + # IF_ZERO local_option_at_CellularAutomaton_num_0 GOTO label_FALSE_329 + # IF_ZERO local_option_at_CellularAutomaton_num_0 GOTO label_FALSE_329 + lw $t0, -4($fp) + beq $t0, 0, label_FALSE_329 + # IF_ZERO local_option_at_CellularAutomaton_internal_134 GOTO label_FALSE_329 + # IF_ZERO local_option_at_CellularAutomaton_internal_134 GOTO label_FALSE_329 + lw $t0, -540($fp) + beq $t0, 0, label_FALSE_329 + # LOCAL local_option_at_CellularAutomaton_internal_133 --> -536($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Comparing -4($fp) type with String + la $v0, String + lw $a0, -4($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -536($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_133 GOTO label_COMPARE_STRING_332 + # IF_ZERO local_option_at_CellularAutomaton_internal_133 GOTO label_COMPARE_STRING_332 + lw $t0, -536($fp) + beq $t0, 0, label_COMPARE_STRING_332 + # LOCAL local_option_at_CellularAutomaton_internal_133 --> -536($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Comparing -4($fp) type with Bool + la $v0, Bool + lw $a0, -4($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -536($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_133 GOTO label_COMPARE_BY_VALUE_333 + # IF_ZERO local_option_at_CellularAutomaton_internal_133 GOTO label_COMPARE_BY_VALUE_333 + lw $t0, -536($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_333 + # LOCAL local_option_at_CellularAutomaton_internal_133 --> -536($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Comparing -4($fp) type with Int + la $v0, Int + lw $a0, -4($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -536($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_133 GOTO label_COMPARE_BY_VALUE_333 + # IF_ZERO local_option_at_CellularAutomaton_internal_133 GOTO label_COMPARE_BY_VALUE_333 + lw $t0, -536($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_333 + # LOCAL local_option_at_CellularAutomaton_internal_133 --> -536($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_134 --> -540($fp) + # Load pointers and SUB + lw $a0, -4($fp) + lw $a1, -540($fp) + sub $a0, $a0, $a1 + sw $a0, -536($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_133 GOTO label_TRUE_330 + # IF_ZERO local_option_at_CellularAutomaton_internal_133 GOTO label_TRUE_330 + lw $t0, -536($fp) + beq $t0, 0, label_TRUE_330 + # GOTO label_FALSE_329 + j label_FALSE_329 + label_COMPARE_BY_VALUE_333: + # LOCAL local_option_at_CellularAutomaton_internal_133 --> -536($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_134 --> -540($fp) + lw $a0, -4($fp) + lw $a1, -540($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -536($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_133 GOTO label_TRUE_330 + # IF_ZERO local_option_at_CellularAutomaton_internal_133 GOTO label_TRUE_330 + lw $t0, -536($fp) + beq $t0, 0, label_TRUE_330 + # GOTO label_FALSE_329 + j label_FALSE_329 + label_COMPARE_STRING_332: + # LOCAL local_option_at_CellularAutomaton_internal_133 --> -536($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_134 --> -540($fp) + # Load strings for comparison + lw $v0, -4($fp) + lw $v1, -540($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -536($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_133 GOTO label_CONTINUE_334 + # IF_ZERO local_option_at_CellularAutomaton_internal_133 GOTO label_CONTINUE_334 + lw $t0, -536($fp) + beq $t0, 0, label_CONTINUE_334 + # GOTO label_FALSE_329 + j label_FALSE_329 + label_CONTINUE_334: + # LOCAL local_option_at_CellularAutomaton_internal_133 --> -536($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_134 --> -540($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -4($fp) + lw $v1, -540($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_335: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_336 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_335 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_336: + # Store result + sw $a2, -536($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_133 GOTO label_TRUE_330 + # IF_ZERO local_option_at_CellularAutomaton_internal_133 GOTO label_TRUE_330 + lw $t0, -536($fp) + beq $t0, 0, label_TRUE_330 + label_FALSE_329: + # LOCAL local_option_at_CellularAutomaton_internal_132 --> -532($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -532($fp) + # GOTO label_END_331 +j label_END_331 +label_TRUE_330: + # LOCAL local_option_at_CellularAutomaton_internal_132 --> -532($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -532($fp) + label_END_331: +# LOCAL local_option_at_CellularAutomaton_internal_130 --> -524($fp) +# LOCAL local_option_at_CellularAutomaton_internal_132 --> -532($fp) +# Obtain value from -532($fp) +lw $v0, -532($fp) +lw $v0, 12($v0) +sw $v0, -524($fp) +# IF_ZERO local_option_at_CellularAutomaton_internal_130 GOTO label_FALSEIF_327 +# IF_ZERO local_option_at_CellularAutomaton_internal_130 GOTO label_FALSEIF_327 +lw $t0, -524($fp) +beq $t0, 0, label_FALSEIF_327 +# LOCAL local_option_at_CellularAutomaton_internal_135 --> -544($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_63 +sw $t0, 12($v0) +li $t0, 25 +sw $t0, 16($v0) +sw $v0, -544($fp) +# LOCAL local_option_at_CellularAutomaton_internal_131 --> -528($fp) +# LOCAL local_option_at_CellularAutomaton_internal_135 --> -544($fp) +# local_option_at_CellularAutomaton_internal_131 = local_option_at_CellularAutomaton_internal_135 +lw $t0, -544($fp) +sw $t0, -528($fp) +# GOTO label_ENDIF_328 +j label_ENDIF_328 +label_FALSEIF_327: + # LOCAL local_option_at_CellularAutomaton_internal_140 --> -564($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 7 + sw $t0, 12($v0) + sw $v0, -564($fp) + # IF_ZERO local_option_at_CellularAutomaton_num_0 GOTO label_FALSE_339 + # IF_ZERO local_option_at_CellularAutomaton_num_0 GOTO label_FALSE_339 + lw $t0, -4($fp) + beq $t0, 0, label_FALSE_339 + # IF_ZERO local_option_at_CellularAutomaton_internal_140 GOTO label_FALSE_339 + # IF_ZERO local_option_at_CellularAutomaton_internal_140 GOTO label_FALSE_339 + lw $t0, -564($fp) + beq $t0, 0, label_FALSE_339 + # LOCAL local_option_at_CellularAutomaton_internal_139 --> -560($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Comparing -4($fp) type with String + la $v0, String + lw $a0, -4($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -560($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_139 GOTO label_COMPARE_STRING_342 + # IF_ZERO local_option_at_CellularAutomaton_internal_139 GOTO label_COMPARE_STRING_342 + lw $t0, -560($fp) + beq $t0, 0, label_COMPARE_STRING_342 + # LOCAL local_option_at_CellularAutomaton_internal_139 --> -560($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Comparing -4($fp) type with Bool + la $v0, Bool + lw $a0, -4($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -560($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_139 GOTO label_COMPARE_BY_VALUE_343 + # IF_ZERO local_option_at_CellularAutomaton_internal_139 GOTO label_COMPARE_BY_VALUE_343 + lw $t0, -560($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_343 + # LOCAL local_option_at_CellularAutomaton_internal_139 --> -560($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Comparing -4($fp) type with Int + la $v0, Int + lw $a0, -4($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -560($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_139 GOTO label_COMPARE_BY_VALUE_343 + # IF_ZERO local_option_at_CellularAutomaton_internal_139 GOTO label_COMPARE_BY_VALUE_343 + lw $t0, -560($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_343 + # LOCAL local_option_at_CellularAutomaton_internal_139 --> -560($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_140 --> -564($fp) + # Load pointers and SUB + lw $a0, -4($fp) + lw $a1, -564($fp) + sub $a0, $a0, $a1 + sw $a0, -560($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_139 GOTO label_TRUE_340 + # IF_ZERO local_option_at_CellularAutomaton_internal_139 GOTO label_TRUE_340 + lw $t0, -560($fp) + beq $t0, 0, label_TRUE_340 + # GOTO label_FALSE_339 + j label_FALSE_339 + label_COMPARE_BY_VALUE_343: + # LOCAL local_option_at_CellularAutomaton_internal_139 --> -560($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_140 --> -564($fp) + lw $a0, -4($fp) + lw $a1, -564($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -560($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_139 GOTO label_TRUE_340 + # IF_ZERO local_option_at_CellularAutomaton_internal_139 GOTO label_TRUE_340 + lw $t0, -560($fp) + beq $t0, 0, label_TRUE_340 + # GOTO label_FALSE_339 + j label_FALSE_339 + label_COMPARE_STRING_342: + # LOCAL local_option_at_CellularAutomaton_internal_139 --> -560($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_140 --> -564($fp) + # Load strings for comparison + lw $v0, -4($fp) + lw $v1, -564($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -560($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_139 GOTO label_CONTINUE_344 + # IF_ZERO local_option_at_CellularAutomaton_internal_139 GOTO label_CONTINUE_344 + lw $t0, -560($fp) + beq $t0, 0, label_CONTINUE_344 + # GOTO label_FALSE_339 + j label_FALSE_339 + label_CONTINUE_344: + # LOCAL local_option_at_CellularAutomaton_internal_139 --> -560($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_140 --> -564($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -4($fp) + lw $v1, -564($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_345: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_346 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_345 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_346: + # Store result + sw $a2, -560($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_139 GOTO label_TRUE_340 + # IF_ZERO local_option_at_CellularAutomaton_internal_139 GOTO label_TRUE_340 + lw $t0, -560($fp) + beq $t0, 0, label_TRUE_340 + label_FALSE_339: + # LOCAL local_option_at_CellularAutomaton_internal_138 --> -556($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -556($fp) + # GOTO label_END_341 +j label_END_341 +label_TRUE_340: + # LOCAL local_option_at_CellularAutomaton_internal_138 --> -556($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -556($fp) + label_END_341: +# LOCAL local_option_at_CellularAutomaton_internal_136 --> -548($fp) +# LOCAL local_option_at_CellularAutomaton_internal_138 --> -556($fp) +# Obtain value from -556($fp) +lw $v0, -556($fp) +lw $v0, 12($v0) +sw $v0, -548($fp) +# IF_ZERO local_option_at_CellularAutomaton_internal_136 GOTO label_FALSEIF_337 +# IF_ZERO local_option_at_CellularAutomaton_internal_136 GOTO label_FALSEIF_337 +lw $t0, -548($fp) +beq $t0, 0, label_FALSEIF_337 +# LOCAL local_option_at_CellularAutomaton_internal_141 --> -568($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_64 +sw $t0, 12($v0) +li $t0, 20 +sw $t0, 16($v0) +sw $v0, -568($fp) +# LOCAL local_option_at_CellularAutomaton_internal_137 --> -552($fp) +# LOCAL local_option_at_CellularAutomaton_internal_141 --> -568($fp) +# local_option_at_CellularAutomaton_internal_137 = local_option_at_CellularAutomaton_internal_141 +lw $t0, -568($fp) +sw $t0, -552($fp) +# GOTO label_ENDIF_338 +j label_ENDIF_338 +label_FALSEIF_337: + # LOCAL local_option_at_CellularAutomaton_internal_146 --> -588($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 8 + sw $t0, 12($v0) + sw $v0, -588($fp) + # IF_ZERO local_option_at_CellularAutomaton_num_0 GOTO label_FALSE_349 + # IF_ZERO local_option_at_CellularAutomaton_num_0 GOTO label_FALSE_349 + lw $t0, -4($fp) + beq $t0, 0, label_FALSE_349 + # IF_ZERO local_option_at_CellularAutomaton_internal_146 GOTO label_FALSE_349 + # IF_ZERO local_option_at_CellularAutomaton_internal_146 GOTO label_FALSE_349 + lw $t0, -588($fp) + beq $t0, 0, label_FALSE_349 + # LOCAL local_option_at_CellularAutomaton_internal_145 --> -584($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Comparing -4($fp) type with String + la $v0, String + lw $a0, -4($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -584($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_145 GOTO label_COMPARE_STRING_352 + # IF_ZERO local_option_at_CellularAutomaton_internal_145 GOTO label_COMPARE_STRING_352 + lw $t0, -584($fp) + beq $t0, 0, label_COMPARE_STRING_352 + # LOCAL local_option_at_CellularAutomaton_internal_145 --> -584($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Comparing -4($fp) type with Bool + la $v0, Bool + lw $a0, -4($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -584($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_145 GOTO label_COMPARE_BY_VALUE_353 + # IF_ZERO local_option_at_CellularAutomaton_internal_145 GOTO label_COMPARE_BY_VALUE_353 + lw $t0, -584($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_353 + # LOCAL local_option_at_CellularAutomaton_internal_145 --> -584($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Comparing -4($fp) type with Int + la $v0, Int + lw $a0, -4($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -584($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_145 GOTO label_COMPARE_BY_VALUE_353 + # IF_ZERO local_option_at_CellularAutomaton_internal_145 GOTO label_COMPARE_BY_VALUE_353 + lw $t0, -584($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_353 + # LOCAL local_option_at_CellularAutomaton_internal_145 --> -584($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_146 --> -588($fp) + # Load pointers and SUB + lw $a0, -4($fp) + lw $a1, -588($fp) + sub $a0, $a0, $a1 + sw $a0, -584($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_145 GOTO label_TRUE_350 + # IF_ZERO local_option_at_CellularAutomaton_internal_145 GOTO label_TRUE_350 + lw $t0, -584($fp) + beq $t0, 0, label_TRUE_350 + # GOTO label_FALSE_349 + j label_FALSE_349 + label_COMPARE_BY_VALUE_353: + # LOCAL local_option_at_CellularAutomaton_internal_145 --> -584($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_146 --> -588($fp) + lw $a0, -4($fp) + lw $a1, -588($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -584($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_145 GOTO label_TRUE_350 + # IF_ZERO local_option_at_CellularAutomaton_internal_145 GOTO label_TRUE_350 + lw $t0, -584($fp) + beq $t0, 0, label_TRUE_350 + # GOTO label_FALSE_349 + j label_FALSE_349 + label_COMPARE_STRING_352: + # LOCAL local_option_at_CellularAutomaton_internal_145 --> -584($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_146 --> -588($fp) + # Load strings for comparison + lw $v0, -4($fp) + lw $v1, -588($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -584($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_145 GOTO label_CONTINUE_354 + # IF_ZERO local_option_at_CellularAutomaton_internal_145 GOTO label_CONTINUE_354 + lw $t0, -584($fp) + beq $t0, 0, label_CONTINUE_354 + # GOTO label_FALSE_349 + j label_FALSE_349 + label_CONTINUE_354: + # LOCAL local_option_at_CellularAutomaton_internal_145 --> -584($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_146 --> -588($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -4($fp) + lw $v1, -588($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_355: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_356 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_355 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_356: + # Store result + sw $a2, -584($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_145 GOTO label_TRUE_350 + # IF_ZERO local_option_at_CellularAutomaton_internal_145 GOTO label_TRUE_350 + lw $t0, -584($fp) + beq $t0, 0, label_TRUE_350 + label_FALSE_349: + # LOCAL local_option_at_CellularAutomaton_internal_144 --> -580($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -580($fp) + # GOTO label_END_351 +j label_END_351 +label_TRUE_350: + # LOCAL local_option_at_CellularAutomaton_internal_144 --> -580($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -580($fp) + label_END_351: +# LOCAL local_option_at_CellularAutomaton_internal_142 --> -572($fp) +# LOCAL local_option_at_CellularAutomaton_internal_144 --> -580($fp) +# Obtain value from -580($fp) +lw $v0, -580($fp) +lw $v0, 12($v0) +sw $v0, -572($fp) +# IF_ZERO local_option_at_CellularAutomaton_internal_142 GOTO label_FALSEIF_347 +# IF_ZERO local_option_at_CellularAutomaton_internal_142 GOTO label_FALSEIF_347 +lw $t0, -572($fp) +beq $t0, 0, label_FALSEIF_347 +# LOCAL local_option_at_CellularAutomaton_internal_147 --> -592($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_65 +sw $t0, 12($v0) +li $t0, 20 +sw $t0, 16($v0) +sw $v0, -592($fp) +# LOCAL local_option_at_CellularAutomaton_internal_143 --> -576($fp) +# LOCAL local_option_at_CellularAutomaton_internal_147 --> -592($fp) +# local_option_at_CellularAutomaton_internal_143 = local_option_at_CellularAutomaton_internal_147 +lw $t0, -592($fp) +sw $t0, -576($fp) +# GOTO label_ENDIF_348 +j label_ENDIF_348 +label_FALSEIF_347: + # LOCAL local_option_at_CellularAutomaton_internal_152 --> -612($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 9 + sw $t0, 12($v0) + sw $v0, -612($fp) + # IF_ZERO local_option_at_CellularAutomaton_num_0 GOTO label_FALSE_359 + # IF_ZERO local_option_at_CellularAutomaton_num_0 GOTO label_FALSE_359 + lw $t0, -4($fp) + beq $t0, 0, label_FALSE_359 + # IF_ZERO local_option_at_CellularAutomaton_internal_152 GOTO label_FALSE_359 + # IF_ZERO local_option_at_CellularAutomaton_internal_152 GOTO label_FALSE_359 + lw $t0, -612($fp) + beq $t0, 0, label_FALSE_359 + # LOCAL local_option_at_CellularAutomaton_internal_151 --> -608($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Comparing -4($fp) type with String + la $v0, String + lw $a0, -4($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -608($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_151 GOTO label_COMPARE_STRING_362 + # IF_ZERO local_option_at_CellularAutomaton_internal_151 GOTO label_COMPARE_STRING_362 + lw $t0, -608($fp) + beq $t0, 0, label_COMPARE_STRING_362 + # LOCAL local_option_at_CellularAutomaton_internal_151 --> -608($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Comparing -4($fp) type with Bool + la $v0, Bool + lw $a0, -4($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -608($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_151 GOTO label_COMPARE_BY_VALUE_363 + # IF_ZERO local_option_at_CellularAutomaton_internal_151 GOTO label_COMPARE_BY_VALUE_363 + lw $t0, -608($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_363 + # LOCAL local_option_at_CellularAutomaton_internal_151 --> -608($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Comparing -4($fp) type with Int + la $v0, Int + lw $a0, -4($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -608($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_151 GOTO label_COMPARE_BY_VALUE_363 + # IF_ZERO local_option_at_CellularAutomaton_internal_151 GOTO label_COMPARE_BY_VALUE_363 + lw $t0, -608($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_363 + # LOCAL local_option_at_CellularAutomaton_internal_151 --> -608($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_152 --> -612($fp) + # Load pointers and SUB + lw $a0, -4($fp) + lw $a1, -612($fp) + sub $a0, $a0, $a1 + sw $a0, -608($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_151 GOTO label_TRUE_360 + # IF_ZERO local_option_at_CellularAutomaton_internal_151 GOTO label_TRUE_360 + lw $t0, -608($fp) + beq $t0, 0, label_TRUE_360 + # GOTO label_FALSE_359 + j label_FALSE_359 + label_COMPARE_BY_VALUE_363: + # LOCAL local_option_at_CellularAutomaton_internal_151 --> -608($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_152 --> -612($fp) + lw $a0, -4($fp) + lw $a1, -612($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -608($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_151 GOTO label_TRUE_360 + # IF_ZERO local_option_at_CellularAutomaton_internal_151 GOTO label_TRUE_360 + lw $t0, -608($fp) + beq $t0, 0, label_TRUE_360 + # GOTO label_FALSE_359 + j label_FALSE_359 + label_COMPARE_STRING_362: + # LOCAL local_option_at_CellularAutomaton_internal_151 --> -608($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_152 --> -612($fp) + # Load strings for comparison + lw $v0, -4($fp) + lw $v1, -612($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -608($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_151 GOTO label_CONTINUE_364 + # IF_ZERO local_option_at_CellularAutomaton_internal_151 GOTO label_CONTINUE_364 + lw $t0, -608($fp) + beq $t0, 0, label_CONTINUE_364 + # GOTO label_FALSE_359 + j label_FALSE_359 + label_CONTINUE_364: + # LOCAL local_option_at_CellularAutomaton_internal_151 --> -608($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_152 --> -612($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -4($fp) + lw $v1, -612($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_365: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_366 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_365 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_366: + # Store result + sw $a2, -608($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_151 GOTO label_TRUE_360 + # IF_ZERO local_option_at_CellularAutomaton_internal_151 GOTO label_TRUE_360 + lw $t0, -608($fp) + beq $t0, 0, label_TRUE_360 + label_FALSE_359: + # LOCAL local_option_at_CellularAutomaton_internal_150 --> -604($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -604($fp) + # GOTO label_END_361 +j label_END_361 +label_TRUE_360: + # LOCAL local_option_at_CellularAutomaton_internal_150 --> -604($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -604($fp) + label_END_361: +# LOCAL local_option_at_CellularAutomaton_internal_148 --> -596($fp) +# LOCAL local_option_at_CellularAutomaton_internal_150 --> -604($fp) +# Obtain value from -604($fp) +lw $v0, -604($fp) +lw $v0, 12($v0) +sw $v0, -596($fp) +# IF_ZERO local_option_at_CellularAutomaton_internal_148 GOTO label_FALSEIF_357 +# IF_ZERO local_option_at_CellularAutomaton_internal_148 GOTO label_FALSEIF_357 +lw $t0, -596($fp) +beq $t0, 0, label_FALSEIF_357 +# LOCAL local_option_at_CellularAutomaton_internal_153 --> -616($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_66 +sw $t0, 12($v0) +li $t0, 15 +sw $t0, 16($v0) +sw $v0, -616($fp) +# LOCAL local_option_at_CellularAutomaton_internal_149 --> -600($fp) +# LOCAL local_option_at_CellularAutomaton_internal_153 --> -616($fp) +# local_option_at_CellularAutomaton_internal_149 = local_option_at_CellularAutomaton_internal_153 +lw $t0, -616($fp) +sw $t0, -600($fp) +# GOTO label_ENDIF_358 +j label_ENDIF_358 +label_FALSEIF_357: + # LOCAL local_option_at_CellularAutomaton_internal_158 --> -636($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 10 + sw $t0, 12($v0) + sw $v0, -636($fp) + # IF_ZERO local_option_at_CellularAutomaton_num_0 GOTO label_FALSE_369 + # IF_ZERO local_option_at_CellularAutomaton_num_0 GOTO label_FALSE_369 + lw $t0, -4($fp) + beq $t0, 0, label_FALSE_369 + # IF_ZERO local_option_at_CellularAutomaton_internal_158 GOTO label_FALSE_369 + # IF_ZERO local_option_at_CellularAutomaton_internal_158 GOTO label_FALSE_369 + lw $t0, -636($fp) + beq $t0, 0, label_FALSE_369 + # LOCAL local_option_at_CellularAutomaton_internal_157 --> -632($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Comparing -4($fp) type with String + la $v0, String + lw $a0, -4($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -632($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_157 GOTO label_COMPARE_STRING_372 + # IF_ZERO local_option_at_CellularAutomaton_internal_157 GOTO label_COMPARE_STRING_372 + lw $t0, -632($fp) + beq $t0, 0, label_COMPARE_STRING_372 + # LOCAL local_option_at_CellularAutomaton_internal_157 --> -632($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Comparing -4($fp) type with Bool + la $v0, Bool + lw $a0, -4($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -632($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_157 GOTO label_COMPARE_BY_VALUE_373 + # IF_ZERO local_option_at_CellularAutomaton_internal_157 GOTO label_COMPARE_BY_VALUE_373 + lw $t0, -632($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_373 + # LOCAL local_option_at_CellularAutomaton_internal_157 --> -632($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Comparing -4($fp) type with Int + la $v0, Int + lw $a0, -4($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -632($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_157 GOTO label_COMPARE_BY_VALUE_373 + # IF_ZERO local_option_at_CellularAutomaton_internal_157 GOTO label_COMPARE_BY_VALUE_373 + lw $t0, -632($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_373 + # LOCAL local_option_at_CellularAutomaton_internal_157 --> -632($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_158 --> -636($fp) + # Load pointers and SUB + lw $a0, -4($fp) + lw $a1, -636($fp) + sub $a0, $a0, $a1 + sw $a0, -632($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_157 GOTO label_TRUE_370 + # IF_ZERO local_option_at_CellularAutomaton_internal_157 GOTO label_TRUE_370 + lw $t0, -632($fp) + beq $t0, 0, label_TRUE_370 + # GOTO label_FALSE_369 + j label_FALSE_369 + label_COMPARE_BY_VALUE_373: + # LOCAL local_option_at_CellularAutomaton_internal_157 --> -632($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_158 --> -636($fp) + lw $a0, -4($fp) + lw $a1, -636($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -632($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_157 GOTO label_TRUE_370 + # IF_ZERO local_option_at_CellularAutomaton_internal_157 GOTO label_TRUE_370 + lw $t0, -632($fp) + beq $t0, 0, label_TRUE_370 + # GOTO label_FALSE_369 + j label_FALSE_369 + label_COMPARE_STRING_372: + # LOCAL local_option_at_CellularAutomaton_internal_157 --> -632($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_158 --> -636($fp) + # Load strings for comparison + lw $v0, -4($fp) + lw $v1, -636($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -632($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_157 GOTO label_CONTINUE_374 + # IF_ZERO local_option_at_CellularAutomaton_internal_157 GOTO label_CONTINUE_374 + lw $t0, -632($fp) + beq $t0, 0, label_CONTINUE_374 + # GOTO label_FALSE_369 + j label_FALSE_369 + label_CONTINUE_374: + # LOCAL local_option_at_CellularAutomaton_internal_157 --> -632($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_158 --> -636($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -4($fp) + lw $v1, -636($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_375: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_376 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_375 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_376: + # Store result + sw $a2, -632($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_157 GOTO label_TRUE_370 + # IF_ZERO local_option_at_CellularAutomaton_internal_157 GOTO label_TRUE_370 + lw $t0, -632($fp) + beq $t0, 0, label_TRUE_370 + label_FALSE_369: + # LOCAL local_option_at_CellularAutomaton_internal_156 --> -628($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -628($fp) + # GOTO label_END_371 +j label_END_371 +label_TRUE_370: + # LOCAL local_option_at_CellularAutomaton_internal_156 --> -628($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -628($fp) + label_END_371: +# LOCAL local_option_at_CellularAutomaton_internal_154 --> -620($fp) +# LOCAL local_option_at_CellularAutomaton_internal_156 --> -628($fp) +# Obtain value from -628($fp) +lw $v0, -628($fp) +lw $v0, 12($v0) +sw $v0, -620($fp) +# IF_ZERO local_option_at_CellularAutomaton_internal_154 GOTO label_FALSEIF_367 +# IF_ZERO local_option_at_CellularAutomaton_internal_154 GOTO label_FALSEIF_367 +lw $t0, -620($fp) +beq $t0, 0, label_FALSEIF_367 +# LOCAL local_option_at_CellularAutomaton_internal_159 --> -640($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_67 +sw $t0, 12($v0) +li $t0, 15 +sw $t0, 16($v0) +sw $v0, -640($fp) +# LOCAL local_option_at_CellularAutomaton_internal_155 --> -624($fp) +# LOCAL local_option_at_CellularAutomaton_internal_159 --> -640($fp) +# local_option_at_CellularAutomaton_internal_155 = local_option_at_CellularAutomaton_internal_159 +lw $t0, -640($fp) +sw $t0, -624($fp) +# GOTO label_ENDIF_368 +j label_ENDIF_368 +label_FALSEIF_367: + # LOCAL local_option_at_CellularAutomaton_internal_164 --> -660($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 11 + sw $t0, 12($v0) + sw $v0, -660($fp) + # IF_ZERO local_option_at_CellularAutomaton_num_0 GOTO label_FALSE_379 + # IF_ZERO local_option_at_CellularAutomaton_num_0 GOTO label_FALSE_379 + lw $t0, -4($fp) + beq $t0, 0, label_FALSE_379 + # IF_ZERO local_option_at_CellularAutomaton_internal_164 GOTO label_FALSE_379 + # IF_ZERO local_option_at_CellularAutomaton_internal_164 GOTO label_FALSE_379 + lw $t0, -660($fp) + beq $t0, 0, label_FALSE_379 + # LOCAL local_option_at_CellularAutomaton_internal_163 --> -656($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Comparing -4($fp) type with String + la $v0, String + lw $a0, -4($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -656($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_163 GOTO label_COMPARE_STRING_382 + # IF_ZERO local_option_at_CellularAutomaton_internal_163 GOTO label_COMPARE_STRING_382 + lw $t0, -656($fp) + beq $t0, 0, label_COMPARE_STRING_382 + # LOCAL local_option_at_CellularAutomaton_internal_163 --> -656($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Comparing -4($fp) type with Bool + la $v0, Bool + lw $a0, -4($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -656($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_163 GOTO label_COMPARE_BY_VALUE_383 + # IF_ZERO local_option_at_CellularAutomaton_internal_163 GOTO label_COMPARE_BY_VALUE_383 + lw $t0, -656($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_383 + # LOCAL local_option_at_CellularAutomaton_internal_163 --> -656($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Comparing -4($fp) type with Int + la $v0, Int + lw $a0, -4($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -656($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_163 GOTO label_COMPARE_BY_VALUE_383 + # IF_ZERO local_option_at_CellularAutomaton_internal_163 GOTO label_COMPARE_BY_VALUE_383 + lw $t0, -656($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_383 + # LOCAL local_option_at_CellularAutomaton_internal_163 --> -656($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_164 --> -660($fp) + # Load pointers and SUB + lw $a0, -4($fp) + lw $a1, -660($fp) + sub $a0, $a0, $a1 + sw $a0, -656($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_163 GOTO label_TRUE_380 + # IF_ZERO local_option_at_CellularAutomaton_internal_163 GOTO label_TRUE_380 + lw $t0, -656($fp) + beq $t0, 0, label_TRUE_380 + # GOTO label_FALSE_379 + j label_FALSE_379 + label_COMPARE_BY_VALUE_383: + # LOCAL local_option_at_CellularAutomaton_internal_163 --> -656($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_164 --> -660($fp) + lw $a0, -4($fp) + lw $a1, -660($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -656($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_163 GOTO label_TRUE_380 + # IF_ZERO local_option_at_CellularAutomaton_internal_163 GOTO label_TRUE_380 + lw $t0, -656($fp) + beq $t0, 0, label_TRUE_380 + # GOTO label_FALSE_379 + j label_FALSE_379 + label_COMPARE_STRING_382: + # LOCAL local_option_at_CellularAutomaton_internal_163 --> -656($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_164 --> -660($fp) + # Load strings for comparison + lw $v0, -4($fp) + lw $v1, -660($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -656($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_163 GOTO label_CONTINUE_384 + # IF_ZERO local_option_at_CellularAutomaton_internal_163 GOTO label_CONTINUE_384 + lw $t0, -656($fp) + beq $t0, 0, label_CONTINUE_384 + # GOTO label_FALSE_379 + j label_FALSE_379 + label_CONTINUE_384: + # LOCAL local_option_at_CellularAutomaton_internal_163 --> -656($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_164 --> -660($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -4($fp) + lw $v1, -660($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_385: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_386 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_385 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_386: + # Store result + sw $a2, -656($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_163 GOTO label_TRUE_380 + # IF_ZERO local_option_at_CellularAutomaton_internal_163 GOTO label_TRUE_380 + lw $t0, -656($fp) + beq $t0, 0, label_TRUE_380 + label_FALSE_379: + # LOCAL local_option_at_CellularAutomaton_internal_162 --> -652($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -652($fp) + # GOTO label_END_381 +j label_END_381 +label_TRUE_380: + # LOCAL local_option_at_CellularAutomaton_internal_162 --> -652($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -652($fp) + label_END_381: +# LOCAL local_option_at_CellularAutomaton_internal_160 --> -644($fp) +# LOCAL local_option_at_CellularAutomaton_internal_162 --> -652($fp) +# Obtain value from -652($fp) +lw $v0, -652($fp) +lw $v0, 12($v0) +sw $v0, -644($fp) +# IF_ZERO local_option_at_CellularAutomaton_internal_160 GOTO label_FALSEIF_377 +# IF_ZERO local_option_at_CellularAutomaton_internal_160 GOTO label_FALSEIF_377 +lw $t0, -644($fp) +beq $t0, 0, label_FALSEIF_377 +# LOCAL local_option_at_CellularAutomaton_internal_165 --> -664($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_68 +sw $t0, 12($v0) +li $t0, 15 +sw $t0, 16($v0) +sw $v0, -664($fp) +# LOCAL local_option_at_CellularAutomaton_internal_161 --> -648($fp) +# LOCAL local_option_at_CellularAutomaton_internal_165 --> -664($fp) +# local_option_at_CellularAutomaton_internal_161 = local_option_at_CellularAutomaton_internal_165 +lw $t0, -664($fp) +sw $t0, -648($fp) +# GOTO label_ENDIF_378 +j label_ENDIF_378 +label_FALSEIF_377: + # LOCAL local_option_at_CellularAutomaton_internal_170 --> -684($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 12 + sw $t0, 12($v0) + sw $v0, -684($fp) + # IF_ZERO local_option_at_CellularAutomaton_num_0 GOTO label_FALSE_389 + # IF_ZERO local_option_at_CellularAutomaton_num_0 GOTO label_FALSE_389 + lw $t0, -4($fp) + beq $t0, 0, label_FALSE_389 + # IF_ZERO local_option_at_CellularAutomaton_internal_170 GOTO label_FALSE_389 + # IF_ZERO local_option_at_CellularAutomaton_internal_170 GOTO label_FALSE_389 + lw $t0, -684($fp) + beq $t0, 0, label_FALSE_389 + # LOCAL local_option_at_CellularAutomaton_internal_169 --> -680($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Comparing -4($fp) type with String + la $v0, String + lw $a0, -4($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -680($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_169 GOTO label_COMPARE_STRING_392 + # IF_ZERO local_option_at_CellularAutomaton_internal_169 GOTO label_COMPARE_STRING_392 + lw $t0, -680($fp) + beq $t0, 0, label_COMPARE_STRING_392 + # LOCAL local_option_at_CellularAutomaton_internal_169 --> -680($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Comparing -4($fp) type with Bool + la $v0, Bool + lw $a0, -4($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -680($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_169 GOTO label_COMPARE_BY_VALUE_393 + # IF_ZERO local_option_at_CellularAutomaton_internal_169 GOTO label_COMPARE_BY_VALUE_393 + lw $t0, -680($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_393 + # LOCAL local_option_at_CellularAutomaton_internal_169 --> -680($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Comparing -4($fp) type with Int + la $v0, Int + lw $a0, -4($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -680($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_169 GOTO label_COMPARE_BY_VALUE_393 + # IF_ZERO local_option_at_CellularAutomaton_internal_169 GOTO label_COMPARE_BY_VALUE_393 + lw $t0, -680($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_393 + # LOCAL local_option_at_CellularAutomaton_internal_169 --> -680($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_170 --> -684($fp) + # Load pointers and SUB + lw $a0, -4($fp) + lw $a1, -684($fp) + sub $a0, $a0, $a1 + sw $a0, -680($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_169 GOTO label_TRUE_390 + # IF_ZERO local_option_at_CellularAutomaton_internal_169 GOTO label_TRUE_390 + lw $t0, -680($fp) + beq $t0, 0, label_TRUE_390 + # GOTO label_FALSE_389 + j label_FALSE_389 + label_COMPARE_BY_VALUE_393: + # LOCAL local_option_at_CellularAutomaton_internal_169 --> -680($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_170 --> -684($fp) + lw $a0, -4($fp) + lw $a1, -684($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -680($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_169 GOTO label_TRUE_390 + # IF_ZERO local_option_at_CellularAutomaton_internal_169 GOTO label_TRUE_390 + lw $t0, -680($fp) + beq $t0, 0, label_TRUE_390 + # GOTO label_FALSE_389 + j label_FALSE_389 + label_COMPARE_STRING_392: + # LOCAL local_option_at_CellularAutomaton_internal_169 --> -680($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_170 --> -684($fp) + # Load strings for comparison + lw $v0, -4($fp) + lw $v1, -684($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -680($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_169 GOTO label_CONTINUE_394 + # IF_ZERO local_option_at_CellularAutomaton_internal_169 GOTO label_CONTINUE_394 + lw $t0, -680($fp) + beq $t0, 0, label_CONTINUE_394 + # GOTO label_FALSE_389 + j label_FALSE_389 + label_CONTINUE_394: + # LOCAL local_option_at_CellularAutomaton_internal_169 --> -680($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_170 --> -684($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -4($fp) + lw $v1, -684($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_395: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_396 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_395 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_396: + # Store result + sw $a2, -680($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_169 GOTO label_TRUE_390 + # IF_ZERO local_option_at_CellularAutomaton_internal_169 GOTO label_TRUE_390 + lw $t0, -680($fp) + beq $t0, 0, label_TRUE_390 + label_FALSE_389: + # LOCAL local_option_at_CellularAutomaton_internal_168 --> -676($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -676($fp) + # GOTO label_END_391 +j label_END_391 +label_TRUE_390: + # LOCAL local_option_at_CellularAutomaton_internal_168 --> -676($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -676($fp) + label_END_391: +# LOCAL local_option_at_CellularAutomaton_internal_166 --> -668($fp) +# LOCAL local_option_at_CellularAutomaton_internal_168 --> -676($fp) +# Obtain value from -676($fp) +lw $v0, -676($fp) +lw $v0, 12($v0) +sw $v0, -668($fp) +# IF_ZERO local_option_at_CellularAutomaton_internal_166 GOTO label_FALSEIF_387 +# IF_ZERO local_option_at_CellularAutomaton_internal_166 GOTO label_FALSEIF_387 +lw $t0, -668($fp) +beq $t0, 0, label_FALSEIF_387 +# LOCAL local_option_at_CellularAutomaton_internal_171 --> -688($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_69 +sw $t0, 12($v0) +li $t0, 25 +sw $t0, 16($v0) +sw $v0, -688($fp) +# LOCAL local_option_at_CellularAutomaton_internal_167 --> -672($fp) +# LOCAL local_option_at_CellularAutomaton_internal_171 --> -688($fp) +# local_option_at_CellularAutomaton_internal_167 = local_option_at_CellularAutomaton_internal_171 +lw $t0, -688($fp) +sw $t0, -672($fp) +# GOTO label_ENDIF_388 +j label_ENDIF_388 +label_FALSEIF_387: + # LOCAL local_option_at_CellularAutomaton_internal_176 --> -708($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 13 + sw $t0, 12($v0) + sw $v0, -708($fp) + # IF_ZERO local_option_at_CellularAutomaton_num_0 GOTO label_FALSE_399 + # IF_ZERO local_option_at_CellularAutomaton_num_0 GOTO label_FALSE_399 + lw $t0, -4($fp) + beq $t0, 0, label_FALSE_399 + # IF_ZERO local_option_at_CellularAutomaton_internal_176 GOTO label_FALSE_399 + # IF_ZERO local_option_at_CellularAutomaton_internal_176 GOTO label_FALSE_399 + lw $t0, -708($fp) + beq $t0, 0, label_FALSE_399 + # LOCAL local_option_at_CellularAutomaton_internal_175 --> -704($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Comparing -4($fp) type with String + la $v0, String + lw $a0, -4($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -704($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_175 GOTO label_COMPARE_STRING_402 + # IF_ZERO local_option_at_CellularAutomaton_internal_175 GOTO label_COMPARE_STRING_402 + lw $t0, -704($fp) + beq $t0, 0, label_COMPARE_STRING_402 + # LOCAL local_option_at_CellularAutomaton_internal_175 --> -704($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Comparing -4($fp) type with Bool + la $v0, Bool + lw $a0, -4($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -704($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_175 GOTO label_COMPARE_BY_VALUE_403 + # IF_ZERO local_option_at_CellularAutomaton_internal_175 GOTO label_COMPARE_BY_VALUE_403 + lw $t0, -704($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_403 + # LOCAL local_option_at_CellularAutomaton_internal_175 --> -704($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Comparing -4($fp) type with Int + la $v0, Int + lw $a0, -4($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -704($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_175 GOTO label_COMPARE_BY_VALUE_403 + # IF_ZERO local_option_at_CellularAutomaton_internal_175 GOTO label_COMPARE_BY_VALUE_403 + lw $t0, -704($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_403 + # LOCAL local_option_at_CellularAutomaton_internal_175 --> -704($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_176 --> -708($fp) + # Load pointers and SUB + lw $a0, -4($fp) + lw $a1, -708($fp) + sub $a0, $a0, $a1 + sw $a0, -704($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_175 GOTO label_TRUE_400 + # IF_ZERO local_option_at_CellularAutomaton_internal_175 GOTO label_TRUE_400 + lw $t0, -704($fp) + beq $t0, 0, label_TRUE_400 + # GOTO label_FALSE_399 + j label_FALSE_399 + label_COMPARE_BY_VALUE_403: + # LOCAL local_option_at_CellularAutomaton_internal_175 --> -704($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_176 --> -708($fp) + lw $a0, -4($fp) + lw $a1, -708($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -704($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_175 GOTO label_TRUE_400 + # IF_ZERO local_option_at_CellularAutomaton_internal_175 GOTO label_TRUE_400 + lw $t0, -704($fp) + beq $t0, 0, label_TRUE_400 + # GOTO label_FALSE_399 + j label_FALSE_399 + label_COMPARE_STRING_402: + # LOCAL local_option_at_CellularAutomaton_internal_175 --> -704($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_176 --> -708($fp) + # Load strings for comparison + lw $v0, -4($fp) + lw $v1, -708($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -704($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_175 GOTO label_CONTINUE_404 + # IF_ZERO local_option_at_CellularAutomaton_internal_175 GOTO label_CONTINUE_404 + lw $t0, -704($fp) + beq $t0, 0, label_CONTINUE_404 + # GOTO label_FALSE_399 + j label_FALSE_399 + label_CONTINUE_404: + # LOCAL local_option_at_CellularAutomaton_internal_175 --> -704($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_176 --> -708($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -4($fp) + lw $v1, -708($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_405: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_406 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_405 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_406: + # Store result + sw $a2, -704($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_175 GOTO label_TRUE_400 + # IF_ZERO local_option_at_CellularAutomaton_internal_175 GOTO label_TRUE_400 + lw $t0, -704($fp) + beq $t0, 0, label_TRUE_400 + label_FALSE_399: + # LOCAL local_option_at_CellularAutomaton_internal_174 --> -700($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -700($fp) + # GOTO label_END_401 +j label_END_401 +label_TRUE_400: + # LOCAL local_option_at_CellularAutomaton_internal_174 --> -700($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -700($fp) + label_END_401: +# LOCAL local_option_at_CellularAutomaton_internal_172 --> -692($fp) +# LOCAL local_option_at_CellularAutomaton_internal_174 --> -700($fp) +# Obtain value from -700($fp) +lw $v0, -700($fp) +lw $v0, 12($v0) +sw $v0, -692($fp) +# IF_ZERO local_option_at_CellularAutomaton_internal_172 GOTO label_FALSEIF_397 +# IF_ZERO local_option_at_CellularAutomaton_internal_172 GOTO label_FALSEIF_397 +lw $t0, -692($fp) +beq $t0, 0, label_FALSEIF_397 +# LOCAL local_option_at_CellularAutomaton_internal_177 --> -712($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_70 +sw $t0, 12($v0) +li $t0, 25 +sw $t0, 16($v0) +sw $v0, -712($fp) +# LOCAL local_option_at_CellularAutomaton_internal_173 --> -696($fp) +# LOCAL local_option_at_CellularAutomaton_internal_177 --> -712($fp) +# local_option_at_CellularAutomaton_internal_173 = local_option_at_CellularAutomaton_internal_177 +lw $t0, -712($fp) +sw $t0, -696($fp) +# GOTO label_ENDIF_398 +j label_ENDIF_398 +label_FALSEIF_397: + # LOCAL local_option_at_CellularAutomaton_internal_182 --> -732($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 14 + sw $t0, 12($v0) + sw $v0, -732($fp) + # IF_ZERO local_option_at_CellularAutomaton_num_0 GOTO label_FALSE_409 + # IF_ZERO local_option_at_CellularAutomaton_num_0 GOTO label_FALSE_409 + lw $t0, -4($fp) + beq $t0, 0, label_FALSE_409 + # IF_ZERO local_option_at_CellularAutomaton_internal_182 GOTO label_FALSE_409 + # IF_ZERO local_option_at_CellularAutomaton_internal_182 GOTO label_FALSE_409 + lw $t0, -732($fp) + beq $t0, 0, label_FALSE_409 + # LOCAL local_option_at_CellularAutomaton_internal_181 --> -728($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Comparing -4($fp) type with String + la $v0, String + lw $a0, -4($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -728($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_181 GOTO label_COMPARE_STRING_412 + # IF_ZERO local_option_at_CellularAutomaton_internal_181 GOTO label_COMPARE_STRING_412 + lw $t0, -728($fp) + beq $t0, 0, label_COMPARE_STRING_412 + # LOCAL local_option_at_CellularAutomaton_internal_181 --> -728($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Comparing -4($fp) type with Bool + la $v0, Bool + lw $a0, -4($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -728($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_181 GOTO label_COMPARE_BY_VALUE_413 + # IF_ZERO local_option_at_CellularAutomaton_internal_181 GOTO label_COMPARE_BY_VALUE_413 + lw $t0, -728($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_413 + # LOCAL local_option_at_CellularAutomaton_internal_181 --> -728($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Comparing -4($fp) type with Int + la $v0, Int + lw $a0, -4($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -728($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_181 GOTO label_COMPARE_BY_VALUE_413 + # IF_ZERO local_option_at_CellularAutomaton_internal_181 GOTO label_COMPARE_BY_VALUE_413 + lw $t0, -728($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_413 + # LOCAL local_option_at_CellularAutomaton_internal_181 --> -728($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_182 --> -732($fp) + # Load pointers and SUB + lw $a0, -4($fp) + lw $a1, -732($fp) + sub $a0, $a0, $a1 + sw $a0, -728($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_181 GOTO label_TRUE_410 + # IF_ZERO local_option_at_CellularAutomaton_internal_181 GOTO label_TRUE_410 + lw $t0, -728($fp) + beq $t0, 0, label_TRUE_410 + # GOTO label_FALSE_409 + j label_FALSE_409 + label_COMPARE_BY_VALUE_413: + # LOCAL local_option_at_CellularAutomaton_internal_181 --> -728($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_182 --> -732($fp) + lw $a0, -4($fp) + lw $a1, -732($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -728($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_181 GOTO label_TRUE_410 + # IF_ZERO local_option_at_CellularAutomaton_internal_181 GOTO label_TRUE_410 + lw $t0, -728($fp) + beq $t0, 0, label_TRUE_410 + # GOTO label_FALSE_409 + j label_FALSE_409 + label_COMPARE_STRING_412: + # LOCAL local_option_at_CellularAutomaton_internal_181 --> -728($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_182 --> -732($fp) + # Load strings for comparison + lw $v0, -4($fp) + lw $v1, -732($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -728($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_181 GOTO label_CONTINUE_414 + # IF_ZERO local_option_at_CellularAutomaton_internal_181 GOTO label_CONTINUE_414 + lw $t0, -728($fp) + beq $t0, 0, label_CONTINUE_414 + # GOTO label_FALSE_409 + j label_FALSE_409 + label_CONTINUE_414: + # LOCAL local_option_at_CellularAutomaton_internal_181 --> -728($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_182 --> -732($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -4($fp) + lw $v1, -732($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_415: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_416 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_415 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_416: + # Store result + sw $a2, -728($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_181 GOTO label_TRUE_410 + # IF_ZERO local_option_at_CellularAutomaton_internal_181 GOTO label_TRUE_410 + lw $t0, -728($fp) + beq $t0, 0, label_TRUE_410 + label_FALSE_409: + # LOCAL local_option_at_CellularAutomaton_internal_180 --> -724($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -724($fp) + # GOTO label_END_411 +j label_END_411 +label_TRUE_410: + # LOCAL local_option_at_CellularAutomaton_internal_180 --> -724($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -724($fp) + label_END_411: +# LOCAL local_option_at_CellularAutomaton_internal_178 --> -716($fp) +# LOCAL local_option_at_CellularAutomaton_internal_180 --> -724($fp) +# Obtain value from -724($fp) +lw $v0, -724($fp) +lw $v0, 12($v0) +sw $v0, -716($fp) +# IF_ZERO local_option_at_CellularAutomaton_internal_178 GOTO label_FALSEIF_407 +# IF_ZERO local_option_at_CellularAutomaton_internal_178 GOTO label_FALSEIF_407 +lw $t0, -716($fp) +beq $t0, 0, label_FALSEIF_407 +# LOCAL local_option_at_CellularAutomaton_internal_183 --> -736($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_71 +sw $t0, 12($v0) +li $t0, 25 +sw $t0, 16($v0) +sw $v0, -736($fp) +# LOCAL local_option_at_CellularAutomaton_internal_179 --> -720($fp) +# LOCAL local_option_at_CellularAutomaton_internal_183 --> -736($fp) +# local_option_at_CellularAutomaton_internal_179 = local_option_at_CellularAutomaton_internal_183 +lw $t0, -736($fp) +sw $t0, -720($fp) +# GOTO label_ENDIF_408 +j label_ENDIF_408 +label_FALSEIF_407: + # LOCAL local_option_at_CellularAutomaton_internal_188 --> -756($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 15 + sw $t0, 12($v0) + sw $v0, -756($fp) + # IF_ZERO local_option_at_CellularAutomaton_num_0 GOTO label_FALSE_419 + # IF_ZERO local_option_at_CellularAutomaton_num_0 GOTO label_FALSE_419 + lw $t0, -4($fp) + beq $t0, 0, label_FALSE_419 + # IF_ZERO local_option_at_CellularAutomaton_internal_188 GOTO label_FALSE_419 + # IF_ZERO local_option_at_CellularAutomaton_internal_188 GOTO label_FALSE_419 + lw $t0, -756($fp) + beq $t0, 0, label_FALSE_419 + # LOCAL local_option_at_CellularAutomaton_internal_187 --> -752($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Comparing -4($fp) type with String + la $v0, String + lw $a0, -4($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -752($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_187 GOTO label_COMPARE_STRING_422 + # IF_ZERO local_option_at_CellularAutomaton_internal_187 GOTO label_COMPARE_STRING_422 + lw $t0, -752($fp) + beq $t0, 0, label_COMPARE_STRING_422 + # LOCAL local_option_at_CellularAutomaton_internal_187 --> -752($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Comparing -4($fp) type with Bool + la $v0, Bool + lw $a0, -4($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -752($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_187 GOTO label_COMPARE_BY_VALUE_423 + # IF_ZERO local_option_at_CellularAutomaton_internal_187 GOTO label_COMPARE_BY_VALUE_423 + lw $t0, -752($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_423 + # LOCAL local_option_at_CellularAutomaton_internal_187 --> -752($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Comparing -4($fp) type with Int + la $v0, Int + lw $a0, -4($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -752($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_187 GOTO label_COMPARE_BY_VALUE_423 + # IF_ZERO local_option_at_CellularAutomaton_internal_187 GOTO label_COMPARE_BY_VALUE_423 + lw $t0, -752($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_423 + # LOCAL local_option_at_CellularAutomaton_internal_187 --> -752($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_188 --> -756($fp) + # Load pointers and SUB + lw $a0, -4($fp) + lw $a1, -756($fp) + sub $a0, $a0, $a1 + sw $a0, -752($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_187 GOTO label_TRUE_420 + # IF_ZERO local_option_at_CellularAutomaton_internal_187 GOTO label_TRUE_420 + lw $t0, -752($fp) + beq $t0, 0, label_TRUE_420 + # GOTO label_FALSE_419 + j label_FALSE_419 + label_COMPARE_BY_VALUE_423: + # LOCAL local_option_at_CellularAutomaton_internal_187 --> -752($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_188 --> -756($fp) + lw $a0, -4($fp) + lw $a1, -756($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -752($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_187 GOTO label_TRUE_420 + # IF_ZERO local_option_at_CellularAutomaton_internal_187 GOTO label_TRUE_420 + lw $t0, -752($fp) + beq $t0, 0, label_TRUE_420 + # GOTO label_FALSE_419 + j label_FALSE_419 + label_COMPARE_STRING_422: + # LOCAL local_option_at_CellularAutomaton_internal_187 --> -752($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_188 --> -756($fp) + # Load strings for comparison + lw $v0, -4($fp) + lw $v1, -756($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -752($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_187 GOTO label_CONTINUE_424 + # IF_ZERO local_option_at_CellularAutomaton_internal_187 GOTO label_CONTINUE_424 + lw $t0, -752($fp) + beq $t0, 0, label_CONTINUE_424 + # GOTO label_FALSE_419 + j label_FALSE_419 + label_CONTINUE_424: + # LOCAL local_option_at_CellularAutomaton_internal_187 --> -752($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_188 --> -756($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -4($fp) + lw $v1, -756($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_425: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_426 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_425 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_426: + # Store result + sw $a2, -752($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_187 GOTO label_TRUE_420 + # IF_ZERO local_option_at_CellularAutomaton_internal_187 GOTO label_TRUE_420 + lw $t0, -752($fp) + beq $t0, 0, label_TRUE_420 + label_FALSE_419: + # LOCAL local_option_at_CellularAutomaton_internal_186 --> -748($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -748($fp) + # GOTO label_END_421 +j label_END_421 +label_TRUE_420: + # LOCAL local_option_at_CellularAutomaton_internal_186 --> -748($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -748($fp) + label_END_421: +# LOCAL local_option_at_CellularAutomaton_internal_184 --> -740($fp) +# LOCAL local_option_at_CellularAutomaton_internal_186 --> -748($fp) +# Obtain value from -748($fp) +lw $v0, -748($fp) +lw $v0, 12($v0) +sw $v0, -740($fp) +# IF_ZERO local_option_at_CellularAutomaton_internal_184 GOTO label_FALSEIF_417 +# IF_ZERO local_option_at_CellularAutomaton_internal_184 GOTO label_FALSEIF_417 +lw $t0, -740($fp) +beq $t0, 0, label_FALSEIF_417 +# LOCAL local_option_at_CellularAutomaton_internal_189 --> -760($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_72 +sw $t0, 12($v0) +li $t0, 21 +sw $t0, 16($v0) +sw $v0, -760($fp) +# LOCAL local_option_at_CellularAutomaton_internal_185 --> -744($fp) +# LOCAL local_option_at_CellularAutomaton_internal_189 --> -760($fp) +# local_option_at_CellularAutomaton_internal_185 = local_option_at_CellularAutomaton_internal_189 +lw $t0, -760($fp) +sw $t0, -744($fp) +# GOTO label_ENDIF_418 +j label_ENDIF_418 +label_FALSEIF_417: + # LOCAL local_option_at_CellularAutomaton_internal_194 --> -780($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 16 + sw $t0, 12($v0) + sw $v0, -780($fp) + # IF_ZERO local_option_at_CellularAutomaton_num_0 GOTO label_FALSE_429 + # IF_ZERO local_option_at_CellularAutomaton_num_0 GOTO label_FALSE_429 + lw $t0, -4($fp) + beq $t0, 0, label_FALSE_429 + # IF_ZERO local_option_at_CellularAutomaton_internal_194 GOTO label_FALSE_429 + # IF_ZERO local_option_at_CellularAutomaton_internal_194 GOTO label_FALSE_429 + lw $t0, -780($fp) + beq $t0, 0, label_FALSE_429 + # LOCAL local_option_at_CellularAutomaton_internal_193 --> -776($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Comparing -4($fp) type with String + la $v0, String + lw $a0, -4($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -776($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_193 GOTO label_COMPARE_STRING_432 + # IF_ZERO local_option_at_CellularAutomaton_internal_193 GOTO label_COMPARE_STRING_432 + lw $t0, -776($fp) + beq $t0, 0, label_COMPARE_STRING_432 + # LOCAL local_option_at_CellularAutomaton_internal_193 --> -776($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Comparing -4($fp) type with Bool + la $v0, Bool + lw $a0, -4($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -776($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_193 GOTO label_COMPARE_BY_VALUE_433 + # IF_ZERO local_option_at_CellularAutomaton_internal_193 GOTO label_COMPARE_BY_VALUE_433 + lw $t0, -776($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_433 + # LOCAL local_option_at_CellularAutomaton_internal_193 --> -776($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Comparing -4($fp) type with Int + la $v0, Int + lw $a0, -4($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -776($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_193 GOTO label_COMPARE_BY_VALUE_433 + # IF_ZERO local_option_at_CellularAutomaton_internal_193 GOTO label_COMPARE_BY_VALUE_433 + lw $t0, -776($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_433 + # LOCAL local_option_at_CellularAutomaton_internal_193 --> -776($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_194 --> -780($fp) + # Load pointers and SUB + lw $a0, -4($fp) + lw $a1, -780($fp) + sub $a0, $a0, $a1 + sw $a0, -776($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_193 GOTO label_TRUE_430 + # IF_ZERO local_option_at_CellularAutomaton_internal_193 GOTO label_TRUE_430 + lw $t0, -776($fp) + beq $t0, 0, label_TRUE_430 + # GOTO label_FALSE_429 + j label_FALSE_429 + label_COMPARE_BY_VALUE_433: + # LOCAL local_option_at_CellularAutomaton_internal_193 --> -776($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_194 --> -780($fp) + lw $a0, -4($fp) + lw $a1, -780($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -776($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_193 GOTO label_TRUE_430 + # IF_ZERO local_option_at_CellularAutomaton_internal_193 GOTO label_TRUE_430 + lw $t0, -776($fp) + beq $t0, 0, label_TRUE_430 + # GOTO label_FALSE_429 + j label_FALSE_429 + label_COMPARE_STRING_432: + # LOCAL local_option_at_CellularAutomaton_internal_193 --> -776($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_194 --> -780($fp) + # Load strings for comparison + lw $v0, -4($fp) + lw $v1, -780($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -776($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_193 GOTO label_CONTINUE_434 + # IF_ZERO local_option_at_CellularAutomaton_internal_193 GOTO label_CONTINUE_434 + lw $t0, -776($fp) + beq $t0, 0, label_CONTINUE_434 + # GOTO label_FALSE_429 + j label_FALSE_429 + label_CONTINUE_434: + # LOCAL local_option_at_CellularAutomaton_internal_193 --> -776($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_194 --> -780($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -4($fp) + lw $v1, -780($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_435: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_436 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_435 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_436: + # Store result + sw $a2, -776($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_193 GOTO label_TRUE_430 + # IF_ZERO local_option_at_CellularAutomaton_internal_193 GOTO label_TRUE_430 + lw $t0, -776($fp) + beq $t0, 0, label_TRUE_430 + label_FALSE_429: + # LOCAL local_option_at_CellularAutomaton_internal_192 --> -772($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -772($fp) + # GOTO label_END_431 +j label_END_431 +label_TRUE_430: + # LOCAL local_option_at_CellularAutomaton_internal_192 --> -772($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -772($fp) + label_END_431: +# LOCAL local_option_at_CellularAutomaton_internal_190 --> -764($fp) +# LOCAL local_option_at_CellularAutomaton_internal_192 --> -772($fp) +# Obtain value from -772($fp) +lw $v0, -772($fp) +lw $v0, 12($v0) +sw $v0, -764($fp) +# IF_ZERO local_option_at_CellularAutomaton_internal_190 GOTO label_FALSEIF_427 +# IF_ZERO local_option_at_CellularAutomaton_internal_190 GOTO label_FALSEIF_427 +lw $t0, -764($fp) +beq $t0, 0, label_FALSEIF_427 +# LOCAL local_option_at_CellularAutomaton_internal_195 --> -784($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_73 +sw $t0, 12($v0) +li $t0, 21 +sw $t0, 16($v0) +sw $v0, -784($fp) +# LOCAL local_option_at_CellularAutomaton_internal_191 --> -768($fp) +# LOCAL local_option_at_CellularAutomaton_internal_195 --> -784($fp) +# local_option_at_CellularAutomaton_internal_191 = local_option_at_CellularAutomaton_internal_195 +lw $t0, -784($fp) +sw $t0, -768($fp) +# GOTO label_ENDIF_428 +j label_ENDIF_428 +label_FALSEIF_427: + # LOCAL local_option_at_CellularAutomaton_internal_200 --> -804($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 17 + sw $t0, 12($v0) + sw $v0, -804($fp) + # IF_ZERO local_option_at_CellularAutomaton_num_0 GOTO label_FALSE_439 + # IF_ZERO local_option_at_CellularAutomaton_num_0 GOTO label_FALSE_439 + lw $t0, -4($fp) + beq $t0, 0, label_FALSE_439 + # IF_ZERO local_option_at_CellularAutomaton_internal_200 GOTO label_FALSE_439 + # IF_ZERO local_option_at_CellularAutomaton_internal_200 GOTO label_FALSE_439 + lw $t0, -804($fp) + beq $t0, 0, label_FALSE_439 + # LOCAL local_option_at_CellularAutomaton_internal_199 --> -800($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Comparing -4($fp) type with String + la $v0, String + lw $a0, -4($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -800($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_199 GOTO label_COMPARE_STRING_442 + # IF_ZERO local_option_at_CellularAutomaton_internal_199 GOTO label_COMPARE_STRING_442 + lw $t0, -800($fp) + beq $t0, 0, label_COMPARE_STRING_442 + # LOCAL local_option_at_CellularAutomaton_internal_199 --> -800($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Comparing -4($fp) type with Bool + la $v0, Bool + lw $a0, -4($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -800($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_199 GOTO label_COMPARE_BY_VALUE_443 + # IF_ZERO local_option_at_CellularAutomaton_internal_199 GOTO label_COMPARE_BY_VALUE_443 + lw $t0, -800($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_443 + # LOCAL local_option_at_CellularAutomaton_internal_199 --> -800($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Comparing -4($fp) type with Int + la $v0, Int + lw $a0, -4($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -800($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_199 GOTO label_COMPARE_BY_VALUE_443 + # IF_ZERO local_option_at_CellularAutomaton_internal_199 GOTO label_COMPARE_BY_VALUE_443 + lw $t0, -800($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_443 + # LOCAL local_option_at_CellularAutomaton_internal_199 --> -800($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_200 --> -804($fp) + # Load pointers and SUB + lw $a0, -4($fp) + lw $a1, -804($fp) + sub $a0, $a0, $a1 + sw $a0, -800($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_199 GOTO label_TRUE_440 + # IF_ZERO local_option_at_CellularAutomaton_internal_199 GOTO label_TRUE_440 + lw $t0, -800($fp) + beq $t0, 0, label_TRUE_440 + # GOTO label_FALSE_439 + j label_FALSE_439 + label_COMPARE_BY_VALUE_443: + # LOCAL local_option_at_CellularAutomaton_internal_199 --> -800($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_200 --> -804($fp) + lw $a0, -4($fp) + lw $a1, -804($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -800($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_199 GOTO label_TRUE_440 + # IF_ZERO local_option_at_CellularAutomaton_internal_199 GOTO label_TRUE_440 + lw $t0, -800($fp) + beq $t0, 0, label_TRUE_440 + # GOTO label_FALSE_439 + j label_FALSE_439 + label_COMPARE_STRING_442: + # LOCAL local_option_at_CellularAutomaton_internal_199 --> -800($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_200 --> -804($fp) + # Load strings for comparison + lw $v0, -4($fp) + lw $v1, -804($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -800($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_199 GOTO label_CONTINUE_444 + # IF_ZERO local_option_at_CellularAutomaton_internal_199 GOTO label_CONTINUE_444 + lw $t0, -800($fp) + beq $t0, 0, label_CONTINUE_444 + # GOTO label_FALSE_439 + j label_FALSE_439 + label_CONTINUE_444: + # LOCAL local_option_at_CellularAutomaton_internal_199 --> -800($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_200 --> -804($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -4($fp) + lw $v1, -804($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_445: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_446 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_445 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_446: + # Store result + sw $a2, -800($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_199 GOTO label_TRUE_440 + # IF_ZERO local_option_at_CellularAutomaton_internal_199 GOTO label_TRUE_440 + lw $t0, -800($fp) + beq $t0, 0, label_TRUE_440 + label_FALSE_439: + # LOCAL local_option_at_CellularAutomaton_internal_198 --> -796($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -796($fp) + # GOTO label_END_441 +j label_END_441 +label_TRUE_440: + # LOCAL local_option_at_CellularAutomaton_internal_198 --> -796($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -796($fp) + label_END_441: +# LOCAL local_option_at_CellularAutomaton_internal_196 --> -788($fp) +# LOCAL local_option_at_CellularAutomaton_internal_198 --> -796($fp) +# Obtain value from -796($fp) +lw $v0, -796($fp) +lw $v0, 12($v0) +sw $v0, -788($fp) +# IF_ZERO local_option_at_CellularAutomaton_internal_196 GOTO label_FALSEIF_437 +# IF_ZERO local_option_at_CellularAutomaton_internal_196 GOTO label_FALSEIF_437 +lw $t0, -788($fp) +beq $t0, 0, label_FALSEIF_437 +# LOCAL local_option_at_CellularAutomaton_internal_201 --> -808($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_74 +sw $t0, 12($v0) +li $t0, 28 +sw $t0, 16($v0) +sw $v0, -808($fp) +# LOCAL local_option_at_CellularAutomaton_internal_197 --> -792($fp) +# LOCAL local_option_at_CellularAutomaton_internal_201 --> -808($fp) +# local_option_at_CellularAutomaton_internal_197 = local_option_at_CellularAutomaton_internal_201 +lw $t0, -808($fp) +sw $t0, -792($fp) +# GOTO label_ENDIF_438 +j label_ENDIF_438 +label_FALSEIF_437: + # LOCAL local_option_at_CellularAutomaton_internal_206 --> -828($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 18 + sw $t0, 12($v0) + sw $v0, -828($fp) + # IF_ZERO local_option_at_CellularAutomaton_num_0 GOTO label_FALSE_449 + # IF_ZERO local_option_at_CellularAutomaton_num_0 GOTO label_FALSE_449 + lw $t0, -4($fp) + beq $t0, 0, label_FALSE_449 + # IF_ZERO local_option_at_CellularAutomaton_internal_206 GOTO label_FALSE_449 + # IF_ZERO local_option_at_CellularAutomaton_internal_206 GOTO label_FALSE_449 + lw $t0, -828($fp) + beq $t0, 0, label_FALSE_449 + # LOCAL local_option_at_CellularAutomaton_internal_205 --> -824($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Comparing -4($fp) type with String + la $v0, String + lw $a0, -4($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -824($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_205 GOTO label_COMPARE_STRING_452 + # IF_ZERO local_option_at_CellularAutomaton_internal_205 GOTO label_COMPARE_STRING_452 + lw $t0, -824($fp) + beq $t0, 0, label_COMPARE_STRING_452 + # LOCAL local_option_at_CellularAutomaton_internal_205 --> -824($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Comparing -4($fp) type with Bool + la $v0, Bool + lw $a0, -4($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -824($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_205 GOTO label_COMPARE_BY_VALUE_453 + # IF_ZERO local_option_at_CellularAutomaton_internal_205 GOTO label_COMPARE_BY_VALUE_453 + lw $t0, -824($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_453 + # LOCAL local_option_at_CellularAutomaton_internal_205 --> -824($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Comparing -4($fp) type with Int + la $v0, Int + lw $a0, -4($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -824($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_205 GOTO label_COMPARE_BY_VALUE_453 + # IF_ZERO local_option_at_CellularAutomaton_internal_205 GOTO label_COMPARE_BY_VALUE_453 + lw $t0, -824($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_453 + # LOCAL local_option_at_CellularAutomaton_internal_205 --> -824($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_206 --> -828($fp) + # Load pointers and SUB + lw $a0, -4($fp) + lw $a1, -828($fp) + sub $a0, $a0, $a1 + sw $a0, -824($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_205 GOTO label_TRUE_450 + # IF_ZERO local_option_at_CellularAutomaton_internal_205 GOTO label_TRUE_450 + lw $t0, -824($fp) + beq $t0, 0, label_TRUE_450 + # GOTO label_FALSE_449 + j label_FALSE_449 + label_COMPARE_BY_VALUE_453: + # LOCAL local_option_at_CellularAutomaton_internal_205 --> -824($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_206 --> -828($fp) + lw $a0, -4($fp) + lw $a1, -828($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -824($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_205 GOTO label_TRUE_450 + # IF_ZERO local_option_at_CellularAutomaton_internal_205 GOTO label_TRUE_450 + lw $t0, -824($fp) + beq $t0, 0, label_TRUE_450 + # GOTO label_FALSE_449 + j label_FALSE_449 + label_COMPARE_STRING_452: + # LOCAL local_option_at_CellularAutomaton_internal_205 --> -824($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_206 --> -828($fp) + # Load strings for comparison + lw $v0, -4($fp) + lw $v1, -828($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -824($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_205 GOTO label_CONTINUE_454 + # IF_ZERO local_option_at_CellularAutomaton_internal_205 GOTO label_CONTINUE_454 + lw $t0, -824($fp) + beq $t0, 0, label_CONTINUE_454 + # GOTO label_FALSE_449 + j label_FALSE_449 + label_CONTINUE_454: + # LOCAL local_option_at_CellularAutomaton_internal_205 --> -824($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_206 --> -828($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -4($fp) + lw $v1, -828($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_455: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_456 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_455 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_456: + # Store result + sw $a2, -824($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_205 GOTO label_TRUE_450 + # IF_ZERO local_option_at_CellularAutomaton_internal_205 GOTO label_TRUE_450 + lw $t0, -824($fp) + beq $t0, 0, label_TRUE_450 + label_FALSE_449: + # LOCAL local_option_at_CellularAutomaton_internal_204 --> -820($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -820($fp) + # GOTO label_END_451 +j label_END_451 +label_TRUE_450: + # LOCAL local_option_at_CellularAutomaton_internal_204 --> -820($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -820($fp) + label_END_451: +# LOCAL local_option_at_CellularAutomaton_internal_202 --> -812($fp) +# LOCAL local_option_at_CellularAutomaton_internal_204 --> -820($fp) +# Obtain value from -820($fp) +lw $v0, -820($fp) +lw $v0, 12($v0) +sw $v0, -812($fp) +# IF_ZERO local_option_at_CellularAutomaton_internal_202 GOTO label_FALSEIF_447 +# IF_ZERO local_option_at_CellularAutomaton_internal_202 GOTO label_FALSEIF_447 +lw $t0, -812($fp) +beq $t0, 0, label_FALSEIF_447 +# LOCAL local_option_at_CellularAutomaton_internal_207 --> -832($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_75 +sw $t0, 12($v0) +li $t0, 28 +sw $t0, 16($v0) +sw $v0, -832($fp) +# LOCAL local_option_at_CellularAutomaton_internal_203 --> -816($fp) +# LOCAL local_option_at_CellularAutomaton_internal_207 --> -832($fp) +# local_option_at_CellularAutomaton_internal_203 = local_option_at_CellularAutomaton_internal_207 +lw $t0, -832($fp) +sw $t0, -816($fp) +# GOTO label_ENDIF_448 +j label_ENDIF_448 +label_FALSEIF_447: + # LOCAL local_option_at_CellularAutomaton_internal_212 --> -852($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 19 + sw $t0, 12($v0) + sw $v0, -852($fp) + # IF_ZERO local_option_at_CellularAutomaton_num_0 GOTO label_FALSE_459 + # IF_ZERO local_option_at_CellularAutomaton_num_0 GOTO label_FALSE_459 + lw $t0, -4($fp) + beq $t0, 0, label_FALSE_459 + # IF_ZERO local_option_at_CellularAutomaton_internal_212 GOTO label_FALSE_459 + # IF_ZERO local_option_at_CellularAutomaton_internal_212 GOTO label_FALSE_459 + lw $t0, -852($fp) + beq $t0, 0, label_FALSE_459 + # LOCAL local_option_at_CellularAutomaton_internal_211 --> -848($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Comparing -4($fp) type with String + la $v0, String + lw $a0, -4($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -848($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_211 GOTO label_COMPARE_STRING_462 + # IF_ZERO local_option_at_CellularAutomaton_internal_211 GOTO label_COMPARE_STRING_462 + lw $t0, -848($fp) + beq $t0, 0, label_COMPARE_STRING_462 + # LOCAL local_option_at_CellularAutomaton_internal_211 --> -848($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Comparing -4($fp) type with Bool + la $v0, Bool + lw $a0, -4($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -848($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_211 GOTO label_COMPARE_BY_VALUE_463 + # IF_ZERO local_option_at_CellularAutomaton_internal_211 GOTO label_COMPARE_BY_VALUE_463 + lw $t0, -848($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_463 + # LOCAL local_option_at_CellularAutomaton_internal_211 --> -848($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Comparing -4($fp) type with Int + la $v0, Int + lw $a0, -4($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -848($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_211 GOTO label_COMPARE_BY_VALUE_463 + # IF_ZERO local_option_at_CellularAutomaton_internal_211 GOTO label_COMPARE_BY_VALUE_463 + lw $t0, -848($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_463 + # LOCAL local_option_at_CellularAutomaton_internal_211 --> -848($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_212 --> -852($fp) + # Load pointers and SUB + lw $a0, -4($fp) + lw $a1, -852($fp) + sub $a0, $a0, $a1 + sw $a0, -848($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_211 GOTO label_TRUE_460 + # IF_ZERO local_option_at_CellularAutomaton_internal_211 GOTO label_TRUE_460 + lw $t0, -848($fp) + beq $t0, 0, label_TRUE_460 + # GOTO label_FALSE_459 + j label_FALSE_459 + label_COMPARE_BY_VALUE_463: + # LOCAL local_option_at_CellularAutomaton_internal_211 --> -848($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_212 --> -852($fp) + lw $a0, -4($fp) + lw $a1, -852($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -848($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_211 GOTO label_TRUE_460 + # IF_ZERO local_option_at_CellularAutomaton_internal_211 GOTO label_TRUE_460 + lw $t0, -848($fp) + beq $t0, 0, label_TRUE_460 + # GOTO label_FALSE_459 + j label_FALSE_459 + label_COMPARE_STRING_462: + # LOCAL local_option_at_CellularAutomaton_internal_211 --> -848($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_212 --> -852($fp) + # Load strings for comparison + lw $v0, -4($fp) + lw $v1, -852($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -848($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_211 GOTO label_CONTINUE_464 + # IF_ZERO local_option_at_CellularAutomaton_internal_211 GOTO label_CONTINUE_464 + lw $t0, -848($fp) + beq $t0, 0, label_CONTINUE_464 + # GOTO label_FALSE_459 + j label_FALSE_459 + label_CONTINUE_464: + # LOCAL local_option_at_CellularAutomaton_internal_211 --> -848($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_212 --> -852($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -4($fp) + lw $v1, -852($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_465: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_466 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_465 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_466: + # Store result + sw $a2, -848($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_211 GOTO label_TRUE_460 + # IF_ZERO local_option_at_CellularAutomaton_internal_211 GOTO label_TRUE_460 + lw $t0, -848($fp) + beq $t0, 0, label_TRUE_460 + label_FALSE_459: + # LOCAL local_option_at_CellularAutomaton_internal_210 --> -844($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -844($fp) + # GOTO label_END_461 +j label_END_461 +label_TRUE_460: + # LOCAL local_option_at_CellularAutomaton_internal_210 --> -844($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -844($fp) + label_END_461: +# LOCAL local_option_at_CellularAutomaton_internal_208 --> -836($fp) +# LOCAL local_option_at_CellularAutomaton_internal_210 --> -844($fp) +# Obtain value from -844($fp) +lw $v0, -844($fp) +lw $v0, 12($v0) +sw $v0, -836($fp) +# IF_ZERO local_option_at_CellularAutomaton_internal_208 GOTO label_FALSEIF_457 +# IF_ZERO local_option_at_CellularAutomaton_internal_208 GOTO label_FALSEIF_457 +lw $t0, -836($fp) +beq $t0, 0, label_FALSEIF_457 +# LOCAL local_option_at_CellularAutomaton_internal_213 --> -856($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_76 +sw $t0, 12($v0) +li $t0, 16 +sw $t0, 16($v0) +sw $v0, -856($fp) +# LOCAL local_option_at_CellularAutomaton_internal_209 --> -840($fp) +# LOCAL local_option_at_CellularAutomaton_internal_213 --> -856($fp) +# local_option_at_CellularAutomaton_internal_209 = local_option_at_CellularAutomaton_internal_213 +lw $t0, -856($fp) +sw $t0, -840($fp) +# GOTO label_ENDIF_458 +j label_ENDIF_458 +label_FALSEIF_457: + # LOCAL local_option_at_CellularAutomaton_internal_218 --> -876($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 20 + sw $t0, 12($v0) + sw $v0, -876($fp) + # IF_ZERO local_option_at_CellularAutomaton_num_0 GOTO label_FALSE_469 + # IF_ZERO local_option_at_CellularAutomaton_num_0 GOTO label_FALSE_469 + lw $t0, -4($fp) + beq $t0, 0, label_FALSE_469 + # IF_ZERO local_option_at_CellularAutomaton_internal_218 GOTO label_FALSE_469 + # IF_ZERO local_option_at_CellularAutomaton_internal_218 GOTO label_FALSE_469 + lw $t0, -876($fp) + beq $t0, 0, label_FALSE_469 + # LOCAL local_option_at_CellularAutomaton_internal_217 --> -872($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Comparing -4($fp) type with String + la $v0, String + lw $a0, -4($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -872($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_217 GOTO label_COMPARE_STRING_472 + # IF_ZERO local_option_at_CellularAutomaton_internal_217 GOTO label_COMPARE_STRING_472 + lw $t0, -872($fp) + beq $t0, 0, label_COMPARE_STRING_472 + # LOCAL local_option_at_CellularAutomaton_internal_217 --> -872($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Comparing -4($fp) type with Bool + la $v0, Bool + lw $a0, -4($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -872($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_217 GOTO label_COMPARE_BY_VALUE_473 + # IF_ZERO local_option_at_CellularAutomaton_internal_217 GOTO label_COMPARE_BY_VALUE_473 + lw $t0, -872($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_473 + # LOCAL local_option_at_CellularAutomaton_internal_217 --> -872($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Comparing -4($fp) type with Int + la $v0, Int + lw $a0, -4($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -872($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_217 GOTO label_COMPARE_BY_VALUE_473 + # IF_ZERO local_option_at_CellularAutomaton_internal_217 GOTO label_COMPARE_BY_VALUE_473 + lw $t0, -872($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_473 + # LOCAL local_option_at_CellularAutomaton_internal_217 --> -872($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_218 --> -876($fp) + # Load pointers and SUB + lw $a0, -4($fp) + lw $a1, -876($fp) + sub $a0, $a0, $a1 + sw $a0, -872($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_217 GOTO label_TRUE_470 + # IF_ZERO local_option_at_CellularAutomaton_internal_217 GOTO label_TRUE_470 + lw $t0, -872($fp) + beq $t0, 0, label_TRUE_470 + # GOTO label_FALSE_469 + j label_FALSE_469 + label_COMPARE_BY_VALUE_473: + # LOCAL local_option_at_CellularAutomaton_internal_217 --> -872($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_218 --> -876($fp) + lw $a0, -4($fp) + lw $a1, -876($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -872($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_217 GOTO label_TRUE_470 + # IF_ZERO local_option_at_CellularAutomaton_internal_217 GOTO label_TRUE_470 + lw $t0, -872($fp) + beq $t0, 0, label_TRUE_470 + # GOTO label_FALSE_469 + j label_FALSE_469 + label_COMPARE_STRING_472: + # LOCAL local_option_at_CellularAutomaton_internal_217 --> -872($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_218 --> -876($fp) + # Load strings for comparison + lw $v0, -4($fp) + lw $v1, -876($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -872($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_217 GOTO label_CONTINUE_474 + # IF_ZERO local_option_at_CellularAutomaton_internal_217 GOTO label_CONTINUE_474 + lw $t0, -872($fp) + beq $t0, 0, label_CONTINUE_474 + # GOTO label_FALSE_469 + j label_FALSE_469 + label_CONTINUE_474: + # LOCAL local_option_at_CellularAutomaton_internal_217 --> -872($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_218 --> -876($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -4($fp) + lw $v1, -876($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_475: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_476 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_475 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_476: + # Store result + sw $a2, -872($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_217 GOTO label_TRUE_470 + # IF_ZERO local_option_at_CellularAutomaton_internal_217 GOTO label_TRUE_470 + lw $t0, -872($fp) + beq $t0, 0, label_TRUE_470 + label_FALSE_469: + # LOCAL local_option_at_CellularAutomaton_internal_216 --> -868($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -868($fp) + # GOTO label_END_471 +j label_END_471 +label_TRUE_470: + # LOCAL local_option_at_CellularAutomaton_internal_216 --> -868($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -868($fp) + label_END_471: +# LOCAL local_option_at_CellularAutomaton_internal_214 --> -860($fp) +# LOCAL local_option_at_CellularAutomaton_internal_216 --> -868($fp) +# Obtain value from -868($fp) +lw $v0, -868($fp) +lw $v0, 12($v0) +sw $v0, -860($fp) +# IF_ZERO local_option_at_CellularAutomaton_internal_214 GOTO label_FALSEIF_467 +# IF_ZERO local_option_at_CellularAutomaton_internal_214 GOTO label_FALSEIF_467 +lw $t0, -860($fp) +beq $t0, 0, label_FALSEIF_467 +# LOCAL local_option_at_CellularAutomaton_internal_219 --> -880($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_77 +sw $t0, 12($v0) +li $t0, 28 +sw $t0, 16($v0) +sw $v0, -880($fp) +# LOCAL local_option_at_CellularAutomaton_internal_215 --> -864($fp) +# LOCAL local_option_at_CellularAutomaton_internal_219 --> -880($fp) +# local_option_at_CellularAutomaton_internal_215 = local_option_at_CellularAutomaton_internal_219 +lw $t0, -880($fp) +sw $t0, -864($fp) +# GOTO label_ENDIF_468 +j label_ENDIF_468 +label_FALSEIF_467: + # LOCAL local_option_at_CellularAutomaton_internal_224 --> -900($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 21 + sw $t0, 12($v0) + sw $v0, -900($fp) + # IF_ZERO local_option_at_CellularAutomaton_num_0 GOTO label_FALSE_479 + # IF_ZERO local_option_at_CellularAutomaton_num_0 GOTO label_FALSE_479 + lw $t0, -4($fp) + beq $t0, 0, label_FALSE_479 + # IF_ZERO local_option_at_CellularAutomaton_internal_224 GOTO label_FALSE_479 + # IF_ZERO local_option_at_CellularAutomaton_internal_224 GOTO label_FALSE_479 + lw $t0, -900($fp) + beq $t0, 0, label_FALSE_479 + # LOCAL local_option_at_CellularAutomaton_internal_223 --> -896($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Comparing -4($fp) type with String + la $v0, String + lw $a0, -4($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -896($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_223 GOTO label_COMPARE_STRING_482 + # IF_ZERO local_option_at_CellularAutomaton_internal_223 GOTO label_COMPARE_STRING_482 + lw $t0, -896($fp) + beq $t0, 0, label_COMPARE_STRING_482 + # LOCAL local_option_at_CellularAutomaton_internal_223 --> -896($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Comparing -4($fp) type with Bool + la $v0, Bool + lw $a0, -4($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -896($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_223 GOTO label_COMPARE_BY_VALUE_483 + # IF_ZERO local_option_at_CellularAutomaton_internal_223 GOTO label_COMPARE_BY_VALUE_483 + lw $t0, -896($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_483 + # LOCAL local_option_at_CellularAutomaton_internal_223 --> -896($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # Comparing -4($fp) type with Int + la $v0, Int + lw $a0, -4($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -896($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_223 GOTO label_COMPARE_BY_VALUE_483 + # IF_ZERO local_option_at_CellularAutomaton_internal_223 GOTO label_COMPARE_BY_VALUE_483 + lw $t0, -896($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_483 + # LOCAL local_option_at_CellularAutomaton_internal_223 --> -896($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_224 --> -900($fp) + # Load pointers and SUB + lw $a0, -4($fp) + lw $a1, -900($fp) + sub $a0, $a0, $a1 + sw $a0, -896($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_223 GOTO label_TRUE_480 + # IF_ZERO local_option_at_CellularAutomaton_internal_223 GOTO label_TRUE_480 + lw $t0, -896($fp) + beq $t0, 0, label_TRUE_480 + # GOTO label_FALSE_479 + j label_FALSE_479 + label_COMPARE_BY_VALUE_483: + # LOCAL local_option_at_CellularAutomaton_internal_223 --> -896($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_224 --> -900($fp) + lw $a0, -4($fp) + lw $a1, -900($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -896($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_223 GOTO label_TRUE_480 + # IF_ZERO local_option_at_CellularAutomaton_internal_223 GOTO label_TRUE_480 + lw $t0, -896($fp) + beq $t0, 0, label_TRUE_480 + # GOTO label_FALSE_479 + j label_FALSE_479 + label_COMPARE_STRING_482: + # LOCAL local_option_at_CellularAutomaton_internal_223 --> -896($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_224 --> -900($fp) + # Load strings for comparison + lw $v0, -4($fp) + lw $v1, -900($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -896($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_223 GOTO label_CONTINUE_484 + # IF_ZERO local_option_at_CellularAutomaton_internal_223 GOTO label_CONTINUE_484 + lw $t0, -896($fp) + beq $t0, 0, label_CONTINUE_484 + # GOTO label_FALSE_479 + j label_FALSE_479 + label_CONTINUE_484: + # LOCAL local_option_at_CellularAutomaton_internal_223 --> -896($fp) + # LOCAL local_option_at_CellularAutomaton_num_0 --> -4($fp) + # LOCAL local_option_at_CellularAutomaton_internal_224 --> -900($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -4($fp) + lw $v1, -900($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_485: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_486 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_485 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_486: + # Store result + sw $a2, -896($fp) + # IF_ZERO local_option_at_CellularAutomaton_internal_223 GOTO label_TRUE_480 + # IF_ZERO local_option_at_CellularAutomaton_internal_223 GOTO label_TRUE_480 + lw $t0, -896($fp) + beq $t0, 0, label_TRUE_480 + label_FALSE_479: + # LOCAL local_option_at_CellularAutomaton_internal_222 --> -892($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -892($fp) + # GOTO label_END_481 +j label_END_481 +label_TRUE_480: + # LOCAL local_option_at_CellularAutomaton_internal_222 --> -892($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -892($fp) + label_END_481: +# LOCAL local_option_at_CellularAutomaton_internal_220 --> -884($fp) +# LOCAL local_option_at_CellularAutomaton_internal_222 --> -892($fp) +# Obtain value from -892($fp) +lw $v0, -892($fp) +lw $v0, 12($v0) +sw $v0, -884($fp) +# IF_ZERO local_option_at_CellularAutomaton_internal_220 GOTO label_FALSEIF_477 +# IF_ZERO local_option_at_CellularAutomaton_internal_220 GOTO label_FALSEIF_477 +lw $t0, -884($fp) +beq $t0, 0, label_FALSEIF_477 +# LOCAL local_option_at_CellularAutomaton_internal_225 --> -904($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_78 +sw $t0, 12($v0) +li $t0, 28 +sw $t0, 16($v0) +sw $v0, -904($fp) +# LOCAL local_option_at_CellularAutomaton_internal_221 --> -888($fp) +# LOCAL local_option_at_CellularAutomaton_internal_225 --> -904($fp) +# local_option_at_CellularAutomaton_internal_221 = local_option_at_CellularAutomaton_internal_225 +lw $t0, -904($fp) +sw $t0, -888($fp) +# GOTO label_ENDIF_478 +j label_ENDIF_478 +label_FALSEIF_477: + # LOCAL local_option_at_CellularAutomaton_internal_226 --> -908($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_79 + sw $t0, 12($v0) + li $t0, 25 + sw $t0, 16($v0) + sw $v0, -908($fp) + # LOCAL local_option_at_CellularAutomaton_internal_221 --> -888($fp) + # LOCAL local_option_at_CellularAutomaton_internal_226 --> -908($fp) + # local_option_at_CellularAutomaton_internal_221 = local_option_at_CellularAutomaton_internal_226 + lw $t0, -908($fp) + sw $t0, -888($fp) + label_ENDIF_478: +# LOCAL local_option_at_CellularAutomaton_internal_215 --> -864($fp) +# LOCAL local_option_at_CellularAutomaton_internal_221 --> -888($fp) +# local_option_at_CellularAutomaton_internal_215 = local_option_at_CellularAutomaton_internal_221 +lw $t0, -888($fp) +sw $t0, -864($fp) +label_ENDIF_468: +# LOCAL local_option_at_CellularAutomaton_internal_209 --> -840($fp) +# LOCAL local_option_at_CellularAutomaton_internal_215 --> -864($fp) +# local_option_at_CellularAutomaton_internal_209 = local_option_at_CellularAutomaton_internal_215 +lw $t0, -864($fp) +sw $t0, -840($fp) +label_ENDIF_458: +# LOCAL local_option_at_CellularAutomaton_internal_203 --> -816($fp) +# LOCAL local_option_at_CellularAutomaton_internal_209 --> -840($fp) +# local_option_at_CellularAutomaton_internal_203 = local_option_at_CellularAutomaton_internal_209 +lw $t0, -840($fp) +sw $t0, -816($fp) +label_ENDIF_448: +# LOCAL local_option_at_CellularAutomaton_internal_197 --> -792($fp) +# LOCAL local_option_at_CellularAutomaton_internal_203 --> -816($fp) +# local_option_at_CellularAutomaton_internal_197 = local_option_at_CellularAutomaton_internal_203 +lw $t0, -816($fp) +sw $t0, -792($fp) +label_ENDIF_438: +# LOCAL local_option_at_CellularAutomaton_internal_191 --> -768($fp) +# LOCAL local_option_at_CellularAutomaton_internal_197 --> -792($fp) +# local_option_at_CellularAutomaton_internal_191 = local_option_at_CellularAutomaton_internal_197 +lw $t0, -792($fp) +sw $t0, -768($fp) +label_ENDIF_428: +# LOCAL local_option_at_CellularAutomaton_internal_185 --> -744($fp) +# LOCAL local_option_at_CellularAutomaton_internal_191 --> -768($fp) +# local_option_at_CellularAutomaton_internal_185 = local_option_at_CellularAutomaton_internal_191 +lw $t0, -768($fp) +sw $t0, -744($fp) +label_ENDIF_418: +# LOCAL local_option_at_CellularAutomaton_internal_179 --> -720($fp) +# LOCAL local_option_at_CellularAutomaton_internal_185 --> -744($fp) +# local_option_at_CellularAutomaton_internal_179 = local_option_at_CellularAutomaton_internal_185 +lw $t0, -744($fp) +sw $t0, -720($fp) +label_ENDIF_408: +# LOCAL local_option_at_CellularAutomaton_internal_173 --> -696($fp) +# LOCAL local_option_at_CellularAutomaton_internal_179 --> -720($fp) +# local_option_at_CellularAutomaton_internal_173 = local_option_at_CellularAutomaton_internal_179 +lw $t0, -720($fp) +sw $t0, -696($fp) +label_ENDIF_398: +# LOCAL local_option_at_CellularAutomaton_internal_167 --> -672($fp) +# LOCAL local_option_at_CellularAutomaton_internal_173 --> -696($fp) +# local_option_at_CellularAutomaton_internal_167 = local_option_at_CellularAutomaton_internal_173 +lw $t0, -696($fp) +sw $t0, -672($fp) +label_ENDIF_388: +# LOCAL local_option_at_CellularAutomaton_internal_161 --> -648($fp) +# LOCAL local_option_at_CellularAutomaton_internal_167 --> -672($fp) +# local_option_at_CellularAutomaton_internal_161 = local_option_at_CellularAutomaton_internal_167 +lw $t0, -672($fp) +sw $t0, -648($fp) +label_ENDIF_378: +# LOCAL local_option_at_CellularAutomaton_internal_155 --> -624($fp) +# LOCAL local_option_at_CellularAutomaton_internal_161 --> -648($fp) +# local_option_at_CellularAutomaton_internal_155 = local_option_at_CellularAutomaton_internal_161 +lw $t0, -648($fp) +sw $t0, -624($fp) +label_ENDIF_368: +# LOCAL local_option_at_CellularAutomaton_internal_149 --> -600($fp) +# LOCAL local_option_at_CellularAutomaton_internal_155 --> -624($fp) +# local_option_at_CellularAutomaton_internal_149 = local_option_at_CellularAutomaton_internal_155 +lw $t0, -624($fp) +sw $t0, -600($fp) +label_ENDIF_358: +# LOCAL local_option_at_CellularAutomaton_internal_143 --> -576($fp) +# LOCAL local_option_at_CellularAutomaton_internal_149 --> -600($fp) +# local_option_at_CellularAutomaton_internal_143 = local_option_at_CellularAutomaton_internal_149 +lw $t0, -600($fp) +sw $t0, -576($fp) +label_ENDIF_348: +# LOCAL local_option_at_CellularAutomaton_internal_137 --> -552($fp) +# LOCAL local_option_at_CellularAutomaton_internal_143 --> -576($fp) +# local_option_at_CellularAutomaton_internal_137 = local_option_at_CellularAutomaton_internal_143 +lw $t0, -576($fp) +sw $t0, -552($fp) +label_ENDIF_338: +# LOCAL local_option_at_CellularAutomaton_internal_131 --> -528($fp) +# LOCAL local_option_at_CellularAutomaton_internal_137 --> -552($fp) +# local_option_at_CellularAutomaton_internal_131 = local_option_at_CellularAutomaton_internal_137 +lw $t0, -552($fp) +sw $t0, -528($fp) +label_ENDIF_328: +# LOCAL local_option_at_CellularAutomaton_internal_125 --> -504($fp) +# LOCAL local_option_at_CellularAutomaton_internal_131 --> -528($fp) +# local_option_at_CellularAutomaton_internal_125 = local_option_at_CellularAutomaton_internal_131 +lw $t0, -528($fp) +sw $t0, -504($fp) +label_ENDIF_318: +# LOCAL local_option_at_CellularAutomaton_internal_119 --> -480($fp) +# LOCAL local_option_at_CellularAutomaton_internal_125 --> -504($fp) +# local_option_at_CellularAutomaton_internal_119 = local_option_at_CellularAutomaton_internal_125 +lw $t0, -504($fp) +sw $t0, -480($fp) +label_ENDIF_308: +# LOCAL local_option_at_CellularAutomaton_internal_113 --> -456($fp) +# LOCAL local_option_at_CellularAutomaton_internal_119 --> -480($fp) +# local_option_at_CellularAutomaton_internal_113 = local_option_at_CellularAutomaton_internal_119 +lw $t0, -480($fp) +sw $t0, -456($fp) +label_ENDIF_298: +# LOCAL local_option_at_CellularAutomaton_internal_107 --> -432($fp) +# LOCAL local_option_at_CellularAutomaton_internal_113 --> -456($fp) +# local_option_at_CellularAutomaton_internal_107 = local_option_at_CellularAutomaton_internal_113 +lw $t0, -456($fp) +sw $t0, -432($fp) +label_ENDIF_288: +# LOCAL local_option_at_CellularAutomaton_internal_101 --> -408($fp) +# LOCAL local_option_at_CellularAutomaton_internal_107 --> -432($fp) +# local_option_at_CellularAutomaton_internal_101 = local_option_at_CellularAutomaton_internal_107 +lw $t0, -432($fp) +sw $t0, -408($fp) +label_ENDIF_278: +# RETURN local_option_at_CellularAutomaton_internal_101 +lw $v0, -408($fp) +# Deallocate stack frame for function function_option_at_CellularAutomaton. +# Restore $ra +lw $ra, 4($sp) +# Restore $fp +lw $fp, 0($sp) +# Restore Stack pointer $sp +addu $sp, $sp, 916 +jr $ra +# Function END + + +# function_prompt_at_CellularAutomaton implementation. +# @Params: +function_prompt_at_CellularAutomaton: + # Allocate stack frame for function function_prompt_at_CellularAutomaton. + subu $sp, $sp, 100 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 100 + # LOCAL local_prompt_at_CellularAutomaton_ans_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_0 + sw $t0, 12($v0) + li $t0, 0 + sw $t0, 16($v0) + sw $v0, -4($fp) + # LOCAL local_prompt_at_CellularAutomaton_internal_3 --> -16($fp) + # local_prompt_at_CellularAutomaton_internal_3 = SELF + sw $s1, -16($fp) + # LOCAL local_prompt_at_CellularAutomaton_internal_1 --> -8($fp) + # LOCAL local_prompt_at_CellularAutomaton_internal_3 --> -16($fp) + # local_prompt_at_CellularAutomaton_internal_1 = local_prompt_at_CellularAutomaton_internal_3 + lw $t0, -16($fp) + sw $t0, -8($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_prompt_at_CellularAutomaton_internal_4 --> -20($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_80 + sw $t0, 12($v0) + li $t0, 54 + sw $t0, 16($v0) + sw $v0, -20($fp) + # ARG local_prompt_at_CellularAutomaton_internal_4 + # LOCAL local_prompt_at_CellularAutomaton_internal_4 --> -20($fp) + lw $t0, -20($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_prompt_at_CellularAutomaton_internal_1 --> -8($fp) + # LOCAL local_prompt_at_CellularAutomaton_internal_2 --> -12($fp) + # local_prompt_at_CellularAutomaton_internal_2 = VCALL local_prompt_at_CellularAutomaton_internal_1 out_string + # Save new self pointer in $s1 + lw $s1, -8($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 92($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -12($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_prompt_at_CellularAutomaton_internal_7 --> -32($fp) + # local_prompt_at_CellularAutomaton_internal_7 = SELF + sw $s1, -32($fp) + # LOCAL local_prompt_at_CellularAutomaton_internal_5 --> -24($fp) + # LOCAL local_prompt_at_CellularAutomaton_internal_7 --> -32($fp) + # local_prompt_at_CellularAutomaton_internal_5 = local_prompt_at_CellularAutomaton_internal_7 + lw $t0, -32($fp) + sw $t0, -24($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_prompt_at_CellularAutomaton_internal_8 --> -36($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_81 + sw $t0, 12($v0) + li $t0, 49 + sw $t0, 16($v0) + sw $v0, -36($fp) + # ARG local_prompt_at_CellularAutomaton_internal_8 + # LOCAL local_prompt_at_CellularAutomaton_internal_8 --> -36($fp) + lw $t0, -36($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_prompt_at_CellularAutomaton_internal_5 --> -24($fp) + # LOCAL local_prompt_at_CellularAutomaton_internal_6 --> -28($fp) + # local_prompt_at_CellularAutomaton_internal_6 = VCALL local_prompt_at_CellularAutomaton_internal_5 out_string + # Save new self pointer in $s1 + lw $s1, -24($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 92($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -28($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_prompt_at_CellularAutomaton_internal_11 --> -48($fp) + # local_prompt_at_CellularAutomaton_internal_11 = SELF + sw $s1, -48($fp) + # LOCAL local_prompt_at_CellularAutomaton_internal_9 --> -40($fp) + # LOCAL local_prompt_at_CellularAutomaton_internal_11 --> -48($fp) + # local_prompt_at_CellularAutomaton_internal_9 = local_prompt_at_CellularAutomaton_internal_11 + lw $t0, -48($fp) + sw $t0, -40($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_prompt_at_CellularAutomaton_internal_9 --> -40($fp) + # LOCAL local_prompt_at_CellularAutomaton_internal_10 --> -44($fp) + # local_prompt_at_CellularAutomaton_internal_10 = VCALL local_prompt_at_CellularAutomaton_internal_9 in_string + # Save new self pointer in $s1 + lw $s1, -40($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 16($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -44($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_prompt_at_CellularAutomaton_ans_0 --> -4($fp) + # LOCAL local_prompt_at_CellularAutomaton_internal_10 --> -44($fp) + # local_prompt_at_CellularAutomaton_ans_0 = local_prompt_at_CellularAutomaton_internal_10 + lw $t0, -44($fp) + sw $t0, -4($fp) + # LOCAL local_prompt_at_CellularAutomaton_internal_14 --> -60($fp) + # local_prompt_at_CellularAutomaton_internal_14 = SELF + sw $s1, -60($fp) + # LOCAL local_prompt_at_CellularAutomaton_internal_12 --> -52($fp) + # LOCAL local_prompt_at_CellularAutomaton_internal_14 --> -60($fp) + # local_prompt_at_CellularAutomaton_internal_12 = local_prompt_at_CellularAutomaton_internal_14 + lw $t0, -60($fp) + sw $t0, -52($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_prompt_at_CellularAutomaton_internal_15 --> -64($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_82 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -64($fp) + # ARG local_prompt_at_CellularAutomaton_internal_15 + # LOCAL local_prompt_at_CellularAutomaton_internal_15 --> -64($fp) + lw $t0, -64($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_prompt_at_CellularAutomaton_internal_12 --> -52($fp) + # LOCAL local_prompt_at_CellularAutomaton_internal_13 --> -56($fp) + # local_prompt_at_CellularAutomaton_internal_13 = VCALL local_prompt_at_CellularAutomaton_internal_12 out_string + # Save new self pointer in $s1 + lw $s1, -52($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 92($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -56($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_prompt_at_CellularAutomaton_internal_20 --> -84($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_83 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -84($fp) + # IF_ZERO local_prompt_at_CellularAutomaton_ans_0 GOTO label_FALSE_489 + # IF_ZERO local_prompt_at_CellularAutomaton_ans_0 GOTO label_FALSE_489 + lw $t0, -4($fp) + beq $t0, 0, label_FALSE_489 + # IF_ZERO local_prompt_at_CellularAutomaton_internal_20 GOTO label_FALSE_489 + # IF_ZERO local_prompt_at_CellularAutomaton_internal_20 GOTO label_FALSE_489 + lw $t0, -84($fp) + beq $t0, 0, label_FALSE_489 + # LOCAL local_prompt_at_CellularAutomaton_internal_19 --> -80($fp) + # LOCAL local_prompt_at_CellularAutomaton_ans_0 --> -4($fp) + # Comparing -4($fp) type with String + la $v0, String + lw $a0, -4($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -80($fp) + # IF_ZERO local_prompt_at_CellularAutomaton_internal_19 GOTO label_COMPARE_STRING_492 + # IF_ZERO local_prompt_at_CellularAutomaton_internal_19 GOTO label_COMPARE_STRING_492 + lw $t0, -80($fp) + beq $t0, 0, label_COMPARE_STRING_492 + # LOCAL local_prompt_at_CellularAutomaton_internal_19 --> -80($fp) + # LOCAL local_prompt_at_CellularAutomaton_ans_0 --> -4($fp) + # Comparing -4($fp) type with Bool + la $v0, Bool + lw $a0, -4($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -80($fp) + # IF_ZERO local_prompt_at_CellularAutomaton_internal_19 GOTO label_COMPARE_BY_VALUE_493 + # IF_ZERO local_prompt_at_CellularAutomaton_internal_19 GOTO label_COMPARE_BY_VALUE_493 + lw $t0, -80($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_493 + # LOCAL local_prompt_at_CellularAutomaton_internal_19 --> -80($fp) + # LOCAL local_prompt_at_CellularAutomaton_ans_0 --> -4($fp) + # Comparing -4($fp) type with Int + la $v0, Int + lw $a0, -4($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -80($fp) + # IF_ZERO local_prompt_at_CellularAutomaton_internal_19 GOTO label_COMPARE_BY_VALUE_493 + # IF_ZERO local_prompt_at_CellularAutomaton_internal_19 GOTO label_COMPARE_BY_VALUE_493 + lw $t0, -80($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_493 + # LOCAL local_prompt_at_CellularAutomaton_internal_19 --> -80($fp) + # LOCAL local_prompt_at_CellularAutomaton_ans_0 --> -4($fp) + # LOCAL local_prompt_at_CellularAutomaton_internal_20 --> -84($fp) + # Load pointers and SUB + lw $a0, -4($fp) + lw $a1, -84($fp) + sub $a0, $a0, $a1 + sw $a0, -80($fp) + # IF_ZERO local_prompt_at_CellularAutomaton_internal_19 GOTO label_TRUE_490 + # IF_ZERO local_prompt_at_CellularAutomaton_internal_19 GOTO label_TRUE_490 + lw $t0, -80($fp) + beq $t0, 0, label_TRUE_490 + # GOTO label_FALSE_489 + j label_FALSE_489 + label_COMPARE_BY_VALUE_493: + # LOCAL local_prompt_at_CellularAutomaton_internal_19 --> -80($fp) + # LOCAL local_prompt_at_CellularAutomaton_ans_0 --> -4($fp) + # LOCAL local_prompt_at_CellularAutomaton_internal_20 --> -84($fp) + lw $a0, -4($fp) + lw $a1, -84($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -80($fp) + # IF_ZERO local_prompt_at_CellularAutomaton_internal_19 GOTO label_TRUE_490 + # IF_ZERO local_prompt_at_CellularAutomaton_internal_19 GOTO label_TRUE_490 + lw $t0, -80($fp) + beq $t0, 0, label_TRUE_490 + # GOTO label_FALSE_489 + j label_FALSE_489 + label_COMPARE_STRING_492: + # LOCAL local_prompt_at_CellularAutomaton_internal_19 --> -80($fp) + # LOCAL local_prompt_at_CellularAutomaton_ans_0 --> -4($fp) + # LOCAL local_prompt_at_CellularAutomaton_internal_20 --> -84($fp) + # Load strings for comparison + lw $v0, -4($fp) + lw $v1, -84($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -80($fp) + # IF_ZERO local_prompt_at_CellularAutomaton_internal_19 GOTO label_CONTINUE_494 + # IF_ZERO local_prompt_at_CellularAutomaton_internal_19 GOTO label_CONTINUE_494 + lw $t0, -80($fp) + beq $t0, 0, label_CONTINUE_494 + # GOTO label_FALSE_489 + j label_FALSE_489 + label_CONTINUE_494: + # LOCAL local_prompt_at_CellularAutomaton_internal_19 --> -80($fp) + # LOCAL local_prompt_at_CellularAutomaton_ans_0 --> -4($fp) + # LOCAL local_prompt_at_CellularAutomaton_internal_20 --> -84($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -4($fp) + lw $v1, -84($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_495: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_496 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_495 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_496: + # Store result + sw $a2, -80($fp) + # IF_ZERO local_prompt_at_CellularAutomaton_internal_19 GOTO label_TRUE_490 + # IF_ZERO local_prompt_at_CellularAutomaton_internal_19 GOTO label_TRUE_490 + lw $t0, -80($fp) + beq $t0, 0, label_TRUE_490 + label_FALSE_489: + # LOCAL local_prompt_at_CellularAutomaton_internal_18 --> -76($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -76($fp) + # GOTO label_END_491 +j label_END_491 +label_TRUE_490: + # LOCAL local_prompt_at_CellularAutomaton_internal_18 --> -76($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -76($fp) + label_END_491: +# LOCAL local_prompt_at_CellularAutomaton_internal_16 --> -68($fp) +# LOCAL local_prompt_at_CellularAutomaton_internal_18 --> -76($fp) +# Obtain value from -76($fp) +lw $v0, -76($fp) +lw $v0, 12($v0) +sw $v0, -68($fp) +# IF_ZERO local_prompt_at_CellularAutomaton_internal_16 GOTO label_FALSEIF_487 +# IF_ZERO local_prompt_at_CellularAutomaton_internal_16 GOTO label_FALSEIF_487 +lw $t0, -68($fp) +beq $t0, 0, label_FALSEIF_487 +# LOCAL local_prompt_at_CellularAutomaton_internal_21 --> -88($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Bool +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Bool +sw $t0, 12($v0) +li $t0, 4 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Bool_start +sw $t0, 4($v0) +# Load type offset +li $t0, 12 +sw $t0, 8($v0) +li $t0, 0 +sw $t0, 12($v0) +sw $v0, -88($fp) +# LOCAL local_prompt_at_CellularAutomaton_internal_17 --> -72($fp) +# LOCAL local_prompt_at_CellularAutomaton_internal_21 --> -88($fp) +# local_prompt_at_CellularAutomaton_internal_17 = local_prompt_at_CellularAutomaton_internal_21 +lw $t0, -88($fp) +sw $t0, -72($fp) +# GOTO label_ENDIF_488 +j label_ENDIF_488 +label_FALSEIF_487: + # LOCAL local_prompt_at_CellularAutomaton_internal_22 --> -92($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -92($fp) + # LOCAL local_prompt_at_CellularAutomaton_internal_17 --> -72($fp) + # LOCAL local_prompt_at_CellularAutomaton_internal_22 --> -92($fp) + # local_prompt_at_CellularAutomaton_internal_17 = local_prompt_at_CellularAutomaton_internal_22 + lw $t0, -92($fp) + sw $t0, -72($fp) + label_ENDIF_488: +# RETURN local_prompt_at_CellularAutomaton_internal_17 +lw $v0, -72($fp) +# Deallocate stack frame for function function_prompt_at_CellularAutomaton. +# Restore $ra +lw $ra, 4($sp) +# Restore $fp +lw $fp, 0($sp) +# Restore Stack pointer $sp +addu $sp, $sp, 100 +jr $ra +# Function END + + +# function_prompt2_at_CellularAutomaton implementation. +# @Params: +function_prompt2_at_CellularAutomaton: + # Allocate stack frame for function function_prompt2_at_CellularAutomaton. + subu $sp, $sp, 100 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 100 + # LOCAL local_prompt2_at_CellularAutomaton_ans_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_0 + sw $t0, 12($v0) + li $t0, 0 + sw $t0, 16($v0) + sw $v0, -4($fp) + # LOCAL local_prompt2_at_CellularAutomaton_internal_3 --> -16($fp) + # local_prompt2_at_CellularAutomaton_internal_3 = SELF + sw $s1, -16($fp) + # LOCAL local_prompt2_at_CellularAutomaton_internal_1 --> -8($fp) + # LOCAL local_prompt2_at_CellularAutomaton_internal_3 --> -16($fp) + # local_prompt2_at_CellularAutomaton_internal_1 = local_prompt2_at_CellularAutomaton_internal_3 + lw $t0, -16($fp) + sw $t0, -8($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_prompt2_at_CellularAutomaton_internal_4 --> -20($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_84 + sw $t0, 12($v0) + li $t0, 2 + sw $t0, 16($v0) + sw $v0, -20($fp) + # ARG local_prompt2_at_CellularAutomaton_internal_4 + # LOCAL local_prompt2_at_CellularAutomaton_internal_4 --> -20($fp) + lw $t0, -20($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_prompt2_at_CellularAutomaton_internal_1 --> -8($fp) + # LOCAL local_prompt2_at_CellularAutomaton_internal_2 --> -12($fp) + # local_prompt2_at_CellularAutomaton_internal_2 = VCALL local_prompt2_at_CellularAutomaton_internal_1 out_string + # Save new self pointer in $s1 + lw $s1, -8($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 92($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -12($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_prompt2_at_CellularAutomaton_internal_7 --> -32($fp) + # local_prompt2_at_CellularAutomaton_internal_7 = SELF + sw $s1, -32($fp) + # LOCAL local_prompt2_at_CellularAutomaton_internal_5 --> -24($fp) + # LOCAL local_prompt2_at_CellularAutomaton_internal_7 --> -32($fp) + # local_prompt2_at_CellularAutomaton_internal_5 = local_prompt2_at_CellularAutomaton_internal_7 + lw $t0, -32($fp) + sw $t0, -24($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_prompt2_at_CellularAutomaton_internal_8 --> -36($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_85 + sw $t0, 12($v0) + li $t0, 48 + sw $t0, 16($v0) + sw $v0, -36($fp) + # ARG local_prompt2_at_CellularAutomaton_internal_8 + # LOCAL local_prompt2_at_CellularAutomaton_internal_8 --> -36($fp) + lw $t0, -36($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_prompt2_at_CellularAutomaton_internal_5 --> -24($fp) + # LOCAL local_prompt2_at_CellularAutomaton_internal_6 --> -28($fp) + # local_prompt2_at_CellularAutomaton_internal_6 = VCALL local_prompt2_at_CellularAutomaton_internal_5 out_string + # Save new self pointer in $s1 + lw $s1, -24($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 92($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -28($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_prompt2_at_CellularAutomaton_internal_11 --> -48($fp) + # local_prompt2_at_CellularAutomaton_internal_11 = SELF + sw $s1, -48($fp) + # LOCAL local_prompt2_at_CellularAutomaton_internal_9 --> -40($fp) + # LOCAL local_prompt2_at_CellularAutomaton_internal_11 --> -48($fp) + # local_prompt2_at_CellularAutomaton_internal_9 = local_prompt2_at_CellularAutomaton_internal_11 + lw $t0, -48($fp) + sw $t0, -40($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_prompt2_at_CellularAutomaton_internal_12 --> -52($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_86 + sw $t0, 12($v0) + li $t0, 49 + sw $t0, 16($v0) + sw $v0, -52($fp) + # ARG local_prompt2_at_CellularAutomaton_internal_12 + # LOCAL local_prompt2_at_CellularAutomaton_internal_12 --> -52($fp) + lw $t0, -52($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_prompt2_at_CellularAutomaton_internal_9 --> -40($fp) + # LOCAL local_prompt2_at_CellularAutomaton_internal_10 --> -44($fp) + # local_prompt2_at_CellularAutomaton_internal_10 = VCALL local_prompt2_at_CellularAutomaton_internal_9 out_string + # Save new self pointer in $s1 + lw $s1, -40($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 92($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -44($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_prompt2_at_CellularAutomaton_internal_15 --> -64($fp) + # local_prompt2_at_CellularAutomaton_internal_15 = SELF + sw $s1, -64($fp) + # LOCAL local_prompt2_at_CellularAutomaton_internal_13 --> -56($fp) + # LOCAL local_prompt2_at_CellularAutomaton_internal_15 --> -64($fp) + # local_prompt2_at_CellularAutomaton_internal_13 = local_prompt2_at_CellularAutomaton_internal_15 + lw $t0, -64($fp) + sw $t0, -56($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_prompt2_at_CellularAutomaton_internal_13 --> -56($fp) + # LOCAL local_prompt2_at_CellularAutomaton_internal_14 --> -60($fp) + # local_prompt2_at_CellularAutomaton_internal_14 = VCALL local_prompt2_at_CellularAutomaton_internal_13 in_string + # Save new self pointer in $s1 + lw $s1, -56($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 16($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -60($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_prompt2_at_CellularAutomaton_ans_0 --> -4($fp) + # LOCAL local_prompt2_at_CellularAutomaton_internal_14 --> -60($fp) + # local_prompt2_at_CellularAutomaton_ans_0 = local_prompt2_at_CellularAutomaton_internal_14 + lw $t0, -60($fp) + sw $t0, -4($fp) + # LOCAL local_prompt2_at_CellularAutomaton_internal_20 --> -84($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_87 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -84($fp) + # IF_ZERO local_prompt2_at_CellularAutomaton_ans_0 GOTO label_FALSE_499 + # IF_ZERO local_prompt2_at_CellularAutomaton_ans_0 GOTO label_FALSE_499 + lw $t0, -4($fp) + beq $t0, 0, label_FALSE_499 + # IF_ZERO local_prompt2_at_CellularAutomaton_internal_20 GOTO label_FALSE_499 + # IF_ZERO local_prompt2_at_CellularAutomaton_internal_20 GOTO label_FALSE_499 + lw $t0, -84($fp) + beq $t0, 0, label_FALSE_499 + # LOCAL local_prompt2_at_CellularAutomaton_internal_19 --> -80($fp) + # LOCAL local_prompt2_at_CellularAutomaton_ans_0 --> -4($fp) + # Comparing -4($fp) type with String + la $v0, String + lw $a0, -4($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -80($fp) + # IF_ZERO local_prompt2_at_CellularAutomaton_internal_19 GOTO label_COMPARE_STRING_502 + # IF_ZERO local_prompt2_at_CellularAutomaton_internal_19 GOTO label_COMPARE_STRING_502 + lw $t0, -80($fp) + beq $t0, 0, label_COMPARE_STRING_502 + # LOCAL local_prompt2_at_CellularAutomaton_internal_19 --> -80($fp) + # LOCAL local_prompt2_at_CellularAutomaton_ans_0 --> -4($fp) + # Comparing -4($fp) type with Bool + la $v0, Bool + lw $a0, -4($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -80($fp) + # IF_ZERO local_prompt2_at_CellularAutomaton_internal_19 GOTO label_COMPARE_BY_VALUE_503 + # IF_ZERO local_prompt2_at_CellularAutomaton_internal_19 GOTO label_COMPARE_BY_VALUE_503 + lw $t0, -80($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_503 + # LOCAL local_prompt2_at_CellularAutomaton_internal_19 --> -80($fp) + # LOCAL local_prompt2_at_CellularAutomaton_ans_0 --> -4($fp) + # Comparing -4($fp) type with Int + la $v0, Int + lw $a0, -4($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -80($fp) + # IF_ZERO local_prompt2_at_CellularAutomaton_internal_19 GOTO label_COMPARE_BY_VALUE_503 + # IF_ZERO local_prompt2_at_CellularAutomaton_internal_19 GOTO label_COMPARE_BY_VALUE_503 + lw $t0, -80($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_503 + # LOCAL local_prompt2_at_CellularAutomaton_internal_19 --> -80($fp) + # LOCAL local_prompt2_at_CellularAutomaton_ans_0 --> -4($fp) + # LOCAL local_prompt2_at_CellularAutomaton_internal_20 --> -84($fp) + # Load pointers and SUB + lw $a0, -4($fp) + lw $a1, -84($fp) + sub $a0, $a0, $a1 + sw $a0, -80($fp) + # IF_ZERO local_prompt2_at_CellularAutomaton_internal_19 GOTO label_TRUE_500 + # IF_ZERO local_prompt2_at_CellularAutomaton_internal_19 GOTO label_TRUE_500 + lw $t0, -80($fp) + beq $t0, 0, label_TRUE_500 + # GOTO label_FALSE_499 + j label_FALSE_499 + label_COMPARE_BY_VALUE_503: + # LOCAL local_prompt2_at_CellularAutomaton_internal_19 --> -80($fp) + # LOCAL local_prompt2_at_CellularAutomaton_ans_0 --> -4($fp) + # LOCAL local_prompt2_at_CellularAutomaton_internal_20 --> -84($fp) + lw $a0, -4($fp) + lw $a1, -84($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -80($fp) + # IF_ZERO local_prompt2_at_CellularAutomaton_internal_19 GOTO label_TRUE_500 + # IF_ZERO local_prompt2_at_CellularAutomaton_internal_19 GOTO label_TRUE_500 + lw $t0, -80($fp) + beq $t0, 0, label_TRUE_500 + # GOTO label_FALSE_499 + j label_FALSE_499 + label_COMPARE_STRING_502: + # LOCAL local_prompt2_at_CellularAutomaton_internal_19 --> -80($fp) + # LOCAL local_prompt2_at_CellularAutomaton_ans_0 --> -4($fp) + # LOCAL local_prompt2_at_CellularAutomaton_internal_20 --> -84($fp) + # Load strings for comparison + lw $v0, -4($fp) + lw $v1, -84($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -80($fp) + # IF_ZERO local_prompt2_at_CellularAutomaton_internal_19 GOTO label_CONTINUE_504 + # IF_ZERO local_prompt2_at_CellularAutomaton_internal_19 GOTO label_CONTINUE_504 + lw $t0, -80($fp) + beq $t0, 0, label_CONTINUE_504 + # GOTO label_FALSE_499 + j label_FALSE_499 + label_CONTINUE_504: + # LOCAL local_prompt2_at_CellularAutomaton_internal_19 --> -80($fp) + # LOCAL local_prompt2_at_CellularAutomaton_ans_0 --> -4($fp) + # LOCAL local_prompt2_at_CellularAutomaton_internal_20 --> -84($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -4($fp) + lw $v1, -84($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_505: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_506 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_505 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_506: + # Store result + sw $a2, -80($fp) + # IF_ZERO local_prompt2_at_CellularAutomaton_internal_19 GOTO label_TRUE_500 + # IF_ZERO local_prompt2_at_CellularAutomaton_internal_19 GOTO label_TRUE_500 + lw $t0, -80($fp) + beq $t0, 0, label_TRUE_500 + label_FALSE_499: + # LOCAL local_prompt2_at_CellularAutomaton_internal_18 --> -76($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -76($fp) + # GOTO label_END_501 +j label_END_501 +label_TRUE_500: + # LOCAL local_prompt2_at_CellularAutomaton_internal_18 --> -76($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -76($fp) + label_END_501: +# LOCAL local_prompt2_at_CellularAutomaton_internal_16 --> -68($fp) +# LOCAL local_prompt2_at_CellularAutomaton_internal_18 --> -76($fp) +# Obtain value from -76($fp) +lw $v0, -76($fp) +lw $v0, 12($v0) +sw $v0, -68($fp) +# IF_ZERO local_prompt2_at_CellularAutomaton_internal_16 GOTO label_FALSEIF_497 +# IF_ZERO local_prompt2_at_CellularAutomaton_internal_16 GOTO label_FALSEIF_497 +lw $t0, -68($fp) +beq $t0, 0, label_FALSEIF_497 +# LOCAL local_prompt2_at_CellularAutomaton_internal_21 --> -88($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Bool +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Bool +sw $t0, 12($v0) +li $t0, 4 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Bool_start +sw $t0, 4($v0) +# Load type offset +li $t0, 12 +sw $t0, 8($v0) +li $t0, 1 +sw $t0, 12($v0) +sw $v0, -88($fp) +# LOCAL local_prompt2_at_CellularAutomaton_internal_17 --> -72($fp) +# LOCAL local_prompt2_at_CellularAutomaton_internal_21 --> -88($fp) +# local_prompt2_at_CellularAutomaton_internal_17 = local_prompt2_at_CellularAutomaton_internal_21 +lw $t0, -88($fp) +sw $t0, -72($fp) +# GOTO label_ENDIF_498 +j label_ENDIF_498 +label_FALSEIF_497: + # LOCAL local_prompt2_at_CellularAutomaton_internal_22 --> -92($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -92($fp) + # LOCAL local_prompt2_at_CellularAutomaton_internal_17 --> -72($fp) + # LOCAL local_prompt2_at_CellularAutomaton_internal_22 --> -92($fp) + # local_prompt2_at_CellularAutomaton_internal_17 = local_prompt2_at_CellularAutomaton_internal_22 + lw $t0, -92($fp) + sw $t0, -72($fp) + label_ENDIF_498: +# RETURN local_prompt2_at_CellularAutomaton_internal_17 +lw $v0, -72($fp) +# Deallocate stack frame for function function_prompt2_at_CellularAutomaton. +# Restore $ra +lw $ra, 4($sp) +# Restore $fp +lw $fp, 0($sp) +# Restore Stack pointer $sp +addu $sp, $sp, 100 +jr $ra +# Function END + + +# __Main__attrib__cells__init implementation. +# @Params: +__Main__attrib__cells__init: + # Allocate stack frame for function __Main__attrib__cells__init. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # RETURN 0 + li $v0, 0 + # Deallocate stack frame for function __Main__attrib__cells__init. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_main_at_Main implementation. +# @Params: +function_main_at_Main: + # Allocate stack frame for function function_main_at_Main. + subu $sp, $sp, 160 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 160 + # LOCAL local_main_at_Main_continue_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -4($fp) + # LOCAL local_main_at_Main_choice_1 --> -8($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_0 + sw $t0, 12($v0) + li $t0, 0 + sw $t0, 16($v0) + sw $v0, -8($fp) + # LOCAL local_main_at_Main_internal_4 --> -20($fp) + # local_main_at_Main_internal_4 = SELF + sw $s1, -20($fp) + # LOCAL local_main_at_Main_internal_2 --> -12($fp) + # LOCAL local_main_at_Main_internal_4 --> -20($fp) + # local_main_at_Main_internal_2 = local_main_at_Main_internal_4 + lw $t0, -20($fp) + sw $t0, -12($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_5 --> -24($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_88 + sw $t0, 12($v0) + li $t0, 29 + sw $t0, 16($v0) + sw $v0, -24($fp) + # ARG local_main_at_Main_internal_5 + # LOCAL local_main_at_Main_internal_5 --> -24($fp) + lw $t0, -24($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_main_at_Main_internal_2 --> -12($fp) + # LOCAL local_main_at_Main_internal_3 --> -16($fp) + # local_main_at_Main_internal_3 = VCALL local_main_at_Main_internal_2 out_string + # Save new self pointer in $s1 + lw $s1, -12($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 92($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -16($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_main_at_Main_internal_8 --> -36($fp) + # local_main_at_Main_internal_8 = SELF + sw $s1, -36($fp) + # LOCAL local_main_at_Main_internal_6 --> -28($fp) + # LOCAL local_main_at_Main_internal_8 --> -36($fp) + # local_main_at_Main_internal_6 = local_main_at_Main_internal_8 + lw $t0, -36($fp) + sw $t0, -28($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_9 --> -40($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_89 + sw $t0, 12($v0) + li $t0, 47 + sw $t0, 16($v0) + sw $v0, -40($fp) + # ARG local_main_at_Main_internal_9 + # LOCAL local_main_at_Main_internal_9 --> -40($fp) + lw $t0, -40($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_main_at_Main_internal_6 --> -28($fp) + # LOCAL local_main_at_Main_internal_7 --> -32($fp) + # local_main_at_Main_internal_7 = VCALL local_main_at_Main_internal_6 out_string + # Save new self pointer in $s1 + lw $s1, -28($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 92($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -32($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + label_WHILE_507: + # LOCAL local_main_at_Main_internal_13 --> -56($fp) + # local_main_at_Main_internal_13 = SELF + sw $s1, -56($fp) + # LOCAL local_main_at_Main_internal_11 --> -48($fp) + # LOCAL local_main_at_Main_internal_13 --> -56($fp) + # local_main_at_Main_internal_11 = local_main_at_Main_internal_13 + lw $t0, -56($fp) + sw $t0, -48($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_11 --> -48($fp) + # LOCAL local_main_at_Main_internal_12 --> -52($fp) + # local_main_at_Main_internal_12 = VCALL local_main_at_Main_internal_11 prompt2 + # Save new self pointer in $s1 + lw $s1, -48($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 108($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -52($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_main_at_Main_internal_10 --> -44($fp) + # LOCAL local_main_at_Main_internal_12 --> -52($fp) + # Obtain value from -52($fp) + lw $v0, -52($fp) + lw $v0, 12($v0) + sw $v0, -44($fp) + # IF_ZERO local_main_at_Main_internal_10 GOTO label_WHILE_END_508 + # IF_ZERO local_main_at_Main_internal_10 GOTO label_WHILE_END_508 + lw $t0, -44($fp) + beq $t0, 0, label_WHILE_END_508 + # LOCAL local_main_at_Main_internal_14 --> -60($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -60($fp) + # LOCAL local_main_at_Main_continue_0 --> -4($fp) + # LOCAL local_main_at_Main_internal_14 --> -60($fp) + # local_main_at_Main_continue_0 = local_main_at_Main_internal_14 + lw $t0, -60($fp) + sw $t0, -4($fp) + # LOCAL local_main_at_Main_internal_17 --> -72($fp) + # local_main_at_Main_internal_17 = SELF + sw $s1, -72($fp) + # LOCAL local_main_at_Main_internal_15 --> -64($fp) + # LOCAL local_main_at_Main_internal_17 --> -72($fp) + # local_main_at_Main_internal_15 = local_main_at_Main_internal_17 + lw $t0, -72($fp) + sw $t0, -64($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_15 --> -64($fp) + # LOCAL local_main_at_Main_internal_16 --> -68($fp) + # local_main_at_Main_internal_16 = VCALL local_main_at_Main_internal_15 option + # Save new self pointer in $s1 + lw $s1, -64($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 96($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -68($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_main_at_Main_choice_1 --> -8($fp) + # LOCAL local_main_at_Main_internal_16 --> -68($fp) + # local_main_at_Main_choice_1 = local_main_at_Main_internal_16 + lw $t0, -68($fp) + sw $t0, -8($fp) + # LOCAL local_main_at_Main_internal_20 --> -84($fp) + # local_main_at_Main_internal_20 = ALLOCATE CellularAutomaton + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, CellularAutomaton + sw $t0, 12($v0) + li $t0, 17 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 28 bytes of memory + li $a0, 28 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, CellularAutomaton_start + sw $t0, 4($v0) + # Load type offset + li $t0, 24 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Board__attrib__rows__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 12($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Board__attrib__columns__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 16($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Board__attrib__board_size__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 20($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __CellularAutomaton__attrib__population_map__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 24($t1) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -84($fp) + # LOCAL local_main_at_Main_internal_18 --> -76($fp) + # LOCAL local_main_at_Main_internal_20 --> -84($fp) + # local_main_at_Main_internal_18 = local_main_at_Main_internal_20 + lw $t0, -84($fp) + sw $t0, -76($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # ARG local_main_at_Main_choice_1 + # LOCAL local_main_at_Main_choice_1 --> -8($fp) + lw $t0, -8($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_main_at_Main_internal_18 --> -76($fp) + # LOCAL local_main_at_Main_internal_19 --> -80($fp) + # local_main_at_Main_internal_19 = VCALL local_main_at_Main_internal_18 init + # Save new self pointer in $s1 + lw $s1, -76($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 68($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -80($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # + # LOCAL local_main_at_Main_internal_19 --> -80($fp) + lw $t0, -80($fp) + sw $t0, 28($s1) + # local_main_at_Main_internal_23 = GETATTRIBUTE cells Main + # LOCAL local_main_at_Main_internal_23 --> -96($fp) + lw $t0, 28($s1) + sw $t0, -96($fp) + # LOCAL local_main_at_Main_internal_21 --> -88($fp) + # LOCAL local_main_at_Main_internal_23 --> -96($fp) + # local_main_at_Main_internal_21 = local_main_at_Main_internal_23 + lw $t0, -96($fp) + sw $t0, -88($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_21 --> -88($fp) + # LOCAL local_main_at_Main_internal_22 --> -92($fp) + # local_main_at_Main_internal_22 = VCALL local_main_at_Main_internal_21 print + # Save new self pointer in $s1 + lw $s1, -88($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 80($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -92($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + label_WHILE_509: + # LOCAL local_main_at_Main_internal_24 --> -100($fp) + # LOCAL local_main_at_Main_continue_0 --> -4($fp) + # Obtain value from -4($fp) + lw $v0, -4($fp) + lw $v0, 12($v0) + sw $v0, -100($fp) + # IF_ZERO local_main_at_Main_internal_24 GOTO label_WHILE_END_510 + # IF_ZERO local_main_at_Main_internal_24 GOTO label_WHILE_END_510 + lw $t0, -100($fp) + beq $t0, 0, label_WHILE_END_510 + # LOCAL local_main_at_Main_internal_29 --> -120($fp) + # local_main_at_Main_internal_29 = SELF + sw $s1, -120($fp) + # LOCAL local_main_at_Main_internal_27 --> -112($fp) + # LOCAL local_main_at_Main_internal_29 --> -120($fp) + # local_main_at_Main_internal_27 = local_main_at_Main_internal_29 + lw $t0, -120($fp) + sw $t0, -112($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_27 --> -112($fp) + # LOCAL local_main_at_Main_internal_28 --> -116($fp) + # local_main_at_Main_internal_28 = VCALL local_main_at_Main_internal_27 prompt + # Save new self pointer in $s1 + lw $s1, -112($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 24($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -116($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_main_at_Main_internal_25 --> -104($fp) + # LOCAL local_main_at_Main_internal_28 --> -116($fp) + # Obtain value from -116($fp) + lw $v0, -116($fp) + lw $v0, 12($v0) + sw $v0, -104($fp) + # IF_ZERO local_main_at_Main_internal_25 GOTO label_FALSEIF_511 + # IF_ZERO local_main_at_Main_internal_25 GOTO label_FALSEIF_511 + lw $t0, -104($fp) + beq $t0, 0, label_FALSEIF_511 + # local_main_at_Main_internal_32 = GETATTRIBUTE cells Main + # LOCAL local_main_at_Main_internal_32 --> -132($fp) + lw $t0, 28($s1) + sw $t0, -132($fp) + # LOCAL local_main_at_Main_internal_30 --> -124($fp) + # LOCAL local_main_at_Main_internal_32 --> -132($fp) + # local_main_at_Main_internal_30 = local_main_at_Main_internal_32 + lw $t0, -132($fp) + sw $t0, -124($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_30 --> -124($fp) + # LOCAL local_main_at_Main_internal_31 --> -128($fp) + # local_main_at_Main_internal_31 = VCALL local_main_at_Main_internal_30 evolve + # Save new self pointer in $s1 + lw $s1, -124($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 120($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -128($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # local_main_at_Main_internal_35 = GETATTRIBUTE cells Main + # LOCAL local_main_at_Main_internal_35 --> -144($fp) + lw $t0, 28($s1) + sw $t0, -144($fp) + # LOCAL local_main_at_Main_internal_33 --> -136($fp) + # LOCAL local_main_at_Main_internal_35 --> -144($fp) + # local_main_at_Main_internal_33 = local_main_at_Main_internal_35 + lw $t0, -144($fp) + sw $t0, -136($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_33 --> -136($fp) + # LOCAL local_main_at_Main_internal_34 --> -140($fp) + # local_main_at_Main_internal_34 = VCALL local_main_at_Main_internal_33 print + # Save new self pointer in $s1 + lw $s1, -136($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 80($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -140($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_main_at_Main_internal_26 --> -108($fp) + # LOCAL local_main_at_Main_internal_34 --> -140($fp) + # local_main_at_Main_internal_26 = local_main_at_Main_internal_34 + lw $t0, -140($fp) + sw $t0, -108($fp) + # GOTO label_ENDIF_512 +j label_ENDIF_512 +label_FALSEIF_511: + # LOCAL local_main_at_Main_internal_36 --> -148($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -148($fp) + # LOCAL local_main_at_Main_continue_0 --> -4($fp) + # LOCAL local_main_at_Main_internal_36 --> -148($fp) + # local_main_at_Main_continue_0 = local_main_at_Main_internal_36 + lw $t0, -148($fp) + sw $t0, -4($fp) + # LOCAL local_main_at_Main_internal_26 --> -108($fp) + # local_main_at_Main_internal_26 = + label_ENDIF_512: +# GOTO label_WHILE_509 +j label_WHILE_509 +label_WHILE_END_510: + # GOTO label_WHILE_507 + j label_WHILE_507 + label_WHILE_END_508: + # LOCAL local_main_at_Main_internal_37 --> -152($fp) + # local_main_at_Main_internal_37 = SELF + sw $s1, -152($fp) + # RETURN local_main_at_Main_internal_37 + lw $v0, -152($fp) + # Deallocate stack frame for function function_main_at_Main. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 160 + jr $ra + # Function END + diff --git a/tests/codegen/list.mips b/tests/codegen/list.mips new file mode 100644 index 00000000..f82b2078 --- /dev/null +++ b/tests/codegen/list.mips @@ -0,0 +1,2112 @@ + +# Code generated by PyCoolc. +# Eliane Puerta, Liset Alfaro, Adrian Gonzalez --- Mon Dec 14 11:08:39 2020 +# School of Math and Computer Science, University of Havana +# + +.data +dummy: .word 0 +IO: .asciiz "IO" +# Function END +Object: .asciiz "Object" +# Function END +String: .asciiz "String" +# Function END +Bool: .asciiz "Bool" +# Function END +Int: .asciiz "Int" +# Function END +List: .asciiz "List" +# Function END +Cons: .asciiz "Cons" +# Function END +Main: .asciiz "Main" +# Function END +# + + +# **** VTABLE for type IO **** +IO_vtable: .word dummy, function_copy_at_Object, function_out_int_at_IO, function_in_int_at_IO, dummy, dummy, dummy, function_in_string_at_IO, dummy, dummy, dummy, function_out_string_at_IO, function_abort_at_Object, function_type_name_at_Object, dummy, dummy, dummy +# Function END +# + + +# **** Type RECORD for type IO **** +IO_start: + IO_vtable_pointer: .word IO_vtable + # Function END +IO_end: +# + + +# **** VTABLE for type Object **** +Object_vtable: .word dummy, function_copy_at_Object, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, function_abort_at_Object, function_type_name_at_Object, dummy, dummy, dummy +# Function END +# + + +# **** Type RECORD for type Object **** +Object_start: + Object_vtable_pointer: .word Object_vtable + # Function END +Object_end: +# + + +# **** VTABLE for type String **** +String_vtable: .word function_substr_at_String, function_copy_at_Object, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, function_abort_at_Object, function_type_name_at_Object, function_concat_at_String, function_length_at_String, dummy +# Function END +# + + +# **** Type RECORD for type String **** +String_start: + String_vtable_pointer: .word String_vtable + # Function END +String_end: +# + + +# **** VTABLE for type Bool **** +Bool_vtable: .word dummy, function_copy_at_Object, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, function_abort_at_Object, function_type_name_at_Object, dummy, dummy, dummy +# Function END +# + + +# **** Type RECORD for type Bool **** +Bool_start: + Bool_vtable_pointer: .word Bool_vtable + # Function END +Bool_end: +# + + +# **** VTABLE for type Int **** +Int_vtable: .word dummy, function_copy_at_Object, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, function_abort_at_Object, function_type_name_at_Object, dummy, dummy, dummy +# Function END +# + + +# **** Type RECORD for type Int **** +Int_start: + Int_vtable_pointer: .word Int_vtable + # Function END +Int_end: +# + + +# **** VTABLE for type List **** +List_vtable: .word dummy, function_copy_at_Object, dummy, dummy, function_isNil_at_List, function_head_at_List, function_cons_at_List, dummy, dummy, function_tail_at_List, dummy, dummy, function_abort_at_Object, function_type_name_at_Object, dummy, dummy, dummy +# Function END +# + + +# **** Type RECORD for type List **** +List_start: + List_vtable_pointer: .word List_vtable + # Function END +List_end: +# + + +# **** VTABLE for type Cons **** +Cons_vtable: .word dummy, function_copy_at_Object, dummy, dummy, function_isNil_at_Cons, function_head_at_Cons, function_cons_at_List, dummy, dummy, function_tail_at_Cons, dummy, dummy, function_abort_at_Object, function_type_name_at_Object, dummy, dummy, function_init_at_Cons +# Function END +# + + +# **** Type RECORD for type Cons **** +Cons_start: + Cons_vtable_pointer: .word Cons_vtable + # Function END +Cons_end: +# + + +# **** VTABLE for type Main **** +Main_vtable: .word dummy, function_copy_at_Object, function_out_int_at_IO, function_in_int_at_IO, dummy, dummy, dummy, function_in_string_at_IO, function_print_list_at_Main, dummy, function_main_at_Main, function_out_string_at_IO, function_abort_at_Object, function_type_name_at_Object, dummy, dummy, dummy +# Function END +# + + +# **** Type RECORD for type Main **** +Main_start: + Main_vtable_pointer: .word Main_vtable + # Function END +Main_end: +# + + +data_0: .asciiz "" +# + + +data_1: .asciiz "Abort called from class " +# + + +data_2: .asciiz "\n" +# + + +IO__TDT: .word 0, -1, -1, -1, -1, -1, -1, 1 +Object__TDT: .word 1, 0, 1, 1, 1, 1, 2, 2 +String__TDT: .word -1, -1, 0, -1, -1, -1, -1, -1 +Bool__TDT: .word -1, -1, -1, 0, -1, -1, -1, -1 +Int__TDT: .word -1, -1, -1, -1, 0, -1, -1, -1 +List__TDT: .word -1, -1, -1, -1, -1, 0, 1, -1 +Cons__TDT: .word -1, -1, -1, -1, -1, -1, 0, -1 +Main__TDT: .word -1, -1, -1, -1, -1, -1, -1, 0 +# + + +data_4: .asciiz "\n" +# + + +data_5: .asciiz " " +# + + +.text +main: + jal entry + # syscall code 10 is for exit + li $v0, 10 + syscall + # Function END + +# function_in_string_at_IO implementation. +# @Params: +function_in_string_at_IO: + # Allocate stack frame for function function_in_string_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_in_string_at_IO_internal_0 --> -4($fp) + # Allocating 1024 bytes of memory + li $a0, 1024 + li $v0, 9 + syscall + move $t0, $v0 + move $a0, $v0 + li $a1, 1024 + li $v0, 8 + syscall + move $t2, $zero + move $t3, $zero + move $t1, $t0 + lb $t3, 0($t1) + beqz $t3, end_loop + read_length_loop: + lb $t3, 0($t1) + beqz $t3, end_read_length_loop + addu $t1, $t1, 1 + addu $t2, $t2, 1 + j read_length_loop + end_read_length_loop: + subu $t1, $t1, 1 + sb $zero, 0($t1) + subu $t2, $t2, 1 + end_loop: + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $t2, 16($v0) + sw $v0, -4($fp) + # RETURN local_in_string_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_in_string_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_out_int_at_IO implementation. +# @Params: +# 0($fp) = param_out_int_at_IO_x_0 +function_out_int_at_IO: + # Allocate stack frame for function function_out_int_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # PRINT_INT param_out_int_at_IO_x_0 + # PARAM param_out_int_at_IO_x_0 --> 0($fp) + lw $v0, 0($fp) + lw $a0, 12($v0) + li $v0, 1 + syscall + # LOCAL local_out_int_at_IO_internal_0 --> -4($fp) + # local_out_int_at_IO_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_out_int_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_out_int_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_out_string_at_IO implementation. +# @Params: +# 0($fp) = param_out_string_at_IO_x_0 +function_out_string_at_IO: + # Allocate stack frame for function function_out_string_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # PARAM param_out_string_at_IO_x_0 --> 0($fp) + # PRINT_STR param_out_string_at_IO_x_0 + lw $v0, 0($fp) + lw $a0, 12($v0) + li $v0, 4 + syscall + # LOCAL local_out_string_at_IO_internal_0 --> -4($fp) + # local_out_string_at_IO_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_out_string_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_out_string_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_in_int_at_IO implementation. +# @Params: +function_in_int_at_IO: + # Allocate stack frame for function function_in_int_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_in_int_at_IO_internal_0 --> -4($fp) + # local_in_int_at_IO_internal_0 = READ_INT + li $v0, 5 + syscall + move $a2, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + sw $a2, 12($v0) + sw $v0, -4($fp) + # RETURN local_in_int_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_in_int_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_abort_at_Object implementation. +# @Params: +function_abort_at_Object: + # Allocate stack frame for function function_abort_at_Object. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_abort_at_Object_internal_0 --> -4($fp) + lw $t0, 0($s1) + sw $t0, -4($fp) + # LOCAL local_abort_at_Object_internal_0 --> -4($fp) + la $a0, data_1 + li $v0, 4 + syscall + lw $a0, -4($fp) + li $v0, 4 + syscall + la $a0, data_2 + li $v0, 4 + syscall + li $v0, 10 + syscall + # Function END + + +# function_copy_at_Object implementation. +# @Params: +function_copy_at_Object: + # Allocate stack frame for function function_copy_at_Object. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_copy_at_Object_internal_0 --> -4($fp) + # local_copy_at_Object_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_copy_at_Object_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function function_copy_at_Object. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_type_name_at_Object implementation. +# @Params: +function_type_name_at_Object: + # Allocate stack frame for function function_type_name_at_Object. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_type_name_at_Object_internal_0 --> -4($fp) + lw $t0, 0($s1) + sw $t0, -4($fp) + # RETURN local_type_name_at_Object_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_type_name_at_Object. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_concat_at_String implementation. +# @Params: +# 0($fp) = param_concat_at_String_s_0 +function_concat_at_String: + # Allocate stack frame for function function_concat_at_String. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_concat_at_String_internal_0 = self.CONCAT + # LOCAL local_concat_at_String_internal_0 --> -4($fp) + # PARAM param_concat_at_String_s_0 --> 0($fp) + # Get first string length from self + lw $t0, 16($s1) + # Get second string length from param + lw $v0, 0($fp) + lw $t1, 16($v0) + # Save new string length in a0 for memory allocation + addu $a0, $t0, $t1 + move $t3, $a0 + # Get first string from self + lw $t0, 12($s1) + # Get second string from param + lw $t1, 12($v0) + addu $a0, $a0, 4 + li $v0, 9 + syscall + move $t2, $v0 + move $t4, $zero + concat_loop1: + # Compare t0 with \0 + lb $t4, 0($t0) + beqz $t4, concat_loop1_end + # Copy 1 byte + sb $t4, 0($t2) + addu $t2, $t2, 1 + addu $t0, $t0, 1 + j concat_loop1 + concat_loop1_end: + # Copy second string + concat_loop2: + # Compare t1 with \0 + lb $t4, 0($t1) + beqz $t4, concat_loop2_end + # Copy 1 byte + sb $t4, 0($t2) + addu $t2, $t2, 1 + addu $t1, $t1, 1 + j concat_loop2 + concat_loop2_end: + sb $zero, 0($t2) + # v0 contains resulting string + move $t1, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + sw $t1, 12($v0) + sw $t3, 16($v0) + sw $v0, -4($fp) + # RETURN local_concat_at_String_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_concat_at_String. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_substr_at_String implementation. +# @Params: +# 0($fp) = param_substr_at_String_l_0 +# 4($fp) = param_substr_at_String_r_1 +function_substr_at_String: + # Allocate stack frame for function function_substr_at_String. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_substr_at_String_internal_0 --> -4($fp) + # PARAM param_substr_at_String_l_0 --> 4($fp) + # PARAM param_substr_at_String_r_1 --> 0($fp) + lw $t0, 12($s1) + lw $t2, 4($fp) + lw $t2, 12($t2) + addu $t0, $t0, $t2 + lw $a0, 0($fp) + lw $a0, 12($a0) + move $t3, $a0 + move $t1, $a0 + addu $a0, $a0, 1 + li $v0, 9 + syscall + move $t2, $v0 + substr_loop: + beqz $t1, substr_end + lb $a0, 0($t0) + sb $a0, 0($t2) + addu $t0, $t0, 1 + addu $t2, $t2, 1 + subu $t1, $t1, 1 + j substr_loop + substr_end: + sb $zero, 0($t2) + move $t1, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + sw $t1, 12($v0) + sw $t3, 16($v0) + sw $v0, -4($fp) + # RETURN local_substr_at_String_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_substr_at_String. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 8 + jr $ra + # Function END + + +# function_length_at_String implementation. +# @Params: +function_length_at_String: + # Allocate stack frame for function function_length_at_String. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_length_at_String_internal_0 = GETATTRIBUTE length String + # LOCAL local_length_at_String_internal_0 --> -4($fp) + lw $t0, 16($s1) + sw $t0, -4($fp) + # LOCAL local_length_at_String_internal_1 --> -8($fp) + # LOCAL local_length_at_String_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + lw $t0, -4($fp) + sw $t0, 12($v0) + sw $v0, -8($fp) + # RETURN local_length_at_String_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function function_length_at_String. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# entry implementation. +# @Params: +entry: + # Allocate stack frame for function entry. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local__internal_0 --> -4($fp) + # local__internal_0 = ALLOCATE Main + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Main + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Main_start + sw $t0, 4($v0) + # Load type offset + li $t0, 28 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Main__attrib__mylist__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 12($t1) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -4($fp) + # LOCAL local__internal_0 --> -4($fp) + lw $s1, -4($fp) + # local__internal_1 = CALL main + # LOCAL local__internal_1 --> -8($fp) + # LOCAL local__internal_0 --> -4($fp) + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type's VTABLE + la $t0, Main_vtable + # Get pointer to function address + lw $t1, 40($t0) + # Call function. Result is on $v0 + jalr $t1 + sw $v0, -8($fp) + # RETURN 0 + li $v0, 0 + # Deallocate stack frame for function entry. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_isNil_at_List implementation. +# @Params: +function_isNil_at_List: + # Allocate stack frame for function function_isNil_at_List. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_isNil_at_List_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -4($fp) + # RETURN local_isNil_at_List_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_isNil_at_List. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_head_at_List implementation. +# @Params: +function_head_at_List: + # Allocate stack frame for function function_head_at_List. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_head_at_List_internal_2 --> -12($fp) + # local_head_at_List_internal_2 = SELF + sw $s1, -12($fp) + # LOCAL local_head_at_List_internal_0 --> -4($fp) + # LOCAL local_head_at_List_internal_2 --> -12($fp) + # local_head_at_List_internal_0 = local_head_at_List_internal_2 + lw $t0, -12($fp) + sw $t0, -4($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_head_at_List_internal_0 --> -4($fp) + # LOCAL local_head_at_List_internal_1 --> -8($fp) + # local_head_at_List_internal_1 = VCALL local_head_at_List_internal_0 abort + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 48($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -8($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_head_at_List_internal_3 --> -16($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -16($fp) + # RETURN local_head_at_List_internal_3 + lw $v0, -16($fp) + # Deallocate stack frame for function function_head_at_List. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_tail_at_List implementation. +# @Params: +function_tail_at_List: + # Allocate stack frame for function function_tail_at_List. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_tail_at_List_internal_2 --> -12($fp) + # local_tail_at_List_internal_2 = SELF + sw $s1, -12($fp) + # LOCAL local_tail_at_List_internal_0 --> -4($fp) + # LOCAL local_tail_at_List_internal_2 --> -12($fp) + # local_tail_at_List_internal_0 = local_tail_at_List_internal_2 + lw $t0, -12($fp) + sw $t0, -4($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_tail_at_List_internal_0 --> -4($fp) + # LOCAL local_tail_at_List_internal_1 --> -8($fp) + # local_tail_at_List_internal_1 = VCALL local_tail_at_List_internal_0 abort + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 48($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -8($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_tail_at_List_internal_3 --> -16($fp) + # local_tail_at_List_internal_3 = SELF + sw $s1, -16($fp) + # RETURN local_tail_at_List_internal_3 + lw $v0, -16($fp) + # Deallocate stack frame for function function_tail_at_List. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_cons_at_List implementation. +# @Params: +# 0($fp) = param_cons_at_List_i_0 +function_cons_at_List: + # Allocate stack frame for function function_cons_at_List. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_cons_at_List_internal_2 --> -12($fp) + # local_cons_at_List_internal_2 = ALLOCATE Cons + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Cons + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Cons_start + sw $t0, 4($v0) + # Load type offset + li $t0, 24 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Cons__attrib__car__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 12($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Cons__attrib__cdr__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 16($t1) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -12($fp) + # LOCAL local_cons_at_List_internal_0 --> -4($fp) + # LOCAL local_cons_at_List_internal_2 --> -12($fp) + # local_cons_at_List_internal_0 = local_cons_at_List_internal_2 + lw $t0, -12($fp) + sw $t0, -4($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # ARG param_cons_at_List_i_0 + # PARAM param_cons_at_List_i_0 --> 0($fp) + lw $t0, 0($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_cons_at_List_internal_3 --> -16($fp) + # local_cons_at_List_internal_3 = SELF + sw $s1, -16($fp) + # ARG local_cons_at_List_internal_3 + # LOCAL local_cons_at_List_internal_3 --> -16($fp) + lw $t0, -16($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_cons_at_List_internal_0 --> -4($fp) + # LOCAL local_cons_at_List_internal_1 --> -8($fp) + # local_cons_at_List_internal_1 = VCALL local_cons_at_List_internal_0 init + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 64($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -8($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # RETURN local_cons_at_List_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function function_cons_at_List. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# __Cons__attrib__car__init implementation. +# @Params: +__Cons__attrib__car__init: + # Allocate stack frame for function __Cons__attrib__car__init. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_ttrib__car__init_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -4($fp) + # RETURN local_ttrib__car__init_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function __Cons__attrib__car__init. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# __Cons__attrib__cdr__init implementation. +# @Params: +__Cons__attrib__cdr__init: + # Allocate stack frame for function __Cons__attrib__cdr__init. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # RETURN 0 + li $v0, 0 + # Deallocate stack frame for function __Cons__attrib__cdr__init. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_isNil_at_Cons implementation. +# @Params: +function_isNil_at_Cons: + # Allocate stack frame for function function_isNil_at_Cons. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_isNil_at_Cons_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -4($fp) + # RETURN local_isNil_at_Cons_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_isNil_at_Cons. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_head_at_Cons implementation. +# @Params: +function_head_at_Cons: + # Allocate stack frame for function function_head_at_Cons. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_head_at_Cons_internal_0 = GETATTRIBUTE car Cons + # LOCAL local_head_at_Cons_internal_0 --> -4($fp) + lw $t0, 12($s1) + sw $t0, -4($fp) + # RETURN local_head_at_Cons_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_head_at_Cons. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_tail_at_Cons implementation. +# @Params: +function_tail_at_Cons: + # Allocate stack frame for function function_tail_at_Cons. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_tail_at_Cons_internal_0 = GETATTRIBUTE cdr Cons + # LOCAL local_tail_at_Cons_internal_0 --> -4($fp) + lw $t0, 16($s1) + sw $t0, -4($fp) + # RETURN local_tail_at_Cons_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_tail_at_Cons. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_init_at_Cons implementation. +# @Params: +# 0($fp) = param_init_at_Cons_i_0 +# 4($fp) = param_init_at_Cons_rest_1 +function_init_at_Cons: + # Allocate stack frame for function function_init_at_Cons. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # + # PARAM param_init_at_Cons_i_0 --> 4($fp) + lw $t0, 4($fp) + sw $t0, 12($s1) + # + # PARAM param_init_at_Cons_rest_1 --> 0($fp) + lw $t0, 0($fp) + sw $t0, 16($s1) + # LOCAL local_init_at_Cons_internal_0 --> -4($fp) + # local_init_at_Cons_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_init_at_Cons_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_init_at_Cons. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 8 + jr $ra + # Function END + + +# __Main__attrib__mylist__init implementation. +# @Params: +__Main__attrib__mylist__init: + # Allocate stack frame for function __Main__attrib__mylist__init. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # RETURN 0 + li $v0, 0 + # Deallocate stack frame for function __Main__attrib__mylist__init. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_print_list_at_Main implementation. +# @Params: +# 0($fp) = param_print_list_at_Main_l_0 +function_print_list_at_Main: + # Allocate stack frame for function function_print_list_at_Main. + subu $sp, $sp, 96 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 96 + # LOCAL local_print_list_at_Main_internal_2 --> -12($fp) + # PARAM param_print_list_at_Main_l_0 --> 0($fp) + # local_print_list_at_Main_internal_2 = PARAM param_print_list_at_Main_l_0 + lw $t0, 0($fp) + sw $t0, -12($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_print_list_at_Main_internal_2 --> -12($fp) + # LOCAL local_print_list_at_Main_internal_3 --> -16($fp) + # local_print_list_at_Main_internal_3 = VCALL local_print_list_at_Main_internal_2 isNil + # Save new self pointer in $s1 + lw $s1, -12($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 16($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -16($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_print_list_at_Main_internal_0 --> -4($fp) + # LOCAL local_print_list_at_Main_internal_3 --> -16($fp) + # Obtain value from -16($fp) + lw $v0, -16($fp) + lw $v0, 12($v0) + sw $v0, -4($fp) + # IF_ZERO local_print_list_at_Main_internal_0 GOTO label_FALSEIF_1 + # IF_ZERO local_print_list_at_Main_internal_0 GOTO label_FALSEIF_1 + lw $t0, -4($fp) + beq $t0, 0, label_FALSEIF_1 + # LOCAL local_print_list_at_Main_internal_6 --> -28($fp) + # local_print_list_at_Main_internal_6 = SELF + sw $s1, -28($fp) + # LOCAL local_print_list_at_Main_internal_4 --> -20($fp) + # LOCAL local_print_list_at_Main_internal_6 --> -28($fp) + # local_print_list_at_Main_internal_4 = local_print_list_at_Main_internal_6 + lw $t0, -28($fp) + sw $t0, -20($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_print_list_at_Main_internal_7 --> -32($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_4 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -32($fp) + # ARG local_print_list_at_Main_internal_7 + # LOCAL local_print_list_at_Main_internal_7 --> -32($fp) + lw $t0, -32($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_print_list_at_Main_internal_4 --> -20($fp) + # LOCAL local_print_list_at_Main_internal_5 --> -24($fp) + # local_print_list_at_Main_internal_5 = VCALL local_print_list_at_Main_internal_4 out_string + # Save new self pointer in $s1 + lw $s1, -20($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 44($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -24($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_print_list_at_Main_internal_1 --> -8($fp) + # LOCAL local_print_list_at_Main_internal_5 --> -24($fp) + # local_print_list_at_Main_internal_1 = local_print_list_at_Main_internal_5 + lw $t0, -24($fp) + sw $t0, -8($fp) + # GOTO label_ENDIF_2 +j label_ENDIF_2 +label_FALSEIF_1: + # LOCAL local_print_list_at_Main_internal_10 --> -44($fp) + # local_print_list_at_Main_internal_10 = SELF + sw $s1, -44($fp) + # LOCAL local_print_list_at_Main_internal_8 --> -36($fp) + # LOCAL local_print_list_at_Main_internal_10 --> -44($fp) + # local_print_list_at_Main_internal_8 = local_print_list_at_Main_internal_10 + lw $t0, -44($fp) + sw $t0, -36($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_print_list_at_Main_internal_11 --> -48($fp) + # PARAM param_print_list_at_Main_l_0 --> 0($fp) + # local_print_list_at_Main_internal_11 = PARAM param_print_list_at_Main_l_0 + lw $t0, 0($fp) + sw $t0, -48($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_print_list_at_Main_internal_11 --> -48($fp) + # LOCAL local_print_list_at_Main_internal_12 --> -52($fp) + # local_print_list_at_Main_internal_12 = VCALL local_print_list_at_Main_internal_11 head + # Save new self pointer in $s1 + lw $s1, -48($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 20($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -52($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # ARG local_print_list_at_Main_internal_12 + # LOCAL local_print_list_at_Main_internal_12 --> -52($fp) + lw $t0, -52($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_print_list_at_Main_internal_8 --> -36($fp) + # LOCAL local_print_list_at_Main_internal_9 --> -40($fp) + # local_print_list_at_Main_internal_9 = VCALL local_print_list_at_Main_internal_8 out_int + # Save new self pointer in $s1 + lw $s1, -36($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 8($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -40($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_print_list_at_Main_internal_15 --> -64($fp) + # local_print_list_at_Main_internal_15 = SELF + sw $s1, -64($fp) + # LOCAL local_print_list_at_Main_internal_13 --> -56($fp) + # LOCAL local_print_list_at_Main_internal_15 --> -64($fp) + # local_print_list_at_Main_internal_13 = local_print_list_at_Main_internal_15 + lw $t0, -64($fp) + sw $t0, -56($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_print_list_at_Main_internal_16 --> -68($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_5 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -68($fp) + # ARG local_print_list_at_Main_internal_16 + # LOCAL local_print_list_at_Main_internal_16 --> -68($fp) + lw $t0, -68($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_print_list_at_Main_internal_13 --> -56($fp) + # LOCAL local_print_list_at_Main_internal_14 --> -60($fp) + # local_print_list_at_Main_internal_14 = VCALL local_print_list_at_Main_internal_13 out_string + # Save new self pointer in $s1 + lw $s1, -56($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 44($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -60($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_print_list_at_Main_internal_19 --> -80($fp) + # local_print_list_at_Main_internal_19 = SELF + sw $s1, -80($fp) + # LOCAL local_print_list_at_Main_internal_17 --> -72($fp) + # LOCAL local_print_list_at_Main_internal_19 --> -80($fp) + # local_print_list_at_Main_internal_17 = local_print_list_at_Main_internal_19 + lw $t0, -80($fp) + sw $t0, -72($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_print_list_at_Main_internal_20 --> -84($fp) + # PARAM param_print_list_at_Main_l_0 --> 0($fp) + # local_print_list_at_Main_internal_20 = PARAM param_print_list_at_Main_l_0 + lw $t0, 0($fp) + sw $t0, -84($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_print_list_at_Main_internal_20 --> -84($fp) + # LOCAL local_print_list_at_Main_internal_21 --> -88($fp) + # local_print_list_at_Main_internal_21 = VCALL local_print_list_at_Main_internal_20 tail + # Save new self pointer in $s1 + lw $s1, -84($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 36($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -88($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # ARG local_print_list_at_Main_internal_21 + # LOCAL local_print_list_at_Main_internal_21 --> -88($fp) + lw $t0, -88($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_print_list_at_Main_internal_17 --> -72($fp) + # LOCAL local_print_list_at_Main_internal_18 --> -76($fp) + # local_print_list_at_Main_internal_18 = VCALL local_print_list_at_Main_internal_17 print_list + # Save new self pointer in $s1 + lw $s1, -72($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 32($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -76($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_print_list_at_Main_internal_1 --> -8($fp) + # LOCAL local_print_list_at_Main_internal_18 --> -76($fp) + # local_print_list_at_Main_internal_1 = local_print_list_at_Main_internal_18 + lw $t0, -76($fp) + sw $t0, -8($fp) + label_ENDIF_2: +# RETURN local_print_list_at_Main_internal_1 +lw $v0, -8($fp) +# Deallocate stack frame for function function_print_list_at_Main. +# Restore $ra +lw $ra, 4($sp) +# Restore $fp +lw $fp, 0($sp) +# Restore Stack pointer $sp +addu $sp, $sp, 96 +# Deallocate function args +addu $sp, $sp, 4 +jr $ra +# Function END + + +# function_main_at_Main implementation. +# @Params: +function_main_at_Main: + # Allocate stack frame for function function_main_at_Main. + subu $sp, $sp, 120 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 120 + # LOCAL local_main_at_Main_internal_10 --> -44($fp) + # local_main_at_Main_internal_10 = ALLOCATE List + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, List + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 12 bytes of memory + li $a0, 12 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, List_start + sw $t0, 4($v0) + # Load type offset + li $t0, 20 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -44($fp) + # LOCAL local_main_at_Main_internal_8 --> -36($fp) + # LOCAL local_main_at_Main_internal_10 --> -44($fp) + # local_main_at_Main_internal_8 = local_main_at_Main_internal_10 + lw $t0, -44($fp) + sw $t0, -36($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_11 --> -48($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -48($fp) + # ARG local_main_at_Main_internal_11 + # LOCAL local_main_at_Main_internal_11 --> -48($fp) + lw $t0, -48($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_main_at_Main_internal_8 --> -36($fp) + # LOCAL local_main_at_Main_internal_9 --> -40($fp) + # local_main_at_Main_internal_9 = VCALL local_main_at_Main_internal_8 cons + # Save new self pointer in $s1 + lw $s1, -36($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 24($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -40($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_main_at_Main_internal_6 --> -28($fp) + # LOCAL local_main_at_Main_internal_9 --> -40($fp) + # local_main_at_Main_internal_6 = local_main_at_Main_internal_9 + lw $t0, -40($fp) + sw $t0, -28($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_12 --> -52($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 2 + sw $t0, 12($v0) + sw $v0, -52($fp) + # ARG local_main_at_Main_internal_12 + # LOCAL local_main_at_Main_internal_12 --> -52($fp) + lw $t0, -52($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_main_at_Main_internal_6 --> -28($fp) + # LOCAL local_main_at_Main_internal_7 --> -32($fp) + # local_main_at_Main_internal_7 = VCALL local_main_at_Main_internal_6 cons + # Save new self pointer in $s1 + lw $s1, -28($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 24($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -32($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_main_at_Main_internal_4 --> -20($fp) + # LOCAL local_main_at_Main_internal_7 --> -32($fp) + # local_main_at_Main_internal_4 = local_main_at_Main_internal_7 + lw $t0, -32($fp) + sw $t0, -20($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_13 --> -56($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 3 + sw $t0, 12($v0) + sw $v0, -56($fp) + # ARG local_main_at_Main_internal_13 + # LOCAL local_main_at_Main_internal_13 --> -56($fp) + lw $t0, -56($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_main_at_Main_internal_4 --> -20($fp) + # LOCAL local_main_at_Main_internal_5 --> -24($fp) + # local_main_at_Main_internal_5 = VCALL local_main_at_Main_internal_4 cons + # Save new self pointer in $s1 + lw $s1, -20($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 24($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -24($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_main_at_Main_internal_2 --> -12($fp) + # LOCAL local_main_at_Main_internal_5 --> -24($fp) + # local_main_at_Main_internal_2 = local_main_at_Main_internal_5 + lw $t0, -24($fp) + sw $t0, -12($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_14 --> -60($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 4 + sw $t0, 12($v0) + sw $v0, -60($fp) + # ARG local_main_at_Main_internal_14 + # LOCAL local_main_at_Main_internal_14 --> -60($fp) + lw $t0, -60($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_main_at_Main_internal_2 --> -12($fp) + # LOCAL local_main_at_Main_internal_3 --> -16($fp) + # local_main_at_Main_internal_3 = VCALL local_main_at_Main_internal_2 cons + # Save new self pointer in $s1 + lw $s1, -12($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 24($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -16($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_main_at_Main_internal_0 --> -4($fp) + # LOCAL local_main_at_Main_internal_3 --> -16($fp) + # local_main_at_Main_internal_0 = local_main_at_Main_internal_3 + lw $t0, -16($fp) + sw $t0, -4($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_15 --> -64($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 5 + sw $t0, 12($v0) + sw $v0, -64($fp) + # ARG local_main_at_Main_internal_15 + # LOCAL local_main_at_Main_internal_15 --> -64($fp) + lw $t0, -64($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_main_at_Main_internal_0 --> -4($fp) + # LOCAL local_main_at_Main_internal_1 --> -8($fp) + # local_main_at_Main_internal_1 = VCALL local_main_at_Main_internal_0 cons + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 24($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -8($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # + # LOCAL local_main_at_Main_internal_1 --> -8($fp) + lw $t0, -8($fp) + sw $t0, 12($s1) + label_WHILE_3: + # local_main_at_Main_internal_19 = GETATTRIBUTE mylist Main + # LOCAL local_main_at_Main_internal_19 --> -80($fp) + lw $t0, 12($s1) + sw $t0, -80($fp) + # LOCAL local_main_at_Main_internal_17 --> -72($fp) + # LOCAL local_main_at_Main_internal_19 --> -80($fp) + # local_main_at_Main_internal_17 = local_main_at_Main_internal_19 + lw $t0, -80($fp) + sw $t0, -72($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_17 --> -72($fp) + # LOCAL local_main_at_Main_internal_18 --> -76($fp) + # local_main_at_Main_internal_18 = VCALL local_main_at_Main_internal_17 isNil + # Save new self pointer in $s1 + lw $s1, -72($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 16($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -76($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_main_at_Main_internal_18 --> -76($fp) + # LOCAL local_main_at_Main_internal_18 --> -76($fp) + # Obtain value from -76($fp) + lw $v0, -76($fp) + lw $v0, 12($v0) + sw $v0, -76($fp) + # IF_ZERO local_main_at_Main_internal_18 GOTO label_FALSE_5 + # IF_ZERO local_main_at_Main_internal_18 GOTO label_FALSE_5 + lw $t0, -76($fp) + beq $t0, 0, label_FALSE_5 + # LOCAL local_main_at_Main_internal_20 --> -84($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -84($fp) + # GOTO label_NOT_END_6 + j label_NOT_END_6 + label_FALSE_5: + # LOCAL local_main_at_Main_internal_20 --> -84($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -84($fp) + label_NOT_END_6: + # LOCAL local_main_at_Main_internal_16 --> -68($fp) + # LOCAL local_main_at_Main_internal_20 --> -84($fp) + # Obtain value from -84($fp) + lw $v0, -84($fp) + lw $v0, 12($v0) + sw $v0, -68($fp) + # IF_ZERO local_main_at_Main_internal_16 GOTO label_WHILE_END_4 + # IF_ZERO local_main_at_Main_internal_16 GOTO label_WHILE_END_4 + lw $t0, -68($fp) + beq $t0, 0, label_WHILE_END_4 + # LOCAL local_main_at_Main_internal_23 --> -96($fp) + # local_main_at_Main_internal_23 = SELF + sw $s1, -96($fp) + # LOCAL local_main_at_Main_internal_21 --> -88($fp) + # LOCAL local_main_at_Main_internal_23 --> -96($fp) + # local_main_at_Main_internal_21 = local_main_at_Main_internal_23 + lw $t0, -96($fp) + sw $t0, -88($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # local_main_at_Main_internal_24 = GETATTRIBUTE mylist Main + # LOCAL local_main_at_Main_internal_24 --> -100($fp) + lw $t0, 12($s1) + sw $t0, -100($fp) + # ARG local_main_at_Main_internal_24 + # LOCAL local_main_at_Main_internal_24 --> -100($fp) + lw $t0, -100($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_main_at_Main_internal_21 --> -88($fp) + # LOCAL local_main_at_Main_internal_22 --> -92($fp) + # local_main_at_Main_internal_22 = VCALL local_main_at_Main_internal_21 print_list + # Save new self pointer in $s1 + lw $s1, -88($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 32($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -92($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # local_main_at_Main_internal_27 = GETATTRIBUTE mylist Main + # LOCAL local_main_at_Main_internal_27 --> -112($fp) + lw $t0, 12($s1) + sw $t0, -112($fp) + # LOCAL local_main_at_Main_internal_25 --> -104($fp) + # LOCAL local_main_at_Main_internal_27 --> -112($fp) + # local_main_at_Main_internal_25 = local_main_at_Main_internal_27 + lw $t0, -112($fp) + sw $t0, -104($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_25 --> -104($fp) + # LOCAL local_main_at_Main_internal_26 --> -108($fp) + # local_main_at_Main_internal_26 = VCALL local_main_at_Main_internal_25 tail + # Save new self pointer in $s1 + lw $s1, -104($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 36($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -108($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # + # LOCAL local_main_at_Main_internal_26 --> -108($fp) + lw $t0, -108($fp) + sw $t0, 12($s1) + # GOTO label_WHILE_3 + j label_WHILE_3 + label_WHILE_END_4: + # RETURN + # Deallocate stack frame for function function_main_at_Main. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 120 + jr $ra + # Function END + diff --git a/tests/codegen/new_complex.mips b/tests/codegen/new_complex.mips new file mode 100644 index 00000000..db9a488e --- /dev/null +++ b/tests/codegen/new_complex.mips @@ -0,0 +1,4219 @@ + +# Code generated by PyCoolc. +# Eliane Puerta, Liset Alfaro, Adrian Gonzalez --- Mon Dec 14 11:08:37 2020 +# School of Math and Computer Science, University of Havana +# + +.data +dummy: .word 0 +IO: .asciiz "IO" +# Function END +Object: .asciiz "Object" +# Function END +String: .asciiz "String" +# Function END +Bool: .asciiz "Bool" +# Function END +Int: .asciiz "Int" +# Function END +Complex: .asciiz "Complex" +# Function END +Main: .asciiz "Main" +# Function END +# + + +# **** VTABLE for type IO **** +IO_vtable: .word dummy, function_out_int_at_IO, dummy, function_abort_at_Object, dummy, dummy, dummy, dummy, dummy, function_in_int_at_IO, function_type_name_at_Object, dummy, function_in_string_at_IO, dummy, function_out_string_at_IO, dummy, dummy, function_copy_at_Object, dummy +# Function END +# + + +# **** Type RECORD for type IO **** +IO_start: + IO_vtable_pointer: .word IO_vtable + # Function END +IO_end: +# + + +# **** VTABLE for type Object **** +Object_vtable: .word dummy, dummy, dummy, function_abort_at_Object, dummy, dummy, dummy, dummy, dummy, dummy, function_type_name_at_Object, dummy, dummy, dummy, dummy, dummy, dummy, function_copy_at_Object, dummy +# Function END +# + + +# **** Type RECORD for type Object **** +Object_start: + Object_vtable_pointer: .word Object_vtable + # Function END +Object_end: +# + + +# **** VTABLE for type String **** +String_vtable: .word dummy, dummy, dummy, function_abort_at_Object, dummy, dummy, dummy, dummy, dummy, dummy, function_type_name_at_Object, function_concat_at_String, dummy, dummy, dummy, function_length_at_String, dummy, function_copy_at_Object, function_substr_at_String +# Function END +# + + +# **** Type RECORD for type String **** +String_start: + String_vtable_pointer: .word String_vtable + # Function END +String_end: +# + + +# **** VTABLE for type Bool **** +Bool_vtable: .word dummy, dummy, dummy, function_abort_at_Object, dummy, dummy, dummy, dummy, dummy, dummy, function_type_name_at_Object, dummy, dummy, dummy, dummy, dummy, dummy, function_copy_at_Object, dummy +# Function END +# + + +# **** Type RECORD for type Bool **** +Bool_start: + Bool_vtable_pointer: .word Bool_vtable + # Function END +Bool_end: +# + + +# **** VTABLE for type Int **** +Int_vtable: .word dummy, dummy, dummy, function_abort_at_Object, dummy, dummy, dummy, dummy, dummy, dummy, function_type_name_at_Object, dummy, dummy, dummy, dummy, dummy, dummy, function_copy_at_Object, dummy +# Function END +# + + +# **** Type RECORD for type Int **** +Int_start: + Int_vtable_pointer: .word Int_vtable + # Function END +Int_end: +# + + +# **** VTABLE for type Complex **** +Complex_vtable: .word function_reflect_Y_at_Complex, function_out_int_at_IO, function_print_at_Complex, function_abort_at_Object, function_reflect_0_at_Complex, function_y_value_at_Complex, dummy, function_init_at_Complex, function_x_value_at_Complex, function_in_int_at_IO, function_type_name_at_Object, dummy, function_in_string_at_IO, function_equal_at_Complex, function_out_string_at_IO, dummy, function_reflect_X_at_Complex, function_copy_at_Object, dummy +# Function END +# + + +# **** Type RECORD for type Complex **** +Complex_start: + Complex_vtable_pointer: .word Complex_vtable + # Function END +Complex_end: +# + + +# **** VTABLE for type Main **** +Main_vtable: .word dummy, function_out_int_at_IO, dummy, function_abort_at_Object, dummy, dummy, function_main_at_Main, dummy, dummy, function_in_int_at_IO, function_type_name_at_Object, dummy, function_in_string_at_IO, dummy, function_out_string_at_IO, dummy, dummy, function_copy_at_Object, dummy +# Function END +# + + +# **** Type RECORD for type Main **** +Main_start: + Main_vtable_pointer: .word Main_vtable + # Function END +Main_end: +# + + +data_0: .asciiz "" +# + + +data_1: .asciiz "Abort called from class " +# + + +data_2: .asciiz "\n" +# + + +IO__TDT: .word 0, -1, -1, -1, -1, 1, 1 +Object__TDT: .word 1, 0, 1, 1, 1, 2, 2 +String__TDT: .word -1, -1, 0, -1, -1, -1, -1 +Bool__TDT: .word -1, -1, -1, 0, -1, -1, -1 +Int__TDT: .word -1, -1, -1, -1, 0, -1, -1 +Complex__TDT: .word -1, -1, -1, -1, -1, 0, -1 +Main__TDT: .word -1, -1, -1, -1, -1, -1, 0 +# + + +data_4: .asciiz "+" +# + + +data_5: .asciiz "I" +# + + +data_6: .asciiz "=)\n" +# + + +data_7: .asciiz "=(\n" +# + + +data_8: .asciiz "=)\n" +# + + +data_9: .asciiz "=(\n" +# + + +.text +main: + jal entry + # syscall code 10 is for exit + li $v0, 10 + syscall + # Function END + +# function_in_string_at_IO implementation. +# @Params: +function_in_string_at_IO: + # Allocate stack frame for function function_in_string_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_in_string_at_IO_internal_0 --> -4($fp) + # Allocating 1024 bytes of memory + li $a0, 1024 + li $v0, 9 + syscall + move $t0, $v0 + move $a0, $v0 + li $a1, 1024 + li $v0, 8 + syscall + move $t2, $zero + move $t3, $zero + move $t1, $t0 + lb $t3, 0($t1) + beqz $t3, end_loop + read_length_loop: + lb $t3, 0($t1) + beqz $t3, end_read_length_loop + addu $t1, $t1, 1 + addu $t2, $t2, 1 + j read_length_loop + end_read_length_loop: + subu $t1, $t1, 1 + sb $zero, 0($t1) + subu $t2, $t2, 1 + end_loop: + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $t2, 16($v0) + sw $v0, -4($fp) + # RETURN local_in_string_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_in_string_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_out_int_at_IO implementation. +# @Params: +# 0($fp) = param_out_int_at_IO_x_0 +function_out_int_at_IO: + # Allocate stack frame for function function_out_int_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # PRINT_INT param_out_int_at_IO_x_0 + # PARAM param_out_int_at_IO_x_0 --> 0($fp) + lw $v0, 0($fp) + lw $a0, 12($v0) + li $v0, 1 + syscall + # LOCAL local_out_int_at_IO_internal_0 --> -4($fp) + # local_out_int_at_IO_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_out_int_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_out_int_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_out_string_at_IO implementation. +# @Params: +# 0($fp) = param_out_string_at_IO_x_0 +function_out_string_at_IO: + # Allocate stack frame for function function_out_string_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # PARAM param_out_string_at_IO_x_0 --> 0($fp) + # PRINT_STR param_out_string_at_IO_x_0 + lw $v0, 0($fp) + lw $a0, 12($v0) + li $v0, 4 + syscall + # LOCAL local_out_string_at_IO_internal_0 --> -4($fp) + # local_out_string_at_IO_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_out_string_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_out_string_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_in_int_at_IO implementation. +# @Params: +function_in_int_at_IO: + # Allocate stack frame for function function_in_int_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_in_int_at_IO_internal_0 --> -4($fp) + # local_in_int_at_IO_internal_0 = READ_INT + li $v0, 5 + syscall + move $a2, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + sw $a2, 12($v0) + sw $v0, -4($fp) + # RETURN local_in_int_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_in_int_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_abort_at_Object implementation. +# @Params: +function_abort_at_Object: + # Allocate stack frame for function function_abort_at_Object. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_abort_at_Object_internal_0 --> -4($fp) + lw $t0, 0($s1) + sw $t0, -4($fp) + # LOCAL local_abort_at_Object_internal_0 --> -4($fp) + la $a0, data_1 + li $v0, 4 + syscall + lw $a0, -4($fp) + li $v0, 4 + syscall + la $a0, data_2 + li $v0, 4 + syscall + li $v0, 10 + syscall + # Function END + + +# function_copy_at_Object implementation. +# @Params: +function_copy_at_Object: + # Allocate stack frame for function function_copy_at_Object. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_copy_at_Object_internal_0 --> -4($fp) + # local_copy_at_Object_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_copy_at_Object_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function function_copy_at_Object. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_type_name_at_Object implementation. +# @Params: +function_type_name_at_Object: + # Allocate stack frame for function function_type_name_at_Object. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_type_name_at_Object_internal_0 --> -4($fp) + lw $t0, 0($s1) + sw $t0, -4($fp) + # RETURN local_type_name_at_Object_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_type_name_at_Object. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_concat_at_String implementation. +# @Params: +# 0($fp) = param_concat_at_String_s_0 +function_concat_at_String: + # Allocate stack frame for function function_concat_at_String. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_concat_at_String_internal_0 = self.CONCAT + # LOCAL local_concat_at_String_internal_0 --> -4($fp) + # PARAM param_concat_at_String_s_0 --> 0($fp) + # Get first string length from self + lw $t0, 16($s1) + # Get second string length from param + lw $v0, 0($fp) + lw $t1, 16($v0) + # Save new string length in a0 for memory allocation + addu $a0, $t0, $t1 + move $t3, $a0 + # Get first string from self + lw $t0, 12($s1) + # Get second string from param + lw $t1, 12($v0) + addu $a0, $a0, 4 + li $v0, 9 + syscall + move $t2, $v0 + move $t4, $zero + concat_loop1: + # Compare t0 with \0 + lb $t4, 0($t0) + beqz $t4, concat_loop1_end + # Copy 1 byte + sb $t4, 0($t2) + addu $t2, $t2, 1 + addu $t0, $t0, 1 + j concat_loop1 + concat_loop1_end: + # Copy second string + concat_loop2: + # Compare t1 with \0 + lb $t4, 0($t1) + beqz $t4, concat_loop2_end + # Copy 1 byte + sb $t4, 0($t2) + addu $t2, $t2, 1 + addu $t1, $t1, 1 + j concat_loop2 + concat_loop2_end: + sb $zero, 0($t2) + # v0 contains resulting string + move $t1, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + sw $t1, 12($v0) + sw $t3, 16($v0) + sw $v0, -4($fp) + # RETURN local_concat_at_String_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_concat_at_String. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_substr_at_String implementation. +# @Params: +# 0($fp) = param_substr_at_String_l_0 +# 4($fp) = param_substr_at_String_r_1 +function_substr_at_String: + # Allocate stack frame for function function_substr_at_String. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_substr_at_String_internal_0 --> -4($fp) + # PARAM param_substr_at_String_l_0 --> 4($fp) + # PARAM param_substr_at_String_r_1 --> 0($fp) + lw $t0, 12($s1) + lw $t2, 4($fp) + lw $t2, 12($t2) + addu $t0, $t0, $t2 + lw $a0, 0($fp) + lw $a0, 12($a0) + move $t3, $a0 + move $t1, $a0 + addu $a0, $a0, 1 + li $v0, 9 + syscall + move $t2, $v0 + substr_loop: + beqz $t1, substr_end + lb $a0, 0($t0) + sb $a0, 0($t2) + addu $t0, $t0, 1 + addu $t2, $t2, 1 + subu $t1, $t1, 1 + j substr_loop + substr_end: + sb $zero, 0($t2) + move $t1, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + sw $t1, 12($v0) + sw $t3, 16($v0) + sw $v0, -4($fp) + # RETURN local_substr_at_String_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_substr_at_String. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 8 + jr $ra + # Function END + + +# function_length_at_String implementation. +# @Params: +function_length_at_String: + # Allocate stack frame for function function_length_at_String. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_length_at_String_internal_0 = GETATTRIBUTE length String + # LOCAL local_length_at_String_internal_0 --> -4($fp) + lw $t0, 16($s1) + sw $t0, -4($fp) + # LOCAL local_length_at_String_internal_1 --> -8($fp) + # LOCAL local_length_at_String_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + lw $t0, -4($fp) + sw $t0, 12($v0) + sw $v0, -8($fp) + # RETURN local_length_at_String_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function function_length_at_String. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# entry implementation. +# @Params: +entry: + # Allocate stack frame for function entry. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local__internal_0 --> -4($fp) + # local__internal_0 = ALLOCATE Main + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Main + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 12 bytes of memory + li $a0, 12 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Main_start + sw $t0, 4($v0) + # Load type offset + li $t0, 24 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -4($fp) + # LOCAL local__internal_0 --> -4($fp) + lw $s1, -4($fp) + # local__internal_1 = CALL main + # LOCAL local__internal_1 --> -8($fp) + # LOCAL local__internal_0 --> -4($fp) + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type's VTABLE + la $t0, Main_vtable + # Get pointer to function address + lw $t1, 24($t0) + # Call function. Result is on $v0 + jalr $t1 + sw $v0, -8($fp) + # RETURN 0 + li $v0, 0 + # Deallocate stack frame for function entry. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# __Complex__attrib__x__init implementation. +# @Params: +__Complex__attrib__x__init: + # Allocate stack frame for function __Complex__attrib__x__init. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local___attrib__x__init_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -4($fp) + # RETURN local___attrib__x__init_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function __Complex__attrib__x__init. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# __Complex__attrib__y__init implementation. +# @Params: +__Complex__attrib__y__init: + # Allocate stack frame for function __Complex__attrib__y__init. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local___attrib__y__init_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -4($fp) + # RETURN local___attrib__y__init_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function __Complex__attrib__y__init. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_init_at_Complex implementation. +# @Params: +# 0($fp) = param_init_at_Complex_a_0 +# 4($fp) = param_init_at_Complex_b_1 +function_init_at_Complex: + # Allocate stack frame for function function_init_at_Complex. + subu $sp, $sp, 36 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 36 + # local_init_at_Complex_internal_2 = GETATTRIBUTE x Complex + # LOCAL local_init_at_Complex_internal_2 --> -12($fp) + lw $t0, 12($s1) + sw $t0, -12($fp) + # IF_ZERO local_init_at_Complex_internal_2 GOTO label_FALSE_1 + # IF_ZERO local_init_at_Complex_internal_2 GOTO label_FALSE_1 + lw $t0, -12($fp) + beq $t0, 0, label_FALSE_1 + # IF_ZERO param_init_at_Complex_a_0 GOTO label_FALSE_1 + # IF_ZERO param_init_at_Complex_a_0 GOTO label_FALSE_1 + lw $t0, 4($fp) + beq $t0, 0, label_FALSE_1 + # LOCAL local_init_at_Complex_internal_1 --> -8($fp) + # LOCAL local_init_at_Complex_internal_2 --> -12($fp) + # Comparing -12($fp) type with String + la $v0, String + lw $a0, -12($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -8($fp) + # IF_ZERO local_init_at_Complex_internal_1 GOTO label_COMPARE_STRING_4 + # IF_ZERO local_init_at_Complex_internal_1 GOTO label_COMPARE_STRING_4 + lw $t0, -8($fp) + beq $t0, 0, label_COMPARE_STRING_4 + # LOCAL local_init_at_Complex_internal_1 --> -8($fp) + # LOCAL local_init_at_Complex_internal_2 --> -12($fp) + # Comparing -12($fp) type with Bool + la $v0, Bool + lw $a0, -12($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -8($fp) + # IF_ZERO local_init_at_Complex_internal_1 GOTO label_COMPARE_BY_VALUE_5 + # IF_ZERO local_init_at_Complex_internal_1 GOTO label_COMPARE_BY_VALUE_5 + lw $t0, -8($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_5 + # LOCAL local_init_at_Complex_internal_1 --> -8($fp) + # LOCAL local_init_at_Complex_internal_2 --> -12($fp) + # Comparing -12($fp) type with Int + la $v0, Int + lw $a0, -12($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -8($fp) + # IF_ZERO local_init_at_Complex_internal_1 GOTO label_COMPARE_BY_VALUE_5 + # IF_ZERO local_init_at_Complex_internal_1 GOTO label_COMPARE_BY_VALUE_5 + lw $t0, -8($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_5 + # LOCAL local_init_at_Complex_internal_1 --> -8($fp) + # LOCAL local_init_at_Complex_internal_2 --> -12($fp) + # PARAM param_init_at_Complex_a_0 --> 4($fp) + # Load pointers and SUB + lw $a0, -12($fp) + lw $a1, 4($fp) + sub $a0, $a0, $a1 + sw $a0, -8($fp) + # IF_ZERO local_init_at_Complex_internal_1 GOTO label_TRUE_2 + # IF_ZERO local_init_at_Complex_internal_1 GOTO label_TRUE_2 + lw $t0, -8($fp) + beq $t0, 0, label_TRUE_2 + # GOTO label_FALSE_1 + j label_FALSE_1 + label_COMPARE_BY_VALUE_5: + # LOCAL local_init_at_Complex_internal_1 --> -8($fp) + # LOCAL local_init_at_Complex_internal_2 --> -12($fp) + # PARAM param_init_at_Complex_a_0 --> 4($fp) + lw $a0, -12($fp) + lw $a1, 4($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -8($fp) + # IF_ZERO local_init_at_Complex_internal_1 GOTO label_TRUE_2 + # IF_ZERO local_init_at_Complex_internal_1 GOTO label_TRUE_2 + lw $t0, -8($fp) + beq $t0, 0, label_TRUE_2 + # GOTO label_FALSE_1 + j label_FALSE_1 + label_COMPARE_STRING_4: + # LOCAL local_init_at_Complex_internal_1 --> -8($fp) + # LOCAL local_init_at_Complex_internal_2 --> -12($fp) + # PARAM param_init_at_Complex_a_0 --> 4($fp) + # Load strings for comparison + lw $v0, -12($fp) + lw $v1, 4($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -8($fp) + # IF_ZERO local_init_at_Complex_internal_1 GOTO label_CONTINUE_6 + # IF_ZERO local_init_at_Complex_internal_1 GOTO label_CONTINUE_6 + lw $t0, -8($fp) + beq $t0, 0, label_CONTINUE_6 + # GOTO label_FALSE_1 + j label_FALSE_1 + label_CONTINUE_6: + # LOCAL local_init_at_Complex_internal_1 --> -8($fp) + # LOCAL local_init_at_Complex_internal_2 --> -12($fp) + # PARAM param_init_at_Complex_a_0 --> 4($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -12($fp) + lw $v1, 4($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_7: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_8 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_7 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_8: + # Store result + sw $a2, -8($fp) + # IF_ZERO local_init_at_Complex_internal_1 GOTO label_TRUE_2 + # IF_ZERO local_init_at_Complex_internal_1 GOTO label_TRUE_2 + lw $t0, -8($fp) + beq $t0, 0, label_TRUE_2 + label_FALSE_1: + # LOCAL local_init_at_Complex_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -4($fp) + # GOTO label_END_3 +j label_END_3 +label_TRUE_2: + # LOCAL local_init_at_Complex_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -4($fp) + label_END_3: +# local_init_at_Complex_internal_5 = GETATTRIBUTE y Complex +# LOCAL local_init_at_Complex_internal_5 --> -24($fp) +lw $t0, 16($s1) +sw $t0, -24($fp) +# IF_ZERO local_init_at_Complex_internal_5 GOTO label_FALSE_9 +# IF_ZERO local_init_at_Complex_internal_5 GOTO label_FALSE_9 +lw $t0, -24($fp) +beq $t0, 0, label_FALSE_9 +# IF_ZERO param_init_at_Complex_b_1 GOTO label_FALSE_9 +# IF_ZERO param_init_at_Complex_b_1 GOTO label_FALSE_9 +lw $t0, 0($fp) +beq $t0, 0, label_FALSE_9 +# LOCAL local_init_at_Complex_internal_4 --> -20($fp) +# LOCAL local_init_at_Complex_internal_5 --> -24($fp) +# Comparing -24($fp) type with String +la $v0, String +lw $a0, -24($fp) +lw $a0, 0($a0) +sub $a0, $a0, $v0 +sw $a0, -20($fp) +# IF_ZERO local_init_at_Complex_internal_4 GOTO label_COMPARE_STRING_12 +# IF_ZERO local_init_at_Complex_internal_4 GOTO label_COMPARE_STRING_12 +lw $t0, -20($fp) +beq $t0, 0, label_COMPARE_STRING_12 +# LOCAL local_init_at_Complex_internal_4 --> -20($fp) +# LOCAL local_init_at_Complex_internal_5 --> -24($fp) +# Comparing -24($fp) type with Bool +la $v0, Bool +lw $a0, -24($fp) +lw $a0, 0($a0) +lw $a0, 12($a0) +sub $a0, $a0, $v0 +sw $a0, -20($fp) +# IF_ZERO local_init_at_Complex_internal_4 GOTO label_COMPARE_BY_VALUE_13 +# IF_ZERO local_init_at_Complex_internal_4 GOTO label_COMPARE_BY_VALUE_13 +lw $t0, -20($fp) +beq $t0, 0, label_COMPARE_BY_VALUE_13 +# LOCAL local_init_at_Complex_internal_4 --> -20($fp) +# LOCAL local_init_at_Complex_internal_5 --> -24($fp) +# Comparing -24($fp) type with Int +la $v0, Int +lw $a0, -24($fp) +lw $a0, 0($a0) +lw $a0, 12($a0) +sub $a0, $a0, $v0 +sw $a0, -20($fp) +# IF_ZERO local_init_at_Complex_internal_4 GOTO label_COMPARE_BY_VALUE_13 +# IF_ZERO local_init_at_Complex_internal_4 GOTO label_COMPARE_BY_VALUE_13 +lw $t0, -20($fp) +beq $t0, 0, label_COMPARE_BY_VALUE_13 +# LOCAL local_init_at_Complex_internal_4 --> -20($fp) +# LOCAL local_init_at_Complex_internal_5 --> -24($fp) +# PARAM param_init_at_Complex_b_1 --> 0($fp) +# Load pointers and SUB +lw $a0, -24($fp) +lw $a1, 0($fp) +sub $a0, $a0, $a1 +sw $a0, -20($fp) +# IF_ZERO local_init_at_Complex_internal_4 GOTO label_TRUE_10 +# IF_ZERO local_init_at_Complex_internal_4 GOTO label_TRUE_10 +lw $t0, -20($fp) +beq $t0, 0, label_TRUE_10 +# GOTO label_FALSE_9 +j label_FALSE_9 +label_COMPARE_BY_VALUE_13: + # LOCAL local_init_at_Complex_internal_4 --> -20($fp) + # LOCAL local_init_at_Complex_internal_5 --> -24($fp) + # PARAM param_init_at_Complex_b_1 --> 0($fp) + lw $a0, -24($fp) + lw $a1, 0($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -20($fp) + # IF_ZERO local_init_at_Complex_internal_4 GOTO label_TRUE_10 + # IF_ZERO local_init_at_Complex_internal_4 GOTO label_TRUE_10 + lw $t0, -20($fp) + beq $t0, 0, label_TRUE_10 + # GOTO label_FALSE_9 + j label_FALSE_9 + label_COMPARE_STRING_12: + # LOCAL local_init_at_Complex_internal_4 --> -20($fp) + # LOCAL local_init_at_Complex_internal_5 --> -24($fp) + # PARAM param_init_at_Complex_b_1 --> 0($fp) + # Load strings for comparison + lw $v0, -24($fp) + lw $v1, 0($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -20($fp) + # IF_ZERO local_init_at_Complex_internal_4 GOTO label_CONTINUE_14 + # IF_ZERO local_init_at_Complex_internal_4 GOTO label_CONTINUE_14 + lw $t0, -20($fp) + beq $t0, 0, label_CONTINUE_14 + # GOTO label_FALSE_9 + j label_FALSE_9 + label_CONTINUE_14: + # LOCAL local_init_at_Complex_internal_4 --> -20($fp) + # LOCAL local_init_at_Complex_internal_5 --> -24($fp) + # PARAM param_init_at_Complex_b_1 --> 0($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -24($fp) + lw $v1, 0($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_15: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_16 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_15 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_16: + # Store result + sw $a2, -20($fp) + # IF_ZERO local_init_at_Complex_internal_4 GOTO label_TRUE_10 + # IF_ZERO local_init_at_Complex_internal_4 GOTO label_TRUE_10 + lw $t0, -20($fp) + beq $t0, 0, label_TRUE_10 + label_FALSE_9: + # LOCAL local_init_at_Complex_internal_3 --> -16($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -16($fp) + # GOTO label_END_11 +j label_END_11 +label_TRUE_10: + # LOCAL local_init_at_Complex_internal_3 --> -16($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -16($fp) + label_END_11: +# LOCAL local_init_at_Complex_internal_6 --> -28($fp) +# local_init_at_Complex_internal_6 = SELF +sw $s1, -28($fp) +# RETURN local_init_at_Complex_internal_6 +lw $v0, -28($fp) +# Deallocate stack frame for function function_init_at_Complex. +# Restore $ra +lw $ra, 4($sp) +# Restore $fp +lw $fp, 0($sp) +# Restore Stack pointer $sp +addu $sp, $sp, 36 +# Deallocate function args +addu $sp, $sp, 8 +jr $ra +# Function END + + +# function_print_at_Complex implementation. +# @Params: +function_print_at_Complex: + # Allocate stack frame for function function_print_at_Complex. + subu $sp, $sp, 100 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 100 + # local_print_at_Complex_internal_4 = GETATTRIBUTE y Complex + # LOCAL local_print_at_Complex_internal_4 --> -20($fp) + lw $t0, 16($s1) + sw $t0, -20($fp) + # LOCAL local_print_at_Complex_internal_5 --> -24($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -24($fp) + # IF_ZERO local_print_at_Complex_internal_4 GOTO label_FALSE_19 + # IF_ZERO local_print_at_Complex_internal_4 GOTO label_FALSE_19 + lw $t0, -20($fp) + beq $t0, 0, label_FALSE_19 + # IF_ZERO local_print_at_Complex_internal_5 GOTO label_FALSE_19 + # IF_ZERO local_print_at_Complex_internal_5 GOTO label_FALSE_19 + lw $t0, -24($fp) + beq $t0, 0, label_FALSE_19 + # LOCAL local_print_at_Complex_internal_3 --> -16($fp) + # LOCAL local_print_at_Complex_internal_4 --> -20($fp) + # Comparing -20($fp) type with String + la $v0, String + lw $a0, -20($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -16($fp) + # IF_ZERO local_print_at_Complex_internal_3 GOTO label_COMPARE_STRING_22 + # IF_ZERO local_print_at_Complex_internal_3 GOTO label_COMPARE_STRING_22 + lw $t0, -16($fp) + beq $t0, 0, label_COMPARE_STRING_22 + # LOCAL local_print_at_Complex_internal_3 --> -16($fp) + # LOCAL local_print_at_Complex_internal_4 --> -20($fp) + # Comparing -20($fp) type with Bool + la $v0, Bool + lw $a0, -20($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -16($fp) + # IF_ZERO local_print_at_Complex_internal_3 GOTO label_COMPARE_BY_VALUE_23 + # IF_ZERO local_print_at_Complex_internal_3 GOTO label_COMPARE_BY_VALUE_23 + lw $t0, -16($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_23 + # LOCAL local_print_at_Complex_internal_3 --> -16($fp) + # LOCAL local_print_at_Complex_internal_4 --> -20($fp) + # Comparing -20($fp) type with Int + la $v0, Int + lw $a0, -20($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -16($fp) + # IF_ZERO local_print_at_Complex_internal_3 GOTO label_COMPARE_BY_VALUE_23 + # IF_ZERO local_print_at_Complex_internal_3 GOTO label_COMPARE_BY_VALUE_23 + lw $t0, -16($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_23 + # LOCAL local_print_at_Complex_internal_3 --> -16($fp) + # LOCAL local_print_at_Complex_internal_4 --> -20($fp) + # LOCAL local_print_at_Complex_internal_5 --> -24($fp) + # Load pointers and SUB + lw $a0, -20($fp) + lw $a1, -24($fp) + sub $a0, $a0, $a1 + sw $a0, -16($fp) + # IF_ZERO local_print_at_Complex_internal_3 GOTO label_TRUE_20 + # IF_ZERO local_print_at_Complex_internal_3 GOTO label_TRUE_20 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_20 + # GOTO label_FALSE_19 + j label_FALSE_19 + label_COMPARE_BY_VALUE_23: + # LOCAL local_print_at_Complex_internal_3 --> -16($fp) + # LOCAL local_print_at_Complex_internal_4 --> -20($fp) + # LOCAL local_print_at_Complex_internal_5 --> -24($fp) + lw $a0, -20($fp) + lw $a1, -24($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -16($fp) + # IF_ZERO local_print_at_Complex_internal_3 GOTO label_TRUE_20 + # IF_ZERO local_print_at_Complex_internal_3 GOTO label_TRUE_20 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_20 + # GOTO label_FALSE_19 + j label_FALSE_19 + label_COMPARE_STRING_22: + # LOCAL local_print_at_Complex_internal_3 --> -16($fp) + # LOCAL local_print_at_Complex_internal_4 --> -20($fp) + # LOCAL local_print_at_Complex_internal_5 --> -24($fp) + # Load strings for comparison + lw $v0, -20($fp) + lw $v1, -24($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -16($fp) + # IF_ZERO local_print_at_Complex_internal_3 GOTO label_CONTINUE_24 + # IF_ZERO local_print_at_Complex_internal_3 GOTO label_CONTINUE_24 + lw $t0, -16($fp) + beq $t0, 0, label_CONTINUE_24 + # GOTO label_FALSE_19 + j label_FALSE_19 + label_CONTINUE_24: + # LOCAL local_print_at_Complex_internal_3 --> -16($fp) + # LOCAL local_print_at_Complex_internal_4 --> -20($fp) + # LOCAL local_print_at_Complex_internal_5 --> -24($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -20($fp) + lw $v1, -24($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_25: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_26 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_25 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_26: + # Store result + sw $a2, -16($fp) + # IF_ZERO local_print_at_Complex_internal_3 GOTO label_TRUE_20 + # IF_ZERO local_print_at_Complex_internal_3 GOTO label_TRUE_20 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_20 + label_FALSE_19: + # LOCAL local_print_at_Complex_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -12($fp) + # GOTO label_END_21 +j label_END_21 +label_TRUE_20: + # LOCAL local_print_at_Complex_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -12($fp) + label_END_21: +# LOCAL local_print_at_Complex_internal_0 --> -4($fp) +# LOCAL local_print_at_Complex_internal_2 --> -12($fp) +# Obtain value from -12($fp) +lw $v0, -12($fp) +lw $v0, 12($v0) +sw $v0, -4($fp) +# IF_ZERO local_print_at_Complex_internal_0 GOTO label_FALSEIF_17 +# IF_ZERO local_print_at_Complex_internal_0 GOTO label_FALSEIF_17 +lw $t0, -4($fp) +beq $t0, 0, label_FALSEIF_17 +# LOCAL local_print_at_Complex_internal_8 --> -36($fp) +# local_print_at_Complex_internal_8 = SELF +sw $s1, -36($fp) +# LOCAL local_print_at_Complex_internal_6 --> -28($fp) +# LOCAL local_print_at_Complex_internal_8 --> -36($fp) +# local_print_at_Complex_internal_6 = local_print_at_Complex_internal_8 +lw $t0, -36($fp) +sw $t0, -28($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# local_print_at_Complex_internal_9 = GETATTRIBUTE x Complex +# LOCAL local_print_at_Complex_internal_9 --> -40($fp) +lw $t0, 12($s1) +sw $t0, -40($fp) +# ARG local_print_at_Complex_internal_9 +# LOCAL local_print_at_Complex_internal_9 --> -40($fp) +lw $t0, -40($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_print_at_Complex_internal_6 --> -28($fp) +# LOCAL local_print_at_Complex_internal_7 --> -32($fp) +# local_print_at_Complex_internal_7 = VCALL local_print_at_Complex_internal_6 out_int +# Save new self pointer in $s1 +lw $s1, -28($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 4($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -32($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_print_at_Complex_internal_1 --> -8($fp) +# LOCAL local_print_at_Complex_internal_7 --> -32($fp) +# local_print_at_Complex_internal_1 = local_print_at_Complex_internal_7 +lw $t0, -32($fp) +sw $t0, -8($fp) +# GOTO label_ENDIF_18 +j label_ENDIF_18 +label_FALSEIF_17: + # LOCAL local_print_at_Complex_internal_18 --> -76($fp) + # local_print_at_Complex_internal_18 = SELF + sw $s1, -76($fp) + # LOCAL local_print_at_Complex_internal_16 --> -68($fp) + # LOCAL local_print_at_Complex_internal_18 --> -76($fp) + # local_print_at_Complex_internal_16 = local_print_at_Complex_internal_18 + lw $t0, -76($fp) + sw $t0, -68($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # local_print_at_Complex_internal_19 = GETATTRIBUTE x Complex + # LOCAL local_print_at_Complex_internal_19 --> -80($fp) + lw $t0, 12($s1) + sw $t0, -80($fp) + # ARG local_print_at_Complex_internal_19 + # LOCAL local_print_at_Complex_internal_19 --> -80($fp) + lw $t0, -80($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_print_at_Complex_internal_16 --> -68($fp) + # LOCAL local_print_at_Complex_internal_17 --> -72($fp) + # local_print_at_Complex_internal_17 = VCALL local_print_at_Complex_internal_16 out_int + # Save new self pointer in $s1 + lw $s1, -68($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 4($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -72($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_print_at_Complex_internal_14 --> -60($fp) + # LOCAL local_print_at_Complex_internal_17 --> -72($fp) + # local_print_at_Complex_internal_14 = local_print_at_Complex_internal_17 + lw $t0, -72($fp) + sw $t0, -60($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_print_at_Complex_internal_20 --> -84($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_4 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -84($fp) + # ARG local_print_at_Complex_internal_20 + # LOCAL local_print_at_Complex_internal_20 --> -84($fp) + lw $t0, -84($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_print_at_Complex_internal_14 --> -60($fp) + # LOCAL local_print_at_Complex_internal_15 --> -64($fp) + # local_print_at_Complex_internal_15 = VCALL local_print_at_Complex_internal_14 out_string + # Save new self pointer in $s1 + lw $s1, -60($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 56($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -64($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_print_at_Complex_internal_12 --> -52($fp) + # LOCAL local_print_at_Complex_internal_15 --> -64($fp) + # local_print_at_Complex_internal_12 = local_print_at_Complex_internal_15 + lw $t0, -64($fp) + sw $t0, -52($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # local_print_at_Complex_internal_21 = GETATTRIBUTE y Complex + # LOCAL local_print_at_Complex_internal_21 --> -88($fp) + lw $t0, 16($s1) + sw $t0, -88($fp) + # ARG local_print_at_Complex_internal_21 + # LOCAL local_print_at_Complex_internal_21 --> -88($fp) + lw $t0, -88($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_print_at_Complex_internal_12 --> -52($fp) + # LOCAL local_print_at_Complex_internal_13 --> -56($fp) + # local_print_at_Complex_internal_13 = VCALL local_print_at_Complex_internal_12 out_int + # Save new self pointer in $s1 + lw $s1, -52($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 4($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -56($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_print_at_Complex_internal_10 --> -44($fp) + # LOCAL local_print_at_Complex_internal_13 --> -56($fp) + # local_print_at_Complex_internal_10 = local_print_at_Complex_internal_13 + lw $t0, -56($fp) + sw $t0, -44($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_print_at_Complex_internal_22 --> -92($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_5 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -92($fp) + # ARG local_print_at_Complex_internal_22 + # LOCAL local_print_at_Complex_internal_22 --> -92($fp) + lw $t0, -92($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_print_at_Complex_internal_10 --> -44($fp) + # LOCAL local_print_at_Complex_internal_11 --> -48($fp) + # local_print_at_Complex_internal_11 = VCALL local_print_at_Complex_internal_10 out_string + # Save new self pointer in $s1 + lw $s1, -44($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 56($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -48($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_print_at_Complex_internal_1 --> -8($fp) + # LOCAL local_print_at_Complex_internal_11 --> -48($fp) + # local_print_at_Complex_internal_1 = local_print_at_Complex_internal_11 + lw $t0, -48($fp) + sw $t0, -8($fp) + label_ENDIF_18: +# RETURN local_print_at_Complex_internal_1 +lw $v0, -8($fp) +# Deallocate stack frame for function function_print_at_Complex. +# Restore $ra +lw $ra, 4($sp) +# Restore $fp +lw $fp, 0($sp) +# Restore Stack pointer $sp +addu $sp, $sp, 100 +jr $ra +# Function END + + +# function_reflect_0_at_Complex implementation. +# @Params: +function_reflect_0_at_Complex: + # Allocate stack frame for function function_reflect_0_at_Complex. + subu $sp, $sp, 52 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 52 + # local_reflect_0_at_Complex_internal_2 = GETATTRIBUTE x Complex + # LOCAL local_reflect_0_at_Complex_internal_2 --> -12($fp) + lw $t0, 12($s1) + sw $t0, -12($fp) + # local_reflect_0_at_Complex_internal_4 = GETATTRIBUTE x Complex + # LOCAL local_reflect_0_at_Complex_internal_4 --> -20($fp) + lw $t0, 12($s1) + sw $t0, -20($fp) + # LOCAL local_reflect_0_at_Complex_internal_3 --> -16($fp) + # LOCAL local_reflect_0_at_Complex_internal_4 --> -20($fp) + lw $t0, -20($fp) + lw $t0, 12($t0) + not $t0, $t0 + add $t0, $t0, 1 + sw $t0, -16($fp) + # LOCAL local_reflect_0_at_Complex_internal_3 --> -16($fp) + # LOCAL local_reflect_0_at_Complex_internal_3 --> -16($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + lw $t0, -16($fp) + sw $t0, 12($v0) + sw $v0, -16($fp) + # IF_ZERO local_reflect_0_at_Complex_internal_2 GOTO label_FALSE_27 + # IF_ZERO local_reflect_0_at_Complex_internal_2 GOTO label_FALSE_27 + lw $t0, -12($fp) + beq $t0, 0, label_FALSE_27 + # IF_ZERO local_reflect_0_at_Complex_internal_3 GOTO label_FALSE_27 + # IF_ZERO local_reflect_0_at_Complex_internal_3 GOTO label_FALSE_27 + lw $t0, -16($fp) + beq $t0, 0, label_FALSE_27 + # LOCAL local_reflect_0_at_Complex_internal_1 --> -8($fp) + # LOCAL local_reflect_0_at_Complex_internal_2 --> -12($fp) + # Comparing -12($fp) type with String + la $v0, String + lw $a0, -12($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -8($fp) + # IF_ZERO local_reflect_0_at_Complex_internal_1 GOTO label_COMPARE_STRING_30 + # IF_ZERO local_reflect_0_at_Complex_internal_1 GOTO label_COMPARE_STRING_30 + lw $t0, -8($fp) + beq $t0, 0, label_COMPARE_STRING_30 + # LOCAL local_reflect_0_at_Complex_internal_1 --> -8($fp) + # LOCAL local_reflect_0_at_Complex_internal_2 --> -12($fp) + # Comparing -12($fp) type with Bool + la $v0, Bool + lw $a0, -12($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -8($fp) + # IF_ZERO local_reflect_0_at_Complex_internal_1 GOTO label_COMPARE_BY_VALUE_31 + # IF_ZERO local_reflect_0_at_Complex_internal_1 GOTO label_COMPARE_BY_VALUE_31 + lw $t0, -8($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_31 + # LOCAL local_reflect_0_at_Complex_internal_1 --> -8($fp) + # LOCAL local_reflect_0_at_Complex_internal_2 --> -12($fp) + # Comparing -12($fp) type with Int + la $v0, Int + lw $a0, -12($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -8($fp) + # IF_ZERO local_reflect_0_at_Complex_internal_1 GOTO label_COMPARE_BY_VALUE_31 + # IF_ZERO local_reflect_0_at_Complex_internal_1 GOTO label_COMPARE_BY_VALUE_31 + lw $t0, -8($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_31 + # LOCAL local_reflect_0_at_Complex_internal_1 --> -8($fp) + # LOCAL local_reflect_0_at_Complex_internal_2 --> -12($fp) + # LOCAL local_reflect_0_at_Complex_internal_3 --> -16($fp) + # Load pointers and SUB + lw $a0, -12($fp) + lw $a1, -16($fp) + sub $a0, $a0, $a1 + sw $a0, -8($fp) + # IF_ZERO local_reflect_0_at_Complex_internal_1 GOTO label_TRUE_28 + # IF_ZERO local_reflect_0_at_Complex_internal_1 GOTO label_TRUE_28 + lw $t0, -8($fp) + beq $t0, 0, label_TRUE_28 + # GOTO label_FALSE_27 + j label_FALSE_27 + label_COMPARE_BY_VALUE_31: + # LOCAL local_reflect_0_at_Complex_internal_1 --> -8($fp) + # LOCAL local_reflect_0_at_Complex_internal_2 --> -12($fp) + # LOCAL local_reflect_0_at_Complex_internal_3 --> -16($fp) + lw $a0, -12($fp) + lw $a1, -16($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -8($fp) + # IF_ZERO local_reflect_0_at_Complex_internal_1 GOTO label_TRUE_28 + # IF_ZERO local_reflect_0_at_Complex_internal_1 GOTO label_TRUE_28 + lw $t0, -8($fp) + beq $t0, 0, label_TRUE_28 + # GOTO label_FALSE_27 + j label_FALSE_27 + label_COMPARE_STRING_30: + # LOCAL local_reflect_0_at_Complex_internal_1 --> -8($fp) + # LOCAL local_reflect_0_at_Complex_internal_2 --> -12($fp) + # LOCAL local_reflect_0_at_Complex_internal_3 --> -16($fp) + # Load strings for comparison + lw $v0, -12($fp) + lw $v1, -16($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -8($fp) + # IF_ZERO local_reflect_0_at_Complex_internal_1 GOTO label_CONTINUE_32 + # IF_ZERO local_reflect_0_at_Complex_internal_1 GOTO label_CONTINUE_32 + lw $t0, -8($fp) + beq $t0, 0, label_CONTINUE_32 + # GOTO label_FALSE_27 + j label_FALSE_27 + label_CONTINUE_32: + # LOCAL local_reflect_0_at_Complex_internal_1 --> -8($fp) + # LOCAL local_reflect_0_at_Complex_internal_2 --> -12($fp) + # LOCAL local_reflect_0_at_Complex_internal_3 --> -16($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -12($fp) + lw $v1, -16($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_33: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_34 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_33 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_34: + # Store result + sw $a2, -8($fp) + # IF_ZERO local_reflect_0_at_Complex_internal_1 GOTO label_TRUE_28 + # IF_ZERO local_reflect_0_at_Complex_internal_1 GOTO label_TRUE_28 + lw $t0, -8($fp) + beq $t0, 0, label_TRUE_28 + label_FALSE_27: + # LOCAL local_reflect_0_at_Complex_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -4($fp) + # GOTO label_END_29 +j label_END_29 +label_TRUE_28: + # LOCAL local_reflect_0_at_Complex_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -4($fp) + label_END_29: +# local_reflect_0_at_Complex_internal_7 = GETATTRIBUTE y Complex +# LOCAL local_reflect_0_at_Complex_internal_7 --> -32($fp) +lw $t0, 16($s1) +sw $t0, -32($fp) +# local_reflect_0_at_Complex_internal_9 = GETATTRIBUTE y Complex +# LOCAL local_reflect_0_at_Complex_internal_9 --> -40($fp) +lw $t0, 16($s1) +sw $t0, -40($fp) +# LOCAL local_reflect_0_at_Complex_internal_8 --> -36($fp) +# LOCAL local_reflect_0_at_Complex_internal_9 --> -40($fp) +lw $t0, -40($fp) +lw $t0, 12($t0) +not $t0, $t0 +add $t0, $t0, 1 +sw $t0, -36($fp) +# LOCAL local_reflect_0_at_Complex_internal_8 --> -36($fp) +# LOCAL local_reflect_0_at_Complex_internal_8 --> -36($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +lw $t0, -36($fp) +sw $t0, 12($v0) +sw $v0, -36($fp) +# IF_ZERO local_reflect_0_at_Complex_internal_7 GOTO label_FALSE_35 +# IF_ZERO local_reflect_0_at_Complex_internal_7 GOTO label_FALSE_35 +lw $t0, -32($fp) +beq $t0, 0, label_FALSE_35 +# IF_ZERO local_reflect_0_at_Complex_internal_8 GOTO label_FALSE_35 +# IF_ZERO local_reflect_0_at_Complex_internal_8 GOTO label_FALSE_35 +lw $t0, -36($fp) +beq $t0, 0, label_FALSE_35 +# LOCAL local_reflect_0_at_Complex_internal_6 --> -28($fp) +# LOCAL local_reflect_0_at_Complex_internal_7 --> -32($fp) +# Comparing -32($fp) type with String +la $v0, String +lw $a0, -32($fp) +lw $a0, 0($a0) +sub $a0, $a0, $v0 +sw $a0, -28($fp) +# IF_ZERO local_reflect_0_at_Complex_internal_6 GOTO label_COMPARE_STRING_38 +# IF_ZERO local_reflect_0_at_Complex_internal_6 GOTO label_COMPARE_STRING_38 +lw $t0, -28($fp) +beq $t0, 0, label_COMPARE_STRING_38 +# LOCAL local_reflect_0_at_Complex_internal_6 --> -28($fp) +# LOCAL local_reflect_0_at_Complex_internal_7 --> -32($fp) +# Comparing -32($fp) type with Bool +la $v0, Bool +lw $a0, -32($fp) +lw $a0, 0($a0) +lw $a0, 12($a0) +sub $a0, $a0, $v0 +sw $a0, -28($fp) +# IF_ZERO local_reflect_0_at_Complex_internal_6 GOTO label_COMPARE_BY_VALUE_39 +# IF_ZERO local_reflect_0_at_Complex_internal_6 GOTO label_COMPARE_BY_VALUE_39 +lw $t0, -28($fp) +beq $t0, 0, label_COMPARE_BY_VALUE_39 +# LOCAL local_reflect_0_at_Complex_internal_6 --> -28($fp) +# LOCAL local_reflect_0_at_Complex_internal_7 --> -32($fp) +# Comparing -32($fp) type with Int +la $v0, Int +lw $a0, -32($fp) +lw $a0, 0($a0) +lw $a0, 12($a0) +sub $a0, $a0, $v0 +sw $a0, -28($fp) +# IF_ZERO local_reflect_0_at_Complex_internal_6 GOTO label_COMPARE_BY_VALUE_39 +# IF_ZERO local_reflect_0_at_Complex_internal_6 GOTO label_COMPARE_BY_VALUE_39 +lw $t0, -28($fp) +beq $t0, 0, label_COMPARE_BY_VALUE_39 +# LOCAL local_reflect_0_at_Complex_internal_6 --> -28($fp) +# LOCAL local_reflect_0_at_Complex_internal_7 --> -32($fp) +# LOCAL local_reflect_0_at_Complex_internal_8 --> -36($fp) +# Load pointers and SUB +lw $a0, -32($fp) +lw $a1, -36($fp) +sub $a0, $a0, $a1 +sw $a0, -28($fp) +# IF_ZERO local_reflect_0_at_Complex_internal_6 GOTO label_TRUE_36 +# IF_ZERO local_reflect_0_at_Complex_internal_6 GOTO label_TRUE_36 +lw $t0, -28($fp) +beq $t0, 0, label_TRUE_36 +# GOTO label_FALSE_35 +j label_FALSE_35 +label_COMPARE_BY_VALUE_39: + # LOCAL local_reflect_0_at_Complex_internal_6 --> -28($fp) + # LOCAL local_reflect_0_at_Complex_internal_7 --> -32($fp) + # LOCAL local_reflect_0_at_Complex_internal_8 --> -36($fp) + lw $a0, -32($fp) + lw $a1, -36($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -28($fp) + # IF_ZERO local_reflect_0_at_Complex_internal_6 GOTO label_TRUE_36 + # IF_ZERO local_reflect_0_at_Complex_internal_6 GOTO label_TRUE_36 + lw $t0, -28($fp) + beq $t0, 0, label_TRUE_36 + # GOTO label_FALSE_35 + j label_FALSE_35 + label_COMPARE_STRING_38: + # LOCAL local_reflect_0_at_Complex_internal_6 --> -28($fp) + # LOCAL local_reflect_0_at_Complex_internal_7 --> -32($fp) + # LOCAL local_reflect_0_at_Complex_internal_8 --> -36($fp) + # Load strings for comparison + lw $v0, -32($fp) + lw $v1, -36($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -28($fp) + # IF_ZERO local_reflect_0_at_Complex_internal_6 GOTO label_CONTINUE_40 + # IF_ZERO local_reflect_0_at_Complex_internal_6 GOTO label_CONTINUE_40 + lw $t0, -28($fp) + beq $t0, 0, label_CONTINUE_40 + # GOTO label_FALSE_35 + j label_FALSE_35 + label_CONTINUE_40: + # LOCAL local_reflect_0_at_Complex_internal_6 --> -28($fp) + # LOCAL local_reflect_0_at_Complex_internal_7 --> -32($fp) + # LOCAL local_reflect_0_at_Complex_internal_8 --> -36($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -32($fp) + lw $v1, -36($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_41: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_42 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_41 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_42: + # Store result + sw $a2, -28($fp) + # IF_ZERO local_reflect_0_at_Complex_internal_6 GOTO label_TRUE_36 + # IF_ZERO local_reflect_0_at_Complex_internal_6 GOTO label_TRUE_36 + lw $t0, -28($fp) + beq $t0, 0, label_TRUE_36 + label_FALSE_35: + # LOCAL local_reflect_0_at_Complex_internal_5 --> -24($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -24($fp) + # GOTO label_END_37 +j label_END_37 +label_TRUE_36: + # LOCAL local_reflect_0_at_Complex_internal_5 --> -24($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -24($fp) + label_END_37: +# LOCAL local_reflect_0_at_Complex_internal_10 --> -44($fp) +# local_reflect_0_at_Complex_internal_10 = SELF +sw $s1, -44($fp) +# RETURN local_reflect_0_at_Complex_internal_10 +lw $v0, -44($fp) +# Deallocate stack frame for function function_reflect_0_at_Complex. +# Restore $ra +lw $ra, 4($sp) +# Restore $fp +lw $fp, 0($sp) +# Restore Stack pointer $sp +addu $sp, $sp, 52 +jr $ra +# Function END + + +# function_reflect_X_at_Complex implementation. +# @Params: +function_reflect_X_at_Complex: + # Allocate stack frame for function function_reflect_X_at_Complex. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_reflect_X_at_Complex_internal_2 = GETATTRIBUTE y Complex + # LOCAL local_reflect_X_at_Complex_internal_2 --> -12($fp) + lw $t0, 16($s1) + sw $t0, -12($fp) + # local_reflect_X_at_Complex_internal_4 = GETATTRIBUTE y Complex + # LOCAL local_reflect_X_at_Complex_internal_4 --> -20($fp) + lw $t0, 16($s1) + sw $t0, -20($fp) + # LOCAL local_reflect_X_at_Complex_internal_3 --> -16($fp) + # LOCAL local_reflect_X_at_Complex_internal_4 --> -20($fp) + lw $t0, -20($fp) + lw $t0, 12($t0) + not $t0, $t0 + add $t0, $t0, 1 + sw $t0, -16($fp) + # LOCAL local_reflect_X_at_Complex_internal_3 --> -16($fp) + # LOCAL local_reflect_X_at_Complex_internal_3 --> -16($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + lw $t0, -16($fp) + sw $t0, 12($v0) + sw $v0, -16($fp) + # IF_ZERO local_reflect_X_at_Complex_internal_2 GOTO label_FALSE_43 + # IF_ZERO local_reflect_X_at_Complex_internal_2 GOTO label_FALSE_43 + lw $t0, -12($fp) + beq $t0, 0, label_FALSE_43 + # IF_ZERO local_reflect_X_at_Complex_internal_3 GOTO label_FALSE_43 + # IF_ZERO local_reflect_X_at_Complex_internal_3 GOTO label_FALSE_43 + lw $t0, -16($fp) + beq $t0, 0, label_FALSE_43 + # LOCAL local_reflect_X_at_Complex_internal_1 --> -8($fp) + # LOCAL local_reflect_X_at_Complex_internal_2 --> -12($fp) + # Comparing -12($fp) type with String + la $v0, String + lw $a0, -12($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -8($fp) + # IF_ZERO local_reflect_X_at_Complex_internal_1 GOTO label_COMPARE_STRING_46 + # IF_ZERO local_reflect_X_at_Complex_internal_1 GOTO label_COMPARE_STRING_46 + lw $t0, -8($fp) + beq $t0, 0, label_COMPARE_STRING_46 + # LOCAL local_reflect_X_at_Complex_internal_1 --> -8($fp) + # LOCAL local_reflect_X_at_Complex_internal_2 --> -12($fp) + # Comparing -12($fp) type with Bool + la $v0, Bool + lw $a0, -12($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -8($fp) + # IF_ZERO local_reflect_X_at_Complex_internal_1 GOTO label_COMPARE_BY_VALUE_47 + # IF_ZERO local_reflect_X_at_Complex_internal_1 GOTO label_COMPARE_BY_VALUE_47 + lw $t0, -8($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_47 + # LOCAL local_reflect_X_at_Complex_internal_1 --> -8($fp) + # LOCAL local_reflect_X_at_Complex_internal_2 --> -12($fp) + # Comparing -12($fp) type with Int + la $v0, Int + lw $a0, -12($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -8($fp) + # IF_ZERO local_reflect_X_at_Complex_internal_1 GOTO label_COMPARE_BY_VALUE_47 + # IF_ZERO local_reflect_X_at_Complex_internal_1 GOTO label_COMPARE_BY_VALUE_47 + lw $t0, -8($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_47 + # LOCAL local_reflect_X_at_Complex_internal_1 --> -8($fp) + # LOCAL local_reflect_X_at_Complex_internal_2 --> -12($fp) + # LOCAL local_reflect_X_at_Complex_internal_3 --> -16($fp) + # Load pointers and SUB + lw $a0, -12($fp) + lw $a1, -16($fp) + sub $a0, $a0, $a1 + sw $a0, -8($fp) + # IF_ZERO local_reflect_X_at_Complex_internal_1 GOTO label_TRUE_44 + # IF_ZERO local_reflect_X_at_Complex_internal_1 GOTO label_TRUE_44 + lw $t0, -8($fp) + beq $t0, 0, label_TRUE_44 + # GOTO label_FALSE_43 + j label_FALSE_43 + label_COMPARE_BY_VALUE_47: + # LOCAL local_reflect_X_at_Complex_internal_1 --> -8($fp) + # LOCAL local_reflect_X_at_Complex_internal_2 --> -12($fp) + # LOCAL local_reflect_X_at_Complex_internal_3 --> -16($fp) + lw $a0, -12($fp) + lw $a1, -16($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -8($fp) + # IF_ZERO local_reflect_X_at_Complex_internal_1 GOTO label_TRUE_44 + # IF_ZERO local_reflect_X_at_Complex_internal_1 GOTO label_TRUE_44 + lw $t0, -8($fp) + beq $t0, 0, label_TRUE_44 + # GOTO label_FALSE_43 + j label_FALSE_43 + label_COMPARE_STRING_46: + # LOCAL local_reflect_X_at_Complex_internal_1 --> -8($fp) + # LOCAL local_reflect_X_at_Complex_internal_2 --> -12($fp) + # LOCAL local_reflect_X_at_Complex_internal_3 --> -16($fp) + # Load strings for comparison + lw $v0, -12($fp) + lw $v1, -16($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -8($fp) + # IF_ZERO local_reflect_X_at_Complex_internal_1 GOTO label_CONTINUE_48 + # IF_ZERO local_reflect_X_at_Complex_internal_1 GOTO label_CONTINUE_48 + lw $t0, -8($fp) + beq $t0, 0, label_CONTINUE_48 + # GOTO label_FALSE_43 + j label_FALSE_43 + label_CONTINUE_48: + # LOCAL local_reflect_X_at_Complex_internal_1 --> -8($fp) + # LOCAL local_reflect_X_at_Complex_internal_2 --> -12($fp) + # LOCAL local_reflect_X_at_Complex_internal_3 --> -16($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -12($fp) + lw $v1, -16($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_49: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_50 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_49 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_50: + # Store result + sw $a2, -8($fp) + # IF_ZERO local_reflect_X_at_Complex_internal_1 GOTO label_TRUE_44 + # IF_ZERO local_reflect_X_at_Complex_internal_1 GOTO label_TRUE_44 + lw $t0, -8($fp) + beq $t0, 0, label_TRUE_44 + label_FALSE_43: + # LOCAL local_reflect_X_at_Complex_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -4($fp) + # GOTO label_END_45 +j label_END_45 +label_TRUE_44: + # LOCAL local_reflect_X_at_Complex_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -4($fp) + label_END_45: +# LOCAL local_reflect_X_at_Complex_internal_5 --> -24($fp) +# local_reflect_X_at_Complex_internal_5 = SELF +sw $s1, -24($fp) +# RETURN local_reflect_X_at_Complex_internal_5 +lw $v0, -24($fp) +# Deallocate stack frame for function function_reflect_X_at_Complex. +# Restore $ra +lw $ra, 4($sp) +# Restore $fp +lw $fp, 0($sp) +# Restore Stack pointer $sp +addu $sp, $sp, 32 +jr $ra +# Function END + + +# function_reflect_Y_at_Complex implementation. +# @Params: +function_reflect_Y_at_Complex: + # Allocate stack frame for function function_reflect_Y_at_Complex. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_reflect_Y_at_Complex_internal_2 = GETATTRIBUTE x Complex + # LOCAL local_reflect_Y_at_Complex_internal_2 --> -12($fp) + lw $t0, 12($s1) + sw $t0, -12($fp) + # local_reflect_Y_at_Complex_internal_4 = GETATTRIBUTE x Complex + # LOCAL local_reflect_Y_at_Complex_internal_4 --> -20($fp) + lw $t0, 12($s1) + sw $t0, -20($fp) + # LOCAL local_reflect_Y_at_Complex_internal_3 --> -16($fp) + # LOCAL local_reflect_Y_at_Complex_internal_4 --> -20($fp) + lw $t0, -20($fp) + lw $t0, 12($t0) + not $t0, $t0 + add $t0, $t0, 1 + sw $t0, -16($fp) + # LOCAL local_reflect_Y_at_Complex_internal_3 --> -16($fp) + # LOCAL local_reflect_Y_at_Complex_internal_3 --> -16($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + lw $t0, -16($fp) + sw $t0, 12($v0) + sw $v0, -16($fp) + # IF_ZERO local_reflect_Y_at_Complex_internal_2 GOTO label_FALSE_51 + # IF_ZERO local_reflect_Y_at_Complex_internal_2 GOTO label_FALSE_51 + lw $t0, -12($fp) + beq $t0, 0, label_FALSE_51 + # IF_ZERO local_reflect_Y_at_Complex_internal_3 GOTO label_FALSE_51 + # IF_ZERO local_reflect_Y_at_Complex_internal_3 GOTO label_FALSE_51 + lw $t0, -16($fp) + beq $t0, 0, label_FALSE_51 + # LOCAL local_reflect_Y_at_Complex_internal_1 --> -8($fp) + # LOCAL local_reflect_Y_at_Complex_internal_2 --> -12($fp) + # Comparing -12($fp) type with String + la $v0, String + lw $a0, -12($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -8($fp) + # IF_ZERO local_reflect_Y_at_Complex_internal_1 GOTO label_COMPARE_STRING_54 + # IF_ZERO local_reflect_Y_at_Complex_internal_1 GOTO label_COMPARE_STRING_54 + lw $t0, -8($fp) + beq $t0, 0, label_COMPARE_STRING_54 + # LOCAL local_reflect_Y_at_Complex_internal_1 --> -8($fp) + # LOCAL local_reflect_Y_at_Complex_internal_2 --> -12($fp) + # Comparing -12($fp) type with Bool + la $v0, Bool + lw $a0, -12($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -8($fp) + # IF_ZERO local_reflect_Y_at_Complex_internal_1 GOTO label_COMPARE_BY_VALUE_55 + # IF_ZERO local_reflect_Y_at_Complex_internal_1 GOTO label_COMPARE_BY_VALUE_55 + lw $t0, -8($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_55 + # LOCAL local_reflect_Y_at_Complex_internal_1 --> -8($fp) + # LOCAL local_reflect_Y_at_Complex_internal_2 --> -12($fp) + # Comparing -12($fp) type with Int + la $v0, Int + lw $a0, -12($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -8($fp) + # IF_ZERO local_reflect_Y_at_Complex_internal_1 GOTO label_COMPARE_BY_VALUE_55 + # IF_ZERO local_reflect_Y_at_Complex_internal_1 GOTO label_COMPARE_BY_VALUE_55 + lw $t0, -8($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_55 + # LOCAL local_reflect_Y_at_Complex_internal_1 --> -8($fp) + # LOCAL local_reflect_Y_at_Complex_internal_2 --> -12($fp) + # LOCAL local_reflect_Y_at_Complex_internal_3 --> -16($fp) + # Load pointers and SUB + lw $a0, -12($fp) + lw $a1, -16($fp) + sub $a0, $a0, $a1 + sw $a0, -8($fp) + # IF_ZERO local_reflect_Y_at_Complex_internal_1 GOTO label_TRUE_52 + # IF_ZERO local_reflect_Y_at_Complex_internal_1 GOTO label_TRUE_52 + lw $t0, -8($fp) + beq $t0, 0, label_TRUE_52 + # GOTO label_FALSE_51 + j label_FALSE_51 + label_COMPARE_BY_VALUE_55: + # LOCAL local_reflect_Y_at_Complex_internal_1 --> -8($fp) + # LOCAL local_reflect_Y_at_Complex_internal_2 --> -12($fp) + # LOCAL local_reflect_Y_at_Complex_internal_3 --> -16($fp) + lw $a0, -12($fp) + lw $a1, -16($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -8($fp) + # IF_ZERO local_reflect_Y_at_Complex_internal_1 GOTO label_TRUE_52 + # IF_ZERO local_reflect_Y_at_Complex_internal_1 GOTO label_TRUE_52 + lw $t0, -8($fp) + beq $t0, 0, label_TRUE_52 + # GOTO label_FALSE_51 + j label_FALSE_51 + label_COMPARE_STRING_54: + # LOCAL local_reflect_Y_at_Complex_internal_1 --> -8($fp) + # LOCAL local_reflect_Y_at_Complex_internal_2 --> -12($fp) + # LOCAL local_reflect_Y_at_Complex_internal_3 --> -16($fp) + # Load strings for comparison + lw $v0, -12($fp) + lw $v1, -16($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -8($fp) + # IF_ZERO local_reflect_Y_at_Complex_internal_1 GOTO label_CONTINUE_56 + # IF_ZERO local_reflect_Y_at_Complex_internal_1 GOTO label_CONTINUE_56 + lw $t0, -8($fp) + beq $t0, 0, label_CONTINUE_56 + # GOTO label_FALSE_51 + j label_FALSE_51 + label_CONTINUE_56: + # LOCAL local_reflect_Y_at_Complex_internal_1 --> -8($fp) + # LOCAL local_reflect_Y_at_Complex_internal_2 --> -12($fp) + # LOCAL local_reflect_Y_at_Complex_internal_3 --> -16($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -12($fp) + lw $v1, -16($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_57: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_58 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_57 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_58: + # Store result + sw $a2, -8($fp) + # IF_ZERO local_reflect_Y_at_Complex_internal_1 GOTO label_TRUE_52 + # IF_ZERO local_reflect_Y_at_Complex_internal_1 GOTO label_TRUE_52 + lw $t0, -8($fp) + beq $t0, 0, label_TRUE_52 + label_FALSE_51: + # LOCAL local_reflect_Y_at_Complex_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -4($fp) + # GOTO label_END_53 +j label_END_53 +label_TRUE_52: + # LOCAL local_reflect_Y_at_Complex_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -4($fp) + label_END_53: +# LOCAL local_reflect_Y_at_Complex_internal_5 --> -24($fp) +# local_reflect_Y_at_Complex_internal_5 = SELF +sw $s1, -24($fp) +# RETURN local_reflect_Y_at_Complex_internal_5 +lw $v0, -24($fp) +# Deallocate stack frame for function function_reflect_Y_at_Complex. +# Restore $ra +lw $ra, 4($sp) +# Restore $fp +lw $fp, 0($sp) +# Restore Stack pointer $sp +addu $sp, $sp, 32 +jr $ra +# Function END + + +# function_equal_at_Complex implementation. +# @Params: +# 0($fp) = param_equal_at_Complex_d_0 +function_equal_at_Complex: + # Allocate stack frame for function function_equal_at_Complex. + subu $sp, $sp, 76 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 76 + # local_equal_at_Complex_internal_4 = GETATTRIBUTE x Complex + # LOCAL local_equal_at_Complex_internal_4 --> -20($fp) + lw $t0, 12($s1) + sw $t0, -20($fp) + # LOCAL local_equal_at_Complex_internal_5 --> -24($fp) + # PARAM param_equal_at_Complex_d_0 --> 0($fp) + # local_equal_at_Complex_internal_5 = PARAM param_equal_at_Complex_d_0 + lw $t0, 0($fp) + sw $t0, -24($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_equal_at_Complex_internal_5 --> -24($fp) + # LOCAL local_equal_at_Complex_internal_6 --> -28($fp) + # local_equal_at_Complex_internal_6 = VCALL local_equal_at_Complex_internal_5 x_value + # Save new self pointer in $s1 + lw $s1, -24($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 32($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -28($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # IF_ZERO local_equal_at_Complex_internal_4 GOTO label_FALSE_61 + # IF_ZERO local_equal_at_Complex_internal_4 GOTO label_FALSE_61 + lw $t0, -20($fp) + beq $t0, 0, label_FALSE_61 + # IF_ZERO local_equal_at_Complex_internal_6 GOTO label_FALSE_61 + # IF_ZERO local_equal_at_Complex_internal_6 GOTO label_FALSE_61 + lw $t0, -28($fp) + beq $t0, 0, label_FALSE_61 + # LOCAL local_equal_at_Complex_internal_3 --> -16($fp) + # LOCAL local_equal_at_Complex_internal_4 --> -20($fp) + # Comparing -20($fp) type with String + la $v0, String + lw $a0, -20($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -16($fp) + # IF_ZERO local_equal_at_Complex_internal_3 GOTO label_COMPARE_STRING_64 + # IF_ZERO local_equal_at_Complex_internal_3 GOTO label_COMPARE_STRING_64 + lw $t0, -16($fp) + beq $t0, 0, label_COMPARE_STRING_64 + # LOCAL local_equal_at_Complex_internal_3 --> -16($fp) + # LOCAL local_equal_at_Complex_internal_4 --> -20($fp) + # Comparing -20($fp) type with Bool + la $v0, Bool + lw $a0, -20($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -16($fp) + # IF_ZERO local_equal_at_Complex_internal_3 GOTO label_COMPARE_BY_VALUE_65 + # IF_ZERO local_equal_at_Complex_internal_3 GOTO label_COMPARE_BY_VALUE_65 + lw $t0, -16($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_65 + # LOCAL local_equal_at_Complex_internal_3 --> -16($fp) + # LOCAL local_equal_at_Complex_internal_4 --> -20($fp) + # Comparing -20($fp) type with Int + la $v0, Int + lw $a0, -20($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -16($fp) + # IF_ZERO local_equal_at_Complex_internal_3 GOTO label_COMPARE_BY_VALUE_65 + # IF_ZERO local_equal_at_Complex_internal_3 GOTO label_COMPARE_BY_VALUE_65 + lw $t0, -16($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_65 + # LOCAL local_equal_at_Complex_internal_3 --> -16($fp) + # LOCAL local_equal_at_Complex_internal_4 --> -20($fp) + # LOCAL local_equal_at_Complex_internal_6 --> -28($fp) + # Load pointers and SUB + lw $a0, -20($fp) + lw $a1, -28($fp) + sub $a0, $a0, $a1 + sw $a0, -16($fp) + # IF_ZERO local_equal_at_Complex_internal_3 GOTO label_TRUE_62 + # IF_ZERO local_equal_at_Complex_internal_3 GOTO label_TRUE_62 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_62 + # GOTO label_FALSE_61 + j label_FALSE_61 + label_COMPARE_BY_VALUE_65: + # LOCAL local_equal_at_Complex_internal_3 --> -16($fp) + # LOCAL local_equal_at_Complex_internal_4 --> -20($fp) + # LOCAL local_equal_at_Complex_internal_6 --> -28($fp) + lw $a0, -20($fp) + lw $a1, -28($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -16($fp) + # IF_ZERO local_equal_at_Complex_internal_3 GOTO label_TRUE_62 + # IF_ZERO local_equal_at_Complex_internal_3 GOTO label_TRUE_62 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_62 + # GOTO label_FALSE_61 + j label_FALSE_61 + label_COMPARE_STRING_64: + # LOCAL local_equal_at_Complex_internal_3 --> -16($fp) + # LOCAL local_equal_at_Complex_internal_4 --> -20($fp) + # LOCAL local_equal_at_Complex_internal_6 --> -28($fp) + # Load strings for comparison + lw $v0, -20($fp) + lw $v1, -28($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -16($fp) + # IF_ZERO local_equal_at_Complex_internal_3 GOTO label_CONTINUE_66 + # IF_ZERO local_equal_at_Complex_internal_3 GOTO label_CONTINUE_66 + lw $t0, -16($fp) + beq $t0, 0, label_CONTINUE_66 + # GOTO label_FALSE_61 + j label_FALSE_61 + label_CONTINUE_66: + # LOCAL local_equal_at_Complex_internal_3 --> -16($fp) + # LOCAL local_equal_at_Complex_internal_4 --> -20($fp) + # LOCAL local_equal_at_Complex_internal_6 --> -28($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -20($fp) + lw $v1, -28($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_67: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_68 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_67 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_68: + # Store result + sw $a2, -16($fp) + # IF_ZERO local_equal_at_Complex_internal_3 GOTO label_TRUE_62 + # IF_ZERO local_equal_at_Complex_internal_3 GOTO label_TRUE_62 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_62 + label_FALSE_61: + # LOCAL local_equal_at_Complex_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -12($fp) + # GOTO label_END_63 +j label_END_63 +label_TRUE_62: + # LOCAL local_equal_at_Complex_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -12($fp) + label_END_63: +# LOCAL local_equal_at_Complex_internal_0 --> -4($fp) +# LOCAL local_equal_at_Complex_internal_2 --> -12($fp) +# Obtain value from -12($fp) +lw $v0, -12($fp) +lw $v0, 12($v0) +sw $v0, -4($fp) +# IF_ZERO local_equal_at_Complex_internal_0 GOTO label_FALSEIF_59 +# IF_ZERO local_equal_at_Complex_internal_0 GOTO label_FALSEIF_59 +lw $t0, -4($fp) +beq $t0, 0, label_FALSEIF_59 +# local_equal_at_Complex_internal_11 = GETATTRIBUTE y Complex +# LOCAL local_equal_at_Complex_internal_11 --> -48($fp) +lw $t0, 16($s1) +sw $t0, -48($fp) +# LOCAL local_equal_at_Complex_internal_12 --> -52($fp) +# PARAM param_equal_at_Complex_d_0 --> 0($fp) +# local_equal_at_Complex_internal_12 = PARAM param_equal_at_Complex_d_0 +lw $t0, 0($fp) +sw $t0, -52($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_equal_at_Complex_internal_12 --> -52($fp) +# LOCAL local_equal_at_Complex_internal_13 --> -56($fp) +# local_equal_at_Complex_internal_13 = VCALL local_equal_at_Complex_internal_12 y_value +# Save new self pointer in $s1 +lw $s1, -52($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 20($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -56($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# IF_ZERO local_equal_at_Complex_internal_11 GOTO label_FALSE_71 +# IF_ZERO local_equal_at_Complex_internal_11 GOTO label_FALSE_71 +lw $t0, -48($fp) +beq $t0, 0, label_FALSE_71 +# IF_ZERO local_equal_at_Complex_internal_13 GOTO label_FALSE_71 +# IF_ZERO local_equal_at_Complex_internal_13 GOTO label_FALSE_71 +lw $t0, -56($fp) +beq $t0, 0, label_FALSE_71 +# LOCAL local_equal_at_Complex_internal_10 --> -44($fp) +# LOCAL local_equal_at_Complex_internal_11 --> -48($fp) +# Comparing -48($fp) type with String +la $v0, String +lw $a0, -48($fp) +lw $a0, 0($a0) +sub $a0, $a0, $v0 +sw $a0, -44($fp) +# IF_ZERO local_equal_at_Complex_internal_10 GOTO label_COMPARE_STRING_74 +# IF_ZERO local_equal_at_Complex_internal_10 GOTO label_COMPARE_STRING_74 +lw $t0, -44($fp) +beq $t0, 0, label_COMPARE_STRING_74 +# LOCAL local_equal_at_Complex_internal_10 --> -44($fp) +# LOCAL local_equal_at_Complex_internal_11 --> -48($fp) +# Comparing -48($fp) type with Bool +la $v0, Bool +lw $a0, -48($fp) +lw $a0, 0($a0) +lw $a0, 12($a0) +sub $a0, $a0, $v0 +sw $a0, -44($fp) +# IF_ZERO local_equal_at_Complex_internal_10 GOTO label_COMPARE_BY_VALUE_75 +# IF_ZERO local_equal_at_Complex_internal_10 GOTO label_COMPARE_BY_VALUE_75 +lw $t0, -44($fp) +beq $t0, 0, label_COMPARE_BY_VALUE_75 +# LOCAL local_equal_at_Complex_internal_10 --> -44($fp) +# LOCAL local_equal_at_Complex_internal_11 --> -48($fp) +# Comparing -48($fp) type with Int +la $v0, Int +lw $a0, -48($fp) +lw $a0, 0($a0) +lw $a0, 12($a0) +sub $a0, $a0, $v0 +sw $a0, -44($fp) +# IF_ZERO local_equal_at_Complex_internal_10 GOTO label_COMPARE_BY_VALUE_75 +# IF_ZERO local_equal_at_Complex_internal_10 GOTO label_COMPARE_BY_VALUE_75 +lw $t0, -44($fp) +beq $t0, 0, label_COMPARE_BY_VALUE_75 +# LOCAL local_equal_at_Complex_internal_10 --> -44($fp) +# LOCAL local_equal_at_Complex_internal_11 --> -48($fp) +# LOCAL local_equal_at_Complex_internal_13 --> -56($fp) +# Load pointers and SUB +lw $a0, -48($fp) +lw $a1, -56($fp) +sub $a0, $a0, $a1 +sw $a0, -44($fp) +# IF_ZERO local_equal_at_Complex_internal_10 GOTO label_TRUE_72 +# IF_ZERO local_equal_at_Complex_internal_10 GOTO label_TRUE_72 +lw $t0, -44($fp) +beq $t0, 0, label_TRUE_72 +# GOTO label_FALSE_71 +j label_FALSE_71 +label_COMPARE_BY_VALUE_75: + # LOCAL local_equal_at_Complex_internal_10 --> -44($fp) + # LOCAL local_equal_at_Complex_internal_11 --> -48($fp) + # LOCAL local_equal_at_Complex_internal_13 --> -56($fp) + lw $a0, -48($fp) + lw $a1, -56($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -44($fp) + # IF_ZERO local_equal_at_Complex_internal_10 GOTO label_TRUE_72 + # IF_ZERO local_equal_at_Complex_internal_10 GOTO label_TRUE_72 + lw $t0, -44($fp) + beq $t0, 0, label_TRUE_72 + # GOTO label_FALSE_71 + j label_FALSE_71 + label_COMPARE_STRING_74: + # LOCAL local_equal_at_Complex_internal_10 --> -44($fp) + # LOCAL local_equal_at_Complex_internal_11 --> -48($fp) + # LOCAL local_equal_at_Complex_internal_13 --> -56($fp) + # Load strings for comparison + lw $v0, -48($fp) + lw $v1, -56($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -44($fp) + # IF_ZERO local_equal_at_Complex_internal_10 GOTO label_CONTINUE_76 + # IF_ZERO local_equal_at_Complex_internal_10 GOTO label_CONTINUE_76 + lw $t0, -44($fp) + beq $t0, 0, label_CONTINUE_76 + # GOTO label_FALSE_71 + j label_FALSE_71 + label_CONTINUE_76: + # LOCAL local_equal_at_Complex_internal_10 --> -44($fp) + # LOCAL local_equal_at_Complex_internal_11 --> -48($fp) + # LOCAL local_equal_at_Complex_internal_13 --> -56($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -48($fp) + lw $v1, -56($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_77: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_78 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_77 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_78: + # Store result + sw $a2, -44($fp) + # IF_ZERO local_equal_at_Complex_internal_10 GOTO label_TRUE_72 + # IF_ZERO local_equal_at_Complex_internal_10 GOTO label_TRUE_72 + lw $t0, -44($fp) + beq $t0, 0, label_TRUE_72 + label_FALSE_71: + # LOCAL local_equal_at_Complex_internal_9 --> -40($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -40($fp) + # GOTO label_END_73 +j label_END_73 +label_TRUE_72: + # LOCAL local_equal_at_Complex_internal_9 --> -40($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -40($fp) + label_END_73: +# LOCAL local_equal_at_Complex_internal_7 --> -32($fp) +# LOCAL local_equal_at_Complex_internal_9 --> -40($fp) +# Obtain value from -40($fp) +lw $v0, -40($fp) +lw $v0, 12($v0) +sw $v0, -32($fp) +# IF_ZERO local_equal_at_Complex_internal_7 GOTO label_FALSEIF_69 +# IF_ZERO local_equal_at_Complex_internal_7 GOTO label_FALSEIF_69 +lw $t0, -32($fp) +beq $t0, 0, label_FALSEIF_69 +# LOCAL local_equal_at_Complex_internal_14 --> -60($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Bool +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Bool +sw $t0, 12($v0) +li $t0, 4 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Bool_start +sw $t0, 4($v0) +# Load type offset +li $t0, 12 +sw $t0, 8($v0) +li $t0, 1 +sw $t0, 12($v0) +sw $v0, -60($fp) +# LOCAL local_equal_at_Complex_internal_8 --> -36($fp) +# LOCAL local_equal_at_Complex_internal_14 --> -60($fp) +# local_equal_at_Complex_internal_8 = local_equal_at_Complex_internal_14 +lw $t0, -60($fp) +sw $t0, -36($fp) +# GOTO label_ENDIF_70 +j label_ENDIF_70 +label_FALSEIF_69: + # LOCAL local_equal_at_Complex_internal_15 --> -64($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -64($fp) + # LOCAL local_equal_at_Complex_internal_8 --> -36($fp) + # LOCAL local_equal_at_Complex_internal_15 --> -64($fp) + # local_equal_at_Complex_internal_8 = local_equal_at_Complex_internal_15 + lw $t0, -64($fp) + sw $t0, -36($fp) + label_ENDIF_70: +# LOCAL local_equal_at_Complex_internal_1 --> -8($fp) +# LOCAL local_equal_at_Complex_internal_8 --> -36($fp) +# local_equal_at_Complex_internal_1 = local_equal_at_Complex_internal_8 +lw $t0, -36($fp) +sw $t0, -8($fp) +# GOTO label_ENDIF_60 +j label_ENDIF_60 +label_FALSEIF_59: + # LOCAL local_equal_at_Complex_internal_16 --> -68($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -68($fp) + # LOCAL local_equal_at_Complex_internal_1 --> -8($fp) + # LOCAL local_equal_at_Complex_internal_16 --> -68($fp) + # local_equal_at_Complex_internal_1 = local_equal_at_Complex_internal_16 + lw $t0, -68($fp) + sw $t0, -8($fp) + label_ENDIF_60: +# RETURN local_equal_at_Complex_internal_1 +lw $v0, -8($fp) +# Deallocate stack frame for function function_equal_at_Complex. +# Restore $ra +lw $ra, 4($sp) +# Restore $fp +lw $fp, 0($sp) +# Restore Stack pointer $sp +addu $sp, $sp, 76 +# Deallocate function args +addu $sp, $sp, 4 +jr $ra +# Function END + + +# function_x_value_at_Complex implementation. +# @Params: +function_x_value_at_Complex: + # Allocate stack frame for function function_x_value_at_Complex. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_x_value_at_Complex_internal_0 = GETATTRIBUTE x Complex + # LOCAL local_x_value_at_Complex_internal_0 --> -4($fp) + lw $t0, 12($s1) + sw $t0, -4($fp) + # RETURN local_x_value_at_Complex_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_x_value_at_Complex. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_y_value_at_Complex implementation. +# @Params: +function_y_value_at_Complex: + # Allocate stack frame for function function_y_value_at_Complex. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_y_value_at_Complex_internal_0 = GETATTRIBUTE y Complex + # LOCAL local_y_value_at_Complex_internal_0 --> -4($fp) + lw $t0, 16($s1) + sw $t0, -4($fp) + # RETURN local_y_value_at_Complex_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_y_value_at_Complex. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_main_at_Main implementation. +# @Params: +function_main_at_Main: + # Allocate stack frame for function function_main_at_Main. + subu $sp, $sp, 168 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 168 + # LOCAL local_main_at_Main_c_0 --> -4($fp) + # local_main_at_Main_c_0 = 0 + li $t0, 0 + sw $t0, -4($fp) + # LOCAL local_main_at_Main_internal_3 --> -16($fp) + # local_main_at_Main_internal_3 = ALLOCATE Complex + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Complex + sw $t0, 12($v0) + li $t0, 7 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Complex_start + sw $t0, 4($v0) + # Load type offset + li $t0, 20 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Complex__attrib__x__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 12($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Complex__attrib__y__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 16($t1) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -16($fp) + # LOCAL local_main_at_Main_internal_1 --> -8($fp) + # LOCAL local_main_at_Main_internal_3 --> -16($fp) + # local_main_at_Main_internal_1 = local_main_at_Main_internal_3 + lw $t0, -16($fp) + sw $t0, -8($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_4 --> -20($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -20($fp) + # ARG local_main_at_Main_internal_4 + # LOCAL local_main_at_Main_internal_4 --> -20($fp) + lw $t0, -20($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_main_at_Main_internal_5 --> -24($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -24($fp) + # ARG local_main_at_Main_internal_5 + # LOCAL local_main_at_Main_internal_5 --> -24($fp) + lw $t0, -24($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_main_at_Main_internal_1 --> -8($fp) + # LOCAL local_main_at_Main_internal_2 --> -12($fp) + # local_main_at_Main_internal_2 = VCALL local_main_at_Main_internal_1 init + # Save new self pointer in $s1 + lw $s1, -8($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 28($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -12($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_main_at_Main_c_0 --> -4($fp) + # LOCAL local_main_at_Main_internal_2 --> -12($fp) + # local_main_at_Main_c_0 = local_main_at_Main_internal_2 + lw $t0, -12($fp) + sw $t0, -4($fp) + # LOCAL local_main_at_Main_internal_10 --> -44($fp) + # LOCAL local_main_at_Main_c_0 --> -4($fp) + # local_main_at_Main_internal_10 = local_main_at_Main_c_0 + lw $t0, -4($fp) + sw $t0, -44($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_10 --> -44($fp) + # LOCAL local_main_at_Main_internal_11 --> -48($fp) + # local_main_at_Main_internal_11 = VCALL local_main_at_Main_internal_10 reflect_X + # Save new self pointer in $s1 + lw $s1, -44($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 64($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -48($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_main_at_Main_internal_12 --> -52($fp) + # LOCAL local_main_at_Main_c_0 --> -4($fp) + # local_main_at_Main_internal_12 = local_main_at_Main_c_0 + lw $t0, -4($fp) + sw $t0, -52($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_12 --> -52($fp) + # LOCAL local_main_at_Main_internal_13 --> -56($fp) + # local_main_at_Main_internal_13 = VCALL local_main_at_Main_internal_12 reflect_0 + # Save new self pointer in $s1 + lw $s1, -52($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 16($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -56($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # IF_ZERO local_main_at_Main_internal_11 GOTO label_FALSE_81 + # IF_ZERO local_main_at_Main_internal_11 GOTO label_FALSE_81 + lw $t0, -48($fp) + beq $t0, 0, label_FALSE_81 + # IF_ZERO local_main_at_Main_internal_13 GOTO label_FALSE_81 + # IF_ZERO local_main_at_Main_internal_13 GOTO label_FALSE_81 + lw $t0, -56($fp) + beq $t0, 0, label_FALSE_81 + # LOCAL local_main_at_Main_internal_9 --> -40($fp) + # LOCAL local_main_at_Main_internal_11 --> -48($fp) + # Comparing -48($fp) type with String + la $v0, String + lw $a0, -48($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -40($fp) + # IF_ZERO local_main_at_Main_internal_9 GOTO label_COMPARE_STRING_84 + # IF_ZERO local_main_at_Main_internal_9 GOTO label_COMPARE_STRING_84 + lw $t0, -40($fp) + beq $t0, 0, label_COMPARE_STRING_84 + # LOCAL local_main_at_Main_internal_9 --> -40($fp) + # LOCAL local_main_at_Main_internal_11 --> -48($fp) + # Comparing -48($fp) type with Bool + la $v0, Bool + lw $a0, -48($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -40($fp) + # IF_ZERO local_main_at_Main_internal_9 GOTO label_COMPARE_BY_VALUE_85 + # IF_ZERO local_main_at_Main_internal_9 GOTO label_COMPARE_BY_VALUE_85 + lw $t0, -40($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_85 + # LOCAL local_main_at_Main_internal_9 --> -40($fp) + # LOCAL local_main_at_Main_internal_11 --> -48($fp) + # Comparing -48($fp) type with Int + la $v0, Int + lw $a0, -48($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -40($fp) + # IF_ZERO local_main_at_Main_internal_9 GOTO label_COMPARE_BY_VALUE_85 + # IF_ZERO local_main_at_Main_internal_9 GOTO label_COMPARE_BY_VALUE_85 + lw $t0, -40($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_85 + # LOCAL local_main_at_Main_internal_9 --> -40($fp) + # LOCAL local_main_at_Main_internal_11 --> -48($fp) + # LOCAL local_main_at_Main_internal_13 --> -56($fp) + # Load pointers and SUB + lw $a0, -48($fp) + lw $a1, -56($fp) + sub $a0, $a0, $a1 + sw $a0, -40($fp) + # IF_ZERO local_main_at_Main_internal_9 GOTO label_TRUE_82 + # IF_ZERO local_main_at_Main_internal_9 GOTO label_TRUE_82 + lw $t0, -40($fp) + beq $t0, 0, label_TRUE_82 + # GOTO label_FALSE_81 + j label_FALSE_81 + label_COMPARE_BY_VALUE_85: + # LOCAL local_main_at_Main_internal_9 --> -40($fp) + # LOCAL local_main_at_Main_internal_11 --> -48($fp) + # LOCAL local_main_at_Main_internal_13 --> -56($fp) + lw $a0, -48($fp) + lw $a1, -56($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -40($fp) + # IF_ZERO local_main_at_Main_internal_9 GOTO label_TRUE_82 + # IF_ZERO local_main_at_Main_internal_9 GOTO label_TRUE_82 + lw $t0, -40($fp) + beq $t0, 0, label_TRUE_82 + # GOTO label_FALSE_81 + j label_FALSE_81 + label_COMPARE_STRING_84: + # LOCAL local_main_at_Main_internal_9 --> -40($fp) + # LOCAL local_main_at_Main_internal_11 --> -48($fp) + # LOCAL local_main_at_Main_internal_13 --> -56($fp) + # Load strings for comparison + lw $v0, -48($fp) + lw $v1, -56($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -40($fp) + # IF_ZERO local_main_at_Main_internal_9 GOTO label_CONTINUE_86 + # IF_ZERO local_main_at_Main_internal_9 GOTO label_CONTINUE_86 + lw $t0, -40($fp) + beq $t0, 0, label_CONTINUE_86 + # GOTO label_FALSE_81 + j label_FALSE_81 + label_CONTINUE_86: + # LOCAL local_main_at_Main_internal_9 --> -40($fp) + # LOCAL local_main_at_Main_internal_11 --> -48($fp) + # LOCAL local_main_at_Main_internal_13 --> -56($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -48($fp) + lw $v1, -56($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_87: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_88 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_87 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_88: + # Store result + sw $a2, -40($fp) + # IF_ZERO local_main_at_Main_internal_9 GOTO label_TRUE_82 + # IF_ZERO local_main_at_Main_internal_9 GOTO label_TRUE_82 + lw $t0, -40($fp) + beq $t0, 0, label_TRUE_82 + label_FALSE_81: + # LOCAL local_main_at_Main_internal_8 --> -36($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -36($fp) + # GOTO label_END_83 +j label_END_83 +label_TRUE_82: + # LOCAL local_main_at_Main_internal_8 --> -36($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -36($fp) + label_END_83: +# LOCAL local_main_at_Main_internal_6 --> -28($fp) +# LOCAL local_main_at_Main_internal_8 --> -36($fp) +# Obtain value from -36($fp) +lw $v0, -36($fp) +lw $v0, 12($v0) +sw $v0, -28($fp) +# IF_ZERO local_main_at_Main_internal_6 GOTO label_FALSEIF_79 +# IF_ZERO local_main_at_Main_internal_6 GOTO label_FALSEIF_79 +lw $t0, -28($fp) +beq $t0, 0, label_FALSEIF_79 +# LOCAL local_main_at_Main_internal_16 --> -68($fp) +# local_main_at_Main_internal_16 = SELF +sw $s1, -68($fp) +# LOCAL local_main_at_Main_internal_14 --> -60($fp) +# LOCAL local_main_at_Main_internal_16 --> -68($fp) +# local_main_at_Main_internal_14 = local_main_at_Main_internal_16 +lw $t0, -68($fp) +sw $t0, -60($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_main_at_Main_internal_17 --> -72($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_6 +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +sw $v0, -72($fp) +# ARG local_main_at_Main_internal_17 +# LOCAL local_main_at_Main_internal_17 --> -72($fp) +lw $t0, -72($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_main_at_Main_internal_14 --> -60($fp) +# LOCAL local_main_at_Main_internal_15 --> -64($fp) +# local_main_at_Main_internal_15 = VCALL local_main_at_Main_internal_14 out_string +# Save new self pointer in $s1 +lw $s1, -60($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 56($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -64($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_main_at_Main_internal_7 --> -32($fp) +# LOCAL local_main_at_Main_internal_15 --> -64($fp) +# local_main_at_Main_internal_7 = local_main_at_Main_internal_15 +lw $t0, -64($fp) +sw $t0, -32($fp) +# GOTO label_ENDIF_80 +j label_ENDIF_80 +label_FALSEIF_79: + # LOCAL local_main_at_Main_internal_20 --> -84($fp) + # local_main_at_Main_internal_20 = SELF + sw $s1, -84($fp) + # LOCAL local_main_at_Main_internal_18 --> -76($fp) + # LOCAL local_main_at_Main_internal_20 --> -84($fp) + # local_main_at_Main_internal_18 = local_main_at_Main_internal_20 + lw $t0, -84($fp) + sw $t0, -76($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_21 --> -88($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_7 + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + sw $v0, -88($fp) + # ARG local_main_at_Main_internal_21 + # LOCAL local_main_at_Main_internal_21 --> -88($fp) + lw $t0, -88($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_main_at_Main_internal_18 --> -76($fp) + # LOCAL local_main_at_Main_internal_19 --> -80($fp) + # local_main_at_Main_internal_19 = VCALL local_main_at_Main_internal_18 out_string + # Save new self pointer in $s1 + lw $s1, -76($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 56($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -80($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_main_at_Main_internal_7 --> -32($fp) + # LOCAL local_main_at_Main_internal_19 --> -80($fp) + # local_main_at_Main_internal_7 = local_main_at_Main_internal_19 + lw $t0, -80($fp) + sw $t0, -32($fp) + label_ENDIF_80: +# LOCAL local_main_at_Main_internal_28 --> -116($fp) +# LOCAL local_main_at_Main_c_0 --> -4($fp) +# local_main_at_Main_internal_28 = local_main_at_Main_c_0 +lw $t0, -4($fp) +sw $t0, -116($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_main_at_Main_internal_28 --> -116($fp) +# LOCAL local_main_at_Main_internal_29 --> -120($fp) +# local_main_at_Main_internal_29 = VCALL local_main_at_Main_internal_28 reflect_X +# Save new self pointer in $s1 +lw $s1, -116($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 64($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -120($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_main_at_Main_internal_26 --> -108($fp) +# LOCAL local_main_at_Main_internal_29 --> -120($fp) +# local_main_at_Main_internal_26 = local_main_at_Main_internal_29 +lw $t0, -120($fp) +sw $t0, -108($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_main_at_Main_internal_26 --> -108($fp) +# LOCAL local_main_at_Main_internal_27 --> -112($fp) +# local_main_at_Main_internal_27 = VCALL local_main_at_Main_internal_26 reflect_Y +# Save new self pointer in $s1 +lw $s1, -108($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 0($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -112($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_main_at_Main_internal_24 --> -100($fp) +# LOCAL local_main_at_Main_internal_27 --> -112($fp) +# local_main_at_Main_internal_24 = local_main_at_Main_internal_27 +lw $t0, -112($fp) +sw $t0, -100($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_main_at_Main_internal_30 --> -124($fp) +# LOCAL local_main_at_Main_c_0 --> -4($fp) +# local_main_at_Main_internal_30 = local_main_at_Main_c_0 +lw $t0, -4($fp) +sw $t0, -124($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_main_at_Main_internal_30 --> -124($fp) +# LOCAL local_main_at_Main_internal_31 --> -128($fp) +# local_main_at_Main_internal_31 = VCALL local_main_at_Main_internal_30 reflect_0 +# Save new self pointer in $s1 +lw $s1, -124($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 16($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -128($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# ARG local_main_at_Main_internal_31 +# LOCAL local_main_at_Main_internal_31 --> -128($fp) +lw $t0, -128($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_main_at_Main_internal_24 --> -100($fp) +# LOCAL local_main_at_Main_internal_25 --> -104($fp) +# local_main_at_Main_internal_25 = VCALL local_main_at_Main_internal_24 equal +# Save new self pointer in $s1 +lw $s1, -100($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 52($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -104($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_main_at_Main_internal_22 --> -92($fp) +# LOCAL local_main_at_Main_internal_25 --> -104($fp) +# Obtain value from -104($fp) +lw $v0, -104($fp) +lw $v0, 12($v0) +sw $v0, -92($fp) +# IF_ZERO local_main_at_Main_internal_22 GOTO label_FALSEIF_89 +# IF_ZERO local_main_at_Main_internal_22 GOTO label_FALSEIF_89 +lw $t0, -92($fp) +beq $t0, 0, label_FALSEIF_89 +# LOCAL local_main_at_Main_internal_34 --> -140($fp) +# local_main_at_Main_internal_34 = SELF +sw $s1, -140($fp) +# LOCAL local_main_at_Main_internal_32 --> -132($fp) +# LOCAL local_main_at_Main_internal_34 --> -140($fp) +# local_main_at_Main_internal_32 = local_main_at_Main_internal_34 +lw $t0, -140($fp) +sw $t0, -132($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_main_at_Main_internal_35 --> -144($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_8 +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +sw $v0, -144($fp) +# ARG local_main_at_Main_internal_35 +# LOCAL local_main_at_Main_internal_35 --> -144($fp) +lw $t0, -144($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_main_at_Main_internal_32 --> -132($fp) +# LOCAL local_main_at_Main_internal_33 --> -136($fp) +# local_main_at_Main_internal_33 = VCALL local_main_at_Main_internal_32 out_string +# Save new self pointer in $s1 +lw $s1, -132($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 56($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -136($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_main_at_Main_internal_23 --> -96($fp) +# LOCAL local_main_at_Main_internal_33 --> -136($fp) +# local_main_at_Main_internal_23 = local_main_at_Main_internal_33 +lw $t0, -136($fp) +sw $t0, -96($fp) +# GOTO label_ENDIF_90 +j label_ENDIF_90 +label_FALSEIF_89: + # LOCAL local_main_at_Main_internal_38 --> -156($fp) + # local_main_at_Main_internal_38 = SELF + sw $s1, -156($fp) + # LOCAL local_main_at_Main_internal_36 --> -148($fp) + # LOCAL local_main_at_Main_internal_38 --> -156($fp) + # local_main_at_Main_internal_36 = local_main_at_Main_internal_38 + lw $t0, -156($fp) + sw $t0, -148($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_39 --> -160($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_9 + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + sw $v0, -160($fp) + # ARG local_main_at_Main_internal_39 + # LOCAL local_main_at_Main_internal_39 --> -160($fp) + lw $t0, -160($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_main_at_Main_internal_36 --> -148($fp) + # LOCAL local_main_at_Main_internal_37 --> -152($fp) + # local_main_at_Main_internal_37 = VCALL local_main_at_Main_internal_36 out_string + # Save new self pointer in $s1 + lw $s1, -148($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 56($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -152($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_main_at_Main_internal_23 --> -96($fp) + # LOCAL local_main_at_Main_internal_37 --> -152($fp) + # local_main_at_Main_internal_23 = local_main_at_Main_internal_37 + lw $t0, -152($fp) + sw $t0, -96($fp) + label_ENDIF_90: +# RETURN local_main_at_Main_internal_23 +lw $v0, -96($fp) +# Deallocate stack frame for function function_main_at_Main. +# Restore $ra +lw $ra, 4($sp) +# Restore $fp +lw $fp, 0($sp) +# Restore Stack pointer $sp +addu $sp, $sp, 168 +jr $ra +# Function END + diff --git a/tests/codegen/palindrome.mips b/tests/codegen/palindrome.mips new file mode 100644 index 00000000..209e283d --- /dev/null +++ b/tests/codegen/palindrome.mips @@ -0,0 +1,2423 @@ + +# Code generated by PyCoolc. +# Eliane Puerta, Liset Alfaro, Adrian Gonzalez --- Mon Dec 14 11:08:40 2020 +# School of Math and Computer Science, University of Havana +# + +.data +dummy: .word 0 +IO: .asciiz "IO" +# Function END +Object: .asciiz "Object" +# Function END +String: .asciiz "String" +# Function END +Bool: .asciiz "Bool" +# Function END +Int: .asciiz "Int" +# Function END +Main: .asciiz "Main" +# Function END +# + + +# **** VTABLE for type IO **** +IO_vtable: .word function_out_string_at_IO, function_copy_at_Object, function_in_int_at_IO, function_abort_at_Object, dummy, dummy, function_in_string_at_IO, function_type_name_at_Object, dummy, dummy, function_out_int_at_IO, dummy +# Function END +# + + +# **** Type RECORD for type IO **** +IO_start: + IO_vtable_pointer: .word IO_vtable + # Function END +IO_end: +# + + +# **** VTABLE for type Object **** +Object_vtable: .word dummy, function_copy_at_Object, dummy, function_abort_at_Object, dummy, dummy, dummy, function_type_name_at_Object, dummy, dummy, dummy, dummy +# Function END +# + + +# **** Type RECORD for type Object **** +Object_start: + Object_vtable_pointer: .word Object_vtable + # Function END +Object_end: +# + + +# **** VTABLE for type String **** +String_vtable: .word dummy, function_copy_at_Object, dummy, function_abort_at_Object, function_length_at_String, dummy, dummy, function_type_name_at_Object, function_concat_at_String, dummy, dummy, function_substr_at_String +# Function END +# + + +# **** Type RECORD for type String **** +String_start: + String_vtable_pointer: .word String_vtable + # Function END +String_end: +# + + +# **** VTABLE for type Bool **** +Bool_vtable: .word dummy, function_copy_at_Object, dummy, function_abort_at_Object, dummy, dummy, dummy, function_type_name_at_Object, dummy, dummy, dummy, dummy +# Function END +# + + +# **** Type RECORD for type Bool **** +Bool_start: + Bool_vtable_pointer: .word Bool_vtable + # Function END +Bool_end: +# + + +# **** VTABLE for type Int **** +Int_vtable: .word dummy, function_copy_at_Object, dummy, function_abort_at_Object, dummy, dummy, dummy, function_type_name_at_Object, dummy, dummy, dummy, dummy +# Function END +# + + +# **** Type RECORD for type Int **** +Int_start: + Int_vtable_pointer: .word Int_vtable + # Function END +Int_end: +# + + +# **** VTABLE for type Main **** +Main_vtable: .word function_out_string_at_IO, function_copy_at_Object, function_in_int_at_IO, function_abort_at_Object, dummy, function_pal_at_Main, function_in_string_at_IO, function_type_name_at_Object, dummy, function_main_at_Main, function_out_int_at_IO, dummy +# Function END +# + + +# **** Type RECORD for type Main **** +Main_start: + Main_vtable_pointer: .word Main_vtable + # Function END +Main_end: +# + + +data_0: .asciiz "" +# + + +data_1: .asciiz "Abort called from class " +# + + +data_2: .asciiz "\n" +# + + +IO__TDT: .word 0, -1, -1, -1, -1, 1 +Object__TDT: .word 1, 0, 1, 1, 1, 2 +String__TDT: .word -1, -1, 0, -1, -1, -1 +Bool__TDT: .word -1, -1, -1, 0, -1, -1 +Int__TDT: .word -1, -1, -1, -1, 0, -1 +Main__TDT: .word -1, -1, -1, -1, -1, 0 +# + + +data_4: .asciiz "enter a string\n" +# + + +data_5: .asciiz "that was a palindrome\n" +# + + +data_6: .asciiz "that was not a palindrome\n" +# + + +.text +main: + jal entry + # syscall code 10 is for exit + li $v0, 10 + syscall + # Function END + +# function_in_string_at_IO implementation. +# @Params: +function_in_string_at_IO: + # Allocate stack frame for function function_in_string_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_in_string_at_IO_internal_0 --> -4($fp) + # Allocating 1024 bytes of memory + li $a0, 1024 + li $v0, 9 + syscall + move $t0, $v0 + move $a0, $v0 + li $a1, 1024 + li $v0, 8 + syscall + move $t2, $zero + move $t3, $zero + move $t1, $t0 + lb $t3, 0($t1) + beqz $t3, end_loop + read_length_loop: + lb $t3, 0($t1) + beqz $t3, end_read_length_loop + addu $t1, $t1, 1 + addu $t2, $t2, 1 + j read_length_loop + end_read_length_loop: + subu $t1, $t1, 1 + sb $zero, 0($t1) + subu $t2, $t2, 1 + end_loop: + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $t2, 16($v0) + sw $v0, -4($fp) + # RETURN local_in_string_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_in_string_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_out_int_at_IO implementation. +# @Params: +# 0($fp) = param_out_int_at_IO_x_0 +function_out_int_at_IO: + # Allocate stack frame for function function_out_int_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # PRINT_INT param_out_int_at_IO_x_0 + # PARAM param_out_int_at_IO_x_0 --> 0($fp) + lw $v0, 0($fp) + lw $a0, 12($v0) + li $v0, 1 + syscall + # LOCAL local_out_int_at_IO_internal_0 --> -4($fp) + # local_out_int_at_IO_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_out_int_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_out_int_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_out_string_at_IO implementation. +# @Params: +# 0($fp) = param_out_string_at_IO_x_0 +function_out_string_at_IO: + # Allocate stack frame for function function_out_string_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # PARAM param_out_string_at_IO_x_0 --> 0($fp) + # PRINT_STR param_out_string_at_IO_x_0 + lw $v0, 0($fp) + lw $a0, 12($v0) + li $v0, 4 + syscall + # LOCAL local_out_string_at_IO_internal_0 --> -4($fp) + # local_out_string_at_IO_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_out_string_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_out_string_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_in_int_at_IO implementation. +# @Params: +function_in_int_at_IO: + # Allocate stack frame for function function_in_int_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_in_int_at_IO_internal_0 --> -4($fp) + # local_in_int_at_IO_internal_0 = READ_INT + li $v0, 5 + syscall + move $a2, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + sw $a2, 12($v0) + sw $v0, -4($fp) + # RETURN local_in_int_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_in_int_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_abort_at_Object implementation. +# @Params: +function_abort_at_Object: + # Allocate stack frame for function function_abort_at_Object. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_abort_at_Object_internal_0 --> -4($fp) + lw $t0, 0($s1) + sw $t0, -4($fp) + # LOCAL local_abort_at_Object_internal_0 --> -4($fp) + la $a0, data_1 + li $v0, 4 + syscall + lw $a0, -4($fp) + li $v0, 4 + syscall + la $a0, data_2 + li $v0, 4 + syscall + li $v0, 10 + syscall + # Function END + + +# function_copy_at_Object implementation. +# @Params: +function_copy_at_Object: + # Allocate stack frame for function function_copy_at_Object. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_copy_at_Object_internal_0 --> -4($fp) + # local_copy_at_Object_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_copy_at_Object_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function function_copy_at_Object. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_type_name_at_Object implementation. +# @Params: +function_type_name_at_Object: + # Allocate stack frame for function function_type_name_at_Object. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_type_name_at_Object_internal_0 --> -4($fp) + lw $t0, 0($s1) + sw $t0, -4($fp) + # RETURN local_type_name_at_Object_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_type_name_at_Object. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_concat_at_String implementation. +# @Params: +# 0($fp) = param_concat_at_String_s_0 +function_concat_at_String: + # Allocate stack frame for function function_concat_at_String. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_concat_at_String_internal_0 = self.CONCAT + # LOCAL local_concat_at_String_internal_0 --> -4($fp) + # PARAM param_concat_at_String_s_0 --> 0($fp) + # Get first string length from self + lw $t0, 16($s1) + # Get second string length from param + lw $v0, 0($fp) + lw $t1, 16($v0) + # Save new string length in a0 for memory allocation + addu $a0, $t0, $t1 + move $t3, $a0 + # Get first string from self + lw $t0, 12($s1) + # Get second string from param + lw $t1, 12($v0) + addu $a0, $a0, 4 + li $v0, 9 + syscall + move $t2, $v0 + move $t4, $zero + concat_loop1: + # Compare t0 with \0 + lb $t4, 0($t0) + beqz $t4, concat_loop1_end + # Copy 1 byte + sb $t4, 0($t2) + addu $t2, $t2, 1 + addu $t0, $t0, 1 + j concat_loop1 + concat_loop1_end: + # Copy second string + concat_loop2: + # Compare t1 with \0 + lb $t4, 0($t1) + beqz $t4, concat_loop2_end + # Copy 1 byte + sb $t4, 0($t2) + addu $t2, $t2, 1 + addu $t1, $t1, 1 + j concat_loop2 + concat_loop2_end: + sb $zero, 0($t2) + # v0 contains resulting string + move $t1, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + sw $t1, 12($v0) + sw $t3, 16($v0) + sw $v0, -4($fp) + # RETURN local_concat_at_String_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_concat_at_String. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_substr_at_String implementation. +# @Params: +# 0($fp) = param_substr_at_String_l_0 +# 4($fp) = param_substr_at_String_r_1 +function_substr_at_String: + # Allocate stack frame for function function_substr_at_String. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_substr_at_String_internal_0 --> -4($fp) + # PARAM param_substr_at_String_l_0 --> 4($fp) + # PARAM param_substr_at_String_r_1 --> 0($fp) + lw $t0, 12($s1) + lw $t2, 4($fp) + lw $t2, 12($t2) + addu $t0, $t0, $t2 + lw $a0, 0($fp) + lw $a0, 12($a0) + move $t3, $a0 + move $t1, $a0 + addu $a0, $a0, 1 + li $v0, 9 + syscall + move $t2, $v0 + substr_loop: + beqz $t1, substr_end + lb $a0, 0($t0) + sb $a0, 0($t2) + addu $t0, $t0, 1 + addu $t2, $t2, 1 + subu $t1, $t1, 1 + j substr_loop + substr_end: + sb $zero, 0($t2) + move $t1, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + sw $t1, 12($v0) + sw $t3, 16($v0) + sw $v0, -4($fp) + # RETURN local_substr_at_String_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_substr_at_String. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 8 + jr $ra + # Function END + + +# function_length_at_String implementation. +# @Params: +function_length_at_String: + # Allocate stack frame for function function_length_at_String. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_length_at_String_internal_0 = GETATTRIBUTE length String + # LOCAL local_length_at_String_internal_0 --> -4($fp) + lw $t0, 16($s1) + sw $t0, -4($fp) + # LOCAL local_length_at_String_internal_1 --> -8($fp) + # LOCAL local_length_at_String_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + lw $t0, -4($fp) + sw $t0, 12($v0) + sw $v0, -8($fp) + # RETURN local_length_at_String_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function function_length_at_String. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# entry implementation. +# @Params: +entry: + # Allocate stack frame for function entry. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local__internal_0 --> -4($fp) + # local__internal_0 = ALLOCATE Main + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Main + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Main_start + sw $t0, 4($v0) + # Load type offset + li $t0, 20 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Main__attrib__i__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 12($t1) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -4($fp) + # LOCAL local__internal_0 --> -4($fp) + lw $s1, -4($fp) + # local__internal_1 = CALL main + # LOCAL local__internal_1 --> -8($fp) + # LOCAL local__internal_0 --> -4($fp) + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type's VTABLE + la $t0, Main_vtable + # Get pointer to function address + lw $t1, 36($t0) + # Call function. Result is on $v0 + jalr $t1 + sw $v0, -8($fp) + # RETURN 0 + li $v0, 0 + # Deallocate stack frame for function entry. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# __Main__attrib__i__init implementation. +# @Params: +__Main__attrib__i__init: + # Allocate stack frame for function __Main__attrib__i__init. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_ttrib__i__init_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -4($fp) + # RETURN local_ttrib__i__init_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function __Main__attrib__i__init. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_pal_at_Main implementation. +# @Params: +# 0($fp) = param_pal_at_Main_s_0 +function_pal_at_Main: + # Allocate stack frame for function function_pal_at_Main. + subu $sp, $sp, 176 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 176 + # LOCAL local_pal_at_Main_internal_4 --> -20($fp) + # PARAM param_pal_at_Main_s_0 --> 0($fp) + # local_pal_at_Main_internal_4 = PARAM param_pal_at_Main_s_0 + lw $t0, 0($fp) + sw $t0, -20($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_pal_at_Main_internal_4 --> -20($fp) + # LOCAL local_pal_at_Main_internal_5 --> -24($fp) + # local_pal_at_Main_internal_5 = VCALL local_pal_at_Main_internal_4 length + # Save new self pointer in $s1 + lw $s1, -20($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 16($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -24($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_pal_at_Main_internal_6 --> -28($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -28($fp) + # IF_ZERO local_pal_at_Main_internal_5 GOTO label_FALSE_3 + # IF_ZERO local_pal_at_Main_internal_5 GOTO label_FALSE_3 + lw $t0, -24($fp) + beq $t0, 0, label_FALSE_3 + # IF_ZERO local_pal_at_Main_internal_6 GOTO label_FALSE_3 + # IF_ZERO local_pal_at_Main_internal_6 GOTO label_FALSE_3 + lw $t0, -28($fp) + beq $t0, 0, label_FALSE_3 + # LOCAL local_pal_at_Main_internal_3 --> -16($fp) + # LOCAL local_pal_at_Main_internal_5 --> -24($fp) + # Comparing -24($fp) type with String + la $v0, String + lw $a0, -24($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -16($fp) + # IF_ZERO local_pal_at_Main_internal_3 GOTO label_COMPARE_STRING_6 + # IF_ZERO local_pal_at_Main_internal_3 GOTO label_COMPARE_STRING_6 + lw $t0, -16($fp) + beq $t0, 0, label_COMPARE_STRING_6 + # LOCAL local_pal_at_Main_internal_3 --> -16($fp) + # LOCAL local_pal_at_Main_internal_5 --> -24($fp) + # Comparing -24($fp) type with Bool + la $v0, Bool + lw $a0, -24($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -16($fp) + # IF_ZERO local_pal_at_Main_internal_3 GOTO label_COMPARE_BY_VALUE_7 + # IF_ZERO local_pal_at_Main_internal_3 GOTO label_COMPARE_BY_VALUE_7 + lw $t0, -16($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_7 + # LOCAL local_pal_at_Main_internal_3 --> -16($fp) + # LOCAL local_pal_at_Main_internal_5 --> -24($fp) + # Comparing -24($fp) type with Int + la $v0, Int + lw $a0, -24($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -16($fp) + # IF_ZERO local_pal_at_Main_internal_3 GOTO label_COMPARE_BY_VALUE_7 + # IF_ZERO local_pal_at_Main_internal_3 GOTO label_COMPARE_BY_VALUE_7 + lw $t0, -16($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_7 + # LOCAL local_pal_at_Main_internal_3 --> -16($fp) + # LOCAL local_pal_at_Main_internal_5 --> -24($fp) + # LOCAL local_pal_at_Main_internal_6 --> -28($fp) + # Load pointers and SUB + lw $a0, -24($fp) + lw $a1, -28($fp) + sub $a0, $a0, $a1 + sw $a0, -16($fp) + # IF_ZERO local_pal_at_Main_internal_3 GOTO label_TRUE_4 + # IF_ZERO local_pal_at_Main_internal_3 GOTO label_TRUE_4 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_4 + # GOTO label_FALSE_3 + j label_FALSE_3 + label_COMPARE_BY_VALUE_7: + # LOCAL local_pal_at_Main_internal_3 --> -16($fp) + # LOCAL local_pal_at_Main_internal_5 --> -24($fp) + # LOCAL local_pal_at_Main_internal_6 --> -28($fp) + lw $a0, -24($fp) + lw $a1, -28($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -16($fp) + # IF_ZERO local_pal_at_Main_internal_3 GOTO label_TRUE_4 + # IF_ZERO local_pal_at_Main_internal_3 GOTO label_TRUE_4 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_4 + # GOTO label_FALSE_3 + j label_FALSE_3 + label_COMPARE_STRING_6: + # LOCAL local_pal_at_Main_internal_3 --> -16($fp) + # LOCAL local_pal_at_Main_internal_5 --> -24($fp) + # LOCAL local_pal_at_Main_internal_6 --> -28($fp) + # Load strings for comparison + lw $v0, -24($fp) + lw $v1, -28($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -16($fp) + # IF_ZERO local_pal_at_Main_internal_3 GOTO label_CONTINUE_8 + # IF_ZERO local_pal_at_Main_internal_3 GOTO label_CONTINUE_8 + lw $t0, -16($fp) + beq $t0, 0, label_CONTINUE_8 + # GOTO label_FALSE_3 + j label_FALSE_3 + label_CONTINUE_8: + # LOCAL local_pal_at_Main_internal_3 --> -16($fp) + # LOCAL local_pal_at_Main_internal_5 --> -24($fp) + # LOCAL local_pal_at_Main_internal_6 --> -28($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -24($fp) + lw $v1, -28($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_9: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_10 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_9 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_10: + # Store result + sw $a2, -16($fp) + # IF_ZERO local_pal_at_Main_internal_3 GOTO label_TRUE_4 + # IF_ZERO local_pal_at_Main_internal_3 GOTO label_TRUE_4 + lw $t0, -16($fp) + beq $t0, 0, label_TRUE_4 + label_FALSE_3: + # LOCAL local_pal_at_Main_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -12($fp) + # GOTO label_END_5 +j label_END_5 +label_TRUE_4: + # LOCAL local_pal_at_Main_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -12($fp) + label_END_5: +# LOCAL local_pal_at_Main_internal_0 --> -4($fp) +# LOCAL local_pal_at_Main_internal_2 --> -12($fp) +# Obtain value from -12($fp) +lw $v0, -12($fp) +lw $v0, 12($v0) +sw $v0, -4($fp) +# IF_ZERO local_pal_at_Main_internal_0 GOTO label_FALSEIF_1 +# IF_ZERO local_pal_at_Main_internal_0 GOTO label_FALSEIF_1 +lw $t0, -4($fp) +beq $t0, 0, label_FALSEIF_1 +# LOCAL local_pal_at_Main_internal_7 --> -32($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Bool +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Bool +sw $t0, 12($v0) +li $t0, 4 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Bool_start +sw $t0, 4($v0) +# Load type offset +li $t0, 12 +sw $t0, 8($v0) +li $t0, 1 +sw $t0, 12($v0) +sw $v0, -32($fp) +# LOCAL local_pal_at_Main_internal_1 --> -8($fp) +# LOCAL local_pal_at_Main_internal_7 --> -32($fp) +# local_pal_at_Main_internal_1 = local_pal_at_Main_internal_7 +lw $t0, -32($fp) +sw $t0, -8($fp) +# GOTO label_ENDIF_2 +j label_ENDIF_2 +label_FALSEIF_1: + # LOCAL local_pal_at_Main_internal_12 --> -52($fp) + # PARAM param_pal_at_Main_s_0 --> 0($fp) + # local_pal_at_Main_internal_12 = PARAM param_pal_at_Main_s_0 + lw $t0, 0($fp) + sw $t0, -52($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_pal_at_Main_internal_12 --> -52($fp) + # LOCAL local_pal_at_Main_internal_13 --> -56($fp) + # local_pal_at_Main_internal_13 = VCALL local_pal_at_Main_internal_12 length + # Save new self pointer in $s1 + lw $s1, -52($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 16($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -56($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_pal_at_Main_internal_14 --> -60($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -60($fp) + # IF_ZERO local_pal_at_Main_internal_13 GOTO label_FALSE_13 + # IF_ZERO local_pal_at_Main_internal_13 GOTO label_FALSE_13 + lw $t0, -56($fp) + beq $t0, 0, label_FALSE_13 + # IF_ZERO local_pal_at_Main_internal_14 GOTO label_FALSE_13 + # IF_ZERO local_pal_at_Main_internal_14 GOTO label_FALSE_13 + lw $t0, -60($fp) + beq $t0, 0, label_FALSE_13 + # LOCAL local_pal_at_Main_internal_11 --> -48($fp) + # LOCAL local_pal_at_Main_internal_13 --> -56($fp) + # Comparing -56($fp) type with String + la $v0, String + lw $a0, -56($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -48($fp) + # IF_ZERO local_pal_at_Main_internal_11 GOTO label_COMPARE_STRING_16 + # IF_ZERO local_pal_at_Main_internal_11 GOTO label_COMPARE_STRING_16 + lw $t0, -48($fp) + beq $t0, 0, label_COMPARE_STRING_16 + # LOCAL local_pal_at_Main_internal_11 --> -48($fp) + # LOCAL local_pal_at_Main_internal_13 --> -56($fp) + # Comparing -56($fp) type with Bool + la $v0, Bool + lw $a0, -56($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -48($fp) + # IF_ZERO local_pal_at_Main_internal_11 GOTO label_COMPARE_BY_VALUE_17 + # IF_ZERO local_pal_at_Main_internal_11 GOTO label_COMPARE_BY_VALUE_17 + lw $t0, -48($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_17 + # LOCAL local_pal_at_Main_internal_11 --> -48($fp) + # LOCAL local_pal_at_Main_internal_13 --> -56($fp) + # Comparing -56($fp) type with Int + la $v0, Int + lw $a0, -56($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -48($fp) + # IF_ZERO local_pal_at_Main_internal_11 GOTO label_COMPARE_BY_VALUE_17 + # IF_ZERO local_pal_at_Main_internal_11 GOTO label_COMPARE_BY_VALUE_17 + lw $t0, -48($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_17 + # LOCAL local_pal_at_Main_internal_11 --> -48($fp) + # LOCAL local_pal_at_Main_internal_13 --> -56($fp) + # LOCAL local_pal_at_Main_internal_14 --> -60($fp) + # Load pointers and SUB + lw $a0, -56($fp) + lw $a1, -60($fp) + sub $a0, $a0, $a1 + sw $a0, -48($fp) + # IF_ZERO local_pal_at_Main_internal_11 GOTO label_TRUE_14 + # IF_ZERO local_pal_at_Main_internal_11 GOTO label_TRUE_14 + lw $t0, -48($fp) + beq $t0, 0, label_TRUE_14 + # GOTO label_FALSE_13 + j label_FALSE_13 + label_COMPARE_BY_VALUE_17: + # LOCAL local_pal_at_Main_internal_11 --> -48($fp) + # LOCAL local_pal_at_Main_internal_13 --> -56($fp) + # LOCAL local_pal_at_Main_internal_14 --> -60($fp) + lw $a0, -56($fp) + lw $a1, -60($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -48($fp) + # IF_ZERO local_pal_at_Main_internal_11 GOTO label_TRUE_14 + # IF_ZERO local_pal_at_Main_internal_11 GOTO label_TRUE_14 + lw $t0, -48($fp) + beq $t0, 0, label_TRUE_14 + # GOTO label_FALSE_13 + j label_FALSE_13 + label_COMPARE_STRING_16: + # LOCAL local_pal_at_Main_internal_11 --> -48($fp) + # LOCAL local_pal_at_Main_internal_13 --> -56($fp) + # LOCAL local_pal_at_Main_internal_14 --> -60($fp) + # Load strings for comparison + lw $v0, -56($fp) + lw $v1, -60($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -48($fp) + # IF_ZERO local_pal_at_Main_internal_11 GOTO label_CONTINUE_18 + # IF_ZERO local_pal_at_Main_internal_11 GOTO label_CONTINUE_18 + lw $t0, -48($fp) + beq $t0, 0, label_CONTINUE_18 + # GOTO label_FALSE_13 + j label_FALSE_13 + label_CONTINUE_18: + # LOCAL local_pal_at_Main_internal_11 --> -48($fp) + # LOCAL local_pal_at_Main_internal_13 --> -56($fp) + # LOCAL local_pal_at_Main_internal_14 --> -60($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -56($fp) + lw $v1, -60($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_19: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_20 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_19 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_20: + # Store result + sw $a2, -48($fp) + # IF_ZERO local_pal_at_Main_internal_11 GOTO label_TRUE_14 + # IF_ZERO local_pal_at_Main_internal_11 GOTO label_TRUE_14 + lw $t0, -48($fp) + beq $t0, 0, label_TRUE_14 + label_FALSE_13: + # LOCAL local_pal_at_Main_internal_10 --> -44($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -44($fp) + # GOTO label_END_15 +j label_END_15 +label_TRUE_14: + # LOCAL local_pal_at_Main_internal_10 --> -44($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -44($fp) + label_END_15: +# LOCAL local_pal_at_Main_internal_8 --> -36($fp) +# LOCAL local_pal_at_Main_internal_10 --> -44($fp) +# Obtain value from -44($fp) +lw $v0, -44($fp) +lw $v0, 12($v0) +sw $v0, -36($fp) +# IF_ZERO local_pal_at_Main_internal_8 GOTO label_FALSEIF_11 +# IF_ZERO local_pal_at_Main_internal_8 GOTO label_FALSEIF_11 +lw $t0, -36($fp) +beq $t0, 0, label_FALSEIF_11 +# LOCAL local_pal_at_Main_internal_15 --> -64($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Bool +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Bool +sw $t0, 12($v0) +li $t0, 4 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Bool_start +sw $t0, 4($v0) +# Load type offset +li $t0, 12 +sw $t0, 8($v0) +li $t0, 1 +sw $t0, 12($v0) +sw $v0, -64($fp) +# LOCAL local_pal_at_Main_internal_9 --> -40($fp) +# LOCAL local_pal_at_Main_internal_15 --> -64($fp) +# local_pal_at_Main_internal_9 = local_pal_at_Main_internal_15 +lw $t0, -64($fp) +sw $t0, -40($fp) +# GOTO label_ENDIF_12 +j label_ENDIF_12 +label_FALSEIF_11: + # LOCAL local_pal_at_Main_internal_20 --> -84($fp) + # PARAM param_pal_at_Main_s_0 --> 0($fp) + # local_pal_at_Main_internal_20 = PARAM param_pal_at_Main_s_0 + lw $t0, 0($fp) + sw $t0, -84($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_pal_at_Main_internal_22 --> -92($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -92($fp) + # ARG local_pal_at_Main_internal_22 + # LOCAL local_pal_at_Main_internal_22 --> -92($fp) + lw $t0, -92($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_pal_at_Main_internal_23 --> -96($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -96($fp) + # ARG local_pal_at_Main_internal_23 + # LOCAL local_pal_at_Main_internal_23 --> -96($fp) + lw $t0, -96($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_pal_at_Main_internal_20 --> -84($fp) + # LOCAL local_pal_at_Main_internal_21 --> -88($fp) + # local_pal_at_Main_internal_21 = VCALL local_pal_at_Main_internal_20 substr + # Save new self pointer in $s1 + lw $s1, -84($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 44($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -88($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_pal_at_Main_internal_24 --> -100($fp) + # PARAM param_pal_at_Main_s_0 --> 0($fp) + # local_pal_at_Main_internal_24 = PARAM param_pal_at_Main_s_0 + lw $t0, 0($fp) + sw $t0, -100($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_pal_at_Main_internal_27 --> -112($fp) + # PARAM param_pal_at_Main_s_0 --> 0($fp) + # local_pal_at_Main_internal_27 = PARAM param_pal_at_Main_s_0 + lw $t0, 0($fp) + sw $t0, -112($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_pal_at_Main_internal_27 --> -112($fp) + # LOCAL local_pal_at_Main_internal_28 --> -116($fp) + # local_pal_at_Main_internal_28 = VCALL local_pal_at_Main_internal_27 length + # Save new self pointer in $s1 + lw $s1, -112($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 16($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -116($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_pal_at_Main_internal_29 --> -120($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -120($fp) + # LOCAL local_pal_at_Main_internal_26 --> -108($fp) + # LOCAL local_pal_at_Main_internal_28 --> -116($fp) + # LOCAL local_pal_at_Main_internal_29 --> -120($fp) + # local_pal_at_Main_internal_26 = local_pal_at_Main_internal_28 - local_pal_at_Main_internal_29 + lw $t1, -116($fp) + lw $t0, 12($t1) + lw $t1, -120($fp) + lw $t2, 12($t1) + sub $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -108($fp) + # ARG local_pal_at_Main_internal_26 + # LOCAL local_pal_at_Main_internal_26 --> -108($fp) + lw $t0, -108($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_pal_at_Main_internal_30 --> -124($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -124($fp) + # ARG local_pal_at_Main_internal_30 + # LOCAL local_pal_at_Main_internal_30 --> -124($fp) + lw $t0, -124($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_pal_at_Main_internal_24 --> -100($fp) + # LOCAL local_pal_at_Main_internal_25 --> -104($fp) + # local_pal_at_Main_internal_25 = VCALL local_pal_at_Main_internal_24 substr + # Save new self pointer in $s1 + lw $s1, -100($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 44($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -104($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # IF_ZERO local_pal_at_Main_internal_21 GOTO label_FALSE_23 + # IF_ZERO local_pal_at_Main_internal_21 GOTO label_FALSE_23 + lw $t0, -88($fp) + beq $t0, 0, label_FALSE_23 + # IF_ZERO local_pal_at_Main_internal_25 GOTO label_FALSE_23 + # IF_ZERO local_pal_at_Main_internal_25 GOTO label_FALSE_23 + lw $t0, -104($fp) + beq $t0, 0, label_FALSE_23 + # LOCAL local_pal_at_Main_internal_19 --> -80($fp) + # LOCAL local_pal_at_Main_internal_21 --> -88($fp) + # Comparing -88($fp) type with String + la $v0, String + lw $a0, -88($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -80($fp) + # IF_ZERO local_pal_at_Main_internal_19 GOTO label_COMPARE_STRING_26 + # IF_ZERO local_pal_at_Main_internal_19 GOTO label_COMPARE_STRING_26 + lw $t0, -80($fp) + beq $t0, 0, label_COMPARE_STRING_26 + # LOCAL local_pal_at_Main_internal_19 --> -80($fp) + # LOCAL local_pal_at_Main_internal_21 --> -88($fp) + # Comparing -88($fp) type with Bool + la $v0, Bool + lw $a0, -88($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -80($fp) + # IF_ZERO local_pal_at_Main_internal_19 GOTO label_COMPARE_BY_VALUE_27 + # IF_ZERO local_pal_at_Main_internal_19 GOTO label_COMPARE_BY_VALUE_27 + lw $t0, -80($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_27 + # LOCAL local_pal_at_Main_internal_19 --> -80($fp) + # LOCAL local_pal_at_Main_internal_21 --> -88($fp) + # Comparing -88($fp) type with Int + la $v0, Int + lw $a0, -88($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -80($fp) + # IF_ZERO local_pal_at_Main_internal_19 GOTO label_COMPARE_BY_VALUE_27 + # IF_ZERO local_pal_at_Main_internal_19 GOTO label_COMPARE_BY_VALUE_27 + lw $t0, -80($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_27 + # LOCAL local_pal_at_Main_internal_19 --> -80($fp) + # LOCAL local_pal_at_Main_internal_21 --> -88($fp) + # LOCAL local_pal_at_Main_internal_25 --> -104($fp) + # Load pointers and SUB + lw $a0, -88($fp) + lw $a1, -104($fp) + sub $a0, $a0, $a1 + sw $a0, -80($fp) + # IF_ZERO local_pal_at_Main_internal_19 GOTO label_TRUE_24 + # IF_ZERO local_pal_at_Main_internal_19 GOTO label_TRUE_24 + lw $t0, -80($fp) + beq $t0, 0, label_TRUE_24 + # GOTO label_FALSE_23 + j label_FALSE_23 + label_COMPARE_BY_VALUE_27: + # LOCAL local_pal_at_Main_internal_19 --> -80($fp) + # LOCAL local_pal_at_Main_internal_21 --> -88($fp) + # LOCAL local_pal_at_Main_internal_25 --> -104($fp) + lw $a0, -88($fp) + lw $a1, -104($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -80($fp) + # IF_ZERO local_pal_at_Main_internal_19 GOTO label_TRUE_24 + # IF_ZERO local_pal_at_Main_internal_19 GOTO label_TRUE_24 + lw $t0, -80($fp) + beq $t0, 0, label_TRUE_24 + # GOTO label_FALSE_23 + j label_FALSE_23 + label_COMPARE_STRING_26: + # LOCAL local_pal_at_Main_internal_19 --> -80($fp) + # LOCAL local_pal_at_Main_internal_21 --> -88($fp) + # LOCAL local_pal_at_Main_internal_25 --> -104($fp) + # Load strings for comparison + lw $v0, -88($fp) + lw $v1, -104($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -80($fp) + # IF_ZERO local_pal_at_Main_internal_19 GOTO label_CONTINUE_28 + # IF_ZERO local_pal_at_Main_internal_19 GOTO label_CONTINUE_28 + lw $t0, -80($fp) + beq $t0, 0, label_CONTINUE_28 + # GOTO label_FALSE_23 + j label_FALSE_23 + label_CONTINUE_28: + # LOCAL local_pal_at_Main_internal_19 --> -80($fp) + # LOCAL local_pal_at_Main_internal_21 --> -88($fp) + # LOCAL local_pal_at_Main_internal_25 --> -104($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -88($fp) + lw $v1, -104($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_29: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_30 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_29 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_30: + # Store result + sw $a2, -80($fp) + # IF_ZERO local_pal_at_Main_internal_19 GOTO label_TRUE_24 + # IF_ZERO local_pal_at_Main_internal_19 GOTO label_TRUE_24 + lw $t0, -80($fp) + beq $t0, 0, label_TRUE_24 + label_FALSE_23: + # LOCAL local_pal_at_Main_internal_18 --> -76($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -76($fp) + # GOTO label_END_25 +j label_END_25 +label_TRUE_24: + # LOCAL local_pal_at_Main_internal_18 --> -76($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -76($fp) + label_END_25: +# LOCAL local_pal_at_Main_internal_16 --> -68($fp) +# LOCAL local_pal_at_Main_internal_18 --> -76($fp) +# Obtain value from -76($fp) +lw $v0, -76($fp) +lw $v0, 12($v0) +sw $v0, -68($fp) +# IF_ZERO local_pal_at_Main_internal_16 GOTO label_FALSEIF_21 +# IF_ZERO local_pal_at_Main_internal_16 GOTO label_FALSEIF_21 +lw $t0, -68($fp) +beq $t0, 0, label_FALSEIF_21 +# LOCAL local_pal_at_Main_internal_33 --> -136($fp) +# local_pal_at_Main_internal_33 = SELF +sw $s1, -136($fp) +# LOCAL local_pal_at_Main_internal_31 --> -128($fp) +# LOCAL local_pal_at_Main_internal_33 --> -136($fp) +# local_pal_at_Main_internal_31 = local_pal_at_Main_internal_33 +lw $t0, -136($fp) +sw $t0, -128($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_pal_at_Main_internal_34 --> -140($fp) +# PARAM param_pal_at_Main_s_0 --> 0($fp) +# local_pal_at_Main_internal_34 = PARAM param_pal_at_Main_s_0 +lw $t0, 0($fp) +sw $t0, -140($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_pal_at_Main_internal_36 --> -148($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 1 +sw $t0, 12($v0) +sw $v0, -148($fp) +# ARG local_pal_at_Main_internal_36 +# LOCAL local_pal_at_Main_internal_36 --> -148($fp) +lw $t0, -148($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_pal_at_Main_internal_38 --> -156($fp) +# PARAM param_pal_at_Main_s_0 --> 0($fp) +# local_pal_at_Main_internal_38 = PARAM param_pal_at_Main_s_0 +lw $t0, 0($fp) +sw $t0, -156($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_pal_at_Main_internal_38 --> -156($fp) +# LOCAL local_pal_at_Main_internal_39 --> -160($fp) +# local_pal_at_Main_internal_39 = VCALL local_pal_at_Main_internal_38 length +# Save new self pointer in $s1 +lw $s1, -156($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 16($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -160($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_pal_at_Main_internal_40 --> -164($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 2 +sw $t0, 12($v0) +sw $v0, -164($fp) +# LOCAL local_pal_at_Main_internal_37 --> -152($fp) +# LOCAL local_pal_at_Main_internal_39 --> -160($fp) +# LOCAL local_pal_at_Main_internal_40 --> -164($fp) +# local_pal_at_Main_internal_37 = local_pal_at_Main_internal_39 - local_pal_at_Main_internal_40 +lw $t1, -160($fp) +lw $t0, 12($t1) +lw $t1, -164($fp) +lw $t2, 12($t1) +sub $t0, $t0, $t2 +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t1, String +sw $t1, 0($v0) +la $t1, String_start +sw $t1, 4($v0) +# Load type offset +li $t1, 8 +sw $t1, 8($v0) +la $t1, Int +sw $t1, 12($v0) +li $t1, 3 +sw $t1, 16($v0) +move $t1, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t1, 0($v0) +la $t1, Int_start +sw $t1, 4($v0) +# Load type offset +li $t1, 16 +sw $t1, 8($v0) +sw $t0, 12($v0) +sw $v0, -152($fp) +# ARG local_pal_at_Main_internal_37 +# LOCAL local_pal_at_Main_internal_37 --> -152($fp) +lw $t0, -152($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_pal_at_Main_internal_34 --> -140($fp) +# LOCAL local_pal_at_Main_internal_35 --> -144($fp) +# local_pal_at_Main_internal_35 = VCALL local_pal_at_Main_internal_34 substr +# Save new self pointer in $s1 +lw $s1, -140($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 44($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -144($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# ARG local_pal_at_Main_internal_35 +# LOCAL local_pal_at_Main_internal_35 --> -144($fp) +lw $t0, -144($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_pal_at_Main_internal_31 --> -128($fp) +# LOCAL local_pal_at_Main_internal_32 --> -132($fp) +# local_pal_at_Main_internal_32 = VCALL local_pal_at_Main_internal_31 pal +# Save new self pointer in $s1 +lw $s1, -128($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 20($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -132($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_pal_at_Main_internal_17 --> -72($fp) +# LOCAL local_pal_at_Main_internal_32 --> -132($fp) +# local_pal_at_Main_internal_17 = local_pal_at_Main_internal_32 +lw $t0, -132($fp) +sw $t0, -72($fp) +# GOTO label_ENDIF_22 +j label_ENDIF_22 +label_FALSEIF_21: + # LOCAL local_pal_at_Main_internal_41 --> -168($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -168($fp) + # LOCAL local_pal_at_Main_internal_17 --> -72($fp) + # LOCAL local_pal_at_Main_internal_41 --> -168($fp) + # local_pal_at_Main_internal_17 = local_pal_at_Main_internal_41 + lw $t0, -168($fp) + sw $t0, -72($fp) + label_ENDIF_22: +# LOCAL local_pal_at_Main_internal_9 --> -40($fp) +# LOCAL local_pal_at_Main_internal_17 --> -72($fp) +# local_pal_at_Main_internal_9 = local_pal_at_Main_internal_17 +lw $t0, -72($fp) +sw $t0, -40($fp) +label_ENDIF_12: +# LOCAL local_pal_at_Main_internal_1 --> -8($fp) +# LOCAL local_pal_at_Main_internal_9 --> -40($fp) +# local_pal_at_Main_internal_1 = local_pal_at_Main_internal_9 +lw $t0, -40($fp) +sw $t0, -8($fp) +label_ENDIF_2: +# RETURN local_pal_at_Main_internal_1 +lw $v0, -8($fp) +# Deallocate stack frame for function function_pal_at_Main. +# Restore $ra +lw $ra, 4($sp) +# Restore $fp +lw $fp, 0($sp) +# Restore Stack pointer $sp +addu $sp, $sp, 176 +# Deallocate function args +addu $sp, $sp, 4 +jr $ra +# Function END + + +# function_main_at_Main implementation. +# @Params: +function_main_at_Main: + # Allocate stack frame for function function_main_at_Main. + subu $sp, $sp, 96 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 96 + # LOCAL local_main_at_Main_internal_1 --> -8($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -8($fp) + # LOCAL local_main_at_Main_internal_0 --> -4($fp) + # LOCAL local_main_at_Main_internal_1 --> -8($fp) + lw $t0, -8($fp) + lw $t0, 12($t0) + not $t0, $t0 + add $t0, $t0, 1 + sw $t0, -4($fp) + # LOCAL local_main_at_Main_internal_0 --> -4($fp) + # LOCAL local_main_at_Main_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + lw $t0, -4($fp) + sw $t0, 12($v0) + sw $v0, -4($fp) + # + # LOCAL local_main_at_Main_internal_0 --> -4($fp) + lw $t0, -4($fp) + sw $t0, 12($s1) + # LOCAL local_main_at_Main_internal_4 --> -20($fp) + # local_main_at_Main_internal_4 = SELF + sw $s1, -20($fp) + # LOCAL local_main_at_Main_internal_2 --> -12($fp) + # LOCAL local_main_at_Main_internal_4 --> -20($fp) + # local_main_at_Main_internal_2 = local_main_at_Main_internal_4 + lw $t0, -20($fp) + sw $t0, -12($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_5 --> -24($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_4 + sw $t0, 12($v0) + li $t0, 15 + sw $t0, 16($v0) + sw $v0, -24($fp) + # ARG local_main_at_Main_internal_5 + # LOCAL local_main_at_Main_internal_5 --> -24($fp) + lw $t0, -24($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_main_at_Main_internal_2 --> -12($fp) + # LOCAL local_main_at_Main_internal_3 --> -16($fp) + # local_main_at_Main_internal_3 = VCALL local_main_at_Main_internal_2 out_string + # Save new self pointer in $s1 + lw $s1, -12($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 0($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -16($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_main_at_Main_internal_10 --> -44($fp) + # local_main_at_Main_internal_10 = SELF + sw $s1, -44($fp) + # LOCAL local_main_at_Main_internal_8 --> -36($fp) + # LOCAL local_main_at_Main_internal_10 --> -44($fp) + # local_main_at_Main_internal_8 = local_main_at_Main_internal_10 + lw $t0, -44($fp) + sw $t0, -36($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_13 --> -56($fp) + # local_main_at_Main_internal_13 = SELF + sw $s1, -56($fp) + # LOCAL local_main_at_Main_internal_11 --> -48($fp) + # LOCAL local_main_at_Main_internal_13 --> -56($fp) + # local_main_at_Main_internal_11 = local_main_at_Main_internal_13 + lw $t0, -56($fp) + sw $t0, -48($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_11 --> -48($fp) + # LOCAL local_main_at_Main_internal_12 --> -52($fp) + # local_main_at_Main_internal_12 = VCALL local_main_at_Main_internal_11 in_string + # Save new self pointer in $s1 + lw $s1, -48($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 24($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -52($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # ARG local_main_at_Main_internal_12 + # LOCAL local_main_at_Main_internal_12 --> -52($fp) + lw $t0, -52($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_main_at_Main_internal_8 --> -36($fp) + # LOCAL local_main_at_Main_internal_9 --> -40($fp) + # local_main_at_Main_internal_9 = VCALL local_main_at_Main_internal_8 pal + # Save new self pointer in $s1 + lw $s1, -36($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 20($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -40($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_main_at_Main_internal_6 --> -28($fp) + # LOCAL local_main_at_Main_internal_9 --> -40($fp) + # Obtain value from -40($fp) + lw $v0, -40($fp) + lw $v0, 12($v0) + sw $v0, -28($fp) + # IF_ZERO local_main_at_Main_internal_6 GOTO label_FALSEIF_31 + # IF_ZERO local_main_at_Main_internal_6 GOTO label_FALSEIF_31 + lw $t0, -28($fp) + beq $t0, 0, label_FALSEIF_31 + # LOCAL local_main_at_Main_internal_16 --> -68($fp) + # local_main_at_Main_internal_16 = SELF + sw $s1, -68($fp) + # LOCAL local_main_at_Main_internal_14 --> -60($fp) + # LOCAL local_main_at_Main_internal_16 --> -68($fp) + # local_main_at_Main_internal_14 = local_main_at_Main_internal_16 + lw $t0, -68($fp) + sw $t0, -60($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_17 --> -72($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_5 + sw $t0, 12($v0) + li $t0, 22 + sw $t0, 16($v0) + sw $v0, -72($fp) + # ARG local_main_at_Main_internal_17 + # LOCAL local_main_at_Main_internal_17 --> -72($fp) + lw $t0, -72($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_main_at_Main_internal_14 --> -60($fp) + # LOCAL local_main_at_Main_internal_15 --> -64($fp) + # local_main_at_Main_internal_15 = VCALL local_main_at_Main_internal_14 out_string + # Save new self pointer in $s1 + lw $s1, -60($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 0($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -64($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_main_at_Main_internal_7 --> -32($fp) + # LOCAL local_main_at_Main_internal_15 --> -64($fp) + # local_main_at_Main_internal_7 = local_main_at_Main_internal_15 + lw $t0, -64($fp) + sw $t0, -32($fp) + # GOTO label_ENDIF_32 +j label_ENDIF_32 +label_FALSEIF_31: + # LOCAL local_main_at_Main_internal_20 --> -84($fp) + # local_main_at_Main_internal_20 = SELF + sw $s1, -84($fp) + # LOCAL local_main_at_Main_internal_18 --> -76($fp) + # LOCAL local_main_at_Main_internal_20 --> -84($fp) + # local_main_at_Main_internal_18 = local_main_at_Main_internal_20 + lw $t0, -84($fp) + sw $t0, -76($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_21 --> -88($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_6 + sw $t0, 12($v0) + li $t0, 26 + sw $t0, 16($v0) + sw $v0, -88($fp) + # ARG local_main_at_Main_internal_21 + # LOCAL local_main_at_Main_internal_21 --> -88($fp) + lw $t0, -88($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_main_at_Main_internal_18 --> -76($fp) + # LOCAL local_main_at_Main_internal_19 --> -80($fp) + # local_main_at_Main_internal_19 = VCALL local_main_at_Main_internal_18 out_string + # Save new self pointer in $s1 + lw $s1, -76($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 0($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -80($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_main_at_Main_internal_7 --> -32($fp) + # LOCAL local_main_at_Main_internal_19 --> -80($fp) + # local_main_at_Main_internal_7 = local_main_at_Main_internal_19 + lw $t0, -80($fp) + sw $t0, -32($fp) + label_ENDIF_32: +# RETURN local_main_at_Main_internal_7 +lw $v0, -32($fp) +# Deallocate stack frame for function function_main_at_Main. +# Restore $ra +lw $ra, 4($sp) +# Restore $fp +lw $fp, 0($sp) +# Restore Stack pointer $sp +addu $sp, $sp, 96 +jr $ra +# Function END + diff --git a/tests/codegen/primes.mips b/tests/codegen/primes.mips new file mode 100644 index 00000000..43bded22 --- /dev/null +++ b/tests/codegen/primes.mips @@ -0,0 +1,2374 @@ + +# Code generated by PyCoolc. +# Eliane Puerta, Liset Alfaro, Adrian Gonzalez --- Mon Dec 14 11:08:36 2020 +# School of Math and Computer Science, University of Havana +# + +.data +dummy: .word 0 +IO: .asciiz "IO" +# Function END +Object: .asciiz "Object" +# Function END +String: .asciiz "String" +# Function END +Bool: .asciiz "Bool" +# Function END +Int: .asciiz "Int" +# Function END +Main: .asciiz "Main" +# Function END +# + + +# **** VTABLE for type IO **** +IO_vtable: .word dummy, function_out_string_at_IO, function_in_string_at_IO, function_in_int_at_IO, dummy, function_out_int_at_IO, function_copy_at_Object, dummy, function_abort_at_Object, dummy, function_type_name_at_Object +# Function END +# + + +# **** Type RECORD for type IO **** +IO_start: + IO_vtable_pointer: .word IO_vtable + # Function END +IO_end: +# + + +# **** VTABLE for type Object **** +Object_vtable: .word dummy, dummy, dummy, dummy, dummy, dummy, function_copy_at_Object, dummy, function_abort_at_Object, dummy, function_type_name_at_Object +# Function END +# + + +# **** Type RECORD for type Object **** +Object_start: + Object_vtable_pointer: .word Object_vtable + # Function END +Object_end: +# + + +# **** VTABLE for type String **** +String_vtable: .word function_concat_at_String, dummy, dummy, dummy, function_substr_at_String, dummy, function_copy_at_Object, function_length_at_String, function_abort_at_Object, dummy, function_type_name_at_Object +# Function END +# + + +# **** Type RECORD for type String **** +String_start: + String_vtable_pointer: .word String_vtable + # Function END +String_end: +# + + +# **** VTABLE for type Bool **** +Bool_vtable: .word dummy, dummy, dummy, dummy, dummy, dummy, function_copy_at_Object, dummy, function_abort_at_Object, dummy, function_type_name_at_Object +# Function END +# + + +# **** Type RECORD for type Bool **** +Bool_start: + Bool_vtable_pointer: .word Bool_vtable + # Function END +Bool_end: +# + + +# **** VTABLE for type Int **** +Int_vtable: .word dummy, dummy, dummy, dummy, dummy, dummy, function_copy_at_Object, dummy, function_abort_at_Object, dummy, function_type_name_at_Object +# Function END +# + + +# **** Type RECORD for type Int **** +Int_start: + Int_vtable_pointer: .word Int_vtable + # Function END +Int_end: +# + + +# **** VTABLE for type Main **** +Main_vtable: .word dummy, function_out_string_at_IO, function_in_string_at_IO, function_in_int_at_IO, dummy, function_out_int_at_IO, function_copy_at_Object, dummy, function_abort_at_Object, function_main_at_Main, function_type_name_at_Object +# Function END +# + + +# **** Type RECORD for type Main **** +Main_start: + Main_vtable_pointer: .word Main_vtable + # Function END +Main_end: +# + + +data_0: .asciiz "" +# + + +data_1: .asciiz "Abort called from class " +# + + +data_2: .asciiz "\n" +# + + +IO__TDT: .word 0, -1, -1, -1, -1, 1 +Object__TDT: .word 1, 0, 1, 1, 1, 2 +String__TDT: .word -1, -1, 0, -1, -1, -1 +Bool__TDT: .word -1, -1, -1, 0, -1, -1 +Int__TDT: .word -1, -1, -1, -1, 0, -1 +Main__TDT: .word -1, -1, -1, -1, -1, 0 +# + + +data_4: .asciiz "2 is trivially prime.\n" +# + + +data_5: .asciiz " is prime.\n" +# + + +data_6: .asciiz "halt" +# + + +data_7: .asciiz "continue" +# + + +.text +main: + jal entry + # syscall code 10 is for exit + li $v0, 10 + syscall + # Function END + +# function_in_string_at_IO implementation. +# @Params: +function_in_string_at_IO: + # Allocate stack frame for function function_in_string_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_in_string_at_IO_internal_0 --> -4($fp) + # Allocating 1024 bytes of memory + li $a0, 1024 + li $v0, 9 + syscall + move $t0, $v0 + move $a0, $v0 + li $a1, 1024 + li $v0, 8 + syscall + move $t2, $zero + move $t3, $zero + move $t1, $t0 + lb $t3, 0($t1) + beqz $t3, end_loop + read_length_loop: + lb $t3, 0($t1) + beqz $t3, end_read_length_loop + addu $t1, $t1, 1 + addu $t2, $t2, 1 + j read_length_loop + end_read_length_loop: + subu $t1, $t1, 1 + sb $zero, 0($t1) + subu $t2, $t2, 1 + end_loop: + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $t2, 16($v0) + sw $v0, -4($fp) + # RETURN local_in_string_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_in_string_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_out_int_at_IO implementation. +# @Params: +# 0($fp) = param_out_int_at_IO_x_0 +function_out_int_at_IO: + # Allocate stack frame for function function_out_int_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # PRINT_INT param_out_int_at_IO_x_0 + # PARAM param_out_int_at_IO_x_0 --> 0($fp) + lw $v0, 0($fp) + lw $a0, 12($v0) + li $v0, 1 + syscall + # LOCAL local_out_int_at_IO_internal_0 --> -4($fp) + # local_out_int_at_IO_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_out_int_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_out_int_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_out_string_at_IO implementation. +# @Params: +# 0($fp) = param_out_string_at_IO_x_0 +function_out_string_at_IO: + # Allocate stack frame for function function_out_string_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # PARAM param_out_string_at_IO_x_0 --> 0($fp) + # PRINT_STR param_out_string_at_IO_x_0 + lw $v0, 0($fp) + lw $a0, 12($v0) + li $v0, 4 + syscall + # LOCAL local_out_string_at_IO_internal_0 --> -4($fp) + # local_out_string_at_IO_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_out_string_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_out_string_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_in_int_at_IO implementation. +# @Params: +function_in_int_at_IO: + # Allocate stack frame for function function_in_int_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_in_int_at_IO_internal_0 --> -4($fp) + # local_in_int_at_IO_internal_0 = READ_INT + li $v0, 5 + syscall + move $a2, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + sw $a2, 12($v0) + sw $v0, -4($fp) + # RETURN local_in_int_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_in_int_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_abort_at_Object implementation. +# @Params: +function_abort_at_Object: + # Allocate stack frame for function function_abort_at_Object. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_abort_at_Object_internal_0 --> -4($fp) + lw $t0, 0($s1) + sw $t0, -4($fp) + # LOCAL local_abort_at_Object_internal_0 --> -4($fp) + la $a0, data_1 + li $v0, 4 + syscall + lw $a0, -4($fp) + li $v0, 4 + syscall + la $a0, data_2 + li $v0, 4 + syscall + li $v0, 10 + syscall + # Function END + + +# function_copy_at_Object implementation. +# @Params: +function_copy_at_Object: + # Allocate stack frame for function function_copy_at_Object. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_copy_at_Object_internal_0 --> -4($fp) + # local_copy_at_Object_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_copy_at_Object_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function function_copy_at_Object. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_type_name_at_Object implementation. +# @Params: +function_type_name_at_Object: + # Allocate stack frame for function function_type_name_at_Object. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_type_name_at_Object_internal_0 --> -4($fp) + lw $t0, 0($s1) + sw $t0, -4($fp) + # RETURN local_type_name_at_Object_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_type_name_at_Object. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_concat_at_String implementation. +# @Params: +# 0($fp) = param_concat_at_String_s_0 +function_concat_at_String: + # Allocate stack frame for function function_concat_at_String. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_concat_at_String_internal_0 = self.CONCAT + # LOCAL local_concat_at_String_internal_0 --> -4($fp) + # PARAM param_concat_at_String_s_0 --> 0($fp) + # Get first string length from self + lw $t0, 16($s1) + # Get second string length from param + lw $v0, 0($fp) + lw $t1, 16($v0) + # Save new string length in a0 for memory allocation + addu $a0, $t0, $t1 + move $t3, $a0 + # Get first string from self + lw $t0, 12($s1) + # Get second string from param + lw $t1, 12($v0) + addu $a0, $a0, 4 + li $v0, 9 + syscall + move $t2, $v0 + move $t4, $zero + concat_loop1: + # Compare t0 with \0 + lb $t4, 0($t0) + beqz $t4, concat_loop1_end + # Copy 1 byte + sb $t4, 0($t2) + addu $t2, $t2, 1 + addu $t0, $t0, 1 + j concat_loop1 + concat_loop1_end: + # Copy second string + concat_loop2: + # Compare t1 with \0 + lb $t4, 0($t1) + beqz $t4, concat_loop2_end + # Copy 1 byte + sb $t4, 0($t2) + addu $t2, $t2, 1 + addu $t1, $t1, 1 + j concat_loop2 + concat_loop2_end: + sb $zero, 0($t2) + # v0 contains resulting string + move $t1, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + sw $t1, 12($v0) + sw $t3, 16($v0) + sw $v0, -4($fp) + # RETURN local_concat_at_String_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_concat_at_String. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_substr_at_String implementation. +# @Params: +# 0($fp) = param_substr_at_String_l_0 +# 4($fp) = param_substr_at_String_r_1 +function_substr_at_String: + # Allocate stack frame for function function_substr_at_String. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_substr_at_String_internal_0 --> -4($fp) + # PARAM param_substr_at_String_l_0 --> 4($fp) + # PARAM param_substr_at_String_r_1 --> 0($fp) + lw $t0, 12($s1) + lw $t2, 4($fp) + lw $t2, 12($t2) + addu $t0, $t0, $t2 + lw $a0, 0($fp) + lw $a0, 12($a0) + move $t3, $a0 + move $t1, $a0 + addu $a0, $a0, 1 + li $v0, 9 + syscall + move $t2, $v0 + substr_loop: + beqz $t1, substr_end + lb $a0, 0($t0) + sb $a0, 0($t2) + addu $t0, $t0, 1 + addu $t2, $t2, 1 + subu $t1, $t1, 1 + j substr_loop + substr_end: + sb $zero, 0($t2) + move $t1, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + sw $t1, 12($v0) + sw $t3, 16($v0) + sw $v0, -4($fp) + # RETURN local_substr_at_String_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_substr_at_String. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 8 + jr $ra + # Function END + + +# function_length_at_String implementation. +# @Params: +function_length_at_String: + # Allocate stack frame for function function_length_at_String. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_length_at_String_internal_0 = GETATTRIBUTE length String + # LOCAL local_length_at_String_internal_0 --> -4($fp) + lw $t0, 16($s1) + sw $t0, -4($fp) + # LOCAL local_length_at_String_internal_1 --> -8($fp) + # LOCAL local_length_at_String_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + lw $t0, -4($fp) + sw $t0, 12($v0) + sw $v0, -8($fp) + # RETURN local_length_at_String_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function function_length_at_String. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# entry implementation. +# @Params: +entry: + # Allocate stack frame for function entry. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local__internal_0 --> -4($fp) + # local__internal_0 = ALLOCATE Main + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Main + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 32 bytes of memory + li $a0, 32 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Main_start + sw $t0, 4($v0) + # Load type offset + li $t0, 20 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Main__attrib__out__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 12($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Main__attrib__testee__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 16($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Main__attrib__divisor__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 20($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Main__attrib__stop__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 24($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Main__attrib__m__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 28($t1) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -4($fp) + # LOCAL local__internal_0 --> -4($fp) + lw $s1, -4($fp) + # local__internal_1 = CALL main + # LOCAL local__internal_1 --> -8($fp) + # LOCAL local__internal_0 --> -4($fp) + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type's VTABLE + la $t0, Main_vtable + # Get pointer to function address + lw $t1, 36($t0) + # Call function. Result is on $v0 + jalr $t1 + sw $v0, -8($fp) + # RETURN 0 + li $v0, 0 + # Deallocate stack frame for function entry. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# __Main__attrib__out__init implementation. +# @Params: +__Main__attrib__out__init: + # Allocate stack frame for function __Main__attrib__out__init. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_ttrib__out__init_internal_3 --> -16($fp) + # local_ttrib__out__init_internal_3 = SELF + sw $s1, -16($fp) + # LOCAL local_ttrib__out__init_internal_1 --> -8($fp) + # LOCAL local_ttrib__out__init_internal_3 --> -16($fp) + # local_ttrib__out__init_internal_1 = local_ttrib__out__init_internal_3 + lw $t0, -16($fp) + sw $t0, -8($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_ttrib__out__init_internal_4 --> -20($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_4 + sw $t0, 12($v0) + li $t0, 22 + sw $t0, 16($v0) + sw $v0, -20($fp) + # ARG local_ttrib__out__init_internal_4 + # LOCAL local_ttrib__out__init_internal_4 --> -20($fp) + lw $t0, -20($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_ttrib__out__init_internal_1 --> -8($fp) + # LOCAL local_ttrib__out__init_internal_2 --> -12($fp) + # local_ttrib__out__init_internal_2 = VCALL local_ttrib__out__init_internal_1 out_string + # Save new self pointer in $s1 + lw $s1, -8($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 4($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -12($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_ttrib__out__init_internal_5 --> -24($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 2 + sw $t0, 12($v0) + sw $v0, -24($fp) + # RETURN local_ttrib__out__init_internal_5 + lw $v0, -24($fp) + # Deallocate stack frame for function __Main__attrib__out__init. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# __Main__attrib__testee__init implementation. +# @Params: +__Main__attrib__testee__init: + # Allocate stack frame for function __Main__attrib__testee__init. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_ttrib__testee__init_internal_1 = GETATTRIBUTE out Main + # LOCAL local_ttrib__testee__init_internal_1 --> -8($fp) + lw $t0, 12($s1) + sw $t0, -8($fp) + # RETURN local_ttrib__testee__init_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function __Main__attrib__testee__init. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# __Main__attrib__divisor__init implementation. +# @Params: +__Main__attrib__divisor__init: + # Allocate stack frame for function __Main__attrib__divisor__init. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_ttrib__divisor__init_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -4($fp) + # RETURN local_ttrib__divisor__init_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function __Main__attrib__divisor__init. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# __Main__attrib__stop__init implementation. +# @Params: +__Main__attrib__stop__init: + # Allocate stack frame for function __Main__attrib__stop__init. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_ttrib__stop__init_internal_1 --> -8($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 500 + sw $t0, 12($v0) + sw $v0, -8($fp) + # RETURN local_ttrib__stop__init_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function __Main__attrib__stop__init. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# __Main__attrib__m__init implementation. +# @Params: +__Main__attrib__m__init: + # Allocate stack frame for function __Main__attrib__m__init. + subu $sp, $sp, 244 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 244 + label_WHILE_1: + # LOCAL local_ttrib__m__init_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -12($fp) + # LOCAL local_ttrib__m__init_internal_1 --> -8($fp) + # LOCAL local_ttrib__m__init_internal_2 --> -12($fp) + # Obtain value from -12($fp) + lw $v0, -12($fp) + lw $v0, 12($v0) + sw $v0, -8($fp) + # IF_ZERO local_ttrib__m__init_internal_1 GOTO label_WHILE_END_2 + # IF_ZERO local_ttrib__m__init_internal_1 GOTO label_WHILE_END_2 + lw $t0, -8($fp) + beq $t0, 0, label_WHILE_END_2 + # local_ttrib__m__init_internal_4 = GETATTRIBUTE testee Main + # LOCAL local_ttrib__m__init_internal_4 --> -20($fp) + lw $t0, 16($s1) + sw $t0, -20($fp) + # LOCAL local_ttrib__m__init_internal_5 --> -24($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -24($fp) + # LOCAL local_ttrib__m__init_internal_3 --> -16($fp) + # LOCAL local_ttrib__m__init_internal_4 --> -20($fp) + # LOCAL local_ttrib__m__init_internal_5 --> -24($fp) + # local_ttrib__m__init_internal_3 = local_ttrib__m__init_internal_4 + local_ttrib__m__init_internal_5 + lw $t1, -20($fp) + lw $t0, 12($t1) + lw $t1, -24($fp) + lw $t2, 12($t1) + add $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -16($fp) + # + # LOCAL local_ttrib__m__init_internal_3 --> -16($fp) + lw $t0, -16($fp) + sw $t0, 16($s1) + # LOCAL local_ttrib__m__init_internal_6 --> -28($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 2 + sw $t0, 12($v0) + sw $v0, -28($fp) + # + # LOCAL local_ttrib__m__init_internal_6 --> -28($fp) + lw $t0, -28($fp) + sw $t0, 20($s1) + label_WHILE_3: + # local_ttrib__m__init_internal_11 = GETATTRIBUTE testee Main + # LOCAL local_ttrib__m__init_internal_11 --> -48($fp) + lw $t0, 16($s1) + sw $t0, -48($fp) + # local_ttrib__m__init_internal_13 = GETATTRIBUTE divisor Main + # LOCAL local_ttrib__m__init_internal_13 --> -56($fp) + lw $t0, 20($s1) + sw $t0, -56($fp) + # local_ttrib__m__init_internal_14 = GETATTRIBUTE divisor Main + # LOCAL local_ttrib__m__init_internal_14 --> -60($fp) + lw $t0, 20($s1) + sw $t0, -60($fp) + # LOCAL local_ttrib__m__init_internal_12 --> -52($fp) + # LOCAL local_ttrib__m__init_internal_13 --> -56($fp) + # LOCAL local_ttrib__m__init_internal_14 --> -60($fp) + # local_ttrib__m__init_internal_12 = local_ttrib__m__init_internal_13 * local_ttrib__m__init_internal_14 + lw $t1, -56($fp) + lw $t0, 12($t1) + lw $t1, -60($fp) + lw $t2, 12($t1) + mul $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -52($fp) + # LOCAL local_ttrib__m__init_internal_10 --> -44($fp) + # LOCAL local_ttrib__m__init_internal_11 --> -48($fp) + # LOCAL local_ttrib__m__init_internal_12 --> -52($fp) + lw $a0, -48($fp) + lw $a1, -52($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -44($fp) + # IF_GREATER_ZERO local_ttrib__m__init_internal_10 GOTO label_FALSE_7 + # IF_GREATER_ZERO local_ttrib__m__init_internal_10 GOTO label_FALSE_7 + lw $t0, -44($fp) + bgt $t0, 0, label_FALSE_7 + # IF_ZERO local_ttrib__m__init_internal_10 GOTO label_FALSE_7 + # IF_ZERO local_ttrib__m__init_internal_10 GOTO label_FALSE_7 + lw $t0, -44($fp) + beq $t0, 0, label_FALSE_7 + # LOCAL local_ttrib__m__init_internal_10 --> -44($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -44($fp) + # GOTO label_END_8 +j label_END_8 +label_FALSE_7: + # LOCAL local_ttrib__m__init_internal_10 --> -44($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -44($fp) + label_END_8: +# LOCAL local_ttrib__m__init_internal_8 --> -36($fp) +# LOCAL local_ttrib__m__init_internal_10 --> -44($fp) +# Obtain value from -44($fp) +lw $v0, -44($fp) +lw $v0, 12($v0) +sw $v0, -36($fp) +# IF_ZERO local_ttrib__m__init_internal_8 GOTO label_FALSEIF_5 +# IF_ZERO local_ttrib__m__init_internal_8 GOTO label_FALSEIF_5 +lw $t0, -36($fp) +beq $t0, 0, label_FALSEIF_5 +# LOCAL local_ttrib__m__init_internal_15 --> -64($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Bool +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Bool +sw $t0, 12($v0) +li $t0, 4 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Bool_start +sw $t0, 4($v0) +# Load type offset +li $t0, 12 +sw $t0, 8($v0) +li $t0, 0 +sw $t0, 12($v0) +sw $v0, -64($fp) +# LOCAL local_ttrib__m__init_internal_9 --> -40($fp) +# LOCAL local_ttrib__m__init_internal_15 --> -64($fp) +# local_ttrib__m__init_internal_9 = local_ttrib__m__init_internal_15 +lw $t0, -64($fp) +sw $t0, -40($fp) +# GOTO label_ENDIF_6 +j label_ENDIF_6 +label_FALSEIF_5: + # local_ttrib__m__init_internal_21 = GETATTRIBUTE testee Main + # LOCAL local_ttrib__m__init_internal_21 --> -88($fp) + lw $t0, 16($s1) + sw $t0, -88($fp) + # local_ttrib__m__init_internal_23 = GETATTRIBUTE divisor Main + # LOCAL local_ttrib__m__init_internal_23 --> -96($fp) + lw $t0, 20($s1) + sw $t0, -96($fp) + # local_ttrib__m__init_internal_25 = GETATTRIBUTE testee Main + # LOCAL local_ttrib__m__init_internal_25 --> -104($fp) + lw $t0, 16($s1) + sw $t0, -104($fp) + # local_ttrib__m__init_internal_26 = GETATTRIBUTE divisor Main + # LOCAL local_ttrib__m__init_internal_26 --> -108($fp) + lw $t0, 20($s1) + sw $t0, -108($fp) + # LOCAL local_ttrib__m__init_internal_24 --> -100($fp) + # LOCAL local_ttrib__m__init_internal_25 --> -104($fp) + # LOCAL local_ttrib__m__init_internal_26 --> -108($fp) + # local_ttrib__m__init_internal_24 = local_ttrib__m__init_internal_25 / local_ttrib__m__init_internal_26 + lw $t1, -104($fp) + lw $t0, 12($t1) + lw $t1, -108($fp) + lw $t2, 12($t1) + div $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -100($fp) + # LOCAL local_ttrib__m__init_internal_22 --> -92($fp) + # LOCAL local_ttrib__m__init_internal_23 --> -96($fp) + # LOCAL local_ttrib__m__init_internal_24 --> -100($fp) + # local_ttrib__m__init_internal_22 = local_ttrib__m__init_internal_23 * local_ttrib__m__init_internal_24 + lw $t1, -96($fp) + lw $t0, 12($t1) + lw $t1, -100($fp) + lw $t2, 12($t1) + mul $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -92($fp) + # LOCAL local_ttrib__m__init_internal_20 --> -84($fp) + # LOCAL local_ttrib__m__init_internal_21 --> -88($fp) + # LOCAL local_ttrib__m__init_internal_22 --> -92($fp) + # local_ttrib__m__init_internal_20 = local_ttrib__m__init_internal_21 - local_ttrib__m__init_internal_22 + lw $t1, -88($fp) + lw $t0, 12($t1) + lw $t1, -92($fp) + lw $t2, 12($t1) + sub $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -84($fp) + # LOCAL local_ttrib__m__init_internal_27 --> -112($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -112($fp) + # IF_ZERO local_ttrib__m__init_internal_20 GOTO label_FALSE_11 + # IF_ZERO local_ttrib__m__init_internal_20 GOTO label_FALSE_11 + lw $t0, -84($fp) + beq $t0, 0, label_FALSE_11 + # IF_ZERO local_ttrib__m__init_internal_27 GOTO label_FALSE_11 + # IF_ZERO local_ttrib__m__init_internal_27 GOTO label_FALSE_11 + lw $t0, -112($fp) + beq $t0, 0, label_FALSE_11 + # LOCAL local_ttrib__m__init_internal_19 --> -80($fp) + # LOCAL local_ttrib__m__init_internal_20 --> -84($fp) + # Comparing -84($fp) type with String + la $v0, String + lw $a0, -84($fp) + lw $a0, 0($a0) + sub $a0, $a0, $v0 + sw $a0, -80($fp) + # IF_ZERO local_ttrib__m__init_internal_19 GOTO label_COMPARE_STRING_14 + # IF_ZERO local_ttrib__m__init_internal_19 GOTO label_COMPARE_STRING_14 + lw $t0, -80($fp) + beq $t0, 0, label_COMPARE_STRING_14 + # LOCAL local_ttrib__m__init_internal_19 --> -80($fp) + # LOCAL local_ttrib__m__init_internal_20 --> -84($fp) + # Comparing -84($fp) type with Bool + la $v0, Bool + lw $a0, -84($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -80($fp) + # IF_ZERO local_ttrib__m__init_internal_19 GOTO label_COMPARE_BY_VALUE_15 + # IF_ZERO local_ttrib__m__init_internal_19 GOTO label_COMPARE_BY_VALUE_15 + lw $t0, -80($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_15 + # LOCAL local_ttrib__m__init_internal_19 --> -80($fp) + # LOCAL local_ttrib__m__init_internal_20 --> -84($fp) + # Comparing -84($fp) type with Int + la $v0, Int + lw $a0, -84($fp) + lw $a0, 0($a0) + lw $a0, 12($a0) + sub $a0, $a0, $v0 + sw $a0, -80($fp) + # IF_ZERO local_ttrib__m__init_internal_19 GOTO label_COMPARE_BY_VALUE_15 + # IF_ZERO local_ttrib__m__init_internal_19 GOTO label_COMPARE_BY_VALUE_15 + lw $t0, -80($fp) + beq $t0, 0, label_COMPARE_BY_VALUE_15 + # LOCAL local_ttrib__m__init_internal_19 --> -80($fp) + # LOCAL local_ttrib__m__init_internal_20 --> -84($fp) + # LOCAL local_ttrib__m__init_internal_27 --> -112($fp) + # Load pointers and SUB + lw $a0, -84($fp) + lw $a1, -112($fp) + sub $a0, $a0, $a1 + sw $a0, -80($fp) + # IF_ZERO local_ttrib__m__init_internal_19 GOTO label_TRUE_12 + # IF_ZERO local_ttrib__m__init_internal_19 GOTO label_TRUE_12 + lw $t0, -80($fp) + beq $t0, 0, label_TRUE_12 + # GOTO label_FALSE_11 + j label_FALSE_11 + label_COMPARE_BY_VALUE_15: + # LOCAL local_ttrib__m__init_internal_19 --> -80($fp) + # LOCAL local_ttrib__m__init_internal_20 --> -84($fp) + # LOCAL local_ttrib__m__init_internal_27 --> -112($fp) + lw $a0, -84($fp) + lw $a1, -112($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -80($fp) + # IF_ZERO local_ttrib__m__init_internal_19 GOTO label_TRUE_12 + # IF_ZERO local_ttrib__m__init_internal_19 GOTO label_TRUE_12 + lw $t0, -80($fp) + beq $t0, 0, label_TRUE_12 + # GOTO label_FALSE_11 + j label_FALSE_11 + label_COMPARE_STRING_14: + # LOCAL local_ttrib__m__init_internal_19 --> -80($fp) + # LOCAL local_ttrib__m__init_internal_20 --> -84($fp) + # LOCAL local_ttrib__m__init_internal_27 --> -112($fp) + # Load strings for comparison + lw $v0, -84($fp) + lw $v1, -112($fp) + # Compare lengths + lw $v0, 16($v0) + lw $v1, 16($v1) + sub $v0, $v0, $v1 + sw $v0, -80($fp) + # IF_ZERO local_ttrib__m__init_internal_19 GOTO label_CONTINUE_16 + # IF_ZERO local_ttrib__m__init_internal_19 GOTO label_CONTINUE_16 + lw $t0, -80($fp) + beq $t0, 0, label_CONTINUE_16 + # GOTO label_FALSE_11 + j label_FALSE_11 + label_CONTINUE_16: + # LOCAL local_ttrib__m__init_internal_19 --> -80($fp) + # LOCAL local_ttrib__m__init_internal_20 --> -84($fp) + # LOCAL local_ttrib__m__init_internal_27 --> -112($fp) + move $a2, $zero + # Load strings for comparison + lw $v0, -84($fp) + lw $v1, -112($fp) + # Load strings pointers + lw $v0, 12($v0) + lw $v1, 12($v1) + # Compare loop, while [v0] != \0 + label_WHILE_STR_COMP_17: + lb $a0, 0($v0) + # If EOS => break + beqz $a0, label_WHILE_STR_COMP_END_18 + lb $a1, 0($v1) + # Move strings pointers + addu $v0, $v0, 1 + addu $v1, $v1, 1 + # Compare chars + sub $a0, $a0, $a1 + beqz $a0, label_WHILE_STR_COMP_17 + # False + li $a2, 1 + label_WHILE_STR_COMP_END_18: + # Store result + sw $a2, -80($fp) + # IF_ZERO local_ttrib__m__init_internal_19 GOTO label_TRUE_12 + # IF_ZERO local_ttrib__m__init_internal_19 GOTO label_TRUE_12 + lw $t0, -80($fp) + beq $t0, 0, label_TRUE_12 + label_FALSE_11: + # LOCAL local_ttrib__m__init_internal_18 --> -76($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -76($fp) + # GOTO label_END_13 +j label_END_13 +label_TRUE_12: + # LOCAL local_ttrib__m__init_internal_18 --> -76($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -76($fp) + label_END_13: +# LOCAL local_ttrib__m__init_internal_16 --> -68($fp) +# LOCAL local_ttrib__m__init_internal_18 --> -76($fp) +# Obtain value from -76($fp) +lw $v0, -76($fp) +lw $v0, 12($v0) +sw $v0, -68($fp) +# IF_ZERO local_ttrib__m__init_internal_16 GOTO label_FALSEIF_9 +# IF_ZERO local_ttrib__m__init_internal_16 GOTO label_FALSEIF_9 +lw $t0, -68($fp) +beq $t0, 0, label_FALSEIF_9 +# LOCAL local_ttrib__m__init_internal_28 --> -116($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Bool +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Bool +sw $t0, 12($v0) +li $t0, 4 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Bool_start +sw $t0, 4($v0) +# Load type offset +li $t0, 12 +sw $t0, 8($v0) +li $t0, 0 +sw $t0, 12($v0) +sw $v0, -116($fp) +# LOCAL local_ttrib__m__init_internal_17 --> -72($fp) +# LOCAL local_ttrib__m__init_internal_28 --> -116($fp) +# local_ttrib__m__init_internal_17 = local_ttrib__m__init_internal_28 +lw $t0, -116($fp) +sw $t0, -72($fp) +# GOTO label_ENDIF_10 +j label_ENDIF_10 +label_FALSEIF_9: + # LOCAL local_ttrib__m__init_internal_29 --> -120($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -120($fp) + # LOCAL local_ttrib__m__init_internal_17 --> -72($fp) + # LOCAL local_ttrib__m__init_internal_29 --> -120($fp) + # local_ttrib__m__init_internal_17 = local_ttrib__m__init_internal_29 + lw $t0, -120($fp) + sw $t0, -72($fp) + label_ENDIF_10: +# LOCAL local_ttrib__m__init_internal_9 --> -40($fp) +# LOCAL local_ttrib__m__init_internal_17 --> -72($fp) +# local_ttrib__m__init_internal_9 = local_ttrib__m__init_internal_17 +lw $t0, -72($fp) +sw $t0, -40($fp) +label_ENDIF_6: +# LOCAL local_ttrib__m__init_internal_7 --> -32($fp) +# LOCAL local_ttrib__m__init_internal_9 --> -40($fp) +# Obtain value from -40($fp) +lw $v0, -40($fp) +lw $v0, 12($v0) +sw $v0, -32($fp) +# IF_ZERO local_ttrib__m__init_internal_7 GOTO label_WHILE_END_4 +# IF_ZERO local_ttrib__m__init_internal_7 GOTO label_WHILE_END_4 +lw $t0, -32($fp) +beq $t0, 0, label_WHILE_END_4 +# local_ttrib__m__init_internal_31 = GETATTRIBUTE divisor Main +# LOCAL local_ttrib__m__init_internal_31 --> -128($fp) +lw $t0, 20($s1) +sw $t0, -128($fp) +# LOCAL local_ttrib__m__init_internal_32 --> -132($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 1 +sw $t0, 12($v0) +sw $v0, -132($fp) +# LOCAL local_ttrib__m__init_internal_30 --> -124($fp) +# LOCAL local_ttrib__m__init_internal_31 --> -128($fp) +# LOCAL local_ttrib__m__init_internal_32 --> -132($fp) +# local_ttrib__m__init_internal_30 = local_ttrib__m__init_internal_31 + local_ttrib__m__init_internal_32 +lw $t1, -128($fp) +lw $t0, 12($t1) +lw $t1, -132($fp) +lw $t2, 12($t1) +add $t0, $t0, $t2 +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t1, String +sw $t1, 0($v0) +la $t1, String_start +sw $t1, 4($v0) +# Load type offset +li $t1, 8 +sw $t1, 8($v0) +la $t1, Int +sw $t1, 12($v0) +li $t1, 3 +sw $t1, 16($v0) +move $t1, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t1, 0($v0) +la $t1, Int_start +sw $t1, 4($v0) +# Load type offset +li $t1, 16 +sw $t1, 8($v0) +sw $t0, 12($v0) +sw $v0, -124($fp) +# +# LOCAL local_ttrib__m__init_internal_30 --> -124($fp) +lw $t0, -124($fp) +sw $t0, 20($s1) +# GOTO label_WHILE_3 +j label_WHILE_3 +label_WHILE_END_4: + # local_ttrib__m__init_internal_36 = GETATTRIBUTE testee Main + # LOCAL local_ttrib__m__init_internal_36 --> -148($fp) + lw $t0, 16($s1) + sw $t0, -148($fp) + # local_ttrib__m__init_internal_38 = GETATTRIBUTE divisor Main + # LOCAL local_ttrib__m__init_internal_38 --> -156($fp) + lw $t0, 20($s1) + sw $t0, -156($fp) + # local_ttrib__m__init_internal_39 = GETATTRIBUTE divisor Main + # LOCAL local_ttrib__m__init_internal_39 --> -160($fp) + lw $t0, 20($s1) + sw $t0, -160($fp) + # LOCAL local_ttrib__m__init_internal_37 --> -152($fp) + # LOCAL local_ttrib__m__init_internal_38 --> -156($fp) + # LOCAL local_ttrib__m__init_internal_39 --> -160($fp) + # local_ttrib__m__init_internal_37 = local_ttrib__m__init_internal_38 * local_ttrib__m__init_internal_39 + lw $t1, -156($fp) + lw $t0, 12($t1) + lw $t1, -160($fp) + lw $t2, 12($t1) + mul $t0, $t0, $t2 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + la $t1, Int + sw $t1, 12($v0) + li $t1, 3 + sw $t1, 16($v0) + move $t1, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t1, 0($v0) + la $t1, Int_start + sw $t1, 4($v0) + # Load type offset + li $t1, 16 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $v0, -152($fp) + # LOCAL local_ttrib__m__init_internal_35 --> -144($fp) + # LOCAL local_ttrib__m__init_internal_36 --> -148($fp) + # LOCAL local_ttrib__m__init_internal_37 --> -152($fp) + lw $a0, -148($fp) + lw $a1, -152($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -144($fp) + # IF_GREATER_ZERO local_ttrib__m__init_internal_35 GOTO label_FALSE_21 + # IF_GREATER_ZERO local_ttrib__m__init_internal_35 GOTO label_FALSE_21 + lw $t0, -144($fp) + bgt $t0, 0, label_FALSE_21 + # IF_ZERO local_ttrib__m__init_internal_35 GOTO label_FALSE_21 + # IF_ZERO local_ttrib__m__init_internal_35 GOTO label_FALSE_21 + lw $t0, -144($fp) + beq $t0, 0, label_FALSE_21 + # LOCAL local_ttrib__m__init_internal_35 --> -144($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -144($fp) + # GOTO label_END_22 +j label_END_22 +label_FALSE_21: + # LOCAL local_ttrib__m__init_internal_35 --> -144($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -144($fp) + label_END_22: +# LOCAL local_ttrib__m__init_internal_33 --> -136($fp) +# LOCAL local_ttrib__m__init_internal_35 --> -144($fp) +# Obtain value from -144($fp) +lw $v0, -144($fp) +lw $v0, 12($v0) +sw $v0, -136($fp) +# IF_ZERO local_ttrib__m__init_internal_33 GOTO label_FALSEIF_19 +# IF_ZERO local_ttrib__m__init_internal_33 GOTO label_FALSEIF_19 +lw $t0, -136($fp) +beq $t0, 0, label_FALSEIF_19 +# local_ttrib__m__init_internal_40 = GETATTRIBUTE testee Main +# LOCAL local_ttrib__m__init_internal_40 --> -164($fp) +lw $t0, 16($s1) +sw $t0, -164($fp) +# +# LOCAL local_ttrib__m__init_internal_40 --> -164($fp) +lw $t0, -164($fp) +sw $t0, 12($s1) +# LOCAL local_ttrib__m__init_internal_43 --> -176($fp) +# local_ttrib__m__init_internal_43 = SELF +sw $s1, -176($fp) +# LOCAL local_ttrib__m__init_internal_41 --> -168($fp) +# LOCAL local_ttrib__m__init_internal_43 --> -176($fp) +# local_ttrib__m__init_internal_41 = local_ttrib__m__init_internal_43 +lw $t0, -176($fp) +sw $t0, -168($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# local_ttrib__m__init_internal_44 = GETATTRIBUTE out Main +# LOCAL local_ttrib__m__init_internal_44 --> -180($fp) +lw $t0, 12($s1) +sw $t0, -180($fp) +# ARG local_ttrib__m__init_internal_44 +# LOCAL local_ttrib__m__init_internal_44 --> -180($fp) +lw $t0, -180($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_ttrib__m__init_internal_41 --> -168($fp) +# LOCAL local_ttrib__m__init_internal_42 --> -172($fp) +# local_ttrib__m__init_internal_42 = VCALL local_ttrib__m__init_internal_41 out_int +# Save new self pointer in $s1 +lw $s1, -168($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 20($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -172($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_ttrib__m__init_internal_47 --> -192($fp) +# local_ttrib__m__init_internal_47 = SELF +sw $s1, -192($fp) +# LOCAL local_ttrib__m__init_internal_45 --> -184($fp) +# LOCAL local_ttrib__m__init_internal_47 --> -192($fp) +# local_ttrib__m__init_internal_45 = local_ttrib__m__init_internal_47 +lw $t0, -192($fp) +sw $t0, -184($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_ttrib__m__init_internal_48 --> -196($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_5 +sw $t0, 12($v0) +li $t0, 11 +sw $t0, 16($v0) +sw $v0, -196($fp) +# ARG local_ttrib__m__init_internal_48 +# LOCAL local_ttrib__m__init_internal_48 --> -196($fp) +lw $t0, -196($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_ttrib__m__init_internal_45 --> -184($fp) +# LOCAL local_ttrib__m__init_internal_46 --> -188($fp) +# local_ttrib__m__init_internal_46 = VCALL local_ttrib__m__init_internal_45 out_string +# Save new self pointer in $s1 +lw $s1, -184($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 4($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -188($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_ttrib__m__init_internal_34 --> -140($fp) +# LOCAL local_ttrib__m__init_internal_46 --> -188($fp) +# local_ttrib__m__init_internal_34 = local_ttrib__m__init_internal_46 +lw $t0, -188($fp) +sw $t0, -140($fp) +# GOTO label_ENDIF_20 +j label_ENDIF_20 +label_FALSEIF_19: + # LOCAL local_ttrib__m__init_internal_49 --> -200($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -200($fp) + # LOCAL local_ttrib__m__init_internal_34 --> -140($fp) + # LOCAL local_ttrib__m__init_internal_49 --> -200($fp) + # local_ttrib__m__init_internal_34 = local_ttrib__m__init_internal_49 + lw $t0, -200($fp) + sw $t0, -140($fp) + label_ENDIF_20: +# local_ttrib__m__init_internal_53 = GETATTRIBUTE stop Main +# LOCAL local_ttrib__m__init_internal_53 --> -216($fp) +lw $t0, 24($s1) +sw $t0, -216($fp) +# local_ttrib__m__init_internal_54 = GETATTRIBUTE testee Main +# LOCAL local_ttrib__m__init_internal_54 --> -220($fp) +lw $t0, 16($s1) +sw $t0, -220($fp) +# LOCAL local_ttrib__m__init_internal_52 --> -212($fp) +# LOCAL local_ttrib__m__init_internal_53 --> -216($fp) +# LOCAL local_ttrib__m__init_internal_54 --> -220($fp) +lw $a0, -216($fp) +lw $a1, -220($fp) +# Load values +lw $a0, 12($a0) +lw $a1, 12($a1) +# SUB and store +sub $a0, $a0, $a1 +sw $a0, -212($fp) +# IF_GREATER_ZERO local_ttrib__m__init_internal_52 GOTO label_FALSE_25 +# IF_GREATER_ZERO local_ttrib__m__init_internal_52 GOTO label_FALSE_25 +lw $t0, -212($fp) +bgt $t0, 0, label_FALSE_25 +# LOCAL local_ttrib__m__init_internal_52 --> -212($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Bool +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Bool +sw $t0, 12($v0) +li $t0, 4 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Bool_start +sw $t0, 4($v0) +# Load type offset +li $t0, 12 +sw $t0, 8($v0) +li $t0, 1 +sw $t0, 12($v0) +sw $v0, -212($fp) +# GOTO label_END_26 +j label_END_26 +label_FALSE_25: + # LOCAL local_ttrib__m__init_internal_52 --> -212($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -212($fp) + label_END_26: +# LOCAL local_ttrib__m__init_internal_50 --> -204($fp) +# LOCAL local_ttrib__m__init_internal_52 --> -212($fp) +# Obtain value from -212($fp) +lw $v0, -212($fp) +lw $v0, 12($v0) +sw $v0, -204($fp) +# IF_ZERO local_ttrib__m__init_internal_50 GOTO label_FALSEIF_23 +# IF_ZERO local_ttrib__m__init_internal_50 GOTO label_FALSEIF_23 +lw $t0, -204($fp) +beq $t0, 0, label_FALSEIF_23 +# LOCAL local_ttrib__m__init_internal_57 --> -232($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_6 +sw $t0, 12($v0) +li $t0, 4 +sw $t0, 16($v0) +sw $v0, -232($fp) +# LOCAL local_ttrib__m__init_internal_55 --> -224($fp) +# LOCAL local_ttrib__m__init_internal_57 --> -232($fp) +# local_ttrib__m__init_internal_55 = local_ttrib__m__init_internal_57 +lw $t0, -232($fp) +sw $t0, -224($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_ttrib__m__init_internal_55 --> -224($fp) +# LOCAL local_ttrib__m__init_internal_56 --> -228($fp) +# local_ttrib__m__init_internal_56 = VCALL local_ttrib__m__init_internal_55 abort +# Save new self pointer in $s1 +lw $s1, -224($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 32($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -228($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_ttrib__m__init_internal_51 --> -208($fp) +# LOCAL local_ttrib__m__init_internal_56 --> -228($fp) +# local_ttrib__m__init_internal_51 = local_ttrib__m__init_internal_56 +lw $t0, -228($fp) +sw $t0, -208($fp) +# GOTO label_ENDIF_24 +j label_ENDIF_24 +label_FALSEIF_23: + # LOCAL local_ttrib__m__init_internal_58 --> -236($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_7 + sw $t0, 12($v0) + li $t0, 8 + sw $t0, 16($v0) + sw $v0, -236($fp) + # LOCAL local_ttrib__m__init_internal_51 --> -208($fp) + # LOCAL local_ttrib__m__init_internal_58 --> -236($fp) + # local_ttrib__m__init_internal_51 = local_ttrib__m__init_internal_58 + lw $t0, -236($fp) + sw $t0, -208($fp) + label_ENDIF_24: +# GOTO label_WHILE_1 +j label_WHILE_1 +label_WHILE_END_2: + # RETURN + # Deallocate stack frame for function __Main__attrib__m__init. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 244 + jr $ra + # Function END + + +# function_main_at_Main implementation. +# @Params: +function_main_at_Main: + # Allocate stack frame for function function_main_at_Main. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_main_at_Main_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -4($fp) + # RETURN local_main_at_Main_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_main_at_Main. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + diff --git a/tests/codegen/print-cool.mips b/tests/codegen/print-cool.mips new file mode 100644 index 00000000..182766cf --- /dev/null +++ b/tests/codegen/print-cool.mips @@ -0,0 +1,1172 @@ + +# Code generated by PyCoolc. +# Eliane Puerta, Liset Alfaro, Adrian Gonzalez --- Mon Dec 14 11:08:37 2020 +# School of Math and Computer Science, University of Havana +# + +.data +dummy: .word 0 +IO: .asciiz "IO" +# Function END +Object: .asciiz "Object" +# Function END +String: .asciiz "String" +# Function END +Bool: .asciiz "Bool" +# Function END +Int: .asciiz "Int" +# Function END +Main: .asciiz "Main" +# Function END +# + + +# **** VTABLE for type IO **** +IO_vtable: .word function_copy_at_Object, dummy, function_out_int_at_IO, function_in_string_at_IO, dummy, dummy, function_out_string_at_IO, function_type_name_at_Object, dummy, function_abort_at_Object, function_in_int_at_IO +# Function END +# + + +# **** Type RECORD for type IO **** +IO_start: + IO_vtable_pointer: .word IO_vtable + # Function END +IO_end: +# + + +# **** VTABLE for type Object **** +Object_vtable: .word function_copy_at_Object, dummy, dummy, dummy, dummy, dummy, dummy, function_type_name_at_Object, dummy, function_abort_at_Object, dummy +# Function END +# + + +# **** Type RECORD for type Object **** +Object_start: + Object_vtable_pointer: .word Object_vtable + # Function END +Object_end: +# + + +# **** VTABLE for type String **** +String_vtable: .word function_copy_at_Object, dummy, dummy, dummy, function_length_at_String, function_concat_at_String, dummy, function_type_name_at_Object, function_substr_at_String, function_abort_at_Object, dummy +# Function END +# + + +# **** Type RECORD for type String **** +String_start: + String_vtable_pointer: .word String_vtable + # Function END +String_end: +# + + +# **** VTABLE for type Bool **** +Bool_vtable: .word function_copy_at_Object, dummy, dummy, dummy, dummy, dummy, dummy, function_type_name_at_Object, dummy, function_abort_at_Object, dummy +# Function END +# + + +# **** Type RECORD for type Bool **** +Bool_start: + Bool_vtable_pointer: .word Bool_vtable + # Function END +Bool_end: +# + + +# **** VTABLE for type Int **** +Int_vtable: .word function_copy_at_Object, dummy, dummy, dummy, dummy, dummy, dummy, function_type_name_at_Object, dummy, function_abort_at_Object, dummy +# Function END +# + + +# **** Type RECORD for type Int **** +Int_start: + Int_vtable_pointer: .word Int_vtable + # Function END +Int_end: +# + + +# **** VTABLE for type Main **** +Main_vtable: .word function_copy_at_Object, function_main_at_Main, function_out_int_at_IO, function_in_string_at_IO, dummy, dummy, function_out_string_at_IO, function_type_name_at_Object, dummy, function_abort_at_Object, function_in_int_at_IO +# Function END +# + + +# **** Type RECORD for type Main **** +Main_start: + Main_vtable_pointer: .word Main_vtable + # Function END +Main_end: +# + + +data_0: .asciiz "" +# + + +data_1: .asciiz "Abort called from class " +# + + +data_2: .asciiz "\n" +# + + +IO__TDT: .word 0, -1, -1, -1, -1, 1 +Object__TDT: .word 1, 0, 1, 1, 1, 2 +String__TDT: .word -1, -1, 0, -1, -1, -1 +Bool__TDT: .word -1, -1, -1, 0, -1, -1 +Int__TDT: .word -1, -1, -1, -1, 0, -1 +Main__TDT: .word -1, -1, -1, -1, -1, 0 +# + + +data_4: .asciiz "\n" +# + + +.text +main: + jal entry + # syscall code 10 is for exit + li $v0, 10 + syscall + # Function END + +# function_in_string_at_IO implementation. +# @Params: +function_in_string_at_IO: + # Allocate stack frame for function function_in_string_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_in_string_at_IO_internal_0 --> -4($fp) + # Allocating 1024 bytes of memory + li $a0, 1024 + li $v0, 9 + syscall + move $t0, $v0 + move $a0, $v0 + li $a1, 1024 + li $v0, 8 + syscall + move $t2, $zero + move $t3, $zero + move $t1, $t0 + lb $t3, 0($t1) + beqz $t3, end_loop + read_length_loop: + lb $t3, 0($t1) + beqz $t3, end_read_length_loop + addu $t1, $t1, 1 + addu $t2, $t2, 1 + j read_length_loop + end_read_length_loop: + subu $t1, $t1, 1 + sb $zero, 0($t1) + subu $t2, $t2, 1 + end_loop: + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $t2, 16($v0) + sw $v0, -4($fp) + # RETURN local_in_string_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_in_string_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_out_int_at_IO implementation. +# @Params: +# 0($fp) = param_out_int_at_IO_x_0 +function_out_int_at_IO: + # Allocate stack frame for function function_out_int_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # PRINT_INT param_out_int_at_IO_x_0 + # PARAM param_out_int_at_IO_x_0 --> 0($fp) + lw $v0, 0($fp) + lw $a0, 12($v0) + li $v0, 1 + syscall + # LOCAL local_out_int_at_IO_internal_0 --> -4($fp) + # local_out_int_at_IO_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_out_int_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_out_int_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_out_string_at_IO implementation. +# @Params: +# 0($fp) = param_out_string_at_IO_x_0 +function_out_string_at_IO: + # Allocate stack frame for function function_out_string_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # PARAM param_out_string_at_IO_x_0 --> 0($fp) + # PRINT_STR param_out_string_at_IO_x_0 + lw $v0, 0($fp) + lw $a0, 12($v0) + li $v0, 4 + syscall + # LOCAL local_out_string_at_IO_internal_0 --> -4($fp) + # local_out_string_at_IO_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_out_string_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_out_string_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_in_int_at_IO implementation. +# @Params: +function_in_int_at_IO: + # Allocate stack frame for function function_in_int_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_in_int_at_IO_internal_0 --> -4($fp) + # local_in_int_at_IO_internal_0 = READ_INT + li $v0, 5 + syscall + move $a2, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + sw $a2, 12($v0) + sw $v0, -4($fp) + # RETURN local_in_int_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_in_int_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_abort_at_Object implementation. +# @Params: +function_abort_at_Object: + # Allocate stack frame for function function_abort_at_Object. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_abort_at_Object_internal_0 --> -4($fp) + lw $t0, 0($s1) + sw $t0, -4($fp) + # LOCAL local_abort_at_Object_internal_0 --> -4($fp) + la $a0, data_1 + li $v0, 4 + syscall + lw $a0, -4($fp) + li $v0, 4 + syscall + la $a0, data_2 + li $v0, 4 + syscall + li $v0, 10 + syscall + # Function END + + +# function_copy_at_Object implementation. +# @Params: +function_copy_at_Object: + # Allocate stack frame for function function_copy_at_Object. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_copy_at_Object_internal_0 --> -4($fp) + # local_copy_at_Object_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_copy_at_Object_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function function_copy_at_Object. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_type_name_at_Object implementation. +# @Params: +function_type_name_at_Object: + # Allocate stack frame for function function_type_name_at_Object. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_type_name_at_Object_internal_0 --> -4($fp) + lw $t0, 0($s1) + sw $t0, -4($fp) + # RETURN local_type_name_at_Object_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_type_name_at_Object. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_concat_at_String implementation. +# @Params: +# 0($fp) = param_concat_at_String_s_0 +function_concat_at_String: + # Allocate stack frame for function function_concat_at_String. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_concat_at_String_internal_0 = self.CONCAT + # LOCAL local_concat_at_String_internal_0 --> -4($fp) + # PARAM param_concat_at_String_s_0 --> 0($fp) + # Get first string length from self + lw $t0, 16($s1) + # Get second string length from param + lw $v0, 0($fp) + lw $t1, 16($v0) + # Save new string length in a0 for memory allocation + addu $a0, $t0, $t1 + move $t3, $a0 + # Get first string from self + lw $t0, 12($s1) + # Get second string from param + lw $t1, 12($v0) + addu $a0, $a0, 4 + li $v0, 9 + syscall + move $t2, $v0 + move $t4, $zero + concat_loop1: + # Compare t0 with \0 + lb $t4, 0($t0) + beqz $t4, concat_loop1_end + # Copy 1 byte + sb $t4, 0($t2) + addu $t2, $t2, 1 + addu $t0, $t0, 1 + j concat_loop1 + concat_loop1_end: + # Copy second string + concat_loop2: + # Compare t1 with \0 + lb $t4, 0($t1) + beqz $t4, concat_loop2_end + # Copy 1 byte + sb $t4, 0($t2) + addu $t2, $t2, 1 + addu $t1, $t1, 1 + j concat_loop2 + concat_loop2_end: + sb $zero, 0($t2) + # v0 contains resulting string + move $t1, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + sw $t1, 12($v0) + sw $t3, 16($v0) + sw $v0, -4($fp) + # RETURN local_concat_at_String_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_concat_at_String. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_substr_at_String implementation. +# @Params: +# 0($fp) = param_substr_at_String_l_0 +# 4($fp) = param_substr_at_String_r_1 +function_substr_at_String: + # Allocate stack frame for function function_substr_at_String. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_substr_at_String_internal_0 --> -4($fp) + # PARAM param_substr_at_String_l_0 --> 4($fp) + # PARAM param_substr_at_String_r_1 --> 0($fp) + lw $t0, 12($s1) + lw $t2, 4($fp) + lw $t2, 12($t2) + addu $t0, $t0, $t2 + lw $a0, 0($fp) + lw $a0, 12($a0) + move $t3, $a0 + move $t1, $a0 + addu $a0, $a0, 1 + li $v0, 9 + syscall + move $t2, $v0 + substr_loop: + beqz $t1, substr_end + lb $a0, 0($t0) + sb $a0, 0($t2) + addu $t0, $t0, 1 + addu $t2, $t2, 1 + subu $t1, $t1, 1 + j substr_loop + substr_end: + sb $zero, 0($t2) + move $t1, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + sw $t1, 12($v0) + sw $t3, 16($v0) + sw $v0, -4($fp) + # RETURN local_substr_at_String_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_substr_at_String. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 8 + jr $ra + # Function END + + +# function_length_at_String implementation. +# @Params: +function_length_at_String: + # Allocate stack frame for function function_length_at_String. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_length_at_String_internal_0 = GETATTRIBUTE length String + # LOCAL local_length_at_String_internal_0 --> -4($fp) + lw $t0, 16($s1) + sw $t0, -4($fp) + # LOCAL local_length_at_String_internal_1 --> -8($fp) + # LOCAL local_length_at_String_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + lw $t0, -4($fp) + sw $t0, 12($v0) + sw $v0, -8($fp) + # RETURN local_length_at_String_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function function_length_at_String. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# entry implementation. +# @Params: +entry: + # Allocate stack frame for function entry. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local__internal_0 --> -4($fp) + # local__internal_0 = ALLOCATE Main + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Main + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 12 bytes of memory + li $a0, 12 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Main_start + sw $t0, 4($v0) + # Load type offset + li $t0, 20 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -4($fp) + # LOCAL local__internal_0 --> -4($fp) + lw $s1, -4($fp) + # local__internal_1 = CALL main + # LOCAL local__internal_1 --> -8($fp) + # LOCAL local__internal_0 --> -4($fp) + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type's VTABLE + la $t0, Main_vtable + # Get pointer to function address + lw $t1, 4($t0) + # Call function. Result is on $v0 + jalr $t1 + sw $v0, -8($fp) + # RETURN 0 + li $v0, 0 + # Deallocate stack frame for function entry. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_main_at_Main implementation. +# @Params: +function_main_at_Main: + # Allocate stack frame for function function_main_at_Main. + subu $sp, $sp, 104 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 104 + # LOCAL local_main_at_Main_internal_4 --> -20($fp) + # local_main_at_Main_internal_4 = SELF + sw $s1, -20($fp) + # LOCAL local_main_at_Main_internal_2 --> -12($fp) + # LOCAL local_main_at_Main_internal_4 --> -20($fp) + # local_main_at_Main_internal_2 = local_main_at_Main_internal_4 + lw $t0, -20($fp) + sw $t0, -12($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_9 --> -40($fp) + # local_main_at_Main_internal_9 = ALLOCATE Object + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Object + sw $t0, 12($v0) + li $t0, 6 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 12 bytes of memory + li $a0, 12 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Object_start + sw $t0, 4($v0) + # Load type offset + li $t0, 4 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -40($fp) + # LOCAL local_main_at_Main_internal_7 --> -32($fp) + # LOCAL local_main_at_Main_internal_9 --> -40($fp) + # local_main_at_Main_internal_7 = local_main_at_Main_internal_9 + lw $t0, -40($fp) + sw $t0, -32($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_7 --> -32($fp) + # LOCAL local_main_at_Main_internal_8 --> -36($fp) + # local_main_at_Main_internal_8 = VCALL local_main_at_Main_internal_7 type_name + # Save new self pointer in $s1 + lw $s1, -32($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 28($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -36($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_main_at_Main_internal_5 --> -24($fp) + # LOCAL local_main_at_Main_internal_8 --> -36($fp) + # local_main_at_Main_internal_5 = local_main_at_Main_internal_8 + lw $t0, -36($fp) + sw $t0, -24($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_10 --> -44($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 4 + sw $t0, 12($v0) + sw $v0, -44($fp) + # ARG local_main_at_Main_internal_10 + # LOCAL local_main_at_Main_internal_10 --> -44($fp) + lw $t0, -44($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_main_at_Main_internal_11 --> -48($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -48($fp) + # ARG local_main_at_Main_internal_11 + # LOCAL local_main_at_Main_internal_11 --> -48($fp) + lw $t0, -48($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_main_at_Main_internal_5 --> -24($fp) + # LOCAL local_main_at_Main_internal_6 --> -28($fp) + # local_main_at_Main_internal_6 = VCALL local_main_at_Main_internal_5 substr + # Save new self pointer in $s1 + lw $s1, -24($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 32($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -28($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # ARG local_main_at_Main_internal_6 + # LOCAL local_main_at_Main_internal_6 --> -28($fp) + lw $t0, -28($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_main_at_Main_internal_2 --> -12($fp) + # LOCAL local_main_at_Main_internal_3 --> -16($fp) + # local_main_at_Main_internal_3 = VCALL local_main_at_Main_internal_2 out_string + # Save new self pointer in $s1 + lw $s1, -12($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 24($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -16($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_main_at_Main_internal_0 --> -4($fp) + # LOCAL local_main_at_Main_internal_3 --> -16($fp) + # local_main_at_Main_internal_0 = local_main_at_Main_internal_3 + lw $t0, -16($fp) + sw $t0, -4($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_17 --> -72($fp) + # local_main_at_Main_internal_17 = SELF + sw $s1, -72($fp) + # IF_ZERO local_main_at_Main_internal_17 GOTO label_TRUE_1 + # IF_ZERO local_main_at_Main_internal_17 GOTO label_TRUE_1 + lw $t0, -72($fp) + beq $t0, 0, label_TRUE_1 + # LOCAL local_main_at_Main_internal_16 --> -68($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -68($fp) + # GOTO label_END_2 +j label_END_2 +label_TRUE_1: + # LOCAL local_main_at_Main_internal_16 --> -68($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -68($fp) + label_END_2: +# LOCAL local_main_at_Main_internal_14 --> -60($fp) +# LOCAL local_main_at_Main_internal_16 --> -68($fp) +# local_main_at_Main_internal_14 = local_main_at_Main_internal_16 +lw $t0, -68($fp) +sw $t0, -60($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_main_at_Main_internal_14 --> -60($fp) +# LOCAL local_main_at_Main_internal_15 --> -64($fp) +# local_main_at_Main_internal_15 = VCALL local_main_at_Main_internal_14 type_name +# Save new self pointer in $s1 +lw $s1, -60($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 28($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -64($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_main_at_Main_internal_12 --> -52($fp) +# LOCAL local_main_at_Main_internal_15 --> -64($fp) +# local_main_at_Main_internal_12 = local_main_at_Main_internal_15 +lw $t0, -64($fp) +sw $t0, -52($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_main_at_Main_internal_18 --> -76($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 1 +sw $t0, 12($v0) +sw $v0, -76($fp) +# ARG local_main_at_Main_internal_18 +# LOCAL local_main_at_Main_internal_18 --> -76($fp) +lw $t0, -76($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_main_at_Main_internal_19 --> -80($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 3 +sw $t0, 12($v0) +sw $v0, -80($fp) +# ARG local_main_at_Main_internal_19 +# LOCAL local_main_at_Main_internal_19 --> -80($fp) +lw $t0, -80($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_main_at_Main_internal_12 --> -52($fp) +# LOCAL local_main_at_Main_internal_13 --> -56($fp) +# local_main_at_Main_internal_13 = VCALL local_main_at_Main_internal_12 substr +# Save new self pointer in $s1 +lw $s1, -52($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 32($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -56($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# ARG local_main_at_Main_internal_13 +# LOCAL local_main_at_Main_internal_13 --> -56($fp) +lw $t0, -56($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_main_at_Main_internal_0 --> -4($fp) +# LOCAL local_main_at_Main_internal_1 --> -8($fp) +# local_main_at_Main_internal_1 = VCALL local_main_at_Main_internal_0 out_string +# Save new self pointer in $s1 +lw $s1, -4($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 24($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -8($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_main_at_Main_internal_22 --> -92($fp) +# local_main_at_Main_internal_22 = SELF +sw $s1, -92($fp) +# LOCAL local_main_at_Main_internal_20 --> -84($fp) +# LOCAL local_main_at_Main_internal_22 --> -92($fp) +# local_main_at_Main_internal_20 = local_main_at_Main_internal_22 +lw $t0, -92($fp) +sw $t0, -84($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# LOCAL local_main_at_Main_internal_23 --> -96($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, data_4 +sw $t0, 12($v0) +li $t0, 1 +sw $t0, 16($v0) +sw $v0, -96($fp) +# ARG local_main_at_Main_internal_23 +# LOCAL local_main_at_Main_internal_23 --> -96($fp) +lw $t0, -96($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_main_at_Main_internal_20 --> -84($fp) +# LOCAL local_main_at_Main_internal_21 --> -88($fp) +# local_main_at_Main_internal_21 = VCALL local_main_at_Main_internal_20 out_string +# Save new self pointer in $s1 +lw $s1, -84($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 24($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -88($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# RETURN local_main_at_Main_internal_21 +lw $v0, -88($fp) +# Deallocate stack frame for function function_main_at_Main. +# Restore $ra +lw $ra, 4($sp) +# Restore $fp +lw $fp, 0($sp) +# Restore Stack pointer $sp +addu $sp, $sp, 104 +jr $ra +# Function END + diff --git a/tests/codegen/sort-list.mips b/tests/codegen/sort-list.mips new file mode 100644 index 00000000..055615a8 --- /dev/null +++ b/tests/codegen/sort-list.mips @@ -0,0 +1,3367 @@ + +# Code generated by PyCoolc. +# Eliane Puerta, Liset Alfaro, Adrian Gonzalez --- Mon Dec 14 11:08:40 2020 +# School of Math and Computer Science, University of Havana +# + +.data +dummy: .word 0 +IO: .asciiz "IO" +# Function END +Object: .asciiz "Object" +# Function END +String: .asciiz "String" +# Function END +Bool: .asciiz "Bool" +# Function END +Int: .asciiz "Int" +# Function END +Main: .asciiz "Main" +# Function END +List: .asciiz "List" +# Function END +Nil: .asciiz "Nil" +# Function END +Cons: .asciiz "Cons" +# Function END +# + + +# **** VTABLE for type IO **** +IO_vtable: .word dummy, function_out_string_at_IO, dummy, function_in_int_at_IO, dummy, dummy, dummy, dummy, function_out_int_at_IO, function_abort_at_Object, dummy, dummy, function_copy_at_Object, dummy, dummy, dummy, function_in_string_at_IO, dummy, function_type_name_at_Object, dummy, dummy, dummy +# Function END +# + + +# **** Type RECORD for type IO **** +IO_start: + IO_vtable_pointer: .word IO_vtable + # Function END +IO_end: +# + + +# **** VTABLE for type Object **** +Object_vtable: .word dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, function_abort_at_Object, dummy, dummy, function_copy_at_Object, dummy, dummy, dummy, dummy, dummy, function_type_name_at_Object, dummy, dummy, dummy +# Function END +# + + +# **** Type RECORD for type Object **** +Object_start: + Object_vtable_pointer: .word Object_vtable + # Function END +Object_end: +# + + +# **** VTABLE for type String **** +String_vtable: .word dummy, dummy, function_substr_at_String, dummy, dummy, dummy, dummy, dummy, dummy, function_abort_at_Object, dummy, function_length_at_String, function_copy_at_Object, dummy, dummy, dummy, dummy, function_concat_at_String, function_type_name_at_Object, dummy, dummy, dummy +# Function END +# + + +# **** Type RECORD for type String **** +String_start: + String_vtable_pointer: .word String_vtable + # Function END +String_end: +# + + +# **** VTABLE for type Bool **** +Bool_vtable: .word dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, function_abort_at_Object, dummy, dummy, function_copy_at_Object, dummy, dummy, dummy, dummy, dummy, function_type_name_at_Object, dummy, dummy, dummy +# Function END +# + + +# **** Type RECORD for type Bool **** +Bool_start: + Bool_vtable_pointer: .word Bool_vtable + # Function END +Bool_end: +# + + +# **** VTABLE for type Int **** +Int_vtable: .word dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy, function_abort_at_Object, dummy, dummy, function_copy_at_Object, dummy, dummy, dummy, dummy, dummy, function_type_name_at_Object, dummy, dummy, dummy +# Function END +# + + +# **** Type RECORD for type Int **** +Int_start: + Int_vtable_pointer: .word Int_vtable + # Function END +Int_end: +# + + +# **** VTABLE for type Main **** +Main_vtable: .word dummy, function_out_string_at_IO, dummy, function_in_int_at_IO, dummy, dummy, dummy, function_iota_at_Main, function_out_int_at_IO, function_abort_at_Object, dummy, dummy, function_copy_at_Object, dummy, dummy, dummy, function_in_string_at_IO, dummy, function_type_name_at_Object, dummy, function_main_at_Main, dummy +# Function END +# + + +# **** Type RECORD for type Main **** +Main_start: + Main_vtable_pointer: .word Main_vtable + # Function END +Main_end: +# + + +# **** VTABLE for type List **** +List_vtable: .word function_sort_at_List, function_out_string_at_IO, dummy, function_in_int_at_IO, function_rev_at_List, dummy, function_rcons_at_List, dummy, function_out_int_at_IO, function_abort_at_Object, function_isNil_at_List, dummy, function_copy_at_Object, function_car_at_List, function_insert_at_List, function_print_list_at_List, function_in_string_at_IO, dummy, function_type_name_at_Object, function_cdr_at_List, dummy, function_cons_at_List +# Function END +# + + +# **** Type RECORD for type List **** +List_start: + List_vtable_pointer: .word List_vtable + # Function END +List_end: +# + + +# **** VTABLE for type Nil **** +Nil_vtable: .word function_sort_at_Nil, function_out_string_at_IO, dummy, function_in_int_at_IO, function_rev_at_Nil, dummy, function_rcons_at_Nil, dummy, function_out_int_at_IO, function_abort_at_Object, function_isNil_at_Nil, dummy, function_copy_at_Object, function_car_at_List, function_insert_at_Nil, function_print_list_at_Nil, function_in_string_at_IO, dummy, function_type_name_at_Object, function_cdr_at_List, dummy, function_cons_at_List +# Function END +# + + +# **** Type RECORD for type Nil **** +Nil_start: + Nil_vtable_pointer: .word Nil_vtable + # Function END +Nil_end: +# + + +# **** VTABLE for type Cons **** +Cons_vtable: .word function_sort_at_Cons, function_out_string_at_IO, dummy, function_in_int_at_IO, function_rev_at_Cons, function_init_at_Cons, function_rcons_at_Cons, dummy, function_out_int_at_IO, function_abort_at_Object, function_isNil_at_Cons, dummy, function_copy_at_Object, function_car_at_Cons, function_insert_at_Cons, function_print_list_at_Cons, function_in_string_at_IO, dummy, function_type_name_at_Object, function_cdr_at_Cons, dummy, function_cons_at_List +# Function END +# + + +# **** Type RECORD for type Cons **** +Cons_start: + Cons_vtable_pointer: .word Cons_vtable + # Function END +Cons_end: +# + + +data_0: .asciiz "" +# + + +data_1: .asciiz "Abort called from class " +# + + +data_2: .asciiz "\n" +# + + +IO__TDT: .word 0, -1, -1, -1, -1, 1, 1, 2, 2 +Object__TDT: .word 1, 0, 1, 1, 1, 2, 2, 3, 3 +String__TDT: .word -1, -1, 0, -1, -1, -1, -1, -1, -1 +Bool__TDT: .word -1, -1, -1, 0, -1, -1, -1, -1, -1 +Int__TDT: .word -1, -1, -1, -1, 0, -1, -1, -1, -1 +Main__TDT: .word -1, -1, -1, -1, -1, 0, -1, -1, -1 +List__TDT: .word -1, -1, -1, -1, -1, -1, 0, 1, 1 +Nil__TDT: .word -1, -1, -1, -1, -1, -1, -1, 0, -1 +Cons__TDT: .word -1, -1, -1, -1, -1, -1, -1, -1, 0 +# + + +data_4: .asciiz "How many numbers to sort? " +# + + +data_5: .asciiz "\n" +# + + +.text +main: + jal entry + # syscall code 10 is for exit + li $v0, 10 + syscall + # Function END + +# function_in_string_at_IO implementation. +# @Params: +function_in_string_at_IO: + # Allocate stack frame for function function_in_string_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_in_string_at_IO_internal_0 --> -4($fp) + # Allocating 1024 bytes of memory + li $a0, 1024 + li $v0, 9 + syscall + move $t0, $v0 + move $a0, $v0 + li $a1, 1024 + li $v0, 8 + syscall + move $t2, $zero + move $t3, $zero + move $t1, $t0 + lb $t3, 0($t1) + beqz $t3, end_loop + read_length_loop: + lb $t3, 0($t1) + beqz $t3, end_read_length_loop + addu $t1, $t1, 1 + addu $t2, $t2, 1 + j read_length_loop + end_read_length_loop: + subu $t1, $t1, 1 + sb $zero, 0($t1) + subu $t2, $t2, 1 + end_loop: + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t1, String + sw $t1, 0($v0) + la $t1, String_start + sw $t1, 4($v0) + # Load type offset + li $t1, 8 + sw $t1, 8($v0) + sw $t0, 12($v0) + sw $t2, 16($v0) + sw $v0, -4($fp) + # RETURN local_in_string_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_in_string_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_out_int_at_IO implementation. +# @Params: +# 0($fp) = param_out_int_at_IO_x_0 +function_out_int_at_IO: + # Allocate stack frame for function function_out_int_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # PRINT_INT param_out_int_at_IO_x_0 + # PARAM param_out_int_at_IO_x_0 --> 0($fp) + lw $v0, 0($fp) + lw $a0, 12($v0) + li $v0, 1 + syscall + # LOCAL local_out_int_at_IO_internal_0 --> -4($fp) + # local_out_int_at_IO_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_out_int_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_out_int_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_out_string_at_IO implementation. +# @Params: +# 0($fp) = param_out_string_at_IO_x_0 +function_out_string_at_IO: + # Allocate stack frame for function function_out_string_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # PARAM param_out_string_at_IO_x_0 --> 0($fp) + # PRINT_STR param_out_string_at_IO_x_0 + lw $v0, 0($fp) + lw $a0, 12($v0) + li $v0, 4 + syscall + # LOCAL local_out_string_at_IO_internal_0 --> -4($fp) + # local_out_string_at_IO_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_out_string_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_out_string_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_in_int_at_IO implementation. +# @Params: +function_in_int_at_IO: + # Allocate stack frame for function function_in_int_at_IO. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_in_int_at_IO_internal_0 --> -4($fp) + # local_in_int_at_IO_internal_0 = READ_INT + li $v0, 5 + syscall + move $a2, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + sw $a2, 12($v0) + sw $v0, -4($fp) + # RETURN local_in_int_at_IO_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_in_int_at_IO. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_abort_at_Object implementation. +# @Params: +function_abort_at_Object: + # Allocate stack frame for function function_abort_at_Object. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_abort_at_Object_internal_0 --> -4($fp) + lw $t0, 0($s1) + sw $t0, -4($fp) + # LOCAL local_abort_at_Object_internal_0 --> -4($fp) + la $a0, data_1 + li $v0, 4 + syscall + lw $a0, -4($fp) + li $v0, 4 + syscall + la $a0, data_2 + li $v0, 4 + syscall + li $v0, 10 + syscall + # Function END + + +# function_copy_at_Object implementation. +# @Params: +function_copy_at_Object: + # Allocate stack frame for function function_copy_at_Object. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_copy_at_Object_internal_0 --> -4($fp) + # local_copy_at_Object_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_copy_at_Object_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function function_copy_at_Object. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_type_name_at_Object implementation. +# @Params: +function_type_name_at_Object: + # Allocate stack frame for function function_type_name_at_Object. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_type_name_at_Object_internal_0 --> -4($fp) + lw $t0, 0($s1) + sw $t0, -4($fp) + # RETURN local_type_name_at_Object_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_type_name_at_Object. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_concat_at_String implementation. +# @Params: +# 0($fp) = param_concat_at_String_s_0 +function_concat_at_String: + # Allocate stack frame for function function_concat_at_String. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_concat_at_String_internal_0 = self.CONCAT + # LOCAL local_concat_at_String_internal_0 --> -4($fp) + # PARAM param_concat_at_String_s_0 --> 0($fp) + # Get first string length from self + lw $t0, 16($s1) + # Get second string length from param + lw $v0, 0($fp) + lw $t1, 16($v0) + # Save new string length in a0 for memory allocation + addu $a0, $t0, $t1 + move $t3, $a0 + # Get first string from self + lw $t0, 12($s1) + # Get second string from param + lw $t1, 12($v0) + addu $a0, $a0, 4 + li $v0, 9 + syscall + move $t2, $v0 + move $t4, $zero + concat_loop1: + # Compare t0 with \0 + lb $t4, 0($t0) + beqz $t4, concat_loop1_end + # Copy 1 byte + sb $t4, 0($t2) + addu $t2, $t2, 1 + addu $t0, $t0, 1 + j concat_loop1 + concat_loop1_end: + # Copy second string + concat_loop2: + # Compare t1 with \0 + lb $t4, 0($t1) + beqz $t4, concat_loop2_end + # Copy 1 byte + sb $t4, 0($t2) + addu $t2, $t2, 1 + addu $t1, $t1, 1 + j concat_loop2 + concat_loop2_end: + sb $zero, 0($t2) + # v0 contains resulting string + move $t1, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + sw $t1, 12($v0) + sw $t3, 16($v0) + sw $v0, -4($fp) + # RETURN local_concat_at_String_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_concat_at_String. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_substr_at_String implementation. +# @Params: +# 0($fp) = param_substr_at_String_l_0 +# 4($fp) = param_substr_at_String_r_1 +function_substr_at_String: + # Allocate stack frame for function function_substr_at_String. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_substr_at_String_internal_0 --> -4($fp) + # PARAM param_substr_at_String_l_0 --> 4($fp) + # PARAM param_substr_at_String_r_1 --> 0($fp) + lw $t0, 12($s1) + lw $t2, 4($fp) + lw $t2, 12($t2) + addu $t0, $t0, $t2 + lw $a0, 0($fp) + lw $a0, 12($a0) + move $t3, $a0 + move $t1, $a0 + addu $a0, $a0, 1 + li $v0, 9 + syscall + move $t2, $v0 + substr_loop: + beqz $t1, substr_end + lb $a0, 0($t0) + sb $a0, 0($t2) + addu $t0, $t0, 1 + addu $t2, $t2, 1 + subu $t1, $t1, 1 + j substr_loop + substr_end: + sb $zero, 0($t2) + move $t1, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + sw $t1, 12($v0) + sw $t3, 16($v0) + sw $v0, -4($fp) + # RETURN local_substr_at_String_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_substr_at_String. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 8 + jr $ra + # Function END + + +# function_length_at_String implementation. +# @Params: +function_length_at_String: + # Allocate stack frame for function function_length_at_String. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_length_at_String_internal_0 = GETATTRIBUTE length String + # LOCAL local_length_at_String_internal_0 --> -4($fp) + lw $t0, 16($s1) + sw $t0, -4($fp) + # LOCAL local_length_at_String_internal_1 --> -8($fp) + # LOCAL local_length_at_String_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + lw $t0, -4($fp) + sw $t0, 12($v0) + sw $v0, -8($fp) + # RETURN local_length_at_String_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function function_length_at_String. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# entry implementation. +# @Params: +entry: + # Allocate stack frame for function entry. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local__internal_0 --> -4($fp) + # local__internal_0 = ALLOCATE Main + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Main + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Main_start + sw $t0, 4($v0) + # Load type offset + li $t0, 20 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Main__attrib__l__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 12($t1) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -4($fp) + # LOCAL local__internal_0 --> -4($fp) + lw $s1, -4($fp) + # local__internal_1 = CALL main + # LOCAL local__internal_1 --> -8($fp) + # LOCAL local__internal_0 --> -4($fp) + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type's VTABLE + la $t0, Main_vtable + # Get pointer to function address + lw $t1, 80($t0) + # Call function. Result is on $v0 + jalr $t1 + sw $v0, -8($fp) + # RETURN 0 + li $v0, 0 + # Deallocate stack frame for function entry. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# __Main__attrib__l__init implementation. +# @Params: +__Main__attrib__l__init: + # Allocate stack frame for function __Main__attrib__l__init. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # RETURN 0 + li $v0, 0 + # Deallocate stack frame for function __Main__attrib__l__init. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_iota_at_Main implementation. +# @Params: +# 0($fp) = param_iota_at_Main_i_0 +function_iota_at_Main: + # Allocate stack frame for function function_iota_at_Main. + subu $sp, $sp, 56 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 56 + # LOCAL local_iota_at_Main_internal_0 --> -4($fp) + # local_iota_at_Main_internal_0 = ALLOCATE Nil + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Nil + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 12 bytes of memory + li $a0, 12 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Nil_start + sw $t0, 4($v0) + # Load type offset + li $t0, 28 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -4($fp) + # + # LOCAL local_iota_at_Main_internal_0 --> -4($fp) + lw $t0, -4($fp) + sw $t0, 12($s1) + # LOCAL local_iota_at_Main_j_1 --> -8($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -8($fp) + # LOCAL local_iota_at_Main_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -12($fp) + # LOCAL local_iota_at_Main_j_1 --> -8($fp) + # LOCAL local_iota_at_Main_internal_2 --> -12($fp) + # local_iota_at_Main_j_1 = local_iota_at_Main_internal_2 + lw $t0, -12($fp) + sw $t0, -8($fp) + label_WHILE_1: + # LOCAL local_iota_at_Main_internal_4 --> -20($fp) + # LOCAL local_iota_at_Main_j_1 --> -8($fp) + # PARAM param_iota_at_Main_i_0 --> 0($fp) + lw $a0, -8($fp) + lw $a1, 0($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -20($fp) + # IF_GREATER_ZERO local_iota_at_Main_internal_4 GOTO label_FALSE_3 + # IF_GREATER_ZERO local_iota_at_Main_internal_4 GOTO label_FALSE_3 + lw $t0, -20($fp) + bgt $t0, 0, label_FALSE_3 + # IF_ZERO local_iota_at_Main_internal_4 GOTO label_FALSE_3 + # IF_ZERO local_iota_at_Main_internal_4 GOTO label_FALSE_3 + lw $t0, -20($fp) + beq $t0, 0, label_FALSE_3 + # LOCAL local_iota_at_Main_internal_4 --> -20($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -20($fp) + # GOTO label_END_4 +j label_END_4 +label_FALSE_3: + # LOCAL local_iota_at_Main_internal_4 --> -20($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -20($fp) + label_END_4: +# LOCAL local_iota_at_Main_internal_3 --> -16($fp) +# LOCAL local_iota_at_Main_internal_4 --> -20($fp) +# Obtain value from -20($fp) +lw $v0, -20($fp) +lw $v0, 12($v0) +sw $v0, -16($fp) +# IF_ZERO local_iota_at_Main_internal_3 GOTO label_WHILE_END_2 +# IF_ZERO local_iota_at_Main_internal_3 GOTO label_WHILE_END_2 +lw $t0, -16($fp) +beq $t0, 0, label_WHILE_END_2 +# LOCAL local_iota_at_Main_internal_7 --> -32($fp) +# local_iota_at_Main_internal_7 = ALLOCATE Cons +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type name +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Cons +sw $t0, 12($v0) +li $t0, 4 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Cons_start +sw $t0, 4($v0) +# Load type offset +li $t0, 32 +sw $t0, 8($v0) +move $t1, $v0 +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +move $s1, $v0 +# Push register t1 into stack +subu $sp, $sp, 4 +sw $t1, 0($sp) +jal __Cons__attrib__xcar__init +# Pop 4 bytes from stack into register t1 +lw $t1, 0($sp) +addu $sp, $sp, 4 +sw $v0, 12($t1) +# Push register t1 into stack +subu $sp, $sp, 4 +sw $t1, 0($sp) +jal __Cons__attrib__xcdr__init +# Pop 4 bytes from stack into register t1 +lw $t1, 0($sp) +addu $sp, $sp, 4 +sw $v0, 16($t1) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +sw $t1, -32($fp) +# LOCAL local_iota_at_Main_internal_5 --> -24($fp) +# LOCAL local_iota_at_Main_internal_7 --> -32($fp) +# local_iota_at_Main_internal_5 = local_iota_at_Main_internal_7 +lw $t0, -32($fp) +sw $t0, -24($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# ARG local_iota_at_Main_j_1 +# LOCAL local_iota_at_Main_j_1 --> -8($fp) +lw $t0, -8($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# local_iota_at_Main_internal_8 = GETATTRIBUTE l Main +# LOCAL local_iota_at_Main_internal_8 --> -36($fp) +lw $t0, 12($s1) +sw $t0, -36($fp) +# ARG local_iota_at_Main_internal_8 +# LOCAL local_iota_at_Main_internal_8 --> -36($fp) +lw $t0, -36($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_iota_at_Main_internal_5 --> -24($fp) +# LOCAL local_iota_at_Main_internal_6 --> -28($fp) +# local_iota_at_Main_internal_6 = VCALL local_iota_at_Main_internal_5 init +# Save new self pointer in $s1 +lw $s1, -24($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 20($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -28($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# +# LOCAL local_iota_at_Main_internal_6 --> -28($fp) +lw $t0, -28($fp) +sw $t0, 12($s1) +# LOCAL local_iota_at_Main_internal_10 --> -44($fp) +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Int +sw $t0, 12($v0) +li $t0, 3 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Int_start +sw $t0, 4($v0) +# Load type offset +li $t0, 16 +sw $t0, 8($v0) +li $t0, 1 +sw $t0, 12($v0) +sw $v0, -44($fp) +# LOCAL local_iota_at_Main_internal_9 --> -40($fp) +# LOCAL local_iota_at_Main_j_1 --> -8($fp) +# LOCAL local_iota_at_Main_internal_10 --> -44($fp) +# local_iota_at_Main_internal_9 = local_iota_at_Main_j_1 + local_iota_at_Main_internal_10 +lw $t1, -8($fp) +lw $t0, 12($t1) +lw $t1, -44($fp) +lw $t2, 12($t1) +add $t0, $t0, $t2 +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type Int +la $t1, String +sw $t1, 0($v0) +la $t1, String_start +sw $t1, 4($v0) +# Load type offset +li $t1, 8 +sw $t1, 8($v0) +la $t1, Int +sw $t1, 12($v0) +li $t1, 3 +sw $t1, 16($v0) +move $t1, $v0 +# Allocating 16 bytes of memory +li $a0, 16 +li $v0, 9 +syscall +sw $t1, 0($v0) +la $t1, Int_start +sw $t1, 4($v0) +# Load type offset +li $t1, 16 +sw $t1, 8($v0) +sw $t0, 12($v0) +sw $v0, -40($fp) +# LOCAL local_iota_at_Main_j_1 --> -8($fp) +# LOCAL local_iota_at_Main_internal_9 --> -40($fp) +# local_iota_at_Main_j_1 = local_iota_at_Main_internal_9 +lw $t0, -40($fp) +sw $t0, -8($fp) +# GOTO label_WHILE_1 +j label_WHILE_1 +label_WHILE_END_2: + # local_iota_at_Main_internal_11 = GETATTRIBUTE l Main + # LOCAL local_iota_at_Main_internal_11 --> -48($fp) + lw $t0, 12($s1) + sw $t0, -48($fp) + # RETURN local_iota_at_Main_internal_11 + lw $v0, -48($fp) + # Deallocate stack frame for function function_iota_at_Main. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 56 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_main_at_Main implementation. +# @Params: +function_main_at_Main: + # Allocate stack frame for function function_main_at_Main. + subu $sp, $sp, 72 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 72 + # LOCAL local_main_at_Main_internal_2 --> -12($fp) + # local_main_at_Main_internal_2 = SELF + sw $s1, -12($fp) + # LOCAL local_main_at_Main_internal_0 --> -4($fp) + # LOCAL local_main_at_Main_internal_2 --> -12($fp) + # local_main_at_Main_internal_0 = local_main_at_Main_internal_2 + lw $t0, -12($fp) + sw $t0, -4($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_3 --> -16($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_4 + sw $t0, 12($v0) + li $t0, 26 + sw $t0, 16($v0) + sw $v0, -16($fp) + # ARG local_main_at_Main_internal_3 + # LOCAL local_main_at_Main_internal_3 --> -16($fp) + lw $t0, -16($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_main_at_Main_internal_0 --> -4($fp) + # LOCAL local_main_at_Main_internal_1 --> -8($fp) + # local_main_at_Main_internal_1 = VCALL local_main_at_Main_internal_0 out_string + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 4($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -8($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_main_at_Main_internal_12 --> -52($fp) + # local_main_at_Main_internal_12 = SELF + sw $s1, -52($fp) + # LOCAL local_main_at_Main_internal_10 --> -44($fp) + # LOCAL local_main_at_Main_internal_12 --> -52($fp) + # local_main_at_Main_internal_10 = local_main_at_Main_internal_12 + lw $t0, -52($fp) + sw $t0, -44($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_15 --> -64($fp) + # local_main_at_Main_internal_15 = SELF + sw $s1, -64($fp) + # LOCAL local_main_at_Main_internal_13 --> -56($fp) + # LOCAL local_main_at_Main_internal_15 --> -64($fp) + # local_main_at_Main_internal_13 = local_main_at_Main_internal_15 + lw $t0, -64($fp) + sw $t0, -56($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_13 --> -56($fp) + # LOCAL local_main_at_Main_internal_14 --> -60($fp) + # local_main_at_Main_internal_14 = VCALL local_main_at_Main_internal_13 in_int + # Save new self pointer in $s1 + lw $s1, -56($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 12($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -60($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # ARG local_main_at_Main_internal_14 + # LOCAL local_main_at_Main_internal_14 --> -60($fp) + lw $t0, -60($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_main_at_Main_internal_10 --> -44($fp) + # LOCAL local_main_at_Main_internal_11 --> -48($fp) + # local_main_at_Main_internal_11 = VCALL local_main_at_Main_internal_10 iota + # Save new self pointer in $s1 + lw $s1, -44($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 28($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -48($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_main_at_Main_internal_8 --> -36($fp) + # LOCAL local_main_at_Main_internal_11 --> -48($fp) + # local_main_at_Main_internal_8 = local_main_at_Main_internal_11 + lw $t0, -48($fp) + sw $t0, -36($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_8 --> -36($fp) + # LOCAL local_main_at_Main_internal_9 --> -40($fp) + # local_main_at_Main_internal_9 = VCALL local_main_at_Main_internal_8 rev + # Save new self pointer in $s1 + lw $s1, -36($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 16($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -40($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_main_at_Main_internal_6 --> -28($fp) + # LOCAL local_main_at_Main_internal_9 --> -40($fp) + # local_main_at_Main_internal_6 = local_main_at_Main_internal_9 + lw $t0, -40($fp) + sw $t0, -28($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_6 --> -28($fp) + # LOCAL local_main_at_Main_internal_7 --> -32($fp) + # local_main_at_Main_internal_7 = VCALL local_main_at_Main_internal_6 sort + # Save new self pointer in $s1 + lw $s1, -28($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 0($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -32($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_main_at_Main_internal_4 --> -20($fp) + # LOCAL local_main_at_Main_internal_7 --> -32($fp) + # local_main_at_Main_internal_4 = local_main_at_Main_internal_7 + lw $t0, -32($fp) + sw $t0, -20($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_main_at_Main_internal_4 --> -20($fp) + # LOCAL local_main_at_Main_internal_5 --> -24($fp) + # local_main_at_Main_internal_5 = VCALL local_main_at_Main_internal_4 print_list + # Save new self pointer in $s1 + lw $s1, -20($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 60($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -24($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # RETURN local_main_at_Main_internal_5 + lw $v0, -24($fp) + # Deallocate stack frame for function function_main_at_Main. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 72 + jr $ra + # Function END + + +# function_isNil_at_List implementation. +# @Params: +function_isNil_at_List: + # Allocate stack frame for function function_isNil_at_List. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_isNil_at_List_internal_2 --> -12($fp) + # local_isNil_at_List_internal_2 = SELF + sw $s1, -12($fp) + # LOCAL local_isNil_at_List_internal_0 --> -4($fp) + # LOCAL local_isNil_at_List_internal_2 --> -12($fp) + # local_isNil_at_List_internal_0 = local_isNil_at_List_internal_2 + lw $t0, -12($fp) + sw $t0, -4($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_isNil_at_List_internal_0 --> -4($fp) + # LOCAL local_isNil_at_List_internal_1 --> -8($fp) + # local_isNil_at_List_internal_1 = VCALL local_isNil_at_List_internal_0 abort + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 36($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -8($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_isNil_at_List_internal_3 --> -16($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -16($fp) + # RETURN local_isNil_at_List_internal_3 + lw $v0, -16($fp) + # Deallocate stack frame for function function_isNil_at_List. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_cons_at_List implementation. +# @Params: +# 0($fp) = param_cons_at_List_hd_0 +function_cons_at_List: + # Allocate stack frame for function function_cons_at_List. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_cons_at_List_new_cell_0 --> -4($fp) + # local_cons_at_List_new_cell_0 = 0 + li $t0, 0 + sw $t0, -4($fp) + # LOCAL local_cons_at_List_internal_1 --> -8($fp) + # local_cons_at_List_internal_1 = ALLOCATE Cons + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Cons + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Cons_start + sw $t0, 4($v0) + # Load type offset + li $t0, 32 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Cons__attrib__xcar__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 12($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Cons__attrib__xcdr__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 16($t1) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -8($fp) + # LOCAL local_cons_at_List_new_cell_0 --> -4($fp) + # LOCAL local_cons_at_List_internal_1 --> -8($fp) + # local_cons_at_List_new_cell_0 = local_cons_at_List_internal_1 + lw $t0, -8($fp) + sw $t0, -4($fp) + # LOCAL local_cons_at_List_internal_2 --> -12($fp) + # LOCAL local_cons_at_List_new_cell_0 --> -4($fp) + # local_cons_at_List_internal_2 = local_cons_at_List_new_cell_0 + lw $t0, -4($fp) + sw $t0, -12($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # ARG param_cons_at_List_hd_0 + # PARAM param_cons_at_List_hd_0 --> 0($fp) + lw $t0, 0($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_cons_at_List_internal_4 --> -20($fp) + # local_cons_at_List_internal_4 = SELF + sw $s1, -20($fp) + # ARG local_cons_at_List_internal_4 + # LOCAL local_cons_at_List_internal_4 --> -20($fp) + lw $t0, -20($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_cons_at_List_internal_2 --> -12($fp) + # LOCAL local_cons_at_List_internal_3 --> -16($fp) + # local_cons_at_List_internal_3 = VCALL local_cons_at_List_internal_2 init + # Save new self pointer in $s1 + lw $s1, -12($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 20($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -16($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # RETURN local_cons_at_List_internal_3 + lw $v0, -16($fp) + # Deallocate stack frame for function function_cons_at_List. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_car_at_List implementation. +# @Params: +function_car_at_List: + # Allocate stack frame for function function_car_at_List. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_car_at_List_internal_2 --> -12($fp) + # local_car_at_List_internal_2 = SELF + sw $s1, -12($fp) + # LOCAL local_car_at_List_internal_0 --> -4($fp) + # LOCAL local_car_at_List_internal_2 --> -12($fp) + # local_car_at_List_internal_0 = local_car_at_List_internal_2 + lw $t0, -12($fp) + sw $t0, -4($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_car_at_List_internal_0 --> -4($fp) + # LOCAL local_car_at_List_internal_1 --> -8($fp) + # local_car_at_List_internal_1 = VCALL local_car_at_List_internal_0 abort + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 36($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -8($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_car_at_List_internal_3 --> -16($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -16($fp) + # RETURN local_car_at_List_internal_3 + lw $v0, -16($fp) + # Deallocate stack frame for function function_car_at_List. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_cdr_at_List implementation. +# @Params: +function_cdr_at_List: + # Allocate stack frame for function function_cdr_at_List. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_cdr_at_List_internal_2 --> -12($fp) + # local_cdr_at_List_internal_2 = SELF + sw $s1, -12($fp) + # LOCAL local_cdr_at_List_internal_0 --> -4($fp) + # LOCAL local_cdr_at_List_internal_2 --> -12($fp) + # local_cdr_at_List_internal_0 = local_cdr_at_List_internal_2 + lw $t0, -12($fp) + sw $t0, -4($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_cdr_at_List_internal_0 --> -4($fp) + # LOCAL local_cdr_at_List_internal_1 --> -8($fp) + # local_cdr_at_List_internal_1 = VCALL local_cdr_at_List_internal_0 abort + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 36($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -8($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_cdr_at_List_internal_3 --> -16($fp) + # local_cdr_at_List_internal_3 = ALLOCATE List + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, List + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 12 bytes of memory + li $a0, 12 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, List_start + sw $t0, 4($v0) + # Load type offset + li $t0, 24 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -16($fp) + # RETURN local_cdr_at_List_internal_3 + lw $v0, -16($fp) + # Deallocate stack frame for function function_cdr_at_List. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_rev_at_List implementation. +# @Params: +function_rev_at_List: + # Allocate stack frame for function function_rev_at_List. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_rev_at_List_internal_2 --> -12($fp) + # local_rev_at_List_internal_2 = SELF + sw $s1, -12($fp) + # LOCAL local_rev_at_List_internal_0 --> -4($fp) + # LOCAL local_rev_at_List_internal_2 --> -12($fp) + # local_rev_at_List_internal_0 = local_rev_at_List_internal_2 + lw $t0, -12($fp) + sw $t0, -4($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_rev_at_List_internal_0 --> -4($fp) + # LOCAL local_rev_at_List_internal_1 --> -8($fp) + # local_rev_at_List_internal_1 = VCALL local_rev_at_List_internal_0 cdr + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 76($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -8($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # RETURN local_rev_at_List_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function function_rev_at_List. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_sort_at_List implementation. +# @Params: +function_sort_at_List: + # Allocate stack frame for function function_sort_at_List. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_sort_at_List_internal_2 --> -12($fp) + # local_sort_at_List_internal_2 = SELF + sw $s1, -12($fp) + # LOCAL local_sort_at_List_internal_0 --> -4($fp) + # LOCAL local_sort_at_List_internal_2 --> -12($fp) + # local_sort_at_List_internal_0 = local_sort_at_List_internal_2 + lw $t0, -12($fp) + sw $t0, -4($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_sort_at_List_internal_0 --> -4($fp) + # LOCAL local_sort_at_List_internal_1 --> -8($fp) + # local_sort_at_List_internal_1 = VCALL local_sort_at_List_internal_0 cdr + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 76($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -8($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # RETURN local_sort_at_List_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function function_sort_at_List. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_insert_at_List implementation. +# @Params: +# 0($fp) = param_insert_at_List_i_0 +function_insert_at_List: + # Allocate stack frame for function function_insert_at_List. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_insert_at_List_internal_2 --> -12($fp) + # local_insert_at_List_internal_2 = SELF + sw $s1, -12($fp) + # LOCAL local_insert_at_List_internal_0 --> -4($fp) + # LOCAL local_insert_at_List_internal_2 --> -12($fp) + # local_insert_at_List_internal_0 = local_insert_at_List_internal_2 + lw $t0, -12($fp) + sw $t0, -4($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_insert_at_List_internal_0 --> -4($fp) + # LOCAL local_insert_at_List_internal_1 --> -8($fp) + # local_insert_at_List_internal_1 = VCALL local_insert_at_List_internal_0 cdr + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 76($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -8($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # RETURN local_insert_at_List_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function function_insert_at_List. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_rcons_at_List implementation. +# @Params: +# 0($fp) = param_rcons_at_List_i_0 +function_rcons_at_List: + # Allocate stack frame for function function_rcons_at_List. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_rcons_at_List_internal_2 --> -12($fp) + # local_rcons_at_List_internal_2 = SELF + sw $s1, -12($fp) + # LOCAL local_rcons_at_List_internal_0 --> -4($fp) + # LOCAL local_rcons_at_List_internal_2 --> -12($fp) + # local_rcons_at_List_internal_0 = local_rcons_at_List_internal_2 + lw $t0, -12($fp) + sw $t0, -4($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_rcons_at_List_internal_0 --> -4($fp) + # LOCAL local_rcons_at_List_internal_1 --> -8($fp) + # local_rcons_at_List_internal_1 = VCALL local_rcons_at_List_internal_0 cdr + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 76($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -8($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # RETURN local_rcons_at_List_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function function_rcons_at_List. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_print_list_at_List implementation. +# @Params: +function_print_list_at_List: + # Allocate stack frame for function function_print_list_at_List. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_print_list_at_List_internal_2 --> -12($fp) + # local_print_list_at_List_internal_2 = SELF + sw $s1, -12($fp) + # LOCAL local_print_list_at_List_internal_0 --> -4($fp) + # LOCAL local_print_list_at_List_internal_2 --> -12($fp) + # local_print_list_at_List_internal_0 = local_print_list_at_List_internal_2 + lw $t0, -12($fp) + sw $t0, -4($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_print_list_at_List_internal_0 --> -4($fp) + # LOCAL local_print_list_at_List_internal_1 --> -8($fp) + # local_print_list_at_List_internal_1 = VCALL local_print_list_at_List_internal_0 abort + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 36($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -8($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # RETURN local_print_list_at_List_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function function_print_list_at_List. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_isNil_at_Nil implementation. +# @Params: +function_isNil_at_Nil: + # Allocate stack frame for function function_isNil_at_Nil. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_isNil_at_Nil_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -4($fp) + # RETURN local_isNil_at_Nil_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_isNil_at_Nil. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_rev_at_Nil implementation. +# @Params: +function_rev_at_Nil: + # Allocate stack frame for function function_rev_at_Nil. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_rev_at_Nil_internal_0 --> -4($fp) + # local_rev_at_Nil_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_rev_at_Nil_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_rev_at_Nil. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_sort_at_Nil implementation. +# @Params: +function_sort_at_Nil: + # Allocate stack frame for function function_sort_at_Nil. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_sort_at_Nil_internal_0 --> -4($fp) + # local_sort_at_Nil_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_sort_at_Nil_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_sort_at_Nil. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_insert_at_Nil implementation. +# @Params: +# 0($fp) = param_insert_at_Nil_i_0 +function_insert_at_Nil: + # Allocate stack frame for function function_insert_at_Nil. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_insert_at_Nil_internal_2 --> -12($fp) + # local_insert_at_Nil_internal_2 = SELF + sw $s1, -12($fp) + # LOCAL local_insert_at_Nil_internal_0 --> -4($fp) + # LOCAL local_insert_at_Nil_internal_2 --> -12($fp) + # local_insert_at_Nil_internal_0 = local_insert_at_Nil_internal_2 + lw $t0, -12($fp) + sw $t0, -4($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # ARG param_insert_at_Nil_i_0 + # PARAM param_insert_at_Nil_i_0 --> 0($fp) + lw $t0, 0($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_insert_at_Nil_internal_0 --> -4($fp) + # LOCAL local_insert_at_Nil_internal_1 --> -8($fp) + # local_insert_at_Nil_internal_1 = VCALL local_insert_at_Nil_internal_0 rcons + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 24($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -8($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # RETURN local_insert_at_Nil_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function function_insert_at_Nil. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_rcons_at_Nil implementation. +# @Params: +# 0($fp) = param_rcons_at_Nil_i_0 +function_rcons_at_Nil: + # Allocate stack frame for function function_rcons_at_Nil. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_rcons_at_Nil_internal_2 --> -12($fp) + # local_rcons_at_Nil_internal_2 = ALLOCATE Cons + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Cons + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Cons_start + sw $t0, 4($v0) + # Load type offset + li $t0, 32 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Cons__attrib__xcar__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 12($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Cons__attrib__xcdr__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 16($t1) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -12($fp) + # LOCAL local_rcons_at_Nil_internal_0 --> -4($fp) + # LOCAL local_rcons_at_Nil_internal_2 --> -12($fp) + # local_rcons_at_Nil_internal_0 = local_rcons_at_Nil_internal_2 + lw $t0, -12($fp) + sw $t0, -4($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # ARG param_rcons_at_Nil_i_0 + # PARAM param_rcons_at_Nil_i_0 --> 0($fp) + lw $t0, 0($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_rcons_at_Nil_internal_3 --> -16($fp) + # local_rcons_at_Nil_internal_3 = SELF + sw $s1, -16($fp) + # ARG local_rcons_at_Nil_internal_3 + # LOCAL local_rcons_at_Nil_internal_3 --> -16($fp) + lw $t0, -16($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_rcons_at_Nil_internal_0 --> -4($fp) + # LOCAL local_rcons_at_Nil_internal_1 --> -8($fp) + # local_rcons_at_Nil_internal_1 = VCALL local_rcons_at_Nil_internal_0 init + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 20($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -8($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # RETURN local_rcons_at_Nil_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function function_rcons_at_Nil. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_print_list_at_Nil implementation. +# @Params: +function_print_list_at_Nil: + # Allocate stack frame for function function_print_list_at_Nil. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_print_list_at_Nil_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -4($fp) + # RETURN local_print_list_at_Nil_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_print_list_at_Nil. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# __Cons__attrib__xcar__init implementation. +# @Params: +__Cons__attrib__xcar__init: + # Allocate stack frame for function __Cons__attrib__xcar__init. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_ttrib__xcar__init_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Int + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Int + sw $t0, 12($v0) + li $t0, 3 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Int_start + sw $t0, 4($v0) + # Load type offset + li $t0, 16 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -4($fp) + # RETURN local_ttrib__xcar__init_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function __Cons__attrib__xcar__init. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# __Cons__attrib__xcdr__init implementation. +# @Params: +__Cons__attrib__xcdr__init: + # Allocate stack frame for function __Cons__attrib__xcdr__init. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # RETURN 0 + li $v0, 0 + # Deallocate stack frame for function __Cons__attrib__xcdr__init. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_isNil_at_Cons implementation. +# @Params: +function_isNil_at_Cons: + # Allocate stack frame for function function_isNil_at_Cons. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # LOCAL local_isNil_at_Cons_internal_0 --> -4($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -4($fp) + # RETURN local_isNil_at_Cons_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_isNil_at_Cons. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_init_at_Cons implementation. +# @Params: +# 0($fp) = param_init_at_Cons_hd_0 +# 4($fp) = param_init_at_Cons_tl_1 +function_init_at_Cons: + # Allocate stack frame for function function_init_at_Cons. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # + # PARAM param_init_at_Cons_hd_0 --> 4($fp) + lw $t0, 4($fp) + sw $t0, 12($s1) + # + # PARAM param_init_at_Cons_tl_1 --> 0($fp) + lw $t0, 0($fp) + sw $t0, 16($s1) + # LOCAL local_init_at_Cons_internal_0 --> -4($fp) + # local_init_at_Cons_internal_0 = SELF + sw $s1, -4($fp) + # RETURN local_init_at_Cons_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_init_at_Cons. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + # Deallocate function args + addu $sp, $sp, 8 + jr $ra + # Function END + + +# function_car_at_Cons implementation. +# @Params: +function_car_at_Cons: + # Allocate stack frame for function function_car_at_Cons. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_car_at_Cons_internal_0 = GETATTRIBUTE xcar Cons + # LOCAL local_car_at_Cons_internal_0 --> -4($fp) + lw $t0, 12($s1) + sw $t0, -4($fp) + # RETURN local_car_at_Cons_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_car_at_Cons. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_cdr_at_Cons implementation. +# @Params: +function_cdr_at_Cons: + # Allocate stack frame for function function_cdr_at_Cons. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_cdr_at_Cons_internal_0 = GETATTRIBUTE xcdr Cons + # LOCAL local_cdr_at_Cons_internal_0 --> -4($fp) + lw $t0, 16($s1) + sw $t0, -4($fp) + # RETURN local_cdr_at_Cons_internal_0 + lw $v0, -4($fp) + # Deallocate stack frame for function function_cdr_at_Cons. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_rev_at_Cons implementation. +# @Params: +function_rev_at_Cons: + # Allocate stack frame for function function_rev_at_Cons. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_rev_at_Cons_internal_4 = GETATTRIBUTE xcdr Cons + # LOCAL local_rev_at_Cons_internal_4 --> -20($fp) + lw $t0, 16($s1) + sw $t0, -20($fp) + # LOCAL local_rev_at_Cons_internal_2 --> -12($fp) + # LOCAL local_rev_at_Cons_internal_4 --> -20($fp) + # local_rev_at_Cons_internal_2 = local_rev_at_Cons_internal_4 + lw $t0, -20($fp) + sw $t0, -12($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_rev_at_Cons_internal_2 --> -12($fp) + # LOCAL local_rev_at_Cons_internal_3 --> -16($fp) + # local_rev_at_Cons_internal_3 = VCALL local_rev_at_Cons_internal_2 rev + # Save new self pointer in $s1 + lw $s1, -12($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 16($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -16($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_rev_at_Cons_internal_0 --> -4($fp) + # LOCAL local_rev_at_Cons_internal_3 --> -16($fp) + # local_rev_at_Cons_internal_0 = local_rev_at_Cons_internal_3 + lw $t0, -16($fp) + sw $t0, -4($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # local_rev_at_Cons_internal_5 = GETATTRIBUTE xcar Cons + # LOCAL local_rev_at_Cons_internal_5 --> -24($fp) + lw $t0, 12($s1) + sw $t0, -24($fp) + # ARG local_rev_at_Cons_internal_5 + # LOCAL local_rev_at_Cons_internal_5 --> -24($fp) + lw $t0, -24($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_rev_at_Cons_internal_0 --> -4($fp) + # LOCAL local_rev_at_Cons_internal_1 --> -8($fp) + # local_rev_at_Cons_internal_1 = VCALL local_rev_at_Cons_internal_0 rcons + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 24($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -8($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # RETURN local_rev_at_Cons_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function function_rev_at_Cons. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_sort_at_Cons implementation. +# @Params: +function_sort_at_Cons: + # Allocate stack frame for function function_sort_at_Cons. + subu $sp, $sp, 32 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 32 + # local_sort_at_Cons_internal_4 = GETATTRIBUTE xcdr Cons + # LOCAL local_sort_at_Cons_internal_4 --> -20($fp) + lw $t0, 16($s1) + sw $t0, -20($fp) + # LOCAL local_sort_at_Cons_internal_2 --> -12($fp) + # LOCAL local_sort_at_Cons_internal_4 --> -20($fp) + # local_sort_at_Cons_internal_2 = local_sort_at_Cons_internal_4 + lw $t0, -20($fp) + sw $t0, -12($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_sort_at_Cons_internal_2 --> -12($fp) + # LOCAL local_sort_at_Cons_internal_3 --> -16($fp) + # local_sort_at_Cons_internal_3 = VCALL local_sort_at_Cons_internal_2 sort + # Save new self pointer in $s1 + lw $s1, -12($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 0($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -16($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_sort_at_Cons_internal_0 --> -4($fp) + # LOCAL local_sort_at_Cons_internal_3 --> -16($fp) + # local_sort_at_Cons_internal_0 = local_sort_at_Cons_internal_3 + lw $t0, -16($fp) + sw $t0, -4($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # local_sort_at_Cons_internal_5 = GETATTRIBUTE xcar Cons + # LOCAL local_sort_at_Cons_internal_5 --> -24($fp) + lw $t0, 12($s1) + sw $t0, -24($fp) + # ARG local_sort_at_Cons_internal_5 + # LOCAL local_sort_at_Cons_internal_5 --> -24($fp) + lw $t0, -24($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_sort_at_Cons_internal_0 --> -4($fp) + # LOCAL local_sort_at_Cons_internal_1 --> -8($fp) + # local_sort_at_Cons_internal_1 = VCALL local_sort_at_Cons_internal_0 insert + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 56($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -8($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # RETURN local_sort_at_Cons_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function function_sort_at_Cons. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 32 + jr $ra + # Function END + + +# function_insert_at_Cons implementation. +# @Params: +# 0($fp) = param_insert_at_Cons_i_0 +function_insert_at_Cons: + # Allocate stack frame for function function_insert_at_Cons. + subu $sp, $sp, 68 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 68 + # local_insert_at_Cons_internal_3 = GETATTRIBUTE xcar Cons + # LOCAL local_insert_at_Cons_internal_3 --> -16($fp) + lw $t0, 12($s1) + sw $t0, -16($fp) + # LOCAL local_insert_at_Cons_internal_2 --> -12($fp) + # PARAM param_insert_at_Cons_i_0 --> 0($fp) + # LOCAL local_insert_at_Cons_internal_3 --> -16($fp) + lw $a0, 0($fp) + lw $a1, -16($fp) + # Load values + lw $a0, 12($a0) + lw $a1, 12($a1) + # SUB and store + sub $a0, $a0, $a1 + sw $a0, -12($fp) + # IF_GREATER_ZERO local_insert_at_Cons_internal_2 GOTO label_FALSE_7 + # IF_GREATER_ZERO local_insert_at_Cons_internal_2 GOTO label_FALSE_7 + lw $t0, -12($fp) + bgt $t0, 0, label_FALSE_7 + # IF_ZERO local_insert_at_Cons_internal_2 GOTO label_FALSE_7 + # IF_ZERO local_insert_at_Cons_internal_2 GOTO label_FALSE_7 + lw $t0, -12($fp) + beq $t0, 0, label_FALSE_7 + # LOCAL local_insert_at_Cons_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 1 + sw $t0, 12($v0) + sw $v0, -12($fp) + # GOTO label_END_8 +j label_END_8 +label_FALSE_7: + # LOCAL local_insert_at_Cons_internal_2 --> -12($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type Bool + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Bool + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 16 bytes of memory + li $a0, 16 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Bool_start + sw $t0, 4($v0) + # Load type offset + li $t0, 12 + sw $t0, 8($v0) + li $t0, 0 + sw $t0, 12($v0) + sw $v0, -12($fp) + label_END_8: +# LOCAL local_insert_at_Cons_internal_0 --> -4($fp) +# LOCAL local_insert_at_Cons_internal_2 --> -12($fp) +# Obtain value from -12($fp) +lw $v0, -12($fp) +lw $v0, 12($v0) +sw $v0, -4($fp) +# IF_ZERO local_insert_at_Cons_internal_0 GOTO label_FALSEIF_5 +# IF_ZERO local_insert_at_Cons_internal_0 GOTO label_FALSEIF_5 +lw $t0, -4($fp) +beq $t0, 0, label_FALSEIF_5 +# LOCAL local_insert_at_Cons_internal_6 --> -28($fp) +# local_insert_at_Cons_internal_6 = ALLOCATE Cons +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +# Allocating string for type name +la $t0, String +sw $t0, 0($v0) +la $t0, String_start +sw $t0, 4($v0) +# Load type offset +li $t0, 8 +sw $t0, 8($v0) +la $t0, Cons +sw $t0, 12($v0) +li $t0, 4 +sw $t0, 16($v0) +move $t0, $v0 +# Allocating 20 bytes of memory +li $a0, 20 +li $v0, 9 +syscall +sw $t0, 0($v0) +la $t0, Cons_start +sw $t0, 4($v0) +# Load type offset +li $t0, 32 +sw $t0, 8($v0) +move $t1, $v0 +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +move $s1, $v0 +# Push register t1 into stack +subu $sp, $sp, 4 +sw $t1, 0($sp) +jal __Cons__attrib__xcar__init +# Pop 4 bytes from stack into register t1 +lw $t1, 0($sp) +addu $sp, $sp, 4 +sw $v0, 12($t1) +# Push register t1 into stack +subu $sp, $sp, 4 +sw $t1, 0($sp) +jal __Cons__attrib__xcdr__init +# Pop 4 bytes from stack into register t1 +lw $t1, 0($sp) +addu $sp, $sp, 4 +sw $v0, 16($t1) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +sw $t1, -28($fp) +# LOCAL local_insert_at_Cons_internal_4 --> -20($fp) +# LOCAL local_insert_at_Cons_internal_6 --> -28($fp) +# local_insert_at_Cons_internal_4 = local_insert_at_Cons_internal_6 +lw $t0, -28($fp) +sw $t0, -20($fp) +# Push register s1 into stack +subu $sp, $sp, 4 +sw $s1, 0($sp) +# ARG param_insert_at_Cons_i_0 +# PARAM param_insert_at_Cons_i_0 --> 0($fp) +lw $t0, 0($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_insert_at_Cons_internal_7 --> -32($fp) +# local_insert_at_Cons_internal_7 = SELF +sw $s1, -32($fp) +# ARG local_insert_at_Cons_internal_7 +# LOCAL local_insert_at_Cons_internal_7 --> -32($fp) +lw $t0, -32($fp) +# Push arg into stack +subu $sp, $sp, 4 +sw $t0, 0($sp) +# LOCAL local_insert_at_Cons_internal_4 --> -20($fp) +# LOCAL local_insert_at_Cons_internal_5 --> -24($fp) +# local_insert_at_Cons_internal_5 = VCALL local_insert_at_Cons_internal_4 init +# Save new self pointer in $s1 +lw $s1, -20($fp) +# Get pointer to type +lw $t0, 4($s1) +# Get pointer to type's VTABLE +lw $t0, 0($t0) +# Get pointer to function address +lw $t0, 20($t0) +# Call function. Result is on $v0 +jalr $t0 +sw $v0, -24($fp) +# Pop 4 bytes from stack into register s1 +lw $s1, 0($sp) +addu $sp, $sp, 4 +# LOCAL local_insert_at_Cons_internal_1 --> -8($fp) +# LOCAL local_insert_at_Cons_internal_5 --> -24($fp) +# local_insert_at_Cons_internal_1 = local_insert_at_Cons_internal_5 +lw $t0, -24($fp) +sw $t0, -8($fp) +# GOTO label_ENDIF_6 +j label_ENDIF_6 +label_FALSEIF_5: + # LOCAL local_insert_at_Cons_internal_10 --> -44($fp) + # local_insert_at_Cons_internal_10 = ALLOCATE Cons + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Cons + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Cons_start + sw $t0, 4($v0) + # Load type offset + li $t0, 32 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Cons__attrib__xcar__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 12($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Cons__attrib__xcdr__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 16($t1) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -44($fp) + # LOCAL local_insert_at_Cons_internal_8 --> -36($fp) + # LOCAL local_insert_at_Cons_internal_10 --> -44($fp) + # local_insert_at_Cons_internal_8 = local_insert_at_Cons_internal_10 + lw $t0, -44($fp) + sw $t0, -36($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # local_insert_at_Cons_internal_11 = GETATTRIBUTE xcar Cons + # LOCAL local_insert_at_Cons_internal_11 --> -48($fp) + lw $t0, 12($s1) + sw $t0, -48($fp) + # ARG local_insert_at_Cons_internal_11 + # LOCAL local_insert_at_Cons_internal_11 --> -48($fp) + lw $t0, -48($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # local_insert_at_Cons_internal_14 = GETATTRIBUTE xcdr Cons + # LOCAL local_insert_at_Cons_internal_14 --> -60($fp) + lw $t0, 16($s1) + sw $t0, -60($fp) + # LOCAL local_insert_at_Cons_internal_12 --> -52($fp) + # LOCAL local_insert_at_Cons_internal_14 --> -60($fp) + # local_insert_at_Cons_internal_12 = local_insert_at_Cons_internal_14 + lw $t0, -60($fp) + sw $t0, -52($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # ARG param_insert_at_Cons_i_0 + # PARAM param_insert_at_Cons_i_0 --> 0($fp) + lw $t0, 0($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_insert_at_Cons_internal_12 --> -52($fp) + # LOCAL local_insert_at_Cons_internal_13 --> -56($fp) + # local_insert_at_Cons_internal_13 = VCALL local_insert_at_Cons_internal_12 insert + # Save new self pointer in $s1 + lw $s1, -52($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 56($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -56($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # ARG local_insert_at_Cons_internal_13 + # LOCAL local_insert_at_Cons_internal_13 --> -56($fp) + lw $t0, -56($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_insert_at_Cons_internal_8 --> -36($fp) + # LOCAL local_insert_at_Cons_internal_9 --> -40($fp) + # local_insert_at_Cons_internal_9 = VCALL local_insert_at_Cons_internal_8 init + # Save new self pointer in $s1 + lw $s1, -36($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 20($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -40($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_insert_at_Cons_internal_1 --> -8($fp) + # LOCAL local_insert_at_Cons_internal_9 --> -40($fp) + # local_insert_at_Cons_internal_1 = local_insert_at_Cons_internal_9 + lw $t0, -40($fp) + sw $t0, -8($fp) + label_ENDIF_6: +# RETURN local_insert_at_Cons_internal_1 +lw $v0, -8($fp) +# Deallocate stack frame for function function_insert_at_Cons. +# Restore $ra +lw $ra, 4($sp) +# Restore $fp +lw $fp, 0($sp) +# Restore Stack pointer $sp +addu $sp, $sp, 68 +# Deallocate function args +addu $sp, $sp, 4 +jr $ra +# Function END + + +# function_rcons_at_Cons implementation. +# @Params: +# 0($fp) = param_rcons_at_Cons_i_0 +function_rcons_at_Cons: + # Allocate stack frame for function function_rcons_at_Cons. + subu $sp, $sp, 36 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 36 + # LOCAL local_rcons_at_Cons_internal_2 --> -12($fp) + # local_rcons_at_Cons_internal_2 = ALLOCATE Cons + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string for type name + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, Cons + sw $t0, 12($v0) + li $t0, 4 + sw $t0, 16($v0) + move $t0, $v0 + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + sw $t0, 0($v0) + la $t0, Cons_start + sw $t0, 4($v0) + # Load type offset + li $t0, 32 + sw $t0, 8($v0) + move $t1, $v0 + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + move $s1, $v0 + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Cons__attrib__xcar__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 12($t1) + # Push register t1 into stack + subu $sp, $sp, 4 + sw $t1, 0($sp) + jal __Cons__attrib__xcdr__init + # Pop 4 bytes from stack into register t1 + lw $t1, 0($sp) + addu $sp, $sp, 4 + sw $v0, 16($t1) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + sw $t1, -12($fp) + # LOCAL local_rcons_at_Cons_internal_0 --> -4($fp) + # LOCAL local_rcons_at_Cons_internal_2 --> -12($fp) + # local_rcons_at_Cons_internal_0 = local_rcons_at_Cons_internal_2 + lw $t0, -12($fp) + sw $t0, -4($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # local_rcons_at_Cons_internal_3 = GETATTRIBUTE xcar Cons + # LOCAL local_rcons_at_Cons_internal_3 --> -16($fp) + lw $t0, 12($s1) + sw $t0, -16($fp) + # ARG local_rcons_at_Cons_internal_3 + # LOCAL local_rcons_at_Cons_internal_3 --> -16($fp) + lw $t0, -16($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # local_rcons_at_Cons_internal_6 = GETATTRIBUTE xcdr Cons + # LOCAL local_rcons_at_Cons_internal_6 --> -28($fp) + lw $t0, 16($s1) + sw $t0, -28($fp) + # LOCAL local_rcons_at_Cons_internal_4 --> -20($fp) + # LOCAL local_rcons_at_Cons_internal_6 --> -28($fp) + # local_rcons_at_Cons_internal_4 = local_rcons_at_Cons_internal_6 + lw $t0, -28($fp) + sw $t0, -20($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # ARG param_rcons_at_Cons_i_0 + # PARAM param_rcons_at_Cons_i_0 --> 0($fp) + lw $t0, 0($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_rcons_at_Cons_internal_4 --> -20($fp) + # LOCAL local_rcons_at_Cons_internal_5 --> -24($fp) + # local_rcons_at_Cons_internal_5 = VCALL local_rcons_at_Cons_internal_4 rcons + # Save new self pointer in $s1 + lw $s1, -20($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 24($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -24($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # ARG local_rcons_at_Cons_internal_5 + # LOCAL local_rcons_at_Cons_internal_5 --> -24($fp) + lw $t0, -24($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_rcons_at_Cons_internal_0 --> -4($fp) + # LOCAL local_rcons_at_Cons_internal_1 --> -8($fp) + # local_rcons_at_Cons_internal_1 = VCALL local_rcons_at_Cons_internal_0 init + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 20($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -8($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # RETURN local_rcons_at_Cons_internal_1 + lw $v0, -8($fp) + # Deallocate stack frame for function function_rcons_at_Cons. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 36 + # Deallocate function args + addu $sp, $sp, 4 + jr $ra + # Function END + + +# function_print_list_at_Cons implementation. +# @Params: +function_print_list_at_Cons: + # Allocate stack frame for function function_print_list_at_Cons. + subu $sp, $sp, 52 + sw $ra, 4($sp) + sw $fp, 0($sp) + addu $fp, $sp, 52 + # LOCAL local_print_list_at_Cons_internal_2 --> -12($fp) + # local_print_list_at_Cons_internal_2 = SELF + sw $s1, -12($fp) + # LOCAL local_print_list_at_Cons_internal_0 --> -4($fp) + # LOCAL local_print_list_at_Cons_internal_2 --> -12($fp) + # local_print_list_at_Cons_internal_0 = local_print_list_at_Cons_internal_2 + lw $t0, -12($fp) + sw $t0, -4($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # local_print_list_at_Cons_internal_3 = GETATTRIBUTE xcar Cons + # LOCAL local_print_list_at_Cons_internal_3 --> -16($fp) + lw $t0, 12($s1) + sw $t0, -16($fp) + # ARG local_print_list_at_Cons_internal_3 + # LOCAL local_print_list_at_Cons_internal_3 --> -16($fp) + lw $t0, -16($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_print_list_at_Cons_internal_0 --> -4($fp) + # LOCAL local_print_list_at_Cons_internal_1 --> -8($fp) + # local_print_list_at_Cons_internal_1 = VCALL local_print_list_at_Cons_internal_0 out_int + # Save new self pointer in $s1 + lw $s1, -4($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 32($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -8($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # LOCAL local_print_list_at_Cons_internal_6 --> -28($fp) + # local_print_list_at_Cons_internal_6 = SELF + sw $s1, -28($fp) + # LOCAL local_print_list_at_Cons_internal_4 --> -20($fp) + # LOCAL local_print_list_at_Cons_internal_6 --> -28($fp) + # local_print_list_at_Cons_internal_4 = local_print_list_at_Cons_internal_6 + lw $t0, -28($fp) + sw $t0, -20($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_print_list_at_Cons_internal_7 --> -32($fp) + # Allocating 20 bytes of memory + li $a0, 20 + li $v0, 9 + syscall + # Allocating string + la $t0, String + sw $t0, 0($v0) + la $t0, String_start + sw $t0, 4($v0) + # Load type offset + li $t0, 8 + sw $t0, 8($v0) + la $t0, data_5 + sw $t0, 12($v0) + li $t0, 1 + sw $t0, 16($v0) + sw $v0, -32($fp) + # ARG local_print_list_at_Cons_internal_7 + # LOCAL local_print_list_at_Cons_internal_7 --> -32($fp) + lw $t0, -32($fp) + # Push arg into stack + subu $sp, $sp, 4 + sw $t0, 0($sp) + # LOCAL local_print_list_at_Cons_internal_4 --> -20($fp) + # LOCAL local_print_list_at_Cons_internal_5 --> -24($fp) + # local_print_list_at_Cons_internal_5 = VCALL local_print_list_at_Cons_internal_4 out_string + # Save new self pointer in $s1 + lw $s1, -20($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 4($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -24($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # local_print_list_at_Cons_internal_10 = GETATTRIBUTE xcdr Cons + # LOCAL local_print_list_at_Cons_internal_10 --> -44($fp) + lw $t0, 16($s1) + sw $t0, -44($fp) + # LOCAL local_print_list_at_Cons_internal_8 --> -36($fp) + # LOCAL local_print_list_at_Cons_internal_10 --> -44($fp) + # local_print_list_at_Cons_internal_8 = local_print_list_at_Cons_internal_10 + lw $t0, -44($fp) + sw $t0, -36($fp) + # Push register s1 into stack + subu $sp, $sp, 4 + sw $s1, 0($sp) + # LOCAL local_print_list_at_Cons_internal_8 --> -36($fp) + # LOCAL local_print_list_at_Cons_internal_9 --> -40($fp) + # local_print_list_at_Cons_internal_9 = VCALL local_print_list_at_Cons_internal_8 print_list + # Save new self pointer in $s1 + lw $s1, -36($fp) + # Get pointer to type + lw $t0, 4($s1) + # Get pointer to type's VTABLE + lw $t0, 0($t0) + # Get pointer to function address + lw $t0, 60($t0) + # Call function. Result is on $v0 + jalr $t0 + sw $v0, -40($fp) + # Pop 4 bytes from stack into register s1 + lw $s1, 0($sp) + addu $sp, $sp, 4 + # RETURN local_print_list_at_Cons_internal_9 + lw $v0, -40($fp) + # Deallocate stack frame for function function_print_list_at_Cons. + # Restore $ra + lw $ra, 4($sp) + # Restore $fp + lw $fp, 0($sp) + # Restore Stack pointer $sp + addu $sp, $sp, 52 + jr $ra + # Function END +