int init_put_byte(ByteIOContext *s,

                  unsigned char *buffer,

                  int buffer_size,

                  int write_flag,

                  void *opaque,

                  int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),

                  int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),

                  int64_t (*seek)(void *opaque, int64_t offset, int whence))

{

    s->buffer = buffer;

    s->buffer_size = buffer_size;

    s->buf_ptr = buffer;

    url_resetbuf(s, write_flag ? URL_WRONLY : URL_RDONLY);

    s->opaque = opaque;

    s->write_packet = write_packet;

    s->read_packet = read_packet;

    s->seek = seek;

    s->pos = 0;

    s->must_flush = 0;

    s->eof_reached = 0;

    s->error = 0;

    s->is_streamed = 0;

    s->max_packet_size = 0;

    s->update_checksum= NULL;

    if(!read_packet && !write_flag){

        s->pos = buffer_size;

        s->buf_end = s->buffer + buffer_size;

    }

    s->read_pause = NULL;

    s->read_seek  = NULL;

    return 0;

}

int init_put_byte(ByteIOContext *s,

                  unsigned char *buffer,

                  int buffer_size,

                  int write_flag,

                  void *opaque,

                  int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),

                  int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),

                  int64_t (*seek)(void *opaque, int64_t offset, int whence))

{

    s->buffer = buffer;

    s->buffer_size = buffer_size;

    s->buf_ptr = buffer;

    url_resetbuf(s, write_flag ? URL_WRONLY : URL_RDONLY);

    s->opaque = opaque;

    s->write_packet = write_packet;

    s->read_packet = read_packet;

    s->seek = seek;

    s->pos = 0;

    s->must_flush = 0;

    s->eof_reached = 0;

    s->error = 0;

    s->is_streamed = 0;

    s->max_packet_size = 0;

    s->update_checksum= NULL;

    if(!read_packet && !write_flag){

        s->pos = buffer_size;

        s->buf_end = s->buffer + buffer_size;

    }

    s->read_pause = NULL;

    s->read_seek  = NULL;

    return 0;

}

    url_resetbuf(s, write_flag ? URL_WRONLY : URL_RDONLY);
int FUNC_0(ByteIOContext *VAR_0,

                  unsigned char *VAR_1,

                  int VAR_2,

                  int VAR_3,

                  void *VAR_9,

                  int (*VAR_5)(void *VAR_9, uint8_t *VAR_9, int VAR_9),

                  int (*VAR_8)(void *VAR_9, uint8_t *VAR_9, int VAR_9),

                  VAR_9 (*seek)(void *VAR_9, VAR_9 offset, int whence))

{

    VAR_0->VAR_1 = VAR_1;

    VAR_0->VAR_2 = VAR_2;

    VAR_0->buf_ptr = VAR_1;

    url_resetbuf(VAR_0, VAR_3 ? URL_WRONLY : URL_RDONLY);

    VAR_0->VAR_9 = VAR_9;

    VAR_0->VAR_8 = VAR_8;

    VAR_0->VAR_5 = VAR_5;

    VAR_0->seek = seek;

    VAR_0->pos = 0;

    VAR_0->must_flush = 0;

    VAR_0->eof_reached = 0;

    VAR_0->error = 0;

    VAR_0->is_streamed = 0;

    VAR_0->max_packet_size = 0;

    VAR_0->update_checksum= NULL;

    if(!VAR_5 && !VAR_3){

        VAR_0->pos = VAR_2;

        VAR_0->buf_end = VAR_0->VAR_1 + VAR_2;

    }

    VAR_0->read_pause = NULL;

    VAR_0->read_seek  = NULL;

    return 0;

}

int FUNC_0(ByteIOContext *VAR_0,
unsigned char *VAR_1,
int VAR_2,
int VAR_3,
void *VAR_9,
int (*VAR_5)(void *VAR_9, uint8_t *VAR_9, int VAR_9),
int (*VAR_8)(void *VAR_9, uint8_t *VAR_9, int VAR_9),
VAR_9 (*seek)(void *VAR_9, VAR_9 offset, int whence))
{ VAR_0->VAR_1 = VAR_1; VAR_0->VAR_2 = VAR_2; VAR_0->buf_ptr = VAR_1; url_resetbuf(VAR_0, VAR_3 ? URL_WRONLY : URL_RDONLY); VAR_0->VAR_9 = VAR_9; VAR_0->VAR_8 = VAR_8; VAR_0->VAR_5 = VAR_5; VAR_0->seek = seek; VAR_0->pos = 0; VAR_0->must_flush = 0; VAR_0->eof_reached = 0; VAR_0->error = 0; VAR_0->is_streamed = 0; VAR_0->max_packet_size = 0; VAR_0->update_checksum= NULL; if(!VAR_5 && !VAR_3){ VAR_0->pos = VAR_2; VAR_0->buf_end = VAR_0->VAR_1 + VAR_2; } VAR_0->read_pause = NULL; VAR_0->read_seek  = NULL; return 0; }