proc copy(int* restrict dest, int* restrict src, int n) for (int i = 0; i < n; i++) dest[i] = src[i];
tailcall fib(n-1) + fib(n-2);
| Mistake | Consequence | |---------|-------------| | Missing restrict | Missed vectorization, redundant loads | | Not using tailcall | Stack overflow in deep recursion | | Over-aligning structures | Wasted memory (padding) | | reg hints on all vars | Register spilling increases | Optimized C-- Pdf
Use tailcall to avoid stack growth: