# 1 "utils.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "utils.c"
# 19 "utils.c"
# 1 "avcodec.h" 1



# 1 "common.h" 1
# 20 "common.h"
# 1 "../config.h" 1
# 21 "common.h" 2

# 1 "/usr/include/stdlib.h" 1 3
# 25 "/usr/include/stdlib.h" 3
# 1 "/usr/include/features.h" 1 3
# 283 "/usr/include/features.h" 3
# 1 "/usr/include/sys/cdefs.h" 1 3
# 284 "/usr/include/features.h" 2 3
# 312 "/usr/include/features.h" 3
# 1 "/usr/include/gnu/stubs.h" 1 3
# 313 "/usr/include/features.h" 2 3
# 26 "/usr/include/stdlib.h" 2 3







# 1 "/usr/lib/gcc-lib/i486-suse-linux/3.2/include/stddef.h" 1 3
# 201 "/usr/lib/gcc-lib/i486-suse-linux/3.2/include/stddef.h" 3
typedef unsigned int size_t;
# 294 "/usr/lib/gcc-lib/i486-suse-linux/3.2/include/stddef.h" 3
typedef long int wchar_t;
# 34 "/usr/include/stdlib.h" 2 3








# 1 "/usr/include/bits/waitflags.h" 1 3
# 43 "/usr/include/stdlib.h" 2 3
# 1 "/usr/include/bits/waitstatus.h" 1 3
# 63 "/usr/include/bits/waitstatus.h" 3
# 1 "/usr/include/endian.h" 1 3
# 37 "/usr/include/endian.h" 3
# 1 "/usr/include/bits/endian.h" 1 3
# 38 "/usr/include/endian.h" 2 3
# 64 "/usr/include/bits/waitstatus.h" 2 3

union wait
  {
    int w_status;
    struct
      {

        unsigned int __w_termsig:7;
        unsigned int __w_coredump:1;
        unsigned int __w_retcode:8;
        unsigned int:16;







      } __wait_terminated;
    struct
      {

        unsigned int __w_stopval:8;
        unsigned int __w_stopsig:8;
        unsigned int:16;






      } __wait_stopped;
  };
# 44 "/usr/include/stdlib.h" 2 3
# 68 "/usr/include/stdlib.h" 3
typedef union
  {
    union wait *__uptr;
    int *__iptr;
  } __WAIT_STATUS __attribute__ ((__transparent_union__));
# 94 "/usr/include/stdlib.h" 3
typedef struct
  {
    int quot;
    int rem;
  } div_t;



typedef struct
  {
    long int quot;
    long int rem;
  } ldiv_t;





__extension__ typedef struct
  {
    long long int quot;
    long long int rem;
  } lldiv_t;
# 133 "/usr/include/stdlib.h" 3
extern size_t __ctype_get_mb_cur_max (void) ;



extern double atof (__const char *__nptr) __attribute__ ((__pure__));

extern int atoi (__const char *__nptr) __attribute__ ((__pure__));

extern long int atol (__const char *__nptr) __attribute__ ((__pure__));



__extension__ extern long long int atoll (__const char *__nptr)
     __attribute__ ((__pure__));



extern double strtod (__const char *__restrict __nptr,
                      char **__restrict __endptr) ;



extern float strtof (__const char *__restrict __nptr,
                     char **__restrict __endptr) ;

extern long double strtold (__const char *__restrict __nptr,
                            char **__restrict __endptr) ;



extern long int strtol (__const char *__restrict __nptr,
                        char **__restrict __endptr, int __base) ;

extern unsigned long int strtoul (__const char *__restrict __nptr,
                                  char **__restrict __endptr, int __base)
     ;



__extension__
extern long long int strtoq (__const char *__restrict __nptr,
                             char **__restrict __endptr, int __base) ;

__extension__
extern unsigned long long int strtouq (__const char *__restrict __nptr,
                                       char **__restrict __endptr, int __base)
     ;






__extension__
extern long long int strtoll (__const char *__restrict __nptr,
                              char **__restrict __endptr, int __base) ;

__extension__
extern unsigned long long int strtoull (__const char *__restrict __nptr,
                                        char **__restrict __endptr, int __base)
     ;
# 211 "/usr/include/stdlib.h" 3
# 1 "/usr/include/xlocale.h" 1 3
# 28 "/usr/include/xlocale.h" 3
typedef struct __locale_struct
{

  struct locale_data *__locales[13];


  const unsigned short int *__ctype_b;
  const int *__ctype_tolower;
  const int *__ctype_toupper;
} *__locale_t;
# 212 "/usr/include/stdlib.h" 2 3



extern long int __strtol_l (__const char *__restrict __nptr,
                            char **__restrict __endptr, int __base,
                            __locale_t __loc) ;

extern unsigned long int __strtoul_l (__const char *__restrict __nptr,
                                      char **__restrict __endptr,
                                      int __base, __locale_t __loc) ;

__extension__
extern long long int __strtoll_l (__const char *__restrict __nptr,
                                  char **__restrict __endptr, int __base,
                                  __locale_t __loc) ;

__extension__
extern unsigned long long int __strtoull_l (__const char *__restrict __nptr,
                                            char **__restrict __endptr,
                                            int __base, __locale_t __loc)
     ;

extern double __strtod_l (__const char *__restrict __nptr,
                          char **__restrict __endptr, __locale_t __loc)
     ;

extern float __strtof_l (__const char *__restrict __nptr,
                         char **__restrict __endptr, __locale_t __loc) ;

extern long double __strtold_l (__const char *__restrict __nptr,
                                char **__restrict __endptr,
                                __locale_t __loc) ;






extern double __strtod_internal (__const char *__restrict __nptr,
                                 char **__restrict __endptr, int __group)
     ;
extern float __strtof_internal (__const char *__restrict __nptr,
                                char **__restrict __endptr, int __group)
     ;
extern long double __strtold_internal (__const char *__restrict __nptr,
                                       char **__restrict __endptr,
                                       int __group) ;

extern long int __strtol_internal (__const char *__restrict __nptr,
                                   char **__restrict __endptr,
                                   int __base, int __group) ;



extern unsigned long int __strtoul_internal (__const char *__restrict __nptr,
                                             char **__restrict __endptr,
                                             int __base, int __group) ;




__extension__
extern long long int __strtoll_internal (__const char *__restrict __nptr,
                                         char **__restrict __endptr,
                                         int __base, int __group) ;



__extension__
extern unsigned long long int __strtoull_internal (__const char *
                                                   __restrict __nptr,
                                                   char **__restrict __endptr,
                                                   int __base, int __group)
     ;







extern __inline double
strtod (__const char *__restrict __nptr, char **__restrict __endptr)
{
  return __strtod_internal (__nptr, __endptr, 0);
}
extern __inline long int
strtol (__const char *__restrict __nptr, char **__restrict __endptr,
        int __base)
{
  return __strtol_internal (__nptr, __endptr, __base, 0);
}
extern __inline unsigned long int
strtoul (__const char *__restrict __nptr, char **__restrict __endptr,
         int __base)
{
  return __strtoul_internal (__nptr, __endptr, __base, 0);
}


extern __inline float
strtof (__const char *__restrict __nptr, char **__restrict __endptr)
{
  return __strtof_internal (__nptr, __endptr, 0);
}
extern __inline long double
strtold (__const char *__restrict __nptr, char **__restrict __endptr)
{
  return __strtold_internal (__nptr, __endptr, 0);
}



__extension__ extern __inline long long int
strtoq (__const char *__restrict __nptr, char **__restrict __endptr,
        int __base)
{
  return __strtoll_internal (__nptr, __endptr, __base, 0);
}
__extension__ extern __inline unsigned long long int
strtouq (__const char *__restrict __nptr, char **__restrict __endptr,
         int __base)
{
  return __strtoull_internal (__nptr, __endptr, __base, 0);
}



__extension__ extern __inline long long int
strtoll (__const char *__restrict __nptr, char **__restrict __endptr,
         int __base)
{
  return __strtoll_internal (__nptr, __endptr, __base, 0);
}
__extension__ extern __inline unsigned long long int
strtoull (__const char * __restrict __nptr, char **__restrict __endptr,
          int __base)
{
  return __strtoull_internal (__nptr, __endptr, __base, 0);
}


extern __inline double
atof (__const char *__nptr)
{
  return strtod (__nptr, (char **) ((void *)0));
}
extern __inline int
atoi (__const char *__nptr)
{
  return (int) strtol (__nptr, (char **) ((void *)0), 10);
}
extern __inline long int
atol (__const char *__nptr)
{
  return strtol (__nptr, (char **) ((void *)0), 10);
}


__extension__ extern __inline long long int
atoll (__const char *__nptr)
{
  return strtoll (__nptr, (char **) ((void *)0), 10);
}
# 384 "/usr/include/stdlib.h" 3
extern char *l64a (long int __n) ;


extern long int a64l (__const char *__s) __attribute__ ((__pure__));


# 1 "/usr/include/sys/types.h" 1 3
# 28 "/usr/include/sys/types.h" 3


# 1 "/usr/include/bits/types.h" 1 3
# 29 "/usr/include/bits/types.h" 3
# 1 "/usr/lib/gcc-lib/i486-suse-linux/3.2/include/stddef.h" 1 3
# 30 "/usr/include/bits/types.h" 2 3


typedef unsigned char __u_char;
typedef unsigned short __u_short;
typedef unsigned int __u_int;
typedef unsigned long __u_long;

__extension__ typedef unsigned long long int __u_quad_t;
__extension__ typedef long long int __quad_t;
# 49 "/usr/include/bits/types.h" 3
typedef signed char __int8_t;
typedef unsigned char __uint8_t;
typedef signed short int __int16_t;
typedef unsigned short int __uint16_t;
typedef signed int __int32_t;
typedef unsigned int __uint32_t;

__extension__ typedef signed long long int __int64_t;
__extension__ typedef unsigned long long int __uint64_t;

typedef __quad_t *__qaddr_t;

typedef __u_quad_t __dev_t;
typedef __u_int __uid_t;
typedef __u_int __gid_t;
typedef __u_long __ino_t;
typedef __u_int __mode_t;
typedef __u_int __nlink_t;
typedef long int __off_t;
typedef __quad_t __loff_t;
typedef int __pid_t;
typedef int __ssize_t;
typedef __u_long __rlim_t;
typedef __u_quad_t __rlim64_t;
typedef __u_int __id_t;

typedef struct
  {
    int __val[2];
  } __fsid_t;


typedef int __daddr_t;
typedef char *__caddr_t;
typedef long int __time_t;
typedef unsigned int __useconds_t;
typedef long int __suseconds_t;
typedef long int __swblk_t;

typedef long int __clock_t;


typedef int __clockid_t;


typedef int __timer_t;






typedef int __key_t;


typedef unsigned short int __ipc_pid_t;



typedef long int __blksize_t;




typedef long int __blkcnt_t;
typedef __quad_t __blkcnt64_t;


typedef __u_long __fsblkcnt_t;
typedef __u_quad_t __fsblkcnt64_t;


typedef __u_long __fsfilcnt_t;
typedef __u_quad_t __fsfilcnt64_t;


typedef __u_quad_t __ino64_t;


typedef __loff_t __off64_t;


typedef long int __t_scalar_t;
typedef unsigned long int __t_uscalar_t;


typedef int __intptr_t;


typedef unsigned int __socklen_t;




# 1 "/usr/include/bits/pthreadtypes.h" 1 3
# 23 "/usr/include/bits/pthreadtypes.h" 3
# 1 "/usr/include/bits/sched.h" 1 3
# 68 "/usr/include/bits/sched.h" 3
struct __sched_param
  {
    int __sched_priority;
  };
# 24 "/usr/include/bits/pthreadtypes.h" 2 3


struct _pthread_fastlock
{
  long int __status;
  int __spinlock;

};



typedef struct _pthread_descr_struct *_pthread_descr;





typedef struct __pthread_attr_s
{
  int __detachstate;
  int __schedpolicy;
  struct __sched_param __schedparam;
  int __inheritsched;
  int __scope;
  size_t __guardsize;
  int __stackaddr_set;
  void *__stackaddr;
  size_t __stacksize;
} pthread_attr_t;



typedef struct
{
  struct _pthread_fastlock __c_lock;
  _pthread_descr __c_waiting;
} pthread_cond_t;



typedef struct
{
  int __dummy;
} pthread_condattr_t;


typedef unsigned int pthread_key_t;





typedef struct
{
  int __m_reserved;
  int __m_count;
  _pthread_descr __m_owner;
  int __m_kind;
  struct _pthread_fastlock __m_lock;
} pthread_mutex_t;



typedef struct
{
  int __mutexkind;
} pthread_mutexattr_t;



typedef int pthread_once_t;




typedef struct _pthread_rwlock_t
{
  struct _pthread_fastlock __rw_lock;
  int __rw_readers;
  _pthread_descr __rw_writer;
  _pthread_descr __rw_read_waiting;
  _pthread_descr __rw_write_waiting;
  int __rw_kind;
  int __rw_pshared;
} pthread_rwlock_t;



typedef struct
{
  int __lockkind;
  int __pshared;
} pthread_rwlockattr_t;




typedef volatile int pthread_spinlock_t;


typedef struct {
  struct _pthread_fastlock __ba_lock;
  int __ba_required;
  int __ba_present;
  _pthread_descr __ba_waiting;
} pthread_barrier_t;


typedef struct {
  int __pshared;
} pthread_barrierattr_t;





typedef unsigned long int pthread_t;
# 144 "/usr/include/bits/types.h" 2 3
# 31 "/usr/include/sys/types.h" 2 3



typedef __u_char u_char;
typedef __u_short u_short;
typedef __u_int u_int;
typedef __u_long u_long;
typedef __quad_t quad_t;
typedef __u_quad_t u_quad_t;
typedef __fsid_t fsid_t;




typedef __loff_t loff_t;





typedef __ino64_t ino_t;




typedef __ino64_t ino64_t;




typedef __dev_t dev_t;




typedef __gid_t gid_t;




typedef __mode_t mode_t;




typedef __nlink_t nlink_t;




typedef __uid_t uid_t;







typedef __off64_t off_t;




typedef __off64_t off64_t;




typedef __pid_t pid_t;




typedef __id_t id_t;




typedef __ssize_t ssize_t;





typedef __daddr_t daddr_t;
typedef __caddr_t caddr_t;





typedef __key_t key_t;
# 132 "/usr/include/sys/types.h" 3
# 1 "/usr/include/time.h" 1 3
# 59 "/usr/include/time.h" 3
typedef __clock_t clock_t;
# 70 "/usr/include/time.h" 3
typedef __time_t time_t;
# 82 "/usr/include/time.h" 3
typedef __clockid_t clockid_t;
# 94 "/usr/include/time.h" 3
typedef __timer_t timer_t;
# 133 "/usr/include/sys/types.h" 2 3



typedef __useconds_t useconds_t;



typedef __suseconds_t suseconds_t;





# 1 "/usr/lib/gcc-lib/i486-suse-linux/3.2/include/stddef.h" 1 3
# 147 "/usr/include/sys/types.h" 2 3



typedef unsigned long int ulong;
typedef unsigned short int ushort;
typedef unsigned int uint;
# 190 "/usr/include/sys/types.h" 3
typedef int int8_t __attribute__ ((__mode__ (__QI__)));
typedef int int16_t __attribute__ ((__mode__ (__HI__)));
typedef int int32_t __attribute__ ((__mode__ (__SI__)));
typedef int int64_t __attribute__ ((__mode__ (__DI__)));


typedef unsigned int u_int8_t __attribute__ ((__mode__ (__QI__)));
typedef unsigned int u_int16_t __attribute__ ((__mode__ (__HI__)));
typedef unsigned int u_int32_t __attribute__ ((__mode__ (__SI__)));
typedef unsigned int u_int64_t __attribute__ ((__mode__ (__DI__)));

typedef int register_t __attribute__ ((__mode__ (__word__)));
# 215 "/usr/include/sys/types.h" 3
# 1 "/usr/include/sys/select.h" 1 3
# 31 "/usr/include/sys/select.h" 3
# 1 "/usr/include/bits/select.h" 1 3
# 32 "/usr/include/sys/select.h" 2 3


# 1 "/usr/include/bits/sigset.h" 1 3
# 23 "/usr/include/bits/sigset.h" 3
typedef int __sig_atomic_t;




typedef struct
  {
    unsigned long int __val[(1024 / (8 * sizeof (unsigned long int)))];
  } __sigset_t;
# 35 "/usr/include/sys/select.h" 2 3



typedef __sigset_t sigset_t;





# 1 "/usr/include/time.h" 1 3
# 106 "/usr/include/time.h" 3
struct timespec
  {
    __time_t tv_sec;
    long int tv_nsec;
  };
# 45 "/usr/include/sys/select.h" 2 3

# 1 "/usr/include/bits/time.h" 1 3
# 67 "/usr/include/bits/time.h" 3
struct timeval
  {
    __time_t tv_sec;
    __suseconds_t tv_usec;
  };
# 47 "/usr/include/sys/select.h" 2 3
# 55 "/usr/include/sys/select.h" 3
typedef long int __fd_mask;







typedef struct
  {



    __fd_mask fds_bits[1024 / (8 * sizeof (__fd_mask))];





  } fd_set;






typedef __fd_mask fd_mask;
# 95 "/usr/include/sys/select.h" 3







extern int select (int __nfds, fd_set *__restrict __readfds,
                   fd_set *__restrict __writefds,
                   fd_set *__restrict __exceptfds,
                   struct timeval *__restrict __timeout) ;





extern int pselect (int __nfds, fd_set *__restrict __readfds,
                    fd_set *__restrict __writefds,
                    fd_set *__restrict __exceptfds,
                    const struct timespec *__restrict __timeout,
                    const __sigset_t *__restrict __sigmask) ;



# 216 "/usr/include/sys/types.h" 2 3


# 1 "/usr/include/sys/sysmacros.h" 1 3
# 219 "/usr/include/sys/types.h" 2 3




typedef __blksize_t blksize_t;
# 243 "/usr/include/sys/types.h" 3
typedef __blkcnt64_t blkcnt_t;



typedef __fsblkcnt64_t fsblkcnt_t;



typedef __fsfilcnt64_t fsfilcnt_t;





typedef __blkcnt64_t blkcnt64_t;
typedef __fsblkcnt64_t fsblkcnt64_t;
typedef __fsfilcnt64_t fsfilcnt64_t;



# 391 "/usr/include/stdlib.h" 2 3






extern long int random (void) ;


extern void srandom (unsigned int __seed) ;





extern char *initstate (unsigned int __seed, char *__statebuf,
                        size_t __statelen) ;



extern char *setstate (char *__statebuf) ;







struct random_data
  {
    int32_t *fptr;
    int32_t *rptr;
    int32_t *state;
    int rand_type;
    int rand_deg;
    int rand_sep;
    int32_t *end_ptr;
  };

extern int random_r (struct random_data *__restrict __buf,
                     int32_t *__restrict __result) ;

extern int srandom_r (unsigned int __seed, struct random_data *__buf) ;

extern int initstate_r (unsigned int __seed, char *__restrict __statebuf,
                        size_t __statelen,
                        struct random_data *__restrict __buf) ;

extern int setstate_r (char *__restrict __statebuf,
                       struct random_data *__restrict __buf) ;





extern int rand (void) ;

extern void srand (unsigned int __seed) ;



extern int rand_r (unsigned int *__seed) ;







extern double drand48 (void) ;
extern double erand48 (unsigned short int __xsubi[3]) ;


extern long int lrand48 (void) ;
extern long int nrand48 (unsigned short int __xsubi[3]) ;


extern long int mrand48 (void) ;
extern long int jrand48 (unsigned short int __xsubi[3]) ;


extern void srand48 (long int __seedval) ;
extern unsigned short int *seed48 (unsigned short int __seed16v[3]) ;
extern void lcong48 (unsigned short int __param[7]) ;





struct drand48_data
  {
    unsigned short int __x[3];
    unsigned short int __old_x[3];
    unsigned short int __c;
    unsigned short int __init;
    unsigned long long int __a;
  };


extern int drand48_r (struct drand48_data *__restrict __buffer,
                      double *__restrict __result) ;
extern int erand48_r (unsigned short int __xsubi[3],
                      struct drand48_data *__restrict __buffer,
                      double *__restrict __result) ;


extern int lrand48_r (struct drand48_data *__restrict __buffer,
                      long int *__restrict __result) ;
extern int nrand48_r (unsigned short int __xsubi[3],
                      struct drand48_data *__restrict __buffer,
                      long int *__restrict __result) ;


extern int mrand48_r (struct drand48_data *__restrict __buffer,
                      long int *__restrict __result) ;
extern int jrand48_r (unsigned short int __xsubi[3],
                      struct drand48_data *__restrict __buffer,
                      long int *__restrict __result) ;


extern int srand48_r (long int __seedval, struct drand48_data *__buffer)
     ;

extern int seed48_r (unsigned short int __seed16v[3],
                     struct drand48_data *__buffer) ;

extern int lcong48_r (unsigned short int __param[7],
                      struct drand48_data *__buffer) ;
# 527 "/usr/include/stdlib.h" 3
extern void *malloc (size_t __size) __attribute__ ((__malloc__));

extern void *calloc (size_t __nmemb, size_t __size)
     __attribute__ ((__malloc__));





extern void *realloc (void *__ptr, size_t __size) __attribute__ ((__malloc__));

extern void free (void *__ptr) ;



extern void cfree (void *__ptr) ;



# 1 "/usr/include/alloca.h" 1 3
# 25 "/usr/include/alloca.h" 3
# 1 "/usr/lib/gcc-lib/i486-suse-linux/3.2/include/stddef.h" 1 3
# 26 "/usr/include/alloca.h" 2 3







extern void *alloca (size_t __size) ;






# 547 "/usr/include/stdlib.h" 2 3




extern void *valloc (size_t __size) __attribute__ ((__malloc__));




extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size)
     __attribute__ ((__malloc__));



extern void abort (void) __attribute__ ((__noreturn__));



extern int atexit (void (*__func) (void)) ;




extern int on_exit (void (*__func) (int __status, void *__arg), void *__arg)
     ;





extern void exit (int __status) __attribute__ ((__noreturn__));




extern void _Exit (int __status) __attribute__ ((__noreturn__));




extern char *getenv (__const char *__name) ;



extern char *__secure_getenv (__const char *__name) ;





extern int putenv (char *__string) ;





extern int setenv (__const char *__name, __const char *__value, int __replace)
     ;


extern int unsetenv (__const char *__name) ;






extern int clearenv (void) ;
# 623 "/usr/include/stdlib.h" 3
extern char *mktemp (char *__template) ;
# 634 "/usr/include/stdlib.h" 3
extern int mkstemp (char *__template) __asm__ ("" "mkstemp64");





extern int mkstemp64 (char *__template) ;
# 650 "/usr/include/stdlib.h" 3
extern char *mkdtemp (char *__template) ;




extern int system (__const char *__command) ;






extern char *canonicalize_file_name (__const char *__name) ;
# 672 "/usr/include/stdlib.h" 3
extern char *realpath (__const char *__restrict __name,
                       char *__restrict __resolved) ;






typedef int (*__compar_fn_t) (__const void *, __const void *);


typedef __compar_fn_t comparison_fn_t;





extern void *bsearch (__const void *__key, __const void *__base,
                      size_t __nmemb, size_t __size, __compar_fn_t __compar);



extern void qsort (void *__base, size_t __nmemb, size_t __size,
                   __compar_fn_t __compar);



extern int abs (int __x) __attribute__ ((__const__));
extern long int labs (long int __x) __attribute__ ((__const__));

__extension__ extern long long int llabs (long long int __x)
     __attribute__ ((__const__));






extern div_t div (int __numer, int __denom)
     __attribute__ ((__const__));
extern ldiv_t ldiv (long int __numer, long int __denom)
     __attribute__ ((__const__));

__extension__ extern lldiv_t lldiv (long long int __numer,
                                    long long int __denom)
     __attribute__ ((__const__));
# 728 "/usr/include/stdlib.h" 3
extern char *ecvt (double __value, int __ndigit, int *__restrict __decpt,
                   int *__restrict __sign) ;




extern char *fcvt (double __value, int __ndigit, int *__restrict __decpt,
                   int *__restrict __sign) ;




extern char *gcvt (double __value, int __ndigit, char *__buf) ;




extern char *qecvt (long double __value, int __ndigit,
                    int *__restrict __decpt, int *__restrict __sign) ;
extern char *qfcvt (long double __value, int __ndigit,
                    int *__restrict __decpt, int *__restrict __sign) ;
extern char *qgcvt (long double __value, int __ndigit, char *__buf) ;




extern int ecvt_r (double __value, int __ndigit, int *__restrict __decpt,
                   int *__restrict __sign, char *__restrict __buf,
                   size_t __len) ;
extern int fcvt_r (double __value, int __ndigit, int *__restrict __decpt,
                   int *__restrict __sign, char *__restrict __buf,
                   size_t __len) ;

extern int qecvt_r (long double __value, int __ndigit,
                    int *__restrict __decpt, int *__restrict __sign,
                    char *__restrict __buf, size_t __len) ;
extern int qfcvt_r (long double __value, int __ndigit,
                    int *__restrict __decpt, int *__restrict __sign,
                    char *__restrict __buf, size_t __len) ;






extern int mblen (__const char *__s, size_t __n) ;


extern int mbtowc (wchar_t *__restrict __pwc,
                   __const char *__restrict __s, size_t __n) ;


extern int wctomb (char *__s, wchar_t __wchar) ;



extern size_t mbstowcs (wchar_t *__restrict __pwcs,
                        __const char *__restrict __s, size_t __n) ;

extern size_t wcstombs (char *__restrict __s,
                        __const wchar_t *__restrict __pwcs, size_t __n)
     ;







extern int rpmatch (__const char *__response) ;
# 808 "/usr/include/stdlib.h" 3
extern int getsubopt (char **__restrict __optionp,
                      char *__const *__restrict __tokens,
                      char **__restrict __valuep) ;





extern void setkey (__const char *__key) ;







extern int posix_openpt (int __oflag) ;







extern int grantpt (int __fd) ;



extern int unlockpt (int __fd) ;




extern char *ptsname (int __fd) ;






extern int ptsname_r (int __fd, char *__buf, size_t __buflen) ;


extern int getpt (void) ;






extern int getloadavg (double __loadavg[], int __nelem) ;






# 23 "common.h" 2
# 1 "/usr/include/stdio.h" 1 3
# 30 "/usr/include/stdio.h" 3




# 1 "/usr/lib/gcc-lib/i486-suse-linux/3.2/include/stddef.h" 1 3
# 35 "/usr/include/stdio.h" 2 3
# 45 "/usr/include/stdio.h" 3
typedef struct _IO_FILE FILE;
# 55 "/usr/include/stdio.h" 3
typedef struct _IO_FILE __FILE;
# 65 "/usr/include/stdio.h" 3
# 1 "/usr/include/libio.h" 1 3
# 32 "/usr/include/libio.h" 3
# 1 "/usr/include/_G_config.h" 1 3
# 14 "/usr/include/_G_config.h" 3
# 1 "/usr/lib/gcc-lib/i486-suse-linux/3.2/include/stddef.h" 1 3
# 321 "/usr/lib/gcc-lib/i486-suse-linux/3.2/include/stddef.h" 3
typedef unsigned int wint_t;
# 15 "/usr/include/_G_config.h" 2 3
# 24 "/usr/include/_G_config.h" 3
# 1 "/usr/include/wchar.h" 1 3
# 48 "/usr/include/wchar.h" 3
# 1 "/usr/lib/gcc-lib/i486-suse-linux/3.2/include/stddef.h" 1 3
# 49 "/usr/include/wchar.h" 2 3

# 1 "/usr/include/bits/wchar.h" 1 3
# 51 "/usr/include/wchar.h" 2 3
# 67 "/usr/include/wchar.h" 3
typedef struct
{
  int __count;
  union
  {
    wint_t __wch;
    char __wchb[4];
  } __value;
} __mbstate_t;
# 25 "/usr/include/_G_config.h" 2 3

typedef struct
{
  __off_t __pos;
  __mbstate_t __state;
} _G_fpos_t;
typedef struct
{
  __off64_t __pos;
  __mbstate_t __state;
} _G_fpos64_t;
# 44 "/usr/include/_G_config.h" 3
# 1 "/usr/include/gconv.h" 1 3
# 28 "/usr/include/gconv.h" 3
# 1 "/usr/include/wchar.h" 1 3
# 48 "/usr/include/wchar.h" 3
# 1 "/usr/lib/gcc-lib/i486-suse-linux/3.2/include/stddef.h" 1 3
# 49 "/usr/include/wchar.h" 2 3
# 29 "/usr/include/gconv.h" 2 3


# 1 "/usr/lib/gcc-lib/i486-suse-linux/3.2/include/stddef.h" 1 3
# 32 "/usr/include/gconv.h" 2 3





enum
{
  __GCONV_OK = 0,
  __GCONV_NOCONV,
  __GCONV_NODB,
  __GCONV_NOMEM,

  __GCONV_EMPTY_INPUT,
  __GCONV_FULL_OUTPUT,
  __GCONV_ILLEGAL_INPUT,
  __GCONV_INCOMPLETE_INPUT,

  __GCONV_ILLEGAL_DESCRIPTOR,
  __GCONV_INTERNAL_ERROR
};



enum
{
  __GCONV_IS_LAST = 0x0001,
  __GCONV_IGNORE_ERRORS = 0x0002
};



struct __gconv_step;
struct __gconv_step_data;
struct __gconv_loaded_object;
struct __gconv_trans_data;



typedef int (*__gconv_fct) (struct __gconv_step *, struct __gconv_step_data *,
                            __const unsigned char **, __const unsigned char *,
                            unsigned char **, size_t *, int, int);


typedef int (*__gconv_init_fct) (struct __gconv_step *);
typedef void (*__gconv_end_fct) (struct __gconv_step *);



typedef int (*__gconv_trans_fct) (struct __gconv_step *,
                                  struct __gconv_step_data *, void *,
                                  __const unsigned char *,
                                  __const unsigned char **,
                                  __const unsigned char *, unsigned char **,
                                  size_t *);


typedef int (*__gconv_trans_context_fct) (void *, __const unsigned char *,
                                          __const unsigned char *,
                                          unsigned char *, unsigned char *);


typedef int (*__gconv_trans_query_fct) (__const char *, __const char ***,
                                        size_t *);


typedef int (*__gconv_trans_init_fct) (void **, const char *);
typedef void (*__gconv_trans_end_fct) (void *);

struct __gconv_trans_data
{

  __gconv_trans_fct __trans_fct;
  __gconv_trans_context_fct __trans_context_fct;
  __gconv_trans_end_fct __trans_end_fct;
  void *__data;
  struct __gconv_trans_data *__next;
};



struct __gconv_step
{
  struct __gconv_loaded_object *__shlib_handle;
  __const char *__modname;

  int __counter;

  char *__from_name;
  char *__to_name;

  __gconv_fct __fct;
  __gconv_init_fct __init_fct;
  __gconv_end_fct __end_fct;



  int __min_needed_from;
  int __max_needed_from;
  int __min_needed_to;
  int __max_needed_to;


  int __stateful;

  void *__data;
};



struct __gconv_step_data
{
  unsigned char *__outbuf;
  unsigned char *__outbufend;



  int __flags;



  int __invocation_counter;



  int __internal_use;

  __mbstate_t *__statep;
  __mbstate_t __state;



  struct __gconv_trans_data *__trans;
};



typedef struct __gconv_info
{
  size_t __nsteps;
  struct __gconv_step *__steps;
  __extension__ struct __gconv_step_data __data [];
} *__gconv_t;
# 45 "/usr/include/_G_config.h" 2 3
typedef union
{
  struct __gconv_info __cd;
  struct
  {
    struct __gconv_info __cd;
    struct __gconv_step_data __data;
  } __combined;
} _G_iconv_t;

typedef int _G_int16_t __attribute__ ((__mode__ (__HI__)));
typedef int _G_int32_t __attribute__ ((__mode__ (__SI__)));
typedef unsigned int _G_uint16_t __attribute__ ((__mode__ (__HI__)));
typedef unsigned int _G_uint32_t __attribute__ ((__mode__ (__SI__)));
# 33 "/usr/include/libio.h" 2 3
# 53 "/usr/include/libio.h" 3
# 1 "/usr/lib/gcc-lib/i486-suse-linux/3.2/include/stdarg.h" 1 3
# 43 "/usr/lib/gcc-lib/i486-suse-linux/3.2/include/stdarg.h" 3
typedef __builtin_va_list __gnuc_va_list;
# 54 "/usr/include/libio.h" 2 3
# 160 "/usr/include/libio.h" 3
struct _IO_jump_t; struct _IO_FILE;
# 170 "/usr/include/libio.h" 3
typedef void _IO_lock_t;





struct _IO_marker {
  struct _IO_marker *_next;
  struct _IO_FILE *_sbuf;



  int _pos;
# 193 "/usr/include/libio.h" 3
};


enum __codecvt_result
{
  __codecvt_ok,
  __codecvt_partial,
  __codecvt_error,
  __codecvt_noconv
};
# 261 "/usr/include/libio.h" 3
struct _IO_FILE {
  int _flags;




  char* _IO_read_ptr;
  char* _IO_read_end;
  char* _IO_read_base;
  char* _IO_write_base;
  char* _IO_write_ptr;
  char* _IO_write_end;
  char* _IO_buf_base;
  char* _IO_buf_end;

  char *_IO_save_base;
  char *_IO_backup_base;
  char *_IO_save_end;

  struct _IO_marker *_markers;

  struct _IO_FILE *_chain;

  int _fileno;
  int _blksize;
  __off_t _old_offset;



  unsigned short _cur_column;
  signed char _vtable_offset;
  char _shortbuf[1];



  _IO_lock_t *_lock;
# 305 "/usr/include/libio.h" 3
  __off64_t _offset;





  void *__pad1;
  void *__pad2;

  int _mode;

  char _unused2[15 * sizeof (int) - 2 * sizeof (void *)];

};


typedef struct _IO_FILE _IO_FILE;


struct _IO_FILE_plus;

extern struct _IO_FILE_plus _IO_2_1_stdin_;
extern struct _IO_FILE_plus _IO_2_1_stdout_;
extern struct _IO_FILE_plus _IO_2_1_stderr_;
# 344 "/usr/include/libio.h" 3
typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes);







typedef __ssize_t __io_write_fn (void *__cookie, __const char *__buf,
                                 size_t __n);







typedef int __io_seek_fn (void *__cookie, __off64_t *__pos, int __w);


typedef int __io_close_fn (void *__cookie);




typedef __io_read_fn cookie_read_function_t;
typedef __io_write_fn cookie_write_function_t;
typedef __io_seek_fn cookie_seek_function_t;
typedef __io_close_fn cookie_close_function_t;


typedef struct
{
  __io_read_fn *read;
  __io_write_fn *write;
  __io_seek_fn *seek;
  __io_close_fn *close;
} _IO_cookie_io_functions_t;
typedef _IO_cookie_io_functions_t cookie_io_functions_t;

struct _IO_cookie_file;


extern void _IO_cookie_init (struct _IO_cookie_file *__cfile, int __read_write,
                             void *__cookie, _IO_cookie_io_functions_t __fns);







extern int __underflow (_IO_FILE *) ;
extern int __uflow (_IO_FILE *) ;
extern int __overflow (_IO_FILE *, int) ;
extern wint_t __wunderflow (_IO_FILE *) ;
extern wint_t __wuflow (_IO_FILE *) ;
extern wint_t __woverflow (_IO_FILE *, wint_t) ;
# 426 "/usr/include/libio.h" 3
extern int _IO_getc (_IO_FILE *__fp) ;
extern int _IO_putc (int __c, _IO_FILE *__fp) ;
extern int _IO_feof (_IO_FILE *__fp) ;
extern int _IO_ferror (_IO_FILE *__fp) ;

extern int _IO_peekc_locked (_IO_FILE *__fp) ;





extern void _IO_flockfile (_IO_FILE *) ;
extern void _IO_funlockfile (_IO_FILE *) ;
extern int _IO_ftrylockfile (_IO_FILE *) ;
# 456 "/usr/include/libio.h" 3
extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict,
                        __gnuc_va_list, int *__restrict) ;
extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict,
                         __gnuc_va_list) ;
extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t) ;
extern size_t _IO_sgetn (_IO_FILE *, void *, size_t) ;

extern __off64_t _IO_seekoff (_IO_FILE *, __off64_t, int, int) ;
extern __off64_t _IO_seekpos (_IO_FILE *, __off64_t, int) ;

extern void _IO_free_backup_area (_IO_FILE *) ;
# 66 "/usr/include/stdio.h" 2 3




typedef __gnuc_va_list va_list;
# 82 "/usr/include/stdio.h" 3
typedef _G_fpos64_t fpos_t;


typedef _G_fpos64_t fpos64_t;
# 129 "/usr/include/stdio.h" 3
# 1 "/usr/include/bits/stdio_lim.h" 1 3
# 130 "/usr/include/stdio.h" 2 3



extern FILE *stdin;
extern FILE *stdout;
extern FILE *stderr;






extern int remove (__const char *__filename) ;

extern int rename (__const char *__old, __const char *__new) ;







extern FILE *tmpfile (void) __asm__ ("" "tmpfile64");





extern FILE *tmpfile64 (void) ;


extern char *tmpnam (char *__s) ;




extern char *tmpnam_r (char *__s) ;
# 178 "/usr/include/stdio.h" 3
extern char *tempnam (__const char *__dir, __const char *__pfx)
     __attribute__ ((__malloc__));




extern int fclose (FILE *__stream) ;

extern int fflush (FILE *__stream) ;



extern int fflush_unlocked (FILE *__stream) ;




extern int fcloseall (void) ;
# 209 "/usr/include/stdio.h" 3
extern FILE *fopen (__const char *__restrict __filename, __const char *__restrict __modes) __asm__ ("" "fopen64");


extern FILE *freopen (__const char *__restrict __filename, __const char *__restrict __modes, FILE *__restrict __stream) __asm__ ("" "freopen64");
# 222 "/usr/include/stdio.h" 3
extern FILE *fopen64 (__const char *__restrict __filename,
                      __const char *__restrict __modes) ;
extern FILE *freopen64 (__const char *__restrict __filename,
                        __const char *__restrict __modes,
                        FILE *__restrict __stream) ;




extern FILE *fdopen (int __fd, __const char *__modes) ;





extern FILE *fopencookie (void *__restrict __magic_cookie,
                          __const char *__restrict __modes,
                          _IO_cookie_io_functions_t __io_funcs) ;


extern FILE *fmemopen (void *__s, size_t __len, __const char *__modes) ;




extern FILE *open_memstream (char **__restrict __bufloc,
                             size_t *__restrict __sizeloc) ;





extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) ;



extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf,
                    int __modes, size_t __n) ;




extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf,
                       size_t __size) ;


extern void setlinebuf (FILE *__stream) ;




extern int fprintf (FILE *__restrict __stream,
                    __const char *__restrict __format, ...) ;

extern int printf (__const char *__restrict __format, ...) ;

extern int sprintf (char *__restrict __s,
                    __const char *__restrict __format, ...) ;


extern int vfprintf (FILE *__restrict __s, __const char *__restrict __format,
                     __gnuc_va_list __arg) ;

extern int vprintf (__const char *__restrict __format, __gnuc_va_list __arg)
     ;

extern int vsprintf (char *__restrict __s, __const char *__restrict __format,
                     __gnuc_va_list __arg) ;



extern int snprintf (char *__restrict __s, size_t __maxlen,
                     __const char *__restrict __format, ...)
     __attribute__ ((__format__ (__printf__, 3, 4)));

extern int vsnprintf (char *__restrict __s, size_t __maxlen,
                      __const char *__restrict __format, __gnuc_va_list __arg)
     __attribute__ ((__format__ (__printf__, 3, 0)));





extern int vasprintf (char **__restrict __ptr, __const char *__restrict __f,
                      __gnuc_va_list __arg)
     __attribute__ ((__format__ (__printf__, 2, 0)));
extern int __asprintf (char **__restrict __ptr,
                       __const char *__restrict __fmt, ...)
     __attribute__ ((__format__ (__printf__, 2, 3)));
extern int asprintf (char **__restrict __ptr,
                     __const char *__restrict __fmt, ...)
     __attribute__ ((__format__ (__printf__, 2, 3)));


extern int vdprintf (int __fd, __const char *__restrict __fmt,
                     __gnuc_va_list __arg)
     __attribute__ ((__format__ (__printf__, 2, 0)));
extern int dprintf (int __fd, __const char *__restrict __fmt, ...)
     __attribute__ ((__format__ (__printf__, 2, 3)));




extern int fscanf (FILE *__restrict __stream,
                   __const char *__restrict __format, ...) ;

extern int scanf (__const char *__restrict __format, ...) ;

extern int sscanf (__const char *__restrict __s,
                   __const char *__restrict __format, ...) ;



extern int vfscanf (FILE *__restrict __s, __const char *__restrict __format,
                    __gnuc_va_list __arg)
     __attribute__ ((__format__ (__scanf__, 2, 0)));


extern int vscanf (__const char *__restrict __format, __gnuc_va_list __arg)
     __attribute__ ((__format__ (__scanf__, 1, 0)));


extern int vsscanf (__const char *__restrict __s,
                    __const char *__restrict __format, __gnuc_va_list __arg)
     __attribute__ ((__format__ (__scanf__, 2, 0)));




extern int fgetc (FILE *__stream) ;
extern int getc (FILE *__stream) ;


extern int getchar (void) ;







extern int getc_unlocked (FILE *__stream) ;
extern int getchar_unlocked (void) ;




extern int fgetc_unlocked (FILE *__stream) ;




extern int fputc (int __c, FILE *__stream) ;
extern int putc (int __c, FILE *__stream) ;


extern int putchar (int __c) ;







extern int fputc_unlocked (int __c, FILE *__stream) ;




extern int putc_unlocked (int __c, FILE *__stream) ;
extern int putchar_unlocked (int __c) ;





extern int getw (FILE *__stream) ;


extern int putw (int __w, FILE *__stream) ;




extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
     ;



extern char *fgets_unlocked (char *__restrict __s, int __n,
                             FILE *__restrict __stream) ;




extern char *gets (char *__s) ;
# 426 "/usr/include/stdio.h" 3
extern __ssize_t __getdelim (char **__restrict __lineptr,
                               size_t *__restrict __n, int __delimiter,
                               FILE *__restrict __stream) ;
extern __ssize_t getdelim (char **__restrict __lineptr,
                             size_t *__restrict __n, int __delimiter,
                             FILE *__restrict __stream) ;


extern __ssize_t getline (char **__restrict __lineptr,
                            size_t *__restrict __n,
                            FILE *__restrict __stream) ;




extern int fputs (__const char *__restrict __s, FILE *__restrict __stream)
     ;



extern int fputs_unlocked (__const char *__restrict __s,
                           FILE *__restrict __stream) ;



extern int puts (__const char *__s) ;



extern int ungetc (int __c, FILE *__stream) ;



extern size_t fread (void *__restrict __ptr, size_t __size,
                     size_t __n, FILE *__restrict __stream) ;

extern size_t fwrite (__const void *__restrict __ptr, size_t __size,
                      size_t __n, FILE *__restrict __s) ;



extern size_t fread_unlocked (void *__restrict __ptr, size_t __size,
                              size_t __n, FILE *__restrict __stream) ;
extern size_t fwrite_unlocked (__const void *__restrict __ptr, size_t __size,
                               size_t __n, FILE *__restrict __stream) ;




extern int fseek (FILE *__stream, long int __off, int __whence) ;

extern long int ftell (FILE *__stream) ;

extern void rewind (FILE *__stream) ;
# 502 "/usr/include/stdio.h" 3
extern int fseeko (FILE *__stream, __off64_t __off, int __whence) __asm__ ("" "fseeko64");


extern __off64_t ftello (FILE *__stream) __asm__ ("" "ftello64");

extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos) __asm__ ("" "fgetpos64");

extern int fsetpos (FILE *__stream, __const fpos_t *__pos) __asm__ ("" "fsetpos64");
# 523 "/usr/include/stdio.h" 3
extern int fseeko64 (FILE *__stream, __off64_t __off, int __whence) ;
extern __off64_t ftello64 (FILE *__stream) ;
extern int fgetpos64 (FILE *__restrict __stream, fpos64_t *__restrict __pos)
     ;
extern int fsetpos64 (FILE *__stream, __const fpos64_t *__pos) ;



extern void clearerr (FILE *__stream) ;

extern int feof (FILE *__stream) ;

extern int ferror (FILE *__stream) ;



extern void clearerr_unlocked (FILE *__stream) ;
extern int feof_unlocked (FILE *__stream) ;
extern int ferror_unlocked (FILE *__stream) ;




extern void perror (__const char *__s) ;





# 1 "/usr/include/bits/sys_errlist.h" 1 3
# 27 "/usr/include/bits/sys_errlist.h" 3
extern int sys_nerr;
extern __const char *__const sys_errlist[];


extern int _sys_nerr;
extern __const char *__const _sys_errlist[];
# 553 "/usr/include/stdio.h" 2 3




extern int fileno (FILE *__stream) ;




extern int fileno_unlocked (FILE *__stream) ;






extern FILE *popen (__const char *__command, __const char *__modes) ;


extern int pclose (FILE *__stream) ;





extern char *ctermid (char *__s) ;





extern char *cuserid (char *__s) ;




struct obstack;


extern int obstack_printf (struct obstack *__restrict __obstack,
                           __const char *__restrict __format, ...) ;
extern int obstack_vprintf (struct obstack *__restrict __obstack,
                            __const char *__restrict __format,
                            __gnuc_va_list __args) ;







extern void flockfile (FILE *__stream) ;



extern int ftrylockfile (FILE *__stream) ;


extern void funlockfile (FILE *__stream) ;
# 625 "/usr/include/stdio.h" 3
# 1 "/usr/include/bits/stdio.h" 1 3
# 33 "/usr/include/bits/stdio.h" 3
extern __inline int
vprintf (__const char *__restrict __fmt, __gnuc_va_list __arg)
{
  return vfprintf (stdout, __fmt, __arg);
}


extern __inline int
getchar (void)
{
  return _IO_getc (stdin);
}




extern __inline int
getc_unlocked (FILE *__fp)
{
  return ((__fp)->_IO_read_ptr >= (__fp)->_IO_read_end ? __uflow (__fp) : *(unsigned char *) (__fp)->_IO_read_ptr++);
}


extern __inline int
getchar_unlocked (void)
{
  return ((stdin)->_IO_read_ptr >= (stdin)->_IO_read_end ? __uflow (stdin) : *(unsigned char *) (stdin)->_IO_read_ptr++);
}




extern __inline int
putchar (int __c)
{
  return _IO_putc (__c, stdout);
}




extern __inline int
fputc_unlocked (int __c, FILE *__stream)
{
  return (((__stream)->_IO_write_ptr >= (__stream)->_IO_write_end) ? __overflow (__stream, (unsigned char) (__c)) : (unsigned char) (*(__stream)->_IO_write_ptr++ = (__c)));
}





extern __inline int
putc_unlocked (int __c, FILE *__stream)
{
  return (((__stream)->_IO_write_ptr >= (__stream)->_IO_write_end) ? __overflow (__stream, (unsigned char) (__c)) : (unsigned char) (*(__stream)->_IO_write_ptr++ = (__c)));
}


extern __inline int
putchar_unlocked (int __c)
{
  return (((stdout)->_IO_write_ptr >= (stdout)->_IO_write_end) ? __overflow (stdout, (unsigned char) (__c)) : (unsigned char) (*(stdout)->_IO_write_ptr++ = (__c)));
}





extern __inline __ssize_t
getline (char **__lineptr, size_t *__n, FILE *__stream)
{
  return __getdelim (__lineptr, __n, '\n', __stream);
}





extern __inline int
feof_unlocked (FILE *__stream)
{
  return (((__stream)->_flags & 0x10) != 0);
}


extern __inline int
ferror_unlocked (FILE *__stream)
{
  return (((__stream)->_flags & 0x20) != 0);
}
# 626 "/usr/include/stdio.h" 2 3



# 24 "common.h" 2
# 1 "/usr/include/string.h" 1 3
# 28 "/usr/include/string.h" 3





# 1 "/usr/lib/gcc-lib/i486-suse-linux/3.2/include/stddef.h" 1 3
# 34 "/usr/include/string.h" 2 3



extern void *memcpy (void *__restrict __dest,
                     __const void *__restrict __src, size_t __n) ;


extern void *memmove (void *__dest, __const void *__src, size_t __n)
     ;





extern void *memccpy (void *__restrict __dest, __const void *__restrict __src,
                      int __c, size_t __n)
     ;




extern void *memset (void *__s, int __c, size_t __n) ;


extern int memcmp (__const void *__s1, __const void *__s2, size_t __n)
     __attribute__ ((__pure__));


extern void *memchr (__const void *__s, int __c, size_t __n)
      __attribute__ ((__pure__));




extern void *rawmemchr (__const void *__s, int __c) __attribute__ ((__pure__));


extern void *memrchr (__const void *__s, int __c, size_t __n)
      __attribute__ ((__pure__));




extern char *strcpy (char *__restrict __dest, __const char *__restrict __src)
     ;

extern char *strncpy (char *__restrict __dest,
                      __const char *__restrict __src, size_t __n) ;


extern char *strcat (char *__restrict __dest, __const char *__restrict __src)
     ;

extern char *strncat (char *__restrict __dest, __const char *__restrict __src,
                      size_t __n) ;


extern int strcmp (__const char *__s1, __const char *__s2)
     __attribute__ ((__pure__));

extern int strncmp (__const char *__s1, __const char *__s2, size_t __n)
     __attribute__ ((__pure__));


extern int strcoll (__const char *__s1, __const char *__s2)
     __attribute__ ((__pure__));

extern size_t strxfrm (char *__restrict __dest,
                       __const char *__restrict __src, size_t __n) ;
# 111 "/usr/include/string.h" 3
extern int __strcoll_l (__const char *__s1, __const char *__s2, __locale_t __l)
     __attribute__ ((__pure__));

extern size_t __strxfrm_l (char *__dest, __const char *__src, size_t __n,
                           __locale_t __l) ;




extern char *strdup (__const char *__s) __attribute__ ((__malloc__));






extern char *strndup (__const char *__string, size_t __n)
     __attribute__ ((__malloc__));
# 155 "/usr/include/string.h" 3
extern char *strchr (__const char *__s, int __c) __attribute__ ((__pure__));

extern char *strrchr (__const char *__s, int __c) __attribute__ ((__pure__));




extern char *strchrnul (__const char *__s, int __c) __attribute__ ((__pure__));




extern size_t strcspn (__const char *__s, __const char *__reject)
     __attribute__ ((__pure__));


extern size_t strspn (__const char *__s, __const char *__accept)
     __attribute__ ((__pure__));

extern char *strpbrk (__const char *__s, __const char *__accept)
     __attribute__ ((__pure__));

extern char *strstr (__const char *__haystack, __const char *__needle)
     __attribute__ ((__pure__));



extern char *strcasestr (__const char *__haystack, __const char *__needle)
     __attribute__ ((__pure__));



extern char *strtok (char *__restrict __s, __const char *__restrict __delim)
     ;



extern char *__strtok_r (char *__restrict __s,
                         __const char *__restrict __delim,
                         char **__restrict __save_ptr) ;

extern char *strtok_r (char *__restrict __s, __const char *__restrict __delim,
                       char **__restrict __save_ptr) ;






extern void *memmem (__const void *__haystack, size_t __haystacklen,
                     __const void *__needle, size_t __needlelen)
     __attribute__ ((__pure__));



extern void *__mempcpy (void *__restrict __dest,
                        __const void *__restrict __src, size_t __n) ;
extern void *mempcpy (void *__restrict __dest,
                      __const void *__restrict __src, size_t __n) ;




extern size_t strlen (__const char *__s) __attribute__ ((__pure__));




extern size_t strnlen (__const char *__string, size_t __maxlen)
     __attribute__ ((__pure__));




extern char *strerror (int __errnum) ;



extern char *strerror_r (int __errnum, char *__buf, size_t __buflen) ;




extern void __bzero (void *__s, size_t __n) ;



extern void bcopy (__const void *__src, void *__dest, size_t __n) ;


extern void bzero (void *__s, size_t __n) ;


extern int bcmp (__const void *__s1, __const void *__s2, size_t __n)
     __attribute__ ((__pure__));


extern char *index (__const char *__s, int __c) __attribute__ ((__pure__));


extern char *rindex (__const char *__s, int __c) __attribute__ ((__pure__));



extern int ffs (int __i) __attribute__ ((__const__));




extern int ffsl (long int __l) __attribute__ ((__const__));

__extension__ extern int ffsll (long long int __ll)
     __attribute__ ((__const__));




extern int strcasecmp (__const char *__s1, __const char *__s2)
     __attribute__ ((__pure__));


extern int strncasecmp (__const char *__s1, __const char *__s2, size_t __n)
     __attribute__ ((__pure__));





extern int __strcasecmp_l (__const char *__s1, __const char *__s2,
                           __locale_t __loc) __attribute__ ((__pure__));

extern int __strncasecmp_l (__const char *__s1, __const char *__s2,
                            size_t __n, __locale_t __loc)
     __attribute__ ((__pure__));





extern char *strsep (char **__restrict __stringp,
                     __const char *__restrict __delim) ;




extern int strverscmp (__const char *__s1, __const char *__s2)
     __attribute__ ((__pure__));


extern char *strsignal (int __sig) ;


extern char *__stpcpy (char *__restrict __dest, __const char *__restrict __src)
     ;
extern char *stpcpy (char *__restrict __dest, __const char *__restrict __src)
     ;



extern char *__stpncpy (char *__restrict __dest,
                        __const char *__restrict __src, size_t __n) ;
extern char *stpncpy (char *__restrict __dest,
                      __const char *__restrict __src, size_t __n) ;


extern char *strfry (char *__string) ;


extern void *memfrob (void *__s, size_t __n) ;






extern char *basename (__const char *__filename) ;
# 357 "/usr/include/string.h" 3
# 1 "/usr/include/bits/string.h" 1 3
# 358 "/usr/include/string.h" 2 3


# 1 "/usr/include/bits/string2.h" 1 3
# 387 "/usr/include/bits/string2.h" 3
extern void *__rawmemchr (const void *__s, int __c);
# 917 "/usr/include/bits/string2.h" 3
extern __inline size_t __strcspn_c1 (__const char *__s, int __reject);
extern __inline size_t
__strcspn_c1 (__const char *__s, int __reject)
{
  register size_t __result = 0;
  while (__s[__result] != '\0' && __s[__result] != __reject)
    ++__result;
  return __result;
}

extern __inline size_t __strcspn_c2 (__const char *__s, int __reject1,
                                     int __reject2);
extern __inline size_t
__strcspn_c2 (__const char *__s, int __reject1, int __reject2)
{
  register size_t __result = 0;
  while (__s[__result] != '\0' && __s[__result] != __reject1
         && __s[__result] != __reject2)
    ++__result;
  return __result;
}

extern __inline size_t __strcspn_c3 (__const char *__s, int __reject1,
                                     int __reject2, int __reject3);
extern __inline size_t
__strcspn_c3 (__const char *__s, int __reject1, int __reject2,
              int __reject3)
{
  register size_t __result = 0;
  while (__s[__result] != '\0' && __s[__result] != __reject1
         && __s[__result] != __reject2 && __s[__result] != __reject3)
    ++__result;
  return __result;
}
# 974 "/usr/include/bits/string2.h" 3
extern __inline size_t __strspn_c1 (__const char *__s, int __accept);
extern __inline size_t
__strspn_c1 (__const char *__s, int __accept)
{
  register size_t __result = 0;

  while (__s[__result] == __accept)
    ++__result;
  return __result;
}

extern __inline size_t __strspn_c2 (__const char *__s, int __accept1,
                                    int __accept2);
extern __inline size_t
__strspn_c2 (__const char *__s, int __accept1, int __accept2)
{
  register size_t __result = 0;

  while (__s[__result] == __accept1 || __s[__result] == __accept2)
    ++__result;
  return __result;
}

extern __inline size_t __strspn_c3 (__const char *__s, int __accept1,
                                    int __accept2, int __accept3);
extern __inline size_t
__strspn_c3 (__const char *__s, int __accept1, int __accept2, int __accept3)
{
  register size_t __result = 0;

  while (__s[__result] == __accept1 || __s[__result] == __accept2
         || __s[__result] == __accept3)
    ++__result;
  return __result;
}
# 1031 "/usr/include/bits/string2.h" 3
extern __inline char *__strpbrk_c2 (__const char *__s, int __accept1,
                                     int __accept2);
extern __inline char *
__strpbrk_c2 (__const char *__s, int __accept1, int __accept2)
{

  while (*__s != '\0' && *__s != __accept1 && *__s != __accept2)
    ++__s;
  return *__s == '\0' ? ((void *)0) : (char *) (size_t) __s;
}

extern __inline char *__strpbrk_c3 (__const char *__s, int __accept1,
                                     int __accept2, int __accept3);
extern __inline char *
__strpbrk_c3 (__const char *__s, int __accept1, int __accept2,
              int __accept3)
{

  while (*__s != '\0' && *__s != __accept1 && *__s != __accept2
         && *__s != __accept3)
    ++__s;
  return *__s == '\0' ? ((void *)0) : (char *) (size_t) __s;
}
# 1083 "/usr/include/bits/string2.h" 3
extern __inline char *__strtok_r_1c (char *__s, char __sep, char **__nextp);
extern __inline char *
__strtok_r_1c (char *__s, char __sep, char **__nextp)
{
  char *__result;
  if (__s == ((void *)0))
    __s = *__nextp;
  while (*__s == __sep)
    ++__s;
  __result = ((void *)0);
  if (*__s != '\0')
    {
      __result = __s++;
      while (*__s != '\0')
        if (*__s++ == __sep)
          {
            __s[-1] = '\0';
            break;
          }
      *__nextp = __s;
    }
  return __result;
}
# 1115 "/usr/include/bits/string2.h" 3
extern char *__strsep_g (char **__stringp, __const char *__delim);
# 1133 "/usr/include/bits/string2.h" 3
extern __inline char *__strsep_1c (char **__s, char __reject);
extern __inline char *
__strsep_1c (char **__s, char __reject)
{
  register char *__retval = *__s;
  if (__retval != ((void *)0) && (*__s = (__extension__ (__builtin_constant_p (__reject) && (__reject) == '\0' ? (char *) __rawmemchr (__retval, __reject) : strchr (__retval, __reject)))) != ((void *)0))
    *(*__s)++ = '\0';
  return __retval;
}

extern __inline char *__strsep_2c (char **__s, char __reject1, char __reject2);
extern __inline char *
__strsep_2c (char **__s, char __reject1, char __reject2)
{
  register char *__retval = *__s;
  if (__retval != ((void *)0))
    {
      register char *__cp = __retval;
      while (1)
        {
          if (*__cp == '\0')
            {
              __cp = ((void *)0);
          break;
            }
          if (*__cp == __reject1 || *__cp == __reject2)
            {
              *__cp++ = '\0';
              break;
            }
          ++__cp;
        }
      *__s = __cp;
    }
  return __retval;
}

extern __inline char *__strsep_3c (char **__s, char __reject1, char __reject2,
                                   char __reject3);
extern __inline char *
__strsep_3c (char **__s, char __reject1, char __reject2, char __reject3)
{
  register char *__retval = *__s;
  if (__retval != ((void *)0))
    {
      register char *__cp = __retval;
      while (1)
        {
          if (*__cp == '\0')
            {
              __cp = ((void *)0);
          break;
            }
          if (*__cp == __reject1 || *__cp == __reject2 || *__cp == __reject3)
            {
              *__cp++ = '\0';
              break;
            }
          ++__cp;
        }
      *__s = __cp;
    }
  return __retval;
}
# 1214 "/usr/include/bits/string2.h" 3
extern char *__strdup (__const char *__string) __attribute__ ((__malloc__));
# 1233 "/usr/include/bits/string2.h" 3
extern char *__strndup (__const char *__string, size_t __n)
     __attribute__ ((__malloc__));
# 361 "/usr/include/string.h" 2 3




# 25 "common.h" 2

# 1 "/usr/include/errno.h" 1 3
# 32 "/usr/include/errno.h" 3




# 1 "/usr/include/bits/errno.h" 1 3
# 25 "/usr/include/bits/errno.h" 3
# 1 "/usr/include/linux/errno.h" 1 3



# 1 "/usr/include/asm/errno.h" 1 3
# 5 "/usr/include/linux/errno.h" 2 3
# 26 "/usr/include/bits/errno.h" 2 3
# 36 "/usr/include/bits/errno.h" 3
extern int errno;


extern int *__errno_location (void) __attribute__ ((__const__));
# 37 "/usr/include/errno.h" 2 3
# 55 "/usr/include/errno.h" 3
extern char *program_invocation_name, *program_invocation_short_name;




# 69 "/usr/include/errno.h" 3
typedef int error_t;
# 27 "common.h" 2



# 1 "/usr/include/math.h" 1 3
# 29 "/usr/include/math.h" 3




# 1 "/usr/include/bits/huge_val.h" 1 3
# 34 "/usr/include/math.h" 2 3



# 1 "/usr/include/bits/nan.h" 1 3
# 38 "/usr/include/math.h" 2 3


# 1 "/usr/include/bits/mathdef.h" 1 3
# 29 "/usr/include/bits/mathdef.h" 3
typedef long double float_t;

typedef long double double_t;
# 41 "/usr/include/math.h" 2 3
# 63 "/usr/include/math.h" 3
# 1 "/usr/include/bits/mathcalls.h" 1 3
# 54 "/usr/include/bits/mathcalls.h" 3
extern double acos (double __x) ; extern double __acos (double __x) ;

extern double asin (double __x) ; extern double __asin (double __x) ;

extern double atan (double __x) ; extern double __atan (double __x) ;

extern double atan2 (double __y, double __x) ; extern double __atan2 (double __y, double __x) ;


extern double cos (double __x) ; extern double __cos (double __x) ;

extern double sin (double __x) ; extern double __sin (double __x) ;

extern double tan (double __x) ; extern double __tan (double __x) ;



extern void sincos (double __x, double *__sinx, double *__cosx) ; extern void __sincos (double __x, double *__sinx, double *__cosx) ;






extern double cosh (double __x) ; extern double __cosh (double __x) ;

extern double sinh (double __x) ; extern double __sinh (double __x) ;

extern double tanh (double __x) ; extern double __tanh (double __x) ;



extern double acosh (double __x) ; extern double __acosh (double __x) ;

extern double asinh (double __x) ; extern double __asinh (double __x) ;

extern double atanh (double __x) ; extern double __atanh (double __x) ;





extern double exp (double __x) ; extern double __exp (double __x) ;



extern double exp10 (double __x) ; extern double __exp10 (double __x) ;

extern double pow10 (double __x) ; extern double __pow10 (double __x) ;



extern double frexp (double __x, int *__exponent) ; extern double __frexp (double __x, int *__exponent) ;


extern double ldexp (double __x, int __exponent) ; extern double __ldexp (double __x, int __exponent) ;


extern double log (double __x) ; extern double __log (double __x) ;


extern double log10 (double __x) ; extern double __log10 (double __x) ;


extern double modf (double __x, double *__iptr) ; extern double __modf (double __x, double *__iptr) ;



extern double expm1 (double __x) ; extern double __expm1 (double __x) ;


extern double log1p (double __x) ; extern double __log1p (double __x) ;


extern double logb (double __x) ; extern double __logb (double __x) ;




extern double exp2 (double __x) ; extern double __exp2 (double __x) ;


extern double log2 (double __x) ; extern double __log2 (double __x) ;






extern double pow (double __x, double __y) ; extern double __pow (double __x, double __y) ;


extern double sqrt (double __x) ; extern double __sqrt (double __x) ;



extern double hypot (double __x, double __y) ; extern double __hypot (double __x, double __y) ;




extern double cbrt (double __x) ; extern double __cbrt (double __x) ;






extern double ceil (double __x) ; extern double __ceil (double __x) ;


extern double fabs (double __x) __attribute__ ((__const__)); extern double __fabs (double __x) __attribute__ ((__const__));


extern double floor (double __x) ; extern double __floor (double __x) ;


extern double fmod (double __x, double __y) ; extern double __fmod (double __x, double __y) ;




extern int __isinf (double __value) __attribute__ ((__const__));


extern int __finite (double __value) __attribute__ ((__const__));




extern int isinf (double __value) __attribute__ ((__const__));


extern int finite (double __value) __attribute__ ((__const__));


extern double drem (double __x, double __y) ; extern double __drem (double __x, double __y) ;



extern double significand (double __x) ; extern double __significand (double __x) ;




extern double copysign (double __x, double __y) __attribute__ ((__const__)); extern double __copysign (double __x, double __y) __attribute__ ((__const__));




extern double nan (__const char *__tagb) __attribute__ ((__const__)); extern double __nan (__const char *__tagb) __attribute__ ((__const__));




extern int __isnan (double __value) __attribute__ ((__const__));



extern int isnan (double __value) __attribute__ ((__const__));


extern double j0 (double) ; extern double __j0 (double) ;
extern double j1 (double) ; extern double __j1 (double) ;
extern double jn (int, double) ; extern double __jn (int, double) ;
extern double y0 (double) ; extern double __y0 (double) ;
extern double y1 (double) ; extern double __y1 (double) ;
extern double yn (int, double) ; extern double __yn (int, double) ;





extern double erf (double) ; extern double __erf (double) ;
extern double erfc (double) ; extern double __erfc (double) ;
extern double lgamma (double) ; extern double __lgamma (double) ;



extern double tgamma (double) ; extern double __tgamma (double) ;




extern double gamma (double) ; extern double __gamma (double) ;






extern double lgamma_r (double, int *__signgamp) ; extern double __lgamma_r (double, int *__signgamp) ;






extern double rint (double __x) ; extern double __rint (double __x) ;


extern double nextafter (double __x, double __y) __attribute__ ((__const__)); extern double __nextafter (double __x, double __y) __attribute__ ((__const__));

extern double nexttoward (double __x, long double __y) __attribute__ ((__const__)); extern double __nexttoward (double __x, long double __y) __attribute__ ((__const__));



extern double remainder (double __x, double __y) ; extern double __remainder (double __x, double __y) ;



extern double scalb (double __x, double __n) ; extern double __scalb (double __x, double __n) ;




extern double scalbn (double __x, int __n) ; extern double __scalbn (double __x, int __n) ;



extern int ilogb (double __x) ; extern int __ilogb (double __x) ;




extern double scalbln (double __x, long int __n) ; extern double __scalbln (double __x, long int __n) ;



extern double nearbyint (double __x) ; extern double __nearbyint (double __x) ;



extern double round (double __x) ; extern double __round (double __x) ;



extern double trunc (double __x) __attribute__ ((__const__)); extern double __trunc (double __x) __attribute__ ((__const__));




extern double remquo (double __x, double __y, int *__quo) ; extern double __remquo (double __x, double __y, int *__quo) ;






extern long int lrint (double __x) ; extern long int __lrint (double __x) ;
extern long long int llrint (double __x) ; extern long long int __llrint (double __x) ;



extern long int lround (double __x) ; extern long int __lround (double __x) ;
extern long long int llround (double __x) ; extern long long int __llround (double __x) ;



extern double fdim (double __x, double __y) ; extern double __fdim (double __x, double __y) ;


extern double fmax (double __x, double __y) ; extern double __fmax (double __x, double __y) ;


extern double fmin (double __x, double __y) ; extern double __fmin (double __x, double __y) ;



extern int __fpclassify (double __value)
     __attribute__ ((__const__));


extern int __signbit (double __value)
     __attribute__ ((__const__));



extern double fma (double __x, double __y, double __z) ; extern double __fma (double __x, double __y, double __z) ;
# 64 "/usr/include/math.h" 2 3
# 82 "/usr/include/math.h" 3
# 1 "/usr/include/bits/mathcalls.h" 1 3
# 54 "/usr/include/bits/mathcalls.h" 3
extern float acosf (float __x) ; extern float __acosf (float __x) ;

extern float asinf (float __x) ; extern float __asinf (float __x) ;

extern float atanf (float __x) ; extern float __atanf (float __x) ;

extern float atan2f (float __y, float __x) ; extern float __atan2f (float __y, float __x) ;


extern float cosf (float __x) ; extern float __cosf (float __x) ;

extern float sinf (float __x) ; extern float __sinf (float __x) ;

extern float tanf (float __x) ; extern float __tanf (float __x) ;



extern void sincosf (float __x, float *__sinx, float *__cosx) ; extern void __sincosf (float __x, float *__sinx, float *__cosx) ;






extern float coshf (float __x) ; extern float __coshf (float __x) ;

extern float sinhf (float __x) ; extern float __sinhf (float __x) ;

extern float tanhf (float __x) ; extern float __tanhf (float __x) ;



extern float acoshf (float __x) ; extern float __acoshf (float __x) ;

extern float asinhf (float __x) ; extern float __asinhf (float __x) ;

extern float atanhf (float __x) ; extern float __atanhf (float __x) ;





extern float expf (float __x) ; extern float __expf (float __x) ;



extern float exp10f (float __x) ; extern float __exp10f (float __x) ;

extern float pow10f (float __x) ; extern float __pow10f (float __x) ;



extern float frexpf (float __x, int *__exponent) ; extern float __frexpf (float __x, int *__exponent) ;


extern float ldexpf (float __x, int __exponent) ; extern float __ldexpf (float __x, int __exponent) ;


extern float logf (float __x) ; extern float __logf (float __x) ;


extern float log10f (float __x) ; extern float __log10f (float __x) ;


extern float modff (float __x, float *__iptr) ; extern float __modff (float __x, float *__iptr) ;



extern float expm1f (float __x) ; extern float __expm1f (float __x) ;


extern float log1pf (float __x) ; extern float __log1pf (float __x) ;


extern float logbf (float __x) ; extern float __logbf (float __x) ;




extern float exp2f (float __x) ; extern float __exp2f (float __x) ;


extern float log2f (float __x) ; extern float __log2f (float __x) ;






extern float powf (float __x, float __y) ; extern float __powf (float __x, float __y) ;


extern float sqrtf (float __x) ; extern float __sqrtf (float __x) ;



extern float hypotf (float __x, float __y) ; extern float __hypotf (float __x, float __y) ;




extern float cbrtf (float __x) ; extern float __cbrtf (float __x) ;






extern float ceilf (float __x) ; extern float __ceilf (float __x) ;


extern float fabsf (float __x) __attribute__ ((__const__)); extern float __fabsf (float __x) __attribute__ ((__const__));


extern float floorf (float __x) ; extern float __floorf (float __x) ;


extern float fmodf (float __x, float __y) ; extern float __fmodf (float __x, float __y) ;




extern int __isinff (float __value) __attribute__ ((__const__));


extern int __finitef (float __value) __attribute__ ((__const__));




extern int isinff (float __value) __attribute__ ((__const__));


extern int finitef (float __value) __attribute__ ((__const__));


extern float dremf (float __x, float __y) ; extern float __dremf (float __x, float __y) ;



extern float significandf (float __x) ; extern float __significandf (float __x) ;




extern float copysignf (float __x, float __y) __attribute__ ((__const__)); extern float __copysignf (float __x, float __y) __attribute__ ((__const__));




extern float nanf (__const char *__tagb) __attribute__ ((__const__)); extern float __nanf (__const char *__tagb) __attribute__ ((__const__));




extern int __isnanf (float __value) __attribute__ ((__const__));



extern int isnanf (float __value) __attribute__ ((__const__));


extern float j0f (float) ; extern float __j0f (float) ;
extern float j1f (float) ; extern float __j1f (float) ;
extern float jnf (int, float) ; extern float __jnf (int, float) ;
extern float y0f (float) ; extern float __y0f (float) ;
extern float y1f (float) ; extern float __y1f (float) ;
extern float ynf (int, float) ; extern float __ynf (int, float) ;





extern float erff (float) ; extern float __erff (float) ;
extern float erfcf (float) ; extern float __erfcf (float) ;
extern float lgammaf (float) ; extern float __lgammaf (float) ;



extern float tgammaf (float) ; extern float __tgammaf (float) ;




extern float gammaf (float) ; extern float __gammaf (float) ;






extern float lgammaf_r (float, int *__signgamp) ; extern float __lgammaf_r (float, int *__signgamp) ;






extern float rintf (float __x) ; extern float __rintf (float __x) ;


extern float nextafterf (float __x, float __y) __attribute__ ((__const__)); extern float __nextafterf (float __x, float __y) __attribute__ ((__const__));

extern float nexttowardf (float __x, long double __y) __attribute__ ((__const__)); extern float __nexttowardf (float __x, long double __y) __attribute__ ((__const__));



extern float remainderf (float __x, float __y) ; extern float __remainderf (float __x, float __y) ;



extern float scalbf (float __x, float __n) ; extern float __scalbf (float __x, float __n) ;




extern float scalbnf (float __x, int __n) ; extern float __scalbnf (float __x, int __n) ;



extern int ilogbf (float __x) ; extern int __ilogbf (float __x) ;




extern float scalblnf (float __x, long int __n) ; extern float __scalblnf (float __x, long int __n) ;



extern float nearbyintf (float __x) ; extern float __nearbyintf (float __x) ;



extern float roundf (float __x) ; extern float __roundf (float __x) ;



extern float truncf (float __x) __attribute__ ((__const__)); extern float __truncf (float __x) __attribute__ ((__const__));




extern float remquof (float __x, float __y, int *__quo) ; extern float __remquof (float __x, float __y, int *__quo) ;






extern long int lrintf (float __x) ; extern long int __lrintf (float __x) ;
extern long long int llrintf (float __x) ; extern long long int __llrintf (float __x) ;



extern long int lroundf (float __x) ; extern long int __lroundf (float __x) ;
extern long long int llroundf (float __x) ; extern long long int __llroundf (float __x) ;



extern float fdimf (float __x, float __y) ; extern float __fdimf (float __x, float __y) ;


extern float fmaxf (float __x, float __y) ; extern float __fmaxf (float __x, float __y) ;


extern float fminf (float __x, float __y) ; extern float __fminf (float __x, float __y) ;



extern int __fpclassifyf (float __value)
     __attribute__ ((__const__));


extern int __signbitf (float __value)
     __attribute__ ((__const__));



extern float fmaf (float __x, float __y, float __z) ; extern float __fmaf (float __x, float __y, float __z) ;
# 83 "/usr/include/math.h" 2 3
# 99 "/usr/include/math.h" 3
# 1 "/usr/include/bits/mathcalls.h" 1 3
# 54 "/usr/include/bits/mathcalls.h" 3
extern long double acosl (long double __x) ; extern long double __acosl (long double __x) ;

extern long double asinl (long double __x) ; extern long double __asinl (long double __x) ;

extern long double atanl (long double __x) ; extern long double __atanl (long double __x) ;

extern long double atan2l (long double __y, long double __x) ; extern long double __atan2l (long double __y, long double __x) ;


extern long double cosl (long double __x) ; extern long double __cosl (long double __x) ;

extern long double sinl (long double __x) ; extern long double __sinl (long double __x) ;

extern long double tanl (long double __x) ; extern long double __tanl (long double __x) ;



extern void sincosl (long double __x, long double *__sinx, long double *__cosx) ; extern void __sincosl (long double __x, long double *__sinx, long double *__cosx) ;






extern long double coshl (long double __x) ; extern long double __coshl (long double __x) ;

extern long double sinhl (long double __x) ; extern long double __sinhl (long double __x) ;

extern long double tanhl (long double __x) ; extern long double __tanhl (long double __x) ;



extern long double acoshl (long double __x) ; extern long double __acoshl (long double __x) ;

extern long double asinhl (long double __x) ; extern long double __asinhl (long double __x) ;

extern long double atanhl (long double __x) ; extern long double __atanhl (long double __x) ;





extern long double expl (long double __x) ; extern long double __expl (long double __x) ;



extern long double exp10l (long double __x) ; extern long double __exp10l (long double __x) ;

extern long double pow10l (long double __x) ; extern long double __pow10l (long double __x) ;



extern long double frexpl (long double __x, int *__exponent) ; extern long double __frexpl (long double __x, int *__exponent) ;


extern long double ldexpl (long double __x, int __exponent) ; extern long double __ldexpl (long double __x, int __exponent) ;


extern long double logl (long double __x) ; extern long double __logl (long double __x) ;


extern long double log10l (long double __x) ; extern long double __log10l (long double __x) ;


extern long double modfl (long double __x, long double *__iptr) ; extern long double __modfl (long double __x, long double *__iptr) ;



extern long double expm1l (long double __x) ; extern long double __expm1l (long double __x) ;


extern long double log1pl (long double __x) ; extern long double __log1pl (long double __x) ;


extern long double logbl (long double __x) ; extern long double __logbl (long double __x) ;




extern long double exp2l (long double __x) ; extern long double __exp2l (long double __x) ;


extern long double log2l (long double __x) ; extern long double __log2l (long double __x) ;






extern long double powl (long double __x, long double __y) ; extern long double __powl (long double __x, long double __y) ;


extern long double sqrtl (long double __x) ; extern long double __sqrtl (long double __x) ;



extern long double hypotl (long double __x, long double __y) ; extern long double __hypotl (long double __x, long double __y) ;




extern long double cbrtl (long double __x) ; extern long double __cbrtl (long double __x) ;






extern long double ceill (long double __x) ; extern long double __ceill (long double __x) ;


extern long double fabsl (long double __x) __attribute__ ((__const__)); extern long double __fabsl (long double __x) __attribute__ ((__const__));


extern long double floorl (long double __x) ; extern long double __floorl (long double __x) ;


extern long double fmodl (long double __x, long double __y) ; extern long double __fmodl (long double __x, long double __y) ;




extern int __isinfl (long double __value) __attribute__ ((__const__));


extern int __finitel (long double __value) __attribute__ ((__const__));




extern int isinfl (long double __value) __attribute__ ((__const__));


extern int finitel (long double __value) __attribute__ ((__const__));


extern long double dreml (long double __x, long double __y) ; extern long double __dreml (long double __x, long double __y) ;



extern long double significandl (long double __x) ; extern long double __significandl (long double __x) ;




extern long double copysignl (long double __x, long double __y) __attribute__ ((__const__)); extern long double __copysignl (long double __x, long double __y) __attribute__ ((__const__));




extern long double nanl (__const char *__tagb) __attribute__ ((__const__)); extern long double __nanl (__const char *__tagb) __attribute__ ((__const__));




extern int __isnanl (long double __value) __attribute__ ((__const__));



extern int isnanl (long double __value) __attribute__ ((__const__));


extern long double j0l (long double) ; extern long double __j0l (long double) ;
extern long double j1l (long double) ; extern long double __j1l (long double) ;
extern long double jnl (int, long double) ; extern long double __jnl (int, long double) ;
extern long double y0l (long double) ; extern long double __y0l (long double) ;
extern long double y1l (long double) ; extern long double __y1l (long double) ;
extern long double ynl (int, long double) ; extern long double __ynl (int, long double) ;





extern long double erfl (long double) ; extern long double __erfl (long double) ;
extern long double erfcl (long double) ; extern long double __erfcl (long double) ;
extern long double lgammal (long double) ; extern long double __lgammal (long double) ;



extern long double tgammal (long double) ; extern long double __tgammal (long double) ;




extern long double gammal (long double) ; extern long double __gammal (long double) ;






extern long double lgammal_r (long double, int *__signgamp) ; extern long double __lgammal_r (long double, int *__signgamp) ;






extern long double rintl (long double __x) ; extern long double __rintl (long double __x) ;


extern long double nextafterl (long double __x, long double __y) __attribute__ ((__const__)); extern long double __nextafterl (long double __x, long double __y) __attribute__ ((__const__));

extern long double nexttowardl (long double __x, long double __y) __attribute__ ((__const__)); extern long double __nexttowardl (long double __x, long double __y) __attribute__ ((__const__));



extern long double remainderl (long double __x, long double __y) ; extern long double __remainderl (long double __x, long double __y) ;



extern long double scalbl (long double __x, long double __n) ; extern long double __scalbl (long double __x, long double __n) ;




extern long double scalbnl (long double __x, int __n) ; extern long double __scalbnl (long double __x, int __n) ;



extern int ilogbl (long double __x) ; extern int __ilogbl (long double __x) ;




extern long double scalblnl (long double __x, long int __n) ; extern long double __scalblnl (long double __x, long int __n) ;



extern long double nearbyintl (long double __x) ; extern long double __nearbyintl (long double __x) ;



extern long double roundl (long double __x) ; extern long double __roundl (long double __x) ;



extern long double truncl (long double __x) __attribute__ ((__const__)); extern long double __truncl (long double __x) __attribute__ ((__const__));




extern long double remquol (long double __x, long double __y, int *__quo) ; extern long double __remquol (long double __x, long double __y, int *__quo) ;






extern long int lrintl (long double __x) ; extern long int __lrintl (long double __x) ;
extern long long int llrintl (long double __x) ; extern long long int __llrintl (long double __x) ;



extern long int lroundl (long double __x) ; extern long int __lroundl (long double __x) ;
extern long long int llroundl (long double __x) ; extern long long int __llroundl (long double __x) ;



extern long double fdiml (long double __x, long double __y) ; extern long double __fdiml (long double __x, long double __y) ;


extern long double fmaxl (long double __x, long double __y) ; extern long double __fmaxl (long double __x, long double __y) ;


extern long double fminl (long double __x, long double __y) ; extern long double __fminl (long double __x, long double __y) ;



extern int __fpclassifyl (long double __value)
     __attribute__ ((__const__));


extern int __signbitl (long double __value)
     __attribute__ ((__const__));



extern long double fmal (long double __x, long double __y, long double __z) ; extern long double __fmal (long double __x, long double __y, long double __z) ;
# 100 "/usr/include/math.h" 2 3
# 113 "/usr/include/math.h" 3
extern int signgam;
# 154 "/usr/include/math.h" 3
enum
  {
    FP_NAN,

    FP_INFINITE,

    FP_ZERO,

    FP_SUBNORMAL,

    FP_NORMAL

  };
# 240 "/usr/include/math.h" 3
typedef enum
{
  _IEEE_ = -1,
  _SVID_,
  _XOPEN_,
  _POSIX_,
  _ISOC_
} _LIB_VERSION_TYPE;




extern _LIB_VERSION_TYPE _LIB_VERSION;
# 265 "/usr/include/math.h" 3
struct exception

  {
    int type;
    char *name;
    double arg1;
    double arg2;
    double retval;
  };




extern int matherr (struct exception *__exc);
# 350 "/usr/include/math.h" 3
# 1 "/usr/include/bits/mathinline.h" 1 3
# 127 "/usr/include/bits/mathinline.h" 3
extern __inline int
__signbitf (float __x)
{
  __extension__ union { float __f; int __i; } __u = { __f: __x };
  return __u.__i < 0;
}
extern __inline int
__signbit (double __x)
{
  __extension__ union { double __d; int __i[2]; } __u = { __d: __x };
  return __u.__i[1] < 0;
}
extern __inline int
__signbitl (long double __x)
{
  __extension__ union { long double __l; int __i[3]; } __u = { __l: __x };
  return (__u.__i[2] & 0x8000) != 0;
}
# 291 "/usr/include/bits/mathinline.h" 3
extern __inline double __sgn (double) ; extern __inline double __sgn (double __x) { return __x == 0.0 ? 0.0 : (__x > 0.0 ? 1.0 : -1.0); } extern __inline float __sgnf (float) ; extern __inline float __sgnf (float __x) { return __x == 0.0 ? 0.0 : (__x > 0.0 ? 1.0 : -1.0); } extern __inline long double __sgnl (long double) ; extern __inline long double __sgnl (long double __x) { return __x == 0.0 ? 0.0 : (__x > 0.0 ? 1.0 : -1.0); }




extern __inline double __pow2 (double) ; extern __inline double __pow2 (double __x) { register long double __value; register long double __exponent; __extension__ long long int __p = (long long int) __x; if (__x == (long double) __p) { __asm __volatile__ ("fscale" : "=t" (__value) : "0" (1.0), "u" (__x)); return __value; } __asm __volatile__ ("fld	%%st(0)\n\t" "frndint			# int(x)\n\t" "fxch\n\t" "fsub	%%st(1)		# fract(x)\n\t" "f2xm1			# 2^(fract(x)) - 1\n\t" : "=t" (__value), "=u" (__exponent) : "0" (__x)); __value += 1.0; __asm __volatile__ ("fscale" : "=t" (__value) : "0" (__value), "u" (__exponent)); return __value; } extern __inline float __pow2f (float) ; extern __inline float __pow2f (float __x) { register long double __value; register long double __exponent; __extension__ long long int __p = (long long int) __x; if (__x == (long double) __p) { __asm __volatile__ ("fscale" : "=t" (__value) : "0" (1.0), "u" (__x)); return __value; } __asm __volatile__ ("fld	%%st(0)\n\t" "frndint			# int(x)\n\t" "fxch\n\t" "fsub	%%st(1)		# fract(x)\n\t" "f2xm1			# 2^(fract(x)) - 1\n\t" : "=t" (__value), "=u" (__exponent) : "0" (__x)); __value += 1.0; __asm __volatile__ ("fscale" : "=t" (__value) : "0" (__value), "u" (__exponent)); return __value; } extern __inline long double __pow2l (long double) ; extern __inline long double __pow2l (long double __x) { register long double __value; register long double __exponent; __extension__ long long int __p = (long long int) __x; if (__x == (long double) __p) { __asm __volatile__ ("fscale" : "=t" (__value) : "0" (1.0), "u" (__x)); return __value; } __asm __volatile__ ("fld	%%st(0)\n\t" "frndint			# int(x)\n\t" "fxch\n\t" "fsub	%%st(1)		# fract(x)\n\t" "f2xm1			# 2^(fract(x)) - 1\n\t" : "=t" (__value), "=u" (__exponent) : "0" (__x)); __value += 1.0; __asm __volatile__ ("fscale" : "=t" (__value) : "0" (__value), "u" (__exponent)); return __value; }
# 343 "/usr/include/bits/mathinline.h" 3
extern __inline void
__sincos (double __x, double *__sinx, double *__cosx)
{
  register long double __cosr; register long double __sinr; __asm __volatile__ ("fsincos\n\t" "fnstsw	%%ax\n\t" "testl	$0x400, %%eax\n\t" "jz	1f\n\t" "fldpi\n\t" "fadd	%%st(0)\n\t" "fxch	%%st(1)\n\t" "2: fprem1\n\t" "fnstsw	%%ax\n\t" "testl	$0x400, %%eax\n\t" "jnz	2b\n\t" "fstp	%%st(1)\n\t" "fsincos\n\t" "1:" : "=t" (__cosr), "=u" (__sinr) : "0" (__x)); *__sinx = __sinr; *__cosx = __cosr;
}

extern __inline void
__sincosf (float __x, float *__sinx, float *__cosx)
{
  register long double __cosr; register long double __sinr; __asm __volatile__ ("fsincos\n\t" "fnstsw	%%ax\n\t" "testl	$0x400, %%eax\n\t" "jz	1f\n\t" "fldpi\n\t" "fadd	%%st(0)\n\t" "fxch	%%st(1)\n\t" "2: fprem1\n\t" "fnstsw	%%ax\n\t" "testl	$0x400, %%eax\n\t" "jnz	2b\n\t" "fstp	%%st(1)\n\t" "fsincos\n\t" "1:" : "=t" (__cosr), "=u" (__sinr) : "0" (__x)); *__sinx = __sinr; *__cosx = __cosr;
}

extern __inline void
__sincosl (long double __x, long double *__sinx, long double *__cosx)
{
  register long double __cosr; register long double __sinr; __asm __volatile__ ("fsincos\n\t" "fnstsw	%%ax\n\t" "testl	$0x400, %%eax\n\t" "jz	1f\n\t" "fldpi\n\t" "fadd	%%st(0)\n\t" "fxch	%%st(1)\n\t" "2: fprem1\n\t" "fnstsw	%%ax\n\t" "testl	$0x400, %%eax\n\t" "jnz	2b\n\t" "fstp	%%st(1)\n\t" "fsincos\n\t" "1:" : "=t" (__cosr), "=u" (__sinr) : "0" (__x)); *__sinx = __sinr; *__cosx = __cosr;
}
# 385 "/usr/include/bits/mathinline.h" 3
extern __inline long double __expm1l (long double __x) { register long double __value; register long double __exponent; register long double __temp; __asm __volatile__ ("fldl2e			# e^x - 1 = 2^(x * log2(e)) - 1\n\t" "fmul	%%st(1)		# x * log2(e)\n\t" "fst	%%st(1)\n\t" "frndint			# int(x * log2(e))\n\t" "fxch\n\t" "fsub	%%st(1)		# fract(x * log2(e))\n\t" "f2xm1			# 2^(fract(x * log2(e))) - 1\n\t" "fscale			# 2^(x * log2(e)) - 2^(int(x * log2(e)))\n\t" : "=t" (__value), "=u" (__exponent) : "0" (__x)); __asm __volatile__ ("fscale			# 2^int(x * log2(e))\n\t" : "=t" (__temp) : "0" (1.0), "u" (__exponent)); __temp -= 1.0; return __temp + __value ?: __x; }
# 405 "/usr/include/bits/mathinline.h" 3
extern __inline double exp (double __x) { register long double __value; register long double __exponent; __asm __volatile__ ("fldl2e			# e^x = 2^(x * log2(e))\n\t" "fmul	%%st(1)		# x * log2(e)\n\t" "fst	%%st(1)\n\t" "frndint			# int(x * log2(e))\n\t" "fxch\n\t" "fsub	%%st(1)		# fract(x * log2(e))\n\t" "f2xm1			# 2^(fract(x * log2(e))) - 1\n\t" : "=t" (__value), "=u" (__exponent) : "0" (__x)); __value += 1.0; __asm __volatile__ ("fscale" : "=t" (__value) : "0" (__value), "u" (__exponent)); return __value; } extern __inline float expf (float __x) { register long double __value; register long double __exponent; __asm __volatile__ ("fldl2e			# e^x = 2^(x * log2(e))\n\t" "fmul	%%st(1)		# x * log2(e)\n\t" "fst	%%st(1)\n\t" "frndint			# int(x * log2(e))\n\t" "fxch\n\t" "fsub	%%st(1)		# fract(x * log2(e))\n\t" "f2xm1			# 2^(fract(x * log2(e))) - 1\n\t" : "=t" (__value), "=u" (__exponent) : "0" (__x)); __value += 1.0; __asm __volatile__ ("fscale" : "=t" (__value) : "0" (__value), "u" (__exponent)); return __value; } extern __inline long double expl (long double __x) { register long double __value; register long double __exponent; __asm __volatile__ ("fldl2e			# e^x = 2^(x * log2(e))\n\t" "fmul	%%st(1)		# x * log2(e)\n\t" "fst	%%st(1)\n\t" "frndint			# int(x * log2(e))\n\t" "fxch\n\t" "fsub	%%st(1)		# fract(x * log2(e))\n\t" "f2xm1			# 2^(fract(x * log2(e))) - 1\n\t" : "=t" (__value), "=u" (__exponent) : "0" (__x)); __value += 1.0; __asm __volatile__ ("fscale" : "=t" (__value) : "0" (__value), "u" (__exponent)); return __value; }
extern __inline long double __expl (long double __x) { register long double __value; register long double __exponent; __asm __volatile__ ("fldl2e			# e^x = 2^(x * log2(e))\n\t" "fmul	%%st(1)		# x * log2(e)\n\t" "fst	%%st(1)\n\t" "frndint			# int(x * log2(e))\n\t" "fxch\n\t" "fsub	%%st(1)		# fract(x * log2(e))\n\t" "f2xm1			# 2^(fract(x * log2(e))) - 1\n\t" : "=t" (__value), "=u" (__exponent) : "0" (__x)); __value += 1.0; __asm __volatile__ ("fscale" : "=t" (__value) : "0" (__value), "u" (__exponent)); return __value; }


extern __inline double tan (double __x) { register long double __value; register long double __value2 __attribute__ ((__unused__)); __asm __volatile__ ("fptan" : "=t" (__value2), "=u" (__value) : "0" (__x)); return __value; } extern __inline float tanf (float __x) { register long double __value; register long double __value2 __attribute__ ((__unused__)); __asm __volatile__ ("fptan" : "=t" (__value2), "=u" (__value) : "0" (__x)); return __value; } extern __inline long double tanl (long double __x) { register long double __value; register long double __value2 __attribute__ ((__unused__)); __asm __volatile__ ("fptan" : "=t" (__value2), "=u" (__value) : "0" (__x)); return __value; }
# 425 "/usr/include/bits/mathinline.h" 3
extern __inline double atan2 (double __y, double __x) { register long double __value; __asm __volatile__ ("fpatan" : "=t" (__value) : "0" (__x), "u" (__y) : "st(1)"); return __value; } extern __inline float atan2f (float __y, float __x) { register long double __value; __asm __volatile__ ("fpatan" : "=t" (__value) : "0" (__x), "u" (__y) : "st(1)"); return __value; } extern __inline long double atan2l (long double __y, long double __x) { register long double __value; __asm __volatile__ ("fpatan" : "=t" (__value) : "0" (__x), "u" (__y) : "st(1)"); return __value; }
extern __inline long double __atan2l (long double __y, long double __x) { register long double __value; __asm __volatile__ ("fpatan" : "=t" (__value) : "0" (__x), "u" (__y) : "st(1)"); return __value; }


extern __inline double fmod (double __x, double __y) { register long double __value; __asm __volatile__ ("1:	fprem\n\t" "fnstsw	%%ax\n\t" "sahf\n\t" "jp	1b" : "=t" (__value) : "0" (__x), "u" (__y) : "ax", "cc"); return __value; } extern __inline float fmodf (float __x, float __y) { register long double __value; __asm __volatile__ ("1:	fprem\n\t" "fnstsw	%%ax\n\t" "sahf\n\t" "jp	1b" : "=t" (__value) : "0" (__x), "u" (__y) : "ax", "cc"); return __value; } extern __inline long double fmodl (long double __x, long double __y) { register long double __value; __asm __volatile__ ("1:	fprem\n\t" "fnstsw	%%ax\n\t" "sahf\n\t" "jp	1b" : "=t" (__value) : "0" (__x), "u" (__y) : "ax", "cc"); return __value; }
# 440 "/usr/include/bits/mathinline.h" 3
extern __inline double sqrt (double __x) { register double __result; __asm __volatile__ ("fsqrt" : "=t" (__result) : "0" (__x)); return __result; } extern __inline float sqrtf (float __x) { register float __result; __asm __volatile__ ("fsqrt" : "=t" (__result) : "0" (__x)); return __result; } extern __inline long double sqrtl (long double __x) { register long double __result; __asm __volatile__ ("fsqrt" : "=t" (__result) : "0" (__x)); return __result; }
extern __inline long double __sqrtl (long double __x) { register long double __result; __asm __volatile__ ("fsqrt" : "=t" (__result) : "0" (__x)); return __result; }


extern __inline double fabs (double __x) { return __builtin_fabs (__x); }
extern __inline float fabsf (float __x) { return __builtin_fabsf (__x); }
extern __inline long double fabsl (long double __x) { return __builtin_fabsl (__x); }
extern __inline long double __fabsl (long double __x) { return __builtin_fabsl (__x); }







extern __inline double sin (double __x) { register double __result; __asm __volatile__ ("fsin" : "=t" (__result) : "0" (__x)); return __result; } extern __inline float sinf (float __x) { register float __result; __asm __volatile__ ("fsin" : "=t" (__result) : "0" (__x)); return __result; } extern __inline long double sinl (long double __x) { register long double __result; __asm __volatile__ ("fsin" : "=t" (__result) : "0" (__x)); return __result; }

extern __inline double cos (double __x) { register double __result; __asm __volatile__ ("fcos" : "=t" (__result) : "0" (__x)); return __result; } extern __inline float cosf (float __x) { register float __result; __asm __volatile__ ("fcos" : "=t" (__result) : "0" (__x)); return __result; } extern __inline long double cosl (long double __x) { register long double __result; __asm __volatile__ ("fcos" : "=t" (__result) : "0" (__x)); return __result; }

extern __inline double log (double __x) { register double __result; __asm __volatile__ ("fldln2; fxch; fyl2x" : "=t" (__result) : "0" (__x) : "st(1)"); return __result; } extern __inline float logf (float __x) { register float __result; __asm __volatile__ ("fldln2; fxch; fyl2x" : "=t" (__result) : "0" (__x) : "st(1)"); return __result; } extern __inline long double logl (long double __x) { register long double __result; __asm __volatile__ ("fldln2; fxch; fyl2x" : "=t" (__result) : "0" (__x) : "st(1)"); return __result; }
extern __inline double log10 (double __x) { register double __result; __asm __volatile__ ("fldlg2; fxch; fyl2x" : "=t" (__result) : "0" (__x) : "st(1)"); return __result; } extern __inline float log10f (float __x) { register float __result; __asm __volatile__ ("fldlg2; fxch; fyl2x" : "=t" (__result) : "0" (__x) : "st(1)"); return __result; } extern __inline long double log10l (long double __x) { register long double __result; __asm __volatile__ ("fldlg2; fxch; fyl2x" : "=t" (__result) : "0" (__x) : "st(1)"); return __result; }

extern __inline double asin (double __x) { return __atan2l (__x, __sqrtl (1.0 - __x * __x)); } extern __inline float asinf (float __x) { return __atan2l (__x, __sqrtl (1.0 - __x * __x)); } extern __inline long double asinl (long double __x) { return __atan2l (__x, __sqrtl (1.0 - __x * __x)); }
extern __inline double acos (double __x) { return __atan2l (__sqrtl (1.0 - __x * __x), __x); } extern __inline float acosf (float __x) { return __atan2l (__sqrtl (1.0 - __x * __x), __x); } extern __inline long double acosl (long double __x) { return __atan2l (__sqrtl (1.0 - __x * __x), __x); }


extern __inline double atan (double __x) { register double __result; __asm __volatile__ ("fld1; fpatan" : "=t" (__result) : "0" (__x) : "st(1)"); return __result; } extern __inline float atanf (float __x) { register float __result; __asm __volatile__ ("fld1; fpatan" : "=t" (__result) : "0" (__x) : "st(1)"); return __result; } extern __inline long double atanl (long double __x) { register long double __result; __asm __volatile__ ("fld1; fpatan" : "=t" (__result) : "0" (__x) : "st(1)"); return __result; }

extern __inline long double __sgn1l (long double) ; extern __inline long double __sgn1l (long double __x) { __extension__ union { long double __xld; unsigned int __xi[3]; } __n = { __xld: __x }; __n.__xi[2] = (__n.__xi[2] & 0x8000) | 0x3fff; __n.__xi[1] = 0x80000000; __n.__xi[0] = 0; return __n.__xld; }
# 479 "/usr/include/bits/mathinline.h" 3
extern __inline double sinh (double __x) { register long double __exm1 = __expm1l (__fabsl (__x)); return 0.5 * (__exm1 / (__exm1 + 1.0) + __exm1) * __sgn1l (__x); } extern __inline float sinhf (float __x) { register long double __exm1 = __expm1l (__fabsl (__x)); return 0.5 * (__exm1 / (__exm1 + 1.0) + __exm1) * __sgn1l (__x); } extern __inline long double sinhl (long double __x) { register long double __exm1 = __expm1l (__fabsl (__x)); return 0.5 * (__exm1 / (__exm1 + 1.0) + __exm1) * __sgn1l (__x); }



extern __inline double cosh (double __x) { register long double __ex = __expl (__x); return 0.5 * (__ex + 1.0 / __ex); } extern __inline float coshf (float __x) { register long double __ex = __expl (__x); return 0.5 * (__ex + 1.0 / __ex); } extern __inline long double coshl (long double __x) { register long double __ex = __expl (__x); return 0.5 * (__ex + 1.0 / __ex); }



extern __inline double tanh (double __x) { register long double __exm1 = __expm1l (-__fabsl (__x + __x)); return __exm1 / (__exm1 + 2.0) * __sgn1l (-__x); } extern __inline float tanhf (float __x) { register long double __exm1 = __expm1l (-__fabsl (__x + __x)); return __exm1 / (__exm1 + 2.0) * __sgn1l (-__x); } extern __inline long double tanhl (long double __x) { register long double __exm1 = __expm1l (-__fabsl (__x + __x)); return __exm1 / (__exm1 + 2.0) * __sgn1l (-__x); }




extern __inline double floor (double __x) { register long double __value; __volatile unsigned short int __cw; __volatile unsigned short int __cwtmp; __asm __volatile ("fnstcw %0" : "=m" (__cw)); __cwtmp = (__cw & 0xf3ff) | 0x0400; __asm __volatile ("fldcw %0" : : "m" (__cwtmp)); __asm __volatile ("frndint" : "=t" (__value) : "0" (__x)); __asm __volatile ("fldcw %0" : : "m" (__cw)); return __value; } extern __inline float floorf (float __x) { register long double __value; __volatile unsigned short int __cw; __volatile unsigned short int __cwtmp; __asm __volatile ("fnstcw %0" : "=m" (__cw)); __cwtmp = (__cw & 0xf3ff) | 0x0400; __asm __volatile ("fldcw %0" : : "m" (__cwtmp)); __asm __volatile ("frndint" : "=t" (__value) : "0" (__x)); __asm __volatile ("fldcw %0" : : "m" (__cw)); return __value; } extern __inline long double floorl (long double __x) { register long double __value; __volatile unsigned short int __cw; __volatile unsigned short int __cwtmp; __asm __volatile ("fnstcw %0" : "=m" (__cw)); __cwtmp = (__cw & 0xf3ff) | 0x0400; __asm __volatile ("fldcw %0" : : "m" (__cwtmp)); __asm __volatile ("frndint" : "=t" (__value) : "0" (__x)); __asm __volatile ("fldcw %0" : : "m" (__cw)); return __value; }
# 503 "/usr/include/bits/mathinline.h" 3
extern __inline double ceil (double __x) { register long double __value; __volatile unsigned short int __cw; __volatile unsigned short int __cwtmp; __asm __volatile ("fnstcw %0" : "=m" (__cw)); __cwtmp = (__cw & 0xf3ff) | 0x0800; __asm __volatile ("fldcw %0" : : "m" (__cwtmp)); __asm __volatile ("frndint" : "=t" (__value) : "0" (__x)); __asm __volatile ("fldcw %0" : : "m" (__cw)); return __value; } extern __inline float ceilf (float __x) { register long double __value; __volatile unsigned short int __cw; __volatile unsigned short int __cwtmp; __asm __volatile ("fnstcw %0" : "=m" (__cw)); __cwtmp = (__cw & 0xf3ff) | 0x0800; __asm __volatile ("fldcw %0" : : "m" (__cwtmp)); __asm __volatile ("frndint" : "=t" (__value) : "0" (__x)); __asm __volatile ("fldcw %0" : : "m" (__cw)); return __value; } extern __inline long double ceill (long double __x) { register long double __value; __volatile unsigned short int __cw; __volatile unsigned short int __cwtmp; __asm __volatile ("fnstcw %0" : "=m" (__cw)); __cwtmp = (__cw & 0xf3ff) | 0x0800; __asm __volatile ("fldcw %0" : : "m" (__cwtmp)); __asm __volatile ("frndint" : "=t" (__value) : "0" (__x)); __asm __volatile ("fldcw %0" : : "m" (__cw)); return __value; }
# 521 "/usr/include/bits/mathinline.h" 3
extern __inline double
ldexp (double __x, int __y)
{
  register long double __value; __asm __volatile__ ("fscale" : "=t" (__value) : "0" (__x), "u" ((long double) __y)); return __value;
}






extern __inline double expm1 (double __x) { register long double __value; register long double __exponent; register long double __temp; __asm __volatile__ ("fldl2e			# e^x - 1 = 2^(x * log2(e)) - 1\n\t" "fmul	%%st(1)		# x * log2(e)\n\t" "fst	%%st(1)\n\t" "frndint			# int(x * log2(e))\n\t" "fxch\n\t" "fsub	%%st(1)		# fract(x * log2(e))\n\t" "f2xm1			# 2^(fract(x * log2(e))) - 1\n\t" "fscale			# 2^(x * log2(e)) - 2^(int(x * log2(e)))\n\t" : "=t" (__value), "=u" (__exponent) : "0" (__x)); __asm __volatile__ ("fscale			# 2^int(x * log2(e))\n\t" : "=t" (__temp) : "0" (1.0), "u" (__exponent)); __temp -= 1.0; return __temp + __value ?: __x; } extern __inline float expm1f (float __x) { register long double __value; register long double __exponent; register long double __temp; __asm __volatile__ ("fldl2e			# e^x - 1 = 2^(x * log2(e)) - 1\n\t" "fmul	%%st(1)		# x * log2(e)\n\t" "fst	%%st(1)\n\t" "frndint			# int(x * log2(e))\n\t" "fxch\n\t" "fsub	%%st(1)		# fract(x * log2(e))\n\t" "f2xm1			# 2^(fract(x * log2(e))) - 1\n\t" "fscale			# 2^(x * log2(e)) - 2^(int(x * log2(e)))\n\t" : "=t" (__value), "=u" (__exponent) : "0" (__x)); __asm __volatile__ ("fscale			# 2^int(x * log2(e))\n\t" : "=t" (__temp) : "0" (1.0), "u" (__exponent)); __temp -= 1.0; return __temp + __value ?: __x; } extern __inline long double expm1l (long double __x) { register long double __value; register long double __exponent; register long double __temp; __asm __volatile__ ("fldl2e			# e^x - 1 = 2^(x * log2(e)) - 1\n\t" "fmul	%%st(1)		# x * log2(e)\n\t" "fst	%%st(1)\n\t" "frndint			# int(x * log2(e))\n\t" "fxch\n\t" "fsub	%%st(1)		# fract(x * log2(e))\n\t" "f2xm1			# 2^(fract(x * log2(e))) - 1\n\t" "fscale			# 2^(x * log2(e)) - 2^(int(x * log2(e)))\n\t" : "=t" (__value), "=u" (__exponent) : "0" (__x)); __asm __volatile__ ("fscale			# 2^int(x * log2(e))\n\t" : "=t" (__temp) : "0" (1.0), "u" (__exponent)); __temp -= 1.0; return __temp + __value ?: __x; }






extern __inline double log1p (double __x) { register long double __value; if (__fabsl (__x) >= 1.0 - 0.5 * 1.41421356237309504880L) __value = logl (1.0 + __x); else __asm __volatile__ ("fldln2\n\t" "fxch\n\t" "fyl2xp1" : "=t" (__value) : "0" (__x) : "st(1)"); return __value; } extern __inline float log1pf (float __x) { register long double __value; if (__fabsl (__x) >= 1.0 - 0.5 * 1.41421356237309504880L) __value = logl (1.0 + __x); else __asm __volatile__ ("fldln2\n\t" "fxch\n\t" "fyl2xp1" : "=t" (__value) : "0" (__x) : "st(1)"); return __value; } extern __inline long double log1pl (long double __x) { register long double __value; if (__fabsl (__x) >= 1.0 - 0.5 * 1.41421356237309504880L) __value = logl (1.0 + __x); else __asm __volatile__ ("fldln2\n\t" "fxch\n\t" "fyl2xp1" : "=t" (__value) : "0" (__x) : "st(1)"); return __value; }
# 553 "/usr/include/bits/mathinline.h" 3
extern __inline double asinh (double __x) { register long double __y = __fabsl (__x); return (log1pl (__y * __y / (__sqrtl (__y * __y + 1.0) + 1.0) + __y) * __sgn1l (__x)); } extern __inline float asinhf (float __x) { register long double __y = __fabsl (__x); return (log1pl (__y * __y / (__sqrtl (__y * __y + 1.0) + 1.0) + __y) * __sgn1l (__x)); } extern __inline long double asinhl (long double __x) { register long double __y = __fabsl (__x); return (log1pl (__y * __y / (__sqrtl (__y * __y + 1.0) + 1.0) + __y) * __sgn1l (__x)); }




extern __inline double acosh (double __x) { return logl (__x + __sqrtl (__x - 1.0) * __sqrtl (__x + 1.0)); } extern __inline float acoshf (float __x) { return logl (__x + __sqrtl (__x - 1.0) * __sqrtl (__x + 1.0)); } extern __inline long double acoshl (long double __x) { return logl (__x + __sqrtl (__x - 1.0) * __sqrtl (__x + 1.0)); }


extern __inline double atanh (double __x) { register long double __y = __fabsl (__x); return -0.5 * log1pl (-(__y + __y) / (1.0 + __y)) * __sgn1l (__x); } extern __inline float atanhf (float __x) { register long double __y = __fabsl (__x); return -0.5 * log1pl (-(__y + __y) / (1.0 + __y)) * __sgn1l (__x); } extern __inline long double atanhl (long double __x) { register long double __y = __fabsl (__x); return -0.5 * log1pl (-(__y + __y) / (1.0 + __y)) * __sgn1l (__x); }




extern __inline double hypot (double __x, double __y) { return __sqrtl (__x * __x + __y * __y); } extern __inline float hypotf (float __x, float __y) { return __sqrtl (__x * __x + __y * __y); } extern __inline long double hypotl (long double __x, long double __y) { return __sqrtl (__x * __x + __y * __y); }

extern __inline double logb (double __x) { register long double __value; register long double __junk; __asm __volatile__ ("fxtract\n\t" : "=t" (__junk), "=u" (__value) : "0" (__x)); return __value; } extern __inline float logbf (float __x) { register long double __value; register long double __junk; __asm __volatile__ ("fxtract\n\t" : "=t" (__junk), "=u" (__value) : "0" (__x)); return __value; } extern __inline long double logbl (long double __x) { register long double __value; register long double __junk; __asm __volatile__ ("fxtract\n\t" : "=t" (__junk), "=u" (__value) : "0" (__x)); return __value; }
# 580 "/usr/include/bits/mathinline.h" 3
extern __inline double log2 (double __x) { register double __result; __asm __volatile__ ("fld1; fxch; fyl2x" : "=t" (__result) : "0" (__x) : "st(1)"); return __result; } extern __inline float log2f (float __x) { register float __result; __asm __volatile__ ("fld1; fxch; fyl2x" : "=t" (__result) : "0" (__x) : "st(1)"); return __result; } extern __inline long double log2l (long double __x) { register long double __result; __asm __volatile__ ("fld1; fxch; fyl2x" : "=t" (__result) : "0" (__x) : "st(1)"); return __result; }


extern __inline float
ldexpf (float __x, int __y)
{
  register long double __value; __asm __volatile__ ("fscale" : "=t" (__value) : "0" (__x), "u" ((long double) __y)); return __value;
}

extern __inline long double
ldexpl (long double __x, int __y)
{
  register long double __value; __asm __volatile__ ("fscale" : "=t" (__value) : "0" (__x), "u" ((long double) __y)); return __value;
}


extern __inline double fma (double __x, double __y, double __z) { return (__x * __y) + __z; } extern __inline float fmaf (float __x, float __y, float __z) { return (__x * __y) + __z; } extern __inline long double fmal (long double __x, long double __y, long double __z) { return (__x * __y) + __z; }

extern __inline double rint (double __x) { register double __result; __asm __volatile__ ("frndint" : "=t" (__result) : "0" (__x)); return __result; } extern __inline float rintf (float __x) { register float __result; __asm __volatile__ ("frndint" : "=t" (__result) : "0" (__x)); return __result; } extern __inline long double rintl (long double __x) { register long double __result; __asm __volatile__ ("frndint" : "=t" (__result) : "0" (__x)); return __result; }
# 607 "/usr/include/bits/mathinline.h" 3
extern __inline long int
lrintf (float __x)
{
  long int __lrintres; __asm__ __volatile__ ("fistpl %0" : "=m" (__lrintres) : "t" (__x) : "st"); return __lrintres;
}
extern __inline long int
lrint (double __x)
{
  long int __lrintres; __asm__ __volatile__ ("fistpl %0" : "=m" (__lrintres) : "t" (__x) : "st"); return __lrintres;
}
extern __inline long int
lrintl (long double __x)
{
  long int __lrintres; __asm__ __volatile__ ("fistpl %0" : "=m" (__lrintres) : "t" (__x) : "st"); return __lrintres;
}
# 630 "/usr/include/bits/mathinline.h" 3
extern __inline long long int
llrintf (float __x)
{
  long long int __llrintres; __asm__ __volatile__ ("fistpll %0" : "=m" (__llrintres) : "t" (__x) : "st"); return __llrintres;
}
extern __inline long long int
llrint (double __x)
{
  long long int __llrintres; __asm__ __volatile__ ("fistpll %0" : "=m" (__llrintres) : "t" (__x) : "st"); return __llrintres;
}
extern __inline long long int
llrintl (long double __x)
{
  long long int __llrintres; __asm__ __volatile__ ("fistpll %0" : "=m" (__llrintres) : "t" (__x) : "st"); return __llrintres;
}







extern __inline double drem (double __x, double __y) { register double __value; register int __clobbered; __asm __volatile__ ("1:	fprem1\n\t" "fstsw	%%ax\n\t" "sahf\n\t" "jp	1b" : "=t" (__value), "=&a" (__clobbered) : "0" (__x), "u" (__y) : "cc"); return __value; } extern __inline float dremf (float __x, float __y) { register double __value; register int __clobbered; __asm __volatile__ ("1:	fprem1\n\t" "fstsw	%%ax\n\t" "sahf\n\t" "jp	1b" : "=t" (__value), "=&a" (__clobbered) : "0" (__x), "u" (__y) : "cc"); return __value; } extern __inline long double dreml (long double __x, long double __y) { register double __value; register int __clobbered; __asm __volatile__ ("1:	fprem1\n\t" "fstsw	%%ax\n\t" "sahf\n\t" "jp	1b" : "=t" (__value), "=&a" (__clobbered) : "0" (__x), "u" (__y) : "cc"); return __value; }
# 665 "/usr/include/bits/mathinline.h" 3
extern __inline int
__finite (double __x)
{
  return (__extension__
          (((((union { double __d; int __i[2]; }) {__d: __x}).__i[1]
             | 0x800fffffu) + 1) >> 31));
}



extern __inline double __coshm1 (double) ; extern __inline double __coshm1 (double __x) { register long double __exm1 = __expm1l (__fabsl (__x)); return 0.5 * (__exm1 / (__exm1 + 1.0)) * __exm1; } extern __inline float __coshm1f (float) ; extern __inline float __coshm1f (float __x) { register long double __exm1 = __expm1l (__fabsl (__x)); return 0.5 * (__exm1 / (__exm1 + 1.0)) * __exm1; } extern __inline long double __coshm1l (long double) ; extern __inline long double __coshm1l (long double __x) { register long double __exm1 = __expm1l (__fabsl (__x)); return 0.5 * (__exm1 / (__exm1 + 1.0)) * __exm1; }



extern __inline double __acosh1p (double) ; extern __inline double __acosh1p (double __x) { return log1pl (__x + __sqrtl (__x) * __sqrtl (__x + 2.0)); } extern __inline float __acosh1pf (float) ; extern __inline float __acosh1pf (float __x) { return log1pl (__x + __sqrtl (__x) * __sqrtl (__x + 2.0)); } extern __inline long double __acosh1pl (long double) ; extern __inline long double __acosh1pl (long double __x) { return log1pl (__x + __sqrtl (__x) * __sqrtl (__x + 2.0)); }
# 351 "/usr/include/math.h" 2 3
# 411 "/usr/include/math.h" 3

# 31 "common.h" 2
# 95 "common.h"
# 1 "/usr/include/inttypes.h" 1 3
# 28 "/usr/include/inttypes.h" 3
# 1 "/usr/include/stdint.h" 1 3
# 28 "/usr/include/stdint.h" 3
# 1 "/usr/include/bits/wordsize.h" 1 3
# 29 "/usr/include/stdint.h" 2 3
# 49 "/usr/include/stdint.h" 3
typedef unsigned char uint8_t;
typedef unsigned short int uint16_t;

typedef unsigned int uint32_t;





__extension__
typedef unsigned long long int uint64_t;






typedef signed char int_least8_t;
typedef short int int_least16_t;
typedef int int_least32_t;



__extension__
typedef long long int int_least64_t;



typedef unsigned char uint_least8_t;
typedef unsigned short int uint_least16_t;
typedef unsigned int uint_least32_t;



__extension__
typedef unsigned long long int uint_least64_t;






typedef signed char int_fast8_t;





typedef int int_fast16_t;
typedef int int_fast32_t;
__extension__
typedef long long int int_fast64_t;



typedef unsigned char uint_fast8_t;





typedef unsigned int uint_fast16_t;
typedef unsigned int uint_fast32_t;
__extension__
typedef unsigned long long int uint_fast64_t;
# 126 "/usr/include/stdint.h" 3
typedef int intptr_t;


typedef unsigned int uintptr_t;
# 138 "/usr/include/stdint.h" 3
__extension__
typedef long long int intmax_t;
__extension__
typedef unsigned long long int uintmax_t;
# 29 "/usr/include/inttypes.h" 2 3






typedef long int __gwchar_t;
# 274 "/usr/include/inttypes.h" 3

# 288 "/usr/include/inttypes.h" 3
typedef struct
  {
    long long int quot;
    long long int rem;
  } imaxdiv_t;





extern intmax_t imaxabs (intmax_t __n) __attribute__ ((__const__));


extern imaxdiv_t imaxdiv (intmax_t __numer, intmax_t __denom)
      __attribute__ ((__const__));


extern intmax_t strtoimax (__const char *__restrict __nptr,
                           char **__restrict __endptr, int __base) ;


extern uintmax_t strtoumax (__const char *__restrict __nptr,
                            char ** __restrict __endptr, int __base) ;


extern intmax_t wcstoimax (__const __gwchar_t *__restrict __nptr,
                           __gwchar_t **__restrict __endptr, int __base)
     ;


extern uintmax_t wcstoumax (__const __gwchar_t *__restrict __nptr,
                            __gwchar_t ** __restrict __endptr, int __base)
     ;
# 396 "/usr/include/inttypes.h" 3
extern __inline intmax_t
strtoimax (__const char *__restrict nptr, char **__restrict endptr,
           int base)
{
  return __strtoll_internal (nptr, endptr, base, 0);
}
# 414 "/usr/include/inttypes.h" 3
extern __inline uintmax_t
strtoumax (__const char *__restrict nptr, char **__restrict endptr,
           int base)
{
  return __strtoull_internal (nptr, endptr, base, 0);
}



__extension__
extern long long int __wcstoll_internal (__const __gwchar_t *
                                         __restrict __nptr,
                                         __gwchar_t **__restrict __endptr,
                                         int __base, int __group) ;


extern __inline intmax_t
wcstoimax (__const __gwchar_t *__restrict nptr, __gwchar_t **__restrict endptr,
           int base)
{
  return __wcstoll_internal (nptr, endptr, base, 0);
}




__extension__
extern unsigned long long int __wcstoull_internal (__const __gwchar_t *
                                                   __restrict __nptr,
                                                   __gwchar_t **
                                                   __restrict __endptr,
                                                   int __base,
                                                   int __group) ;


extern __inline uintmax_t
wcstoumax (__const __gwchar_t *__restrict nptr, __gwchar_t **__restrict endptr,
           int base)
{
  return __wcstoull_internal (nptr, endptr, base, 0);
}





# 96 "common.h" 2



typedef unsigned short UINT16;
typedef signed short INT16;


typedef unsigned char UINT8;
typedef unsigned int UINT32;
typedef unsigned long long UINT64;
typedef signed char INT8;
typedef signed int INT32;
typedef signed long long INT64;
# 117 "common.h"
# 1 "fastmemcpy.h" 1
# 1 "../libvo/fastmemcpy.h" 1



# 1 "../config.h" 1
# 5 "../libvo/fastmemcpy.h" 2




# 1 "/usr/lib/gcc-lib/i486-suse-linux/3.2/include/stddef.h" 1 3
# 147 "/usr/lib/gcc-lib/i486-suse-linux/3.2/include/stddef.h" 3
typedef int ptrdiff_t;
# 10 "../libvo/fastmemcpy.h" 2

extern void * fast_memcpy(void * to, const void * from, size_t len);
extern void * mem2agpcpy(void * to, const void * from, size_t len);
# 23 "../libvo/fastmemcpy.h"
static inline void * mem2agpcpy_pic(void * dst, void * src, int bytesPerLine, int height, int dstStride, int srcStride)
{
        int i;
        void *retval=dst;

        if(dstStride == srcStride) mem2agpcpy(dst, src, srcStride*height);
        else
        {
                for(i=0; i<height; i++)
                {
                        mem2agpcpy(dst, src, bytesPerLine);
                        src+= srcStride;
                        dst+= dstStride;
                }
        }

        return retval;
}

static inline void * memcpy_pic(void * dst, void * src, int bytesPerLine, int height, int dstStride, int srcStride)
{
        int i;
        void *retval=dst;

        if(dstStride == srcStride) fast_memcpy(dst,src,srcStride*height);
        else
        {
                for(i=0; i<height; i++)
                {
                        fast_memcpy(dst,src,bytesPerLine);
                        src+= srcStride;
                        dst+= dstStride;
                }
        }

        return retval;
}
# 2 "fastmemcpy.h" 2
# 118 "common.h" 2







# 1 "bswap.h" 1
# 9 "bswap.h"
inline static unsigned short ByteSwap16(unsigned short x)
{
  __asm("xchgb %b0,%h0" :
        "=q" (x) :
        "0" (x));
    return x;
}


inline static unsigned int ByteSwap32(unsigned int x)
{

 __asm("bswap	%0":
      "=r" (x) :






      "0" (x));
  return x;
}


inline static unsigned long long int ByteSwap64(unsigned long long int x)
{
  register union { __extension__ uint64_t __ll;
          uint32_t __l[2]; } __x;
  asm("xchgl	%0,%1":
      "=r"(__x.__l[0]),"=r"(__x.__l[1]):
      "0"(ByteSwap32((unsigned long)x)),"1"(ByteSwap32((unsigned long)(x>>32))));
  return __x.__ll;
}
# 126 "common.h" 2
# 139 "common.h"
# 1 "/usr/include/assert.h" 1 3
# 140 "common.h" 2
# 169 "common.h"
static inline int32_t NEG_SSR32( int32_t a, int8_t s){
    asm ("sarl %1, %0\n\t"
         : "+r" (a)
         : "ic" ((uint8_t)(-s))
    );
    return a;
}
static inline uint32_t NEG_USR32(uint32_t a, int8_t s){
    asm ("shrl %1, %0\n\t"
         : "+r" (a)
         : "ic" ((uint8_t)(-s))
    );
    return a;
}







struct PutBitContext;

typedef void (*WriteDataFunc)(void *, UINT8 *, int);

typedef struct PutBitContext {




    UINT32 bit_buf;
    int bit_left;
    UINT8 *buf, *buf_ptr, *buf_end;

    INT64 data_out_size;
} PutBitContext;

void init_put_bits(PutBitContext *s,
                   UINT8 *buffer, int buffer_size,
                   void *opaque,
                   void (*write_data)(void *, UINT8 *, int));

INT64 get_bit_count(PutBitContext *s);
void align_put_bits(PutBitContext *s);
void flush_put_bits(PutBitContext *s);
void put_string(PutBitContext * pbc, char *s);



typedef struct GetBitContext {
    UINT8 *buffer, *buffer_end;

    int index;
# 232 "common.h"
    int size;
} GetBitContext;

static inline int get_bits_count(GetBitContext *s);



typedef struct VLC {
    int bits;
    INT16 (*table)[2];
    int table_size, table_allocated;
} VLC;

typedef struct RL_VLC_ELEM {
    int16_t level;
    int8_t len;
    uint8_t run;
} RL_VLC_ELEM;
# 275 "common.h"
static inline void put_bits(PutBitContext *s, int n, unsigned int value)
{
    unsigned int bit_buf;
    int bit_left;





    ((void) (0));

    bit_buf = s->bit_buf;
    bit_left = s->bit_left;



    if (n < bit_left) {
        bit_buf = (bit_buf<<n) | value;
        bit_left-=n;
    } else {
        bit_buf<<=bit_left;
        bit_buf |= value >> (n - bit_left);
        *(UINT32 *)s->buf_ptr = ByteSwap32(bit_buf);

        s->buf_ptr+=4;
        bit_left+=32 - n;
        bit_buf = value;
    }

    s->bit_buf = bit_buf;
    s->bit_left = bit_left;
}
# 377 "common.h"
static inline uint8_t* pbBufPtr(PutBitContext *s)
{



        return s->buf_ptr;

}
# 469 "common.h"
static inline int get_bits_count(GetBitContext *s){
    return s->index;
}
# 589 "common.h"
static inline unsigned int get_bits(GetBitContext *s, int n){
    register int tmp;
    int re_index= (s)->index; int re_cache= 0;
    re_cache= ByteSwap32((*(UINT32*)(((uint8_t *)(s)->buffer)+(re_index>>3)))) << (re_index&0x07);
    tmp= NEG_USR32(re_cache, n);
    re_index += (n);
    (s)->index= re_index;
    return tmp;
}

static inline unsigned int show_bits(GetBitContext *s, int n){
    register int tmp;
    int re_index= (s)->index; int re_cache= 0;
    re_cache= ByteSwap32((*(UINT32*)(((uint8_t *)(s)->buffer)+(re_index>>3)))) << (re_index&0x07);
    tmp= NEG_USR32(re_cache, n);

    return tmp;
}

static inline void skip_bits(GetBitContext *s, int n){

    int re_index= (s)->index; int re_cache= 0;
    re_cache= ByteSwap32((*(UINT32*)(((uint8_t *)(s)->buffer)+(re_index>>3)))) << (re_index&0x07);
    re_index += (n);
    (s)->index= re_index;
}

static inline unsigned int get_bits1(GetBitContext *s){

    int index= s->index;
    uint8_t result= s->buffer[ index>>3 ];
    result<<= (index&0x07);
    result>>= 8 - 1;
    index++;
    s->index= index;

    return result;



}

static inline unsigned int show_bits1(GetBitContext *s){
    return show_bits(s, 1);
}

static inline void skip_bits1(GetBitContext *s){
    skip_bits(s, 1);
}

void init_get_bits(GetBitContext *s,
                   UINT8 *buffer, int buffer_size);

int check_marker(GetBitContext *s, char *msg);
void align_get_bits(GetBitContext *s);
int init_vlc(VLC *vlc, int nb_bits, int nb_codes,
             const void *bits, int bits_wrap, int bits_size,
             const void *codes, int codes_wrap, int codes_size);
void free_vlc(VLC *vlc);
# 703 "common.h"
static inline int get_vlc(GetBitContext *s, VLC *vlc)
{
    int code;
    INT16 (*table)[2]= vlc->table;

    int re_index= (s)->index; int re_cache= 0;
    re_cache= ByteSwap32((*(UINT32*)(((uint8_t *)(s)->buffer)+(re_index>>3)))) << (re_index&0x07);

    { int n, index, nb_bits; index= NEG_USR32(re_cache, vlc->bits); code = table[index][0]; n = table[index][1]; if(3 > 1 && n < 0){ re_index += (vlc->bits); re_cache= ByteSwap32((*(UINT32*)(((uint8_t *)(s)->buffer)+(re_index>>3)))) << (re_index&0x07); nb_bits = -n; index= NEG_USR32(re_cache, nb_bits) + code; code = table[index][0]; n = table[index][1]; if(3 > 2 && n < 0){ re_index += (nb_bits); re_cache= ByteSwap32((*(UINT32*)(((uint8_t *)(s)->buffer)+(re_index>>3)))) << (re_index&0x07); nb_bits = -n; index= NEG_USR32(re_cache, nb_bits) + code; code = table[index][0]; n = table[index][1]; } } { re_cache <<= (n); re_index += (n); }}

    (s)->index= re_index;
    return code;
}

static __attribute__((always_inline)) inline int get_vlc2(GetBitContext *s, INT16 (*table)[2],
                                  int bits, int max_depth)
{
    int code;

    int re_index= (s)->index; int re_cache= 0;
    re_cache= ByteSwap32((*(UINT32*)(((uint8_t *)(s)->buffer)+(re_index>>3)))) << (re_index&0x07);

    { int n, index, nb_bits; index= NEG_USR32(re_cache, bits); code = table[index][0]; n = table[index][1]; if(max_depth > 1 && n < 0){ re_index += (bits); re_cache= ByteSwap32((*(UINT32*)(((uint8_t *)(s)->buffer)+(re_index>>3)))) << (re_index&0x07); nb_bits = -n; index= NEG_USR32(re_cache, nb_bits) + code; code = table[index][0]; n = table[index][1]; if(max_depth > 2 && n < 0){ re_index += (nb_bits); re_cache= ByteSwap32((*(UINT32*)(((uint8_t *)(s)->buffer)+(re_index>>3)))) << (re_index&0x07); nb_bits = -n; index= NEG_USR32(re_cache, nb_bits) + code; code = table[index][0]; n = table[index][1]; } } { re_cache <<= (n); re_index += (n); }}

    (s)->index= re_index;
    return code;
}
# 758 "common.h"
static inline int av_log2(unsigned int v)
{
    int n;

    n = 0;
    if (v & 0xffff0000) {
        v >>= 16;
        n += 16;
    }
    if (v & 0xff00) {
        v >>= 8;
        n += 8;
    }
    if (v & 0xf0) {
        v >>= 4;
        n += 4;
    }
    if (v & 0xc) {
        v >>= 2;
        n += 2;
    }
    if (v & 0x2) {
        n++;
    }
    return n;
}


static inline int mid_pred(int a, int b, int c)
{
    int vmin, vmax;
    vmax = vmin = a;
    if (b < vmin)
        vmin = b;
    else
        vmax = b;

    if (c < vmin)
        vmin = c;
    else if (c > vmax)
        vmax = c;

    return a + b + c - vmin - vmax;
}

static inline int clip(int a, int amin, int amax)
{
    if (a < amin)
        return amin;
    else if (a > amax)
        return amax;
    else
        return a;
}


extern const UINT8 ff_sqrt_tab[128];

int ff_gcd(int a, int b);

static inline int ff_sqrt(int a)
{
    int ret=0;
    int s;
    int ret_sq=0;

    if(a<128) return ff_sqrt_tab[a];

    for(s=15; s>=0; s--){
        int b= ret_sq + (1<<(s*2)) + (ret<<s)*2;
        if(b<=a){
            ret_sq=b;
            ret+= 1<<s;
        }
    }
    return ret;
}




static inline int ff_get_fourcc(char *s){
    ((void) (0));

    return (s[0]) + (s[1]<<8) + (s[2]<<16) + (s[3]<<24);
}
# 5 "avcodec.h" 2






enum CodecID {
    CODEC_ID_NONE,
    CODEC_ID_MPEG1VIDEO,
    CODEC_ID_H263,
    CODEC_ID_RV10,
    CODEC_ID_MP2,
    CODEC_ID_MP3LAME,
    CODEC_ID_VORBIS,
    CODEC_ID_AC3,
    CODEC_ID_MJPEG,
    CODEC_ID_MPEG4,
    CODEC_ID_RAWVIDEO,
    CODEC_ID_MSMPEG4V1,
    CODEC_ID_MSMPEG4V2,
    CODEC_ID_MSMPEG4V3,
    CODEC_ID_WMV1,
    CODEC_ID_WMV2,
    CODEC_ID_H263P,
    CODEC_ID_H263I,
    CODEC_ID_SVQ1,
    CODEC_ID_DVVIDEO,
    CODEC_ID_DVAUDIO,
    CODEC_ID_WMAV1,
    CODEC_ID_WMAV2,
    CODEC_ID_MACE3,
    CODEC_ID_MACE6,


    CODEC_ID_PCM_S16LE,
    CODEC_ID_PCM_S16BE,
    CODEC_ID_PCM_U16LE,
    CODEC_ID_PCM_U16BE,
    CODEC_ID_PCM_S8,
    CODEC_ID_PCM_U8,
    CODEC_ID_PCM_MULAW,
    CODEC_ID_PCM_ALAW,


    CODEC_ID_ADPCM_IMA_QT,
    CODEC_ID_ADPCM_IMA_WAV,
    CODEC_ID_ADPCM_MS,
};

enum CodecType {
    CODEC_TYPE_UNKNOWN = -1,
    CODEC_TYPE_VIDEO,
    CODEC_TYPE_AUDIO,
};

enum PixelFormat {
    PIX_FMT_ANY = -1,
    PIX_FMT_YUV420P,
    PIX_FMT_YUV422,
    PIX_FMT_RGB24,
    PIX_FMT_BGR24,
    PIX_FMT_YUV422P,
    PIX_FMT_YUV444P,
    PIX_FMT_RGBA32,
    PIX_FMT_BGRA32,
    PIX_FMT_YUV410P,
    PIX_FMT_YUV411P
};


enum SampleFormat {
    SAMPLE_FMT_S16 = 0,
};
# 89 "avcodec.h"
enum Motion_Est_ID {
    ME_ZERO = 1,
    ME_FULL,
    ME_LOG,
    ME_PHODS,
    ME_EPZS,
    ME_X1
};

typedef struct RcOverride{
    int start_frame;
    int end_frame;
    int qscale;
    float quality_factor;
} RcOverride;


extern int motion_estimation_method;


static const int Motion_Est_QTab[] = { ME_ZERO, ME_PHODS, ME_LOG,
                                       ME_X1, ME_EPZS, ME_FULL };
# 152 "avcodec.h"
typedef struct AVCodecContext {





    int bit_rate;







    int bit_rate_tolerance;






    int flags;






    int sub_id;






    int me_method;
# 197 "avcodec.h"
    void *extradata;
    int extradata_size;
# 208 "avcodec.h"
    int frame_rate;





    int width, height;





    int aspect_ratio_info;
# 233 "avcodec.h"
    int gop_size;






    enum PixelFormat pix_fmt;

    int repeat_pict;
# 254 "avcodec.h"
    void (*draw_horiz_band)(struct AVCodecContext *s,
                            UINT8 **src_ptr, int linesize,
                            int y, int width, int height);


    int sample_rate;
    int channels;
    int sample_fmt;


    int frame_size;
    int frame_number;
    int real_pict_num;







    int key_frame;






    int pict_type;
# 294 "avcodec.h"
    int delay;







    uint8_t *mbskip_table;







    int quality;



    float qcompress;
    float qblur;






    int qmin;






    int qmax;






    int max_qdiff;







    int max_b_frames;






    float b_quant_factor;


    int rc_strategy;
    int b_frame_strategy;





    int hurry_up;

    struct AVCodec *codec;

    void *priv_data;



    int rtp_mode;



    int rtp_payload_size;
# 385 "avcodec.h"
    void (*rtp_callback)(void *data, int size, int packet_number);







    int get_psnr;
    float psnr_y;
    float psnr_cb;
    float psnr_cr;


    int mv_bits;
    int header_bits;
    int i_tex_bits;
    int p_tex_bits;
    int i_count;
    int p_count;
    int skip_count;
    int misc_bits;






    int frame_bits;






    void *opaque;

    char codec_name[32];
    enum CodecType codec_type;
    enum CodecID codec_id;
    unsigned int codec_tag;






    int workaround_bugs;
# 446 "avcodec.h"
    int luma_elim_threshold;





    int chroma_elim_threshold;






    int strict_std_compliance;
# 468 "avcodec.h"
    float b_quant_offset;







    int error_resilience;




    int *quant_store;






    int qstride;
# 497 "avcodec.h"
    uint8_t *dr_buffer[3];






    int dr_stride;






    void *dr_opaque_frame;






    int (*get_buffer_callback)(struct AVCodecContext *c, int width, int height, int pict_type);






    int has_b_frames;






    int dr_uvstride;






    int dr_ip_buffer_count;

    int block_align;

    int parse_only;
# 552 "avcodec.h"
    int mpeg_quant;






    char *stats_out;







    char *stats_in;







    float rc_qsquish;

    float rc_qmod_amp;
    int rc_qmod_freq;






    RcOverride *rc_override;
    int rc_override_count;






    char *rc_eq;






    int rc_max_rate;






    int rc_min_rate;






    int rc_buffer_size;
    float rc_buffer_aggressivity;






    float i_quant_factor;
# 631 "avcodec.h"
    float i_quant_offset;






    float rc_initial_cplx;






    int aspected_width;
    int aspected_height;






    int dct_algo;
# 667 "avcodec.h"
    long long int pts;






    float lumi_masking;






    float temporal_cplx_masking;






    float spatial_cplx_masking;






    float p_masking;






    float dark_masking;







    int fourcc;






    int idct_algo;
# 733 "avcodec.h"
    int slice_count;





    int *slice_offset;






    int error_concealment;
# 755 "avcodec.h"
     int8_t *current_qscale_table;





     int8_t *display_qscale_table;






    int force_type;
} AVCodecContext;

typedef struct AVCodec {
    char *name;
    int type;
    int id;
    int priv_data_size;
    int (*init)(AVCodecContext *);
    int (*encode)(AVCodecContext *, UINT8 *buf, int buf_size, void *data);
    int (*close)(AVCodecContext *);
    int (*decode)(AVCodecContext *, void *outdata, int *outdata_size,
                  UINT8 *buf, int buf_size);
    int capabilities;
    struct AVCodec *next;
} AVCodec;





typedef struct AVPicture {
    UINT8 *data[4];
    int linesize[4];
} AVPicture;

extern AVCodec ac3_encoder;
extern AVCodec mp2_encoder;
extern AVCodec mp3lame_encoder;
extern AVCodec oggvorbis_encoder;
extern AVCodec mpeg1video_encoder;
extern AVCodec h263_encoder;
extern AVCodec h263p_encoder;
extern AVCodec rv10_encoder;
extern AVCodec mjpeg_encoder;
extern AVCodec mpeg4_encoder;
extern AVCodec msmpeg4v1_encoder;
extern AVCodec msmpeg4v2_encoder;
extern AVCodec msmpeg4v3_encoder;
extern AVCodec wmv1_encoder;
extern AVCodec wmv2_encoder;

extern AVCodec h263_decoder;
extern AVCodec mpeg4_decoder;
extern AVCodec msmpeg4v1_decoder;
extern AVCodec msmpeg4v2_decoder;
extern AVCodec msmpeg4v3_decoder;
extern AVCodec wmv1_decoder;
extern AVCodec wmv2_decoder;
extern AVCodec mpeg_decoder;
extern AVCodec h263i_decoder;
extern AVCodec rv10_decoder;
extern AVCodec svq1_decoder;
extern AVCodec dvvideo_decoder;
extern AVCodec dvaudio_decoder;
extern AVCodec wmav1_decoder;
extern AVCodec wmav2_decoder;
extern AVCodec mjpeg_decoder;
extern AVCodec mp2_decoder;
extern AVCodec mp3_decoder;
extern AVCodec mace3_decoder;
extern AVCodec mace6_decoder;






extern AVCodec pcm_s16le_decoder; extern AVCodec pcm_s16le_encoder;
extern AVCodec pcm_s16be_decoder; extern AVCodec pcm_s16be_encoder;
extern AVCodec pcm_u16le_decoder; extern AVCodec pcm_u16le_encoder;
extern AVCodec pcm_u16be_decoder; extern AVCodec pcm_u16be_encoder;
extern AVCodec pcm_s8_decoder; extern AVCodec pcm_s8_encoder;
extern AVCodec pcm_u8_decoder; extern AVCodec pcm_u8_encoder;
extern AVCodec pcm_alaw_decoder; extern AVCodec pcm_alaw_encoder;
extern AVCodec pcm_mulaw_decoder; extern AVCodec pcm_mulaw_encoder;



extern AVCodec adpcm_ima_qt_decoder; extern AVCodec adpcm_ima_qt_encoder;
extern AVCodec adpcm_ima_wav_decoder; extern AVCodec adpcm_ima_wav_encoder;
extern AVCodec adpcm_ms_decoder; extern AVCodec adpcm_ms_encoder;




extern AVCodec rawvideo_codec;


extern AVCodec ac3_decoder;



struct ReSampleContext;

typedef struct ReSampleContext ReSampleContext;

ReSampleContext *audio_resample_init(int output_channels, int input_channels,
                                     int output_rate, int input_rate);
int audio_resample(ReSampleContext *s, short *output, short *input, int nb_samples);
void audio_resample_close(ReSampleContext *s);



struct ImgReSampleContext;

typedef struct ImgReSampleContext ImgReSampleContext;

ImgReSampleContext *img_resample_init(int output_width, int output_height,
                                      int input_width, int input_height);

ImgReSampleContext *img_resample_full_init(int owidth, int oheight,
                                      int iwidth, int iheight,
                                      int topBand, int bottomBand,
                                      int leftBand, int rightBand);

void img_resample(ImgReSampleContext *s,
                  AVPicture *output, AVPicture *input);

void img_resample_close(ImgReSampleContext *s);

void avpicture_fill(AVPicture *picture, UINT8 *ptr,
                    int pix_fmt, int width, int height);
int avpicture_get_size(int pix_fmt, int width, int height);


int img_convert(AVPicture *dst, int dst_pix_fmt,
                AVPicture *src, int pix_fmt,
                int width, int height);


int avpicture_deinterlace(AVPicture *dst, AVPicture *src,
                          int pix_fmt, int width, int height);



extern AVCodec *first_avcodec;


unsigned avcodec_version(void);

unsigned avcodec_build(void);
void avcodec_init(void);

void avcodec_set_bit_exact(void);

void register_avcodec(AVCodec *format);
AVCodec *avcodec_find_encoder(enum CodecID id);
AVCodec *avcodec_find_encoder_by_name(const char *name);
AVCodec *avcodec_find_decoder(enum CodecID id);
AVCodec *avcodec_find_decoder_by_name(const char *name);
void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode);

AVCodecContext *avcodec_alloc_context(void);
int avcodec_open(AVCodecContext *avctx, AVCodec *codec);
int avcodec_decode_audio(AVCodecContext *avctx, INT16 *samples,
                         int *frame_size_ptr,
                         UINT8 *buf, int buf_size);
int avcodec_decode_video(AVCodecContext *avctx, AVPicture *picture,
                         int *got_picture_ptr,
                         UINT8 *buf, int buf_size);
int avcodec_parse_frame(AVCodecContext *avctx, UINT8 **pdata,
                        int *data_size_ptr,
                        UINT8 *buf, int buf_size);
int avcodec_encode_audio(AVCodecContext *avctx, UINT8 *buf, int buf_size,
                         const short *samples);
int avcodec_encode_video(AVCodecContext *avctx, UINT8 *buf, int buf_size,
                         const AVPicture *pict);

int avcodec_close(AVCodecContext *avctx);

void avcodec_register_all(void);

void avcodec_flush_buffers(AVCodecContext *avctx);







typedef struct {

    int size;

    int frame_type;
} avc_enc_result_t;





typedef enum {

    AVC_OPEN_BY_NAME = 0xACA000,
    AVC_OPEN_BY_CODEC_ID,
    AVC_OPEN_BY_FOURCC,
    AVC_CLOSE,

    AVC_FLUSH,


    AVC_DECODE,


    AVC_ENCODE,


    AVC_GET_VERSION = 0xACB000,
    AVC_GET_WIDTH,
    AVC_GET_HEIGHT,
    AVC_GET_DELAY,
    AVC_GET_QUANT_TABLE,



    AVC_GET_FRAME_SIZE = 0xABC000,







    AVC_SET_WIDTH = 0xACD000,
    AVC_SET_HEIGHT,


    AVC_SET_FRAME_RATE = 0xACD800,
    AVC_SET_QUALITY,
    AVC_SET_HURRY_UP,


    AVC_SET_SAMPLE_RATE = 0xACE000,
    AVC_SET_CHANNELS,

} avc_cmd_t;
# 1017 "avcodec.h"
int avcodec(void* handle, avc_cmd_t cmd, void* pin, void* pout);


void *av_malloc(int size);
void *av_mallocz(int size);
void av_free(void *ptr);
void __av_freep(void **ptr);
# 20 "utils.c" 2
# 1 "dsputil.h" 1
# 27 "dsputil.h"
typedef short DCTELEM;

void fdct_ifast (DCTELEM *data);
void ff_jpeg_fdct_islow (DCTELEM *data);

void j_rev_dct (DCTELEM *data);

void ff_fdct_mmx(DCTELEM *block);


extern const UINT8 ff_alternate_horizontal_scan[64];
extern const UINT8 ff_alternate_vertical_scan[64];
extern const UINT8 ff_zigzag_direct[64];





extern UINT32 squareTbl[512];
extern UINT8 cropTbl[256 + 2 * 384];

void dsputil_init(void);
# 61 "dsputil.h"
extern void (*get_pixels)(DCTELEM *block , const UINT8 *pixels , int line_size);
extern void (*diff_pixels)(DCTELEM *block , const UINT8 *s1 , const UINT8 *s2 , int stride);
extern void (*put_pixels_clamped)(const DCTELEM *block , UINT8 *pixels , int line_size);
extern void (*add_pixels_clamped)(const DCTELEM *block , UINT8 *pixels , int line_size);
extern void (*ff_gmc1)(UINT8 *dst , UINT8 *src , int srcStride, int h, int x16, int y16, int rounder);
extern void (*ff_gmc )(UINT8 *dst , UINT8 *src , int stride, int h, int ox, int oy,
                  int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, int height);
extern void (*clear_blocks)(DCTELEM *blocks );
extern int (*pix_sum)(UINT8 * pix, int line_size);
extern int (*pix_norm1)(UINT8 * pix, int line_size);



void get_pixels_c(DCTELEM *block, const UINT8 *pixels, int line_size);
void diff_pixels_c(DCTELEM *block, const UINT8 *s1, const UINT8 *s2, int stride);
void put_pixels_clamped_c(const DCTELEM *block, UINT8 *pixels, int line_size);
void add_pixels_clamped_c(const DCTELEM *block, UINT8 *pixels, int line_size);
void clear_blocks_c(DCTELEM *blocks);



typedef void (*op_pixels_func)(UINT8 *block , const UINT8 *pixels , int line_size, int h);
typedef void (*qpel_mc_func)(UINT8 *dst , UINT8 *src , int stride);

extern op_pixels_func put_pixels_tab[2][4];
extern op_pixels_func avg_pixels_tab[2][4];
extern op_pixels_func put_no_rnd_pixels_tab[2][4];
extern op_pixels_func avg_no_rnd_pixels_tab[2][4];
extern qpel_mc_func put_qpel_pixels_tab[2][16];
extern qpel_mc_func avg_qpel_pixels_tab[2][16];
extern qpel_mc_func put_no_rnd_qpel_pixels_tab[2][16];
extern qpel_mc_func avg_no_rnd_qpel_pixels_tab[2][16];
# 102 "dsputil.h"
typedef int (*op_pixels_abs_func)(UINT8 *blk1 , UINT8 *blk2 , int line_size);

extern op_pixels_abs_func pix_abs16x16;
extern op_pixels_abs_func pix_abs16x16_x2;
extern op_pixels_abs_func pix_abs16x16_y2;
extern op_pixels_abs_func pix_abs16x16_xy2;
extern op_pixels_abs_func pix_abs8x8;
extern op_pixels_abs_func pix_abs8x8_x2;
extern op_pixels_abs_func pix_abs8x8_y2;
extern op_pixels_abs_func pix_abs8x8_xy2;

int pix_abs16x16_c(UINT8 *blk1, UINT8 *blk2, int lx);
int pix_abs16x16_x2_c(UINT8 *blk1, UINT8 *blk2, int lx);
int pix_abs16x16_y2_c(UINT8 *blk1, UINT8 *blk2, int lx);
int pix_abs16x16_xy2_c(UINT8 *blk1, UINT8 *blk2, int lx);





void ff_block_permute(INT16 *block, UINT8 *permutation, const UINT8 *scantable, int last);
# 132 "dsputil.h"
extern int mm_flags;

int mm_support(void);

static inline void emms(void)
{
    __asm __volatile ("emms;":::"memory");
}
# 149 "dsputil.h"
void dsputil_init_mmx(void);
void dsputil_set_bit_exact_mmx(void);
# 203 "dsputil.h"
struct unaligned_64 { uint64_t l; } __attribute__((packed));
struct unaligned_32 { uint32_t l; } __attribute__((packed));
# 221 "dsputil.h"
void get_psnr(UINT8 *orig_image[3], UINT8 *coded_image[3],
              int orig_linesize[3], int coded_linesize,
              AVCodecContext *avctx);





typedef float FFTSample;

typedef struct FFTComplex {
    FFTSample re, im;
} FFTComplex;

typedef struct FFTContext {
    int nbits;
    int inverse;
    uint16_t *revtab;
    FFTComplex *exptab;
    FFTComplex *exptab1;
    void (*fft_calc)(struct FFTContext *s, FFTComplex *z);
} FFTContext;

int fft_init(FFTContext *s, int nbits, int inverse);
void fft_permute(FFTContext *s, FFTComplex *z);
void fft_calc_c(FFTContext *s, FFTComplex *z);
void fft_calc_sse(FFTContext *s, FFTComplex *z);
static inline void fft_calc(FFTContext *s, FFTComplex *z)
{
    s->fft_calc(s, z);
}
void fft_end(FFTContext *s);



typedef struct MDCTContext {
    int n;
    int nbits;

    FFTSample *tcos;
    FFTSample *tsin;
    FFTContext fft;
} MDCTContext;

int ff_mdct_init(MDCTContext *s, int nbits, int inverse);
void ff_imdct_calc(MDCTContext *s, FFTSample *output,
                const FFTSample *input, FFTSample *tmp);
void ff_mdct_calc(MDCTContext *s, FFTSample *out,
               const FFTSample *input, FFTSample *tmp);
void ff_mdct_end(MDCTContext *s);





static inline long int lrintf(float x)
{
    return (int)(rint(x));
}
# 21 "utils.c" 2
# 1 "mpegvideo.h" 1
# 25 "mpegvideo.h"
enum OutputFormat {
    FMT_MPEG1,
    FMT_H263,
    FMT_MJPEG,
};
# 48 "mpegvideo.h"
typedef struct Predictor{
    double coeff;
    double count;
    double decay;
} Predictor;

typedef struct RateControlEntry{
    int pict_type;
    float qscale;
    int mv_bits;
    int i_tex_bits;
    int p_tex_bits;
    int misc_bits;
    UINT64 expected_bits;
    int new_pict_type;
    float new_qscale;
    int mc_mb_var_sum;
    int mb_var_sum;
    int i_count;
    int f_code;
    int b_code;
}RateControlEntry;

typedef struct RateControlContext{
    FILE *stats_file;
    int num_entries;
    RateControlEntry *entry;
    int buffer_index;
    Predictor pred[5];
    double short_term_qsum;
    double short_term_qcount;
    double pass1_rc_eq_output_sum;
    double pass1_wanted_bits;
    double last_qscale;
    double last_qscale_for[5];
    int last_mc_mb_var_sum;
    int last_mb_var_sum;
    UINT64 i_cplx_sum[5];
    UINT64 p_cplx_sum[5];
    UINT64 mv_bits_sum[5];
    UINT64 qscale_sum[5];
    int frame_count[5];
    int last_non_b_pict_type;
}RateControlContext;

typedef struct ReorderBuffer{
    UINT8 *picture[3];
    int pict_type;
    int qscale;
    int force_type;
    int picture_number;
    int picture_in_gop_number;
} ReorderBuffer;

typedef struct ScanTable{
    const UINT8 *scantable;
    UINT8 permutated[64];
    UINT8 raster_end[64];




} ScanTable;

typedef struct ParseContext{
    UINT8 *buffer;
    int index;
    int last_index;
    int buffer_size;
    int state;
    int frame_start_found;
} ParseContext;

typedef struct MpegEncContext {
    struct AVCodecContext *avctx;

    int width, height;
    int gop_size;
    int frame_rate;
    int intra_only;
    int bit_rate;
    int bit_rate_tolerance;
    enum OutputFormat out_format;
    int h263_pred;


    int h263_plus;
    int h263_rv10;
    int h263_msmpeg4;
    int h263_intel;

    int codec_id;
    int fixed_qscale;
    float qcompress;
    float qblur;
    int qmin;
    int qmax;
    int max_qdiff;
    int encoding;
    int flags;
    int force_input_type;
    int max_b_frames;
    int b_frame_strategy;
    int luma_elim_threshold;
    int chroma_elim_threshold;
    int strict_std_compliance;
    int workaround_bugs;



    PutBitContext pb;


    int context_initialized;
    int input_picture_number;
    int input_picture_in_gop_number;
    int picture_number;
    int fake_picture_number;
    int gop_picture_number;
    int picture_in_gop_number;
    int b_frames_since_non_b;
    int mb_width, mb_height;
    int h_edge_pos, v_edge_pos;
    int mb_num;
    int linesize;
    int uvlinesize;
    UINT8 *new_picture[3];
    UINT8 *picture_buffer[(4 +2)][3];
    int picture_buffer_index;
    ReorderBuffer coded_order[(4 +2)];
    UINT8 *last_picture[3];
    UINT8 *last_picture_base[3];
    UINT8 *next_picture[3];
    UINT8 *next_picture_base[3];
    UINT8 *aux_picture[3];
    UINT8 *aux_picture_base[3];
    UINT8 *current_picture[3];
    void *last_dr_opaque;
    void *next_dr_opaque;
    int ip_buffer_count;
    int num_available_buffers;
    int last_dc[3];
    INT16 *dc_val[3];
    int y_dc_scale, c_dc_scale;
    UINT8 *y_dc_scale_table;
    UINT8 *c_dc_scale_table;
    UINT8 *coded_block;
    INT16 (*ac_val[3])[16];
    int ac_pred;
    int mb_skiped;
    UINT8 *mbskip_table;

    UINT8 *mbintra_table;
    UINT8 *cbp_table;
    UINT8 *pred_dir_table;
    INT8 *qscale_table;
    INT8 *aux_qscale_table;
    INT8 *next_qscale_table;
    INT8 *last_qscale_table;
    UINT8 *edge_emu_buffer;

    int input_qscale;
    int input_pict_type;
    int force_type;
    int qscale;
    float frame_qscale;
    int adaptive_quant;
    int dquant;
    int pict_type;
    int last_pict_type;
    int last_non_b_pict_type;
    int frame_rate_index;

    int unrestricted_mv;
    int h263_long_vectors;

    int f_code;
    int b_code;
    INT16 (*motion_val)[2];
    INT16 (*p_mv_table)[2];
    INT16 (*b_forw_mv_table)[2];
    INT16 (*b_back_mv_table)[2];
    INT16 (*b_bidir_forw_mv_table)[2];
    INT16 (*b_bidir_back_mv_table)[2];
    INT16 (*b_direct_forw_mv_table)[2];
    INT16 (*b_direct_back_mv_table)[2];
    INT16 (*b_direct_mv_table)[2];
    int me_method;
    uint8_t *me_scratchpad;
    uint32_t *me_map;
    uint16_t *me_score_map;
    int me_map_generation;
    int skip_me;
    int scene_change_score;
    int mv_dir;



    int mv_type;
# 257 "mpegvideo.h"
    int mv[2][4][2];
    int field_select[2][2];
    int last_mv[2][2][2];
    UINT16 (*mv_penalty)[2048*2+1];
    UINT8 *fcode_tab;

    int has_b_frames;
    int no_rounding;


    int hurry_up;



    int mb_x, mb_y;
    int mb_incr;
    int mb_intra;
    UINT16 *mb_var;
    UINT16 *mc_mb_var;
    UINT8 *mb_mean;
    UINT8 *mb_type;
# 289 "mpegvideo.h"
    int block_index[6];
    int block_wrap[6];


    UINT16 intra_matrix[64];
    UINT16 chroma_intra_matrix[64];
    UINT16 inter_matrix[64];
    UINT16 chroma_inter_matrix[64];

    int intra_quant_bias;
    int inter_quant_bias;
    int min_qcoeff;
    int max_qcoeff;

    int __attribute__ ((aligned (8))) q_intra_matrix[32][64];
    int __attribute__ ((aligned (8))) q_inter_matrix[32][64];

    UINT16 __attribute__ ((aligned (8))) q_intra_matrix16[32][64];
    UINT16 __attribute__ ((aligned (8))) q_inter_matrix16[32][64];
    UINT16 __attribute__ ((aligned (8))) q_intra_matrix16_bias[32][64];
    UINT16 __attribute__ ((aligned (8))) q_inter_matrix16_bias[32][64];
    int block_last_index[6];

    ScanTable __attribute__ ((aligned (8))) intra_scantable;
    ScanTable intra_h_scantable;
    ScanTable intra_v_scantable;
    ScanTable inter_scantable;
    UINT8 idct_permutation[64];
    int idct_permutation_type;





    void *opaque;


    int I_frame_bits;
    int mb_var_sum;
    int mc_mb_var_sum;
    INT64 wanted_bits;
    INT64 total_bits;
    int frame_bits;
    RateControlContext rc_context;


    int mv_bits;
    int header_bits;
    int i_tex_bits;
    int p_tex_bits;
    int i_count;
    int f_count;
    int b_count;
    int skip_count;
    int misc_bits;
    int last_bits;


    UINT8 *error_status_table;
# 357 "mpegvideo.h"
    int resync_mb_x;
    int resync_mb_y;
    GetBitContext last_resync_gb;
    int mb_num_left;
    int next_p_frame_damaged;
    int error_resilience;

    ParseContext parse_context;


    int gob_number;
    int gob_index;


    int umvplus;
    int umvplus_dec;
    int h263_aic;
    int h263_aic_dir;


    int time_increment_resolution;
    int time_increment_bits;
    int last_time_base;
    int time_base;
    INT64 time;
    INT64 last_non_b_time;
    UINT16 pp_time;
    UINT16 pb_time;
    UINT16 pp_field_time;
    UINT16 pb_field_time;
    int shape;
    int vol_sprite_usage;
    int sprite_width;
    int sprite_height;
    int sprite_left;
    int sprite_top;
    int sprite_brightness_change;
    int num_sprite_warping_points;
    int real_sprite_warping_points;
    int sprite_offset[2][2];
    int sprite_delta[2][2];
    int sprite_shift[2];
    int mcsel;
    int quant_precision;
    int quarter_sample;
    int scalability;
    int hierachy_type;
    int enhancement_type;
    int new_pred;
    int reduced_res_vop;
    int aspect_ratio_info;
    int aspected_width;
    int aspected_height;
    int sprite_warping_accuracy;
    int low_latency_sprite;
    int data_partitioning;
    int partitioned_frame;
    int rvlc;
    int resync_marker;
    int low_delay;
    int vo_type;
    int vol_control_parameters;
    PutBitContext tex_pb;
    PutBitContext pb2;

    uint8_t *tex_pb_buffer;
    uint8_t *pb2_buffer;
    int mpeg_quant;


    INT8 *co_located_type_table;
    INT16 (*field_mv_table)[2][2];
    INT8 (*field_select_table)[2];
    int t_frame;
    int padding_bug_score;


    int divx_version;
    int divx_build;

    UINT8 *bitstream_buffer;
    int bitstream_buffer_size;

    int xvid_build;


    int ffmpeg_version;
    int lavc_build;


    int rv10_version;
    int rv10_first_dc_coded[3];


    struct MJpegContext *mjpeg_ctx;
    int mjpeg_vsample[3];
    int mjpeg_hsample[3];
    int mjpeg_write_tables;

    int mjpeg_data_only_frames;


    int mv_table_index;
    int rl_table_index;
    int rl_chroma_table_index;
    int dc_table_index;
    int use_skip_mb_code;
    int slice_height;
    int first_slice_line;
    int flipflop_rounding;
    int msmpeg4_version;
    int per_mb_rl_table;
    int esc3_level_length;
    int esc3_run_length;

    int (*ac_stats)[2][64 +1][64 +1][2];
    int inter_intra_pred;


    GetBitContext gb;


    int progressive_sequence;
    int mpeg_f_code[2][2];
    int picture_structure;





    int intra_dc_precision;
    int frame_pred_frame_dct;
    int top_field_first;
    int concealment_motion_vectors;
    int q_scale_type;
    int intra_vlc_format;
    int alternate_scan;
    int repeat_first_field;
    int chroma_420_type;
    int progressive_frame;
    int mpeg2;
    int full_pel[2];
    int interlaced_dct;
    int last_qscale;
    int first_slice;



    int rtp_mode;
    int rtp_payload_size;
    void (*rtp_callback)(void *data, int size, int packet_number);
    UINT8 *ptr_lastgob;
    UINT8 *ptr_last_mb_line;
    UINT32 mb_line_avgsize;

    DCTELEM (*block)[64];
    DCTELEM blocks[2][6][64] __attribute__ ((aligned (8)));
    int (*decode_mb)(struct MpegEncContext *s, DCTELEM block[6][64]);





    void (*dct_unquantize_mpeg1)(struct MpegEncContext *s,
                           DCTELEM *block, int n, int qscale);
    void (*dct_unquantize_mpeg2)(struct MpegEncContext *s,
                           DCTELEM *block, int n, int qscale);
    void (*dct_unquantize_h263)(struct MpegEncContext *s,
                           DCTELEM *block, int n, int qscale);
    void (*dct_unquantize)(struct MpegEncContext *s,
                           DCTELEM *block, int n, int qscale);
    int (*dct_quantize)(struct MpegEncContext *s, DCTELEM *block, int n, int qscale, int *overflow);
    void (*fdct)(DCTELEM *block );
    void (*idct_put)(UINT8 *dest , int line_size, DCTELEM *block );
    void (*idct_add)(UINT8 *dest , int line_size, DCTELEM *block );
} MpegEncContext;


int DCT_common_init(MpegEncContext *s);
int MPV_common_init(MpegEncContext *s);
void MPV_common_end(MpegEncContext *s);
void MPV_decode_mb(MpegEncContext *s, DCTELEM block[6][64]);
int MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx);
void MPV_frame_end(MpegEncContext *s);

void MPV_common_init_mmx(MpegEncContext *s);
# 556 "mpegvideo.h"
extern void (*draw_edges)(UINT8 *buf, int wrap, int width, int height, int w);
void ff_conceal_past_errors(MpegEncContext *s, int conceal_all);
void ff_copy_bits(PutBitContext *pb, UINT8 *src, int length);
void ff_clean_intra_table_entries(MpegEncContext *s);
void ff_init_scantable(MpegEncContext *s, ScanTable *st, const UINT8 *src_scantable);
void ff_error_resilience(MpegEncContext *s);
void ff_draw_horiz_band(MpegEncContext *s);

extern int ff_bit_exact;

static inline void ff_init_block_index(MpegEncContext *s){
    s->block_index[0]= s->block_wrap[0]*(s->mb_y*2 + 1) - 1 + s->mb_x*2;
    s->block_index[1]= s->block_wrap[0]*(s->mb_y*2 + 1) + s->mb_x*2;
    s->block_index[2]= s->block_wrap[0]*(s->mb_y*2 + 2) - 1 + s->mb_x*2;
    s->block_index[3]= s->block_wrap[0]*(s->mb_y*2 + 2) + s->mb_x*2;
    s->block_index[4]= s->block_wrap[4]*(s->mb_y + 1) + s->block_wrap[0]*(s->mb_height*2 + 2) + s->mb_x;
    s->block_index[5]= s->block_wrap[4]*(s->mb_y + 1 + s->mb_height + 2) + s->block_wrap[0]*(s->mb_height*2 + 2) + s->mb_x;
}

static inline void ff_update_block_index(MpegEncContext *s){
    s->block_index[0]+=2;
    s->block_index[1]+=2;
    s->block_index[2]+=2;
    s->block_index[3]+=2;
    s->block_index[4]++;
    s->block_index[5]++;
}



void ff_estimate_p_frame_motion(MpegEncContext * s,
                             int mb_x, int mb_y);
void ff_estimate_b_frame_motion(MpegEncContext * s,
                             int mb_x, int mb_y);
int ff_get_best_fcode(MpegEncContext * s, int16_t (*mv_table)[2], int type);
void ff_fix_long_p_mvs(MpegEncContext * s);
void ff_fix_long_b_mvs(MpegEncContext * s, int16_t (*mv_table)[2], int f_code, int type);



extern const INT16 ff_mpeg1_default_intra_matrix[64];
extern const INT16 ff_mpeg1_default_non_intra_matrix[64];
extern UINT8 ff_mpeg1_dc_scale_table[128];

void mpeg1_encode_picture_header(MpegEncContext *s, int picture_number);
void mpeg1_encode_mb(MpegEncContext *s,
                     DCTELEM block[6][64],
                     int motion_x, int motion_y);
void ff_mpeg1_encode_init(MpegEncContext *s);



typedef struct RLTable {
    int n;
    int last;
    const UINT16 (*table_vlc)[2];
    const INT8 *table_run;
    const INT8 *table_level;
    UINT8 *index_run[2];
    INT8 *max_level[2];
    INT8 *max_run[2];
    VLC vlc;
    RL_VLC_ELEM *rl_vlc[32];
} RLTable;

void init_rl(RLTable *rl);
void init_vlc_rl(RLTable *rl);

static inline int get_rl_index(const RLTable *rl, int last, int run, int level)
{
    int index;
    index = rl->index_run[last][run];
    if (index >= rl->n)
        return rl->n;
    if (level > rl->max_level[last][run])
        return rl->n;
    return index + level - 1;
}

extern UINT8 ff_mpeg4_y_dc_scale_table[32];
extern UINT8 ff_mpeg4_c_dc_scale_table[32];
extern const INT16 ff_mpeg4_default_intra_matrix[64];
extern const INT16 ff_mpeg4_default_non_intra_matrix[64];
void h263_encode_mb(MpegEncContext *s,
                    DCTELEM block[6][64],
                    int motion_x, int motion_y);
void mpeg4_encode_mb(MpegEncContext *s,
                    DCTELEM block[6][64],
                    int motion_x, int motion_y);
void h263_encode_picture_header(MpegEncContext *s, int picture_number);
int h263_encode_gob_header(MpegEncContext * s, int mb_line);
INT16 *h263_pred_motion(MpegEncContext * s, int block,
                        int *px, int *py);
void mpeg4_pred_ac(MpegEncContext * s, INT16 *block, int n,
                   int dir);
void ff_set_mpeg4_time(MpegEncContext * s, int picture_number);
void mpeg4_encode_picture_header(MpegEncContext *s, int picture_number);
void h263_encode_init(MpegEncContext *s);
void h263_decode_init_vlc(MpegEncContext *s);
int h263_decode_picture_header(MpegEncContext *s);
int ff_h263_decode_gob_header(MpegEncContext *s);
int ff_mpeg4_decode_picture_header(MpegEncContext * s, GetBitContext *gb);


int intel_h263_decode_picture_header(MpegEncContext *s);
int ff_h263_decode_mb(MpegEncContext *s,
                      DCTELEM block[6][64]);
int h263_get_picture_format(int width, int height);
void ff_mpeg4_encode_video_packet_header(MpegEncContext *s);
void ff_mpeg4_clean_buffers(MpegEncContext *s);
void ff_mpeg4_stuffing(PutBitContext * pbc);
void ff_mpeg4_init_partitions(MpegEncContext *s);
void ff_mpeg4_merge_partitions(MpegEncContext *s);
void ff_clean_mpeg4_qscales(MpegEncContext *s);
void ff_clean_h263_qscales(MpegEncContext *s);
int ff_mpeg4_decode_partitions(MpegEncContext *s);
int ff_mpeg4_get_video_packet_prefix_length(MpegEncContext *s);
int ff_h263_resync(MpegEncContext *s);
int ff_h263_get_gob_height(MpegEncContext *s);



void rv10_encode_picture_header(MpegEncContext *s, int picture_number);
int rv_decode_dc(MpegEncContext *s, int n);



void msmpeg4_encode_picture_header(MpegEncContext * s, int picture_number);
void msmpeg4_encode_ext_header(MpegEncContext * s);
void msmpeg4_encode_mb(MpegEncContext * s,
                       DCTELEM block[6][64],
                       int motion_x, int motion_y);
int msmpeg4_decode_picture_header(MpegEncContext * s);
int msmpeg4_decode_ext_header(MpegEncContext * s, int buf_size);
int ff_msmpeg4_decode_init(MpegEncContext *s);
void ff_msmpeg4_encode_init(MpegEncContext *s);



int mjpeg_init(MpegEncContext *s);
void mjpeg_close(MpegEncContext *s);
void mjpeg_encode_mb(MpegEncContext *s,
                     DCTELEM block[6][64]);
void mjpeg_picture_header(MpegEncContext *s);
void mjpeg_picture_trailer(MpegEncContext *s);



int ff_rate_control_init(MpegEncContext *s);
float ff_rate_estimate_qscale(MpegEncContext *s);
void ff_write_pass1_stats(MpegEncContext *s);
void ff_rate_control_uninit(MpegEncContext *s);
double ff_eval(char *s, double *const_value, char **const_name,
               double (**func1)(void *, double), char **func1_name,
               double (**func2)(void *, double, double), char **func2_name,
               void *opaque);
# 22 "utils.c" 2

void *av_mallocz(int size)
{
    void *ptr;
    ptr = av_malloc(size);
    if (!ptr)
        return ((void *)0);
    (__extension__ (__builtin_constant_p (size) && (size) <= 16 ? ((size) == 1 ? ({ void *__s = (ptr); *((__uint8_t *) __s) = (__uint8_t) 0; __s; }) : ({ void *__s = (ptr); union { unsigned int __ui; unsigned short int __usi; unsigned char __uc; } *__u = __s; __uint8_t __c = (__uint8_t) (0); switch ((unsigned int) (size)) { case 15: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 11: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 7: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 3: __u->__usi = (unsigned short int) __c * 0x0101; __u = __extension__ ((void *) __u + 2); __u->__uc = (unsigned char) __c; break; case 14: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 10: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 6: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 2: __u->__usi = (unsigned short int) __c * 0x0101; break; case 13: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 9: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 5: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 1: __u->__uc = (unsigned char) __c; break; case 16: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 12: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 8: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 4: __u->__ui = __c * 0x01010101; case 0: break; } __s; })) : (__builtin_constant_p (0) && (0) == '\0' ? ({ void *__s = (ptr); __builtin_memset (__s, '\0', size); __s; }) : memset (ptr, 0, size))));
    return ptr;
}


void __av_freep(void **ptr)
{
    av_free(*ptr);
    *ptr = ((void *)0);
}


AVCodec *first_avcodec;

void register_avcodec(AVCodec *format)
{
    AVCodec **p;
    p = &first_avcodec;
    while (*p != ((void *)0)) p = &(*p)->next;
    *p = format;
    format->next = ((void *)0);
}

void avcodec_get_context_defaults(AVCodecContext *s){
    s->bit_rate= 800*1000;
    s->bit_rate_tolerance= s->bit_rate*10;
    s->qmin= 2;
    s->qmax= 31;
    s->rc_eq= "tex^qComp";
    s->qcompress= 0.5;
    s->max_qdiff= 3;
    s->b_quant_factor=1.25;
    s->b_quant_offset=1.25;
    s->i_quant_factor=-0.8;
    s->i_quant_offset=0.0;
    s->error_concealment= 3;
    s->error_resilience= 1;
    s->workaround_bugs= 1;
    s->frame_rate = 25 * 10000;
    s->gop_size= 50;
    s->me_method= ME_EPZS;
}





AVCodecContext *avcodec_alloc_context(void){
    AVCodecContext *avctx= av_mallocz(sizeof(AVCodecContext));

    if(avctx==((void *)0)) return ((void *)0);

    avcodec_get_context_defaults(avctx);

    return avctx;
}

int avcodec_open(AVCodecContext *avctx, AVCodec *codec)
{
    int ret;

    avctx->codec = codec;
    avctx->frame_number = 0;
    if (codec->priv_data_size > 0) {
        avctx->priv_data = av_mallocz(codec->priv_data_size);
        if (!avctx->priv_data)
            return -12;
    } else {
        avctx->priv_data = ((void *)0);
    }
    ret = avctx->codec->init(avctx);
    if (ret < 0) {
        __av_freep((void **)(&avctx->priv_data));
        return ret;
    }
    return 0;
}

int avcodec_encode_audio(AVCodecContext *avctx, UINT8 *buf, int buf_size,
                         const short *samples)
{
    int ret;

    ret = avctx->codec->encode(avctx, buf, buf_size, (void *)samples);
    avctx->frame_number++;
    return ret;
}

int avcodec_encode_video(AVCodecContext *avctx, UINT8 *buf, int buf_size,
                         const AVPicture *pict)
{
    int ret;

    ret = avctx->codec->encode(avctx, buf, buf_size, (void *)pict);

    { if (mm_flags & 0x0001) emms();};

    avctx->frame_number++;
    return ret;
}




int avcodec_decode_video(AVCodecContext *avctx, AVPicture *picture,
                         int *got_picture_ptr,
                         UINT8 *buf, int buf_size)
{
    int ret;

    ret = avctx->codec->decode(avctx, picture, got_picture_ptr,
                               buf, buf_size);

    { if (mm_flags & 0x0001) emms();};

    if (*got_picture_ptr)
        avctx->frame_number++;
    return ret;
}





int avcodec_decode_audio(AVCodecContext *avctx, INT16 *samples,
                         int *frame_size_ptr,
                         UINT8 *buf, int buf_size)
{
    int ret;

    ret = avctx->codec->decode(avctx, samples, frame_size_ptr,
                               buf, buf_size);
    avctx->frame_number++;
    return ret;
}

int avcodec_close(AVCodecContext *avctx)
{
    if (avctx->codec->close)
        avctx->codec->close(avctx);
    __av_freep((void **)(&avctx->priv_data));
    avctx->codec = ((void *)0);
    return 0;
}

AVCodec *avcodec_find_encoder(enum CodecID id)
{
    AVCodec *p;
    p = first_avcodec;
    while (p) {
        if (p->encode != ((void *)0) && p->id == id)
            return p;
        p = p->next;
    }
    return ((void *)0);
}

AVCodec *avcodec_find_encoder_by_name(const char *name)
{
    AVCodec *p;
    p = first_avcodec;
    while (p) {
        if (p->encode != ((void *)0) && __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (name) && __builtin_constant_p (p->name) && (__s1_len = strlen (name), __s2_len = strlen (p->name), (!((size_t)(const void *)((name) + 1) - (size_t)(const void *)(name) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((p->name) + 1) - (size_t)(const void *)(p->name) == 1) || __s2_len >= 4)) ? memcmp ((__const char *) (name), (__const char *) (p->name), (__s1_len < __s2_len ? __s1_len : __s2_len) + 1) : (__builtin_constant_p (name) && ((size_t)(const void *)((name) + 1) - (size_t)(const void *)(name) == 1) && (__s1_len = strlen (name), __s1_len < 4) ? (__builtin_constant_p (p->name) && ((size_t)(const void *)((p->name) + 1) - (size_t)(const void *)(p->name) == 1) ? (__extension__ ({ register int __result = (((__const unsigned char *) (__const char *) (name))[0] - ((__const unsigned char *) (__const char *)(p->name))[0]); if (__s1_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (name))[1] - ((__const unsigned char *) (__const char *) (p->name))[1]); if (__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (name))[2] - ((__const unsigned char *) (__const char *) (p->name))[2]); if (__s1_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (name))[3] - ((__const unsigned char *) (__const char *) (p->name))[3]); } } __result; })) : (__extension__ ({ __const unsigned char *__s2 = (__const unsigned char *) (__const char *) (p->name); register int __result = (((__const unsigned char *) (__const char *) (name))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (name))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (name))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (name))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p (p->name) && ((size_t)(const void *)((p->name) + 1) - (size_t)(const void *)(p->name) == 1) && (__s2_len = strlen (p->name), __s2_len < 4) ? (__builtin_constant_p (name) && ((size_t)(const void *)((name) + 1) - (size_t)(const void *)(name) == 1) ? (__extension__ ({ register int __result = (((__const unsigned char *) (__const char *) (name))[0] - ((__const unsigned char *) (__const char *)(p->name))[0]); if (__s2_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (name))[1] - ((__const unsigned char *) (__const char *) (p->name))[1]); if (__s2_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (name))[2] - ((__const unsigned char *) (__const char *) (p->name))[2]); if (__s2_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (name))[3] - ((__const unsigned char *) (__const char *) (p->name))[3]); } } __result; })) : (__extension__ ({ __const unsigned char *__s1 = (__const unsigned char *) (__const char *) (name); register int __result = __s1[0] - ((__const unsigned char *) (__const char *) (p->name))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((__const unsigned char *) (__const char *) (p->name))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((__const unsigned char *) (__const char *) (p->name))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((__const unsigned char *) (__const char *) (p->name))[3]); } } __result; }))) : strcmp (name, p->name)))); }) == 0)
            return p;
        p = p->next;
    }
    return ((void *)0);
}

AVCodec *avcodec_find_decoder(enum CodecID id)
{
    AVCodec *p;
    p = first_avcodec;
    while (p) {
        if (p->decode != ((void *)0) && p->id == id)
            return p;
        p = p->next;
    }
    return ((void *)0);
}

AVCodec *avcodec_find_decoder_by_name(const char *name)
{
    AVCodec *p;
    p = first_avcodec;
    while (p) {
        if (p->decode != ((void *)0) && __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (name) && __builtin_constant_p (p->name) && (__s1_len = strlen (name), __s2_len = strlen (p->name), (!((size_t)(const void *)((name) + 1) - (size_t)(const void *)(name) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((p->name) + 1) - (size_t)(const void *)(p->name) == 1) || __s2_len >= 4)) ? memcmp ((__const char *) (name), (__const char *) (p->name), (__s1_len < __s2_len ? __s1_len : __s2_len) + 1) : (__builtin_constant_p (name) && ((size_t)(const void *)((name) + 1) - (size_t)(const void *)(name) == 1) && (__s1_len = strlen (name), __s1_len < 4) ? (__builtin_constant_p (p->name) && ((size_t)(const void *)((p->name) + 1) - (size_t)(const void *)(p->name) == 1) ? (__extension__ ({ register int __result = (((__const unsigned char *) (__const char *) (name))[0] - ((__const unsigned char *) (__const char *)(p->name))[0]); if (__s1_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (name))[1] - ((__const unsigned char *) (__const char *) (p->name))[1]); if (__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (name))[2] - ((__const unsigned char *) (__const char *) (p->name))[2]); if (__s1_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (name))[3] - ((__const unsigned char *) (__const char *) (p->name))[3]); } } __result; })) : (__extension__ ({ __const unsigned char *__s2 = (__const unsigned char *) (__const char *) (p->name); register int __result = (((__const unsigned char *) (__const char *) (name))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (name))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (name))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (name))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p (p->name) && ((size_t)(const void *)((p->name) + 1) - (size_t)(const void *)(p->name) == 1) && (__s2_len = strlen (p->name), __s2_len < 4) ? (__builtin_constant_p (name) && ((size_t)(const void *)((name) + 1) - (size_t)(const void *)(name) == 1) ? (__extension__ ({ register int __result = (((__const unsigned char *) (__const char *) (name))[0] - ((__const unsigned char *) (__const char *)(p->name))[0]); if (__s2_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (name))[1] - ((__const unsigned char *) (__const char *) (p->name))[1]); if (__s2_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (name))[2] - ((__const unsigned char *) (__const char *) (p->name))[2]); if (__s2_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (name))[3] - ((__const unsigned char *) (__const char *) (p->name))[3]); } } __result; })) : (__extension__ ({ __const unsigned char *__s1 = (__const unsigned char *) (__const char *) (name); register int __result = __s1[0] - ((__const unsigned char *) (__const char *) (p->name))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((__const unsigned char *) (__const char *) (p->name))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((__const unsigned char *) (__const char *) (p->name))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((__const unsigned char *) (__const char *) (p->name))[3]); } } __result; }))) : strcmp (name, p->name)))); }) == 0)
            return p;
        p = p->next;
    }
    return ((void *)0);
}

AVCodec *avcodec_find(enum CodecID id)
{
    AVCodec *p;
    p = first_avcodec;
    while (p) {
        if (p->id == id)
            return p;
        p = p->next;
    }
    return ((void *)0);
}

const char *pix_fmt_str[] = {
    "yuv420p",
    "yuv422",
    "rgb24",
    "bgr24",
    "yuv422p",
    "yuv444p",
    "rgba32",
    "bgra32",
    "yuv410p",
    "yuv411p",
};

void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
{
    const char *codec_name;
    AVCodec *p;
    char buf1[32];
    char channels_str[100];
    int bitrate;

    if (encode)
        p = avcodec_find_encoder(enc->codec_id);
    else
        p = avcodec_find_decoder(enc->codec_id);

    if (p) {
        codec_name = p->name;
    } else if (enc->codec_name[0] != '\0') {
        codec_name = enc->codec_name;
    } else {

        if (enc->codec_type == CODEC_TYPE_VIDEO) {
            snprintf(buf1, sizeof(buf1), "%c%c%c%c",
                     enc->codec_tag & 0xff,
                     (enc->codec_tag >> 8) & 0xff,
                     (enc->codec_tag >> 16) & 0xff,
                     (enc->codec_tag >> 24) & 0xff);
        } else {
            snprintf(buf1, sizeof(buf1), "0x%04x", enc->codec_tag);
        }
        codec_name = buf1;
    }

    switch(enc->codec_type) {
    case CODEC_TYPE_VIDEO:
        snprintf(buf, buf_size,
                 "Video: %s%s",
                 codec_name, enc->flags & 0x0001 ? " (hq)" : "");
        if (enc->codec_id == CODEC_ID_RAWVIDEO) {
            snprintf(buf + strlen(buf), buf_size - strlen(buf),
                     ", %s",
                     pix_fmt_str[enc->pix_fmt]);
        }
        if (enc->width) {
            snprintf(buf + strlen(buf), buf_size - strlen(buf),
                     ", %dx%d, %0.2f fps",
                     enc->width, enc->height,
                     (float)enc->frame_rate / 10000);
        }
        if (encode) {
            snprintf(buf + strlen(buf), buf_size - strlen(buf),
                     ", q=%d-%d", enc->qmin, enc->qmax);
        }
        bitrate = enc->bit_rate;
        break;
    case CODEC_TYPE_AUDIO:
        snprintf(buf, buf_size,
                 "Audio: %s",
                 codec_name);
        switch (enc->channels) {
            case 1:
                strcpy(channels_str, "mono");
                break;
            case 2:
                strcpy(channels_str, "stereo");
                break;
            case 6:
                strcpy(channels_str, "5:1");
                break;
            default:
                sprintf(channels_str, "%d channels", enc->channels);
                break;
        }
        if (enc->sample_rate) {
            snprintf(buf + strlen(buf), buf_size - strlen(buf),
                     ", %d Hz, %s",
                     enc->sample_rate,
                     channels_str);
        }


        switch(enc->codec_id) {
        case CODEC_ID_PCM_S16LE:
        case CODEC_ID_PCM_S16BE:
        case CODEC_ID_PCM_U16LE:
        case CODEC_ID_PCM_U16BE:
            bitrate = enc->sample_rate * enc->channels * 16;
            break;
        case CODEC_ID_PCM_S8:
        case CODEC_ID_PCM_U8:
        case CODEC_ID_PCM_ALAW:
        case CODEC_ID_PCM_MULAW:
            bitrate = enc->sample_rate * enc->channels * 8;
            break;
        default:
            bitrate = enc->bit_rate;
            break;
        }
        break;
    default:
        do { fprintf(stderr, "Abort at %s:%d\n", "utils.c", 345); abort(); } while (0);
    }
    if (encode) {
        if (enc->flags & 0x0200)
            snprintf(buf + strlen(buf), buf_size - strlen(buf),
                     ", pass 1");
        if (enc->flags & 0x0400)
            snprintf(buf + strlen(buf), buf_size - strlen(buf),
                     ", pass 2");
    }
    if (bitrate != 0) {
        snprintf(buf + strlen(buf), buf_size - strlen(buf),
                 ", %d kb/s", bitrate / 1000);
    }
}


void avpicture_fill(AVPicture *picture, UINT8 *ptr,
                    int pix_fmt, int width, int height)
{
    int size;

    size = width * height;
    switch(pix_fmt) {
    case PIX_FMT_YUV420P:
        picture->data[0] = ptr;
        picture->data[1] = picture->data[0] + size;
        picture->data[2] = picture->data[1] + size / 4;
        picture->linesize[0] = width;
        picture->linesize[1] = width / 2;
        picture->linesize[2] = width / 2;
        break;
    case PIX_FMT_YUV422P:
        picture->data[0] = ptr;
        picture->data[1] = picture->data[0] + size;
        picture->data[2] = picture->data[1] + size / 2;
        picture->linesize[0] = width;
        picture->linesize[1] = width / 2;
        picture->linesize[2] = width / 2;
        break;
    case PIX_FMT_YUV444P:
        picture->data[0] = ptr;
        picture->data[1] = picture->data[0] + size;
        picture->data[2] = picture->data[1] + size;
        picture->linesize[0] = width;
        picture->linesize[1] = width;
        picture->linesize[2] = width;
        break;
    case PIX_FMT_RGB24:
    case PIX_FMT_BGR24:
        picture->data[0] = ptr;
        picture->data[1] = ((void *)0);
        picture->data[2] = ((void *)0);
        picture->linesize[0] = width * 3;
        break;
    case PIX_FMT_RGBA32:
    case PIX_FMT_BGRA32:
        picture->data[0] = ptr;
        picture->data[1] = ((void *)0);
        picture->data[2] = ((void *)0);
        picture->linesize[0] = width * 4;
        break;
    case PIX_FMT_YUV422:
        picture->data[0] = ptr;
        picture->data[1] = ((void *)0);
        picture->data[2] = ((void *)0);
        picture->linesize[0] = width * 2;
        break;
    default:
        picture->data[0] = ((void *)0);
        picture->data[1] = ((void *)0);
        picture->data[2] = ((void *)0);
        break;
    }
}

int avpicture_get_size(int pix_fmt, int width, int height)
{
    int size;

    size = width * height;
    switch(pix_fmt) {
    case PIX_FMT_YUV420P:
        size = (size * 3) / 2;
        break;
    case PIX_FMT_YUV422P:
        size = (size * 2);
        break;
    case PIX_FMT_YUV444P:
        size = (size * 3);
        break;
    case PIX_FMT_RGB24:
    case PIX_FMT_BGR24:
        size = (size * 3);
        break;
    case PIX_FMT_RGBA32:
    case PIX_FMT_BGRA32:
        size = (size * 4);
        break;
    case PIX_FMT_YUV422:
        size = (size * 2);
        break;
    default:
        size = -1;
        break;
    }
    return size;
}

unsigned avcodec_version( void )
{
  return 0x000406;
}

unsigned avcodec_build( void )
{
  return 4637;
}


void avcodec_init(void)
{
    static int inited = 0;

    if (inited != 0)
        return;
    inited = 1;

    dsputil_init();
}


void avcodec_flush_buffers(AVCodecContext *avctx)
{
    MpegEncContext *s = avctx->priv_data;
    s->num_available_buffers=0;
}


static int raw_encode_init(AVCodecContext *s)
{
    return 0;
}

static int raw_decode_frame(AVCodecContext *avctx,
                            void *data, int *data_size,
                            UINT8 *buf, int buf_size)
{
    return -1;
}

static int raw_encode_frame(AVCodecContext *avctx,
                            unsigned char *frame, int buf_size, void *data)
{
    return -1;
}

AVCodec rawvideo_codec = {
    "rawvideo",
    CODEC_TYPE_VIDEO,
    CODEC_ID_RAWVIDEO,
    0,
    raw_encode_init,
    raw_encode_frame,
    ((void *)0),
    raw_decode_frame,
};
