-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprev.s
710 lines (684 loc) · 15.8 KB
/
prev.s
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
.include "src/header.s"
.global _special_switch_i
.global _dataseg_string_loop
.macro write string,length
push {r0,r1,r2}
mov r7,#4 @ write syscall
mov r0,#1 @ stdout
ldr r1,=\string
ldr r2,=\length
svc 0
pop {r0,r1,r2}
.endm
_start:
bl main
main:
ldr r5,=heap @ heap pointer
mov r6,#0 @ comment flag
bl header @ print out header
b _loop1_cond @ while check cond
_loop1_start:
cmp r0,'\t'
beq _loop1_cond
cmp r0,' '
beq _loop1_cond
cmp r0,'\n'
moveq r6,#0 @ turn comment mode off
beq _loop1_cond
cmp r6,#1 @ ? is comment mode on
beq _loop1_cond
cmp r0,#35 @ # (begin comment)
moveq r6,#1
beq _loop1_cond
cmp r0,'}'
beq rcurly
cmp r0,':'
beq special @ one of special functions (getchar, putchar, if, while, exit)
blne assign @ any of the assign statements
_loop1_cond:
bl getchar
cmp r0,#0 @ check if we read any characters
bne _loop1_start
_loop_1_end:
bl dataseg @ data segment
mov r0,#0 @ set return value
bl exit @ call exit function
special:
bl getchar
mov r1,r0 @ save first character of keyword
_loop2:
bl getchar
cmp r0,'('
bne _loop2 @ skip all characters between first and (
_special_switch:
cmp r1,'g'
beq _special_switch_g
cmp r1,'p'
beq _special_switch_p
cmp r1,'r'
beq _special_switch_r
cmp r1,'i'
beq _special_switch_i
cmp r1,'w'
beq _special_switch_w
cmp r1,'e'
beq _special_switch_e
cmp r1,'l'
beq _special_switch_l
cmp r1,'s'
beq _special_switch_s
cmp r1,'c'
beq _special_switch_c
cmp r1,'f'
beq _special_switch_f
cmp r1,'t'
beq _special_switch_t
cmp r1,'u'
beq _special_switch_u
@ g(etchar)
_special_switch_g:
write __getchar_str1,__getchar_len1
bl getchar @ var
bl putchar
write __getchar_str2,__getchar_len2
b _special_switch_end
@ p(utchar)
_special_switch_p:
write __putchar_str1,__putchar_len1
bl getchar @ var
bl putchar
write __putchar_str2,__putchar_len2
b _special_switch_end
@ u(throwchar)
_special_switch_u:
write __putchar_str1,__putchar_len1
bl getchar @ var
bl putchar
write __uchar_str2,__uchar_len2
b _special_switch_end
@ raw(string)
_special_switch_r:
bl getchar
cmp r0,'"'
bne _special_switch_r @ skip all chars until "
_special_switch_r_loop:
bl getchar
cmp r0,'"'
beq _special_switch_r_loop_end
str r0,[r5],#4 @ store char on the heap and increment hp
cmp r0,'\\'
bne _special_switch_r_loop
bl getchar
str r0,[r5],#4 @ store escaped char and increment hp
b _special_switch_r_loop
_special_switch_r_loop_end:
mov r0,#0
strb r0,[r5],#4 @ null seperated strings
write __rstring_str1,__rstring_len1
ldr r0,=stringcnt
ldr r0,[r0]
bl putint @ write string id
write __rstring_str2,__rstring_len2
ldr r0,=stringcnt
ldr r0,[r0]
bl putint @ write string id
write __rstring_str3,__rstring_len3
ldr r1,=stringcnt
ldr r2,[r1] @ read string count
add r2,r2,#1 @ increment string counter
str r2,[r1] @ write back string counter
b _special_switch_end
@ throw(string)
_special_switch_t:
bl getchar
cmp r0,'"'
bne _special_switch_t @ skip all chars until "
_special_switch_t_loop:
bl getchar
cmp r0,'"'
beq _special_switch_t_loop_end
str r0,[r5],#4 @ store char on the heap and increment hp
cmp r0,'\\'
bne _special_switch_t_loop
bl getchar
str r0,[r5],#4 @ store escaped char and increment hp
b _special_switch_t_loop
_special_switch_t_loop_end:
mov r0,#0
strb r0,[r5],#4 @ null separated strings
write __tstring_str1,__tstring_len1
ldr r0,=stringcnt
ldr r0,[r0]
bl putint @ write string id
write __rstring_str2,__rstring_len2
ldr r0,=stringcnt
ldr r0,[r0]
bl putint @ write string id
write __rstring_str3,__rstring_len3
ldr r1,=stringcnt
ldr r2,[r1] @ read string count
add r2,r2,#1 @ increment string counter
str r2,[r1] @ write back string counter
b _special_switch_end
@ i(f)
_special_switch_i:
bl expression_entry
write __if_str1,__if_len1
ldr r2,=labelcnt
ldr r1,[r2]
mov r0,r1
bl putint
mov r0,'\n'
bl putchar
mov r0,#1
mov r8,r1
push {r0,r1,r8}
add r1,r1,#1
str r1,[r2]
_special_switch_i_skip:
bl getchar
cmp r0,'{'
bne _special_switch_i_skip
b _special_switch_end
@ w(hile)
_special_switch_w:
ldr r4,=labelcnt
ldr r3,[r4]
write __while_str1,__while_len1
mov r0,r3 @ id
bl putint
mov r0,':'
bl putchar
mov r0,'\n'
bl putchar
bl expression_entry
write __while_str2,__while_len2
mov r0,r3 @ id
bl putint
mov r0,'\n'
bl putchar
mov r0,#3 @ while
mov r8,#-1 @ invalid if chain label
push {r0,r3,r8}
add r3,r3,#1
str r3,[r4]
b _special_switch_end
@ e(xit)
_special_switch_e:
bl expression_entry
write __exit_str,__exit_len
b _special_switch_end
@ c(all)
_special_switch_c:
write __call_str,__call_len
bl getchar
_special_switch_c_loop:
bl putchar
bl getchar
cmp r0,')'
bne _special_switch_c_loop
mov r0,'\n'
bl putchar
b _special_switch_end
@ f(un)
_special_switch_f:
mov r0,'F' @ function label prefix
bl putchar
bl getchar
_special_switch_f_loop:
bl putchar
bl getchar
cmp r0,')'
bne _special_switch_f_loop
write __fun_str1,__fun_len1
mov r0,#4
mov r1,#-1
mov r8,#-1
push {r0,r1,r8}
b _special_switch_end
@ l(oad)
_special_switch_l:
bl skipspaces
push {r0} @ :load 1st arg
bl skipspaces
cmp r0,','
movne r0,','
bne exit @ error 44 - missing ,
bl expression_entry
write __load_str1,__load_len1
pop {r0}
bl putchar
write __load_str2,__load_len2 @ ldr r0,[r0, LSL #2] str r0,[r1]
b _special_switch_end
@ s(tore)
_special_switch_s:
bl expression_entry
cmp r0,','
movne r0,','
bne exit @ error 44 - missing ,
bl expression_entry
write __store_str,__store_len
b _special_switch_end
_special_switch_end:
bl getchar
cmp r0,#0
beq _special_endskip
cmp r0,'\n'
beq _special_endskip
b _special_switch_end
_special_endskip:
b _loop1_cond
rcurly: @ not a function
@ r3 .. enclosing statement if:1 else:2 while:3 fun:4
@ r4 .. statement's label number
@ r8 .. chained if end label number
pop {r3,r4,r8}
cmp r3,#1 @ if
beq rcurly_if
cmp r3,#2 @ else
beq rcurly_else
cmp r3,#3 @ while
beq rcurly_while
cmp r3,#4 @ fun
beq rcurly_fun
mov r0,#11 @ error 11 - misplaced }
bl exit
rcurly_if:
write __if_str3,__if_len3
mov r0,r8 @ end label
bl putint
write __if_str4,__if_len4
mov r0,r4 @ id
bl putint
mov r0,':'
bl putchar
mov r0,'\n'
bl putchar
bl skipspaces
cmp r0,'e'
bne rcurly_else
rcurly_if_skip:
bl getchar
cmp r0,'i'
beq rcurly_another_if
cmp r0,'{'
bne rcurly_if_skip
mov r3,#2 @ set else mode
push {r3,r4,r8}
b rcurly_end
rcurly_else:
write __if_str5,__if_len5
mov r0,r8 @ id
bl putint
mov r0,':'
bl putchar
mov r0,'\n'
bl putchar
b rcurly_end
rcurly_another_if:
bl getchar
cmp r0,'('
bne rcurly_another_if @ skip all characters between first and (
bl expression_entry
write __if_str1,__if_len1
ldr r2,=labelcnt
ldr r1,[r2]
mov r0,r1
bl putint
mov r0,'\n'
bl putchar
mov r0,#1
push {r0,r1,r8}
add r1,r1,#1
str r1,[r2]
b _special_switch_i_skip
rcurly_while:
write __while_str3,__while_len3
mov r0,r4 @ id
bl putint
write __while_str4,__while_len4
mov r0,r4 @ id
bl putint
mov r0,':'
bl putchar
mov r0,'\n'
bl putchar
b rcurly_end
rcurly_fun:
write __fun_str2,__fun_len2
b rcurly_end
rcurly_end:
b _loop1_cond
assign:
push {lr}
push {r0} @ destination
bl skipspaces
cmp r0,'='
bne exit @ error 61 - missing =
bl expression_entry
write __stmt_store_str1,__stmt_store_len1
pop {r0}
bl putchar
write __stmt_store_str2,__stmt_store_len2
pop {lr}
bx lr
expression_entry:
push {lr}
expression:
bl skipspaces
expression_noskip:
cmp r0,'\n'
beq expression_end
cmp r0,'0'
blt expression_variable
cmp r0,'9'
bgt expression_variable
expression_const:
write __stmt_const_str1,__stmt_const_len1
expression_const_loop:
bl putchar
bl getchar
cmp r0,'0'
blt expression_const_end
cmp r0,'9'
bgt expression_const_end
b expression_const_loop
expression_const_end:
write __stmt_const_str2,__stmt_const_len2
cmp r0,' '
beq expression
cmp r0,'\t'
beq expression
b expression_noskip
expression_variable:
cmp r0,'a'
blt expression_operator
cmp r0,'z'
bgt expression_operator
write __load_var_str1,__load_var_len1
bl putchar
write __load_var_str2,__load_var_len2
write __load_var_str3,__load_var_len3
b expression
expression_operator:
cmp r0,'+'
beq expression_add
cmp r0,'-'
beq expression_sub
cmp r0,'*'
beq expression_mul
cmp r0,'/'
beq expression_div
cmp r0,'%'
beq expression_mod
cmp r0,'>'
beq expression_gt
cmp r0,'<'
beq expression_lt
cmp r0,'&'
beq expression_and
cmp r0,'|'
beq expression_or
cmp r0,'#'
beq expression_comment
cmp r0,'='
bne expression_end
bl getchar
cmp r0,'='
beq expression_eq
cmp r0,'<'
beq expression_leq
cmp r0,'>'
beq expression_geq
cmp r0,'!'
beq expression_neq
@ if no expression matches, we just fall through and return
expression_end:
pop {lr}
bx lr
expression_comment:
mov r6,#1
b expression_end
expression_add:
write __stmt_add_str,__stmt_add_len
b expression
expression_sub:
write __stmt_sub_str,__stmt_sub_len
b expression
expression_mul:
write __stmt_mul_str,__stmt_mul_len
b expression
expression_div:
write __stmt_div_str,__stmt_div_len
b expression
expression_mod:
write __stmt_mod_str,__stmt_mod_len
b expression
expression_gt:
write __stmt_gt_str,__stmt_gt_len
b expression
expression_geq:
write __stmt_geq_str,__stmt_geq_len
b expression
expression_lt:
write __stmt_lt_str,__stmt_lt_len
b expression
expression_leq:
write __stmt_leq_str,__stmt_leq_len
b expression
expression_eq:
write __stmt_eq_str,__stmt_eq_len
b expression
expression_neq:
write __stmt_neq_str,__stmt_neq_len
b expression
expression_and:
write __stmt_and_str,__stmt_and_len
b expression
expression_or:
write __stmt_or_str,__stmt_or_len
b expression
header:
push {r0,r1,r2,r7,lr}
write __header_str,__header_len
pop {r0,r1,r2,r7,lr}
bx lr
dataseg:
push {r0,r1,r2,r3,r4,r7,lr}
@ dataseg header
write __dataseg_str,__dataseg_len
@ dataseg header end
@ variables
mov r3,'a'
_dataseg_loop:
mov r0,r3
bl putchar
write __variable_str,__variable_len
add r3,r3,#1
cmp r3,'z'
ble _dataseg_loop
@ strings (r4 already contains cbuf addr)
ldr r2,=stringcnt
mov r3,#0 @ string index
ldr r2,[r2] @ string counter
ldr r1,=heap @ start of heap
_dataseg_string_loop:
cmp r3,r2
bge _dataseg_string_end
mov r0,'s'
bl putchar
mov r0,r3
bl putint
push {r1,r2}
write __rstrdata_str1,__rstrdata_len1
pop {r1,r2}
_dataseg_str_literal:
ldr r0,[r1],#4
cmp r0,#0 @ is char null
beq _dataseg_str_literal_end
bl putchar
b _dataseg_str_literal
_dataseg_str_literal_end:
@ close string literal
push {r1,r2} @ save r2 (string count)
write __rstrdata_str2,__rstrdata_len2
mov r0,r3
bl putint
write __rstrdata_str3,__rstrdata_len3
mov r0,r3
bl putint
mov r0,'\n'
bl putchar
pop {r1,r2} @ retrieve r2 (string count)
add r3,r3,#1 @ increment string index
b _dataseg_string_loop
_dataseg_string_end:
@ heap label
write __mem_str,__mem_len
pop {r0,r1,r2,r3,r4,r7,lr}
bx lr
@ r0 has arg
putint:
push {r1,r2,r3,lr}
mov r2,#0
putint_div:
mov r1,#10 @ divisor
sdiv r3,r0,r1
mul r1,r1,r3
sub r1,r0,r1
mov r0,r3
cmp r0,#0
beq putint_unroll
add r2,r2,#1 @ counter
push {r1}
b putint_div
putint_unroll:
push {r1}
ldr r3,=cbuf
putint_unroll_loop:
pop {r1}
add r1,r1,'0'
mov r0,r1
bl putchar
sub r2,r2,#1
cmp r2,#0
bge putint_unroll_loop
pop {r1,r2,r3,lr}
bx lr
skipspaces: @ returns read character in r0
push {lr}
skipspaces_l:
bl getchar
cmp r0,' '
beq skipspaces_l
cmp r0,'\t'
beq skipspaces_l
pop {lr}
bx lr
.data
cbuf: .byte 0,0
stringcnt: .word 0
labelcnt: .word 0
__header_str: .ascii ".include \"src/header.s\"\n\n_start:\n\tbl\tFmain\n\tmov\tr0,#0\n\tbl\texit\n\n"
__header_len = .-__header_str
__dataseg_str: .ascii "\n.data\ncbuf: .byte 0,0\n"
__dataseg_len = .-__dataseg_str
__getchar_str1: .ascii "\tbl\tgetchar\n\tldr\tr1,="
__getchar_len1 = .-__getchar_str1
__getchar_str2: .ascii "\n\tstr\tr0,[r1]\n"
__getchar_len2 = .-__getchar_str2
__putchar_str1: .ascii "\tldr\tr0,="
__putchar_len1 = .-__putchar_str1
__putchar_str2: .ascii "\n\tldr\tr0,[r0]\n\tbl\tputchar\n"
__putchar_len2 = .-__putchar_str2
__uchar_str2: .ascii "\n\tldr\tr0,[r0]\n\tbl\tthrowchar\n"
__uchar_len2 = .-__uchar_str2
__rstring_str1: .ascii "\tmov\tr7,#4\n\tmov\tr0,#1\n\tldr\tr1,=s"
__rstring_len1 = .-__rstring_str1
__tstring_str1: .ascii "\tmov\tr7,#4\n\tmov\tr0,#2\n\tldr\tr1,=s"
__tstring_len1 = .-__tstring_str1
__rstring_str2: .ascii "\n\tldr\tr2,=slen"
__rstring_len2 = .-__rstring_str2
__rstring_str3: .ascii "\n\tsvc\t0\n"
__rstring_len3 = .-__rstring_str3
__rstrdata_str1: .ascii ": .ascii \""
__rstrdata_len1 = .-__rstrdata_str1
__rstrdata_str2: .ascii "\"\nslen"
__rstrdata_len2 = .-__rstrdata_str2
__rstrdata_str3: .ascii " = .-s"
__rstrdata_len3 = .-__rstrdata_str3
__exit_str: .ascii "\n\tpop\t{r0}\n\tbl\texit\n"
__exit_len = .-__exit_str
__variable_str: .ascii ": .word 0\n"
__variable_len = .-__variable_str
__if_str1: .ascii "\tpop\t{r0}\n\tcmp\tr0,#0\n\tbeq\tLneg"
__if_len1 = .-__if_str1
__if_str3: .ascii "\tb\tLend"
__if_len3 = .-__if_str3
__if_str4: .ascii "\n.pool\nLneg"
__if_len4 = .-__if_str4
__if_str5: .ascii "Lend"
__if_len5 = .-__if_str5
__load_var_str1: .ascii "\tldr\tr0,="
__load_var_len1 = .-__load_var_str1
__load_var_str2: .ascii "\n\tldr\tr0,[r0]\n"
__load_var_len2 = .-__load_var_str2
__load_var_str3: .ascii "\tpush\t{r0}\n"
__load_var_len3 = .-__load_var_str3
__while_str1: .ascii "Lloop"
__while_len1 = .-__while_str1
__while_str2: .ascii "\tpop\t{r0}\n\tcmp\tr0,#0\n\tbeq\tLloop_end"
__while_len2 = .-__while_str2
__while_str3: .ascii "\tb\tLloop"
__while_len3 = .-__while_str3
__while_str4: .ascii "\nLloop_end"
__while_len4 = .-__while_str4
__load_str1: .ascii "\tpop\t{r0}\n\tldr\tr1,="
__load_len1 = .-__load_str1
__load_str2: .ascii "\n\tldr\tr2,=mem\n\tldr\tr0,[r2, r0, LSL #2]\n\tstr\tr0,[r1]\n"
__load_len2 = .-__load_str2
__store_str: .ascii "\tpop\t{r0,r1}\n\tldr\tr2,=mem\n\tstr\tr1,[r2,r0, LSL #2]\n"
__store_len = .-__store_str
__stmt_const_str1: .ascii "\tmov\tr0,#"
__stmt_const_len1 = .-__stmt_const_str1
__stmt_const_str2: .ascii "\n\tpush\t{r0}\n"
__stmt_const_len2 = .-__stmt_const_str2
__stmt_add_str: .ascii "\tpop\t{r0,r1}\n\tadd\tr0,r1,r0\n\tpush\t{r0}\n"
__stmt_add_len = .-__stmt_add_str
__stmt_sub_str: .ascii "\tpop\t{r0,r1}\n\tsub\tr0,r1,r0\n\tpush\t{r0}\n"
__stmt_sub_len = .-__stmt_sub_str
__stmt_mul_str: .ascii "\tpop\t{r0,r1}\n\tmul\tr0,r1,r0\n\tpush\t{r0}\n"
__stmt_mul_len = .-__stmt_mul_str
__stmt_div_str: .ascii "\tpop\t{r0,r1}\n\tsdiv\tr0,r1,r0\n\tpush\t{r0}\n"
__stmt_div_len = .-__stmt_div_str
__stmt_mod_str: .ascii "\tpop\t{r0,r1}\n\tsdiv\tr2,r1,r0\n\tmul\tr0,r2,r0\n\tsub\tr0,r1,r0\n\tpush\t{r0}\n"
__stmt_mod_len = .-__stmt_mod_str
__stmt_gt_str: .ascii "\tpop\t{r0,r1}\n\tcmp\tr1,r0\n\tmovgt\tr0,#1\n\tmovle\tr0,#0\n\tpush\t{r0}\n"
__stmt_gt_len = .-__stmt_gt_str
__stmt_geq_str: .ascii "\tpop\t{r0,r1}\n\tcmp\tr1,r0\n\tmovge\tr0,#1\n\tmovlt\tr0,#0\n\tpush\t{r0}\n"
__stmt_geq_len = .-__stmt_geq_str
__stmt_lt_str: .ascii "\tpop\t{r0,r1}\n\tcmp\tr1,r0\n\tmovlt\tr0,#1\n\tmovge\tr0,#0\n\tpush\t{r0}\n"
__stmt_lt_len = .-__stmt_lt_str
__stmt_leq_str: .ascii "\tpop\t{r0,r1}\n\tcmp\tr1,r0\n\tmovle\tr0,#1\n\tmovgt\tr0,#0\n\tpush\t{r0}\n"
__stmt_leq_len = .-__stmt_leq_str
__stmt_eq_str: .ascii "\tpop\t{r0,r1}\n\tcmp\tr1,r0\n\tmoveq\tr0,#1\n\tmovne\tr0,#0\n\tpush\t{r0}\n"
__stmt_eq_len = .-__stmt_eq_str
__stmt_neq_str: .ascii "\tpop\t{r0,r1}\n\tcmp\tr1,r0\n\tmovne\tr0,#1\n\tmoveq\tr0,#0\n\tpush\t{r0}\n"
__stmt_neq_len = .-__stmt_neq_str
__stmt_and_str: .ascii "\tpop\t{r0,r1}\n\tand\tr0,r1,r0\n\tpush\t{r0}\n"
__stmt_and_len = .-__stmt_and_str
__stmt_or_str: .ascii "\tpop\t{r0,r1}\n\torr\tr0,r1,r0\n\tpush\t{r0}\n"
__stmt_or_len = .-__stmt_or_str
__stmt_store_str1: .ascii "\tpop\t{r0}\n\tldr\tr1,="
__stmt_store_len1 = .-__stmt_store_str1
__stmt_store_str2: .ascii "\n\tstr\tr0,[r1]\n"
__stmt_store_len2 = .-__stmt_store_str2
__call_str: .ascii "\tbl\tF"
__call_len = .-__call_str
__fun_str1: .ascii ":\n\tpush\t{lr}\n"
__fun_len1 = .-__fun_str1
__fun_str2: .ascii "\tpop\t{lr}\n\tbx\tlr\n.pool\n"
__fun_len2 = .-__fun_str2
__mem_str: .ascii "mem: .space 80000\n"
__mem_len = .-__mem_str
heap: .space 40000