--- a/hws/hw09.tex Thu Dec 01 13:07:32 2022 +0000
+++ b/hws/hw09.tex Fri Dec 02 16:26:20 2022 +0000
@@ -44,6 +44,38 @@
if_icmpge label
\end{lstlisting}
+\item What does the following JVM function calculate?
+
+\begin{lstlisting}[language=JVMIS2,numbers=none]
+.method public static bar(I)I
+.limit locals 1
+.limit stack 9
+ iload 0
+ ldc 0
+ if_icmpne If_else_8
+ ldc 0
+ goto If_end_9
+If_else_8:
+ iload 0
+ ldc 1
+ if_icmpne If_else_10
+ ldc 1
+ goto If_end_11
+If_else_10:
+ iload 0
+ ldc 1
+ isub
+ invokestatic bar(I)I
+ iload 0
+ ldc 2
+ isub
+ invokestatic bar(I)I
+ iadd
+If_end_11:
+If_end_9:
+ ireturn
+.end method
+\end{lstlisting}
\item What does the following LLVM function calculate? Give the
corresponding arithmetic expression .