static void nvme_init_sq(NvmeSQueue *sq, NvmeCtrl *n, uint64_t dma_addr,

    uint16_t sqid, uint16_t cqid, uint16_t size)

{

    int i;

    NvmeCQueue *cq;



    sq->ctrl = n;

    sq->dma_addr = dma_addr;

    sq->sqid = sqid;

    sq->size = size;

    sq->cqid = cqid;

    sq->head = sq->tail = 0;

    sq->io_req = g_malloc(sq->size * sizeof(*sq->io_req));



    QTAILQ_INIT(&sq->req_list);

    QTAILQ_INIT(&sq->out_req_list);

    for (i = 0; i < sq->size; i++) {

        sq->io_req[i].sq = sq;

        QTAILQ_INSERT_TAIL(&(sq->req_list), &sq->io_req[i], entry);

    }

    sq->timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, nvme_process_sq, sq);



    assert(n->cq[cqid]);

    cq = n->cq[cqid];

    QTAILQ_INSERT_TAIL(&(cq->sq_list), sq, entry);

    n->sq[sqid] = sq;

}

static void nvme_init_sq(NvmeSQueue *sq, NvmeCtrl *n, uint64_t dma_addr,

    uint16_t sqid, uint16_t cqid, uint16_t size)

{

    int i;

    NvmeCQueue *cq;



    sq->ctrl = n;

    sq->dma_addr = dma_addr;

    sq->sqid = sqid;

    sq->size = size;

    sq->cqid = cqid;

    sq->head = sq->tail = 0;

    sq->io_req = g_malloc(sq->size * sizeof(*sq->io_req));



    QTAILQ_INIT(&sq->req_list);

    QTAILQ_INIT(&sq->out_req_list);

    for (i = 0; i < sq->size; i++) {

        sq->io_req[i].sq = sq;

        QTAILQ_INSERT_TAIL(&(sq->req_list), &sq->io_req[i], entry);

    }

    sq->timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, nvme_process_sq, sq);



    assert(n->cq[cqid]);

    cq = n->cq[cqid];

    QTAILQ_INSERT_TAIL(&(cq->sq_list), sq, entry);

    n->sq[sqid] = sq;

}

    sq->io_req = g_malloc(sq->size * sizeof(*sq->io_req));
static void FUNC_0(NvmeSQueue *VAR_0, NvmeCtrl *VAR_1, uint64_t VAR_2,

    uint16_t VAR_3, uint16_t VAR_4, uint16_t VAR_5)

{

    int VAR_6;

    NvmeCQueue *cq;



    VAR_0->ctrl = VAR_1;

    VAR_0->VAR_2 = VAR_2;

    VAR_0->VAR_3 = VAR_3;

    VAR_0->VAR_5 = VAR_5;

    VAR_0->VAR_4 = VAR_4;

    VAR_0->head = VAR_0->tail = 0;

    VAR_0->io_req = g_malloc(VAR_0->VAR_5 * sizeof(*VAR_0->io_req));



    QTAILQ_INIT(&VAR_0->req_list);

    QTAILQ_INIT(&VAR_0->out_req_list);

    for (VAR_6 = 0; VAR_6 < VAR_0->VAR_5; VAR_6++) {

        VAR_0->io_req[VAR_6].VAR_0 = VAR_0;

        QTAILQ_INSERT_TAIL(&(VAR_0->req_list), &VAR_0->io_req[VAR_6], entry);

    }

    VAR_0->timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, nvme_process_sq, VAR_0);



    assert(VAR_1->cq[VAR_4]);

    cq = VAR_1->cq[VAR_4];

    QTAILQ_INSERT_TAIL(&(cq->sq_list), VAR_0, entry);

    VAR_1->VAR_0[VAR_3] = VAR_0;

}

static void FUNC_0(NvmeSQueue *VAR_0, NvmeCtrl *VAR_1, uint64_t VAR_2,
uint16_t VAR_3, uint16_t VAR_4, uint16_t VAR_5)
{ int VAR_6; NvmeCQueue *cq; VAR_0->ctrl = VAR_1; VAR_0->VAR_2 = VAR_2; VAR_0->VAR_3 = VAR_3; VAR_0->VAR_5 = VAR_5; VAR_0->VAR_4 = VAR_4; VAR_0->head = VAR_0->tail = 0; VAR_0->io_req = g_malloc(VAR_0->VAR_5 * sizeof(*VAR_0->io_req)); QTAILQ_INIT(&VAR_0->req_list); QTAILQ_INIT(&VAR_0->out_req_list); for (VAR_6 = 0; VAR_6 < VAR_0->VAR_5; VAR_6++) { VAR_0->io_req[VAR_6].VAR_0 = VAR_0; QTAILQ_INSERT_TAIL(&(VAR_0->req_list), &VAR_0->io_req[VAR_6], entry); } VAR_0->timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, nvme_process_sq, VAR_0); assert(VAR_1->cq[VAR_4]); cq = VAR_1->cq[VAR_4]; QTAILQ_INSERT_TAIL(&(cq->sq_list), VAR_0, entry); VAR_1->VAR_0[VAR_3] = VAR_0; }