170 loadI 0 => r_nul // initialise zero register 171 loadI 176 => r_arp // malloc 172 push r_arp // malloc 173 loadI 24 => r_arp // malloc 174 push r_arp // malloc 175 jumpI -> memalloc // malloc 176 pop => r_arp // malloc 177 addI r_arp,16 => r_arp // construct main AR 178 jumpI -> s0 // define successor - jump over body 179 nop // define successor - entry point 180 addI r_arp,0 => r_1 // add offset 181 load r_1 => r_1 // load address 182 loadI 1 => r_2 // 1 183 add r_1,r_2 => r_1 // + 184 storeAI r_1 => r_arp,-12 // define successor - move result 185 loadAI r_arp,-8 => r_2 // load ref count 186 loadI 1 => r_1 // one 187 cmp_LE r_2,r_1 => r_2 // check more than one ref 188 cbr r_2 -> ycl1,ncl2 // remove vars if last reference 189 ycl1: nop // cleanup target 190 ncl2: nop // no cleanup target 191 loadAI r_arp,-8 => r_1 // define successor - load return address 192 jump -> r_1 // define successor - go to return address 193 s0: nop // define successor - skip target 194 loadI 199 => r_1 // malloc 195 push r_1 // malloc 196 loadI 12 => r_1 // malloc 197 push r_1 // malloc 198 jumpI -> memalloc // malloc 199 pop => r_1 // malloc 200 loadI 179 => r_2 // define successor - load target address 201 storeAI r_2 => r_1,0 // define successor - set target address 202 storeAI r_arp => r_1,4 // define successor - copy ARP 203 loadI 20 => r_2 // define successor - load AR size 204 storeAI r_2 => r_1,8 // define successor - set AR size 205 storeAI r_1 => r_arp,0 // define successor - set function reference 206 i2i r_arp => ART // AR incRef 207 cmp_NE ART,r_nul => r_1 // AR incRef 208 cbr r_1 -> aril3,arid4 // AR incRef 209 aril3: loadI 214 => r_1 // AR incRef 210 push r_1 // AR incRef 211 subI ART,16 => r_1 // AR incRef 212 push r_1 // AR incRef 213 jumpI -> memaddref // AR incRef 214 loadAI ART,-16 => ART // AR incRef 215 cmp_NE ART,r_nul => r_1 // AR incRef 216 cbr r_1 -> aril3,arid4 // AR incRef 217 arid4: nop // AR incRef 218 addI r_arp,4 => r_1 // add offset 219 in "" => r_1 // 220 addI r_arp,4 => r_2 // add offset 221 store r_1 => r_2 // save to var x 222 addI r_arp,0 => r_3 // add offset 223 load r_3 => r_2 // call successor - load function reference 224 loadAI r_2,8 => r_2 // call successor - load AR size 225 loadI 229 => r_1 // malloc 226 push r_1 // malloc 227 push r_2 // malloc 228 jumpI -> memalloc // malloc 229 pop => r_1 // malloc 230 addI r_1,16 => r_1 // call successor - shift AR 231 addI r_arp,4 => r_2 // add offset 232 load r_2 => r_2 // load address 233 storeAI r_2 => r_1,0 // call successor - store param 0 234 addI r_arp,0 => r_4 // add offset 235 load r_4 => r_2 // call successor - load function reference 236 storeAI r_arp => r_1,-4 // call successor - link caller ARP 237 loadAI r_2,4 => r_3 // call successor - load AL 238 storeAI r_3 => r_1,-16 // call successor - link AL 239 loadAI r_1,-16 => ART // add ref for callee's AL 240 i2i ART => ART // AR incRef 241 cmp_NE ART,r_nul => r_3 // AR incRef 242 cbr r_3 -> aril5,arid6 // AR incRef 243 aril5: loadI 248 => r_3 // AR incRef 244 push r_3 // AR incRef 245 subI ART,16 => r_3 // AR incRef 246 push r_3 // AR incRef 247 jumpI -> memaddref // AR incRef 248 loadAI ART,-16 => ART // AR incRef 249 cmp_NE ART,r_nul => r_3 // AR incRef 250 cbr r_3 -> aril5,arid6 // AR incRef 251 arid6: nop // AR incRef 252 loadI 257 => r_3 // call successor - load return address 253 storeAI r_3 => r_1,-8 // call successor - set return address 254 i2i r_1 => r_arp // call successor - move ARP 255 loadAI r_2,0 => r_3 // call successor - load target address 256 jump -> r_3 // call successor - execute 257 i2i r_arp => ART // AR decRef 258 cmp_NE ART,r_nul => r_2 // AR decRef 259 cbr r_2 -> ardl7,ardd8 // AR decRef 260 ardl7: loadI 265 => r_2 // AR decRef 261 push r_2 // AR decRef 262 subI ART,16 => r_2 // AR decRef 263 push r_2 // AR decRef 264 jumpI -> memfree // AR decRef 265 loadAI ART,-16 => ART // AR decRef 266 cmp_NE ART,r_nul => r_2 // AR decRef 267 cbr r_2 -> ardl7,ardd8 // AR decRef 268 ardd8: nop // AR decRef 269 loadAI r_arp,-12 => r_1 // call successor - load result 270 loadAI r_arp,-4 => r_arp // call successor - reset ARP 271 out "",r_1 // 272 loadAI r_arp,0 => r_3 // remove reference get var 273 cmp_EQ r_3,r_nul => r_2 // remove reference 274 cbr r_2 -> ynul9,nnul10 // remove reference 275 nnul10: nop // remove reference 276 loadI 280 => r_2 // free 277 push r_2 // free 278 push r_3 // free 279 jumpI -> memfree // free 280 loadAI r_3,4 => r_3 // remove reference 281 i2i r_3 => ART // AR decRef 282 cmp_NE ART,r_nul => r_2 // AR decRef 283 cbr r_2 -> ardl11,ardd12 // AR decRef 284 ardl11: loadI 289 => r_2 // AR decRef 285 push r_2 // AR decRef 286 subI ART,16 => r_2 // AR decRef 287 push r_2 // AR decRef 288 jumpI -> memfree // AR decRef 289 loadAI ART,-16 => ART // AR decRef 290 cmp_NE ART,r_nul => r_2 // AR decRef 291 cbr r_2 -> ardl11,ardd12 // AR decRef 292 ardd12: nop // AR decRef 293 ynul9: nop // remove reference 294 subI r_arp,16 => r_arp // deconstruct main AR 295 loadI 299 => r_3 // free 296 push r_3 // free 297 push r_arp // free 298 jumpI -> memfree // free