4 ms·
Just literally draw a flowchart of what your program is supposed to do, then translate that flowchart. Something like each box gets its own label, diamonds are
by pdpi 4y ago
Just literally draw a flowchart of what your program is supposed to do, then translate that flowchart. Something like each box gets its own label, diamonds are just some variation on `jz some-box-label`, etc.
The problem with assembly isn't that it's too complex, it's that it's way too simple, so it's exceedingly easy to lose track of how your higher-level thought process maps to assembly code. The flowchart serves as an intermediate representation between the two — something you can reason about at a high level, but can almost mindlessly, mechanically translate to assembly.