static char *value_string(char *buf, int buf_size, struct unit_value uv)

{

    double vald;

    int show_float = 0;



    if (uv.unit == unit_second_str) {

        vald = uv.val.d;

        show_float = 1;

    } else {

        vald = uv.val.i;

    }



    if (uv.unit == unit_second_str && use_value_sexagesimal_format) {

        double secs;

        int hours, mins;

        secs  = vald;

        mins  = (int)secs / 60;

        secs  = secs - mins * 60;

        hours = mins / 60;

        mins %= 60;

        snprintf(buf, buf_size, "%d:%02d:%09.6f", hours, mins, secs);

    } else {

        const char *prefix_string = "";

        int l;



        if (use_value_prefix && vald > 1) {

            long long int index;



            if (uv.unit == unit_byte_str && use_byte_value_binary_prefix) {

                index = (long long int) (log2(vald)) / 10;

                index = av_clip(index, 0, FF_ARRAY_ELEMS(binary_unit_prefixes) - 1);

                vald /= exp2(index * 10);

                prefix_string = binary_unit_prefixes[index];

            } else {

                index = (long long int) (log10(vald)) / 3;

                index = av_clip(index, 0, FF_ARRAY_ELEMS(decimal_unit_prefixes) - 1);

                vald /= pow(10, index * 3);

                prefix_string = decimal_unit_prefixes[index];

            }

        }



        if (show_float || (use_value_prefix && vald != (long long int)vald))

            l = snprintf(buf, buf_size, "%f", vald);

        else

            l = snprintf(buf, buf_size, "%lld", (long long int)vald);

        snprintf(buf+l, buf_size-l, "%s%s%s", *prefix_string || show_value_unit ? " " : "",

                 prefix_string, show_value_unit ? uv.unit : "");

    }



    return buf;

}

static char *value_string(char *buf, int buf_size, struct unit_value uv)

{

    double vald;

    int show_float = 0;



    if (uv.unit == unit_second_str) {

        vald = uv.val.d;

        show_float = 1;

    } else {

        vald = uv.val.i;

    }



    if (uv.unit == unit_second_str && use_value_sexagesimal_format) {

        double secs;

        int hours, mins;

        secs  = vald;

        mins  = (int)secs / 60;

        secs  = secs - mins * 60;

        hours = mins / 60;

        mins %= 60;

        snprintf(buf, buf_size, "%d:%02d:%09.6f", hours, mins, secs);

    } else {

        const char *prefix_string = "";

        int l;



        if (use_value_prefix && vald > 1) {

            long long int index;



            if (uv.unit == unit_byte_str && use_byte_value_binary_prefix) {

                index = (long long int) (log2(vald)) / 10;

                index = av_clip(index, 0, FF_ARRAY_ELEMS(binary_unit_prefixes) - 1);

                vald /= exp2(index * 10);

                prefix_string = binary_unit_prefixes[index];

            } else {

                index = (long long int) (log10(vald)) / 3;

                index = av_clip(index, 0, FF_ARRAY_ELEMS(decimal_unit_prefixes) - 1);

                vald /= pow(10, index * 3);

                prefix_string = decimal_unit_prefixes[index];

            }

        }



        if (show_float || (use_value_prefix && vald != (long long int)vald))

            l = snprintf(buf, buf_size, "%f", vald);

        else

            l = snprintf(buf, buf_size, "%lld", (long long int)vald);

        snprintf(buf+l, buf_size-l, "%s%s%s", *prefix_string || show_value_unit ? " " : "",

                 prefix_string, show_value_unit ? uv.unit : "");

    }



    return buf;

}

static char *FUNC_0(char *VAR_0, int VAR_1, struct unit_value VAR_2)

{

    double VAR_3;

    int VAR_4 = 0;



    if (VAR_2.unit == unit_second_str) {

        VAR_3 = VAR_2.val.d;

        VAR_4 = 1;

    } else {

        VAR_3 = VAR_2.val.i;

    }



    if (VAR_2.unit == unit_second_str && use_value_sexagesimal_format) {

        double VAR_5;

        int VAR_6, VAR_7;

        VAR_5  = VAR_3;

        VAR_7  = (int)VAR_5 / 60;

        VAR_5  = VAR_5 - VAR_7 * 60;

        VAR_6 = VAR_7 / 60;

        VAR_7 %= 60;

        snprintf(VAR_0, VAR_1, "%d:%02d:%09.6f", VAR_6, VAR_7, VAR_5);

    } else {

        const char *VAR_8 = "";

        int VAR_9;



        if (use_value_prefix && VAR_3 > 1) {

            long long int VAR_10;



            if (VAR_2.unit == unit_byte_str && use_byte_value_binary_prefix) {

                VAR_10 = (long long int) (log2(VAR_3)) / 10;

                VAR_10 = av_clip(VAR_10, 0, FF_ARRAY_ELEMS(binary_unit_prefixes) - 1);

                VAR_3 /= exp2(VAR_10 * 10);

                VAR_8 = binary_unit_prefixes[VAR_10];

            } else {

                VAR_10 = (long long int) (log10(VAR_3)) / 3;

                VAR_10 = av_clip(VAR_10, 0, FF_ARRAY_ELEMS(decimal_unit_prefixes) - 1);

                VAR_3 /= pow(10, VAR_10 * 3);

                VAR_8 = decimal_unit_prefixes[VAR_10];

            }

        }



        if (VAR_4 || (use_value_prefix && VAR_3 != (long long int)VAR_3))

            VAR_9 = snprintf(VAR_0, VAR_1, "%f", VAR_3);

        else

            VAR_9 = snprintf(VAR_0, VAR_1, "%lld", (long long int)VAR_3);

        snprintf(VAR_0+VAR_9, VAR_1-VAR_9, "%s%s%s", *VAR_8 || show_value_unit ? " " : "",

                 VAR_8, show_value_unit ? VAR_2.unit : "");

    }



    return VAR_0;

}

static char *FUNC_0(char *VAR_0, int VAR_1, struct unit_value VAR_2)
{ double VAR_3; int VAR_4 = 0; if (VAR_2.unit == unit_second_str) { VAR_3 = VAR_2.val.d; VAR_4 = 1; } else { VAR_3 = VAR_2.val.i; } if (VAR_2.unit == unit_second_str && use_value_sexagesimal_format) { double VAR_5; int VAR_6, VAR_7; VAR_5  = VAR_3; VAR_7  = (int)VAR_5 / 60; VAR_5  = VAR_5 - VAR_7 * 60; VAR_6 = VAR_7 / 60; VAR_7 %= 60; snprintf(VAR_0, VAR_1, "%d:%02d:%09.6f", VAR_6, VAR_7, VAR_5); } else { const char *VAR_8 = ""; int VAR_9; if (use_value_prefix && VAR_3 > 1) { long long int VAR_10; if (VAR_2.unit == unit_byte_str && use_byte_value_binary_prefix) { VAR_10 = (long long int) (log2(VAR_3)) / 10; VAR_10 = av_clip(VAR_10, 0, FF_ARRAY_ELEMS(binary_unit_prefixes) - 1); VAR_3 /= exp2(VAR_10 * 10); VAR_8 = binary_unit_prefixes[VAR_10]; } else { VAR_10 = (long long int) (log10(VAR_3)) / 3; VAR_10 = av_clip(VAR_10, 0, FF_ARRAY_ELEMS(decimal_unit_prefixes) - 1); VAR_3 /= pow(10, VAR_10 * 3); VAR_8 = decimal_unit_prefixes[VAR_10]; } } if (VAR_4 || (use_value_prefix && VAR_3 != (long long int)VAR_3))
VAR_9 = snprintf(VAR_0, VAR_1, "%f", VAR_3); else
VAR_9 = snprintf(VAR_0, VAR_1, "%lld", (long long int)VAR_3); snprintf(VAR_0+VAR_9, VAR_1-VAR_9, "%s%s%s", *VAR_8 || show_value_unit ? " " : "",
VAR_8, show_value_unit ? VAR_2.unit : ""); } return VAR_0; }