Every oracle at once
Capstone time. One function, three pointers of three different types, and an expression that leans on the whole chapter. First, a warm-up decode — blend2, the average of two unsigned bytes:
s32 blend2(u8 *p, u8 *q) {
return (*p + *q) >> 1;
}
lbu t6, 0(a1) # *q — u8
lbu t7, 0(a0) # *p — u8
addu v0, t6, t7 # the sum, full 32-bit width
sra t8, v0, 1 # >> 1 — signed shift on the s32 sum
or v0, t8, zero
jr ra
nop
The subtlety is the sra. Both inputs are unsigned bytes — so why not srl? Because C promotes narrow values to int before arithmetic: *p + *q is an s32 sum of two small numbers, and >> on a signed value is sra. The loads tell you the pointers' types; the arithmetic runs at full width under signed rules; only edges (loads, stores, casts, narrow returns) ever narrow anything. That promotion rule is why byte-heavy code still reads like ordinary integer code in the middle.
Now the target. Inventory its loads — three mnemonics, three widths and signedness, three pointer declarations handed to you. Then read the arithmetic as plain s32 work: what's added, what's subtracted, what's halved, in what order. The operand order on the subu and the register feeding the sra pin the expression's shape. One return line covers everything after the loads.
Declarations from mnemonics, expression from dataflow — the two halves of this chapter, and of most functions you'll ever match.
Your task
Write func_803a4904 to reproduce the target assembly.