unsigned int ff_vorbis_nth_root(unsigned int x, unsigned int n) {
    unsigned int ret=0, i, j;
    do {
        ++ret;
        for(i=0,j=ret;i<n-1;i++) j*=ret;
    } while (j<=x);
    return (ret-1);
}
['static int vorbis_parse_setup_hdr_codebooks(vorbis_context *vc) {\n    uint_fast16_t cb;\n    uint8_t *tmp_vlc_bits;\n    uint32_t *tmp_vlc_codes;\n    GetBitContext *gb=&vc->gb;\n    vc->codebook_count=get_bits(gb,8)+1;\n    AV_DEBUG(" Codebooks: %d \\n", vc->codebook_count);\n    vc->codebooks=av_mallocz(vc->codebook_count * sizeof(vorbis_codebook));\n    tmp_vlc_bits =av_mallocz(V_MAX_VLCS * sizeof(uint8_t));\n    tmp_vlc_codes=av_mallocz(V_MAX_VLCS * sizeof(uint32_t));\n    for(cb=0;cb<vc->codebook_count;++cb) {\n        vorbis_codebook *codebook_setup=&vc->codebooks[cb];\n        uint_fast8_t ordered;\n        uint_fast32_t t, used_entries=0;\n        uint_fast32_t entries;\n        AV_DEBUG(" %d. Codebook \\n", cb);\n        if (get_bits(gb, 24)!=0x564342) {\n            av_log(vc->avccontext, AV_LOG_ERROR, " %"PRIdFAST16". Codebook setup data corrupt. \\n", cb);\n            goto error;\n        }\n        codebook_setup->dimensions=get_bits(gb, 16);\n        if (codebook_setup->dimensions>16) {\n            av_log(vc->avccontext, AV_LOG_ERROR, " %"PRIdFAST16". Codebook\'s dimension is too large (%d). \\n", cb, codebook_setup->dimensions);\n            goto error;\n        }\n        entries=get_bits(gb, 24);\n        if (entries>V_MAX_VLCS) {\n            av_log(vc->avccontext, AV_LOG_ERROR, " %"PRIdFAST16". Codebook has too many entries (%"PRIdFAST32"). \\n", cb, entries);\n            goto error;\n        }\n        ordered=get_bits1(gb);\n        AV_DEBUG(" codebook_dimensions %d, codebook_entries %d \\n", codebook_setup->dimensions, entries);\n        if (!ordered) {\n            uint_fast16_t ce;\n            uint_fast8_t flag;\n            uint_fast8_t sparse=get_bits1(gb);\n            AV_DEBUG(" not ordered \\n");\n            if (sparse) {\n                AV_DEBUG(" sparse \\n");\n                used_entries=0;\n                for(ce=0;ce<entries;++ce) {\n                    flag=get_bits1(gb);\n                    if (flag) {\n                        tmp_vlc_bits[ce]=get_bits(gb, 5)+1;\n                        ++used_entries;\n                    }\n                    else tmp_vlc_bits[ce]=0;\n                }\n            } else {\n                AV_DEBUG(" not sparse \\n");\n                used_entries=entries;\n                for(ce=0;ce<entries;++ce) {\n                    tmp_vlc_bits[ce]=get_bits(gb, 5)+1;\n                }\n            }\n        } else {\n            uint_fast16_t current_entry=0;\n            uint_fast8_t current_length=get_bits(gb, 5)+1;\n            AV_DEBUG(" ordered, current length: %d \\n", current_length);\n            used_entries=entries;\n            for(;current_entry<used_entries;++current_length) {\n                uint_fast16_t i, number;\n                AV_DEBUG(" number bits: %d ", ilog(entries - current_entry));\n                number=get_bits(gb, ilog(entries - current_entry));\n                AV_DEBUG(" number: %d \\n", number);\n                for(i=current_entry;i<number+current_entry;++i) {\n                    if (i<used_entries) tmp_vlc_bits[i]=current_length;\n                }\n                current_entry+=number;\n            }\n            if (current_entry>used_entries) {\n                av_log(vc->avccontext, AV_LOG_ERROR, " More codelengths than codes in codebook. \\n");\n                goto error;\n            }\n        }\n        codebook_setup->lookup_type=get_bits(gb, 4);\n        AV_DEBUG(" lookup type: %d : %s \\n", codebook_setup->lookup_type, codebook_setup->lookup_type ? "vq" : "no lookup" );\n        if (codebook_setup->lookup_type==1) {\n            uint_fast16_t i, j, k;\n            uint_fast16_t codebook_lookup_values=ff_vorbis_nth_root(entries, codebook_setup->dimensions);\n            uint_fast16_t codebook_multiplicands[codebook_lookup_values];\n            float codebook_minimum_value=vorbisfloat2float(get_bits_long(gb, 32));\n            float codebook_delta_value=vorbisfloat2float(get_bits_long(gb, 32));\n            uint_fast8_t codebook_value_bits=get_bits(gb, 4)+1;\n            uint_fast8_t codebook_sequence_p=get_bits1(gb);\n            AV_DEBUG(" We expect %d numbers for building the codevectors. \\n", codebook_lookup_values);\n            AV_DEBUG("  delta %f minmum %f \\n", codebook_delta_value, codebook_minimum_value);\n            for(i=0;i<codebook_lookup_values;++i) {\n                codebook_multiplicands[i]=get_bits(gb, codebook_value_bits);\n                AV_DEBUG(" multiplicands*delta+minmum : %e \\n", (float)codebook_multiplicands[i]*codebook_delta_value+codebook_minimum_value);\n                AV_DEBUG(" multiplicand %d \\n", codebook_multiplicands[i]);\n            }\n            codebook_setup->codevectors=used_entries ? av_mallocz(used_entries*codebook_setup->dimensions * sizeof(float)) : NULL;\n            for(j=0, i=0;i<entries;++i) {\n                uint_fast8_t dim=codebook_setup->dimensions;\n                if (tmp_vlc_bits[i]) {\n                    float last=0.0;\n                    uint_fast32_t lookup_offset=i;\n#ifdef V_DEBUG\n                    av_log(vc->avccontext, AV_LOG_INFO, "Lookup offset %d ,", i);\n#endif\n                    for(k=0;k<dim;++k) {\n                        uint_fast32_t multiplicand_offset = lookup_offset % codebook_lookup_values;\n                        codebook_setup->codevectors[j*dim+k]=codebook_multiplicands[multiplicand_offset]*codebook_delta_value+codebook_minimum_value+last;\n                        if (codebook_sequence_p) {\n                            last=codebook_setup->codevectors[j*dim+k];\n                        }\n                        lookup_offset/=codebook_lookup_values;\n                    }\n                    tmp_vlc_bits[j]=tmp_vlc_bits[i];\n#ifdef V_DEBUG\n                    av_log(vc->avccontext, AV_LOG_INFO, "real lookup offset %d, vector: ", j);\n                    for(k=0;k<dim;++k) {\n                        av_log(vc->avccontext, AV_LOG_INFO, " %f ", codebook_setup->codevectors[j*dim+k]);\n                    }\n                    av_log(vc->avccontext, AV_LOG_INFO, "\\n");\n#endif\n                    ++j;\n                }\n            }\n            if (j!=used_entries) {\n                av_log(vc->avccontext, AV_LOG_ERROR, "Bug in codevector vector building code. \\n");\n                goto error;\n            }\n            entries=used_entries;\n        }\n        else if (codebook_setup->lookup_type>=2) {\n            av_log(vc->avccontext, AV_LOG_ERROR, "Codebook lookup type not supported. \\n");\n            goto error;\n        }\n        if (ff_vorbis_len2vlc(tmp_vlc_bits, tmp_vlc_codes, entries)) {\n            av_log(vc->avccontext, AV_LOG_ERROR, " Invalid code lengths while generating vlcs. \\n");\n            goto error;\n        }\n        codebook_setup->maxdepth=0;\n        for(t=0;t<entries;++t)\n            if (tmp_vlc_bits[t]>=codebook_setup->maxdepth) codebook_setup->maxdepth=tmp_vlc_bits[t];\n        if(codebook_setup->maxdepth > 3*V_NB_BITS) codebook_setup->nb_bits=V_NB_BITS2;\n        else                                       codebook_setup->nb_bits=V_NB_BITS;\n        codebook_setup->maxdepth=(codebook_setup->maxdepth+codebook_setup->nb_bits-1)/codebook_setup->nb_bits;\n        if (init_vlc(&codebook_setup->vlc, codebook_setup->nb_bits, entries, tmp_vlc_bits, sizeof(*tmp_vlc_bits), sizeof(*tmp_vlc_bits), tmp_vlc_codes, sizeof(*tmp_vlc_codes), sizeof(*tmp_vlc_codes), INIT_VLC_LE)) {\n            av_log(vc->avccontext, AV_LOG_ERROR, " Error generating vlc tables. \\n");\n            goto error;\n        }\n    }\n    av_free(tmp_vlc_bits);\n    av_free(tmp_vlc_codes);\n    return 0;\nerror:\n    av_free(tmp_vlc_bits);\n    av_free(tmp_vlc_codes);\n    return 1;\n}', 'unsigned int ff_vorbis_nth_root(unsigned int x, unsigned int n) {\n    unsigned int ret=0, i, j;\n    do {\n        ++ret;\n        for(i=0,j=ret;i<n-1;i++) j*=ret;\n    } while (j<=x);\n    return (ret-1);\n}']