int opt_timelimit(const char *opt, const char *arg)
{
#if HAVE_SETRLIMIT
    int lim = parse_number_or_die(opt, arg, OPT_INT64, 0, INT_MAX);
    struct rlimit rl = { lim, lim + 1 };
    if (setrlimit(RLIMIT_CPU, &rl))
        perror("setrlimit");
#else
    av_log(NULL, AV_LOG_WARNING, "-%s not implemented on this OS\n", opt);
#endif
    return 0;
}
['int opt_timelimit(const char *opt, const char *arg)\n{\n#if HAVE_SETRLIMIT\n    int lim = parse_number_or_die(opt, arg, OPT_INT64, 0, INT_MAX);\n    struct rlimit rl = { lim, lim + 1 };\n    if (setrlimit(RLIMIT_CPU, &rl))\n        perror("setrlimit");\n#else\n    av_log(NULL, AV_LOG_WARNING, "-%s not implemented on this OS\\n", opt);\n#endif\n    return 0;\n}', 'double parse_number_or_die(const char *context, const char *numstr, int type,\n                           double min, double max)\n{\n    char *tail;\n    const char *error;\n    double d = av_strtod(numstr, &tail);\n    if (*tail)\n        error = "Expected number for %s but found: %s\\n";\n    else if (d < min || d > max)\n        error = "The value for %s was %s which is not within %f - %f\\n";\n    else if (type == OPT_INT64 && (int64_t)d != d)\n        error = "Expected int64 for %s but found %s\\n";\n    else if (type == OPT_INT && (int)d != d)\n        error = "Expected int for %s but found %s\\n";\n    else\n        return d;\n    av_log(NULL, AV_LOG_FATAL, error, context, numstr, min, max);\n    exit_program(1);\n    return 0;\n}']