static MegasasCmd *megasas_next_frame(MegasasState *s,

    hwaddr frame)

{

    MegasasCmd *cmd = NULL;

    int num = 0, index;



    cmd = megasas_lookup_frame(s, frame);

    if (cmd) {

        trace_megasas_qf_found(cmd->index, cmd->pa);

        return cmd;

    }

    index = s->reply_queue_head;

    num = 0;

    while (num < s->fw_cmds) {

        if (!s->frames[index].pa) {

            cmd = &s->frames[index];

            break;

        }

        index = megasas_next_index(s, index, s->fw_cmds);

        num++;

    }

    if (!cmd) {

        trace_megasas_qf_failed(frame);

    }

    trace_megasas_qf_new(index, cmd);

    return cmd;

}

static MegasasCmd *megasas_next_frame(MegasasState *s,

    hwaddr frame)

{

    MegasasCmd *cmd = NULL;

    int num = 0, index;



    cmd = megasas_lookup_frame(s, frame);

    if (cmd) {

        trace_megasas_qf_found(cmd->index, cmd->pa);

        return cmd;

    }

    index = s->reply_queue_head;

    num = 0;

    while (num < s->fw_cmds) {

        if (!s->frames[index].pa) {

            cmd = &s->frames[index];

            break;

        }

        index = megasas_next_index(s, index, s->fw_cmds);

        num++;

    }

    if (!cmd) {

        trace_megasas_qf_failed(frame);

    }

    trace_megasas_qf_new(index, cmd);

    return cmd;

}

static MegasasCmd *megasas_next_frame(MegasasState *s,     hwaddr frame)     MegasasCmd *cmd = NULL;     int num = 0, index;     cmd = megasas_lookup_frame(s, frame);     if (cmd) {         trace_megasas_qf_found(cmd->index, cmd->pa);         return cmd;     index = s->reply_queue_head;     num = 0;     while (num < s->fw_cmds) {         if (!s->frames[index].pa) {             cmd = &s->frames[index];             break;         index = megasas_next_index(s, index, s->fw_cmds);         num++;     if (!cmd) {         trace_megasas_qf_failed(frame);     trace_megasas_qf_new(index, cmd);     return cmd;     if (!cmd) {
static MegasasCmd *FUNC_0(MegasasState *s,

    hwaddr frame)

{

    MegasasCmd *cmd = NULL;

    int VAR_0 = 0, VAR_1;



    cmd = megasas_lookup_frame(s, frame);

    if (cmd) {

        trace_megasas_qf_found(cmd->VAR_1, cmd->pa);

        return cmd;

    }

    VAR_1 = s->reply_queue_head;

    VAR_0 = 0;

    while (VAR_0 < s->fw_cmds) {

        if (!s->frames[VAR_1].pa) {

            cmd = &s->frames[VAR_1];

            break;

        }

        VAR_1 = megasas_next_index(s, VAR_1, s->fw_cmds);

        VAR_0++;

    }

    if (!cmd) {

        trace_megasas_qf_failed(frame);

    }

    trace_megasas_qf_new(VAR_1, cmd);

    return cmd;

}

static MegasasCmd *FUNC_0(MegasasState *s,
hwaddr frame)
{ MegasasCmd *cmd = NULL; int VAR_0 = 0, VAR_1; cmd = megasas_lookup_frame(s, frame); if (cmd) { trace_megasas_qf_found(cmd->VAR_1, cmd->pa); return cmd; } VAR_1 = s->reply_queue_head; VAR_0 = 0; while (VAR_0 < s->fw_cmds) { if (!s->frames[VAR_1].pa) { cmd = &s->frames[VAR_1]; break; } VAR_1 = megasas_next_index(s, VAR_1, s->fw_cmds); VAR_0++; } if (!cmd) { trace_megasas_qf_failed(frame); } trace_megasas_qf_new(VAR_1, cmd); return cmd; }