main (int argc, char * * argv)
{
  int argc.0;
  char * * argv.1;
  char * * D.18135;
  char * D.18136;
  struct GstBus * D.18150;
  int D.18154;

  {
    struct GstElement * pipe;
    struct GstElement * filter;
    struct GstCaps * caps;
    gint width;
    gint height;
    gint xdir;
    gint ydir;
    gint round;
    gint type;
    gint stop;

    gst_init (&argc, &argv);
    type = 0;
    stop = -1;
    argc.0 = argc;
    if (argc.0 > 1) goto <D.18132>; else goto <D.18133>;
    <D.18132>:
    argv.1 = argv;
    D.18135 = argv.1 + 8;
    D.18136 = *D.18135;
    type = atoi (D.18136);
    stop = type + 1;
    <D.18133>:
    <D.18129>:
    {
      struct GstMessage * message;

      pipe = make_pipeline (type);
      if (pipe == 0B) goto <D.18124>; else goto <D.18137>;
      <D.18137>:
      filter = gst_bin_get_by_name (pipe, "filter");
      width = 320;
      height = 240;
      ydir = -10;
      xdir = ydir;
      round = 0;
      goto <D.18127>;
      <D.18126>:
      {
        gchar * capsstr;

        g_print ("resize to %dx%d (%d/%d)   \r", width, height, round, 100);
        capsstr = g_strdup_printf ("video/x-raw, width=(int)%d, height=(int)%d;video/x-raw", width, height);
        caps = gst_caps_from_string (capsstr);
        g_free (capsstr);
        g_object_set (filter, "caps", caps, 0B);
        gst_caps_unref (caps);
        if (round == 0) goto <D.18138>; else goto <D.18139>;
        <D.18138>:
        gst_element_set_state (pipe, 4);
        <D.18139>:
        width = width + xdir;
        if (width > 319) goto <D.18140>; else goto <D.18141>;
        <D.18140>:
        xdir = -10;
        goto <D.18142>;
        <D.18141>:
        if (width <= 199) goto <D.18143>; else goto <D.18144>;
        <D.18143>:
        xdir = 10;
        <D.18144>:
        <D.18142>:
        height = height + ydir;
        if (height > 239) goto <D.18145>; else goto <D.18146>;
        <D.18145>:
        ydir = -10;
        goto <D.18147>;
        <D.18146>:
        if (height <= 149) goto <D.18148>; else goto <D.18149>;
        <D.18148>:
        ydir = 10;
        <D.18149>:
        <D.18147>:
        D.18150 = pipe->bus;
        message = gst_bus_poll (D.18150, 2, 50000000);
        if (message != 0B) goto <D.18151>; else goto <D.18152>;
        <D.18151>:
        g_print ("got error           \n");
        gst_message_unref (message);
        <D.18152>:
      }
      round = round + 1;
      <D.18127>:
      if (round <= 99) goto <D.18126>; else goto <D.18128>;
      <D.18128>:
      g_print ("test %d done                    \n", type);
      gst_object_unref (filter);
      gst_element_set_state (pipe, 1);
      gst_object_unref (pipe);
      type = type + 1;
      if (type == stop) goto <D.18124>; else goto <D.18153>;
      <D.18153>:
    }
    goto <D.18129>;
    <D.18124>:
    D.18154 = 0;
    return D.18154;
  }
  D.18154 = 0;
  return D.18154;
}


atoi (const char * __nptr)
{
  int D.18156;
  long int D.18157;

  D.18157 = strtol (__nptr, 0B, 10);
  D.18156 = (int) D.18157;
  return D.18156;
}


make_pipeline (gint type)
{
  struct GstElement * D.18159;
  struct GstElement * result;
  gchar * pstr;

  switch (type) <default: <D.18108>, case 0: <D.18101>, case 1: <D.18103>, case 2: <D.18104>, case 3: <D.18105>, case 4: <D.18106>, case 5: <D.18107>>
  <D.18101>:
  pstr = g_strdup_printf ("videotestsrc ! capsfilter name=filter ! ximagesink");
  goto <D.18102>;
  <D.18103>:
  pstr = g_strdup_printf ("videotestsrc ! queue ! capsfilter name=filter ! ximagesink");
  goto <D.18102>;
  <D.18104>:
  pstr = g_strdup_printf ("videotestsrc ! videoscale ! capsfilter name=filter ! ximagesink");
  goto <D.18102>;
  <D.18105>:
  pstr = g_strdup_printf ("videotestsrc ! queue ! videoscale ! capsfilter name=filter ! ximagesink");
  goto <D.18102>;
  <D.18106>:
  pstr = g_strdup_printf ("videotestsrc ! videoscale ! queue ! capsfilter name=filter ! ximagesink");
  goto <D.18102>;
  <D.18107>:
  pstr = g_strdup_printf ("v4l2src ! videoconvert ! videoscale ! capsfilter name=filter ! ximagesink");
  goto <D.18102>;
  <D.18108>:
  D.18159 = 0B;
  return D.18159;
  <D.18102>:
  result = gst_parse_launch_full (pstr, 0B, 0, 0B);
  g_print ("created test %d: \"%s\"\n", type, pstr);
  g_free (pstr);
  D.18159 = result;
  return D.18159;
}


gst_caps_unref (struct GstCaps * caps)
{
  gst_mini_object_unref (caps);
}


gst_message_unref (struct GstMessage * msg)
{
  gst_mini_object_unref (msg);
}


