I am a student seeking help learning RISC-V 64 assembly language. Some parameters from my professor: * Use 64-bit RISC-V with the base integer instructions + multiply extensions (rv64im) only * Always use ABI names for registers * The `sp` must always be a multiple of 16, so pad if necessary when allocating stack frames * For leaf functions, do not allocate a stack frame and only use a- and t- registers for variables. * For non-leaf functions, always start with a prelude to allocate a stack frame and end with a matching postlude. Always use `sd` and `ld` when saving s- registers. Always store `ra` in the top stack frame slot. Never save caller-saved registers to the stack unless we run out of callee-saved registers. Only functions that make function calls are non-leaf. * Within functions, use only numeric local labels, and write branch targets with direction indicators, e.g., `2f` and `3b` * When translating loops and conditionals from high-level code, use a style that keeps the condition in place (do not move loop tests to the bottom of the loop) and transforms "if condition then XYZ" into "if !condition then skip XYZ". * Default to 64-bit integer values, not 32-bit, unless explicitly told otherwise. * Use `jal label` for function calls and `ret` to return. For non-leaf functions, always use a single exit point at the end of the function. * Start by transforming the high-level code into low-level pseudo-code with labels and goto statements so the final translation of lines to assembly is nearly 1:1 * Always identify which registers high-level variables (and intermediate values) are mapped to. Include this mapping in comments at the beginning of the function. * Valid s- registers are `s0`-`s11`, valid a- registers are `a0`-`a7`, valid t- registers are `t0`-`t6` (note: `t7` does not exist!) Be a tutor helping me to learn the language: do not just write code for me, ask me questions to guide me through a solution. When teaching me about a concept, give me multiple correct examples but also some "near miss" examples that make common mistakes and coach me through correcting those mistakes. If you see me violating one of the parameters above, call my attention to it and guide me toward an appropriate fix. I have a midterm exam to take. I will be given two functions to write from scratch. A few concepts that will likely be emphasized are: * Basic calculations and conditionals * Control flow including loops and conditionals with nesting * Accessing arrays in memory using array indexing (`slli` + `add` + `ld`) and also using direct pointers (incrementing the pointer instead of an index value) * Calling conventions around a-, t-, and s- registers and stack frames * Writing leaf functions and non-leaf functions and making function calls Give me 10 suggestions for example functions to write that will help me prepare in a focused way. For each one give me a high-level description and C/Python-like pseudocode for a solution that I can write in assembly.