static int copy_moof(AVFormatContext *s, const char* infile, const char *outfile, int64_t size)

{

    AVIOContext *in, *out;

    int ret = 0;

    if ((ret = avio_open2(&in, infile, AVIO_FLAG_READ, &s->interrupt_callback, NULL)) < 0)

        return ret;

    if ((ret = avio_open2(&out, outfile, AVIO_FLAG_WRITE, &s->interrupt_callback, NULL)) < 0) {

        avio_close(in);

        return ret;

    }

    while (size > 0) {

        uint8_t buf[8192];

        int n = FFMIN(size, sizeof(buf));

        n = avio_read(in, buf, n);

        if (n <= 0) {

            ret = AVERROR(EIO);

            break;

        }

        avio_write(out, buf, n);

        size -= n;

    }

    avio_flush(out);

    avio_close(out);

    avio_close(in);

    return ret;

}

static int copy_moof(AVFormatContext *s, const char* infile, const char *outfile, int64_t size)

{

    AVIOContext *in, *out;

    int ret = 0;

    if ((ret = avio_open2(&in, infile, AVIO_FLAG_READ, &s->interrupt_callback, NULL)) < 0)

        return ret;

    if ((ret = avio_open2(&out, outfile, AVIO_FLAG_WRITE, &s->interrupt_callback, NULL)) < 0) {

        avio_close(in);

        return ret;

    }

    while (size > 0) {

        uint8_t buf[8192];

        int n = FFMIN(size, sizeof(buf));

        n = avio_read(in, buf, n);

        if (n <= 0) {

            ret = AVERROR(EIO);

            break;

        }

        avio_write(out, buf, n);

        size -= n;

    }

    avio_flush(out);

    avio_close(out);

    avio_close(in);

    return ret;

}

static int FUNC_0(AVFormatContext *VAR_0, const char* VAR_1, const char *VAR_2, int64_t VAR_3)

{

    AVIOContext *in, *out;

    int VAR_4 = 0;

    if ((VAR_4 = avio_open2(&in, VAR_1, AVIO_FLAG_READ, &VAR_0->interrupt_callback, NULL)) < 0)

        return VAR_4;

    if ((VAR_4 = avio_open2(&out, VAR_2, AVIO_FLAG_WRITE, &VAR_0->interrupt_callback, NULL)) < 0) {

        avio_close(in);

        return VAR_4;

    }

    while (VAR_3 > 0) {

        uint8_t buf[8192];

        int VAR_5 = FFMIN(VAR_3, sizeof(buf));

        VAR_5 = avio_read(in, buf, VAR_5);

        if (VAR_5 <= 0) {

            VAR_4 = AVERROR(EIO);

            break;

        }

        avio_write(out, buf, VAR_5);

        VAR_3 -= VAR_5;

    }

    avio_flush(out);

    avio_close(out);

    avio_close(in);

    return VAR_4;

}

static int FUNC_0(AVFormatContext *VAR_0, const char* VAR_1, const char *VAR_2, int64_t VAR_3)
{ AVIOContext *in, *out; int VAR_4 = 0; if ((VAR_4 = avio_open2(&in, VAR_1, AVIO_FLAG_READ, &VAR_0->interrupt_callback, NULL)) < 0)
return VAR_4; if ((VAR_4 = avio_open2(&out, VAR_2, AVIO_FLAG_WRITE, &VAR_0->interrupt_callback, NULL)) < 0) { avio_close(in); return VAR_4; } while (VAR_3 > 0) { uint8_t buf[8192]; int VAR_5 = FFMIN(VAR_3, sizeof(buf)); VAR_5 = avio_read(in, buf, VAR_5); if (VAR_5 <= 0) { VAR_4 = AVERROR(EIO); break; } avio_write(out, buf, VAR_5); VAR_3 -= VAR_5; } avio_flush(out); avio_close(out); avio_close(in); return VAR_4; }