CASM Functions
A function declaration starts with the lowercase keyword function, followed by its name and parameter and capture counts separated by a semicolon:
casm
function <name>(<parameter-count>;<capture-count>):
<instruction> [operand [, operand ...]]
...Both counts are integer literals from 0 through 8. Function names follow the identifier rules in Syntax.
The function body ends when the next function declaration begins or the file ends. Every function needs at least one instruction. Parameters occupy registers starting at r1; captured values follow the parameters. See Registers and the closure instructions.
If a function does not end with ret, CandleC appends ret void when compiling it. The ret instruction documents the return operand.