static int decode_pivot(MSS1Context *ctx, ArithCoder *acoder, int base)

{

    int val, inv;



    inv = arith_get_model_sym(acoder, &ctx->edge_mode);

    val = arith_get_model_sym(acoder, &ctx->pivot) + 1;



    if (val > 2) {

        if ((base + 1) / 2 - 2 <= 0) {

            ctx->corrupted = 1;

            return 0;

        }

        val = arith_get_number(acoder, (base + 1) / 2 - 2) + 3;

    }



    if (val == base) {

        ctx->corrupted = 1;

        return 0;

    }



    return inv ? base - val : val;

}

static int decode_pivot(MSS1Context *ctx, ArithCoder *acoder, int base)

{

    int val, inv;



    inv = arith_get_model_sym(acoder, &ctx->edge_mode);

    val = arith_get_model_sym(acoder, &ctx->pivot) + 1;



    if (val > 2) {

        if ((base + 1) / 2 - 2 <= 0) {

            ctx->corrupted = 1;

            return 0;

        }

        val = arith_get_number(acoder, (base + 1) / 2 - 2) + 3;

    }



    if (val == base) {

        ctx->corrupted = 1;

        return 0;

    }



    return inv ? base - val : val;

}

    if (val == base) {
static int FUNC_0(MSS1Context *VAR_0, ArithCoder *VAR_1, int VAR_2)

{

    int VAR_3, VAR_4;



    VAR_4 = arith_get_model_sym(VAR_1, &VAR_0->edge_mode);

    VAR_3 = arith_get_model_sym(VAR_1, &VAR_0->pivot) + 1;



    if (VAR_3 > 2) {

        if ((VAR_2 + 1) / 2 - 2 <= 0) {

            VAR_0->corrupted = 1;

            return 0;

        }

        VAR_3 = arith_get_number(VAR_1, (VAR_2 + 1) / 2 - 2) + 3;

    }



    if (VAR_3 == VAR_2) {

        VAR_0->corrupted = 1;

        return 0;

    }



    return VAR_4 ? VAR_2 - VAR_3 : VAR_3;

}

static int FUNC_0(MSS1Context *VAR_0, ArithCoder *VAR_1, int VAR_2)
{ int VAR_3, VAR_4; VAR_4 = arith_get_model_sym(VAR_1, &VAR_0->edge_mode); VAR_3 = arith_get_model_sym(VAR_1, &VAR_0->pivot) + 1; if (VAR_3 > 2) { if ((VAR_2 + 1) / 2 - 2 <= 0) { VAR_0->corrupted = 1; return 0; } VAR_3 = arith_get_number(VAR_1, (VAR_2 + 1) / 2 - 2) + 3; } if (VAR_3 == VAR_2) { VAR_0->corrupted = 1; return 0; } return VAR_4 ? VAR_2 - VAR_3 : VAR_3; }