(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
i386/
pr36064.c
       1  /* { dg-do compile } */
       2  /* { dg-require-effective-target ilp32 } */
       3  /* { dg-options "-O1 -march=core2" } */
       4  
       5  typedef long long ogg_int64_t;
       6  
       7  typedef struct vorbis_info
       8  {
       9    long rate;
      10  } vorbis_info;
      11  
      12  typedef struct OggVorbis_File
      13  {
      14    int seekable;
      15    int links;
      16    ogg_int64_t *pcmlengths;
      17    vorbis_info *vi;
      18    int ready_state;
      19  } OggVorbis_File;
      20  
      21  extern double ov_time_total (OggVorbis_File * vf, int i);
      22  extern int ov_pcm_seek_page (OggVorbis_File * vf, ogg_int64_t pos);
      23  
      24  int
      25  ov_time_seek_page (OggVorbis_File * vf, double seconds)
      26  {
      27    int link = -1;
      28    ogg_int64_t pcm_total = 0;
      29    double time_total = 0.;
      30  
      31    if (vf->ready_state < 2)
      32      return (-131);
      33    if (!vf->seekable)
      34      return (-138);
      35    if (seconds < 0)
      36      return (-131);
      37  
      38    for (link = 0; link < vf->links; link++)
      39      {
      40        double addsec = ov_time_total (vf, link);
      41        if (seconds < time_total + addsec)
      42  	break;
      43        time_total += addsec;
      44        pcm_total += vf->pcmlengths[link * 2 + 1];
      45      }
      46  
      47    if (link == vf->links)
      48      return (-131);
      49  
      50    {
      51      ogg_int64_t target =
      52        pcm_total + (seconds - time_total) * vf->vi[link].rate;
      53      return (ov_pcm_seek_page (vf, target));
      54    }
      55  }