https://github.com/akkartik/mu/blob/master/310copy-bytes.subx
  1 # Some helpers for copying non-overlapping regions of memory.
  2 # Really only intended to be called from code generated by mu.subx.
  3 
  4 == code
  5 
  6 copy-bytes:  # src: (addr byte), dest: (addr byte), size: int
  7     # pseudocode:
  8     #   curr-src/esi = src
  9     #   curr-dest/edi = dest
 10     #   i/ecx = 0
 11     #   while true
 12     #     if (i >= size) break
 13     #     *curr-dest = *curr-src
 14     #     ++curr-src
 15     #     ++curr-dest
 16     #     ++i
 17     #
 18     # . prologue
 19     55/push-ebp
 20     89/<- %ebp 4/r32/esp
 21     # . save registers
 22     50/push-eax
 23     51/push-ecx
 24     52/push-edx
 25     56/push-esi
 26     57/push-edi
 27     # curr-src/esi = src
 28     8b/-> *(ebp+8) 6/r32/esi
 29     # curr-dest/edi = dest
 30     8b/-> *(ebp+0xc) 7/r32/edi
 31     # var i/ecx: int = 0
 32     b9/copy-to-ecx 0/imm32
 33     # edx = size
 34     8b/-> *(ebp+0x10) 2/r32/edx
 35     {
 36       # if (i >= size) break
 37       39/compare %ecx 2/r32/edx
 38       7d/jump-if->=  break/disp8
 39       # *curr-dest = *curr-src
 40       8a/byte-> *esi 0/r32/AL
 41       88/byte<- *edi 0/r32/AL
 42       # update
 43       46/increment-esi
 44       47/increment-edi
 45       41/increment-ecx
 46       eb/jump loop/disp8
 47     }
 48 $copy-bytes:end:
 49     # . restore registers
 50     5f/po
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module ranger.shared.settings</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head><body bgcolor="#f0f0f8">

<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong><a href="ranger.html"><font color="#ffffff">ranger</font></a>.<a href="ranger.shared.html"><font color="#ffffff">shared</font></a>.settings</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><