Similar questions 1 more →
Code Optimization & Data-Flow Analysis

Answer & solution
Official answer: A
Our answer: A with algebraic simplification
Step 1: Preserve old values when tracking assignments: let the input leaves be b0,c0,d0. The first three operations create u=b0+c0, v=u+d0, w=b0+v. The current c is v and current d is w. Step 2: Algebraically, e=w−b0=(b0+v)−b0=v, and final a=e+b0=v+b0=w. Therefore e shares v's node and a shares w's node. Step 3: The minimized DAG has three input leaves and three binary addition nodes: six nodes. Each operation has two incoming operand edges, giving six edges, A. Without cancellation, a purely syntactic DAG gives eight nodes and ten edges. The keyed minimum assumes valid algebraic identities, not unrestricted floating-point cancellation.