static void disas_ldst_reg_imm9(DisasContext *s, uint32_t insn,

                                int opc,

                                int size,

                                int rt,

                                bool is_vector)

{

    int rn = extract32(insn, 5, 5);

    int imm9 = sextract32(insn, 12, 9);

    int idx = extract32(insn, 10, 2);

    bool is_signed = false;

    bool is_store = false;

    bool is_extended = false;

    bool is_unpriv = (idx == 2);

    bool iss_valid = !is_vector;

    bool post_index;

    bool writeback;



    TCGv_i64 tcg_addr;



    if (is_vector) {

        size |= (opc & 2) << 1;

        if (size > 4 || is_unpriv) {

            unallocated_encoding(s);

            return;

        }

        is_store = ((opc & 1) == 0);

        if (!fp_access_check(s)) {

            return;

        }

    } else {

        if (size == 3 && opc == 2) {

            /* PRFM - prefetch */

            if (is_unpriv) {

                unallocated_encoding(s);

                return;

            }

            return;

        }

        if (opc == 3 && size > 1) {

            unallocated_encoding(s);

            return;

        }

        is_store = (opc == 0);

        is_signed = extract32(opc, 1, 1);

        is_extended = (size < 3) && extract32(opc, 0, 1);

    }



    switch (idx) {

    case 0:

    case 2:

        post_index = false;

        writeback = false;

        break;

    case 1:

        post_index = true;

        writeback = true;

        break;

    case 3:

        post_index = false;

        writeback = true;

        break;



    }



    if (rn == 31) {

        gen_check_sp_alignment(s);

    }

    tcg_addr = read_cpu_reg_sp(s, rn, 1);



    if (!post_index) {

        tcg_gen_addi_i64(tcg_addr, tcg_addr, imm9);

    }



    if (is_vector) {

        if (is_store) {

            do_fp_st(s, rt, tcg_addr, size);

        } else {

            do_fp_ld(s, rt, tcg_addr, size);

        }

    } else {

        TCGv_i64 tcg_rt = cpu_reg(s, rt);

        int memidx = is_unpriv ? get_a64_user_mem_index(s) : get_mem_index(s);

        bool iss_sf = disas_ldst_compute_iss_sf(size, is_signed, opc);



        if (is_store) {

            do_gpr_st_memidx(s, tcg_rt, tcg_addr, size, memidx,

                             iss_valid, rt, iss_sf, false);

        } else {

            do_gpr_ld_memidx(s, tcg_rt, tcg_addr, size,

                             is_signed, is_extended, memidx,

                             iss_valid, rt, iss_sf, false);

        }

    }



    if (writeback) {

        TCGv_i64 tcg_rn = cpu_reg_sp(s, rn);

        if (post_index) {

            tcg_gen_addi_i64(tcg_addr, tcg_addr, imm9);

        }

        tcg_gen_mov_i64(tcg_rn, tcg_addr);

    }

}
static void disas_ldst_reg_imm9(DisasContext *s, uint32_t insn,

                                int opc,

                                int size,

                                int rt,

                                bool is_vector)

{

    int rn = extract32(insn, 5, 5);

    int imm9 = sextract32(insn, 12, 9);

    int idx = extract32(insn, 10, 2);

    bool is_signed = false;

    bool is_store = false;

    bool is_extended = false;

    bool is_unpriv = (idx == 2);

    bool iss_valid = !is_vector;

    bool post_index;

    bool writeback;



    TCGv_i64 tcg_addr;



    if (is_vector) {

        size |= (opc & 2) << 1;

        if (size > 4 || is_unpriv) {

            unallocated_encoding(s);

            return;

        }

        is_store = ((opc & 1) == 0);

        if (!fp_access_check(s)) {

            return;

        }

    } else {

        if (size == 3 && opc == 2) {

            

            if (is_unpriv) {

                unallocated_encoding(s);

                return;

            }

            return;

        }

        if (opc == 3 && size > 1) {

            unallocated_encoding(s);

            return;

        }

        is_store = (opc == 0);

        is_signed = extract32(opc, 1, 1);

        is_extended = (size < 3) && extract32(opc, 0, 1);

    }



    switch (idx) {

    case 0:

    case 2:

        post_index = false;

        writeback = false;

        break;

    case 1:

        post_index = true;

        writeback = true;

        break;

    case 3:

        post_index = false;

        writeback = true;

        break;



    }



    if (rn == 31) {

        gen_check_sp_alignment(s);

    }

    tcg_addr = read_cpu_reg_sp(s, rn, 1);



    if (!post_index) {

        tcg_gen_addi_i64(tcg_addr, tcg_addr, imm9);

    }



    if (is_vector) {

        if (is_store) {

            do_fp_st(s, rt, tcg_addr, size);

        } else {

            do_fp_ld(s, rt, tcg_addr, size);

        }

    } else {

        TCGv_i64 tcg_rt = cpu_reg(s, rt);

        int memidx = is_unpriv ? get_a64_user_mem_index(s) : get_mem_index(s);

        bool iss_sf = disas_ldst_compute_iss_sf(size, is_signed, opc);



        if (is_store) {

            do_gpr_st_memidx(s, tcg_rt, tcg_addr, size, memidx,

                             iss_valid, rt, iss_sf, false);

        } else {

            do_gpr_ld_memidx(s, tcg_rt, tcg_addr, size,

                             is_signed, is_extended, memidx,

                             iss_valid, rt, iss_sf, false);

        }

    }



    if (writeback) {

        TCGv_i64 tcg_rn = cpu_reg_sp(s, rn);

        if (post_index) {

            tcg_gen_addi_i64(tcg_addr, tcg_addr, imm9);

        }

        tcg_gen_mov_i64(tcg_rn, tcg_addr);

    }

}
static void FUNC_0(DisasContext *VAR_0, uint32_t VAR_1,

                                int VAR_2,

                                int VAR_3,

                                int VAR_4,

                                bool VAR_5)

{

    int VAR_6 = extract32(VAR_1, 5, 5);

    int VAR_7 = sextract32(VAR_1, 12, 9);

    int VAR_8 = extract32(VAR_1, 10, 2);

    bool is_signed = false;

    bool is_store = false;

    bool is_extended = false;

    bool is_unpriv = (VAR_8 == 2);

    bool iss_valid = !VAR_5;

    bool post_index;

    bool writeback;



    TCGv_i64 tcg_addr;



    if (VAR_5) {

        VAR_3 |= (VAR_2 & 2) << 1;

        if (VAR_3 > 4 || is_unpriv) {

            unallocated_encoding(VAR_0);

            return;

        }

        is_store = ((VAR_2 & 1) == 0);

        if (!fp_access_check(VAR_0)) {

            return;

        }

    } else {

        if (VAR_3 == 3 && VAR_2 == 2) {

            

            if (is_unpriv) {

                unallocated_encoding(VAR_0);

                return;

            }

            return;

        }

        if (VAR_2 == 3 && VAR_3 > 1) {

            unallocated_encoding(VAR_0);

            return;

        }

        is_store = (VAR_2 == 0);

        is_signed = extract32(VAR_2, 1, 1);

        is_extended = (VAR_3 < 3) && extract32(VAR_2, 0, 1);

    }



    switch (VAR_8) {

    case 0:

    case 2:

        post_index = false;

        writeback = false;

        break;

    case 1:

        post_index = true;

        writeback = true;

        break;

    case 3:

        post_index = false;

        writeback = true;

        break;



    }



    if (VAR_6 == 31) {

        gen_check_sp_alignment(VAR_0);

    }

    tcg_addr = read_cpu_reg_sp(VAR_0, VAR_6, 1);



    if (!post_index) {

        tcg_gen_addi_i64(tcg_addr, tcg_addr, VAR_7);

    }



    if (VAR_5) {

        if (is_store) {

            do_fp_st(VAR_0, VAR_4, tcg_addr, VAR_3);

        } else {

            do_fp_ld(VAR_0, VAR_4, tcg_addr, VAR_3);

        }

    } else {

        TCGv_i64 tcg_rt = cpu_reg(VAR_0, VAR_4);

        int VAR_9 = is_unpriv ? get_a64_user_mem_index(VAR_0) : get_mem_index(VAR_0);

        bool iss_sf = disas_ldst_compute_iss_sf(VAR_3, is_signed, VAR_2);



        if (is_store) {

            do_gpr_st_memidx(VAR_0, tcg_rt, tcg_addr, VAR_3, VAR_9,

                             iss_valid, VAR_4, iss_sf, false);

        } else {

            do_gpr_ld_memidx(VAR_0, tcg_rt, tcg_addr, VAR_3,

                             is_signed, is_extended, VAR_9,

                             iss_valid, VAR_4, iss_sf, false);

        }

    }



    if (writeback) {

        TCGv_i64 tcg_rn = cpu_reg_sp(VAR_0, VAR_6);

        if (post_index) {

            tcg_gen_addi_i64(tcg_addr, tcg_addr, VAR_7);

        }

        tcg_gen_mov_i64(tcg_rn, tcg_addr);

    }

}
static void FUNC_0(DisasContext *VAR_0, uint32_t VAR_1,
int VAR_2,
int VAR_3,
int VAR_4,
bool VAR_5)
{ int VAR_6 = extract32(VAR_1, 5, 5); int VAR_7 = sextract32(VAR_1, 12, 9); int VAR_8 = extract32(VAR_1, 10, 2); bool is_signed = false; bool is_store = false; bool is_extended = false; bool is_unpriv = (VAR_8 == 2); bool iss_valid = !VAR_5; bool post_index; bool writeback; TCGv_i64 tcg_addr; if (VAR_5) { VAR_3 |= (VAR_2 & 2) << 1; if (VAR_3 > 4 || is_unpriv) { unallocated_encoding(VAR_0); return; } is_store = ((VAR_2 & 1) == 0); if (!fp_access_check(VAR_0)) { return; } } else { if (VAR_3 == 3 && VAR_2 == 2) { if (is_unpriv) { unallocated_encoding(VAR_0); return; } return; } if (VAR_2 == 3 && VAR_3 > 1) { unallocated_encoding(VAR_0); return; } is_store = (VAR_2 == 0); is_signed = extract32(VAR_2, 1, 1); is_extended = (VAR_3 < 3) && extract32(VAR_2, 0, 1); } switch (VAR_8) { case 0:
case 2:
post_index = false; writeback = false; break; case 1:
post_index = true; writeback = true; break; case 3:
post_index = false; writeback = true; break; } if (VAR_6 == 31) { gen_check_sp_alignment(VAR_0); } tcg_addr = read_cpu_reg_sp(VAR_0, VAR_6, 1); if (!post_index) { tcg_gen_addi_i64(tcg_addr, tcg_addr, VAR_7); } if (VAR_5) { if (is_store) { do_fp_st(VAR_0, VAR_4, tcg_addr, VAR_3); } else { do_fp_ld(VAR_0, VAR_4, tcg_addr, VAR_3); } } else { TCGv_i64 tcg_rt = cpu_reg(VAR_0, VAR_4); int VAR_9 = is_unpriv ? get_a64_user_mem_index(VAR_0) : get_mem_index(VAR_0); bool iss_sf = disas_ldst_compute_iss_sf(VAR_3, is_signed, VAR_2); if (is_store) { do_gpr_st_memidx(VAR_0, tcg_rt, tcg_addr, VAR_3, VAR_9,
iss_valid, VAR_4, iss_sf, false); } else { do_gpr_ld_memidx(VAR_0, tcg_rt, tcg_addr, VAR_3,
is_signed, is_extended, VAR_9,
iss_valid, VAR_4, iss_sf, false); } } if (writeback) { TCGv_i64 tcg_rn = cpu_reg_sp(VAR_0, VAR_6); if (post_index) { tcg_gen_addi_i64(tcg_addr, tcg_addr, VAR_7); } tcg_gen_mov_i64(tcg_rn, tcg_addr); } }