The order you wrote the operands in is still there
Thumb's register add has two encodings, and agbcc picks between them for a reason you can read backwards.
The two-operand form is the cheap default. Here is x + y for the first two arguments:
0 add r0, r1
2 bx lr
r0 = r0 + r1. The destination already held the left operand, the sum needs to end up in r0 anyway, so one encoding covers the whole expression.
Swap the two operands in the source. The sum is the same number, and the instruction is different:
0 add r0, r1, r0
2 bx lr
r0 = r1 + r0. The left operand is in r1 this time, and the answer still has to land in r0, so the two-operand form no longer fits: it can only write to the register holding the left side. gcc reaches for the three-operand encoding and names r0 twice, as the right-hand source and as the destination.
add r0, r1, r0 is the fingerprint of an addition whose left operand was the second argument, and there is no cheaper way to spell it. When you see the destination register repeated as the last source of an add, the source wrote that operand on the right.
Once the accumulator is established, everything after it folds in with the two-operand form — each add overwrites r0 with the running total, because nothing needs the intermediate values again.
Read your target from the top. The first instruction fixes the operand order for you; the rest just pile on.
Your task
Write func_08031f10 to reproduce the target assembly.