The negu diamond
Some diamonds are so common they read as a single word. Here's one of them warming up — a helper that negates its second argument when a flag is set, if (f) x = -x; return x;:
0: beqzl a0, 0x10 # flag clear? keep x untouched —
4: or v0, a1, zero # (likely slot) the as-is copy, taken path only
8: negu a1, a1 # flag set: flip the sign
c: or v0, a1, zero
10: jr ra
14: nop
negu you've known since the warmup — 0 - x, the negation. Guarded by a condition and if-converted onto a likely branch, it's "maybe negate": the duplicated copy-out from the branch-likely lesson, with negu as the guarded work.
Now put a sign test in charge of that same negation and you get one of the most recognizable idioms in compiled C — absolute value: "if it's negative, negate it." The target below is exactly that, but IDO shapes it as the full ternary diamond rather than the likely form: a bgez choosing between two arms, one arm a copy, the other a negu, both meeting in v1 before the join copies to v0.
Two ways to write matching C for that shape:
if (x < 0) { ... } /* statement form */
return x < 0 ? ... : ...; /* expression form */
Both compile identically here — the diamond doesn't care how the C spells it. What it does care about: the branch is bgez, so the fall-through (non-taken) path is the negative case — trace which arm holds the negu and make your condition agree.
Your task
Write func_802964ac to reproduce the target assembly.