main (gint argc, gchar * * argv)
{
  int argc.0;
  gchar * * argv.1;
  gchar * D.18295;
  int D.18288;
  <unnamed type> _gst_debug_min.2;
  long int D.18302;
  long int D.18303;
  struct GstDebugCategory * GST_CAT_DEFAULT.3;
  <unnamed type> D.18307;
  gint D.18310;

  {
    gint res;
    struct GstElement * bin;
    struct GstBus * bus;
    struct GMainLoop * loop;
    const gchar * uri;
    void Error = <<< error >>>;
    static const char __FUNCTION__[5] = "main";

    res = 1;
    gst_init (&argc, &argv);
    argc.0 = argc;
    if (argc.0 <= 1) goto <D.18292>; else goto <D.18293>;
    <D.18292>:
    argv.1 = argv;
    D.18295 = *argv.1;
    printf ("Usage: %s <uri>\n", D.18295);
    goto Error;
    <D.18293>:
    argv.1 = argv;
    uri = MEM[(gchar * *)argv.1 + 8B];
    bin = gst_element_factory_make ("playbin", 0B);
    if (bin == 0B) goto <D.18296>; else goto <D.18297>;
    <D.18296>:
    {
      int _g_boolean_var_;

      {
        _gst_debug_min.2 = _gst_debug_min;
        if (_gst_debug_min.2 > 1) goto <D.18299>; else goto <D.18300>;
        <D.18299>:
        _g_boolean_var_ = 1;
        goto <D.18301>;
        <D.18300>:
        _g_boolean_var_ = 0;
        <D.18301>:
      }
      D.18288 = _g_boolean_var_;
    }
    D.18302 = (long int) D.18288;
    D.18303 = __builtin_expect (D.18302, 0);
    if (D.18303 != 0) goto <D.18304>; else goto <D.18305>;
    <D.18304>:
    GST_CAT_DEFAULT.3 = GST_CAT_DEFAULT;
    gst_debug_log (GST_CAT_DEFAULT.3, 2, "position-formats.c", &__FUNCTION__, 120, 0B, "need playbin from gst-plugins-base");
    <D.18305>:
    goto Error;
    <D.18297>:
    g_object_set (bin, "uri", uri, 0B);
    loop = g_main_loop_new (0B, 1);
    bus = gst_pipeline_get_bus (bin);
    gst_bus_add_watch (bus, bus_message, loop);
    gst_object_unref (bus);
    g_timeout_add_seconds (1, run_queries, bin);
    D.18307 = gst_element_set_state (bin, 4);
    if (D.18307 != 0) goto <D.18308>; else goto <D.18309>;
    <D.18308>:
    g_main_loop_run (loop);
    gst_element_set_state (bin, 1);
    <D.18309>:
    g_main_loop_unref (loop);
    gst_object_unref (bin);
    res = 0;
    Error:
    D.18310 = res;
    return D.18310;
  }
  D.18310 = 0;
  return D.18310;
}


run_queries (void * user_data)
{
  const gchar * D.18312;
  long int pos.4;
  long int dur.5;
  gboolean D.18315;
  struct GstElement * bin;
  GstFormat i;
  GstFormat fmt;
  gint64 pos;
  gint64 dur;
  gboolean pres;
  gboolean dres;

  try
    {
      bin = user_data;
      i = 1;
      goto <D.18275>;
      <D.18274>:
      fmt = i;
      pres = gst_element_query_position (bin, fmt, &pos);
      fmt = i;
      dres = gst_element_query_duration (bin, fmt, &dur);
      D.18312 = gst_format_get_name (i);
      printf ("%-8s : ", D.18312);
      pos.4 = pos;
      print_value (pres, fmt, pos.4);
      printf (" / ");
      dur.5 = dur;
      print_value (dres, fmt, dur.5);
      printf ("\n");
      i = i + 1;
      <D.18275>:
      if (i <= 5) goto <D.18274>; else goto <D.18276>;
      <D.18276>:
      printf ("\n");
      D.18315 = 1;
      return D.18315;
    }
  finally
    {
      pos = {CLOBBER};
      dur = {CLOBBER};
    }
}


print_value (gboolean res, GstFormat fmt, gint64 val)
{
  unsigned int iftmp.6;
  long unsigned int val.7;
  long unsigned int D.18324;
  unsigned int iftmp.8;
  long unsigned int D.18329;
  long unsigned int D.18330;
  unsigned int iftmp.9;
  long unsigned int D.18335;
  long unsigned int D.18336;
  unsigned int iftmp.10;
  long unsigned int D.18341;
  double D.18343;
  double D.18344;

  if (res != 0) goto <D.18318>; else goto <D.18319>;
  <D.18318>:
  switch (fmt) <default: <D.18263>, case 1: <D.18260>, case 2: <D.18261>, case 3: <D.18257>, case 4: <D.18262>, case 5: <D.18259>>
  <D.18257>:
  if (val != -1) goto <D.18321>; else goto <D.18322>;
  <D.18321>:
  val.7 = (long unsigned int) val;
  D.18324 = val.7 % 1000000000;
  iftmp.6 = (unsigned int) D.18324;
  goto <D.18325>;
  <D.18322>:
  iftmp.6 = 999999999;
  <D.18325>:
  if (val != -1) goto <D.18327>; else goto <D.18328>;
  <D.18327>:
  val.7 = (long unsigned int) val;
  D.18329 = val.7 / 1000000000;
  D.18330 = D.18329 % 60;
  iftmp.8 = (unsigned int) D.18330;
  goto <D.18331>;
  <D.18328>:
  iftmp.8 = 99;
  <D.18331>:
  if (val != -1) goto <D.18333>; else goto <D.18334>;
  <D.18333>:
  val.7 = (long unsigned int) val;
  D.18335 = val.7 / 60000000000;
  D.18336 = D.18335 % 60;
  iftmp.9 = (unsigned int) D.18336;
  goto <D.18337>;
  <D.18334>:
  iftmp.9 = 99;
  <D.18337>:
  if (val != -1) goto <D.18339>; else goto <D.18340>;
  <D.18339>:
  val.7 = (long unsigned int) val;
  D.18341 = val.7 / 3600000000000;
  iftmp.10 = (unsigned int) D.18341;
  goto <D.18342>;
  <D.18340>:
  iftmp.10 = 99;
  <D.18342>:
  printf ("%u:%02u:%02u.%09u", iftmp.10, iftmp.9, iftmp.8, iftmp.6);
  goto <D.18258>;
  <D.18259>:
  D.18343 = (double) val;
  D.18344 = D.18343 / 1.0e+4;
  printf ("%8.4lf%%", D.18344);
  goto <D.18258>;
  <D.18260>:
  <D.18261>:
  <D.18262>:
  <D.18263>:
  printf ("%li", val);
  goto <D.18258>;
  <D.18258>:
  goto <D.18345>;
  <D.18319>:
  printf ("-");
  <D.18345>:
}


bus_message (struct GstBus * bus, struct GstMessage * message, void * user_data)
{
  <unnamed type> D.18346;
  gchar * debug.11;
  struct GError * gerror.12;
  struct GstObject * D.18349;
  gchar * debug.13;
  struct GError * gerror.14;
  gboolean D.18352;
  struct GMainLoop * loop;

  loop = user_data;
  D.18346 = message->type;
  switch (D.18346) <default: <D.18251>, case 1: <D.18250>, case 2: <D.18243>, case 4: <D.18247>>
  <D.18243>:
  {
    struct GError * gerror;
    gchar * debug;

    try
      {
        gst_message_parse_error (message, &gerror, &debug);
        debug.11 = debug;
        gerror.12 = gerror;
        D.18349 = message->src;
        gst_object_default_error (D.18349, gerror.12, debug.11);
        gerror.12 = gerror;
        g_error_free (gerror.12);
        debug.11 = debug;
        g_free (debug.11);
        g_main_loop_quit (loop);
        goto <D.18246>;
      }
    finally
      {
        gerror = {CLOBBER};
        debug = {CLOBBER};
      }
  }
  <D.18247>:
  {
    struct GError * gerror;
    gchar * debug;

    try
      {
        gst_message_parse_warning (message, &gerror, &debug);
        debug.13 = debug;
        gerror.14 = gerror;
        D.18349 = message->src;
        gst_object_default_error (D.18349, gerror.14, debug.13);
        gerror.14 = gerror;
        g_error_free (gerror.14);
        debug.13 = debug;
        g_free (debug.13);
        g_main_loop_quit (loop);
        goto <D.18246>;
      }
    finally
      {
        gerror = {CLOBBER};
        debug = {CLOBBER};
      }
  }
  <D.18250>:
  g_main_loop_quit (loop);
  goto <D.18246>;
  <D.18251>:
  goto <D.18246>;
  <D.18246>:
  D.18352 = 1;
  return D.18352;
}


printf (const char * restrict __fmt)
{
  int D.18357;

  D.18357 = __printf_chk (1, __fmt, __builtin_va_arg_pack ());
  return D.18357;
}


