int main (int argc, char *argv[])
{
    short *samps;
    int  i, j, buflen, endutt, blksize, nhypwds, nsamp;
    char   *argsfile, *ctlfile, *indir;
    char   filename[512], cepfile[512];
    partialhyp_t *parthyp;
    FILE *fp, *sfp;

    
    fprintf(stderr,"At the beginning\n");
    if (argc != 4) {
      argsfile = NULL;
      parse_args_file(argsfile);
      E_FATAL("\nUSAGE: %s <ctlfile> <inrawdir> <argsfile>\n",argv[0]);
    }
    ctlfile = argv[1]; indir = argv[2]; argsfile = argv[3];
    fprintf(stderr,"before calloc\n");
    samps = (short *) calloc(MAXSAMPLES,sizeof(short));
    blksize = 2000;
    
    fprintf(stderr,"after calloc\n");
    if ((fp = fopen(ctlfile,"r")) == NULL)
	E_FATAL("Unable to read %s\n",ctlfile);

    live_initialize_decoder(argsfile);
    fprintf(stderr,"after initialize decode\n");
#ifdef VTUNE
    VTResume();
#endif

    while (fscanf(fp,"%s",filename) != EOF){
	sprintf(cepfile,"%s/%s.raw",indir,filename);
	if ((sfp = fopen(cepfile,"rb")) == NULL)
	    E_FATAL("Unable to read %s\n",cepfile);
		nsamp = fread(samps, sizeof(short), MAXSAMPLES, sfp);
        fprintf(stdout,"%d samples in file %s.\nWill be decoded in blocks of %d\n",nsamp,cepfile,blksize);
        fflush(stdout); fclose(sfp);

        for (i=0;i<nsamp;i+=blksize){
	    buflen = i+blksize < nsamp ? blksize : nsamp-i;
	    endutt = i+blksize <= nsamp-1 ? 0 : 1;
	    nhypwds = live_utt_decode_block(samps+i,buflen,endutt,&parthyp);

	    E_INFO("PARTIAL HYP:");
	    if (nhypwds > 0)
                for (j=0; j < nhypwds; j++) fprintf(stderr," %s",parthyp[j].word);
	    fprintf(stderr,"\n");
        }

    }
    return 0;
}
//-----------------------------------------------------------------------------
// The application main loop
//-----------------------------------------------------------------------------
int CIHVTestApp::Main()
{
	SpewOutputFunc( IHVTestSpewFunc );
		    
	if ( !SetupStudioRender() )
	{
		return 0;
	}

	if ( !InitMaterialSystem( m_hWnd ) )
	{
		return 0;
	}

#if !defined( _X360 ) // X360TBD:
extern void Sys_InitFloatTime( void ); //garymcthack
	Sys_InitFloatTime();
#endif

	LoadModels();

#if USE_VTUNE
	VTResume();
#endif
#ifdef USE_VPROF
	g_VProfCurrentProfile.Start();
#endif

	bool m_bExitMainLoop = false;
	while (!m_bExitMainLoop && !g_BenchFinished)
	{
		AppPumpMessages();
		RenderFrame();
	}

#ifdef USE_VPROF
	g_VProfCurrentProfile.Stop();
#endif
	g_IHVTestFP = fopen( "ihvtest_vprof.txt", "w" );
#ifdef USE_VPROF
	SpewOutputFunc( IHVTestVProfSpewFunc );
	g_VProfCurrentProfile.OutputReport( VPRT_SUMMARY );
	g_VProfCurrentProfile.OutputReport( VPRT_HIERARCHY_TIME_PER_FRAME_AND_COUNT_ONLY );
	fclose( g_IHVTestFP );
	SpewOutputFunc( IHVTestSpewFunc );
#endif
#if USE_VTUNE
	VTPause();
#endif

    return 0;
}
	/** Resumes profiling. */
	virtual void ProfilerResumeFunction() override
	{
		VTResume();
	}