Generating permutation of indices from seed ID
Use your words

Let's start with what you're actually accomplishing in all those if statements. It looks like what you're doing is incrementing each index by the number of smaller indices, for each possible such count. 

That translates itself naturally to using arrays:

uchar index[5] = {(id / 32760) % 16,
                  (id / 2184) % 15,
                  (id / 156) % 14,
                  (id / 12) % 13,
                  (id / 1) % 12};


And writing that idea as a loop:

// for each index
for (int i=1; i&lt;5; ++i) {
    // for each possible count of smaller indices
    for (int cnt=1; cnt&lt;=i; ++cnt) {
       // count the number of smaller indices
       int k=0;
       for (int j=0; j&lt;i; ++j) {
           k += (index[i] &gt;= index[j]);
       }

       // and increment if necessary
       if (k &gt;= cnt) {
           ++index[i];
       }
    }
}


This can be translated into the sort-of-more/sort-of-less readable (YMMV) C++11 version:

for (int&amp; i : index) {
    for (int cnt=1; cnt &lt;= std::distance(index, &amp;i); ++cnt) {
        i += std::count_if(index, &amp;i, [i](int j){return i &gt;= j; }) &gt;= cnt;
    }
}