You are not logged in. Your edit will be placed in a queue until it is peer reviewed.
We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.
Required fields*
How to Edit
- Correct minor typos or mistakes
- Clarify meaning without changing it
- Add related resources or links
- Always respect the author’s intent
- Don’t use edits to reply to the author
How to Format
- create code fences with backticks ` or tildes ~ ```
like so
``` - add language identifier to highlight code ```python
def function(foo):
print(foo)
``` - put returns between paragraphs
- for linebreak add 2 spaces at end
- _italic_ or **bold**
- indent code by 4 spaces
- backtick escapes
`like _so_` - quote by placing > at start of line
- to make links (use https whenever possible) <https://example.com>[example](https://example.com)<a href="https://example.com">example</a>
- MathJax equations
\$\sin^2 \theta\$
How to Tag
A tag is a keyword or label that categorizes your question with other, similar questions. Choose one or more (up to 5) tags that will help answerers to find and interpret your question.
- complete the sentence: my question is about...
- use tags that describe things or concepts that are essential, not incidental to your question
- favor using existing popular tags
- read the descriptions that appear below the tag
If your question is primarily about a topic for which you can't find a tag:
- combine multiple words into single-words with hyphens (e.g. code-golf), up to a maximum of 35 characters
- creating new tags is a privilege; if you can't yet create a tag you need, then post this question without it, then ask the community to create it for you
retinstruction as well (one byte). And that's assuming a custom calling convention whereeaxis used as an arg-passing register. (The Irvine32 asm teaching library does that, but no standard calling conventions for x86-32 or x86-64 do that, unlike on ARM where the return-value registerr0is also the first arg-passing register.) Custom calling conventions are fine in asm functions though, so you don't need to change it to 3 bytelea (%ecx, %edx), %eax+ 1 byteretfor Microsoft__fastcallor gcc-mregparm. \$\endgroup\$popis only 1 byte, butesp-relative addressing modes need a SIB byte. So a caller-pops calling convention mightpop %ecx(the return address),pop %eax/pop %edx/add %edx, %eax(2 bytes) /jmp *%ecx(2 bytes) = 7 bytes total. vs.mov 4(%esp), %eax(4B) /add 8(%esp), %eax(4B) /ret= 9 bytes, or 11 bytes for a caller-pops version of that usingret imm16, if I did that right. It's an extra 1 byte for the SIB with ESP as a base, and an extra 1 byte for the disp8 in each insn. \$\endgroup\$ret(or ajmpor something). Just like a C answer must befoo(x){return x+x;}notx+x. Yes, such functions are fully allowed to take args in registers, as per Tips for golfing in x86/x64 machine code, like a function with a custom calling convention. \$\endgroup\$retorjmpmay be conventional, there's nothing that really requires that. I think it's perfectly reasonable to put a label at the top of some n lines and call it a subroutine. Further, I did include a link to a full running program. \$\endgroup\$