void vnc_init_state(VncState *vs)

{

    vs->initialized = true;

    VncDisplay *vd = vs->vd;



    vs->last_x = -1;

    vs->last_y = -1;



    vs->as.freq = 44100;

    vs->as.nchannels = 2;

    vs->as.fmt = AUD_FMT_S16;

    vs->as.endianness = 0;



    qemu_mutex_init(&vs->output_mutex);

    vs->bh = qemu_bh_new(vnc_jobs_bh, vs);



    QTAILQ_INSERT_HEAD(&vd->clients, vs, next);



    graphic_hw_update(vd->dcl.con);



    vnc_write(vs, "RFB 003.008\n", 12);

    vnc_flush(vs);

    vnc_read_when(vs, protocol_version, 12);

    reset_keys(vs);

    if (vs->vd->lock_key_sync)

        vs->led = qemu_add_led_event_handler(kbd_leds, vs);



    vs->mouse_mode_notifier.notify = check_pointer_type_change;

    qemu_add_mouse_mode_change_notifier(&vs->mouse_mode_notifier);



    /* vs might be free()ed here */

}

void vnc_init_state(VncState *vs)

{

    vs->initialized = true;

    VncDisplay *vd = vs->vd;



    vs->last_x = -1;

    vs->last_y = -1;



    vs->as.freq = 44100;

    vs->as.nchannels = 2;

    vs->as.fmt = AUD_FMT_S16;

    vs->as.endianness = 0;



    qemu_mutex_init(&vs->output_mutex);

    vs->bh = qemu_bh_new(vnc_jobs_bh, vs);



    QTAILQ_INSERT_HEAD(&vd->clients, vs, next);



    graphic_hw_update(vd->dcl.con);



    vnc_write(vs, "RFB 003.008\n", 12);

    vnc_flush(vs);

    vnc_read_when(vs, protocol_version, 12);

    reset_keys(vs);

    if (vs->vd->lock_key_sync)

        vs->led = qemu_add_led_event_handler(kbd_leds, vs);



    vs->mouse_mode_notifier.notify = check_pointer_type_change;

    qemu_add_mouse_mode_change_notifier(&vs->mouse_mode_notifier);



    

}

    QTAILQ_INSERT_HEAD(&vd->clients, vs, next);
void FUNC_0(VncState *VAR_0)

{

    VAR_0->initialized = true;

    VncDisplay *vd = VAR_0->vd;



    VAR_0->last_x = -1;

    VAR_0->last_y = -1;



    VAR_0->as.freq = 44100;

    VAR_0->as.nchannels = 2;

    VAR_0->as.fmt = AUD_FMT_S16;

    VAR_0->as.endianness = 0;



    qemu_mutex_init(&VAR_0->output_mutex);

    VAR_0->bh = qemu_bh_new(vnc_jobs_bh, VAR_0);



    QTAILQ_INSERT_HEAD(&vd->clients, VAR_0, next);



    graphic_hw_update(vd->dcl.con);



    vnc_write(VAR_0, "RFB 003.008\n", 12);

    vnc_flush(VAR_0);

    vnc_read_when(VAR_0, protocol_version, 12);

    reset_keys(VAR_0);

    if (VAR_0->vd->lock_key_sync)

        VAR_0->led = qemu_add_led_event_handler(kbd_leds, VAR_0);



    VAR_0->mouse_mode_notifier.notify = check_pointer_type_change;

    qemu_add_mouse_mode_change_notifier(&VAR_0->mouse_mode_notifier);



    

}

void FUNC_0(VncState *VAR_0)
{ VAR_0->initialized = true; VncDisplay *vd = VAR_0->vd; VAR_0->last_x = -1; VAR_0->last_y = -1; VAR_0->as.freq = 44100; VAR_0->as.nchannels = 2; VAR_0->as.fmt = AUD_FMT_S16; VAR_0->as.endianness = 0; qemu_mutex_init(&VAR_0->output_mutex); VAR_0->bh = qemu_bh_new(vnc_jobs_bh, VAR_0); QTAILQ_INSERT_HEAD(&vd->clients, VAR_0, next); graphic_hw_update(vd->dcl.con); vnc_write(VAR_0, "RFB 003.008\n", 12); vnc_flush(VAR_0); vnc_read_when(VAR_0, protocol_version, 12); reset_keys(VAR_0); if (VAR_0->vd->lock_key_sync)
VAR_0->led = qemu_add_led_event_handler(kbd_leds, VAR_0); VAR_0->mouse_mode_notifier.notify = check_pointer_type_change; qemu_add_mouse_mode_change_notifier(&VAR_0->mouse_mode_notifier); }