The greatest common divisor (gcd) of positive integers a and b is the greatest positive integer dividing both. Euclid’s algorithm preserves the gcd while replacing the larger argument with the remainder of division. section 7.3
Recursive gcd of 18 and 30
The recursive calls reduce gcd2(18, 30) to gcd2(12, 18), then gcd2(6, 12), and finally return 6 when the remainder becomes zero. section 7.3
inline size_t gcd2(size_t a, size_t b) [[__unsequenced__]] { 1
assert(a <= b); 2
if (!a) return b; 3
size_t r = b % a; 4
return gcd2(r, a);
}
Use the compact C implementation to follow argument ordering, the zero-remainder base case, modulus computation, and recursive descent. section 7.3

