void parse_file_args(int *argc, char *argv[], int nf, t_filenm fnm[],
                     const char *deffnm, gmx_bool bReadNode)
{
    int       i, j;
    gmx_bool *bRemove;

    check_opts(nf, fnm);

    for (i = 0; (i < nf); i++)
    {
        UN_SET(fnm[i]);
    }

    if (*argc > 1)
    {
        snew(bRemove, (*argc)+1);
        i = 1;
        do
        {
            for (j = 0; (j < nf); j++)
            {
                if (strcmp(argv[i], fnm[j].opt) == 0)
                {
                    DO_SET(fnm[j]);
                    bRemove[i] = TRUE;
                    i++;
                    /* check if we are out of arguments for this option */
                    if ((i >= *argc) || (argv[i][0] == '-'))
                    {
                        set_filenm(&fnm[j], fnm[j].fn, deffnm, bReadNode);
                    }
                    /* sweep up all file arguments for this option */
                    while ((i < *argc) && (argv[i][0] != '-'))
                    {
                        set_filenm(&fnm[j], argv[i], NULL, bReadNode);
                        bRemove[i] = TRUE;
                        i++;
                        /* only repeat for 'multiple' file options: */
                        if (!IS_MULT(fnm[j]))
                        {
                            break;
                        }
                    }

                    break; /* jump out of 'j' loop */
                }
            }
            /* No file found corresponding to option argv[i] */
            if (j == nf)
            {
                i++;
            }
        }
        while (i < *argc);

        /* Remove used entries */
        for (i = j = 0; (i <= *argc); i++)
        {
            if (!bRemove[i])
            {
                argv[j++] = argv[i];
            }
        }
        (*argc) = j - 1;
        sfree(bRemove);
    }

    set_filenms(nf, fnm, deffnm, bReadNode);

}
/*!
 * Memory copy using HW engines
 *  
 *  reserved [unused]
 *  pDmaInputBuffer [in] -A structure which represents the DMA input buffer.
 *  pDmaOutputBuffer [in/out] -A structure which represents the DMA output buffer.
 * 
 * \return int One of DX_SYM_* error codes defined in dx_error.h.
 */
int ProcessBypass(struct sep_ctx_generic *reserved, DmaBuffer_s *pDmaInputBuffer, DmaBuffer_s *pDmaOutputBuffer)
{
	Bypass_t dmaTypeIn, dmaTypeOut;
	int drvRc = DX_RET_OK;

	dmaTypeIn = GetBypassType(pDmaInputBuffer->dmaBufType, pDmaInputBuffer->pData);
	dmaTypeOut = GetBypassType(pDmaOutputBuffer->dmaBufType, pDmaOutputBuffer->pData);
	
	if ((dmaTypeIn == BYPASS_MAX) || (dmaTypeOut == BYPASS_MAX)) {
		DX_PAL_LOG_ERR("Invalid din/dout memory type\n");
		drvRc = DX_RET_INVARG;
		goto EndWithErr;
	}

	switch (dmaTypeIn) {
	case BYPASS_SRAM:
		switch (dmaTypeOut) {
		case BYPASS_DLLI:
			if (IS_ALIGNED(pDmaInputBuffer->pData, sizeof(uint32_t)) ||
			    IS_MULT(pDmaInputBuffer->size, sizeof(uint32_t))) { 
				DescBypass(
					DMA_SRAM, 
					pDmaInputBuffer->pData, 
					pDmaInputBuffer->size,
					pDmaInputBuffer->axiNs,
					DMA_DLLI, 
					pDmaOutputBuffer->pData,
					pDmaOutputBuffer->size,
					pDmaOutputBuffer->axiNs);
			} else {
				DX_PAL_LOG_ERR("Bad address or bad size. SRAM to DLLI copy -Input address %xl with %ul B\n",
					pDmaInputBuffer->pData, pDmaInputBuffer->size);
				drvRc = DX_RET_INVARG;
				goto EndWithErr;
			}
			break;
		default:
			DX_PAL_LOG_ERR("Invalid BYPASS mode\n");
			drvRc = DX_RET_UNSUPP_ALG_MODE;
			goto EndWithErr;
		}
		break;
	case BYPASS_DLLI:
		switch (dmaTypeOut) {
		case BYPASS_SRAM:
			if (IS_ALIGNED(pDmaInputBuffer->pData, sizeof(uint32_t)) ||
			    IS_MULT(pDmaInputBuffer->size, sizeof(uint32_t))) { 
				DescBypass(
					DMA_DLLI, 
					pDmaInputBuffer->pData, 
					pDmaInputBuffer->size,
					pDmaInputBuffer->axiNs,
					DMA_SRAM, 
					pDmaOutputBuffer->pData,
					pDmaOutputBuffer->size,
					pDmaOutputBuffer->axiNs);
			} else {
				DX_PAL_LOG_ERR("Bad address or bad size. SRAM to DLLI copy -Input address %xl with %ul B\n",
					pDmaInputBuffer->pData, pDmaInputBuffer->size);
				drvRc = DX_RET_INVARG;
				goto EndWithErr;
			}
			break;
		case BYPASS_DLLI:
			DescBypass(
				    DMA_BUF_TYPE_TO_MODE(pDmaInputBuffer->dmaBufType), 
				    pDmaInputBuffer->pData, 
				    pDmaInputBuffer->size,
				    pDmaInputBuffer->axiNs,
				    DMA_BUF_TYPE_TO_MODE(pDmaOutputBuffer->dmaBufType), 
				    pDmaOutputBuffer->pData,
				    pDmaOutputBuffer->size,
				    pDmaOutputBuffer->axiNs);
			break;
		default:
			DX_PAL_LOG_ERR("Invalid BYPASS mode\n");
			drvRc = DX_RET_UNSUPP_ALG_MODE;
			goto EndWithErr;
		}
		break;
	default:
		DX_PAL_LOG_ERR("Invalid BYPASS mode\n");
		drvRc = DX_RET_UNSUPP_ALG_MODE;
		break;
	}

EndWithErr:
	return drvRc;
}