<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">\begin{algorithmic}
    \Function{staticdeps}{basic\_block}
        \State{} deps $\gets{} \emptyset{}$
        \State{} insn\_count, cur\_iter, cur\_instruction $\gets{} 0$
        \State{} shadow\_memory, shadow\_registers, last\_wrote\_at $\gets{} \emptyset_\text{map}$

        \medskip{}

        \Function{fresh}{}
            \State{} \textbf{return} random uint64\_t value
        \EndFunction{}

        \smallskip{}

        \Function{read\_memory}{address}
            \State{} \textbf{Assert} address \neq{} ⊥
            \If{address \not\in{} shadow\_memory}
                \State{} shadow\_memory[address] $\gets$ \Call{fresh}{}
            \EndIf{}
            \State{} \Return{} shadow\_memory[address]
        \EndFunction{}

        \Function{read\_register}{register}
            \Comment{likewise, without dependency tracking}
        \EndFunction{}

        \smallskip{}

        \Function{expr\_value}{expr}
            \If{expr == Register(reg)}
                \State{} \Return{} \Call{read\_register}{reg}
            \ElsIf{expr == Memory(addr\_expr)}
                \State{} addr $\gets{}$ \Call{expr\_value}{expr}
                \If{addr \in{} last\_wrote\_at}
                    \State{} deps $\gets{}$ deps \cup{} (last\_wrote\_at[addr] \to{} (cur\_iter, cur\_instruction))
                \EndIf{}
                \State{} \Return{} \Call{read\_memory}{addr}
            \ElsIf{expr == IntegerArithmeticOp(operator, op1, …, opN)}
                \If{\Call{expr\_value}{op\_i} == ⊥ for any i}
                    \State{} \Return{} ⊥
                \EndIf{}
                \State\Return{} semantics(operator)(\Comment{provided by Valgrind's Vex}
                    \State{} \quad \Call{expr\_value}{op1}, …, \Call{expr\_value}{opN})
            \Else{}
                \Return{} ⊥
            \EndIf{}
        \EndFunction{}

        \Function{iter\_statement}{statement}
            \State{} lhs, rhs \gets{} statement
            \If{lhs == Register(reg)}
                \State{} shadow\_register[reg] \gets{} \Call{expr\_value}{rhs}
            \ElsIf{lhs == Memory(addr\_expr)}
                \State{} addr \gets{} \Call{expr\_value}{addr\_expr}
                \State{} last\_wrote\_at[addr] \gets{}(cur\_iter, cur\_instruction)
                \State{} shadow\_memory[addr] &lt;- \Call{expr\_value}{rhs}
            \ElsIf{\ldots}
                \Comment{Etc.}
            \EndIf{}
        \EndFunction{}

        \medskip{}

        \While{insn\_count &lt;= |ROB| + |basic\_block|}
        \State{} cur\_instruction \gets{} 0
            \For{statement \in{} basic\_block}
                \State{} \Call{iter\_statement}{statement}
                \If{statement is last statement of an instruction}
                    \State{} \Comment{An instruction can be composed of multiple statements}
                    \State{} cur\_instruction \gets{} cur\_instruction + 1
                \EndIf{}
            \EndFor{}
            \State{} cur\_iter \gets{} cur\_iter + 1
        \EndWhile{}
        \State{} \Return{} deps
    \EndFunction{}
\end{algorithmic}
</pre></body></html>