main (int argc, char * * argv)
{
  int argc.0;
  char * * argv.1;
  char * * D.18132;
  char * D.18133;
  struct GstBus * D.18157;
  int D.18161;

  {
    struct GstElement * pipe;
    struct GstElement * filter;
    gint left;
    gint right;
    gint top;
    gint bottom;
    gint rdir;
    gint ldir;
    gint tdir;
    gint bdir;
    gint round;
    gint type;
    gint stop;

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

      pipe = make_pipeline (type);
      if (pipe == 0B) goto <D.18122>; else goto <D.18134>;
      <D.18134>:
      filter = gst_bin_get_by_name (pipe, "box");
      bottom = 0;
      top = bottom;
      right = top;
      left = right;
      bdir = -10;
      tdir = bdir;
      ldir = tdir;
      rdir = ldir;
      round = 0;
      goto <D.18124>;
      <D.18123>:
      g_print ("box to %dx%d %dx%d (%d/%d)   \r", left, right, top, bottom, round, 100);
      g_object_set (filter, "left", left, "right", right, "top", top, "bottom", bottom, 0B);
      if (round == 0) goto <D.18135>; else goto <D.18136>;
      <D.18135>:
      gst_element_set_state (pipe, 4);
      <D.18136>:
      left = left + ldir;
      if (left > 39) goto <D.18137>; else goto <D.18138>;
      <D.18137>:
      ldir = -10;
      goto <D.18139>;
      <D.18138>:
      if (left < -30) goto <D.18140>; else goto <D.18141>;
      <D.18140>:
      ldir = 10;
      <D.18141>:
      <D.18139>:
      right = right + rdir;
      if (right > 29) goto <D.18142>; else goto <D.18143>;
      <D.18142>:
      rdir = -10;
      goto <D.18144>;
      <D.18143>:
      if (right < -20) goto <D.18145>; else goto <D.18146>;
      <D.18145>:
      rdir = 10;
      <D.18146>:
      <D.18144>:
      top = top + tdir;
      if (top > 19) goto <D.18147>; else goto <D.18148>;
      <D.18147>:
      tdir = -10;
      goto <D.18149>;
      <D.18148>:
      if (top < -30) goto <D.18150>; else goto <D.18151>;
      <D.18150>:
      tdir = 10;
      <D.18151>:
      <D.18149>:
      bottom = bottom + bdir;
      if (bottom > 59) goto <D.18152>; else goto <D.18153>;
      <D.18152>:
      bdir = -10;
      goto <D.18154>;
      <D.18153>:
      if (bottom < -40) goto <D.18155>; else goto <D.18156>;
      <D.18155>:
      bdir = 10;
      <D.18156>:
      <D.18154>:
      D.18157 = pipe->bus;
      message = gst_bus_poll (D.18157, 2, 50000000);
      if (message != 0B) goto <D.18158>; else goto <D.18159>;
      <D.18158>:
      g_print ("got error                                 \n");
      gst_message_unref (message);
      <D.18159>:
      round = round + 1;
      <D.18124>:
      if (round <= 99) goto <D.18123>; else goto <D.18125>;
      <D.18125>:
      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.18122>; else goto <D.18160>;
      <D.18160>:
    }
    goto <D.18126>;
    <D.18122>:
    D.18161 = 0;
    return D.18161;
  }
  D.18161 = 0;
  return D.18161;
}


atoi (const char * __nptr)
{
  int D.18163;
  long int D.18164;

  D.18164 = strtol (__nptr, 0B, 10);
  D.18163 = (int) D.18164;
  return D.18163;
}


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

  switch (type) <default: <D.18103>, case 0: <D.18101>>
  <D.18101>:
  pstr = g_strdup_printf ("videotestsrc !  capsfilter caps=\"video/x-raw, format=(string)I420, width=(int)640, height=(int)480\"  ! videobox name=box ! videoscale !  capsfilter caps=\"video/x-raw, format=(string)I420, width=(int)640, height=(int)480\"  ! videoconvert ! ximagesink");
  goto <D.18102>;
  <D.18103>:
  D.18166 = 0B;
  return D.18166;
  <D.18102>:
  result = gst_parse_launch_full (pstr, 0B, 0, 0B);
  g_print ("created test %d: \"%s\"\n", type, pstr);
  g_free (pstr);
  D.18166 = result;
  return D.18166;
}


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


