static void gen_store_exclusive(DisasContext *s, int rd, int rt, int rt2,

                                TCGv_i64 inaddr, int size, int is_pair)

{

    /* if (env->exclusive_addr == addr && env->exclusive_val == [addr]

     *     && (!is_pair || env->exclusive_high == [addr + datasize])) {

     *     [addr] = {Rt};

     *     if (is_pair) {

     *         [addr + datasize] = {Rt2};

     *     }

     *     {Rd} = 0;

     * } else {

     *     {Rd} = 1;

     * }

     * env->exclusive_addr = -1;

     */

    int fail_label = gen_new_label();

    int done_label = gen_new_label();

    TCGv_i64 addr = tcg_temp_local_new_i64();

    TCGv_i64 tmp;



    /* Copy input into a local temp so it is not trashed when the

     * basic block ends at the branch insn.

     */

    tcg_gen_mov_i64(addr, inaddr);

    tcg_gen_brcond_i64(TCG_COND_NE, addr, cpu_exclusive_addr, fail_label);



    tmp = tcg_temp_new_i64();

    tcg_gen_qemu_ld_i64(tmp, addr, get_mem_index(s), MO_TE + size);

    tcg_gen_brcond_i64(TCG_COND_NE, tmp, cpu_exclusive_val, fail_label);

    tcg_temp_free_i64(tmp);



    if (is_pair) {

        TCGv_i64 addrhi = tcg_temp_new_i64();

        TCGv_i64 tmphi = tcg_temp_new_i64();



        tcg_gen_addi_i64(addrhi, addr, 1 << size);

        tcg_gen_qemu_ld_i64(tmphi, addrhi, get_mem_index(s), MO_TE + size);

        tcg_gen_brcond_i64(TCG_COND_NE, tmphi, cpu_exclusive_high, fail_label);



        tcg_temp_free_i64(tmphi);

        tcg_temp_free_i64(addrhi);

    }



    /* We seem to still have the exclusive monitor, so do the store */

    tcg_gen_qemu_st_i64(cpu_reg(s, rt), addr, get_mem_index(s), MO_TE + size);

    if (is_pair) {

        TCGv_i64 addrhi = tcg_temp_new_i64();



        tcg_gen_addi_i64(addrhi, addr, 1 << size);

        tcg_gen_qemu_st_i64(cpu_reg(s, rt2), addrhi,

                            get_mem_index(s), MO_TE + size);

        tcg_temp_free_i64(addrhi);

    }



    tcg_temp_free_i64(addr);



    tcg_gen_movi_i64(cpu_reg(s, rd), 0);

    tcg_gen_br(done_label);

    gen_set_label(fail_label);

    tcg_gen_movi_i64(cpu_reg(s, rd), 1);

    gen_set_label(done_label);

    tcg_gen_movi_i64(cpu_exclusive_addr, -1);



}

static void gen_store_exclusive(DisasContext *s, int rd, int rt, int rt2,

                                TCGv_i64 inaddr, int size, int is_pair)

{

    























    int fail_label = gen_new_label();

    int done_label = gen_new_label();

    TCGv_i64 addr = tcg_temp_local_new_i64();

    TCGv_i64 tmp;



    





    tcg_gen_mov_i64(addr, inaddr);

    tcg_gen_brcond_i64(TCG_COND_NE, addr, cpu_exclusive_addr, fail_label);



    tmp = tcg_temp_new_i64();

    tcg_gen_qemu_ld_i64(tmp, addr, get_mem_index(s), MO_TE + size);

    tcg_gen_brcond_i64(TCG_COND_NE, tmp, cpu_exclusive_val, fail_label);

    tcg_temp_free_i64(tmp);



    if (is_pair) {

        TCGv_i64 addrhi = tcg_temp_new_i64();

        TCGv_i64 tmphi = tcg_temp_new_i64();



        tcg_gen_addi_i64(addrhi, addr, 1 << size);

        tcg_gen_qemu_ld_i64(tmphi, addrhi, get_mem_index(s), MO_TE + size);

        tcg_gen_brcond_i64(TCG_COND_NE, tmphi, cpu_exclusive_high, fail_label);



        tcg_temp_free_i64(tmphi);

        tcg_temp_free_i64(addrhi);

    }



    

    tcg_gen_qemu_st_i64(cpu_reg(s, rt), addr, get_mem_index(s), MO_TE + size);

    if (is_pair) {

        TCGv_i64 addrhi = tcg_temp_new_i64();



        tcg_gen_addi_i64(addrhi, addr, 1 << size);

        tcg_gen_qemu_st_i64(cpu_reg(s, rt2), addrhi,

                            get_mem_index(s), MO_TE + size);

        tcg_temp_free_i64(addrhi);

    }



    tcg_temp_free_i64(addr);



    tcg_gen_movi_i64(cpu_reg(s, rd), 0);

    tcg_gen_br(done_label);

    gen_set_label(fail_label);

    tcg_gen_movi_i64(cpu_reg(s, rd), 1);

    gen_set_label(done_label);

    tcg_gen_movi_i64(cpu_exclusive_addr, -1);



}

static void FUNC_0(DisasContext *VAR_0, int VAR_1, int VAR_2, int VAR_3,

                                TCGv_i64 VAR_4, int VAR_5, int VAR_6)

{

    























    int VAR_7 = gen_new_label();

    int VAR_8 = gen_new_label();

    TCGv_i64 addr = tcg_temp_local_new_i64();

    TCGv_i64 tmp;



    





    tcg_gen_mov_i64(addr, VAR_4);

    tcg_gen_brcond_i64(TCG_COND_NE, addr, cpu_exclusive_addr, VAR_7);



    tmp = tcg_temp_new_i64();

    tcg_gen_qemu_ld_i64(tmp, addr, get_mem_index(VAR_0), MO_TE + VAR_5);

    tcg_gen_brcond_i64(TCG_COND_NE, tmp, cpu_exclusive_val, VAR_7);

    tcg_temp_free_i64(tmp);



    if (VAR_6) {

        TCGv_i64 addrhi = tcg_temp_new_i64();

        TCGv_i64 tmphi = tcg_temp_new_i64();



        tcg_gen_addi_i64(addrhi, addr, 1 << VAR_5);

        tcg_gen_qemu_ld_i64(tmphi, addrhi, get_mem_index(VAR_0), MO_TE + VAR_5);

        tcg_gen_brcond_i64(TCG_COND_NE, tmphi, cpu_exclusive_high, VAR_7);



        tcg_temp_free_i64(tmphi);

        tcg_temp_free_i64(addrhi);

    }



    

    tcg_gen_qemu_st_i64(cpu_reg(VAR_0, VAR_2), addr, get_mem_index(VAR_0), MO_TE + VAR_5);

    if (VAR_6) {

        TCGv_i64 addrhi = tcg_temp_new_i64();



        tcg_gen_addi_i64(addrhi, addr, 1 << VAR_5);

        tcg_gen_qemu_st_i64(cpu_reg(VAR_0, VAR_3), addrhi,

                            get_mem_index(VAR_0), MO_TE + VAR_5);

        tcg_temp_free_i64(addrhi);

    }



    tcg_temp_free_i64(addr);



    tcg_gen_movi_i64(cpu_reg(VAR_0, VAR_1), 0);

    tcg_gen_br(VAR_8);

    gen_set_label(VAR_7);

    tcg_gen_movi_i64(cpu_reg(VAR_0, VAR_1), 1);

    gen_set_label(VAR_8);

    tcg_gen_movi_i64(cpu_exclusive_addr, -1);



}

static void FUNC_0(DisasContext *VAR_0, int VAR_1, int VAR_2, int VAR_3,
TCGv_i64 VAR_4, int VAR_5, int VAR_6)
{ int VAR_7 = gen_new_label(); int VAR_8 = gen_new_label(); TCGv_i64 addr = tcg_temp_local_new_i64(); TCGv_i64 tmp; tcg_gen_mov_i64(addr, VAR_4); tcg_gen_brcond_i64(TCG_COND_NE, addr, cpu_exclusive_addr, VAR_7); tmp = tcg_temp_new_i64(); tcg_gen_qemu_ld_i64(tmp, addr, get_mem_index(VAR_0), MO_TE + VAR_5); tcg_gen_brcond_i64(TCG_COND_NE, tmp, cpu_exclusive_val, VAR_7); tcg_temp_free_i64(tmp); if (VAR_6) { TCGv_i64 addrhi = tcg_temp_new_i64(); TCGv_i64 tmphi = tcg_temp_new_i64(); tcg_gen_addi_i64(addrhi, addr, 1 << VAR_5); tcg_gen_qemu_ld_i64(tmphi, addrhi, get_mem_index(VAR_0), MO_TE + VAR_5); tcg_gen_brcond_i64(TCG_COND_NE, tmphi, cpu_exclusive_high, VAR_7); tcg_temp_free_i64(tmphi); tcg_temp_free_i64(addrhi); } tcg_gen_qemu_st_i64(cpu_reg(VAR_0, VAR_2), addr, get_mem_index(VAR_0), MO_TE + VAR_5); if (VAR_6) { TCGv_i64 addrhi = tcg_temp_new_i64(); tcg_gen_addi_i64(addrhi, addr, 1 << VAR_5); tcg_gen_qemu_st_i64(cpu_reg(VAR_0, VAR_3), addrhi,
get_mem_index(VAR_0), MO_TE + VAR_5); tcg_temp_free_i64(addrhi); } tcg_temp_free_i64(addr); tcg_gen_movi_i64(cpu_reg(VAR_0, VAR_1), 0); tcg_gen_br(VAR_8); gen_set_label(VAR_7); tcg_gen_movi_i64(cpu_reg(VAR_0, VAR_1), 1); gen_set_label(VAR_8); tcg_gen_movi_i64(cpu_exclusive_addr, -1); }