static void tgen_andi(TCGContext *s, TCGType type, TCGReg dest, uint64_t val)

{

    static const S390Opcode ni_insns[4] = {

        RI_NILL, RI_NILH, RI_NIHL, RI_NIHH

    };

    static const S390Opcode nif_insns[2] = {

        RIL_NILF, RIL_NIHF

    };

    uint64_t valid = (type == TCG_TYPE_I32 ? 0xffffffffull : -1ull);

    int i;



    /* Look for the zero-extensions.  */

    if ((val & valid) == 0xffffffff) {

        tgen_ext32u(s, dest, dest);

        return;

    }

    if (facilities & FACILITY_EXT_IMM) {

        if ((val & valid) == 0xff) {

            tgen_ext8u(s, TCG_TYPE_I64, dest, dest);

            return;

        }

        if ((val & valid) == 0xffff) {

            tgen_ext16u(s, TCG_TYPE_I64, dest, dest);

            return;

        }

    }



    /* Try all 32-bit insns that can perform it in one go.  */

    for (i = 0; i < 4; i++) {

        tcg_target_ulong mask = ~(0xffffull << i*16);

        if (((val | ~valid) & mask) == mask) {

            tcg_out_insn_RI(s, ni_insns[i], dest, val >> i*16);

            return;

        }

    }



    /* Try all 48-bit insns that can perform it in one go.  */

    if (facilities & FACILITY_EXT_IMM) {

        for (i = 0; i < 2; i++) {

            tcg_target_ulong mask = ~(0xffffffffull << i*32);

            if (((val | ~valid) & mask) == mask) {

                tcg_out_insn_RIL(s, nif_insns[i], dest, val >> i*32);

                return;

            }

        }

    }

    if ((facilities & FACILITY_GEN_INST_EXT) && risbg_mask(val)) {

        int msb, lsb;

        if ((val & 0x8000000000000001ull) == 0x8000000000000001ull) {

            /* Achieve wraparound by swapping msb and lsb.  */

            msb = 63 - ctz64(~val);

            lsb = clz64(~val) + 1;

        } else {

            msb = clz64(val);

            lsb = 63 - ctz64(val);

        }

        tcg_out_risbg(s, dest, dest, msb, lsb, 0, 1);

        return;

    }



    /* Fall back to loading the constant.  */

    tcg_out_movi(s, type, TCG_TMP0, val);

    if (type == TCG_TYPE_I32) {

        tcg_out_insn(s, RR, NR, dest, TCG_TMP0);

    } else {

        tcg_out_insn(s, RRE, NGR, dest, TCG_TMP0);

    }

}

static void tgen_andi(TCGContext *s, TCGType type, TCGReg dest, uint64_t val)

{

    static const S390Opcode ni_insns[4] = {

        RI_NILL, RI_NILH, RI_NIHL, RI_NIHH

    };

    static const S390Opcode nif_insns[2] = {

        RIL_NILF, RIL_NIHF

    };

    uint64_t valid = (type == TCG_TYPE_I32 ? 0xffffffffull : -1ull);

    int i;



    

    if ((val & valid) == 0xffffffff) {

        tgen_ext32u(s, dest, dest);

        return;

    }

    if (facilities & FACILITY_EXT_IMM) {

        if ((val & valid) == 0xff) {

            tgen_ext8u(s, TCG_TYPE_I64, dest, dest);

            return;

        }

        if ((val & valid) == 0xffff) {

            tgen_ext16u(s, TCG_TYPE_I64, dest, dest);

            return;

        }

    }



    

    for (i = 0; i < 4; i++) {

        tcg_target_ulong mask = ~(0xffffull << i*16);

        if (((val | ~valid) & mask) == mask) {

            tcg_out_insn_RI(s, ni_insns[i], dest, val >> i*16);

            return;

        }

    }



    

    if (facilities & FACILITY_EXT_IMM) {

        for (i = 0; i < 2; i++) {

            tcg_target_ulong mask = ~(0xffffffffull << i*32);

            if (((val | ~valid) & mask) == mask) {

                tcg_out_insn_RIL(s, nif_insns[i], dest, val >> i*32);

                return;

            }

        }

    }

    if ((facilities & FACILITY_GEN_INST_EXT) && risbg_mask(val)) {

        int msb, lsb;

        if ((val & 0x8000000000000001ull) == 0x8000000000000001ull) {

            

            msb = 63 - ctz64(~val);

            lsb = clz64(~val) + 1;

        } else {

            msb = clz64(val);

            lsb = 63 - ctz64(val);

        }

        tcg_out_risbg(s, dest, dest, msb, lsb, 0, 1);

        return;

    }



    

    tcg_out_movi(s, type, TCG_TMP0, val);

    if (type == TCG_TYPE_I32) {

        tcg_out_insn(s, RR, NR, dest, TCG_TMP0);

    } else {

        tcg_out_insn(s, RRE, NGR, dest, TCG_TMP0);

    }

}

            msb = 63 - ctz64(~val);             lsb = clz64(~val) + 1;
static void FUNC_0(TCGContext *VAR_0, TCGType VAR_1, TCGReg VAR_2, uint64_t VAR_3)

{

    static const S390Opcode VAR_4[4] = {

        RI_NILL, RI_NILH, RI_NIHL, RI_NIHH

    };

    static const S390Opcode VAR_5[2] = {

        RIL_NILF, RIL_NIHF

    };

    uint64_t valid = (VAR_1 == TCG_TYPE_I32 ? 0xffffffffull : -1ull);

    int VAR_6;



    

    if ((VAR_3 & valid) == 0xffffffff) {

        tgen_ext32u(VAR_0, VAR_2, VAR_2);

        return;

    }

    if (facilities & FACILITY_EXT_IMM) {

        if ((VAR_3 & valid) == 0xff) {

            tgen_ext8u(VAR_0, TCG_TYPE_I64, VAR_2, VAR_2);

            return;

        }

        if ((VAR_3 & valid) == 0xffff) {

            tgen_ext16u(VAR_0, TCG_TYPE_I64, VAR_2, VAR_2);

            return;

        }

    }



    

    for (VAR_6 = 0; VAR_6 < 4; VAR_6++) {

        tcg_target_ulong mask = ~(0xffffull << VAR_6*16);

        if (((VAR_3 | ~valid) & mask) == mask) {

            tcg_out_insn_RI(VAR_0, VAR_4[VAR_6], VAR_2, VAR_3 >> VAR_6*16);

            return;

        }

    }



    

    if (facilities & FACILITY_EXT_IMM) {

        for (VAR_6 = 0; VAR_6 < 2; VAR_6++) {

            tcg_target_ulong mask = ~(0xffffffffull << VAR_6*32);

            if (((VAR_3 | ~valid) & mask) == mask) {

                tcg_out_insn_RIL(VAR_0, VAR_5[VAR_6], VAR_2, VAR_3 >> VAR_6*32);

                return;

            }

        }

    }

    if ((facilities & FACILITY_GEN_INST_EXT) && risbg_mask(VAR_3)) {

        int VAR_7, VAR_8;

        if ((VAR_3 & 0x8000000000000001ull) == 0x8000000000000001ull) {

            

            VAR_7 = 63 - ctz64(~VAR_3);

            VAR_8 = clz64(~VAR_3) + 1;

        } else {

            VAR_7 = clz64(VAR_3);

            VAR_8 = 63 - ctz64(VAR_3);

        }

        tcg_out_risbg(VAR_0, VAR_2, VAR_2, VAR_7, VAR_8, 0, 1);

        return;

    }



    

    tcg_out_movi(VAR_0, VAR_1, TCG_TMP0, VAR_3);

    if (VAR_1 == TCG_TYPE_I32) {

        tcg_out_insn(VAR_0, RR, NR, VAR_2, TCG_TMP0);

    } else {

        tcg_out_insn(VAR_0, RRE, NGR, VAR_2, TCG_TMP0);

    }

}

static void FUNC_0(TCGContext *VAR_0, TCGType VAR_1, TCGReg VAR_2, uint64_t VAR_3)
{ static const S390Opcode VAR_4[4] = { RI_NILL, RI_NILH, RI_NIHL, RI_NIHH
}; static const S390Opcode VAR_5[2] = { RIL_NILF, RIL_NIHF
}; uint64_t valid = (VAR_1 == TCG_TYPE_I32 ? 0xffffffffull : -1ull); int VAR_6; if ((VAR_3 & valid) == 0xffffffff) { tgen_ext32u(VAR_0, VAR_2, VAR_2); return; } if (facilities & FACILITY_EXT_IMM) { if ((VAR_3 & valid) == 0xff) { tgen_ext8u(VAR_0, TCG_TYPE_I64, VAR_2, VAR_2); return; } if ((VAR_3 & valid) == 0xffff) { tgen_ext16u(VAR_0, TCG_TYPE_I64, VAR_2, VAR_2); return; } } for (VAR_6 = 0; VAR_6 < 4; VAR_6++) { tcg_target_ulong mask = ~(0xffffull << VAR_6*16); if (((VAR_3 | ~valid) & mask) == mask) { tcg_out_insn_RI(VAR_0, VAR_4[VAR_6], VAR_2, VAR_3 >> VAR_6*16); return; } } if (facilities & FACILITY_EXT_IMM) { for (VAR_6 = 0; VAR_6 < 2; VAR_6++) { tcg_target_ulong mask = ~(0xffffffffull << VAR_6*32); if (((VAR_3 | ~valid) & mask) == mask) { tcg_out_insn_RIL(VAR_0, VAR_5[VAR_6], VAR_2, VAR_3 >> VAR_6*32); return; } } } if ((facilities & FACILITY_GEN_INST_EXT) && risbg_mask(VAR_3)) { int VAR_7, VAR_8; if ((VAR_3 & 0x8000000000000001ull) == 0x8000000000000001ull) { VAR_7 = 63 - ctz64(~VAR_3); VAR_8 = clz64(~VAR_3) + 1; } else { VAR_7 = clz64(VAR_3); VAR_8 = 63 - ctz64(VAR_3); } tcg_out_risbg(VAR_0, VAR_2, VAR_2, VAR_7, VAR_8, 0, 1); return; } tcg_out_movi(VAR_0, VAR_1, TCG_TMP0, VAR_3); if (VAR_1 == TCG_TYPE_I32) { tcg_out_insn(VAR_0, RR, NR, VAR_2, TCG_TMP0); } else { tcg_out_insn(VAR_0, RRE, NGR, VAR_2, TCG_TMP0); } }