YSH4YZQTU34SS3RGOIKTIFJS5MFACNIEGIXBYIRBKQFNG4OJWQHQC
GF4WTRMY4V6PYJIQCXXFJWQUPZKJC4O2M73WFVQ2ODYDVRSLO5OQC
Z5FLR3LAG3VY2QF7PMM3BU3MCDSCRZNY7GUUYRT7LF4EK5PNJJLAC
LIZLRMXKIAS26HOLF62CWPZ3GSRVOKZPMSF537OH4LALRZLRXHXAC
V4DL4DHUIDACFVBYJXKHLTGRMBV5V5EK2MTGESXW62656UDUVNJAC
KFLYOSTI7YNXINV7WSZ2YYOL66GHXP5SVGD6HX4ECXZL4N2LLYCQC
KVDC7QI5DWVMAAX7F5BTB7WIZO2T7FCN4DSDCN3SG2LNROB6WQ7AC
VUTPXHZOHNZE7EWKYSPMU4Q4U5F3OPPHVBFKZCLCBYCW2TUPUPEAC
BYQMDP2IKXLPX4G3AXE26QVFRRKFU665REQCT7L2P37B4DLGI2TAC
ZWKILT2IJQ4PELLVZ7MSKFLS6CK4WFXPPENCNCDG46JLI67B743QC
defp compile_function_params([param | rest], acc) do
compile_function_params(rest, [compile_function_param(param) | acc])
defp compile_function_locals([], acc) do
acc |> Enum.reverse() |> List.flatten()
end
defp compile_function_locals([locals | rest], acc) do
%{num: num, type: type} = locals
vars = Enum.map(0..(num - 1), fn _ -> new_variable(type) end)
compile_function_locals(rest, [vars | acc])
defp compile_function_body([instr | rest], params, acc) do
{beam_instr, acc} = compile_instruction(instr, params, acc)
compile_function_body(rest, params, [beam_instr | acc])
defp compile_function_body([instr | rest], locals, acc) do
{beam_instr, acc} = compile_instruction(instr, locals, acc)
compile_function_body(rest, locals, [beam_instr | acc])