This is a compiler internals tutorial disguised as a blog post. The author walks through every lowering strategy GCC uses for switch statements — jump tables, comparison trees, contiguous-range folding, and bitset membership tests — and demonstrates each one by reading the assembly output. The approach is empirical: write C, compile it, read the machine code, form a hypothesis about the heuristic, then test the hypothesis by tweaking case values. The jump table section establishes the baseline. Consecutive case labels become an indirect jump through a pointer array, and GCC subtracts a constant offset when labels don't start at zero (the lea [rdi-97] trick). The interesting question is when GCC stops using jump tables. Through experimentation, the author finds the threshold: roughly 8 table entries per actual case label. Cross that density ratio and GCC falls back to a binary comparison tree. The comparison tree section is where the post earns its keep. The author visualizes the tree structure — a balanced binary search over case values, with leaves that either jump to handler code or return the default. The key insight is that GCC counts comparisons after range folding, not raw case labels, when deciding whether a jump table is worth the memory. Contiguous cases like case 42: case 43: case 44: case 45: collapse into two comparisons (cmp eax, 45; jg and cmp eax, 41; jg), which changes the cost calculus entirely. The bitset lowering is the showstopper. When multiple non-contiguous cases all lead to the same code block, GCC encodes the set of matching values as an integer bitmask and uses the bt (bit test) instruction to check membership in a single operation. The constant 2753205 in the assembly is the bitmask itself — its set bits correspond to the ASCII values of the case labels minus 48. This is the kind of optimization that looks like magic in disassembly until someone explains the encoding. The author then starts walking through GCC's actual source code — passlowerswitch and analyzeswitchstatement — translating the gimple IR manipulation into plain English. The post cuts off partway through this section, suggesting it's either a work in progress or part of a series. What's present is meticulous: every assembly listing is annotated, every heuristic is tested experimentally before being confirmed in source. The pedagogical structure is sound. Each example builds on the last, and the author resists the temptation to dump the source code first. You see the effect of each optimization in assembly, form your own mental model, and then get the implementation details. This is how compiler internals should be taught — from the output backward, not from the IR forward.