about summary refs log tree commit diff stats
path: root/sandboxing/includes
blob: 1ae39d0da55e4e00e5829744f1ac9b610720502e (plain) (blame)
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
kilo.c:#include <assert.h>
kilo.c:#include <ncurses.h>
kilo.c:#include <stdlib.h>
kilo.c:#include <stdio.h>
kilo.c:#include <stdint.h>
kilo.c:#include <errno.h>
kilo.c:#include <string.h>
kilo.c:#include <ctype.h>
kilo.c:#include <time.h>
kilo.c:#include <sys/types.h>
kilo.c:#include <sys/time.h>
kilo.c:#include <unistd.h>
kilo.c:#include <fcntl.h>
kilo.c:#include "lua.h"
kilo.c:#include "teliva.h"
lapi.c:#include <assert.h>
lapi.c:#include <math.h>
lapi.c:#include <stdarg.h>
lapi.c:#include <string.h>
lapi.c:#include "lua.h"
lapi.c:#include "lapi.h"
lapi.c:#include "ldebug.h"
lapi.c:#include "ldo.h"
lapi.c:#include "lfunc.h"
lapi.c:#include "lgc.h"
lapi.c:#include "lmem.h"
lapi.c:#include "lobject.h"
lapi.c:#include "lstate.h"
lapi.c:#include "lstring.h"
lapi.c:#include "ltable.h"
lapi.c:#include "ltm.h"
lapi.c:#include "lundump.h"
lapi.c:#include "lvm.h"
lapi.h:#include "lobject.h"
lauxlib.c:#include <ctype.h>
lauxlib.c:#include <errno.h>
lauxlib.c:#include <stdarg.h>
lauxlib.c:#include <stdio.h>
lauxlib.c:#include <stdlib.h>
lauxlib.c:#include <string.h>
lauxlib.c:#include "lua.h"
lauxlib.c:#include "lauxlib.h"
lauxlib.h:#include <stddef.h>
lauxlib.h:#include <stdio.h>
lauxlib.h:#include "lua.h"
lbaselib.c:#include <ctype.h>
lbaselib.c:#include <ncurses.h>
lbaselib.c:#include <stdio.h>
lbaselib.c:#include <stdlib.h>
lbaselib.c:#include <string.h>
lbaselib.c:#include "lua.h"
lbaselib.c:#include "lauxlib.h"
lbaselib.c:#include "lualib.h"
lcode.c:#include <stdlib.h>
lcode.c:#include "lua.h"
lcode.c:#include "lcode.h"
lcode.c:#include "ldebug.h"
lcode.c:#include "ldo.h"
lcode.c:#include "lgc.h"
lcode.c:#include "llex.h"
lcode.c:#include "lmem.h"
lcode.c:#include "lobject.h"
lcode.c:#include "lopcodes.h"
lcode.c:#include "lparser.h"
lcode.c:#include "ltable.h"
lcode.h:#include "llex.h"
lcode.h:#include "lobject.h"
lcode.h:#include "lopcodes.h"
lcode.h:#include "lparser.h"
ldblib.c:#include <stdio.h>
ldblib.c:#include <stdlib.h>
ldblib.c:#include <string.h>
ldblib.c:#include "lua.h"
ldblib.c:#include "lauxlib.h"
ldblib.c:#include "lualib.h"
ldebug.c:#include <stdarg.h>
ldebug.c:#include <stddef.h>
ldebug.c:#include <string.h>
ldebug.c:#include "lua.h"
ldebug.c:#include "lapi.h"
ldebug.c:#include "lcode.h"
ldebug.c:#include "ldebug.h"
ldebug.c:#include "ldo.h"
ldebug.c:#include "lfunc.h"
ldebug.c:#include "lobject.h"
ldebug.c:#include "lopcodes.h"
ldebug.c:#include "lstate.h"
ldebug.c:#include "lstring.h"
ldebug.c:#include "ltable.h"
ldebug.c:#include "ltm.h"
ldebug.c:#include "lvm.h"
ldebug.h:#include "lstate.h"
ldo.c:#include <setjmp.h>
ldo.c:#include <stdio.h>
ldo.c:#include <stdlib.h>
ldo.c:#include <string.h>
ldo.c:#include "lua.h"
ldo.c:#include "ldebug.h"
ldo.c:#include "ldo.h"
ldo.c:#include "lfunc.h"
ldo.c:#include "lgc.h"
ldo.c:#include "lmem.h"
ldo.c:#include "lobject.h"
ldo.c:#include "lopcodes.h"
ldo.c:#include "lparser.h"
ldo.c:#include "lstate.h"
ldo.c:#include "lstring.h"
ldo.c:#include "ltable.h"
ldo.c:#include "ltm.h"
ldo.c:#include "lundump.h"
ldo.c:#include "lvm.h"
ldo.c:#include "lzio.h"
ldo.h:#include "lobject.h"
ldo.h:#include "lstate.h"
ldo.h:#include "lzio.h"
ldump.c:#include <stddef.h>
ldump.c:#include "lua.h"
ldump.c:#include "lobject.h"
ldump.c:#include "lstate.h"
ldump.c:#include "lundump.h"
lfunc.c:#include <stddef.h>
lfunc.c:#include "lua.h"
lfunc.c:#include "lfunc.h"
lfunc.c:#include "lgc.h"
lfunc.c:#include "lmem.h"
lfunc.c:#include "lobject.h"
lfunc.c:#include "lstate.h"
lfunc.h:#include "lobject.h"
lgc.c:#include <string.h>
lgc.c:#include "lua.h"
lgc.c:#include "ldebug.h"
lgc.c:#include "ldo.h"
lgc.c:#include "lfunc.h"
lgc.c:#include "lgc.h"
lgc.c:#include "lmem.h"
lgc.c:#include "lobject.h"
lgc.c:#include "lstate.h"
lgc.c:#include "lstring.h"
lgc.c:#include "ltable.h"
lgc.c:#include "ltm.h"
lgc.h:#include "lobject.h"
linit.c:#include "lua.h"
linit.c:#include "lualib.h"
linit.c:#include "lauxlib.h"
liolib.c:#include <errno.h>
liolib.c:#include <stdio.h>
liolib.c:#include <stdlib.h>
liolib.c:#include <string.h>
liolib.c:#include "lua.h"
liolib.c:#include "lauxlib.h"
liolib.c:#include "lualib.h"
llex.c:#include <ctype.h>
llex.c:#include <locale.h>
llex.c:#include <string.h>
llex.c:#include "lua.h"
llex.c:#include "ldo.h"
llex.c:#include "llex.h"
llex.c:#include "lobject.h"
llex.c:#include "lparser.h"
llex.c:#include "lstate.h"
llex.c:#include "lstring.h"
llex.c:#include "ltable.h"
llex.c:#include "lzio.h"
llex.h:#include "lobject.h"
llex.h:#include "lzio.h"
llimits.h:#include <limits.h>
llimits.h:#include <stddef.h>
llimits.h:#include "lua.h"
lmathlib.c:#include <stdlib.h>
lmathlib.c:#include <math.h>
lmathlib.c:#include "lua.h"
lmathlib.c:#include "lauxlib.h"
lmathlib.c:#include "lualib.h"
lmem.c:#include <stddef.h>
lmem.c:#include "lua.h"
lmem.c:#include "ldebug.h"
lmem.c:#include "ldo.h"
lmem.c:#include "lmem.h"
lmem.c:#include "lobject.h"
lmem.c:#include "lstate.h"
lmem.h:#include <stddef.h>
lmem.h:#include "llimits.h"
lmem.h:#include "lua.h"
loadlib.c:#include <stdlib.h>
loadlib.c:#include <string.h>
loadlib.c:#include "lua.h"
loadlib.c:#include "lauxlib.h"
loadlib.c:#include "lualib.h"
loadlib.c:#include <dlfcn.h>
loadlib.c:#include <windows.h>
loadlib.c:#include <mach-o/dyld.h>
lobject.c:#include <ctype.h>
lobject.c:#include <stdarg.h>
lobject.c:#include <stdio.h>
lobject.c:#include <stdlib.h>
lobject.c:#include <string.h>
lobject.c:#include "lua.h"
lobject.c:#include "ldo.h"
lobject.c:#include "lmem.h"
lobject.c:#include "lobject.h"
lobject.c:#include "lstate.h"
lobject.c:#include "lstring.h"
lobject.c:#include "lvm.h"
lobject.h:#include <stdarg.h>
lobject.h:#include "llimits.h"
lobject.h:#include "lua.h"
lopcodes.c:#include "lopcodes.h"
lopcodes.h:#include "llimits.h"
loslib.c:#include <errno.h>
loslib.c:#include <locale.h>
loslib.c:#include <stdlib.h>
loslib.c:#include <string.h>
loslib.c:#include <time.h>
loslib.c:#include "lua.h"
loslib.c:#include "lauxlib.h"
loslib.c:#include "lualib.h"
lparser.c:#include <string.h>
lparser.c:#include "lua.h"
lparser.c:#include "lcode.h"
lparser.c:#include "ldebug.h"
lparser.c:#include "ldo.h"
lparser.c:#include "lfunc.h"
lparser.c:#include "llex.h"
lparser.c:#include "lmem.h"
lparser.c:#include "lobject.h"
lparser.c:#include "lopcodes.h"
lparser.c:#include "lparser.h"
lparser.c:#include "lstate.h"
lparser.c:#include "lstring.h"
lparser.c:#include "ltable.h"
lparser.h:#include "llimits.h"
lparser.h:#include "lobject.h"
lparser.h:#include "lzio.h"
lstate.c:#include <stddef.h>
lstate.c:#include "lua.h"
lstate.c:#include "ldebug.h"
lstate.c:#include "ldo.h"
lstate.c:#include "lfunc.h"
lstate.c:#include "lgc.h"
lstate.c:#include "llex.h"
lstate.c:#include "lmem.h"
lstate.c:#include "lstate.h"
lstate.c:#include "lstring.h"
lstate.c:#include "ltable.h"
lstate.c:#include "ltm.h"
lstate.h:#include "lua.h"
lstate.h:#include "lobject.h"
lstate.h:#include "ltm.h"
lstate.h:#include "lzio.h"
lstring.c:#include <string.h>
lstring.c:#include "lua.h"
lstring.c:#include "lmem.h"
lstring.c:#include "lobject.h"
lstring.c:#include "lstate.h"
lstring.c:#include "lstring.h"
lstring.h:#include "lgc.h"
lstring.h:#include "lobject.h"
lstring.h:#include "lstate.h"
lstrlib.c:#include <ctype.h>
lstrlib.c:#include <stddef.h>
lstrlib.c:#include <stdio.h>
lstrlib.c:#include <stdlib.h>
lstrlib.c:#include <string.h>
lstrlib.c:#include "lua.h"
lstrlib.c:#include "lauxlib.h"
lstrlib.c:#include "lualib.h"
ltable.c:#include <math.h>
ltable.c:#include <string.h>
ltable.c:#include "lua.h"
ltable.c:#include "ldebug.h"
ltable.c:#include "ldo.h"
ltable.c:#include "lgc.h"
ltable.c:#include "lmem.h"
ltable.c:#include "lobject.h"
ltable.c:#include "lstate.h"
ltable.c:#include "ltable.h"
ltable.h:#include "lobject.h"
ltablib.c:#include <stddef.h>
ltablib.c:#include "lua.h"
ltablib.c:#include "lauxlib.h"
ltablib.c:#include "lualib.h"
ltm.c:#include <string.h>
ltm.c:#include "lua.h"
ltm.c:#include "lobject.h"
ltm.c:#include "lstate.h"
ltm.c:#include "lstring.h"
ltm.c:#include "ltable.h"
ltm.c:#include "ltm.h"
ltm.h:#include "lobject.h"
lua.c:#include <assert.h>
lua.c:#include <ctype.h>
lua.c:#include <fcntl.h>
lua.c:#include <locale.h>
lua.c:#include <ncurses.h>
lua.c:#include <signal.h>
lua.c:#include <stdio.h>
lua.c:#include <stdlib.h>
lua.c:#include <string.h>
lua.c:#include <time.h>
lua.c:#include <unistd.h>
lua.c:#include "lua.h"
lua.c:#include "teliva.h"
lua.c:#include "lauxlib.h"
lua.c:#include "lualib.h"
lua.h:#include <stdarg.h>
lua.h:#include <stddef.h>
lua.h:#include "luaconf.h"
lua.h:#include LUA_USER_H
luaconf.h:#include <limits.h>
luaconf.h:#include <stddef.h>
luaconf.h:#include <assert.h>
luaconf.h:#include <math.h>
luaconf.h:#include <unistd.h>
luaconf.h:#include <stdio.h>
lualib.h:#include "lua.h"
lundump.c:#include <string.h>
lundump.c:#include "lua.h"
lundump.c:#include "ldebug.h"
lundump.c:#include "ldo.h"
lundump.c:#include "lfunc.h"
lundump.c:#include "lmem.h"
lundump.c:#include "lobject.h"
lundump.c:#include "lstring.h"
lundump.c:#include "lundump.h"
lundump.c:#include "lzio.h"
lundump.h:#include "lobject.h"
lundump.h:#include "lzio.h"
lvm.c:#include <stdio.h>
lvm.c:#include <stdlib.h>
lvm.c:#include <string.h>
lvm.c:#include "lua.h"
lvm.c:#include "ldebug.h"
lvm.c:#include "ldo.h"
lvm.c:#include "lfunc.h"
lvm.c:#include "lgc.h"
lvm.c:#include "lobject.h"
lvm.c:#include "lopcodes.h"
lvm.c:#include "lstate.h"
lvm.c:#include "lstring.h"
lvm.c:#include "ltable.h"
lvm.c:#include "ltm.h"
lvm.c:#include "lvm.h"
lvm.h:#include "ldo.h"
lvm.h:#include "lobject.h"
lvm.h:#include "ltm.h"
lzio.c:#include <string.h>
lzio.c:#include "lua.h"
lzio.c:#include "llimits.h"
lzio.c:#include "lmem.h"
lzio.c:#include "lstate.h"
lzio.c:#include "lzio.h"
lzio.h:#include "lua.h"
lzio.h:#include "lmem.h"
menu.c:#include <ncurses.h>
menu.c:#include <string.h>
menu.c:#include "lua.h"
menu.c:#include "lauxlib.h"
menu.c:#include "teliva.h"
tlv.c:#include <assert.h>
tlv.c:#include <ncurses.h>
tlv.c:#include <stdio.h>
tlv.c:#include <stdlib.h>
tlv.c:#include <string.h>
tlv.c:#include <strings.h>
tlv.c:#include "lua.h"
tlv.c:#include "lauxlib.h"
lcurses/_helpers.c:#include <errno.h>
lcurses/_helpers.c:#include <grp.h>
lcurses/_helpers.c:#include <pwd.h>
lcurses/_helpers.c:#include <stdlib.h>
lcurses/_helpers.c:#include <string.h>
lcurses/_helpers.c:#include <sys/stat.h>
lcurses/_helpers.c:#include <unistd.h>
lcurses/_helpers.c:#include <ncurses.h>
lcurses/_helpers.c:#include <term.h>
lcurses/_helpers.c:#include "../lua.h"
lcurses/_helpers.c:#include "../lualib.h"
lcurses/_helpers.c:#include "../lauxlib.h"
lcurses/chstr.c:#include "_helpers.c"
lcurses/compat-5.2.c:#include <errno.h>
lcurses/compat-5.2.c:#include <string.h>
lcurses/compat-5.2.c:#include "../lua.h"
lcurses/compat-5.2.c:#include "../lauxlib.h"
lcurses/compat-5.2.c:#include "compat-5.2.h"
lcurses/compat-5.2.c:#include <limits.h>
lcurses/compat-5.2.c:#include <math.h>
lcurses/compat-5.2.h:#include <stddef.h>
lcurses/compat-5.2.h:#include <string.h>
lcurses/compat-5.2.h:#include <stdio.h>
lcurses/compat-5.2.h:#include "../lua.h"
lcurses/compat-5.2.h:#include "../lauxlib.h"
lcurses/compat-5.2.h:#include "../lualib.h"
lcurses/compat-5.2.h:#include <limits.h>
lcurses/curses.c:#include "_helpers.c"
lcurses/curses.c:#include "strlcpy.c"
lcurses/curses.c:#include "chstr.c"
lcurses/curses.c:#include "window.c"
lcurses/strlcpy.c:#include <sys/types.h>
lcurses/strlcpy.c:#include <string.h>
lcurses/window.c:#include "../teliva.h"
lcurses/window.c:#include "_helpers.c"
lcurses/window.c:#include "chstr.c"
luasec/compat.h:#include <openssl/ssl.h>
luasec/config.c:#include "compat.h"
luasec/config.c:#include "options.h"
luasec/config.c:#include "ec.h"
luasec/context.c:#include <string.h>
luasec/context.c:#include <windows.h>
luasec/context.c:#include <openssl/ssl.h>
luasec/context.c:#include <openssl/err.h>
luasec/context.c:#include <openssl/x509.h>
luasec/context.c:#include <openssl/x509v3.h>
luasec/context.c:#include <openssl/dh.h>
luasec/context.c:#include "../lua.h"
luasec/context.c:#include "../lauxlib.h"
luasec/context.c:#include "compat.h"
luasec/context.c:#include "context.h"
luasec/context.c:#include "options.h"
luasec/context.c:#include <openssl/ec.h>
luasec/context.c:#include "ec.h"
luasec/context.h:#include "../lua.h"
luasec/context.h:#include <openssl/ssl.h>
luasec/context.h:#include "compat.h"
luasec/ec.c:#include <openssl/objects.h>
luasec/ec.c:#include "ec.h"
luasec/ec.h:#include "../lua.h"
luasec/ec.h:#include <openssl/ec.h>
luasec/options.c:#include <openssl/ssl.h>
luasec/options.c:#include "options.h"
luasec/options.h:#include "compat.h"
luasec/options.lua:#include <openssl/ssl.h>
luasec/options.lua:#include "options.h"
luasec/ssl.c:#include <errno.h>
luasec/ssl.c:#include <string.h>
luasec/ssl.c:#include <winsock2.h>
luasec/ssl.c:#include <openssl/ssl.h>
luasec/ssl.c:#include <openssl/x509v3.h>
luasec/ssl.c:#include <openssl/x509_vfy.h>
luasec/ssl.c:#include <openssl/err.h>
luasec/ssl.c:#include <openssl/dh.h>
luasec/ssl.c:#include "../lua.h"
luasec/ssl.c:#include "../lauxlib.h"
luasec/ssl.c:#include "../luasocket/io.h"
luasec/ssl.c:#include "../luasocket/buffer.h"
luasec/ssl.c:#include "../luasocket/timeout.h"
luasec/ssl.c:#include "../luasocket/socket.h"
luasec/ssl.c:#include "x509.h"
luasec/ssl.c:#include "context.h"
luasec/ssl.c:#include "ssl.h"
luasec/ssl.h:#include <openssl/ssl.h>
luasec/ssl.h:#include "../lua.h"
luasec/ssl.h:#include "../luasocket/io.h"
luasec/ssl.h:#include "../luasocket/buffer.h"
luasec/ssl.h:#include "../luasocket/timeout.h"
luasec/ssl.h:#include "../luasocket/socket.h"
luasec/ssl.h:#include "compat.h"
luasec/ssl.h:#include "context.h"
luasec/x509.c:#include <stdio.h>
luasec/x509.c:#include <string.h>
luasec/x509.c:#include <ws2tcpip.h>
luasec/x509.c:#include <windows.h>
luasec/x509.c:#include <sys/types.h>
luasec/x509.c:#include <sys/socket.h>
luasec/x509.c:#include <netinet/in.h>
luasec/x509.c:#include <arpa/inet.h>
luasec/x509.c:#include <openssl/ssl.h>
luasec/x509.c:#include <openssl/x509v3.h>
luasec/x509.c:#include <openssl/evp.h>
luasec/x509.c:#include <openssl/err.h>
luasec/x509.c:#include <openssl/asn1.h>
luasec/x509.c:#include <openssl/bio.h>
luasec/x509.c:#include <openssl/bn.h>
luasec/x509.c:#include "../lua.h"
luasec/x509.c:#include "../lauxlib.h"
luasec/x509.c:#include "x509.h"
luasec/x509.h:#include <openssl/x509v3.h>
luasec/x509.h:#include "../lua.h"
luasec/x509.h:#include "compat.h"
luasocket/auxiliar.c:#include "luasocket.h"
luasocket/auxiliar.c:#include "auxiliar.h"
luasocket/auxiliar.c:#include <string.h>
luasocket/auxiliar.c:#include <stdio.h>
luasocket/auxiliar.h:#include "luasocket.h"
luasocket/buffer.c:#include "luasocket.h"
luasocket/buffer.c:#include "buffer.h"
luasocket/buffer.h:#include "luasocket.h"
luasocket/buffer.h:#include "io.h"
luasocket/buffer.h:#include "timeout.h"
luasocket/compat.c:#include "luasocket.h"
luasocket/compat.c:#include "compat.h"
luasocket/except.c:#include "luasocket.h"
luasocket/except.c:#include "except.h"
luasocket/except.c:#include <stdio.h>
luasocket/except.h:#include "luasocket.h"
luasocket/inet.c:#include "luasocket.h"
luasocket/inet.c:#include "inet.h"
luasocket/inet.c:#include <stdio.h>
luasocket/inet.c:#include <stdlib.h>
luasocket/inet.c:#include <string.h>
luasocket/inet.h:#include "luasocket.h"
luasocket/inet.h:#include "socket.h"
luasocket/inet.h:#include "timeout.h"
luasocket/io.c:#include "luasocket.h"
luasocket/io.c:#include "io.h"
luasocket/io.h:#include "luasocket.h"
luasocket/io.h:#include "timeout.h"
luasocket/luasocket.c:#include "luasocket.h"
luasocket/luasocket.c:#include "auxiliar.h"
luasocket/luasocket.c:#include "except.h"
luasocket/luasocket.c:#include "timeout.h"
luasocket/luasocket.c:#include "buffer.h"
luasocket/luasocket.c:#include "inet.h"
luasocket/luasocket.c:#include "tcp.h"
luasocket/luasocket.c:#include "udp.h"
luasocket/luasocket.c:#include "select.h"
luasocket/luasocket.h:#include "../lua.h"
luasocket/luasocket.h:#include "../lauxlib.h"
luasocket/luasocket.h:#include "compat.h"
luasocket/mime.c:#include "luasocket.h"
luasocket/mime.c:#include "mime.h"
luasocket/mime.c:#include <string.h>
luasocket/mime.c:#include <ctype.h>
luasocket/mime.h:#include "luasocket.h"
luasocket/options.c:#include "luasocket.h"
luasocket/options.c:#include "auxiliar.h"
luasocket/options.c:#include "options.h"
luasocket/options.c:#include "inet.h"
luasocket/options.c:#include <string.h>
luasocket/options.h:#include "luasocket.h"
luasocket/options.h:#include "socket.h"
luasocket/select.c:#include "luasocket.h"
luasocket/select.c:#include "socket.h"
luasocket/select.c:#include "timeout.h"
luasocket/select.c:#include "select.h"
luasocket/select.c:#include <string.h>
luasocket/serial.c:#include "luasocket.h"
luasocket/serial.c:#include "auxiliar.h"
luasocket/serial.c:#include "socket.h"
luasocket/serial.c:#include "options.h"
luasocket/serial.c:#include "unix.h"
luasocket/serial.c:#include <string.h>
luasocket/serial.c:#include <sys/un.h>
luasocket/socket.h:#include "io.h"
luasocket/socket.h:#include "wsocket.h"
luasocket/socket.h:#include "usocket.h"
luasocket/socket.h:#include "timeout.h"
luasocket/tcp.c:#include "luasocket.h"
luasocket/tcp.c:#include "auxiliar.h"
luasocket/tcp.c:#include "socket.h"
luasocket/tcp.c:#include "inet.h"
luasocket/tcp.c:#include "options.h"
luasocket/tcp.c:#include "tcp.h"
luasocket/tcp.c:#include <string.h>
luasocket/tcp.h:#include "luasocket.h"
luasocket/tcp.h:#include "buffer.h"
luasocket/tcp.h:#include "timeout.h"
luasocket/tcp.h:#include "socket.h"
luasocket/timeout.c:#include "luasocket.h"
luasocket/timeout.c:#include "auxiliar.h"
luasocket/timeout.c:#include "timeout.h"
luasocket/timeout.c:#include <stdio.h>
luasocket/timeout.c:#include <limits.h>
luasocket/timeout.c:#include <float.h>
luasocket/timeout.c:#include <windows.h>
luasocket/timeout.c:#include <time.h>
luasocket/timeout.c:#include <sys/time.h>
luasocket/timeout.h:#include "luasocket.h"
luasocket/udp.c:#include "luasocket.h"
luasocket/udp.c:#include "auxiliar.h"
luasocket/udp.c:#include "socket.h"
luasocket/udp.c:#include "inet.h"
luasocket/udp.c:#include "options.h"
luasocket/udp.c:#include "udp.h"
luasocket/udp.c:#include <string.h>
luasocket/udp.c:#include <stdlib.h>
luasocket/udp.h:#include "luasocket.h"
luasocket/udp.h:#include "timeout.h"
luasocket/udp.h:#include "socket.h"
luasocket/unix.c:#include "luasocket.h"
luasocket/unix.c:#include "unixstream.h"
luasocket/unix.c:#include "unixdgram.h"
luasocket/unix.h:#include "luasocket.h"
luasocket/unix.h:#include "buffer.h"
luasocket/unix.h:#include "timeout.h"
luasocket/unix.h:#include "socket.h"
luasocket/unixdgram.c:#include "luasocket.h"
luasocket/unixdgram.c:#include "auxiliar.h"
luasocket/unixdgram.c:#include "socket.h"
luasocket/unixdgram.c:#include "options.h"
luasocket/unixdgram.c:#include "unix.h"
luasocket/unixdgram.c:#include <string.h>
luasocket/unixdgram.c:#include <stdlib.h>
luasocket/unixdgram.c:#include <sys/un.h>
luasocket/unixdgram.h:#include "unix.h"
luasocket/unixstream.c:#include "luasocket.h"
luasocket/unixstream.c:#include "auxiliar.h"
luasocket/unixstream.c:#include "socket.h"
luasocket/unixstream.c:#include "options.h"
luasocket/unixstream.c:#include "unixstream.h"
luasocket/unixstream.c:#include <string.h>
luasocket/unixstream.c:#include <sys/un.h>
luasocket/unixstream.h:#include "unix.h"
luasocket/usocket.c:#include "luasocket.h"
luasocket/usocket.c:#include "socket.h"
luasocket/usocket.c:#include "pierror.h"
luasocket/usocket.c:#include <string.h>
luasocket/usocket.c:#include <signal.h>
luasocket/usocket.c:#include <sys/poll.h>
luasocket/usocket.h:#include <errno.h>
luasocket/usocket.h:#include <unistd.h>
luasocket/usocket.h:#include <fcntl.h>
luasocket/usocket.h:#include <sys/types.h>
luasocket/usocket.h:#include <sys/socket.h>
luasocket/usocket.h:#include <sys/time.h>
luasocket/usocket.h:#include <netdb.h>
luasocket/usocket.h:#include <signal.h>
luasocket/usocket.h:#include <netinet/in.h>
luasocket/usocket.h:#include <arpa/inet.h>
luasocket/usocket.h:#include <netinet/tcp.h>
luasocket/usocket.h:#include <net/if.h>
luasocket/usocket.h:#include <sys/poll.h>
luasocket/wsocket.c:#include "luasocket.h"
luasocket/wsocket.c:#include <string.h>
luasocket/wsocket.c:#include "socket.h"
luasocket/wsocket.c:#include "pierror.h"
luasocket/wsocket.h:#include <winsock2.h>
luasocket/wsocket.h:#include <ws2tcpip.h>
500'>1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458
# A table is a stream of (key, value) rows.
#
# Each row consists of an 8-byte key -- a (handle array byte) -- and a variable-size value.
#
# Accessing the table performs a linear scan for a key string, and always
# requires passing in the row size.
#
# Table primitives have the form <variant>(stream, <arg>, row-size, ...) -> address/eax
#
# The following table shows available options for <variant>:
#   if not found:           | arg=string              arg=slice
#   ------------------------+---------------------------------------------------
#   abort                   | get                     get-slice
#   insert key              | get-or-insert           get-or-insert-slice
#                           | get-or-insert-handle
#   stop                    | get-or-stop             get-slice-or-stop
#   return null             | maybe-get               maybe-get-slice
# Some variants may take extra args.

== code
#   instruction                     effective address                                                   register    displacement    immediate
# . op          subop               mod             rm32          base        index         scale       r32
# . 1-3 bytes   3 bits              2 bits          3 bits        3 bits      3 bits        2 bits      2 bits      0/1/2/4 bytes   0/1/2/4 bytes

# if no row is found, abort
get:  # table: (addr stream {(handle array byte), T}), key: (addr array byte), row-size: int, abort-message-prefix: (addr array byte) -> result/eax: (addr T)
    # pseudocode:
    #   curr = table->data
    #   max = &table->data[table->write]
    #   while curr < max
    #     var c: (addr array byte) = lookup(*curr)
    #     if string-equal?(key, c)
    #       return curr+8
    #     curr += row-size
    #   abort
    #
    # . prologue
    55/push-ebp
    89/copy                         3/mod/direct    5/rm32/ebp    .           .             .           4/r32/esp   .               .                 # copy esp to ebp
    # . save registers
    51/push-ecx
    52/push-edx
    56/push-esi
    # esi = table
    8b/copy                         1/mod/*+disp8   5/rm32/ebp    .           .             .           6/r32/esi   8/disp8         .                 # copy *(ebp+8) to esi
    # var curr/ecx: (addr handle array byte) = table->data
    8d/copy-address                 1/mod/*+disp8   6/rm32/esi    .           .             .           1/r32/ecx   0xc/disp8       .                 # copy esi+12 to ecx
    # var max/edx: (addr byte) = &table->data[table->write]
    8b/copy                         0/mod/indirect  6/rm32/esi    .           .             .           2/r32/edx   .               .                 # copy *esi to edx
    8d/copy-address                 0/mod/indirect  4/rm32/sib    1/base/ecx  2/index/edx   .           2/r32/edx   .               .                 # copy ecx+edx to edx
$get:search-loop:
    # if (curr >= max) abort
    39/compare                      3/mod/direct    1/rm32/ecx    .           .             .           2/r32/edx   .               .                 # compare ecx with edx
    73/jump-if-addr>=  $get:abort/disp8
    # var c/eax: (addr array byte) = lookup(*curr)
    # . . push args
    ff          6/subop/push        1/mod/*+disp8   1/rm32/ecx    .           .             .           .           4/disp8         .                 # push *(ecx+4)
    ff          6/subop/push        0/mod/indirect  1/rm32/ecx    .           .             .           .           .               .                 # push *ecx
    # . . call
    e8/call  lookup/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # if (string-equal?(key, c)) return curr+8
    # . eax = string-equal?(key, c)
    # . . push args
    50/push-eax
    ff          6/subop/push        1/mod/*+disp8   5/rm32/ebp    .           .             .           .           0xc/disp8       .                 # push *(ebp+12)
    # . . call
    e8/call  string-equal?/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # . if (eax != false) return eax = curr+8
    3d/compare-eax-and  0/imm32/false
    74/jump-if-=  $get:mismatch/disp8
    8d/copy-address                 1/mod/*+disp8   1/rm32/ecx    .           .             .           0/r32/eax   8/disp8         .                 # copy ecx+8 to eax
    eb/jump  $get:end/disp8
$get:mismatch:
    # curr += row-size
    03/add                          1/mod/*+disp8   5/rm32/ebp    .           .             .           1/r32/ecx   0x10/disp8      .                 # add *(ebp+16) to ecx
    # loop
    eb/jump  $get:search-loop/disp8
$get:end:
    # . restore registers
    5e/pop-to-esi
    5a/pop-to-edx
    59/pop-to-ecx
    # . epilogue
    89/copy                         3/mod/direct    4/rm32/esp    .           .             .           5/r32/ebp   .               .                 # copy ebp to esp
    5d/pop-to-ebp
    c3/return

$get:abort:
    # . _write(2/stderr, abort-message-prefix)
    # . . push args
    ff          6/subop/push        1/mod/*+disp8   5/rm32/ebp    .           .             .           .           0x14/disp8      .                 # push *(ebp+20)
    68/push  2/imm32/stderr
    # . . call
    e8/call  _write/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # . _write(2/stderr, error)
    # . . push args
    68/push  ": get: key not found: "/imm32
    68/push  2/imm32/stderr
    # . . call
    e8/call  _write/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # . _write(2/stderr, key)
    # . . push args
    ff          6/subop/push        1/mod/*+disp8   5/rm32/ebp    .           .             .           .           0xc/disp8       .                 # push *(ebp+12)
    68/push  2/imm32/stderr
    # . . call
    e8/call  _write/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # . _write(2/stderr, "\n")
    # . . push args
    68/push  Newline/imm32
    68/push  2/imm32/stderr
    # . . call
    e8/call  _write/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # . syscall_exit(1)
    bb/copy-to-ebx  1/imm32
    e8/call  syscall_exit/disp32
    # never gets here

test-get:
    # . prologue
    55/push-ebp
    89/copy                         3/mod/direct    5/rm32/ebp    .           .             .           4/r32/esp   .               .                 # copy esp to ebp
    # - setup: create a table with a couple of keys
    # var table/ecx: (stream {(handle array byte), number} 24)  # 2 rows * 12 bytes/row
    81          5/subop/subtract    3/mod/direct    4/rm32/esp    .           .             .           .           .               0x18/imm32        # subtract from esp
    68/push  0x18/imm32/size
    68/push  0/imm32/read
    68/push  0/imm32/write
    89/copy                         3/mod/direct    1/rm32/ecx    .           .             .           4/r32/esp   .               .                 # copy esp to ecx
    # insert(table, "code", 12 bytes/row, Heap)
    # . . push args
    68/push  Heap/imm32
    68/push  0xc/imm32/row-size
    68/push  "code"/imm32
    51/push-ecx
    # . . call
    e8/call  get-or-insert/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0x10/imm32        # add to esp
    # insert(table, "data", 12 bytes/row, Heap)
    # . . push args
    68/push  Heap/imm32
    68/push  0xc/imm32/row-size
    68/push  "data"/imm32
    51/push-ecx
    # . . call
    e8/call  get-or-insert/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0x10/imm32        # add to esp
$test-get:check1:
    # eax = get(table, "code", 12 bytes/row)
    # . . push args
    68/push  0xc/imm32/row-size
    68/push  "code"/imm32
    51/push-ecx
    # . . call
    e8/call  get/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
    # check-ints-equal(eax - table->data, 8, msg)
    # . check-ints-equal(eax - table, 20, msg)
    # . . push args
    68/push  "F - test-get/0"/imm32
    68/push  0x14/imm32
    29/subtract                     3/mod/direct    0/rm32/eax    .           .             .           1/r32/ecx   .               .                 # subtract ecx from eax
    50/push-eax
    # . . call
    e8/call  check-ints-equal/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
$test-get:check2:
    # eax = get(table, "data", 12 bytes/row)
    # . . push args
    68/push  0xc/imm32/row-size
    68/push  "data"/imm32
    51/push-ecx
    # . . call
    e8/call  get/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
    # check-ints-equal(eax - table->data, 20, msg)
    # . check-ints-equal(eax - table, 32, msg)
    # . . push args
    68/push  "F - test-get/1"/imm32
    68/push  0x20/imm32
    29/subtract                     3/mod/direct    0/rm32/eax    .           .             .           1/r32/ecx   .               .                 # subtract ecx from eax
    50/push-eax
    # . . call
    e8/call  check-ints-equal/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
$test-get:end:
    # . epilogue
    89/copy                         3/mod/direct    4/rm32/esp    .           .             .           5/r32/ebp   .               .                 # copy ebp to esp
    5d/pop-to-ebp
    c3/return

# if no row is found, abort
get-slice:  # table: (addr stream {(handle array byte), T}), key: (addr slice), row-size: int, abort-message-prefix: (addr array byte) -> result/eax: (addr T)
    # pseudocode:
    #   curr = table->data
    #   max = &table->data[table->write]
    #   while curr < max
    #     var c: (addr array byte) = lookup(*curr)
    #     if slice-equal?(key, c)
    #       return curr+8
    #     curr += row-size
    #   abort
    #
    # . prologue
    55/push-ebp
    89/copy                         3/mod/direct    5/rm32/ebp    .           .             .           4/r32/esp   .               .                 # copy esp to ebp
    # . save registers
    51/push-ecx
    52/push-edx
    56/push-esi
    # esi = table
    8b/copy                         1/mod/*+disp8   5/rm32/ebp    .           .             .           6/r32/esi   8/disp8         .                 # copy *(ebp+8) to esi
    # var curr/ecx: (addr handle array byte) = table->data
    8d/copy-address                 1/mod/*+disp8   6/rm32/esi    .           .             .           1/r32/ecx   0xc/disp8       .                 # copy esi+12 to ecx
    # var max/edx: (addr byte) = &table->data[table->write]
    8b/copy                         0/mod/indirect  6/rm32/esi    .           .             .           2/r32/edx   .               .                 # copy *esi to edx
    8d/copy-address                 0/mod/indirect  4/rm32/sib    1/base/ecx  2/index/edx   .           2/r32/edx   .               .                 # copy ecx+edx to edx
$get-slice:search-loop:
    # if (curr >= max) abort
    39/compare                      3/mod/direct    1/rm32/ecx    .           .             .           2/r32/edx   .               .                 # compare ecx with edx
    73/jump-if-addr>=  $get-slice:abort/disp8
    # var c/eax: (addr array byte) = lookup(*curr)
    # . . push args
    ff          6/subop/push        1/mod/*+disp8   1/rm32/ecx    .           .             .           .           4/disp8         .                 # push *(ecx+4)
    ff          6/subop/push        0/mod/indirect  1/rm32/ecx    .           .             .           .           .               .                 # push *ecx
    # . . call
    e8/call  lookup/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # if (slice-equal?(key, c)) return curr+8
    # . eax = slice-equal?(key, c)
    # . . push args
    50/push-eax
    ff          6/subop/push        1/mod/*+disp8   5/rm32/ebp    .           .             .           .           0xc/disp8       .                 # push *(ebp+12)
    # . . call
    e8/call  slice-equal?/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # . if (eax != false) return eax = curr+8
    3d/compare-eax-and  0/imm32/false
    74/jump-if-=  $get-slice:mismatch/disp8
    8d/copy-address                 1/mod/*+disp8   1/rm32/ecx    .           .             .           0/r32/eax   8/disp8         .                 # copy ecx+8 to eax
    eb/jump  $get-slice:end/disp8
$get-slice:mismatch:
    # curr += row-size
    03/add                          1/mod/*+disp8   5/rm32/ebp    .           .             .           1/r32/ecx   0x10/disp8      .                 # add *(ebp+16) to ecx
    # loop
    eb/jump  $get-slice:search-loop/disp8
$get-slice:end:
    # . restore registers
    5e/pop-to-esi
    5a/pop-to-edx
    59/pop-to-ecx
    # . epilogue
    89/copy                         3/mod/direct    4/rm32/esp    .           .             .           5/r32/ebp   .               .                 # copy ebp to esp
    5d/pop-to-ebp
    c3/return

$get-slice:abort:
    # . _write(2/stderr, abort-message-prefix)
    # . . push args
    ff          6/subop/push        1/mod/*+disp8   5/rm32/ebp    .           .             .           .           0x14/disp8      .                 # push *(ebp+20)
    68/push  2/imm32/stderr
    # . . call
    e8/call  _write/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # . _write(2/stderr, error)
    # . . push args
    68/push  ": get-slice: key not found: "/imm32
    68/push  2/imm32/stderr
    # . . call
    e8/call  _write/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # . write-slice-buffered(Stderr, key)
    # . . push args
    ff          6/subop/push        1/mod/*+disp8   5/rm32/ebp    .           .             .           .           0xc/disp8       .                 # push *(ebp+12)
    68/push  Stderr/imm32
    # . . call
    e8/call  write-slice-buffered/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # . flush(Stderr)
    # . . push args
    68/push  Stderr/imm32
    # . . call
    e8/call  flush/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               4/imm32           # add to esp
    # . _write(2/stderr, "\n")
    # . . push args
    68/push  Newline/imm32
    68/push  2/imm32/stderr
    # . . call
    e8/call  _write/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # . syscall_exit(1)
    bb/copy-to-ebx  1/imm32
    e8/call  syscall_exit/disp32
    # never gets here

test-get-slice:
    # . prologue
    55/push-ebp
    89/copy                         3/mod/direct    5/rm32/ebp    .           .             .           4/r32/esp   .               .                 # copy esp to ebp
    # - setup: create a table with a couple of keys
    # var table/ecx: (stream {string, number} 24)  # 2 rows * 12 bytes/row
    81          5/subop/subtract    3/mod/direct    4/rm32/esp    .           .             .           .           .               0x18/imm32        # subtract from esp
    68/push  0x18/imm32/size
    68/push  0/imm32/read
    68/push  0/imm32/write
    89/copy                         3/mod/direct    1/rm32/ecx    .           .             .           4/r32/esp   .               .                 # copy esp to ecx
    # insert(table, "code", 12 bytes/row, Heap)
    # . . push args
    68/push  Heap/imm32
    68/push  0xc/imm32/row-size
    68/push  "code"/imm32
    51/push-ecx
    # . . call
    e8/call  get-or-insert/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0x10/imm32        # add to esp
    # insert(table, "data", 12 bytes/row, Heap)
    # . . push args
    68/push  Heap/imm32
    68/push  0xc/imm32/row-size
    68/push  "data"/imm32
    51/push-ecx
    # . . call
    e8/call  get-or-insert/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0x10/imm32        # add to esp
$test-get-slice:check1:
    # (eax..edx) = "code"
    b8/copy-to-eax  "code"/imm32
    8b/copy                         0/mod/indirect  0/rm32/eax    .           .             .           2/r32/edx   .               .                 # copy *eax to edx
    8d/copy-address                 1/mod/*+disp8   4/rm32/sib    0/base/eax  2/index/edx   .           2/r32/edx   4/disp8         .                 # copy eax+edx+4 to edx
    05/add-to-eax  4/imm32
    # var slice/edx: slice = {eax, edx}
    52/push-edx
    50/push-eax
    89/copy                         3/mod/direct    2/rm32/edx    .           .             .           4/r32/esp   .               .                 # copy esp to edx
    # eax = get-slice(table, "code", 12 bytes/row)
    # . . push args
    68/push  0xc/imm32/row-size
    52/push-edx
    51/push-ecx
    # . . call
    e8/call  get-slice/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
    # check-ints-equal(eax - table->data, 8, msg)  # first row's value slot returned
    # . check-ints-equal(eax - table, 20, msg)
    # . . push args
    68/push  "F - test-get-slice/0"/imm32
    68/push  0x14/imm32
    29/subtract                     3/mod/direct    0/rm32/eax    .           .             .           1/r32/ecx   .               .                 # subtract ecx from eax
    50/push-eax
    # . . call
    e8/call  check-ints-equal/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
$test-get-slice:check2:
    # (eax..edx) = "data"
    b8/copy-to-eax  "data"/imm32
    8b/copy                         0/mod/indirect  0/rm32/eax    .           .             .           2/r32/edx   .               .                 # copy *eax to edx
    8d/copy-address                 1/mod/*+disp8   4/rm32/sib    0/base/eax  2/index/edx   .           2/r32/edx   4/disp8         .                 # copy eax+edx+4 to edx
    05/add-to-eax  4/imm32
    # var slice/edx: slice = {eax, edx}
    52/push-edx
    50/push-eax
    89/copy                         3/mod/direct    2/rm32/edx    .           .             .           4/r32/esp   .               .                 # copy esp to edx
    # eax = get-slice(table, "data" slice, 12 bytes/row)
    # . . push args
    68/push  0xc/imm32/row-size
    52/push-edx
    51/push-ecx
    # . . call
    e8/call  get-slice/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
    # check-ints-equal(eax - table->data, 20, msg)
    # . check-ints-equal(eax - table, 32, msg)
    # . . push args
    68/push  "F - test-get-slice/1"/imm32
    68/push  0x20/imm32
    29/subtract                     3/mod/direct    0/rm32/eax    .           .             .           1/r32/ecx   .               .                 # subtract ecx from eax
    50/push-eax
    # . . call
    e8/call  check-ints-equal/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
$test-get-slice:end:
    # . epilogue
    89/copy                         3/mod/direct    4/rm32/esp    .           .             .           5/r32/ebp   .               .                 # copy ebp to esp
    5d/pop-to-ebp
    c3/return

# if no row is found, save 'key' to the next available row
# if there are no rows free, abort
# return the address of the value
get-or-insert:  # table: (addr stream {(handle array byte), T}), key: (addr array byte), row-size: int, ad: (addr allocation-descriptor) -> result/eax: (addr T)
    # pseudocode:
    #   curr = table->data
    #   max = &table->data[table->write]
    #   while curr < max
    #     var c: (addr array byte) = lookup(*curr)
    #     if string-equal?(key, c)
    #       return curr+8
    #     curr += row-size
    #   if table->write >= table->size
    #     abort
    #   zero-out(max, row-size)
    #   copy-array(ad, key, max)
    #   table->write += row-size
    #   return max+8
    #
    # . prologue
    55/push-ebp
    89/copy                         3/mod/direct    5/rm32/ebp    .           .             .           4/r32/esp   .               .                 # copy esp to ebp
    # . save registers
    51/push-ecx
    52/push-edx
    56/push-esi
    # esi = table
    8b/copy                         1/mod/*+disp8   5/rm32/ebp    .           .             .           6/r32/esi   8/disp8         .                 # copy *(ebp+8) to esi
    # var curr/ecx: (addr handle array byte) = table->data
    8d/copy-address                 1/mod/*+disp8   6/rm32/esi    .           .             .           1/r32/ecx   0xc/disp8       .                 # copy esi+12 to ecx
    # var max/edx: (addr byte) = &table->data[table->write]
    8b/copy                         0/mod/indirect  6/rm32/esi    .           .             .           2/r32/edx   .               .                 # copy *esi to edx
    8d/copy-address                 0/mod/indirect  4/rm32/sib    1/base/ecx  2/index/edx   .           2/r32/edx   .               .                 # copy ecx+edx to edx
$get-or-insert:search-loop:
    # if (curr >= max) break
    39/compare                      3/mod/direct    1/rm32/ecx    .           .             .           2/r32/edx   .               .                 # compare ecx with edx
    73/jump-if-addr>=  $get-or-insert:not-found/disp8
    # var c/eax: (addr array byte) = lookup(*curr)
    # . . push args
    ff          6/subop/push        1/mod/*+disp8   1/rm32/ecx    .           .             .           .           4/disp8         .                 # push *(ecx+4)
    ff          6/subop/push        0/mod/indirect  1/rm32/ecx    .           .             .           .           .               .                 # push *ecx
    # . . call
    e8/call  lookup/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # if (string-equal?(key, c)) return curr+8
    # . eax = string-equal?(key, c)
    # . . push args
    50/push-eax
    ff          6/subop/push        1/mod/*+disp8   5/rm32/ebp    .           .             .           .           0xc/disp8       .                 # push *(ebp+12)
    # . . call
    e8/call  string-equal?/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # . if (eax != false) return eax = curr+8
    3d/compare-eax-and  0/imm32/false
    74/jump-if-=  $get-or-insert:mismatch/disp8
    8d/copy-address                 1/mod/*+disp8   1/rm32/ecx    .           .             .           0/r32/eax   8/disp8         .                 # copy ecx+8 to eax
    eb/jump  $get-or-insert:end/disp8
$get-or-insert:mismatch:
    # curr += row-size
    03/add                          1/mod/*+disp8   5/rm32/ebp    .           .             .           1/r32/ecx   0x10/disp8      .                 # add *(ebp+16) to ecx
    # loop
    eb/jump  $get-or-insert:search-loop/disp8
$get-or-insert:not-found:
    # if (table->write >= table->size) abort
    8b/copy                         0/mod/indirect  6/rm32/esi    .           .             .           1/r32/ecx   .               .                 # copy *esi to ecx
    3b/compare                      1/mod/*+disp8   6/rm32/esi    .           .             .           1/r32/ecx   8/disp8         .                 # compare ecx with *(esi+8)
    73/jump-if-addr>=  $get-or-insert:abort/disp8
    # zero-out(max, row-size)
    # . . push args
    ff          6/subop/push        1/mod/*+disp8   5/rm32/ebp    .           .             .           .           0x10/disp8      .                 # push *(ebp+16)
    52/push-edx
    # . . call
    e8/call  zero-out/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # copy-array(ad, key, max)
    # . . push args
    52/push-edx
    ff          6/subop/push        1/mod/*+disp8   5/rm32/ebp    .           .             .           .           0xc/disp8       .                 # push *(ebp+12)
    ff          6/subop/push        1/mod/*+disp8   5/rm32/ebp    .           .             .           .           0x14/disp8      .                 # push *(ebp+20)
    # . . call
    e8/call  copy-array/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
    # table->write += row-size
    # . eax = row-size
    8b/copy                         1/mod/*+disp8   5/rm32/ebp    .           .             .           0/r32/eax   0x10/disp8      .                 # copy *(ebp+16) to eax
    # . table->write += eax
    01/add                          0/mod/indirect  6/rm32/esi    .           .             .           0/r32/eax   .               .                 # add eax to *esi
    # return max+8
    # . eax = max
    89/copy                         3/mod/direct    0/rm32/eax    .           .             .           2/r32/edx   .               .                 # copy edx to eax
    # . eax += 8
    05/add-to-eax  8/imm32
$get-or-insert:end:
    # . restore registers
    5e/pop-to-esi
    5a/pop-to-edx
    59/pop-to-ecx
    # . epilogue
    89/copy                         3/mod/direct    4/rm32/esp    .           .             .           5/r32/ebp   .               .                 # copy ebp to esp
    5d/pop-to-ebp
    c3/return

$get-or-insert:abort:
    # . _write(2/stderr, error)
    # . . push args
    68/push  "get-or-insert: table is full\n"/imm32
    68/push  2/imm32/stderr
    # . . call
    e8/call  _write/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # . syscall_exit(1)
    bb/copy-to-ebx  1/imm32
    e8/call  syscall_exit/disp32
    # never gets here

test-get-or-insert:
    # . prologue
    55/push-ebp
    89/copy                         3/mod/direct    5/rm32/ebp    .           .             .           4/r32/esp   .               .                 # copy esp to ebp
    # var table/ecx: (stream {(handle array byte), number} 24)  # 2 rows * 12 bytes/row
    81          5/subop/subtract    3/mod/direct    4/rm32/esp    .           .             .           .           .               0x18/imm32        # subtract from esp
    68/push  0x18/imm32/size
    68/push  0/imm32/read
    68/push  0/imm32/write
    89/copy                         3/mod/direct    1/rm32/ecx    .           .             .           4/r32/esp   .               .                 # copy esp to ecx
$test-get-or-insert:first-call:
    # - start with an empty table, insert one key, verify that it was inserted
    # eax = get-or-insert(table, "code", 12 bytes/row, Heap)
    # . . push args
    68/push  Heap/imm32
    68/push  0xc/imm32/row-size
    68/push  "code"/imm32
    51/push-ecx
    # . . call
    e8/call  get-or-insert/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0x10/imm32        # add to esp
    # check-ints-equal(eax - table->data, 8, msg)  # first row's value slot returned
    # . check-ints-equal(eax - table, 20, msg)
    # . . push args
    68/push  "F - test-get-or-insert/0"/imm32
    68/push  0x14/imm32
    29/subtract                     3/mod/direct    0/rm32/eax    .           .             .           1/r32/ecx   .               .                 # subtract ecx from eax
    50/push-eax
    # . . call
    e8/call  check-ints-equal/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
    # check-ints-equal(table->write, row-size = 12, msg)
    # . . push args
    68/push  "F - test-get-or-insert/1"/imm32
    68/push  0xc/imm32/row-size
    ff          6/subop/push        0/mod/indirect  1/rm32/ecx    .           .             .           .           .               .                 # push *ecx
    # . . call
    e8/call  check-ints-equal/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
    # var curr-addr/eax: (addr array byte) = lookup(table->data)
    # . . push args
    ff          6/subop/push        1/mod/*+disp8   1/rm32/ecx    .           .             .           .           0x10/disp8      .                 # push *(ecx+16)
    ff          6/subop/push        1/mod/*+disp8   1/rm32/ecx    .           .             .           .           0xc/disp8       .                 # push *(ecx+12)
    # . . call
    e8/call  lookup/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # check-strings-equal(curr-addr, "code", msg)
    # . . push args
    68/push  "F - test-get-or-insert/2"/imm32
    68/push  "code"/imm32
    50/push-eax
    # . . call
    e8/call  check-strings-equal/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
$test-get-or-insert:second-call:
    # - insert the same key again, verify that it was reused
    # eax = get-or-insert(table, "code", 12 bytes/row, Heap)
    # . . push args
    68/push  Heap/imm32
    68/push  0xc/imm32/row-size
    68/push  "code"/imm32
    51/push-ecx
    # . . call
    e8/call  get-or-insert/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0x10/imm32        # add to esp
    # check-ints-equal(eax - table->data, 8, msg)
    # . check-ints-equal(eax - table, 20, msg)
    # . . push args
    68/push  "F - test-get-or-insert/3"/imm32
    68/push  0x14/imm32
    29/subtract                     3/mod/direct    0/rm32/eax    .           .             .           1/r32/ecx   .               .                 # subtract ecx from eax
    50/push-eax
    # . . call
    e8/call  check-ints-equal/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
    # no new row inserted
    # . check-ints-equal(table->write, row-size = 12, msg)
    # . . push args
    68/push  "F - test-get-or-insert/4"/imm32
    68/push  0xc/imm32/row-size
    ff          6/subop/push        0/mod/indirect  1/rm32/ecx    .           .             .           .           .               .                 # push *ecx
    # . . call
    e8/call  check-ints-equal/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
    # curr-addr = lookup(table->data)
    # . . push args
    ff          6/subop/push        1/mod/*+disp8   1/rm32/ecx    .           .             .           .           0x10/disp8      .                 # push *(ecx+16)
    ff          6/subop/push        1/mod/*+disp8   1/rm32/ecx    .           .             .           .           0xc/disp8       .                 # push *(ecx+12)
    # . . call
    e8/call  lookup/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # check-strings-equal(curr-addr, "code", msg)
    # . . push args
    68/push  "F - test-get-or-insert/5"/imm32
    68/push  "code"/imm32
    50/push-eax
    # . . call
    e8/call  check-strings-equal/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
$test-get-or-insert:third-call:
    # - insert a new key, verify that it was inserted
    # eax = get-or-insert(table, "data", 12 bytes/row, Heap)
    # . . push args
    68/push  Heap/imm32
    68/push  0xc/imm32/row-size
    68/push  "data"/imm32
    51/push-ecx
    # . . call
    e8/call  get-or-insert/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0x10/imm32        # add to esp
    # table gets a new row
    # check-ints-equal(eax - table->data, 20, msg)  # second row's value slot returned
    # . check-ints-equal(eax - table, 32, msg)
    # . . push args
    68/push  "F - test-get-or-insert/6"/imm32
    68/push  0x20/imm32
    29/subtract                     3/mod/direct    0/rm32/eax    .           .             .           1/r32/ecx   .               .                 # subtract ecx from eax
    50/push-eax
    # . . call
    e8/call  check-ints-equal/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
    # check-ints-equal(table->write, 2 rows = 24, msg)
    # . . push args
    68/push  "F - test-get-or-insert/7"/imm32
    68/push  0x18/imm32/two-rows
    ff          6/subop/push        0/mod/indirect  1/rm32/ecx    .           .             .           .           .               .                 # push *ecx
    # . . call
    e8/call  check-ints-equal/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
    # curr-addr = lookup(table->data+12)
    # . . push args
    ff          6/subop/push        1/mod/*+disp8   1/rm32/ecx    .           .             .           .           0x1c/disp8      .                 # push *(ecx+28)
    ff          6/subop/push        1/mod/*+disp8   1/rm32/ecx    .           .             .           .           0x18/disp8      .                 # push *(ecx+24)
    # . . call
    e8/call  lookup/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # check-strings-equal(curr-addr, "data", msg)
    # . . push args
    68/push  "F - test-get-or-insert/8"/imm32
    68/push  "data"/imm32
    50/push-eax
    # . . call
    e8/call  check-strings-equal/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
$test-get-or-insert:end:
    # . epilogue
    89/copy                         3/mod/direct    4/rm32/esp    .           .             .           5/r32/ebp   .               .                 # copy ebp to esp
    5d/pop-to-ebp
    c3/return

# save 'key' to the next available row
# if key already exists, abort
# if there are no rows free, abort
# return the address of the value
insert-or-abort:  # table: (addr stream {(handle array byte), T}), key: (addr array byte), row-size: int, ad: (addr allocation-descriptor) -> result/eax: (addr T)
    # pseudocode:
    #   curr = table->data
    #   max = &table->data[table->write]
    #   while curr < max
    #     var c: (addr array byte) = lookup(*curr)
    #     if string-equal?(key, c)
    #       abort
    #     curr += row-size
    #   if table->write >= table->size
    #     abort
    #   zero-out(max, row-size)
    #   copy-array(ad, key, max)
    #   table->write += row-size
    #   return max+8
    #
    # . prologue
    55/push-ebp
    89/copy                         3/mod/direct    5/rm32/ebp    .           .             .           4/r32/esp   .               .                 # copy esp to ebp
    # . save registers
    51/push-ecx
    52/push-edx
    56/push-esi
    # esi = table
    8b/copy                         1/mod/*+disp8   5/rm32/ebp    .           .             .           6/r32/esi   8/disp8         .                 # copy *(ebp+8) to esi
    # var curr/ecx: (addr handle array byte) = table->data
    8d/copy-address                 1/mod/*+disp8   6/rm32/esi    .           .             .           1/r32/ecx   0xc/disp8       .                 # copy esi+12 to ecx
    # var max/edx: (addr byte) = &table->data[table->write]
    8b/copy                         0/mod/indirect  6/rm32/esi    .           .             .           2/r32/edx   .               .                 # copy *esi to edx
    8d/copy-address                 0/mod/indirect  4/rm32/sib    1/base/ecx  2/index/edx   .           2/r32/edx   .               .                 # copy ecx+edx to edx
$insert-or-abort:search-loop:
    # if (curr >= max) break
    39/compare                      3/mod/direct    1/rm32/ecx    .           .             .           2/r32/edx   .               .                 # compare ecx with edx
    73/jump-if-addr>=  $insert-or-abort:not-found/disp8
    # var c/eax: (addr array byte) = lookup(*curr)
    # . . push args
    ff          6/subop/push        1/mod/*+disp8   1/rm32/ecx    .           .             .           .           4/disp8         .                 # push *(ecx+4)
    ff          6/subop/push        0/mod/indirect  1/rm32/ecx    .           .             .           .           .               .                 # push *ecx
    # . . call
    e8/call  lookup/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # if (string-equal?(key, c)) abort
    # . eax = string-equal?(key, c)
    # . . push args
    50/push-eax
    ff          6/subop/push        1/mod/*+disp8   5/rm32/ebp    .           .             .           .           0xc/disp8       .                 # push *(ebp+12)
    # . . call
    e8/call  string-equal?/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # . if (eax != false) abort
    3d/compare-eax-and  0/imm32/false
    0f 85/jump-if-!=  $insert-or-abort:error-duplicate/disp32
    # curr += row-size
    03/add                          1/mod/*+disp8   5/rm32/ebp    .           .             .           1/r32/ecx   0x10/disp8      .                 # add *(ebp+16) to ecx
    # loop
    eb/jump  $insert-or-abort:search-loop/disp8
$insert-or-abort:not-found:
    # if (table->write >= table->size) abort
    8b/copy                         0/mod/indirect  6/rm32/esi    .           .             .           1/r32/ecx   .               .                 # copy *esi to ecx
    3b/compare                      1/mod/*+disp8   6/rm32/esi    .           .             .           1/r32/ecx   8/disp8         .                 # compare ecx with *(esi+8)
    0f 83/jump-if-addr>=  $insert-or-abort:error-full/disp32
    # zero-out(max, row-size)
    # . . push args
    ff          6/subop/push        1/mod/*+disp8   5/rm32/ebp    .           .             .           .           0x10/disp8      .                 # push *(ebp+16)
    52/push-edx
    # . . call
    e8/call  zero-out/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # copy-array(ad, key, max)
    # . . push args
    52/push-edx
    ff          6/subop/push        1/mod/*+disp8   5/rm32/ebp    .           .             .           .           0xc/disp8       .                 # push *(ebp+12)
    ff          6/subop/push        1/mod/*+disp8   5/rm32/ebp    .           .             .           .           0x14/disp8      .                 # push *(ebp+20)
    # . . call
    e8/call  copy-array/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
    # table->write += row-size
    # . eax = row-size
    8b/copy                         1/mod/*+disp8   5/rm32/ebp    .           .             .           0/r32/eax   0x10/disp8      .                 # copy *(ebp+16) to eax
    # . table->write += eax
    01/add                          0/mod/indirect  6/rm32/esi    .           .             .           0/r32/eax   .               .                 # add eax to *esi
    # return max+8
    # . eax = max
    89/copy                         3/mod/direct    0/rm32/eax    .           .             .           2/r32/edx   .               .                 # copy edx to eax
    # . eax += 8
    05/add-to-eax  8/imm32
$insert-or-abort:end:
    # . restore registers
    5e/pop-to-esi
    5a/pop-to-edx
    59/pop-to-ecx
    # . epilogue
    89/copy                         3/mod/direct    4/rm32/esp    .           .             .           5/r32/ebp   .               .                 # copy ebp to esp
    5d/pop-to-ebp
    c3/return

$insert-or-abort:error-duplicate:
    # . _write(2/stderr, error)
    # . . push args
    68/push  "insert-or-abort: key already exists: "/imm32
    68/push  2/imm32/stderr
    # . . call
    e8/call  _write/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # . _write(2/stderr, key)
    # . . push args
    ff          6/subop/push        1/mod/*+disp8   5/rm32/ebp    .           .             .           .           0xc/disp8       .                 # push *(ebp+12)
    68/push  2/imm32/stderr
    # . . call
    e8/call  _write/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # . _write(2/stderr, "\n")
    # . . push args
    68/push  "\n"/imm32
    68/push  2/imm32/stderr
    # . . call
    e8/call  _write/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # . syscall_exit(1)
    bb/copy-to-ebx  1/imm32
    e8/call  syscall_exit/disp32
    # never gets here

$insert-or-abort:error-full:
    # . _write(2/stderr, error)
    # . . push args
    68/push  "insert-or-abort: table is full\n"/imm32
    68/push  2/imm32/stderr
    # . . call
    e8/call  _write/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # . syscall_exit(1)
    bb/copy-to-ebx  1/imm32
    e8/call  syscall_exit/disp32
    # never gets here

# if no row is found, save 'key' to the next available row
# if there are no rows free, abort
# return the address of the value
get-or-insert-handle:  # table: (addr stream {(handle array byte), T}), key: (handle array byte), row-size: int -> result/eax: (addr T)
    # pseudocode:
    #   var curr: (addr handle stream) = table->data
    #   var max: (addr byte) = &table->data[table->write]
    #   var k: (addr array byte) = lookup(key)
    #   while curr < max
    #     var c: (addr array byte) = lookup(*curr)
    #     if string-equal?(k, c)
    #       return curr+8
    #     curr += row-size
    #   if table->write >= table->size
    #     abort
    #   *max = key
    #   table->write += row-size
    #   return max+8
    #
    # . prologue
    55/push-ebp
    89/copy                         3/mod/direct    5/rm32/ebp    .           .             .           4/r32/esp   .               .                 # copy esp to ebp
    # . save registers
    51/push-ecx
    52/push-edx
    53/push-ebx
    56/push-esi
    # esi = table
    8b/copy                         1/mod/*+disp8   5/rm32/ebp    .           .             .           6/r32/esi   8/disp8         .                 # copy *(ebp+8) to esi
    # var k/ebx: (addr array byte) = lookup(key)
    # . eax = lookup(key)
    # . . push args
    ff          6/subop/push        1/mod/*+disp8   5/rm32/ebp    .           .             .           .           0x10/disp8      .                 # push *(ebp+16)
    ff          6/subop/push        1/mod/*+disp8   5/rm32/ebp    .           .             .           .           0xc/disp8       .                 # push *(ebp+12)
    # . . call
    e8/call  lookup/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # . ebx = eax
    89/copy                         3/mod/direct    3/rm32/ebx    .           .             .           0/r32/eax   .               .                 # copy eax to ebx
    # var curr/ecx: (addr handle array byte) = table->data
    8d/copy-address                 1/mod/*+disp8   6/rm32/esi    .           .             .           1/r32/ecx   0xc/disp8       .                 # copy esi+12 to ecx
    # var max/edx: (addr byte) = &table->data[table->write]
    8b/copy                         0/mod/indirect  6/rm32/esi    .           .             .           2/r32/edx   .               .                 # copy *esi to edx
    8d/copy-address                 0/mod/indirect  4/rm32/sib    1/base/ecx  2/index/edx   .           2/r32/edx   .               .                 # copy ecx+edx to edx
$get-or-insert-handle:search-loop:
    # if (curr >= max) break
    39/compare                      3/mod/direct    1/rm32/ecx    .           .             .           2/r32/edx   .               .                 # compare ecx with edx
    73/jump-if-addr>=  $get-or-insert-handle:not-found/disp8
    # var c/eax: (addr array byte) = lookup(*curr)
    # . . push args
    ff          6/subop/push        1/mod/*+disp8   1/rm32/ecx    .           .             .           .           4/disp8         .                 # push *(ecx+4)
    ff          6/subop/push        0/mod/indirect  1/rm32/ecx    .           .             .           .           .               .                 # push *ecx
    # . . call
    e8/call  lookup/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # if (string-equal?(k, c)) return curr+8
    # . eax = string-equal?(k, c)
    # . . push args
    50/push-eax
    53/push-ebx
    # . . call
    e8/call  string-equal?/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # . if (eax != false) return eax = curr+8
    3d/compare-eax-and  0/imm32/false
    74/jump-if-=  $get-or-insert-handle:mismatch/disp8
    8d/copy-address                 1/mod/*+disp8   1/rm32/ecx    .           .             .           0/r32/eax   8/disp8         .                 # copy ecx+8 to eax
    eb/jump  $get-or-insert-handle:end/disp8
$get-or-insert-handle:mismatch:
    # curr += row-size
    03/add                          1/mod/*+disp8   5/rm32/ebp    .           .             .           1/r32/ecx   0x14/disp8      .                 # add *(ebp+20) to ecx
    # loop
    eb/jump  $get-or-insert-handle:search-loop/disp8
$get-or-insert-handle:not-found:
    # if (table->write >= table->size) abort
    8b/copy                         0/mod/indirect  6/rm32/esi    .           .             .           1/r32/ecx   .               .                 # copy *esi to ecx
    3b/compare                      1/mod/*+disp8   6/rm32/esi    .           .             .           1/r32/ecx   8/disp8         .                 # compare ecx with *(esi+8)
    73/jump-if-addr>=  $get-or-insert-handle:abort/disp8
    # table->write += row-size
    # . eax = row-size
    8b/copy                         1/mod/*+disp8   5/rm32/ebp    .           .             .           0/r32/eax   0x14/disp8      .                 # copy *(ebp+20) to eax
    # . table->write += eax
    01/add                          0/mod/indirect  6/rm32/esi    .           .             .           0/r32/eax   .               .                 # add eax to *esi
    # *max = key
    8b/copy                         1/mod/*+disp8   5/rm32/ebp    .           .             .           0/r32/eax   0xc/disp8       .                 # copy *(ebp+12) to eax
    89/copy                         0/mod/indirect  2/rm32/edx    .           .             .           0/r32/eax   .               .                 # copy eax to *edx
    8b/copy                         1/mod/*+disp8   5/rm32/ebp    .           .             .           0/r32/eax   0x10/disp8      .                 # copy *(ebp+16) to eax
    89/copy                         1/mod/*+disp8   2/rm32/edx    .           .             .           0/r32/eax   4/disp8         .                 # copy eax to *(edx+4)
    # return max+8
    # . eax = max
    89/copy                         3/mod/direct    0/rm32/eax    .           .             .           2/r32/edx   .               .                 # copy edx to eax
    # . eax += 8
    05/add-to-eax  8/imm32
$get-or-insert-handle:end:
    # . restore registers
    5e/pop-to-esi
    5b/pop-to-ebx
    5a/pop-to-edx
    59/pop-to-ecx
    # . epilogue
    89/copy                         3/mod/direct    4/rm32/esp    .           .             .           5/r32/ebp   .               .                 # copy ebp to esp
    5d/pop-to-ebp
    c3/return

$get-or-insert-handle:abort:
    # . _write(2/stderr, error)
    # . . push args
    68/push  "get-or-insert-handle: table is full\n"/imm32
    68/push  2/imm32/stderr
    # . . call
    e8/call  _write/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # . syscall_exit(1)
    bb/copy-to-ebx  1/imm32
    e8/call  syscall_exit/disp32
    # never gets here

test-get-or-insert-handle:
    # . prologue
    55/push-ebp
    89/copy                         3/mod/direct    5/rm32/ebp    .           .             .           4/r32/esp   .               .                 # copy esp to ebp
    # var table/ecx: (stream {(handle array byte), number} 24)  # 2 rows * 12 bytes/row
    81          5/subop/subtract    3/mod/direct    4/rm32/esp    .           .             .           .           .               0x18/imm32        # subtract from esp
    68/push  0x18/imm32/size
    68/push  0/imm32/read
    68/push  0/imm32/write
    89/copy                         3/mod/direct    1/rm32/ecx    .           .             .           4/r32/esp   .               .                 # copy esp to ecx
    # var h/edx: (handle array byte)
    68/push  0/imm32
    68/push  0/imm32
    89/copy                         3/mod/direct    2/rm32/edx    .           .             .           4/r32/esp   .               .                 # copy esp to edx
$test-get-or-insert-handle:first-call:
    # - start with an empty table, insert one key, verify that it was inserted
    # copy-array(Heap, "code", h)
    # . . push args
    52/push-edx
    68/push  "code"/imm32
    68/push  Heap/imm32
    # . . call
    e8/call  copy-array/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
    # eax = get-or-insert-handle(table, h, 12 bytes/row)
    # . . push args
    68/push  0xc/imm32/row-size
    ff          6/subop/push        1/mod/*+disp8   2/rm32/edx    .           .             .           .           4/disp8         .                 # push *(edx+4)
    ff          6/subop/push        0/mod/indirect  2/rm32/edx    .           .             .           .           .               .                 # push *edx
    51/push-ecx
    # . . call
    e8/call  get-or-insert-handle/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0x10/imm32        # add to esp
    # check-ints-equal(eax - table->data, 8, msg)  # first row's value slot returned
    # . check-ints-equal(eax - table, 20, msg)
    # . . push args
    68/push  "F - test-get-or-insert-handle/0"/imm32
    68/push  0x14/imm32
    29/subtract                     3/mod/direct    0/rm32/eax    .           .             .           1/r32/ecx   .               .                 # subtract ecx from eax
    50/push-eax
    # . . call
    e8/call  check-ints-equal/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
    # check-ints-equal(table->write, row-size = 12, msg)
    # . . push args
    68/push  "F - test-get-or-insert-handle/1"/imm32
    68/push  0xc/imm32/row-size
    ff          6/subop/push        0/mod/indirect  1/rm32/ecx    .           .             .           .           .               .                 # push *ecx
    # . . call
    e8/call  check-ints-equal/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
    # var curr-addr/eax: (addr array byte) = lookup(table->data)
    # . . push args
    ff          6/subop/push        1/mod/*+disp8   1/rm32/ecx    .           .             .           .           0x10/disp8      .                 # push *(ecx+16)
    ff          6/subop/push        1/mod/*+disp8   1/rm32/ecx    .           .             .           .           0xc/disp8       .                 # push *(ecx+12)
    # . . call
    e8/call  lookup/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # check-strings-equal(curr-addr, "code", msg)
    # . . push args
    68/push  "F - test-get-or-insert-handle/2"/imm32
    68/push  "code"/imm32
    50/push-eax
    # . . call
    e8/call  check-strings-equal/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
$test-get-or-insert-handle:second-call:
    # - insert the same key again, verify that it was reused
    # copy-array(Heap, "code", h)
    # . . push args
    52/push-edx
    68/push  "code"/imm32
    68/push  Heap/imm32
    # . . call
    e8/call  copy-array/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
    # eax = get-or-insert-handle(table, h, 12 bytes/row)
    # . . push args
    68/push  0xc/imm32/row-size
    ff          6/subop/push        1/mod/*+disp8   2/rm32/edx    .           .             .           .           4/disp8         .                 # push *(edx+4)
    ff          6/subop/push        0/mod/indirect  2/rm32/edx    .           .             .           .           .               .                 # push *edx
    51/push-ecx
    # . . call
    e8/call  get-or-insert-handle/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0x10/imm32        # add to esp
    # check-ints-equal(eax - table->data, 8, msg)
    # . check-ints-equal(eax - table, 20, msg)
    # . . push args
    68/push  "F - test-get-or-insert-handle/3"/imm32
    68/push  0x14/imm32
    29/subtract                     3/mod/direct    0/rm32/eax    .           .             .           1/r32/ecx   .               .                 # subtract ecx from eax
    50/push-eax
    # . . call
    e8/call  check-ints-equal/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
    # no new row inserted
    # . check-ints-equal(table->write, row-size = 12, msg)
    # . . push args
    68/push  "F - test-get-or-insert-handle/4"/imm32
    68/push  0xc/imm32/row-size
    ff          6/subop/push        0/mod/indirect  1/rm32/ecx    .           .             .           .           .               .                 # push *ecx
    # . . call
    e8/call  check-ints-equal/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
    # curr-addr = lookup(table->data)
    # . . push args
    ff          6/subop/push        1/mod/*+disp8   1/rm32/ecx    .           .             .           .           0x10/disp8      .                 # push *(ecx+16)
    ff          6/subop/push        1/mod/*+disp8   1/rm32/ecx    .           .             .           .           0xc/disp8       .                 # push *(ecx+12)
    # . . call
    e8/call  lookup/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # check-strings-equal(curr-addr, "code", msg)
    # . . push args
    68/push  "F - test-get-or-insert-handle/5"/imm32
    68/push  "code"/imm32
    50/push-eax
    # . . call
    e8/call  check-strings-equal/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
$test-get-or-insert-handle:third-call:
    # - insert a new key, verify that it was inserted
    # copy-array(Heap, "data", h)
    # . . push args
    52/push-edx
    68/push  "data"/imm32
    68/push  Heap/imm32
    # . . call
    e8/call  copy-array/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
    # eax = get-or-insert-handle(table, h, 12 bytes/row)
    # . . push args
    68/push  0xc/imm32/row-size
    ff          6/subop/push        1/mod/*+disp8   2/rm32/edx    .           .             .           .           4/disp8         .                 # push *(edx+4)
    ff          6/subop/push        0/mod/indirect  2/rm32/edx    .           .             .           .           .               .                 # push *edx
    51/push-ecx
    # . . call
    e8/call  get-or-insert-handle/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0x10/imm32        # add to esp
    # table gets a new row
    # check-ints-equal(eax - table->data, 20, msg)  # second row's value slot returned
    # . check-ints-equal(eax - table, 32, msg)
    # . . push args
    68/push  "F - test-get-or-insert-handle/6"/imm32
    68/push  0x20/imm32
    29/subtract                     3/mod/direct    0/rm32/eax    .           .             .           1/r32/ecx   .               .                 # subtract ecx from eax
    50/push-eax
    # . . call
    e8/call  check-ints-equal/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
    # check-ints-equal(table->write, 2 rows = 24, msg)
    # . . push args
    68/push  "F - test-get-or-insert-handle/7"/imm32
    68/push  0x18/imm32/two-rows
    ff          6/subop/push        0/mod/indirect  1/rm32/ecx    .           .             .           .           .               .                 # push *ecx
    # . . call
    e8/call  check-ints-equal/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
    # curr-addr = lookup(table->data+12)
    # . . push args
    ff          6/subop/push        1/mod/*+disp8   1/rm32/ecx    .           .             .           .           0x1c/disp8      .                 # push *(ecx+28)
    ff          6/subop/push        1/mod/*+disp8   1/rm32/ecx    .           .             .           .           0x18/disp8      .                 # push *(ecx+24)
    # . . call
    e8/call  lookup/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # check-strings-equal(curr-addr, "data", msg)
    # . . push args
    68/push  "F - test-get-or-insert-handle/8"/imm32
    68/push  "data"/imm32
    50/push-eax
    # . . call
    e8/call  check-strings-equal/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
$test-get-or-insert-handle:end:
    # . epilogue
    89/copy                         3/mod/direct    4/rm32/esp    .           .             .           5/r32/ebp   .               .                 # copy ebp to esp
    5d/pop-to-ebp
    c3/return

# if no row is found, save 'key' in the next available row
# if there are no rows free, abort
get-or-insert-slice:  # table: (addr stream {(handle array byte), T}), key: (addr slice), row-size: int, ad: (addr allocation-descriptor) -> result/eax: (addr T)
    # pseudocode:
    #   curr = table->data
    #   max = &table->data[table->write]
    #   while curr < max
    #     var c: (addr array byte) = lookup(*curr)
    #     if slice-equal?(key, *curr)
    #       return curr+8
    #     curr += row-size
    #   if table->write >= table->size
    #     abort
    #   zero-out(max, row-size)
    #   slice-to-string(ad, key, max)
    #   table->write += row-size
    #   return max+8
    #
    # . prologue
    55/push-ebp
    89/copy                         3/mod/direct    5/rm32/ebp    .           .             .           4/r32/esp   .               .                 # copy esp to ebp
    # . save registers
    51/push-ecx
    52/push-edx
    56/push-esi
    # esi = table
    8b/copy                         1/mod/*+disp8   5/rm32/ebp    .           .             .           6/r32/esi   8/disp8         .                 # copy *(ebp+8) to esi
    # var curr/ecx: (addr handle array byte) = table->data
    8d/copy-address                 1/mod/*+disp8   6/rm32/esi    .           .             .           1/r32/ecx   0xc/disp8       .                 # copy esi+12 to ecx
    # var max/edx: (addr byte) = &table->data[table->write]
    8b/copy                         0/mod/indirect  6/rm32/esi    .           .             .           2/r32/edx   .               .                 # copy *esi to edx
    8d/copy-address                 0/mod/indirect  4/rm32/sib    1/base/ecx  2/index/edx   .           2/r32/edx   .               .                 # copy ecx+edx to edx
$get-or-insert-slice:search-loop:
    # if (curr >= max) break
    39/compare                      3/mod/direct    1/rm32/ecx    .           .             .           2/r32/edx   .               .                 # compare ecx with edx
    73/jump-if-addr>=  $get-or-insert-slice:not-found/disp8
    # var c/eax: (addr array byte) = lookup(*curr)
    # . . push args
    ff          6/subop/push        1/mod/*+disp8   1/rm32/ecx    .           .             .           .           4/disp8         .                 # push *(ecx+4)
    ff          6/subop/push        0/mod/indirect  1/rm32/ecx    .           .             .           .           .               .                 # push *ecx
    # . . call
    e8/call  lookup/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # if (slice-equal?(key, c)) return curr+4
    # . eax = slice-equal?(key, c)
    # . . push args
    50/push-eax
    ff          6/subop/push        1/mod/*+disp8   5/rm32/ebp    .           .             .           .           0xc/disp8       .                 # push *(ebp+12)
    # . . call
    e8/call  slice-equal?/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # . if (eax != false) return eax = curr+8
    3d/compare-eax-and  0/imm32/false
    74/jump-if-=  $get-or-insert-slice:mismatch/disp8
    8d/copy-address                 1/mod/*+disp8   1/rm32/ecx    .           .             .           0/r32/eax   8/disp8         .                 # copy ecx+8 to eax
    eb/jump  $get-or-insert-slice:end/disp8
$get-or-insert-slice:mismatch:
    # curr += row-size
    03/add                          1/mod/*+disp8   5/rm32/ebp    .           .             .           1/r32/ecx   0x10/disp8      .                 # add *(ebp+16) to ecx
    # loop
    eb/jump  $get-or-insert-slice:search-loop/disp8
$get-or-insert-slice:not-found:
    # result/eax = 0
    31/xor                          3/mod/direct    0/rm32/eax    .           .             .           0/r32/eax   .               .                 # clear eax
    # if (table->write >= table->size) abort
    8b/copy                         0/mod/indirect  6/rm32/esi    .           .             .           1/r32/ecx   .               .                 # copy *esi to ecx
    3b/compare                      1/mod/*+disp8   6/rm32/esi    .           .             .           1/r32/ecx   8/disp8         .                 # compare ecx with *(esi+8)
    7d/jump-if->=  $get-or-insert-slice:abort/disp8
    # zero-out(max, row-size)
    # . . push args
    ff          6/subop/push        1/mod/*+disp8   5/rm32/ebp    .           .             .           .           0x10/disp8      .                 # push *(ebp+16)
    52/push-edx
    # . . call
    e8/call  zero-out/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # slice-to-string(ad, key, max)
    # . . push args
    52/push-edx
    ff          6/subop/push        1/mod/*+disp8   5/rm32/ebp    .           .             .           .           0xc/disp8       .                 # push *(ebp+12)
    ff          6/subop/push        1/mod/*+disp8   5/rm32/ebp    .           .             .           .           0x14/disp8      .                 # push *(ebp+20)
    # . . call
    e8/call  slice-to-string/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
    # table->write += row-size
    # . eax = row-size
    8b/copy                         1/mod/*+disp8   5/rm32/ebp    .           .             .           0/r32/eax   0x10/disp8      .                 # copy *(ebp+16) to eax
    # . table->write += eax
    01/add                          0/mod/indirect  6/rm32/esi    .           .             .           0/r32/eax   .               .                 # add eax to *esi
    # return max+8
    # . eax = max
    89/copy                         3/mod/direct    0/rm32/eax    .           .             .           2/r32/edx   .               .                 # copy edx to eax
    # . eax += 8
    05/add-to-eax  8/imm32
$get-or-insert-slice:end:
    # . restore registers
    5e/pop-to-esi
    5a/pop-to-edx
    59/pop-to-ecx
    # . epilogue
    89/copy                         3/mod/direct    4/rm32/esp    .           .             .           5/r32/ebp   .               .                 # copy ebp to esp
    5d/pop-to-ebp
    c3/return

$get-or-insert-slice:abort:
    # . _write(2/stderr, error)
    # . . push args
    68/push  "get-or-insert-slice: table is full\n"/imm32
    68/push  2/imm32/stderr
    # . . call
    e8/call  _write/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # . syscall_exit(1)
    bb/copy-to-ebx  1/imm32
    e8/call  syscall_exit/disp32
    # never gets here

test-get-or-insert-slice:
    # . prologue
    55/push-ebp
    89/copy                         3/mod/direct    5/rm32/ebp    .           .             .           4/r32/esp   .               .                 # copy esp to ebp
    # var table/ecx: (stream {string, number} 24)  # 2 rows * 12 bytes/row
    81          5/subop/subtract    3/mod/direct    4/rm32/esp    .           .             .           .           .               0x18/imm32        # subtract from esp
    68/push  0x18/imm32/size
    68/push  0/imm32/read
    68/push  0/imm32/write
    89/copy                         3/mod/direct    1/rm32/ecx    .           .             .           4/r32/esp   .               .                 # copy esp to ecx
    # (eax..edx) = "code"
    b8/copy-to-eax  "code"/imm32
    8b/copy                         0/mod/indirect  0/rm32/eax    .           .             .           2/r32/edx   .               .                 # copy *eax to edx
    8d/copy-address                 1/mod/*+disp8   4/rm32/sib    0/base/eax  2/index/edx   .           2/r32/edx   4/disp8         .                 # copy eax+edx+4 to edx
    05/add-to-eax  4/imm32
    # var slice/edx: slice = {eax, edx}
    52/push-edx
    50/push-eax
    89/copy                         3/mod/direct    2/rm32/edx    .           .             .           4/r32/esp   .               .                 # copy esp to edx
$test-get-or-insert-slice:first-call:
    # - start with an empty table, insert one key, verify that it was inserted
    # eax = get-or-insert-slice(table, "code" slice, 12 bytes/row, Heap)
    # . . push args
    68/push  Heap/imm32
    68/push  0xc/imm32/row-size
    52/push-edx
    51/push-ecx
    # . . call
    e8/call  get-or-insert-slice/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0x10/imm32        # add to esp
    # check-ints-equal(eax - table->data, 8, msg)  # first row's value slot returned
    # . check-ints-equal(eax - table, 20, msg)
    # . . push args
    68/push  "F - test-get-or-insert-slice/0"/imm32
    68/push  0x14/imm32
    29/subtract                     3/mod/direct    0/rm32/eax    .           .             .           1/r32/ecx   .               .                 # subtract ecx from eax
    50/push-eax
    # . . call
    e8/call  check-ints-equal/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
    # check-ints-equal(table->write, row-size = 12, msg)
    # . . push args
    68/push  "F - test-get-or-insert-slice/1"/imm32
    68/push  0xc/imm32/row-size
    ff          6/subop/push        0/mod/indirect  1/rm32/ecx    .           .             .           .           .               .                 # push *ecx
    # . . call
    e8/call  check-ints-equal/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
    # var curr-addr/eax: (addr array byte) = lookup(table->data)
    # . . push args
    ff          6/subop/push        1/mod/*+disp8   1/rm32/ecx    .           .             .           .           0x10/disp8      .                 # push *(ecx+16)
    ff          6/subop/push        1/mod/*+disp8   1/rm32/ecx    .           .             .           .           0xc/disp8       .                 # push *(ecx+12)
    # . . call
    e8/call  lookup/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # check-strings-equal(curr-addr, "code", msg)
    # . . push args
    68/push  "F - test-get-or-insert-slice/2"/imm32
    68/push  "code"/imm32
    50/push-eax
    # . . call
    e8/call  check-strings-equal/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
$test-get-or-insert-slice:second-call:
    # - insert the same key again, verify that it was reused
    # eax = get-or-insert-slice(table, "code" slice, 12 bytes/row)
    # . . push args
    68/push  Heap/imm32
    68/push  0xc/imm32/row-size
    52/push-edx
    51/push-ecx
    # . . call
    e8/call  get-or-insert-slice/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0x10/imm32        # add to esp
    # check-ints-equal(eax - table->data, 8, msg)
    # . check-ints-equal(eax - table, 20, msg)
    # . . push args
    68/push  "F - test-get-or-insert-slice/3"/imm32
    68/push  0x14/imm32
    29/subtract                     3/mod/direct    0/rm32/eax    .           .             .           1/r32/ecx   .               .                 # subtract ecx from eax
    50/push-eax
    # . . call
    e8/call  check-ints-equal/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
    # no new row inserted
    # . check-ints-equal(table->write, row-size = 12, msg)
    # . . push args
    68/push  "F - test-get-or-insert-slice/4"/imm32
    68/push  0xc/imm32/row-size
    ff          6/subop/push        0/mod/indirect  1/rm32/ecx    .           .             .           .           .               .                 # push *ecx
    # . . call
    e8/call  check-ints-equal/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
    # curr-addr = lookup(table->data)
    # . . push args
    ff          6/subop/push        1/mod/*+disp8   1/rm32/ecx    .           .             .           .           0x10/disp8      .                 # push *(ecx+16)
    ff          6/subop/push        1/mod/*+disp8   1/rm32/ecx    .           .             .           .           0xc/disp8       .                 # push *(ecx+12)
    # . . call
    e8/call  lookup/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # check-strings-equal(curr-addr, "code", msg)
    # . . push args
    68/push  "F - test-get-or-insert-slice/5"/imm32
    68/push  "code"/imm32
    50/push-eax
    # . . call
    e8/call  check-strings-equal/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
$test-get-or-insert-slice:third-call:
    # - insert a new key, verify that it was inserted
    # (eax..edx) = "data"
    b8/copy-to-eax  "data"/imm32
    8b/copy                         0/mod/indirect  0/rm32/eax    .           .             .           2/r32/edx   .               .                 # copy *eax to edx
    8d/copy-address                 1/mod/*+disp8   4/rm32/sib    0/base/eax  2/index/edx   .           2/r32/edx   4/disp8         .                 # copy eax+edx+4 to edx
    05/add-to-eax  4/imm32
    # var slice/edx: slice = {eax, edx}
    52/push-edx
    50/push-eax
    89/copy                         3/mod/direct    2/rm32/edx    .           .             .           4/r32/esp   .               .                 # copy esp to edx
    # eax = get-or-insert-slice(table, "data" slice, 12 bytes/row)
    # . . push args
    68/push  Heap/imm32
    68/push  0xc/imm32/row-size
    52/push-edx
    51/push-ecx
    # . . call
    e8/call  get-or-insert-slice/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0x10/imm32        # add to esp
    # table gets a new row
    # check-ints-equal(eax - table->data, 20, msg)  # second row's value slot returned
    # . check-ints-equal(eax - table, 32, msg)
    # . . push args
    68/push  "F - test-get-or-insert-slice/6"/imm32
    68/push  0x20/imm32
    29/subtract                     3/mod/direct    0/rm32/eax    .           .             .           1/r32/ecx   .               .                 # subtract ecx from eax
    50/push-eax
    # . . call
    e8/call  check-ints-equal/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
    # check-ints-equal(table->write, 2 rows = 24, msg)
    # . . push args
    68/push  "F - test-get-or-insert-slice/7"/imm32
    68/push  0x18/imm32/two-rows
    ff          6/subop/push        0/mod/indirect  1/rm32/ecx    .           .             .           .           .               .                 # push *ecx
    # . . call
    e8/call  check-ints-equal/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
    # curr-addr = lookup(table->data+12)
    # . . push args
    ff          6/subop/push        1/mod/*+disp8   1/rm32/ecx    .           .             .           .           0x1c/disp8      .                 # push *(ecx+28)
    ff          6/subop/push        1/mod/*+disp8   1/rm32/ecx    .           .             .           .           0x18/disp8      .                 # push *(ecx+24)
    # . . call
    e8/call  lookup/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # check-strings-equal(curr-addr, "data", msg)
    # . . push args
    68/push  "F - test-get-or-insert-slice/8"/imm32
    68/push  "data"/imm32
    50/push-eax
    # . . call
    e8/call  check-strings-equal/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
$test-get-or-insert-slice:end:
    # . epilogue
    89/copy                         3/mod/direct    4/rm32/esp    .           .             .           5/r32/ebp   .               .                 # copy ebp to esp
    5d/pop-to-ebp
    c3/return

# if no row is found, save 'key' in the next available row
# if there are no rows free, abort
insert-slice-or-abort:  # table: (addr stream {(handle array byte), T}), key: (addr slice), row-size: int, ad: (addr allocation-descriptor) -> result/eax: (addr T)
    # pseudocode:
    #   curr = table->data
    #   max = &table->data[table->write]
    #   while curr < max
    #     var c: (addr array byte) = lookup(*curr)
    #     if slice-equal?(key, *curr)
    #       return curr+8
    #     curr += row-size
    #   if table->write >= table->size
    #     abort
    #   zero-out(max, row-size)
    #   slice-to-string(ad, key, max)
    #   table->write += row-size
    #   return max+8
    #
    # . prologue
    55/push-ebp
    89/copy                         3/mod/direct    5/rm32/ebp    .           .             .           4/r32/esp   .               .                 # copy esp to ebp
    # . save registers
    51/push-ecx
    52/push-edx
    56/push-esi
    # esi = table
    8b/copy                         1/mod/*+disp8   5/rm32/ebp    .           .             .           6/r32/esi   8/disp8         .                 # copy *(ebp+8) to esi
    # var curr/ecx: (addr handle array byte) = table->data
    8d/copy-address                 1/mod/*+disp8   6/rm32/esi    .           .             .           1/r32/ecx   0xc/disp8       .                 # copy esi+12 to ecx
    # var max/edx: (addr byte) = &table->data[table->write]
    8b/copy                         0/mod/indirect  6/rm32/esi    .           .             .           2/r32/edx   .               .                 # copy *esi to edx
    8d/copy-address                 0/mod/indirect  4/rm32/sib    1/base/ecx  2/index/edx   .           2/r32/edx   .               .                 # copy ecx+edx to edx
$insert-slice-or-abort:search-loop:
    # if (curr >= max) break
    39/compare                      3/mod/direct    1/rm32/ecx    .           .             .           2/r32/edx   .               .                 # compare ecx with edx
    73/jump-if-addr>=  $insert-slice-or-abort:not-found/disp8
    # var c/eax: (addr array byte) = lookup(*curr)
    # . . push args
    ff          6/subop/push        1/mod/*+disp8   1/rm32/ecx    .           .             .           .           4/disp8         .                 # push *(ecx+4)
    ff          6/subop/push        0/mod/indirect  1/rm32/ecx    .           .             .           .           .               .                 # push *ecx
    # . . call
    e8/call  lookup/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # if (slice-equal?(key, c)) abort
    # . eax = slice-equal?(key, c)
    # . . push args
    50/push-eax
    ff          6/subop/push        1/mod/*+disp8   5/rm32/ebp    .           .             .           .           0xc/disp8       .                 # push *(ebp+12)
    # . . call
    e8/call  slice-equal?/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # . if (eax != false) abort
    3d/compare-eax-and  0/imm32/false
    0f 85/jump-if-!=  $insert-slice-or-abort:error-duplicate/disp32
    # curr += row-size
    03/add                          1/mod/*+disp8   5/rm32/ebp    .           .             .           1/r32/ecx   0x10/disp8      .                 # add *(ebp+16) to ecx
    # loop
    eb/jump  $insert-slice-or-abort:search-loop/disp8
$insert-slice-or-abort:not-found:
    # result/eax = 0
    31/xor                          3/mod/direct    0/rm32/eax    .           .             .           0/r32/eax   .               .                 # clear eax
    # if (table->write >= table->size) abort
    8b/copy                         0/mod/indirect  6/rm32/esi    .           .             .           1/r32/ecx   .               .                 # copy *esi to ecx
    3b/compare                      1/mod/*+disp8   6/rm32/esi    .           .             .           1/r32/ecx   8/disp8         .                 # compare ecx with *(esi+8)
    0f 8d/jump-if->=  $insert-slice-or-abort:error-full/disp32
    # zero-out(max, row-size)
    # . . push args
    ff          6/subop/push        1/mod/*+disp8   5/rm32/ebp    .           .             .           .           0x10/disp8      .                 # push *(ebp+16)
    52/push-edx
    # . . call
    e8/call  zero-out/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # slice-to-string(ad, key, max)
    # . . push args
    52/push-edx
    ff          6/subop/push        1/mod/*+disp8   5/rm32/ebp    .           .             .           .           0xc/disp8       .                 # push *(ebp+12)
    ff          6/subop/push        1/mod/*+disp8   5/rm32/ebp    .           .             .           .           0x14/disp8      .                 # push *(ebp+20)
    # . . call
    e8/call  slice-to-string/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
    # table->write += row-size
    # . eax = row-size
    8b/copy                         1/mod/*+disp8   5/rm32/ebp    .           .             .           0/r32/eax   0x10/disp8      .                 # copy *(ebp+16) to eax
    # . table->write += eax
    01/add                          0/mod/indirect  6/rm32/esi    .           .             .           0/r32/eax   .               .                 # add eax to *esi
    # return max+8
    # . eax = max
    89/copy                         3/mod/direct    0/rm32/eax    .           .             .           2/r32/edx   .               .                 # copy edx to eax
    # . eax += 8
    05/add-to-eax  8/imm32
$insert-slice-or-abort:end:
    # . restore registers
    5e/pop-to-esi
    5a/pop-to-edx
    59/pop-to-ecx
    # . epilogue
    89/copy                         3/mod/direct    4/rm32/esp    .           .             .           5/r32/ebp   .               .                 # copy ebp to esp
    5d/pop-to-ebp
    c3/return

$insert-slice-or-abort:error-duplicate:
    # . flush(Stderr)
    # . . push args
    68/push  Stderr/imm32
    # . . call
    e8/call  flush/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               4/imm32           # add to esp
    # . _write(2/stderr, error)
    # . . push args
    68/push  "insert-slice-or-abort: key already exists: "/imm32
    68/push  2/imm32/stderr
    # . . call
    e8/call  _write/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # . write-slice-buffered(Stderr, key)
    # . . push args
    ff          6/subop/push        1/mod/*+disp8   5/rm32/ebp    .           .             .           .           0xc/disp8       .                 # push *(ebp+12)
    68/push  Stderr/imm32
    # . . call
    e8/call  write-slice-buffered/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # . flush(Stderr)
    # . . push args
    68/push  Stderr/imm32
    # . . call
    e8/call  flush/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               4/imm32           # add to esp
    # . _write(2/stderr, "\n")
    # . . push args
    68/push  "\n"/imm32
    68/push  2/imm32/stderr
    # . . call
    e8/call  _write/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # . syscall_exit(1)
    bb/copy-to-ebx  1/imm32
    e8/call  syscall_exit/disp32
    # never gets here

$insert-slice-or-abort:error-full:
    # . _write(2/stderr, error)
    # . . push args
    68/push  "insert-slice-or-abort: table is full\n"/imm32
    68/push  2/imm32/stderr
    # . . call
    e8/call  _write/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # . syscall_exit(1)
    bb/copy-to-ebx  1/imm32
    e8/call  syscall_exit/disp32
    # never gets here


# if no row is found, stop(ed)
get-or-stop:  # table: (addr stream {(handle array byte), T}), key: (addr array byte), row-size: int,
              # abort-message-prefix: (addr array byte), err: (addr buffered-file), ed: (addr exit-descriptor)
              # -> result/eax: (addr T)
    # pseudocode:
    #   curr = table->data
    #   max = &table->data[table->write]
    #   while curr < max
    #     var c: (addr array byte) = lookup(*curr)
    #     if string-equal?(key, c)
    #       return curr+8
    #     curr += row-size
    #   write-buffered(err, msg)
    #   stop(ed)
    #
    # . prologue
    55/push-ebp
    89/copy                         3/mod/direct    5/rm32/ebp    .           .             .           4/r32/esp   .               .                 # copy esp to ebp
    # . save registers
    51/push-ecx
    52/push-edx
    56/push-esi
    # esi = table
    8b/copy                         1/mod/*+disp8   5/rm32/ebp    .           .             .           6/r32/esi   8/disp8         .                 # copy *(ebp+8) to esi
    # var curr/ecx: (addr handle array byte) = table->data
    8d/copy-address                 1/mod/*+disp8   6/rm32/esi    .           .             .           1/r32/ecx   0xc/disp8       .                 # copy esi+12 to ecx
    # var max/edx: (addr byte) = &table->data[table->write]
    8b/copy                         0/mod/indirect  6/rm32/esi    .           .             .           2/r32/edx   .               .                 # copy *esi to edx
    8d/copy-address                 0/mod/indirect  4/rm32/sib    1/base/ecx  2/index/edx   .           2/r32/edx   .               .                 # copy ecx+edx to edx
$get-or-stop:search-loop:
    # if (curr >= max) stop(ed)
    39/compare                      3/mod/direct    1/rm32/ecx    .           .             .           2/r32/edx   .               .                 # compare ecx with edx
    73/jump-if-addr>=  $get-or-stop:stop/disp8
    # var c/eax: (addr array byte) = lookup(*curr)
    # . . push args
    ff          6/subop/push        1/mod/*+disp8   1/rm32/ecx    .           .             .           .           4/disp8         .                 # push *(ecx+4)
    ff          6/subop/push        0/mod/indirect  1/rm32/ecx    .           .             .           .           .               .                 # push *ecx
    # . . call
    e8/call  lookup/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # if (string-equal?(key, c)) return curr+8
    # . eax = string-equal?(key, c)
    # . . push args
    50/push-eax
    ff          6/subop/push        1/mod/*+disp8   5/rm32/ebp    .           .             .           .           0xc/disp8       .                 # push *(ebp+12)
    # . . call
    e8/call  string-equal?/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # . if (eax != false) return eax = curr+8
    3d/compare-eax-and  0/imm32/false
    74/jump-if-=  $get-or-stop:mismatch/disp8
    8d/copy-address                 1/mod/*+disp8   1/rm32/ecx    .           .             .           0/r32/eax   8/disp8         .                 # copy ecx+8 to eax
    eb/jump  $get-or-stop:end/disp8
$get-or-stop:mismatch:
    # curr += row-size
    03/add                          1/mod/*+disp8   5/rm32/ebp    .           .             .           1/r32/ecx   0x10/disp8      .                 # add *(ebp+16) to ecx
    # loop
    eb/jump  $get-or-stop:search-loop/disp8
$get-or-stop:end:
    # . restore registers
    5e/pop-to-esi
    5a/pop-to-edx
    59/pop-to-ecx
    # . epilogue
    89/copy                         3/mod/direct    4/rm32/esp    .           .             .           5/r32/ebp   .               .                 # copy ebp to esp
    5d/pop-to-ebp
    c3/return

$get-or-stop:stop:
    # . write-buffered(err, abort-message-prefix)
    # . . push args
    ff          6/subop/push        1/mod/*+disp8   5/rm32/ebp    .           .             .           .           0x14/disp8      .                 # push *(ebp+20)
    ff          6/subop/push        1/mod/*+disp8   5/rm32/ebp    .           .             .           .           0x18/disp8      .                 # push *(ebp+24)
    # . . call
    e8/call  write-buffered/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # . write-buffered(err, error)
    # . . push args
    68/push  ": get-or-stop: key not found: "/imm32
    ff          6/subop/push        1/mod/*+disp8   5/rm32/ebp    .           .             .           .           0x18/disp8      .                 # push *(ebp+24)
    # . . call
    e8/call  write-buffered/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # . write-buffered(err, key)
    # . . push args
    ff          6/subop/push        1/mod/*+disp8   5/rm32/ebp    .           .             .           .           0xc/disp8       .                 # push *(ebp+12)
    ff          6/subop/push        1/mod/*+disp8   5/rm32/ebp    .           .             .           .           0x18/disp8      .                 # push *(ebp+24)
    # . . call
    e8/call  write-buffered/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # . write-buffered(err, "\n")
    # . . push args
    68/push  Newline/imm32
    ff          6/subop/push        1/mod/*+disp8   5/rm32/ebp    .           .             .           .           0x18/disp8      .                 # push *(ebp+24)
    # . . call
    e8/call  write-buffered/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # . stop(ed, 1)
    # . . push args
    68/push  1/imm32
    ff          6/subop/push        1/mod/*+disp8   5/rm32/ebp    .           .             .           .           0x1c/disp8      .                 # push *(ebp+28)
    # . . call
    e8/call  stop/disp32
    # never gets here
$get-or-stop:terminus:
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # syscall_exit(1)
    bb/copy-to-ebx  1/imm32
    e8/call  syscall_exit/disp32

test-get-or-stop:
    # This test uses exit-descriptors. Use ebp for setting up local variables.
    # . prologue
    55/push-ebp
    89/copy                         3/mod/direct    5/rm32/ebp    .           .             .           4/r32/esp   .               .                 # copy esp to ebp
    # setup
    # . clear-stream(_test-error-stream)
    # . . push args
    68/push  _test-error-stream/imm32
    # . . call
    e8/call  clear-stream/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               4/imm32           # add to esp
    # . clear-stream($_test-error-buffered-file->buffer)
    # . . push args
    68/push  $_test-error-buffered-file->buffer/imm32
    # . . call
    e8/call  clear-stream/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               4/imm32           # add to esp
    # var table/ecx: (stream {string, number} 24)  # 2 rows * 12 bytes/row
    81          5/subop/subtract    3/mod/direct    4/rm32/esp    .           .             .           .           .               0x18/imm32        # subtract from esp
    68/push  0x18/imm32/size
    68/push  0/imm32/read
    68/push  0/imm32/write
    89/copy                         3/mod/direct    1/rm32/ecx    .           .             .           4/r32/esp   .               .                 # copy esp to ecx
    # var ed/edx: exit-descriptor
    68/push  0/imm32
    68/push  0/imm32
    89/copy                         3/mod/direct    2/rm32/edx    .           .             .           4/r32/esp   .               .                 # copy esp to edx
    # size 'ed' for the calls to 'get-or-stop'
    # . tailor-exit-descriptor(ed, 24)
    # . . push args
    68/push  0x18/imm32/nbytes-of-args-for-get-or-stop
    52/push-edx
    # . . call
    e8/call  tailor-exit-descriptor/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # insert(table, "code", 12 bytes/row, Heap)
    # . . push args
    68/push  Heap/imm32
    68/push  0xc/imm32/row-size
    68/push  "code"/imm32
    51/push-ecx
    # . . call
    e8/call  get-or-insert/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0x10/imm32        # add to esp
$test-get-or-stop:success:
    # eax = get-or-stop(table, "code", row-size=12, msg, _test-error-buffered-file, ed)
    # . . push args
    52/push-edx/ed
    68/push  _test-error-buffered-file/imm32
    68/push  "foo"/imm32/abort-prefix
    68/push  0xc/imm32/row-size
    68/push  "code"/imm32
    51/push-ecx
    # . . call
    e8/call  get-or-stop/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0x18/imm32        # add to esp
$test-get-or-stop:success-assertion:
    # check-ints-equal(eax - table->data, 8, msg)
    # . check-ints-equal(eax - table, 20, msg)
    # . . push args
    68/push  "F - test-get-or-stop/0"/imm32
    68/push  0x14/imm32
    29/subtract                     3/mod/direct    0/rm32/eax    .           .             .           1/r32/ecx   .               .                 # subtract ecx from eax
    50/push-eax
    # . . call
    e8/call  check-ints-equal/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
$test-get-or-stop:failure:
    # eax = get-or-stop(table, "data", row-size=12, msg, _test-error-buffered-file, ed)
    # . . push args
    52/push-edx/ed
    68/push  _test-error-buffered-file/imm32
    68/push  "foo"/imm32/abort-prefix
    68/push  0xc/imm32/row-size
    68/push  "data"/imm32
    51/push-ecx
    # . . call
    e8/call  get-or-stop/disp32
    # registers except esp may be clobbered at this point
    # restore register args, discard others
    59/pop-to-ecx
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0x10/imm32        # add to esp
    5a/pop-to-edx
$test-get-or-stop:failure-assertion:
    # check that get-or-stop tried to call stop(1)
    # . check-ints-equal(ed->value, 2, msg)
    # . . push args
    68/push  "F - test-get-or-stop/1"/imm32
    68/push  2/imm32
    # . . push ed->value
    ff          6/subop/push        1/mod/*+disp8   2/rm32/edx    .           .             .           .           4/disp8         .                 # push *(edx+4)
    # . . call
    e8/call  check-ints-equal/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
$test-get-or-stop:end:
    # . epilogue
    # don't restore esp from ebp; manually reclaim locals
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0x2c/imm32        # add to esp
    5d/pop-to-ebp
    c3/return

# if no row is found, stop(ed)
get-slice-or-stop:  # table: (addr stream {(handle array byte), _}), key: (addr slice), row-size: int,
                    # abort-message-prefix: (addr string), err: (addr buffered-file), ed: (addr exit-descriptor)
                    # -> result/eax: (addr _)
    # pseudocode:
    #   curr = table->data
    #   max = &table->data[table->write]
    #   while curr < max
    #     var c: (addr array byte) = lookup(*curr)
    #     if slice-equal?(key, c)
    #       return curr+8
    #     curr += row-size
    #   write-buffered(err, msg)
    #   stop(ed)
    #
    # . prologue
    55/push-ebp
    89/copy                         3/mod/direct    5/rm32/ebp    .           .             .           4/r32/esp   .               .                 # copy esp to ebp
    # . save registers
    51/push-ecx
    52/push-edx
    56/push-esi
    # esi = table
    8b/copy                         1/mod/*+disp8   5/rm32/ebp    .           .             .           6/r32/esi   8/disp8         .                 # copy *(ebp+8) to esi
    # var curr/ecx: (addr handle array byte) = table->data
    8d/copy-address                 1/mod/*+disp8   6/rm32/esi    .           .             .           1/r32/ecx   0xc/disp8       .                 # copy esi+12 to ecx
    # var max/edx: (addr byte) = &table->data[table->write]
    8b/copy                         0/mod/indirect  6/rm32/esi    .           .             .           2/r32/edx   .               .                 # copy *esi to edx
    8d/copy-address                 0/mod/indirect  4/rm32/sib    1/base/ecx  2/index/edx   .           2/r32/edx   .               .                 # copy ecx+edx to edx
$get-slice-or-stop:search-loop:
    # if (curr >= max) stop(ed)
    39/compare                      3/mod/direct    1/rm32/ecx    .           .             .           2/r32/edx   .               .                 # compare ecx with edx
    73/jump-if-addr>=  $get-slice-or-stop:stop/disp8
    # var c/eax: (addr array byte) = lookup(*curr)
    # . . push args
    ff          6/subop/push        1/mod/*+disp8   1/rm32/ecx    .           .             .           .           4/disp8         .                 # push *(ecx+4)
    ff          6/subop/push        0/mod/indirect  1/rm32/ecx    .           .             .           .           .               .                 # push *ecx
    # . . call
    e8/call  lookup/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # if (slice-equal?(key, c)) return curr+4
    # . eax = slice-equal?(key, c)
    # . . push args
    50/push-eax
    ff          6/subop/push        1/mod/*+disp8   5/rm32/ebp    .           .             .           .           0xc/disp8       .                 # push *(ebp+12)
    # . . call
    e8/call  slice-equal?/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # . if (eax != false) return eax = curr+8
    3d/compare-eax-and  0/imm32/false
    74/jump-if-=  $get-slice-or-stop:mismatch/disp8
    8d/copy-address                 1/mod/*+disp8   1/rm32/ecx    .           .             .           0/r32/eax   8/disp8         .                 # copy ecx+8 to eax
    eb/jump  $get-slice-or-stop:end/disp8
$get-slice-or-stop:mismatch:
    # curr += row-size
    03/add                          1/mod/*+disp8   5/rm32/ebp    .           .             .           1/r32/ecx   0x10/disp8      .                 # add *(ebp+16) to ecx
    # loop
    eb/jump  $get-slice-or-stop:search-loop/disp8
$get-slice-or-stop:end:
    # . restore registers
    5e/pop-to-esi
    5a/pop-to-edx
    59/pop-to-ecx
    # . epilogue
    89/copy                         3/mod/direct    4/rm32/esp    .           .             .           5/r32/ebp   .               .                 # copy ebp to esp
    5d/pop-to-ebp
    c3/return

$get-slice-or-stop:stop:
    # . write-buffered(err, abort-message-prefix)
    # . . push args
    ff          6/subop/push        1/mod/*+disp8   5/rm32/ebp    .           .             .           .           0x14/disp8      .                 # push *(ebp+20)
    ff          6/subop/push        1/mod/*+disp8   5/rm32/ebp    .           .             .           .           0x18/disp8      .                 # push *(ebp+24)
    # . . call
    e8/call  write-buffered/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # . write-buffered(err, error)
    # . . push args
    68/push  ": get-slice-or-stop: key not found: "/imm32
    ff          6/subop/push        1/mod/*+disp8   5/rm32/ebp    .           .             .           .           0x18/disp8      .                 # push *(ebp+24)
    # . . call
    e8/call  write-buffered/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # . write-slice-buffered(err, key)
    # . . push args
    ff          6/subop/push        1/mod/*+disp8   5/rm32/ebp    .           .             .           .           0xc/disp8       .                 # push *(ebp+12)
    ff          6/subop/push        1/mod/*+disp8   5/rm32/ebp    .           .             .           .           0x18/disp8      .                 # push *(ebp+24)
    # . . call
    e8/call  write-slice-buffered/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # . write-buffered(err, "\n")
    # . . push args
    68/push  Newline/imm32
    ff          6/subop/push        1/mod/*+disp8   5/rm32/ebp    .           .             .           .           0x18/disp8      .                 # push *(ebp+24)
    # . . call
    e8/call  write-buffered/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # . stop(ed, 1)
    # . . push args
    68/push  1/imm32
    ff          6/subop/push        1/mod/*+disp8   5/rm32/ebp    .           .             .           .           0x1c/disp8      .                 # push *(ebp+28)
    # . . call
    e8/call  stop/disp32
    # never gets here
$get-slice-or-stop:terminus:
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # syscall_exit(1)
    bb/copy-to-ebx  1/imm32
    e8/call  syscall_exit/disp32

test-get-slice-or-stop:
    # This test uses exit-descriptors. Use ebp for setting up local variables.
    # . prologue
    55/push-ebp
    89/copy                         3/mod/direct    5/rm32/ebp    .           .             .           4/r32/esp   .               .                 # copy esp to ebp
    # setup
    # . clear-stream(_test-error-stream)
    # . . push args
    68/push  _test-error-stream/imm32
    # . . call
    e8/call  clear-stream/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               4/imm32           # add to esp
    # . clear-stream($_test-error-buffered-file->buffer)
    # . . push args
    68/push  $_test-error-buffered-file->buffer/imm32
    # . . call
    e8/call  clear-stream/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               4/imm32           # add to esp
    # var table/ecx: (stream {string, number} 24)  # 2 rows * 12 bytes/row
    81          5/subop/subtract    3/mod/direct    4/rm32/esp    .           .             .           .           .               0x18/imm32        # subtract from esp
    68/push  0x18/imm32/size
    68/push  0/imm32/read
    68/push  0/imm32/write
    89/copy                         3/mod/direct    1/rm32/ecx    .           .             .           4/r32/esp   .               .                 # copy esp to ecx
    # var ed/edx: exit-descriptor
    68/push  0/imm32
    68/push  0/imm32
    89/copy                         3/mod/direct    2/rm32/edx    .           .             .           4/r32/esp   .               .                 # copy esp to edx
    # var slice/ebx: slice = "code"
    # . (eax..ebx) = "code"
    b8/copy-to-eax  "code"/imm32
    8b/copy                         0/mod/indirect  0/rm32/eax    .           .             .           3/r32/ebx   .               .                 # copy *eax to ebx
    8d/copy-address                 1/mod/*+disp8   4/rm32/sib    0/base/eax  3/index/ebx   .           3/r32/ebx   4/disp8         .                 # copy eax+ebx+4 to ebx
    05/add-to-eax  4/imm32
    # . ebx = {eax, ebx}
    53/push-ebx
    50/push-eax
    89/copy                         3/mod/direct    3/rm32/ebx    .           .             .           4/r32/esp   .               .                 # copy esp to ebx
    # size 'ed' for the calls to 'get-or-stop' (define no locals past this point)
    # . tailor-exit-descriptor(ed, 24)
    # . . push args
    68/push  0x18/imm32/nbytes-of-args-for-get-or-stop
    52/push-edx
    # . . call
    e8/call  tailor-exit-descriptor/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # insert(table, "code", 12 bytes/row, Heap)
    # . . push args
    68/push  Heap/imm32
    68/push  0xc/imm32/row-size
    68/push  "code"/imm32
    51/push-ecx
    # . . call
    e8/call  get-or-insert/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0x10/imm32        # add to esp
$test-get-slice-or-stop:success:
    # eax = get-slice-or-stop(table, slice, row-size=12, msg, _test-error-buffered-file, ed)
    # . . push args
    52/push-edx/ed
    68/push  _test-error-buffered-file/imm32
    68/push  "foo"/imm32/abort-prefix
    68/push  0xc/imm32/row-size
    53/push-ebx/slice
    51/push-ecx
    # . . call
    e8/call  get-slice-or-stop/disp32
    # registers except esp may be clobbered at this point
    # restore register args, discard others
    59/pop-to-ecx
    5b/pop-to-ebx
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
    5a/pop-to-edx
$test-get-slice-or-stop:success-assertion:
    # check-ints-equal(eax - table->data, 8, msg)  # first row's value slot returned
    # . check-ints-equal(eax - table, 20, msg)
    # . . push args
    68/push  "F - test-get-slice-or-stop/0"/imm32
    68/push  0x14/imm32
    29/subtract                     3/mod/direct    0/rm32/eax    .           .             .           1/r32/ecx   .               .                 # subtract ecx from eax
    50/push-eax
    # . . call
    e8/call  check-ints-equal/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
$test-get-slice-or-stop:failure:
    # slice = "segment2"
    # . *ebx = "segment2"->data
    b8/copy-to-eax  "segment2"/imm32
    05/add-to-eax  4/imm32
    89/copy                         0/mod/indirect  3/rm32/ebx    .           .             .           0/r32/eax   .               .                 # copy eax to *ebx
    # . *(ebx+4) = "segment2"->data + len("segment2")
    05/add-to-eax  8/imm32/strlen
    89/copy                         1/mod/*+disp8   3/rm32/ebx    .           .             .           0/r32/eax   4/disp8         .                 # copy eax to *(ebx+4)
    # eax = get-slice-or-stop(table, slice, row-size=12, msg, _test-error-buffered-file, ed)
    # . . push args
    52/push-edx/ed
    68/push  _test-error-buffered-file/imm32
    68/push  "foo"/imm32/abort-prefix
    68/push  0xc/imm32/row-size
    53/push-ebx/slice
    51/push-ecx
    # . . call
    e8/call  get-slice-or-stop/disp32
    # registers except esp may be clobbered at this point
    # restore register args, discard others
    59/pop-to-ecx
    5b/pop-to-ebx
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
    5a/pop-to-edx
$test-get-slice-or-stop:failure-assertion:
    # check that get-or-stop tried to call stop(1)
    # . check-ints-equal(ed->value, 2, msg)
    # . . push args
    68/push  "F - test-get-or-stop/1"/imm32
    68/push  2/imm32
    # . . push ed->value
    ff          6/subop/push        1/mod/*+disp8   2/rm32/edx    .           .             .           .           4/disp8         .                 # push *(edx+4)
    # . . call
    e8/call  check-ints-equal/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
$test-get-slice-or-stop:end:
    # . epilogue
    # don't restore esp from ebp; manually reclaim locals
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0x34/imm32        # add to esp
    5d/pop-to-ebp
    c3/return

# if no row is found, return null (0)
maybe-get:  # table: (addr stream {(handle array byte), T}), key: (addr array byte), row-size: int -> result/eax: (addr T)
    # pseudocode:
    #   curr = table->data
    #   max = &table->data[table->write]
    #   while curr < max
    #     var c: (addr array byte) = lookup(*curr)
    #     if string-equal?(key, c)
    #       return curr+8
    #     curr += row-size
    #   return 0
    #
    # . prologue
    55/push-ebp
    89/copy                         3/mod/direct    5/rm32/ebp    .           .             .           4/r32/esp   .               .                 # copy esp to ebp
    # . save registers
    51/push-ecx
    52/push-edx
    56/push-esi
    # esi = table
    8b/copy                         1/mod/*+disp8   5/rm32/ebp    .           .             .           6/r32/esi   8/disp8         .                 # copy *(ebp+8) to esi
    # var curr/ecx: (addr handle array byte) = table->data
    8d/copy-address                 1/mod/*+disp8   6/rm32/esi    .           .             .           1/r32/ecx   0xc/disp8       .                 # copy esi+12 to ecx
    # var max/edx: (addr byte) = &table->data[table->write]
    8b/copy                         0/mod/indirect  6/rm32/esi    .           .             .           2/r32/edx   .               .                 # copy *esi to edx
    8d/copy-address                 0/mod/indirect  4/rm32/sib    1/base/ecx  2/index/edx   .           2/r32/edx   .               .                 # copy ecx+edx to edx
$maybe-get:search-loop:
    # if (curr >= max) return null
    39/compare                      3/mod/direct    1/rm32/ecx    .           .             .           2/r32/edx   .               .                 # compare ecx with edx
    73/jump-if-addr>=  $maybe-get:null/disp8
    # var c/eax: (addr array byte) = lookup(*curr)
    # . . push args
    ff          6/subop/push        1/mod/*+disp8   1/rm32/ecx    .           .             .           .           4/disp8         .                 # push *(ecx+4)
    ff          6/subop/push        0/mod/indirect  1/rm32/ecx    .           .             .           .           .               .                 # push *ecx
    # . . call
    e8/call  lookup/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # if (string-equal?(key, c)) return curr+4
    # . eax = string-equal?(key, c)
    # . . push args
    50/push-eax
    ff          6/subop/push        1/mod/*+disp8   5/rm32/ebp    .           .             .           .           0xc/disp8       .                 # push *(ebp+12)
    # . . call
    e8/call  string-equal?/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # . if (eax != false) return eax = curr+8
    3d/compare-eax-and  0/imm32/false
    74/jump-if-=  $maybe-get:mismatch/disp8
    8d/copy-address                 1/mod/*+disp8   1/rm32/ecx    .           .             .           0/r32/eax   8/disp8         .                 # copy ecx+8 to eax
    eb/jump  $maybe-get:end/disp8
$maybe-get:mismatch:
    # curr += row-size
    03/add                          1/mod/*+disp8   5/rm32/ebp    .           .             .           1/r32/ecx   0x10/disp8      .                 # add *(ebp+16) to ecx
    # loop
    eb/jump  $maybe-get:search-loop/disp8
$maybe-get:null:
    b8/copy-to-eax  0/imm32
$maybe-get:end:
    # . restore registers
    5e/pop-to-esi
    5a/pop-to-edx
    59/pop-to-ecx
    # . epilogue
    89/copy                         3/mod/direct    4/rm32/esp    .           .             .           5/r32/ebp   .               .                 # copy ebp to esp
    5d/pop-to-ebp
    c3/return

test-maybe-get:
    # . prologue
    55/push-ebp
    89/copy                         3/mod/direct    5/rm32/ebp    .           .             .           4/r32/esp   .               .                 # copy esp to ebp
    # - setup: create a table with one row
    # var table/ecx: (stream {string, number} 24)   # 2 rows * 12 bytes/row
    81          5/subop/subtract    3/mod/direct    4/rm32/esp    .           .             .           .           .               0x18/imm32        # subtract from esp
    68/push  0x18/imm32/size
    68/push  0/imm32/read
    68/push  0/imm32/write
    89/copy                         3/mod/direct    1/rm32/ecx    .           .             .           4/r32/esp   .               .                 # copy esp to ecx
    # eax = get-or-insert(table, "code", 12 bytes/row, Heap)
    # . . push args
    68/push  Heap/imm32
    68/push  0xc/imm32/row-size
    68/push  "code"/imm32
    51/push-ecx
    # . . call
    e8/call  get-or-insert/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0x10/imm32        # add to esp
$test-maybe-get:success:
    # - check for the same key, verify that it was reused
    # eax = maybe-get(table, "code", 12 bytes/row)
    # . . push args
    68/push  0xc/imm32/row-size
    68/push  "code"/imm32
    51/push-ecx
    # . . call
    e8/call  maybe-get/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
    # check-ints-equal(eax - table->data, 8, msg)
    # . check-ints-equal(eax - table, 20, msg)
    # . . push args
    68/push  "F - test-maybe-get/0"/imm32
    68/push  0x14/imm32
    29/subtract                     3/mod/direct    0/rm32/eax    .           .             .           1/r32/ecx   .               .                 # subtract ecx from eax
    50/push-eax
    # . . call
    e8/call  check-ints-equal/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
    # no new row inserted
    # . check-ints-equal(table->write, row-size = 12, msg)
    # . . push args
    68/push  "F - test-maybe-get/1"/imm32
    68/push  0xc/imm32/row-size
    ff          6/subop/push        0/mod/indirect  1/rm32/ecx    .           .             .           .           .               .                 # push *ecx
    # . . call
    e8/call  check-ints-equal/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
    # var curr-addr/eax: (addr array byte) = lookup(table->data)
    # . . push args
    ff          6/subop/push        1/mod/*+disp8   1/rm32/ecx    .           .             .           .           0x10/disp8      .                 # push *(ecx+16)
    ff          6/subop/push        1/mod/*+disp8   1/rm32/ecx    .           .             .           .           0xc/disp8       .                 # push *(ecx+12)
    # . . call
    e8/call  lookup/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # check-strings-equal(curr-addr, "code", msg)
    # . . push args
    68/push  "F - test-maybe-get/2"/imm32
    68/push  "code"/imm32
    50/push-eax
    # . . call
    e8/call  check-strings-equal/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
$test-maybe-get:failure:
    # - search for a new key
    # eax = maybe-get(table, "data", 12 bytes/row)
    # . . push args
    68/push  0xc/imm32/row-size
    68/push  "data"/imm32
    51/push-ecx
    # . . call
    e8/call  maybe-get/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
    # check-ints-equal(eax, 0, msg)
    # . . push args
    68/push  "F - test-maybe-get/3"/imm32
    68/push  0/imm32
    50/push-eax
    # . . call
    e8/call  check-ints-equal/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
$test-maybe-get:end:
    # . epilogue
    89/copy                         3/mod/direct    4/rm32/esp    .           .             .           5/r32/ebp   .               .                 # copy ebp to esp
    5d/pop-to-ebp
    c3/return

# if no row is found, return null (0)
maybe-get-slice:  # table: (addr stream {(handle array byte), T}), key: (addr slice), row-size: int -> result/eax: (addr T)
    # pseudocode:
    #   curr = table->data
    #   max = &table->data[table->write]
    #   while curr < max
    #     var c: (addr array byte) = lookup(*curr)
    #     if slice-equal?(key, c)
    #       return curr+8
    #     curr += row-size
    #   return 0
    #
    # . prologue
    55/push-ebp
    89/copy                         3/mod/direct    5/rm32/ebp    .           .             .           4/r32/esp   .               .                 # copy esp to ebp
    # . save registers
    51/push-ecx
    52/push-edx
    56/push-esi
    # esi = table
    8b/copy                         1/mod/*+disp8   5/rm32/ebp    .           .             .           6/r32/esi   8/disp8         .                 # copy *(ebp+8) to esi
    # var curr/ecx: (addr handle array byte) = table->data
    8d/copy-address                 1/mod/*+disp8   6/rm32/esi    .           .             .           1/r32/ecx   0xc/disp8       .                 # copy esi+12 to ecx
    # var max/edx: (addr byte) = &table->data[table->write]
    8b/copy                         0/mod/indirect  6/rm32/esi    .           .             .           2/r32/edx   .               .                 # copy *esi to edx
    8d/copy-address                 0/mod/indirect  4/rm32/sib    1/base/ecx  2/index/edx   .           2/r32/edx   .               .                 # copy ecx+edx to edx
$maybe-get-slice:search-loop:
    # if (curr >= max) return null
    39/compare                      3/mod/direct    1/rm32/ecx    .           .             .           2/r32/edx   .               .                 # compare ecx with edx
    73/jump-if-addr>=  $maybe-get-slice:null/disp8
    # var c/eax: (addr array byte) = lookup(*curr)
    # . . push args
    ff          6/subop/push        1/mod/*+disp8   1/rm32/ecx    .           .             .           .           4/disp8         .                 # push *(ecx+4)
    ff          6/subop/push        0/mod/indirect  1/rm32/ecx    .           .             .           .           .               .                 # push *ecx
    # . . call
    e8/call  lookup/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # if (slice-equal?(key, c)) return curr+4
    # . eax = slice-equal?(key, c)
    # . . push args
    50/push-eax
    ff          6/subop/push        1/mod/*+disp8   5/rm32/ebp    .           .             .           .           0xc/disp8       .                 # push *(ebp+12)
    # . . call
    e8/call  slice-equal?/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # . if (eax != false) return eax = curr+8
    3d/compare-eax-and  0/imm32/false
    74/jump-if-=  $maybe-get-slice:mismatch/disp8
    8d/copy-address                 1/mod/*+disp8   1/rm32/ecx    .           .             .           0/r32/eax   8/disp8         .                 # copy ecx+8 to eax
    eb/jump  $maybe-get-slice:end/disp8
$maybe-get-slice:mismatch:
    # curr += row-size
    03/add                          1/mod/*+disp8   5/rm32/ebp    .           .             .           1/r32/ecx   0x10/disp8      .                 # add *(ebp+16) to ecx
    # loop
    eb/jump  $maybe-get-slice:search-loop/disp8
$maybe-get-slice:null:
    b8/copy-to-eax  0/imm32
$maybe-get-slice:end:
    # . restore registers
    5e/pop-to-esi
    5a/pop-to-edx
    59/pop-to-ecx
    # . epilogue
    89/copy                         3/mod/direct    4/rm32/esp    .           .             .           5/r32/ebp   .               .                 # copy ebp to esp
    5d/pop-to-ebp
    c3/return

test-maybe-get-slice:
    # . prologue
    55/push-ebp
    89/copy                         3/mod/direct    5/rm32/ebp    .           .             .           4/r32/esp   .               .                 # copy esp to ebp
    # - setup: create a table with one row
    # var table/ecx: (stream {string, number} 24)   # 2 rows * 12 bytes/row
    81          5/subop/subtract    3/mod/direct    4/rm32/esp    .           .             .           .           .               0x18/imm32        # subtract from esp
    68/push  0x18/imm32/size
    68/push  0/imm32/read
    68/push  0/imm32/write
    89/copy                         3/mod/direct    1/rm32/ecx    .           .             .           4/r32/esp   .               .                 # copy esp to ecx
    # insert(table, "code", 12 bytes/row, Heap)
    # . . push args
    68/push  Heap/imm32
    68/push  0xc/imm32/row-size
    68/push  "code"/imm32
    51/push-ecx
    # . . call
    e8/call  get-or-insert/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0x10/imm32        # add to esp
$test-maybe-get-slice:success:
    # - check for the same key, verify that it was reused
    # (eax..edx) = "code"
    b8/copy-to-eax  "code"/imm32
    8b/copy                         0/mod/indirect  0/rm32/eax    .           .             .           2/r32/edx   .               .                 # copy *eax to edx
    8d/copy-address                 1/mod/*+disp8   4/rm32/sib    0/base/eax  2/index/edx   .           2/r32/edx   4/disp8         .                 # copy eax+edx+4 to edx
    05/add-to-eax  4/imm32
    # var slice/edx: slice = {eax, edx}
    52/push-edx
    50/push-eax
    89/copy                         3/mod/direct    2/rm32/edx    .           .             .           4/r32/esp   .               .                 # copy esp to edx
    # eax = maybe-get-slice(table, "code" slice, 12 bytes/row)
    # . . push args
    68/push  0xc/imm32/row-size
    52/push-edx
    51/push-ecx
    # . . call
    e8/call  maybe-get-slice/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
    # check-ints-equal(eax - table->data, 8, msg)
    # . check-ints-equal(eax - table, 20, msg)
    # . . push args
    68/push  "F - test-maybe-get-slice/0"/imm32
    68/push  0x14/imm32
    29/subtract                     3/mod/direct    0/rm32/eax    .           .             .           1/r32/ecx   .               .                 # subtract ecx from eax
    50/push-eax
    # . . call
    e8/call  check-ints-equal/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
    # no new row inserted
    # . check-ints-equal(table->write, row-size = 12, msg)
    # . . push args
    68/push  "F - test-maybe-get-slice/1"/imm32
    68/push  0xc/imm32/row-size
    ff          6/subop/push        0/mod/indirect  1/rm32/ecx    .           .             .           .           .               .                 # push *ecx
    # . . call
    e8/call  check-ints-equal/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
    # var curr-addr/eax: (addr array byte) = lookup(table->data)
    # . . push args
    ff          6/subop/push        1/mod/*+disp8   1/rm32/ecx    .           .             .           .           0x10/disp8      .                 # push *(ecx+16)
    ff          6/subop/push        1/mod/*+disp8   1/rm32/ecx    .           .             .           .           0xc/disp8       .                 # push *(ecx+12)
    # . . call
    e8/call  lookup/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # check-strings-equal(curr-addr, "code", msg)
    # . . push args
    68/push  "F - test-maybe-get-slice/2"/imm32
    68/push  "code"/imm32
    50/push-eax
    # . . call
    e8/call  check-strings-equal/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
$test-maybe-get-slice:failure:
    # - search for a new key
    # (eax..edx) = "data"
    b8/copy-to-eax  "data"/imm32
    8b/copy                         0/mod/indirect  0/rm32/eax    .           .             .           2/r32/edx   .               .                 # copy *eax to edx
    8d/copy-address                 1/mod/*+disp8   4/rm32/sib    0/base/eax  2/index/edx   .           2/r32/edx   4/disp8         .                 # copy eax+edx+4 to edx
    05/add-to-eax  4/imm32
    # var slice/edx: slice = {eax, edx}
    52/push-edx
    50/push-eax
    89/copy                         3/mod/direct    2/rm32/edx    .           .             .           4/r32/esp   .               .                 # copy esp to edx
    # eax = maybe-get-slice(table, "data" slice, 12 bytes/row)
    # . . push args
    68/push  0xc/imm32/row-size
    52/push-edx
    51/push-ecx
    # . . call
    e8/call  maybe-get-slice/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
    # check-ints-equal(eax, 0, msg)
    # . . push args
    68/push  "F - test-maybe-get-slice/3"/imm32
    68/push  0/imm32
    50/push-eax
    # . . call
    e8/call  check-ints-equal/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
$test-maybe-get-slice:end:
    # . epilogue
    89/copy                         3/mod/direct    4/rm32/esp    .           .             .           5/r32/ebp   .               .                 # copy ebp to esp
    5d/pop-to-ebp
    c3/return

# . . vim:nowrap:textwidth=0