static void save_native_fp_fsave(CPUState *env)

{

    int fptag, i, j;

    uint16_t fpuc;

    struct fpstate fp1, *fp = &fp1;



    asm volatile ("fsave %0" : : "m" (*fp));

    env->fpuc = fp->fpuc;

    env->fpstt = (fp->fpus >> 11) & 7;

    env->fpus = fp->fpus & ~0x3800;

    fptag = fp->fptag;

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

        env->fptags[i] = ((fptag & 3) == 3);

        fptag >>= 2;

    }

    j = env->fpstt;

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

        memcpy(&env->fpregs[j].d, &fp->fpregs1[i * 10], 10);

        j = (j + 1) & 7;

    }

    /* we must restore the default rounding state */

    fpuc = 0x037f | (env->fpuc & (3 << 10));

    asm volatile("fldcw %0" : : "m" (fpuc));

}

static void save_native_fp_fsave(CPUState *env)

{

    int fptag, i, j;

    uint16_t fpuc;

    struct fpstate fp1, *fp = &fp1;



    asm volatile ("fsave %0" : : "m" (*fp));

    env->fpuc = fp->fpuc;

    env->fpstt = (fp->fpus >> 11) & 7;

    env->fpus = fp->fpus & ~0x3800;

    fptag = fp->fptag;

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

        env->fptags[i] = ((fptag & 3) == 3);

        fptag >>= 2;

    }

    j = env->fpstt;

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

        memcpy(&env->fpregs[j].d, &fp->fpregs1[i * 10], 10);

        j = (j + 1) & 7;

    }

    

    fpuc = 0x037f | (env->fpuc & (3 << 10));

    asm volatile("fldcw %0" : : "m" (fpuc));

}

static void FUNC_0(CPUState *VAR_0)

{

    int VAR_1, VAR_2, VAR_3;

    uint16_t fpuc;

    struct fpstate VAR_4, *VAR_5 = &VAR_4;



    asm volatile ("fsave %0" : : "m" (*VAR_5));

    VAR_0->fpuc = VAR_5->fpuc;

    VAR_0->fpstt = (VAR_5->fpus >> 11) & 7;

    VAR_0->fpus = VAR_5->fpus & ~0x3800;

    VAR_1 = VAR_5->VAR_1;

    for(VAR_2 = 0;VAR_2 < 8; VAR_2++) {

        VAR_0->fptags[VAR_2] = ((VAR_1 & 3) == 3);

        VAR_1 >>= 2;

    }

    VAR_3 = VAR_0->fpstt;

    for(VAR_2 = 0;VAR_2 < 8; VAR_2++) {

        memcpy(&VAR_0->fpregs[VAR_3].d, &VAR_5->fpregs1[VAR_2 * 10], 10);

        VAR_3 = (VAR_3 + 1) & 7;

    }

    

    fpuc = 0x037f | (VAR_0->fpuc & (3 << 10));

    asm volatile("fldcw %0" : : "m" (fpuc));

}

static void FUNC_0(CPUState *VAR_0)
{ int VAR_1, VAR_2, VAR_3; uint16_t fpuc; struct fpstate VAR_4, *VAR_5 = &VAR_4; asm volatile ("fsave %0" : : "m" (*VAR_5)); VAR_0->fpuc = VAR_5->fpuc; VAR_0->fpstt = (VAR_5->fpus >> 11) & 7; VAR_0->fpus = VAR_5->fpus & ~0x3800; VAR_1 = VAR_5->VAR_1; for(VAR_2 = 0;VAR_2 < 8; VAR_2++) { VAR_0->fptags[VAR_2] = ((VAR_1 & 3) == 3); VAR_1 >>= 2; } VAR_3 = VAR_0->fpstt; for(VAR_2 = 0;VAR_2 < 8; VAR_2++) { memcpy(&VAR_0->fpregs[VAR_3].d, &VAR_5->fpregs1[VAR_2 * 10], 10); VAR_3 = (VAR_3 + 1) & 7; } fpuc = 0x037f | (VAR_0->fpuc & (3 << 10)); asm volatile("fldcw %0" : : "m" (fpuc)); }