Examination of the MAL code reveals that the procedure calling conventions are observed when passing parameters to the system procedures prior to the jal instructions. The read() and write() functions, like all Unix system procedures, return a value in $2 ($v0).
The MAL code is then assembled to produce the executable file a.out.