int qemu_input_key_value_to_scancode(const KeyValue *value, bool down,

                                     int *codes)

{

    int keycode = qemu_input_key_value_to_number(value);

    int count = 0;



    if (value->type == KEY_VALUE_KIND_QCODE &&

        value->u.qcode == Q_KEY_CODE_PAUSE) {

        /* specific case */

        int v = down ? 0 : 0x80;

        codes[count++] = 0xe1;

        codes[count++] = 0x1d | v;

        codes[count++] = 0x45 | v;

        return count;

    }

    if (keycode & SCANCODE_GREY) {

        codes[count++] = SCANCODE_EMUL0;

        keycode &= ~SCANCODE_GREY;

    }

    if (!down) {

        keycode |= SCANCODE_UP;

    }

    codes[count++] = keycode;



    return count;

}

int qemu_input_key_value_to_scancode(const KeyValue *value, bool down,

                                     int *codes)

{

    int keycode = qemu_input_key_value_to_number(value);

    int count = 0;



    if (value->type == KEY_VALUE_KIND_QCODE &&

        value->u.qcode == Q_KEY_CODE_PAUSE) {

        

        int v = down ? 0 : 0x80;

        codes[count++] = 0xe1;

        codes[count++] = 0x1d | v;

        codes[count++] = 0x45 | v;

        return count;

    }

    if (keycode & SCANCODE_GREY) {

        codes[count++] = SCANCODE_EMUL0;

        keycode &= ~SCANCODE_GREY;

    }

    if (!down) {

        keycode |= SCANCODE_UP;

    }

    codes[count++] = keycode;



    return count;

}

int FUNC_0(const KeyValue *VAR_0, bool VAR_1,

                                     int *VAR_2)

{

    int VAR_3 = qemu_input_key_value_to_number(VAR_0);

    int VAR_4 = 0;



    if (VAR_0->type == KEY_VALUE_KIND_QCODE &&

        VAR_0->u.qcode == Q_KEY_CODE_PAUSE) {

        

        int VAR_5 = VAR_1 ? 0 : 0x80;

        VAR_2[VAR_4++] = 0xe1;

        VAR_2[VAR_4++] = 0x1d | VAR_5;

        VAR_2[VAR_4++] = 0x45 | VAR_5;

        return VAR_4;

    }

    if (VAR_3 & SCANCODE_GREY) {

        VAR_2[VAR_4++] = SCANCODE_EMUL0;

        VAR_3 &= ~SCANCODE_GREY;

    }

    if (!VAR_1) {

        VAR_3 |= SCANCODE_UP;

    }

    VAR_2[VAR_4++] = VAR_3;



    return VAR_4;

}

int FUNC_0(const KeyValue *VAR_0, bool VAR_1,
int *VAR_2)
{ int VAR_3 = qemu_input_key_value_to_number(VAR_0); int VAR_4 = 0; if (VAR_0->type == KEY_VALUE_KIND_QCODE &&
VAR_0->u.qcode == Q_KEY_CODE_PAUSE) { int VAR_5 = VAR_1 ? 0 : 0x80; VAR_2[VAR_4++] = 0xe1; VAR_2[VAR_4++] = 0x1d | VAR_5; VAR_2[VAR_4++] = 0x45 | VAR_5; return VAR_4; } if (VAR_3 & SCANCODE_GREY) { VAR_2[VAR_4++] = SCANCODE_EMUL0; VAR_3 &= ~SCANCODE_GREY; } if (!VAR_1) { VAR_3 |= SCANCODE_UP; } VAR_2[VAR_4++] = VAR_3; return VAR_4; }