https://github.com/akkartik/mu/blob/main/linux/308allocate-array.subx

     1 # 2-arg version of allocate-array.
     2 # Really only intended to be called from code generated by mu.subx.
     3
     4 == code
     5
     6 allocate-array2:  # ad: (addr allocation-descriptor), array-len: int, elem-size: int, out: (addr handle array _)
     7     # . prologue
     8     55/push-ebp
     9     89/<- %ebp 4/r32/esp
    10     # . save registers
    11     50/push-eax
    12     52/push-edx
    13     #
    14     8b/-> *(ebp+0xc) 0/r32/eax
    15     f7 4/subop/multiply-into-edx-eax *(ebp+0x10)
    16     # TODO: check edx for overflow
    17     (allocate-array *(ebp+8) %eax *(ebp+0x14))
    18 $allocate-array2:end:
    19     # . restore registers
    20     5a/pop-to-edx
    21     58/pop-to-eax
    22     # . epilogue
    23     89/<- %esp 5/r32/ebp
    24     5d/pop-to-ebp
    25     c3/return