Exercise 1: Translating Intel Syntax Into AT&T Syntax — Possible Solution ==================================================================== GIVEN (INTEL SYNTAX) ------------------------------ MOV RAX, RCX SUB RAX, 10 APPLYING THIS CHAPTER'S OWN TRANSLATION RULES ------------------------------ Per the chapter's own table: - Operand order reverses (source first in AT&T, not destination first) - Registers get a % prefix - Immediates get a $ prefix - The mnemonic gets a size suffix — here, q for quadword (64-bit), matching RAX/RCX's own 64-bit width TRANSLATING MOV RAX, RCX ------------------------------ Intel: destination RAX, source RCX AT&T: source first, so %rcx comes first, then %rax Result: movq %rcx, %rax TRANSLATING SUB RAX, 10 ------------------------------ Intel: destination RAX, source (immediate) 10 AT&T: source first, so $10 comes first, then %rax; immediate gets the $ prefix, register gets the % prefix Result: subq $10, %rax FULL AT&T TRANSLATION ------------------------------ movq %rcx, %rax subq $10, %rax WHY THIS WORKS AS AN ANSWER ------------------------------ It correctly reverses the operand order for both instructions (a common point of error), correctly applies the % and $ prefixes to registers and immediates respectively, and correctly appends the q suffix matching the 64-bit register width used throughout — all per the chapter's own stated conversion rules.