How was this table generated using a de Bruijn sequence? We have this obscure reference to a "de Bruijn sequence" which is somehow related to this table:
/* Using a de Bruijn sequence. This is a table lookup with a 32-entry
table. The de Bruijn sequence used here is
                0000 0100 1101 0111 0110 0101 0001 1111,
obtained from Danny Dube's October 3, 1997, posting in
comp.compression.research. Thanks to Norbert Juffa for this reference. */

int ntz10(unsigned x) {

  static char table[32] =
    { 0, 1, 2,24, 3,19, 6,25,  22, 4,20,10,16, 7,12,26,
      31,23,18, 5,21, 9,15,11,  30,17, 8,14,29,13,28,27};

  if (x == 0) return 32;
  x = (x & -x)*0x04D7651F;
  return table[x >> 27];
}

How did that table get generated?
[
   0, 1,   2, 24,  3, 19,  6, 25,
  22, 4,  20, 10, 16,  7, 12, 26,
  31, 23, 18,  5, 21,  9, 15, 11,
  30, 17,  8, 14, 29, 13, 28, 27
]

Where did those numbers come from? The end goal is to figure out what algorithm was used to generate this table.
 A: The De Bruijn sequence listed there is encoded in the constant 0x04D7651F.
The expression (x&-x) extracts the lowest bit from the variable x, i.e. it is a number with just a single bit set. Let's say the i-th bit is the one that is set. When this is multiplied by that constant and shifted right by 27 steps, what you get is the i-th 5-bit string from the De Bruijn sequence, which is some number between 0 and 31.
The De Bruijn sequence gives a quick way to convert any exact power of 2 to some number between 0 and 31. Unfortunately the number you get does not exactly match the exponent of the power of 2. They come out in the wrong order. Therefore the numbers need to be permuted back to the right order, and that is what the table is for. It is basically the inverse permutation of the De Bruijn sequence.
For example, the number $3=00011_2$ occurs at the $24$th bit position in the De Bruijn sequence (the first five bits of 1F). Therefore, table[3]=24. That way, if the lowest bit of x is the 24th bit, the DeBruijn sequence gives 3 at that position, and the table reverts that back to 24.
