Pointer reads meet integer arithmetic
In a register, an array element is nothing special, just an integer, and everything from the Integer Arithmetic chapter still applies. Here the work is small. An element gets loaded, multiplied by some constant, and added to a neighbour. When the constant isn't a power of two the compiler can't shift, so it reaches for mulli rD, rA, n (multiply low immediate) and parks the multiplier n inside the instruction itself. Powers of two stay the exception, folding down to a slwi the way they did in those earlier lessons.
blend(q) is a good example. Three elements come in, the middle one gets scaled by 5, and the three are combined:
lwz r0, 4(r3) # q[1]
lwz r4, 0(r3) # q[0]
mulli r0, r0, 5 # q[1] * 5
lwz r3, 12(r3) # q[3] (displacement 12 / 4 = index 3)
add r0, r4, r0 # q[0] + q[1]*5
subf r3, r3, r0 # r0 - q[3]
blr
Loads gather the elements. mulli handles the scale. The running total flows through add and subf. To recover the C, read the assembly backwards. Each displacement becomes an index, and the mulli immediate becomes the multiplier. Your target wears the same load-scale-combine shape, only with different indices, a different multiplier, and a different combine at the end.
Your task
Write weight, taking one int*, to reproduce the assembly above.