The other kind of switch
In the control chapter you met the compare chain — a cascade of cmpwi / beq- / bge- that bisects a handful of cases. But when the cases are dense and numerous (here 0..7, all consecutive), MWCC stops comparing one value at a time and builds a computed jump: it uses x itself as an index into a table of code addresses.
cmplwi r3, 7 # bounds check: is x in 0..7?
bgt- .default # above the table -> default arm
lis r4, table@ha # load the upper 16 bits of the @switch table address...
slwi r0, r3, 2 # x * 4 (each table entry is a 4-byte address)
addi r3, r4, table@lo # ...add the lower 16 bits -> r3 = full table base
lwzx r0, r3, r0 # load table[x] -> the target address
mtctr r0 # move it into the count register
bctr # branch to CTR -> jump straight to case x
Three fingerprints give it away: the single cmplwi bounds check (note cmplwi, unsigned — a negative x wraps to a huge value and fails the check for free), the slwi r0, r3, 2 index scaling, and the lwzx → mtctr → bctr trio that loads an address from a @switch rodata table and jumps through it. After bctr, each case is its own tiny li r3, N / blr block. No per-case compares at all — the dispatch is O(1).
Your task
Write dispatch(int x): a switch on x with eight consecutive cases and a default. Read the li r3, N values in each case arm from the assembly above to recover what each case returns. Eight dense cases is past the threshold, so this compiles to the table form.