static int64_t do_strtosz(const char *nptr, char **end,

                          const char default_suffix, int64_t unit)

{

    int64_t retval;

    char *endptr;

    unsigned char c;

    int mul_required = 0;

    double val, mul, integral, fraction;



    errno = 0;

    val = strtod(nptr, &endptr);

    if (isnan(val) || endptr == nptr || errno != 0) {

        retval = -EINVAL;

        goto out;

    }

    fraction = modf(val, &integral);

    if (fraction != 0) {

        mul_required = 1;

    }

    c = *endptr;

    mul = suffix_mul(c, unit);

    if (mul >= 0) {

        endptr++;

    } else {

        mul = suffix_mul(default_suffix, unit);

        assert(mul >= 0);

    }

    if (mul == 1 && mul_required) {

        retval = -EINVAL;

        goto out;

    }

    if ((val * mul >= INT64_MAX) || val < 0) {

        retval = -ERANGE;

        goto out;

    }

    retval = val * mul;



out:

    if (end) {

        *end = endptr;

    } else if (*endptr) {

        retval = -EINVAL;

    }



    return retval;

}

static int64_t do_strtosz(const char *nptr, char **end,

                          const char default_suffix, int64_t unit)

{

    int64_t retval;

    char *endptr;

    unsigned char c;

    int mul_required = 0;

    double val, mul, integral, fraction;



    errno = 0;

    val = strtod(nptr, &endptr);

    if (isnan(val) || endptr == nptr || errno != 0) {

        retval = -EINVAL;

        goto out;

    }

    fraction = modf(val, &integral);

    if (fraction != 0) {

        mul_required = 1;

    }

    c = *endptr;

    mul = suffix_mul(c, unit);

    if (mul >= 0) {

        endptr++;

    } else {

        mul = suffix_mul(default_suffix, unit);

        assert(mul >= 0);

    }

    if (mul == 1 && mul_required) {

        retval = -EINVAL;

        goto out;

    }

    if ((val * mul >= INT64_MAX) || val < 0) {

        retval = -ERANGE;

        goto out;

    }

    retval = val * mul;



out:

    if (end) {

        *end = endptr;

    } else if (*endptr) {

        retval = -EINVAL;

    }



    return retval;

}

static int64_t FUNC_0(const char *nptr, char **end,

                          const char default_suffix, int64_t unit)

{

    int64_t retval;

    char *VAR_0;

    unsigned char VAR_1;

    int VAR_2 = 0;

    double VAR_3, VAR_4, VAR_5, VAR_6;



    errno = 0;

    VAR_3 = strtod(nptr, &VAR_0);

    if (isnan(VAR_3) || VAR_0 == nptr || errno != 0) {

        retval = -EINVAL;

        goto out;

    }

    VAR_6 = modf(VAR_3, &VAR_5);

    if (VAR_6 != 0) {

        VAR_2 = 1;

    }

    VAR_1 = *VAR_0;

    VAR_4 = suffix_mul(VAR_1, unit);

    if (VAR_4 >= 0) {

        VAR_0++;

    } else {

        VAR_4 = suffix_mul(default_suffix, unit);

        assert(VAR_4 >= 0);

    }

    if (VAR_4 == 1 && VAR_2) {

        retval = -EINVAL;

        goto out;

    }

    if ((VAR_3 * VAR_4 >= INT64_MAX) || VAR_3 < 0) {

        retval = -ERANGE;

        goto out;

    }

    retval = VAR_3 * VAR_4;



out:

    if (end) {

        *end = VAR_0;

    } else if (*VAR_0) {

        retval = -EINVAL;

    }



    return retval;

}

static int64_t FUNC_0(const char *nptr, char **end,
const char default_suffix, int64_t unit)
{ int64_t retval; char *VAR_0; unsigned char VAR_1; int VAR_2 = 0; double VAR_3, VAR_4, VAR_5, VAR_6; errno = 0; VAR_3 = strtod(nptr, &VAR_0); if (isnan(VAR_3) || VAR_0 == nptr || errno != 0) { retval = -EINVAL; goto out; } VAR_6 = modf(VAR_3, &VAR_5); if (VAR_6 != 0) { VAR_2 = 1; } VAR_1 = *VAR_0; VAR_4 = suffix_mul(VAR_1, unit); if (VAR_4 >= 0) { VAR_0++; } else { VAR_4 = suffix_mul(default_suffix, unit); assert(VAR_4 >= 0); } if (VAR_4 == 1 && VAR_2) { retval = -EINVAL; goto out; } if ((VAR_3 * VAR_4 >= INT64_MAX) || VAR_3 < 0) { retval = -ERANGE; goto out; } retval = VAR_3 * VAR_4; out:
if (end) { *end = VAR_0; } else if (*VAR_0) { retval = -EINVAL; } return retval; }