REFERENCE GUIDE

Assembly reading: widths, flags, and ABI contracts

Assembly interpretation depends on operand width, signedness, flags, and the calling convention.

Also known as: ABI · signed branches

assembly-and-abireversing

Mechanism

Assembly interpretation depends on operand width, signedness, flags, and the calling convention. A comparison instruction sets flags; the following branch determines whether the relation is signed or unsigned. Narrow register writes and extensions can change the upper bits, creating behavior that an incorrect decompiler type obscures.

Practical method

Identify the architecture and ABI, then annotate inputs and return values. Track the width of every load, arithmetic operation, and comparison in the validation path. Derive branch conditions from the actual conditional jump and verify them with boundary inputs.

compare x,y -> flags -> signed or unsigned branch
load byte -> zero/sign extend -> wider arithmetic

Interpreting evidence

Confirm one loop iteration with concrete values. Recording the register state before and after an instruction exposes implicit effects and gives a reliable model for implementing an equivalent checker.

Pitfalls and limits

Endianness affects memory representation, not the abstract integer value. Optimized arithmetic may implement division with multiplication and shifts. Registers used for arguments differ between operating-system ABIs.

Sources & further reading

  1. System V ABI ↗elf
  2. x64 calling convention ↗microsoft

Content license: CC-BY-4.0. Source-derived sections retain their cited licenses and redistribution notices. How this reference is compiled →