static int default_lockmgr_cb(void **arg, enum AVLockOp op)

{

    void * volatile * mutex = arg;

    int err;



    switch (op) {

    case AV_LOCK_CREATE:

        return 0;

    case AV_LOCK_OBTAIN:

        if (!*mutex) {

            pthread_mutex_t *tmp = av_malloc(sizeof(pthread_mutex_t));

            if (!tmp)

                return AVERROR(ENOMEM);

            if ((err = pthread_mutex_init(tmp, NULL))) {

                av_free(tmp);

                return AVERROR(err);

            }

            if (avpriv_atomic_ptr_cas(mutex, NULL, tmp)) {

                pthread_mutex_destroy(tmp);

                av_free(tmp);

            }

        }



        if ((err = pthread_mutex_lock(*mutex)))

            return AVERROR(err);



        return 0;

    case AV_LOCK_RELEASE:

        if ((err = pthread_mutex_unlock(*mutex)))

            return AVERROR(err);



        return 0;

    case AV_LOCK_DESTROY:

        if (*mutex)

            pthread_mutex_destroy(*mutex);

        av_free(*mutex);

        avpriv_atomic_ptr_cas(mutex, *mutex, NULL);

        return 0;

    }

    return 1;

}

static int default_lockmgr_cb(void **arg, enum AVLockOp op)

{

    void * volatile * mutex = arg;

    int err;



    switch (op) {

    case AV_LOCK_CREATE:

        return 0;

    case AV_LOCK_OBTAIN:

        if (!*mutex) {

            pthread_mutex_t *tmp = av_malloc(sizeof(pthread_mutex_t));

            if (!tmp)

                return AVERROR(ENOMEM);

            if ((err = pthread_mutex_init(tmp, NULL))) {

                av_free(tmp);

                return AVERROR(err);

            }

            if (avpriv_atomic_ptr_cas(mutex, NULL, tmp)) {

                pthread_mutex_destroy(tmp);

                av_free(tmp);

            }

        }



        if ((err = pthread_mutex_lock(*mutex)))

            return AVERROR(err);



        return 0;

    case AV_LOCK_RELEASE:

        if ((err = pthread_mutex_unlock(*mutex)))

            return AVERROR(err);



        return 0;

    case AV_LOCK_DESTROY:

        if (*mutex)

            pthread_mutex_destroy(*mutex);

        av_free(*mutex);

        avpriv_atomic_ptr_cas(mutex, *mutex, NULL);

        return 0;

    }

    return 1;

}

static int default_lockmgr_cb(void **arg, enum AVLockOp op)     void * volatile * mutex = arg;     int err;     switch (op) {     case AV_LOCK_CREATE:         return 0;     case AV_LOCK_OBTAIN:         if (!*mutex) {             pthread_mutex_t *tmp = av_malloc(sizeof(pthread_mutex_t));             if (!tmp)                 return AVERROR(ENOMEM);             if ((err = pthread_mutex_init(tmp, NULL))) {                 av_free(tmp);                 return AVERROR(err);             if (avpriv_atomic_ptr_cas(mutex, NULL, tmp)) {                 pthread_mutex_destroy(tmp);                 av_free(tmp);         if ((err = pthread_mutex_lock(*mutex)))             return AVERROR(err);         return 0;     case AV_LOCK_RELEASE:         if ((err = pthread_mutex_unlock(*mutex)))             return AVERROR(err);         return 0;     case AV_LOCK_DESTROY:         if (*mutex)             pthread_mutex_destroy(*mutex);         av_free(*mutex);         avpriv_atomic_ptr_cas(mutex, *mutex, NULL);         return 0;     return 1;
static int FUNC_0(void **VAR_0, enum AVLockOp VAR_1)

{

    void * volatile * VAR_2 = VAR_0;

    int VAR_3;



    switch (VAR_1) {

    case AV_LOCK_CREATE:

        return 0;

    case AV_LOCK_OBTAIN:

        if (!*VAR_2) {

            pthread_mutex_t *tmp = av_malloc(sizeof(pthread_mutex_t));

            if (!tmp)

                return AVERROR(ENOMEM);

            if ((VAR_3 = pthread_mutex_init(tmp, NULL))) {

                av_free(tmp);

                return AVERROR(VAR_3);

            }

            if (avpriv_atomic_ptr_cas(VAR_2, NULL, tmp)) {

                pthread_mutex_destroy(tmp);

                av_free(tmp);

            }

        }



        if ((VAR_3 = pthread_mutex_lock(*VAR_2)))

            return AVERROR(VAR_3);



        return 0;

    case AV_LOCK_RELEASE:

        if ((VAR_3 = pthread_mutex_unlock(*VAR_2)))

            return AVERROR(VAR_3);



        return 0;

    case AV_LOCK_DESTROY:

        if (*VAR_2)

            pthread_mutex_destroy(*VAR_2);

        av_free(*VAR_2);

        avpriv_atomic_ptr_cas(VAR_2, *VAR_2, NULL);

        return 0;

    }

    return 1;

}

static int FUNC_0(void **VAR_0, enum AVLockOp VAR_1)
{ void * volatile * VAR_2 = VAR_0; int VAR_3; switch (VAR_1) { case AV_LOCK_CREATE:
return 0; case AV_LOCK_OBTAIN:
if (!*VAR_2) { pthread_mutex_t *tmp = av_malloc(sizeof(pthread_mutex_t)); if (!tmp)
return AVERROR(ENOMEM); if ((VAR_3 = pthread_mutex_init(tmp, NULL))) { av_free(tmp); return AVERROR(VAR_3); } if (avpriv_atomic_ptr_cas(VAR_2, NULL, tmp)) { pthread_mutex_destroy(tmp); av_free(tmp); } } if ((VAR_3 = pthread_mutex_lock(*VAR_2)))
return AVERROR(VAR_3); return 0; case AV_LOCK_RELEASE:
if ((VAR_3 = pthread_mutex_unlock(*VAR_2)))
return AVERROR(VAR_3); return 0; case AV_LOCK_DESTROY:
if (*VAR_2)
pthread_mutex_destroy(*VAR_2); av_free(*VAR_2); avpriv_atomic_ptr_cas(VAR_2, *VAR_2, NULL); return 0; } return 1; }