static void tcg_out_movi_int(TCGContext *s, TCGType type, TCGReg ret,

                             tcg_target_long arg, bool in_prologue)

{

    intptr_t tb_diff;

    tcg_target_long tmp;

    int shift;



    tcg_debug_assert(TCG_TARGET_REG_BITS == 64 || type == TCG_TYPE_I32);



    if (TCG_TARGET_REG_BITS == 64 && type == TCG_TYPE_I32) {

        arg = (int32_t)arg;

    }



    /* Load 16-bit immediates with one insn.  */

    if (tcg_out_movi_one(s, ret, arg)) {

        return;

    }



    /* Load addresses within the TB with one insn.  */

    tb_diff = arg - (intptr_t)s->code_gen_ptr;

    if (!in_prologue && USE_REG_TB && tb_diff == (int16_t)tb_diff) {

        tcg_out32(s, ADDI | TAI(ret, TCG_REG_TB, tb_diff));

        return;

    }



    /* Load 32-bit immediates with two insns.  Note that we've already

       eliminated bare ADDIS, so we know both insns are required.  */

    if (TCG_TARGET_REG_BITS == 32 || arg == (int32_t)arg) {

        tcg_out32(s, ADDIS | TAI(ret, 0, arg >> 16));

        tcg_out32(s, ORI | SAI(ret, ret, arg));

        return;

    }

    if (arg == (uint32_t)arg && !(arg & 0x8000)) {

        tcg_out32(s, ADDI | TAI(ret, 0, arg));

        tcg_out32(s, ORIS | SAI(ret, ret, arg >> 16));

        return;

    }



    /* Load masked 16-bit value.  */

    if (arg > 0 && (arg & 0x8000)) {

        tmp = arg | 0x7fff;

        if ((tmp & (tmp + 1)) == 0) {

            int mb = clz64(tmp + 1) + 1;

            tcg_out32(s, ADDI | TAI(ret, 0, arg));

            tcg_out_rld(s, RLDICL, ret, ret, 0, mb);

            return;

        }

    }



    /* Load common masks with 2 insns.  */

    shift = ctz64(arg);

    tmp = arg >> shift;

    if (tmp == (int16_t)tmp) {

        tcg_out32(s, ADDI | TAI(ret, 0, tmp));

        tcg_out_shli64(s, ret, ret, shift);

        return;

    }

    shift = clz64(arg);

    if (tcg_out_movi_one(s, ret, arg << shift)) {

        tcg_out_shri64(s, ret, ret, shift);

        return;

    }



    /* Load addresses within 2GB of TB with 2 (or rarely 3) insns.  */

    if (!in_prologue && USE_REG_TB && tb_diff == (int32_t)tb_diff) {

        tcg_out_mem_long(s, ADDI, ADD, ret, TCG_REG_TB, tb_diff);

        return;

    }



    /* Use the constant pool, if possible.  */

    if (!in_prologue && USE_REG_TB) {

        new_pool_label(s, arg, R_PPC_ADDR16, s->code_ptr,

                       -(intptr_t)s->code_gen_ptr);

        tcg_out32(s, LD | TAI(ret, TCG_REG_TB, 0));

        return;

    }



    tmp = arg >> 31 >> 1;

    tcg_out_movi(s, TCG_TYPE_I32, ret, tmp);

    if (tmp) {

        tcg_out_shli64(s, ret, ret, 32);

    }

    if (arg & 0xffff0000) {

        tcg_out32(s, ORIS | SAI(ret, ret, arg >> 16));

    }

    if (arg & 0xffff) {

        tcg_out32(s, ORI | SAI(ret, ret, arg));

    }

}

static void tcg_out_movi_int(TCGContext *s, TCGType type, TCGReg ret,

                             tcg_target_long arg, bool in_prologue)

{

    intptr_t tb_diff;

    tcg_target_long tmp;

    int shift;



    tcg_debug_assert(TCG_TARGET_REG_BITS == 64 || type == TCG_TYPE_I32);



    if (TCG_TARGET_REG_BITS == 64 && type == TCG_TYPE_I32) {

        arg = (int32_t)arg;

    }



    

    if (tcg_out_movi_one(s, ret, arg)) {

        return;

    }



    

    tb_diff = arg - (intptr_t)s->code_gen_ptr;

    if (!in_prologue && USE_REG_TB && tb_diff == (int16_t)tb_diff) {

        tcg_out32(s, ADDI | TAI(ret, TCG_REG_TB, tb_diff));

        return;

    }



    



    if (TCG_TARGET_REG_BITS == 32 || arg == (int32_t)arg) {

        tcg_out32(s, ADDIS | TAI(ret, 0, arg >> 16));

        tcg_out32(s, ORI | SAI(ret, ret, arg));

        return;

    }

    if (arg == (uint32_t)arg && !(arg & 0x8000)) {

        tcg_out32(s, ADDI | TAI(ret, 0, arg));

        tcg_out32(s, ORIS | SAI(ret, ret, arg >> 16));

        return;

    }



    

    if (arg > 0 && (arg & 0x8000)) {

        tmp = arg | 0x7fff;

        if ((tmp & (tmp + 1)) == 0) {

            int mb = clz64(tmp + 1) + 1;

            tcg_out32(s, ADDI | TAI(ret, 0, arg));

            tcg_out_rld(s, RLDICL, ret, ret, 0, mb);

            return;

        }

    }



    

    shift = ctz64(arg);

    tmp = arg >> shift;

    if (tmp == (int16_t)tmp) {

        tcg_out32(s, ADDI | TAI(ret, 0, tmp));

        tcg_out_shli64(s, ret, ret, shift);

        return;

    }

    shift = clz64(arg);

    if (tcg_out_movi_one(s, ret, arg << shift)) {

        tcg_out_shri64(s, ret, ret, shift);

        return;

    }



    

    if (!in_prologue && USE_REG_TB && tb_diff == (int32_t)tb_diff) {

        tcg_out_mem_long(s, ADDI, ADD, ret, TCG_REG_TB, tb_diff);

        return;

    }



    

    if (!in_prologue && USE_REG_TB) {

        new_pool_label(s, arg, R_PPC_ADDR16, s->code_ptr,

                       -(intptr_t)s->code_gen_ptr);

        tcg_out32(s, LD | TAI(ret, TCG_REG_TB, 0));

        return;

    }



    tmp = arg >> 31 >> 1;

    tcg_out_movi(s, TCG_TYPE_I32, ret, tmp);

    if (tmp) {

        tcg_out_shli64(s, ret, ret, 32);

    }

    if (arg & 0xffff0000) {

        tcg_out32(s, ORIS | SAI(ret, ret, arg >> 16));

    }

    if (arg & 0xffff) {

        tcg_out32(s, ORI | SAI(ret, ret, arg));

    }

}

        tcg_out32(s, LD | TAI(ret, TCG_REG_TB, 0));
static void FUNC_0(TCGContext *VAR_0, TCGType VAR_1, TCGReg VAR_2,

                             tcg_target_long VAR_3, bool VAR_4)

{

    intptr_t tb_diff;

    tcg_target_long tmp;

    int VAR_5;



    tcg_debug_assert(TCG_TARGET_REG_BITS == 64 || VAR_1 == TCG_TYPE_I32);



    if (TCG_TARGET_REG_BITS == 64 && VAR_1 == TCG_TYPE_I32) {

        VAR_3 = (int32_t)VAR_3;

    }



    

    if (tcg_out_movi_one(VAR_0, VAR_2, VAR_3)) {

        return;

    }



    

    tb_diff = VAR_3 - (intptr_t)VAR_0->code_gen_ptr;

    if (!VAR_4 && USE_REG_TB && tb_diff == (int16_t)tb_diff) {

        tcg_out32(VAR_0, ADDI | TAI(VAR_2, TCG_REG_TB, tb_diff));

        return;

    }



    



    if (TCG_TARGET_REG_BITS == 32 || VAR_3 == (int32_t)VAR_3) {

        tcg_out32(VAR_0, ADDIS | TAI(VAR_2, 0, VAR_3 >> 16));

        tcg_out32(VAR_0, ORI | SAI(VAR_2, VAR_2, VAR_3));

        return;

    }

    if (VAR_3 == (uint32_t)VAR_3 && !(VAR_3 & 0x8000)) {

        tcg_out32(VAR_0, ADDI | TAI(VAR_2, 0, VAR_3));

        tcg_out32(VAR_0, ORIS | SAI(VAR_2, VAR_2, VAR_3 >> 16));

        return;

    }



    

    if (VAR_3 > 0 && (VAR_3 & 0x8000)) {

        tmp = VAR_3 | 0x7fff;

        if ((tmp & (tmp + 1)) == 0) {

            int VAR_6 = clz64(tmp + 1) + 1;

            tcg_out32(VAR_0, ADDI | TAI(VAR_2, 0, VAR_3));

            tcg_out_rld(VAR_0, RLDICL, VAR_2, VAR_2, 0, VAR_6);

            return;

        }

    }



    

    VAR_5 = ctz64(VAR_3);

    tmp = VAR_3 >> VAR_5;

    if (tmp == (int16_t)tmp) {

        tcg_out32(VAR_0, ADDI | TAI(VAR_2, 0, tmp));

        tcg_out_shli64(VAR_0, VAR_2, VAR_2, VAR_5);

        return;

    }

    VAR_5 = clz64(VAR_3);

    if (tcg_out_movi_one(VAR_0, VAR_2, VAR_3 << VAR_5)) {

        tcg_out_shri64(VAR_0, VAR_2, VAR_2, VAR_5);

        return;

    }



    

    if (!VAR_4 && USE_REG_TB && tb_diff == (int32_t)tb_diff) {

        tcg_out_mem_long(VAR_0, ADDI, ADD, VAR_2, TCG_REG_TB, tb_diff);

        return;

    }



    

    if (!VAR_4 && USE_REG_TB) {

        new_pool_label(VAR_0, VAR_3, R_PPC_ADDR16, VAR_0->code_ptr,

                       -(intptr_t)VAR_0->code_gen_ptr);

        tcg_out32(VAR_0, LD | TAI(VAR_2, TCG_REG_TB, 0));

        return;

    }



    tmp = VAR_3 >> 31 >> 1;

    tcg_out_movi(VAR_0, TCG_TYPE_I32, VAR_2, tmp);

    if (tmp) {

        tcg_out_shli64(VAR_0, VAR_2, VAR_2, 32);

    }

    if (VAR_3 & 0xffff0000) {

        tcg_out32(VAR_0, ORIS | SAI(VAR_2, VAR_2, VAR_3 >> 16));

    }

    if (VAR_3 & 0xffff) {

        tcg_out32(VAR_0, ORI | SAI(VAR_2, VAR_2, VAR_3));

    }

}

static void FUNC_0(TCGContext *VAR_0, TCGType VAR_1, TCGReg VAR_2,
tcg_target_long VAR_3, bool VAR_4)
{ intptr_t tb_diff; tcg_target_long tmp; int VAR_5; tcg_debug_assert(TCG_TARGET_REG_BITS == 64 || VAR_1 == TCG_TYPE_I32); if (TCG_TARGET_REG_BITS == 64 && VAR_1 == TCG_TYPE_I32) { VAR_3 = (int32_t)VAR_3; } if (tcg_out_movi_one(VAR_0, VAR_2, VAR_3)) { return; } tb_diff = VAR_3 - (intptr_t)VAR_0->code_gen_ptr; if (!VAR_4 && USE_REG_TB && tb_diff == (int16_t)tb_diff) { tcg_out32(VAR_0, ADDI | TAI(VAR_2, TCG_REG_TB, tb_diff)); return; } if (TCG_TARGET_REG_BITS == 32 || VAR_3 == (int32_t)VAR_3) { tcg_out32(VAR_0, ADDIS | TAI(VAR_2, 0, VAR_3 >> 16)); tcg_out32(VAR_0, ORI | SAI(VAR_2, VAR_2, VAR_3)); return; } if (VAR_3 == (uint32_t)VAR_3 && !(VAR_3 & 0x8000)) { tcg_out32(VAR_0, ADDI | TAI(VAR_2, 0, VAR_3)); tcg_out32(VAR_0, ORIS | SAI(VAR_2, VAR_2, VAR_3 >> 16)); return; } if (VAR_3 > 0 && (VAR_3 & 0x8000)) { tmp = VAR_3 | 0x7fff; if ((tmp & (tmp + 1)) == 0) { int VAR_6 = clz64(tmp + 1) + 1; tcg_out32(VAR_0, ADDI | TAI(VAR_2, 0, VAR_3)); tcg_out_rld(VAR_0, RLDICL, VAR_2, VAR_2, 0, VAR_6); return; } } VAR_5 = ctz64(VAR_3); tmp = VAR_3 >> VAR_5; if (tmp == (int16_t)tmp) { tcg_out32(VAR_0, ADDI | TAI(VAR_2, 0, tmp)); tcg_out_shli64(VAR_0, VAR_2, VAR_2, VAR_5); return; } VAR_5 = clz64(VAR_3); if (tcg_out_movi_one(VAR_0, VAR_2, VAR_3 << VAR_5)) { tcg_out_shri64(VAR_0, VAR_2, VAR_2, VAR_5); return; } if (!VAR_4 && USE_REG_TB && tb_diff == (int32_t)tb_diff) { tcg_out_mem_long(VAR_0, ADDI, ADD, VAR_2, TCG_REG_TB, tb_diff); return; } if (!VAR_4 && USE_REG_TB) { new_pool_label(VAR_0, VAR_3, R_PPC_ADDR16, VAR_0->code_ptr,
-(intptr_t)VAR_0->code_gen_ptr); tcg_out32(VAR_0, LD | TAI(VAR_2, TCG_REG_TB, 0)); return; } tmp = VAR_3 >> 31 >> 1; tcg_out_movi(VAR_0, TCG_TYPE_I32, VAR_2, tmp); if (tmp) { tcg_out_shli64(VAR_0, VAR_2, VAR_2, 32); } if (VAR_3 & 0xffff0000) { tcg_out32(VAR_0, ORIS | SAI(VAR_2, VAR_2, VAR_3 >> 16)); } if (VAR_3 & 0xffff) { tcg_out32(VAR_0, ORI | SAI(VAR_2, VAR_2, VAR_3)); } }