Reaching into two inner structs
You just saw a .a.b access boil down to one offset. Two of them isn't any harder, even when each one lives in a separate inner struct of the same outer struct. The field you want still has exactly one absolute offset. You get it by adding where the inner struct starts to where the field sits inside it. After that the two loads just combine, same as any other pair of fields.
Put two of the same inner type back to back and the second one starts a whole inner-struct later. Here's a range built out of two Pairs:
typedef struct { int a; int b; } Pair;
typedef struct { Pair lo; Pair hi; } Range;
int Range_sumB(Range* r) {
return r->lo.b + r->hi.b;
}
lo starts at offset 0. hi comes right after it at offset 8, past the 8-byte Pair. And b is always +4 into a Pair, so lo.b works out to 4 and hi.b to 8 + 4 = 12:
lwz r4, 4(r3) # r->lo.b (0 + 4)
lwz r0, 12(r3) # r->hi.b (8 + 4)
add r3, r4, r0
blr
See how the two displacements are exactly sizeof(Pair) apart? That's the giveaway. It's one field, read out of two inner structs sitting side by side. To take a pair of loads like this apart, peel each offset into the inner struct it picks and the field it lands on.
Your target pulls a field from each inner struct and joins them with a different operation. Peel each offset into outer plus inner, then put the combine back together.
Your task
With the structs above, write AABB_spanX to reproduce the assembly above.