# 1 "scumm/thumbnail.cpp"
# 1 "/home/tore/scummvm-ice/scummvm-0.8.0//"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "scumm/thumbnail.cpp"
# 23 "scumm/thumbnail.cpp"
# 1 "./common/stdafx.h" 1
# 117 "./common/stdafx.h"
# 1 "/usr/include/sys/types.h" 1 3 4
# 27 "/usr/include/sys/types.h" 3 4
# 1 "/usr/include/features.h" 1 3 4
# 308 "/usr/include/features.h" 3 4
# 1 "/usr/include/sys/cdefs.h" 1 3 4
# 309 "/usr/include/features.h" 2 3 4
# 331 "/usr/include/features.h" 3 4
# 1 "/usr/include/gnu/stubs.h" 1 3 4
# 332 "/usr/include/features.h" 2 3 4
# 28 "/usr/include/sys/types.h" 2 3 4

extern "C" {

# 1 "/usr/include/bits/types.h" 1 3 4
# 28 "/usr/include/bits/types.h" 3 4
# 1 "/usr/include/bits/wordsize.h" 1 3 4
# 29 "/usr/include/bits/types.h" 2 3 4


# 1 "/usr/lib/gcc/mipsel-linux-gnu/4.0.3/include/stddef.h" 1 3 4
# 214 "/usr/lib/gcc/mipsel-linux-gnu/4.0.3/include/stddef.h" 3 4
typedef unsigned int size_t;
# 32 "/usr/include/bits/types.h" 2 3 4


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


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;







__extension__ typedef long long int __quad_t;
__extension__ typedef unsigned long long int __u_quad_t;
# 129 "/usr/include/bits/types.h" 3 4
# 1 "/usr/include/bits/typesizes.h" 1 3 4
# 130 "/usr/include/bits/types.h" 2 3 4






__extension__ typedef __u_quad_t __dev_t;
__extension__ typedef unsigned int __uid_t;
__extension__ typedef unsigned int __gid_t;
__extension__ typedef unsigned long int __ino_t;
__extension__ typedef __u_quad_t __ino64_t;
__extension__ typedef unsigned int __mode_t;
__extension__ typedef unsigned int __nlink_t;
__extension__ typedef long int __off_t;
__extension__ typedef __quad_t __off64_t;
__extension__ typedef int __pid_t;
__extension__ typedef struct { int __val[2]; } __fsid_t;
__extension__ typedef long int __clock_t;
__extension__ typedef unsigned long int __rlim_t;
__extension__ typedef __u_quad_t __rlim64_t;
__extension__ typedef unsigned int __id_t;
__extension__ typedef long int __time_t;
__extension__ typedef unsigned int __useconds_t;
__extension__ typedef long int __suseconds_t;

__extension__ typedef int __daddr_t;
__extension__ typedef long int __swblk_t;
__extension__ typedef int __key_t;


__extension__ typedef int __clockid_t;


__extension__ typedef int __timer_t;


__extension__ typedef long int __blksize_t;




__extension__ typedef long int __blkcnt_t;
__extension__ typedef __quad_t __blkcnt64_t;


__extension__ typedef unsigned long int __fsblkcnt_t;
__extension__ typedef __u_quad_t __fsblkcnt64_t;


__extension__ typedef unsigned long int __fsfilcnt_t;
__extension__ typedef __u_quad_t __fsfilcnt64_t;

__extension__ typedef int __ssize_t;



typedef __off64_t __loff_t;
typedef __quad_t *__qaddr_t;
typedef char *__caddr_t;


__extension__ typedef int __intptr_t;


__extension__ typedef unsigned int __socklen_t;
# 32 "/usr/include/sys/types.h" 2 3 4



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 __ino_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 __off_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;
# 133 "/usr/include/sys/types.h" 3 4
# 1 "/usr/include/time.h" 1 3 4
# 58 "/usr/include/time.h" 3 4


typedef __clock_t clock_t;



# 74 "/usr/include/time.h" 3 4


typedef __time_t time_t;



# 92 "/usr/include/time.h" 3 4
typedef __clockid_t clockid_t;
# 104 "/usr/include/time.h" 3 4
typedef __timer_t timer_t;
# 134 "/usr/include/sys/types.h" 2 3 4



typedef __useconds_t useconds_t;



typedef __suseconds_t suseconds_t;





# 1 "/usr/lib/gcc/mipsel-linux-gnu/4.0.3/include/stddef.h" 1 3 4
# 148 "/usr/include/sys/types.h" 2 3 4



typedef unsigned long int ulong;
typedef unsigned short int ushort;
typedef unsigned int uint;
# 191 "/usr/include/sys/types.h" 3 4
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__)));
# 213 "/usr/include/sys/types.h" 3 4
# 1 "/usr/include/endian.h" 1 3 4
# 37 "/usr/include/endian.h" 3 4
# 1 "/usr/include/bits/endian.h" 1 3 4
# 38 "/usr/include/endian.h" 2 3 4
# 214 "/usr/include/sys/types.h" 2 3 4


# 1 "/usr/include/sys/select.h" 1 3 4
# 31 "/usr/include/sys/select.h" 3 4
# 1 "/usr/include/bits/select.h" 1 3 4
# 32 "/usr/include/sys/select.h" 2 3 4


# 1 "/usr/include/bits/sigset.h" 1 3 4
# 23 "/usr/include/bits/sigset.h" 3 4
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 4



typedef __sigset_t sigset_t;





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

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



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





  } fd_set;






typedef __fd_mask fd_mask;
# 99 "/usr/include/sys/select.h" 3 4
extern "C" {
# 109 "/usr/include/sys/select.h" 3 4
extern int select (int __nfds, fd_set *__restrict __readfds,
     fd_set *__restrict __writefds,
     fd_set *__restrict __exceptfds,
     struct timeval *__restrict __timeout);
# 121 "/usr/include/sys/select.h" 3 4
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);


}
# 217 "/usr/include/sys/types.h" 2 3 4


# 1 "/usr/include/sys/sysmacros.h" 1 3 4
# 29 "/usr/include/sys/sysmacros.h" 3 4
__extension__
extern __inline unsigned int gnu_dev_major (unsigned long long int __dev)
     throw ();
__extension__
extern __inline unsigned int gnu_dev_minor (unsigned long long int __dev)
     throw ();
__extension__
extern __inline unsigned long long int gnu_dev_makedev (unsigned int __major,
       unsigned int __minor)
     throw ();


__extension__ extern __inline unsigned int
gnu_dev_major (unsigned long long int __dev) throw ()
{
  return ((__dev >> 8) & 0xfff) | ((unsigned int) (__dev >> 32) & ~0xfff);
}

__extension__ extern __inline unsigned int
gnu_dev_minor (unsigned long long int __dev) throw ()
{
  return (__dev & 0xff) | ((unsigned int) (__dev >> 12) & ~0xff);
}

__extension__ extern __inline unsigned long long int
gnu_dev_makedev (unsigned int __major, unsigned int __minor) throw ()
{
  return ((__minor & 0xff) | ((__major & 0xfff) << 8)
   | (((unsigned long long int) (__minor & ~0xff)) << 12)
   | (((unsigned long long int) (__major & ~0xfff)) << 32));
}
# 220 "/usr/include/sys/types.h" 2 3 4




typedef __blksize_t blksize_t;






typedef __blkcnt_t blkcnt_t;



typedef __fsblkcnt_t fsblkcnt_t;



typedef __fsfilcnt_t fsfilcnt_t;
# 258 "/usr/include/sys/types.h" 3 4
typedef __blkcnt64_t blkcnt64_t;
typedef __fsblkcnt64_t fsblkcnt64_t;
typedef __fsfilcnt64_t fsfilcnt64_t;





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

typedef int __atomic_lock_t;


struct _pthread_fastlock
{
  long int __status;
  __atomic_lock_t __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;





__extension__ typedef long long __pthread_cond_align_t;




typedef struct
{
  struct _pthread_fastlock __c_lock;
  _pthread_descr __c_waiting;
  char __padding[48 - sizeof (struct _pthread_fastlock)
   - sizeof (_pthread_descr) - sizeof (__pthread_cond_align_t)];
  __pthread_cond_align_t __align;
} 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;
# 267 "/usr/include/sys/types.h" 2 3 4


}
# 118 "./common/stdafx.h" 2

# 1 "/usr/include/sys/uio.h" 1 3 4
# 26 "/usr/include/sys/uio.h" 3 4
extern "C" {


# 1 "/usr/include/bits/uio.h" 1 3 4
# 42 "/usr/include/bits/uio.h" 3 4
struct iovec
  {
    void *iov_base;
    size_t iov_len;
  };
# 30 "/usr/include/sys/uio.h" 2 3 4
# 40 "/usr/include/sys/uio.h" 3 4
extern ssize_t readv (int __fd, __const struct iovec *__iovec, int __count);
# 50 "/usr/include/sys/uio.h" 3 4
extern ssize_t writev (int __fd, __const struct iovec *__iovec, int __count);

}
# 120 "./common/stdafx.h" 2


# 1 "/usr/include/sys/param.h" 1 3 4
# 22 "/usr/include/sys/param.h" 3 4
# 1 "/usr/lib/gcc/mipsel-linux-gnu/4.0.3/include/limits.h" 1 3 4
# 11 "/usr/lib/gcc/mipsel-linux-gnu/4.0.3/include/limits.h" 3 4
# 1 "/usr/lib/gcc/mipsel-linux-gnu/4.0.3/include/syslimits.h" 1 3 4






# 1 "/usr/lib/gcc/mipsel-linux-gnu/4.0.3/include/limits.h" 1 3 4
# 122 "/usr/lib/gcc/mipsel-linux-gnu/4.0.3/include/limits.h" 3 4
# 1 "/usr/include/limits.h" 1 3 4
# 144 "/usr/include/limits.h" 3 4
# 1 "/usr/include/bits/posix1_lim.h" 1 3 4
# 153 "/usr/include/bits/posix1_lim.h" 3 4
# 1 "/usr/include/bits/local_lim.h" 1 3 4
# 36 "/usr/include/bits/local_lim.h" 3 4
# 1 "/usr/include/linux/limits.h" 1 3 4
# 37 "/usr/include/bits/local_lim.h" 2 3 4
# 154 "/usr/include/bits/posix1_lim.h" 2 3 4
# 145 "/usr/include/limits.h" 2 3 4



# 1 "/usr/include/bits/posix2_lim.h" 1 3 4
# 149 "/usr/include/limits.h" 2 3 4



# 1 "/usr/include/bits/xopen_lim.h" 1 3 4
# 34 "/usr/include/bits/xopen_lim.h" 3 4
# 1 "/usr/include/bits/stdio_lim.h" 1 3 4
# 35 "/usr/include/bits/xopen_lim.h" 2 3 4
# 153 "/usr/include/limits.h" 2 3 4
# 123 "/usr/lib/gcc/mipsel-linux-gnu/4.0.3/include/limits.h" 2 3 4
# 8 "/usr/lib/gcc/mipsel-linux-gnu/4.0.3/include/syslimits.h" 2 3 4
# 12 "/usr/lib/gcc/mipsel-linux-gnu/4.0.3/include/limits.h" 2 3 4
# 23 "/usr/include/sys/param.h" 2 3 4

# 1 "/usr/include/linux/param.h" 1 3 4



# 1 "/usr/include/asm/param.h" 1 3 4
# 5 "/usr/include/linux/param.h" 2 3 4
# 25 "/usr/include/sys/param.h" 2 3 4
# 123 "./common/stdafx.h" 2



# 1 "/usr/include/unistd.h" 1 3 4
# 28 "/usr/include/unistd.h" 3 4
extern "C" {
# 171 "/usr/include/unistd.h" 3 4
# 1 "/usr/include/bits/posix_opt.h" 1 3 4
# 172 "/usr/include/unistd.h" 2 3 4



# 1 "/usr/include/bits/environments.h" 1 3 4
# 23 "/usr/include/bits/environments.h" 3 4
# 1 "/usr/include/bits/wordsize.h" 1 3 4
# 24 "/usr/include/bits/environments.h" 2 3 4
# 176 "/usr/include/unistd.h" 2 3 4
# 195 "/usr/include/unistd.h" 3 4
# 1 "/usr/lib/gcc/mipsel-linux-gnu/4.0.3/include/stddef.h" 1 3 4
# 196 "/usr/include/unistd.h" 2 3 4
# 236 "/usr/include/unistd.h" 3 4
typedef __intptr_t intptr_t;






typedef __socklen_t socklen_t;
# 256 "/usr/include/unistd.h" 3 4
extern int access (__const char *__name, int __type) throw () __attribute__ ((__nonnull__ (1)));




extern int euidaccess (__const char *__name, int __type)
     throw () __attribute__ ((__nonnull__ (1)));
# 287 "/usr/include/unistd.h" 3 4
extern __off_t lseek (int __fd, __off_t __offset, int __whence) throw ();
# 298 "/usr/include/unistd.h" 3 4
extern __off64_t lseek64 (int __fd, __off64_t __offset, int __whence) throw ();






extern int close (int __fd);






extern ssize_t read (int __fd, void *__buf, size_t __nbytes);





extern ssize_t write (int __fd, __const void *__buf, size_t __n);
# 328 "/usr/include/unistd.h" 3 4
extern ssize_t pread (int __fd, void *__buf, size_t __nbytes,
        __off_t __offset);






extern ssize_t pwrite (int __fd, __const void *__buf, size_t __n,
         __off_t __offset);
# 356 "/usr/include/unistd.h" 3 4
extern ssize_t pread64 (int __fd, void *__buf, size_t __nbytes,
   __off64_t __offset);


extern ssize_t pwrite64 (int __fd, __const void *__buf, size_t __n,
    __off64_t __offset);







extern int pipe (int __pipedes[2]) throw ();
# 378 "/usr/include/unistd.h" 3 4
extern unsigned int alarm (unsigned int __seconds) throw ();
# 390 "/usr/include/unistd.h" 3 4
extern unsigned int sleep (unsigned int __seconds);






extern __useconds_t ualarm (__useconds_t __value, __useconds_t __interval)
     throw ();






extern int usleep (__useconds_t __useconds);
# 414 "/usr/include/unistd.h" 3 4
extern int pause (void);



extern int chown (__const char *__file, __uid_t __owner, __gid_t __group)
     throw () __attribute__ ((__nonnull__ (1)));



extern int fchown (int __fd, __uid_t __owner, __gid_t __group) throw ();




extern int lchown (__const char *__file, __uid_t __owner, __gid_t __group)
     throw () __attribute__ ((__nonnull__ (1)));




extern int chdir (__const char *__path) throw () __attribute__ ((__nonnull__ (1)));



extern int fchdir (int __fd) throw ();
# 448 "/usr/include/unistd.h" 3 4
extern char *getcwd (char *__buf, size_t __size) throw ();





extern char *get_current_dir_name (void) throw ();






extern char *getwd (char *__buf) throw () __attribute__ ((__nonnull__ (1)));




extern int dup (int __fd) throw ();


extern int dup2 (int __fd, int __fd2) throw ();


extern char **__environ;

extern char **environ;





extern int execve (__const char *__path, char *__const __argv[],
     char *__const __envp[]) throw () __attribute__ ((__nonnull__ (1)));




extern int fexecve (int __fd, char *__const __argv[], char *__const __envp[])
     throw ();




extern int execv (__const char *__path, char *__const __argv[])
     throw () __attribute__ ((__nonnull__ (1)));



extern int execle (__const char *__path, __const char *__arg, ...)
     throw () __attribute__ ((__nonnull__ (1)));



extern int execl (__const char *__path, __const char *__arg, ...)
     throw () __attribute__ ((__nonnull__ (1)));



extern int execvp (__const char *__file, char *__const __argv[])
     throw () __attribute__ ((__nonnull__ (1)));




extern int execlp (__const char *__file, __const char *__arg, ...)
     throw () __attribute__ ((__nonnull__ (1)));




extern int nice (int __inc) throw ();




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





# 1 "/usr/include/bits/confname.h" 1 3 4
# 26 "/usr/include/bits/confname.h" 3 4
enum
  {
    _PC_LINK_MAX,

    _PC_MAX_CANON,

    _PC_MAX_INPUT,

    _PC_NAME_MAX,

    _PC_PATH_MAX,

    _PC_PIPE_BUF,

    _PC_CHOWN_RESTRICTED,

    _PC_NO_TRUNC,

    _PC_VDISABLE,

    _PC_SYNC_IO,

    _PC_ASYNC_IO,

    _PC_PRIO_IO,

    _PC_SOCK_MAXBUF,

    _PC_FILESIZEBITS,

    _PC_REC_INCR_XFER_SIZE,

    _PC_REC_MAX_XFER_SIZE,

    _PC_REC_MIN_XFER_SIZE,

    _PC_REC_XFER_ALIGN,

    _PC_ALLOC_SIZE_MIN,

    _PC_SYMLINK_MAX,

    _PC_2_SYMLINKS

  };


enum
  {
    _SC_ARG_MAX,

    _SC_CHILD_MAX,

    _SC_CLK_TCK,

    _SC_NGROUPS_MAX,

    _SC_OPEN_MAX,

    _SC_STREAM_MAX,

    _SC_TZNAME_MAX,

    _SC_JOB_CONTROL,

    _SC_SAVED_IDS,

    _SC_REALTIME_SIGNALS,

    _SC_PRIORITY_SCHEDULING,

    _SC_TIMERS,

    _SC_ASYNCHRONOUS_IO,

    _SC_PRIORITIZED_IO,

    _SC_SYNCHRONIZED_IO,

    _SC_FSYNC,

    _SC_MAPPED_FILES,

    _SC_MEMLOCK,

    _SC_MEMLOCK_RANGE,

    _SC_MEMORY_PROTECTION,

    _SC_MESSAGE_PASSING,

    _SC_SEMAPHORES,

    _SC_SHARED_MEMORY_OBJECTS,

    _SC_AIO_LISTIO_MAX,

    _SC_AIO_MAX,

    _SC_AIO_PRIO_DELTA_MAX,

    _SC_DELAYTIMER_MAX,

    _SC_MQ_OPEN_MAX,

    _SC_MQ_PRIO_MAX,

    _SC_VERSION,

    _SC_PAGESIZE,


    _SC_RTSIG_MAX,

    _SC_SEM_NSEMS_MAX,

    _SC_SEM_VALUE_MAX,

    _SC_SIGQUEUE_MAX,

    _SC_TIMER_MAX,




    _SC_BC_BASE_MAX,

    _SC_BC_DIM_MAX,

    _SC_BC_SCALE_MAX,

    _SC_BC_STRING_MAX,

    _SC_COLL_WEIGHTS_MAX,

    _SC_EQUIV_CLASS_MAX,

    _SC_EXPR_NEST_MAX,

    _SC_LINE_MAX,

    _SC_RE_DUP_MAX,

    _SC_CHARCLASS_NAME_MAX,


    _SC_2_VERSION,

    _SC_2_C_BIND,

    _SC_2_C_DEV,

    _SC_2_FORT_DEV,

    _SC_2_FORT_RUN,

    _SC_2_SW_DEV,

    _SC_2_LOCALEDEF,


    _SC_PII,

    _SC_PII_XTI,

    _SC_PII_SOCKET,

    _SC_PII_INTERNET,

    _SC_PII_OSI,

    _SC_POLL,

    _SC_SELECT,

    _SC_UIO_MAXIOV,

    _SC_IOV_MAX = _SC_UIO_MAXIOV,

    _SC_PII_INTERNET_STREAM,

    _SC_PII_INTERNET_DGRAM,

    _SC_PII_OSI_COTS,

    _SC_PII_OSI_CLTS,

    _SC_PII_OSI_M,

    _SC_T_IOV_MAX,



    _SC_THREADS,

    _SC_THREAD_SAFE_FUNCTIONS,

    _SC_GETGR_R_SIZE_MAX,

    _SC_GETPW_R_SIZE_MAX,

    _SC_LOGIN_NAME_MAX,

    _SC_TTY_NAME_MAX,

    _SC_THREAD_DESTRUCTOR_ITERATIONS,

    _SC_THREAD_KEYS_MAX,

    _SC_THREAD_STACK_MIN,

    _SC_THREAD_THREADS_MAX,

    _SC_THREAD_ATTR_STACKADDR,

    _SC_THREAD_ATTR_STACKSIZE,

    _SC_THREAD_PRIORITY_SCHEDULING,

    _SC_THREAD_PRIO_INHERIT,

    _SC_THREAD_PRIO_PROTECT,

    _SC_THREAD_PROCESS_SHARED,


    _SC_NPROCESSORS_CONF,

    _SC_NPROCESSORS_ONLN,

    _SC_PHYS_PAGES,

    _SC_AVPHYS_PAGES,

    _SC_ATEXIT_MAX,

    _SC_PASS_MAX,


    _SC_XOPEN_VERSION,

    _SC_XOPEN_XCU_VERSION,

    _SC_XOPEN_UNIX,

    _SC_XOPEN_CRYPT,

    _SC_XOPEN_ENH_I18N,

    _SC_XOPEN_SHM,


    _SC_2_CHAR_TERM,

    _SC_2_C_VERSION,

    _SC_2_UPE,


    _SC_XOPEN_XPG2,

    _SC_XOPEN_XPG3,

    _SC_XOPEN_XPG4,


    _SC_CHAR_BIT,

    _SC_CHAR_MAX,

    _SC_CHAR_MIN,

    _SC_INT_MAX,

    _SC_INT_MIN,

    _SC_LONG_BIT,

    _SC_WORD_BIT,

    _SC_MB_LEN_MAX,

    _SC_NZERO,

    _SC_SSIZE_MAX,

    _SC_SCHAR_MAX,

    _SC_SCHAR_MIN,

    _SC_SHRT_MAX,

    _SC_SHRT_MIN,

    _SC_UCHAR_MAX,

    _SC_UINT_MAX,

    _SC_ULONG_MAX,

    _SC_USHRT_MAX,


    _SC_NL_ARGMAX,

    _SC_NL_LANGMAX,

    _SC_NL_MSGMAX,

    _SC_NL_NMAX,

    _SC_NL_SETMAX,

    _SC_NL_TEXTMAX,


    _SC_XBS5_ILP32_OFF32,

    _SC_XBS5_ILP32_OFFBIG,

    _SC_XBS5_LP64_OFF64,

    _SC_XBS5_LPBIG_OFFBIG,


    _SC_XOPEN_LEGACY,

    _SC_XOPEN_REALTIME,

    _SC_XOPEN_REALTIME_THREADS,


    _SC_ADVISORY_INFO,

    _SC_BARRIERS,

    _SC_BASE,

    _SC_C_LANG_SUPPORT,

    _SC_C_LANG_SUPPORT_R,

    _SC_CLOCK_SELECTION,

    _SC_CPUTIME,

    _SC_THREAD_CPUTIME,

    _SC_DEVICE_IO,

    _SC_DEVICE_SPECIFIC,

    _SC_DEVICE_SPECIFIC_R,

    _SC_FD_MGMT,

    _SC_FIFO,

    _SC_PIPE,

    _SC_FILE_ATTRIBUTES,

    _SC_FILE_LOCKING,

    _SC_FILE_SYSTEM,

    _SC_MONOTONIC_CLOCK,

    _SC_MULTI_PROCESS,

    _SC_SINGLE_PROCESS,

    _SC_NETWORKING,

    _SC_READER_WRITER_LOCKS,

    _SC_SPIN_LOCKS,

    _SC_REGEXP,

    _SC_REGEX_VERSION,

    _SC_SHELL,

    _SC_SIGNALS,

    _SC_SPAWN,

    _SC_SPORADIC_SERVER,

    _SC_THREAD_SPORADIC_SERVER,

    _SC_SYSTEM_DATABASE,

    _SC_SYSTEM_DATABASE_R,

    _SC_TIMEOUTS,

    _SC_TYPED_MEMORY_OBJECTS,

    _SC_USER_GROUPS,

    _SC_USER_GROUPS_R,

    _SC_2_PBS,

    _SC_2_PBS_ACCOUNTING,

    _SC_2_PBS_LOCATE,

    _SC_2_PBS_MESSAGE,

    _SC_2_PBS_TRACK,

    _SC_SYMLOOP_MAX,

    _SC_STREAMS,

    _SC_2_PBS_CHECKPOINT,


    _SC_V6_ILP32_OFF32,

    _SC_V6_ILP32_OFFBIG,

    _SC_V6_LP64_OFF64,

    _SC_V6_LPBIG_OFFBIG,


    _SC_HOST_NAME_MAX,

    _SC_TRACE,

    _SC_TRACE_EVENT_FILTER,

    _SC_TRACE_INHERIT,

    _SC_TRACE_LOG,


    _SC_LEVEL1_ICACHE_SIZE,

    _SC_LEVEL1_ICACHE_ASSOC,

    _SC_LEVEL1_ICACHE_LINESIZE,

    _SC_LEVEL1_DCACHE_SIZE,

    _SC_LEVEL1_DCACHE_ASSOC,

    _SC_LEVEL1_DCACHE_LINESIZE,

    _SC_LEVEL2_CACHE_SIZE,

    _SC_LEVEL2_CACHE_ASSOC,

    _SC_LEVEL2_CACHE_LINESIZE,

    _SC_LEVEL3_CACHE_SIZE,

    _SC_LEVEL3_CACHE_ASSOC,

    _SC_LEVEL3_CACHE_LINESIZE,

    _SC_LEVEL4_CACHE_SIZE,

    _SC_LEVEL4_CACHE_ASSOC,

    _SC_LEVEL4_CACHE_LINESIZE,



    _SC_IPV6 = _SC_LEVEL1_ICACHE_SIZE + 50,

    _SC_RAW_SOCKETS

  };


enum
  {
    _CS_PATH,


    _CS_V6_WIDTH_RESTRICTED_ENVS,


    _CS_GNU_LIBC_VERSION,

    _CS_GNU_LIBPTHREAD_VERSION,


    _CS_LFS_CFLAGS = 1000,

    _CS_LFS_LDFLAGS,

    _CS_LFS_LIBS,

    _CS_LFS_LINTFLAGS,

    _CS_LFS64_CFLAGS,

    _CS_LFS64_LDFLAGS,

    _CS_LFS64_LIBS,

    _CS_LFS64_LINTFLAGS,


    _CS_XBS5_ILP32_OFF32_CFLAGS = 1100,

    _CS_XBS5_ILP32_OFF32_LDFLAGS,

    _CS_XBS5_ILP32_OFF32_LIBS,

    _CS_XBS5_ILP32_OFF32_LINTFLAGS,

    _CS_XBS5_ILP32_OFFBIG_CFLAGS,

    _CS_XBS5_ILP32_OFFBIG_LDFLAGS,

    _CS_XBS5_ILP32_OFFBIG_LIBS,

    _CS_XBS5_ILP32_OFFBIG_LINTFLAGS,

    _CS_XBS5_LP64_OFF64_CFLAGS,

    _CS_XBS5_LP64_OFF64_LDFLAGS,

    _CS_XBS5_LP64_OFF64_LIBS,

    _CS_XBS5_LP64_OFF64_LINTFLAGS,

    _CS_XBS5_LPBIG_OFFBIG_CFLAGS,

    _CS_XBS5_LPBIG_OFFBIG_LDFLAGS,

    _CS_XBS5_LPBIG_OFFBIG_LIBS,

    _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS,


    _CS_POSIX_V6_ILP32_OFF32_CFLAGS,

    _CS_POSIX_V6_ILP32_OFF32_LDFLAGS,

    _CS_POSIX_V6_ILP32_OFF32_LIBS,

    _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS,

    _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS,

    _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS,

    _CS_POSIX_V6_ILP32_OFFBIG_LIBS,

    _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS,

    _CS_POSIX_V6_LP64_OFF64_CFLAGS,

    _CS_POSIX_V6_LP64_OFF64_LDFLAGS,

    _CS_POSIX_V6_LP64_OFF64_LIBS,

    _CS_POSIX_V6_LP64_OFF64_LINTFLAGS,

    _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS,

    _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS,

    _CS_POSIX_V6_LPBIG_OFFBIG_LIBS,

    _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS

  };
# 531 "/usr/include/unistd.h" 2 3 4


extern long int pathconf (__const char *__path, int __name)
     throw () __attribute__ ((__nonnull__ (1)));


extern long int fpathconf (int __fd, int __name) throw ();


extern long int sysconf (int __name) throw () __attribute__ ((__const__));



extern size_t confstr (int __name, char *__buf, size_t __len) throw ();




extern __pid_t getpid (void) throw ();


extern __pid_t getppid (void) throw ();




extern __pid_t getpgrp (void) throw ();
# 567 "/usr/include/unistd.h" 3 4
extern __pid_t __getpgid (__pid_t __pid) throw ();

extern __pid_t getpgid (__pid_t __pid) throw ();






extern int setpgid (__pid_t __pid, __pid_t __pgid) throw ();
# 593 "/usr/include/unistd.h" 3 4
extern int setpgrp (void) throw ();
# 610 "/usr/include/unistd.h" 3 4
extern __pid_t setsid (void) throw ();



extern __pid_t getsid (__pid_t __pid) throw ();



extern __uid_t getuid (void) throw ();


extern __uid_t geteuid (void) throw ();


extern __gid_t getgid (void) throw ();


extern __gid_t getegid (void) throw ();




extern int getgroups (int __size, __gid_t __list[]) throw ();



extern int group_member (__gid_t __gid) throw ();






extern int setuid (__uid_t __uid) throw ();




extern int setreuid (__uid_t __ruid, __uid_t __euid) throw ();




extern int seteuid (__uid_t __uid) throw ();






extern int setgid (__gid_t __gid) throw ();




extern int setregid (__gid_t __rgid, __gid_t __egid) throw ();




extern int setegid (__gid_t __gid) throw ();





extern int getresuid (__uid_t *__euid, __uid_t *__ruid, __uid_t *__suid);



extern int getresgid (__gid_t *__egid, __gid_t *__rgid, __gid_t *__sgid);



extern int setresuid (__uid_t __euid, __uid_t __ruid, __uid_t __suid);



extern int setresgid (__gid_t __egid, __gid_t __rgid, __gid_t __sgid);






extern __pid_t fork (void) throw ();






extern __pid_t vfork (void) throw ();





extern char *ttyname (int __fd) throw ();



extern int ttyname_r (int __fd, char *__buf, size_t __buflen)
     throw () __attribute__ ((__nonnull__ (2)));



extern int isatty (int __fd) throw ();





extern int ttyslot (void) throw ();




extern int link (__const char *__from, __const char *__to)
     throw () __attribute__ ((__nonnull__ (1, 2)));



extern int symlink (__const char *__from, __const char *__to)
     throw () __attribute__ ((__nonnull__ (1, 2)));




extern int readlink (__const char *__restrict __path, char *__restrict __buf,
       size_t __len) throw () __attribute__ ((__nonnull__ (1, 2)));



extern int unlink (__const char *__name) throw () __attribute__ ((__nonnull__ (1)));


extern int rmdir (__const char *__path) throw () __attribute__ ((__nonnull__ (1)));



extern __pid_t tcgetpgrp (int __fd) throw ();


extern int tcsetpgrp (int __fd, __pid_t __pgrp_id) throw ();






extern char *getlogin (void);







extern int getlogin_r (char *__name, size_t __name_len) __attribute__ ((__nonnull__ (1)));




extern int setlogin (__const char *__name) throw () __attribute__ ((__nonnull__ (1)));
# 783 "/usr/include/unistd.h" 3 4
# 1 "/usr/include/getopt.h" 1 3 4
# 50 "/usr/include/getopt.h" 3 4
extern "C" {
# 59 "/usr/include/getopt.h" 3 4
extern char *optarg;
# 73 "/usr/include/getopt.h" 3 4
extern int optind;




extern int opterr;



extern int optopt;
# 152 "/usr/include/getopt.h" 3 4
extern int getopt (int ___argc, char *const *___argv, const char *__shortopts)
       throw ();
# 171 "/usr/include/getopt.h" 3 4
}
# 784 "/usr/include/unistd.h" 2 3 4







extern int gethostname (char *__name, size_t __len) throw () __attribute__ ((__nonnull__ (1)));






extern int sethostname (__const char *__name, size_t __len)
     throw () __attribute__ ((__nonnull__ (1)));



extern int sethostid (long int __id) throw ();





extern int getdomainname (char *__name, size_t __len)
     throw () __attribute__ ((__nonnull__ (1)));
extern int setdomainname (__const char *__name, size_t __len)
     throw () __attribute__ ((__nonnull__ (1)));





extern int vhangup (void) throw ();


extern int revoke (__const char *__file) throw () __attribute__ ((__nonnull__ (1)));







extern int profil (unsigned short int *__sample_buffer, size_t __size,
     size_t __offset, unsigned int __scale)
     throw () __attribute__ ((__nonnull__ (1)));





extern int acct (__const char *__name) throw () __attribute__ ((__nonnull__ (1)));



extern char *getusershell (void) throw ();
extern void endusershell (void) throw ();
extern void setusershell (void) throw ();





extern int daemon (int __nochdir, int __noclose) throw ();






extern int chroot (__const char *__path) throw () __attribute__ ((__nonnull__ (1)));



extern char *getpass (__const char *__prompt) __attribute__ ((__nonnull__ (1)));
# 869 "/usr/include/unistd.h" 3 4
extern int fsync (int __fd);






extern long int gethostid (void);


extern void sync (void) throw ();




extern int getpagesize (void) throw () __attribute__ ((__const__));




extern int getdtablesize (void) throw ();




extern int truncate (__const char *__file, __off_t __length)
     throw () __attribute__ ((__nonnull__ (1)));
# 906 "/usr/include/unistd.h" 3 4
extern int truncate64 (__const char *__file, __off64_t __length)
     throw () __attribute__ ((__nonnull__ (1)));
# 916 "/usr/include/unistd.h" 3 4
extern int ftruncate (int __fd, __off_t __length) throw ();
# 926 "/usr/include/unistd.h" 3 4
extern int ftruncate64 (int __fd, __off64_t __length) throw ();
# 936 "/usr/include/unistd.h" 3 4
extern int brk (void *__addr) throw ();





extern void *sbrk (intptr_t __delta) throw ();
# 957 "/usr/include/unistd.h" 3 4
extern long int syscall (long int __sysno, ...) throw ();
# 980 "/usr/include/unistd.h" 3 4
extern int lockf (int __fd, int __cmd, __off_t __len);
# 990 "/usr/include/unistd.h" 3 4
extern int lockf64 (int __fd, int __cmd, __off64_t __len);
# 1011 "/usr/include/unistd.h" 3 4
extern int fdatasync (int __fildes) throw ();







extern char *crypt (__const char *__key, __const char *__salt)
     throw () __attribute__ ((__nonnull__ (1, 2)));



extern void encrypt (char *__block, int __edflag) throw () __attribute__ ((__nonnull__ (1)));






extern void swab (__const void *__restrict __from, void *__restrict __to,
    ssize_t __n) throw () __attribute__ ((__nonnull__ (1, 2)));







extern char *ctermid (char *__s) throw () __attribute__ ((__nonnull__ (1)));


}
# 127 "./common/stdafx.h" 2




# 1 "/usr/include/stdio.h" 1 3 4
# 30 "/usr/include/stdio.h" 3 4
extern "C" {



# 1 "/usr/lib/gcc/mipsel-linux-gnu/4.0.3/include/stddef.h" 1 3 4
# 35 "/usr/include/stdio.h" 2 3 4
# 44 "/usr/include/stdio.h" 3 4


typedef struct _IO_FILE FILE;





# 62 "/usr/include/stdio.h" 3 4
typedef struct _IO_FILE __FILE;
# 72 "/usr/include/stdio.h" 3 4
# 1 "/usr/include/libio.h" 1 3 4
# 32 "/usr/include/libio.h" 3 4
# 1 "/usr/include/_G_config.h" 1 3 4
# 14 "/usr/include/_G_config.h" 3 4
# 1 "/usr/lib/gcc/mipsel-linux-gnu/4.0.3/include/stddef.h" 1 3 4
# 355 "/usr/lib/gcc/mipsel-linux-gnu/4.0.3/include/stddef.h" 3 4
typedef unsigned int wint_t;
# 15 "/usr/include/_G_config.h" 2 3 4
# 24 "/usr/include/_G_config.h" 3 4
# 1 "/usr/include/wchar.h" 1 3 4
# 48 "/usr/include/wchar.h" 3 4
# 1 "/usr/lib/gcc/mipsel-linux-gnu/4.0.3/include/stddef.h" 1 3 4
# 49 "/usr/include/wchar.h" 2 3 4

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

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 4
# 1 "/usr/include/gconv.h" 1 3 4
# 28 "/usr/include/gconv.h" 3 4
# 1 "/usr/include/wchar.h" 1 3 4
# 48 "/usr/include/wchar.h" 3 4
# 1 "/usr/lib/gcc/mipsel-linux-gnu/4.0.3/include/stddef.h" 1 3 4
# 49 "/usr/include/wchar.h" 2 3 4
# 29 "/usr/include/gconv.h" 2 3 4


# 1 "/usr/lib/gcc/mipsel-linux-gnu/4.0.3/include/stddef.h" 1 3 4
# 32 "/usr/include/gconv.h" 2 3 4





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 wint_t (*__gconv_btowc_fct) (struct __gconv_step *, unsigned char);


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_btowc_fct __btowc_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 4
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 4
# 53 "/usr/include/libio.h" 3 4
# 1 "/usr/lib/gcc/mipsel-linux-gnu/4.0.3/include/stdarg.h" 1 3 4
# 43 "/usr/lib/gcc/mipsel-linux-gnu/4.0.3/include/stdarg.h" 3 4
typedef __builtin_va_list __gnuc_va_list;
# 54 "/usr/include/libio.h" 2 3 4
# 166 "/usr/include/libio.h" 3 4
struct _IO_jump_t; struct _IO_FILE;
# 176 "/usr/include/libio.h" 3 4
typedef void _IO_lock_t;





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



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


enum __codecvt_result
{
  __codecvt_ok,
  __codecvt_partial,
  __codecvt_error,
  __codecvt_noconv
};
# 267 "/usr/include/libio.h" 3 4
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 _flags2;

  __off_t _old_offset;



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



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





  void *__pad1;
  void *__pad2;

  int _mode;

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

};





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_;
# 354 "/usr/include/libio.h" 3 4
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 "C" {


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

extern int _IO_peekc_locked (_IO_FILE *__fp) throw ();





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

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

extern void _IO_free_backup_area (_IO_FILE *) throw ();
# 532 "/usr/include/libio.h" 3 4
}
# 73 "/usr/include/stdio.h" 2 3 4




typedef __gnuc_va_list va_list;
# 86 "/usr/include/stdio.h" 3 4


typedef _G_fpos_t fpos_t;





typedef _G_fpos64_t fpos64_t;
# 138 "/usr/include/stdio.h" 3 4
# 1 "/usr/include/bits/stdio_lim.h" 1 3 4
# 139 "/usr/include/stdio.h" 2 3 4



extern struct _IO_FILE *stdin;
extern struct _IO_FILE *stdout;
extern struct _IO_FILE *stderr;







extern int remove (__const char *__filename) throw ();

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









extern FILE *tmpfile (void);
# 174 "/usr/include/stdio.h" 3 4
extern FILE *tmpfile64 (void);



extern char *tmpnam (char *__s) throw ();





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








extern int fclose (FILE *__stream);




extern int fflush (FILE *__stream);

# 221 "/usr/include/stdio.h" 3 4
extern int fflush_unlocked (FILE *__stream);
# 231 "/usr/include/stdio.h" 3 4
extern int fcloseall (void);









extern FILE *fopen (__const char *__restrict __filename,
      __const char *__restrict __modes);




extern FILE *freopen (__const char *__restrict __filename,
        __const char *__restrict __modes,
        FILE *__restrict __stream);
# 262 "/usr/include/stdio.h" 3 4


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) throw ();





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


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




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






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



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





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


extern void setlinebuf (FILE *__stream) throw ();








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, ...) throw ();





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) throw ();





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

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






extern int vasprintf (char **__restrict __ptr, __const char *__restrict __f,
        __gnuc_va_list __arg)
     throw () __attribute__ ((__format__ (__printf__, 2, 0)));
extern int __asprintf (char **__restrict __ptr,
         __const char *__restrict __fmt, ...)
     throw () __attribute__ ((__format__ (__printf__, 2, 3)));
extern int asprintf (char **__restrict __ptr,
       __const char *__restrict __fmt, ...)
     throw () __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, ...) throw ();








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)
     throw () __attribute__ ((__format__ (__scanf__, 2, 0)));









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





extern int getchar (void);

# 454 "/usr/include/stdio.h" 3 4
extern int getc_unlocked (FILE *__stream);
extern int getchar_unlocked (void);
# 465 "/usr/include/stdio.h" 3 4
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);

# 498 "/usr/include/stdio.h" 3 4
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 *gets (char *__s);

# 543 "/usr/include/stdio.h" 3 4
extern char *fgets_unlocked (char *__restrict __s, int __n,
        FILE *__restrict __stream);
# 559 "/usr/include/stdio.h" 3 4
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 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);

# 620 "/usr/include/stdio.h" 3 4
extern int fputs_unlocked (__const char *__restrict __s,
      FILE *__restrict __stream);
# 631 "/usr/include/stdio.h" 3 4
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);

# 667 "/usr/include/stdio.h" 3 4
extern int fseeko (FILE *__stream, __off_t __off, int __whence);




extern __off_t ftello (FILE *__stream);
# 686 "/usr/include/stdio.h" 3 4






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




extern int fsetpos (FILE *__stream, __const fpos_t *__pos);
# 709 "/usr/include/stdio.h" 3 4



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) throw ();

extern int feof (FILE *__stream) throw ();

extern int ferror (FILE *__stream) throw ();




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








extern void perror (__const char *__s);






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


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




extern int fileno (FILE *__stream) throw ();




extern int fileno_unlocked (FILE *__stream) throw ();
# 767 "/usr/include/stdio.h" 3 4
extern FILE *popen (__const char *__command, __const char *__modes);





extern int pclose (FILE *__stream);





extern char *ctermid (char *__s) throw ();





extern char *cuserid (char *__s);




struct obstack;


extern int obstack_printf (struct obstack *__restrict __obstack,
      __const char *__restrict __format, ...)
     throw () __attribute__ ((__format__ (__printf__, 2, 3)));
extern int obstack_vprintf (struct obstack *__restrict __obstack,
       __const char *__restrict __format,
       __gnuc_va_list __args)
     throw () __attribute__ ((__format__ (__printf__, 2, 0)));







extern void flockfile (FILE *__stream) throw ();



extern int ftrylockfile (FILE *__stream) throw ();


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


inline int
getchar (void)
{
  return _IO_getc (stdin);
}




inline int
getc_unlocked (FILE *__fp)
{
  return (__builtin_expect ((__fp)->_IO_read_ptr >= (__fp)->_IO_read_end, 0) ? __uflow (__fp) : *(unsigned char *) (__fp)->_IO_read_ptr++);
}


inline int
getchar_unlocked (void)
{
  return (__builtin_expect ((stdin)->_IO_read_ptr >= (stdin)->_IO_read_end, 0) ? __uflow (stdin) : *(unsigned char *) (stdin)->_IO_read_ptr++);
}




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




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





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


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





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





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


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





}
# 132 "./common/stdafx.h" 2
# 1 "/usr/include/fcntl.h" 1 3 4
# 29 "/usr/include/fcntl.h" 3 4
extern "C" {



# 1 "/usr/include/bits/fcntl.h" 1 3 4
# 25 "/usr/include/bits/fcntl.h" 3 4
# 1 "/usr/include/sgidefs.h" 1 3 4
# 26 "/usr/include/bits/fcntl.h" 2 3 4
# 140 "/usr/include/bits/fcntl.h" 3 4
typedef struct flock
  {
    short int l_type;
    short int l_whence;

    __off_t l_start;
    __off_t l_len;



    long int l_sysid;





    __pid_t l_pid;



    long int pad[4];

} flock_t;


struct flock64
  {
    short int l_type;
    short int l_whence;
    __off64_t l_start;
    __off64_t l_len;
    __pid_t l_pid;
  };
# 34 "/usr/include/fcntl.h" 2 3 4



# 1 "/usr/include/sys/stat.h" 1 3 4
# 37 "/usr/include/sys/stat.h" 3 4
# 1 "/usr/include/time.h" 1 3 4
# 38 "/usr/include/sys/stat.h" 2 3 4
# 103 "/usr/include/sys/stat.h" 3 4
extern "C" {

# 1 "/usr/include/bits/stat.h" 1 3 4
# 41 "/usr/include/bits/stat.h" 3 4
struct stat
  {
    unsigned long int st_dev;
    long int st_pad1[3];

    __ino_t st_ino;



    __mode_t st_mode;
    __nlink_t st_nlink;
    __uid_t st_uid;
    __gid_t st_gid;
    unsigned long int st_rdev;

    long int st_pad2[2];
    __off_t st_size;

    long int st_pad3;
# 68 "/usr/include/bits/stat.h" 3 4
    __time_t st_atime;
    long int __reserved0;
    __time_t st_mtime;
    long int __reserved1;
    __time_t st_ctime;
    long int __reserved2;
    __blksize_t st_blksize;

    __blkcnt_t st_blocks;




    long int st_pad5[14];
  };


struct stat64
  {
    unsigned long int st_dev;
    long int st_pad1[3];
    __ino64_t st_ino;
    __mode_t st_mode;
    __nlink_t st_nlink;
    __uid_t st_uid;
    __gid_t st_gid;
    unsigned long int st_rdev;
    long int st_pad2[3];
    __off64_t st_size;




    __time_t st_atime;
    long int __reserved0;
    __time_t st_mtime;
    long int __reserved1;
    __time_t st_ctime;
    long int __reserved2;
    __blksize_t st_blksize;
    long int st_pad3;
    __blkcnt64_t st_blocks;
    long int st_pad4[14];
  };
# 106 "/usr/include/sys/stat.h" 2 3 4
# 207 "/usr/include/sys/stat.h" 3 4
extern int stat (__const char *__restrict __file,
   struct stat *__restrict __buf) throw () __attribute__ ((__nonnull__ (1, 2)));



extern int fstat (int __fd, struct stat *__buf) throw () __attribute__ ((__nonnull__ (2)));
# 226 "/usr/include/sys/stat.h" 3 4
extern int stat64 (__const char *__restrict __file,
     struct stat64 *__restrict __buf) throw () __attribute__ ((__nonnull__ (1, 2)));
extern int fstat64 (int __fd, struct stat64 *__buf) throw () __attribute__ ((__nonnull__ (2)));






extern int lstat (__const char *__restrict __file,
    struct stat *__restrict __buf) throw () __attribute__ ((__nonnull__ (1, 2)));
# 248 "/usr/include/sys/stat.h" 3 4
extern int lstat64 (__const char *__restrict __file,
      struct stat64 *__restrict __buf)
     throw () __attribute__ ((__nonnull__ (1, 2)));





extern int chmod (__const char *__file, __mode_t __mode)
     throw () __attribute__ ((__nonnull__ (1)));





extern int lchmod (__const char *__file, __mode_t __mode)
     throw () __attribute__ ((__nonnull__ (1)));




extern int fchmod (int __fd, __mode_t __mode) throw ();





extern __mode_t umask (__mode_t __mask) throw ();




extern __mode_t getumask (void) throw ();



extern int mkdir (__const char *__path, __mode_t __mode)
     throw () __attribute__ ((__nonnull__ (1)));





extern int mknod (__const char *__path, __mode_t __mode, __dev_t __dev)
     throw () __attribute__ ((__nonnull__ (1)));




extern int mkfifo (__const char *__path, __mode_t __mode)
     throw () __attribute__ ((__nonnull__ (1)));
# 324 "/usr/include/sys/stat.h" 3 4
extern int __fxstat (int __ver, int __fildes, struct stat *__stat_buf)
     throw () __attribute__ ((__nonnull__ (3)));
extern int __xstat (int __ver, __const char *__filename,
      struct stat *__stat_buf) throw () __attribute__ ((__nonnull__ (2, 3)));
extern int __lxstat (int __ver, __const char *__filename,
       struct stat *__stat_buf) throw () __attribute__ ((__nonnull__ (2, 3)));
# 350 "/usr/include/sys/stat.h" 3 4
extern int __fxstat64 (int __ver, int __fildes, struct stat64 *__stat_buf)
     throw () __attribute__ ((__nonnull__ (3)));
extern int __xstat64 (int __ver, __const char *__filename,
        struct stat64 *__stat_buf) throw () __attribute__ ((__nonnull__ (2, 3)));
extern int __lxstat64 (int __ver, __const char *__filename,
         struct stat64 *__stat_buf) throw () __attribute__ ((__nonnull__ (2, 3)));

extern int __xmknod (int __ver, __const char *__path, __mode_t __mode,
       __dev_t *__dev) throw () __attribute__ ((__nonnull__ (2, 4)));




extern __inline__ int
stat (__const char *__path, struct stat *__statbuf) throw ()
{
  return __xstat (3, __path, __statbuf);
}


extern __inline__ int
lstat (__const char *__path, struct stat *__statbuf) throw ()
{
  return __lxstat (3, __path, __statbuf);
}


extern __inline__ int
fstat (int __fd, struct stat *__statbuf) throw ()
{
  return __fxstat (3, __fd, __statbuf);
}


extern __inline__ int
mknod (__const char *__path, __mode_t __mode, __dev_t __dev) throw ()
{
  return __xmknod (1, __path, __mode, &__dev);
}





extern __inline__ int
stat64 (__const char *__path, struct stat64 *__statbuf) throw ()
{
  return __xstat64 (3, __path, __statbuf);
}


extern __inline__ int
lstat64 (__const char *__path, struct stat64 *__statbuf) throw ()
{
  return __lxstat64 (3, __path, __statbuf);
}


extern __inline__ int
fstat64 (int __fd, struct stat64 *__statbuf) throw ()
{
  return __fxstat64 (3, __fd, __statbuf);
}




}
# 38 "/usr/include/fcntl.h" 2 3 4
# 63 "/usr/include/fcntl.h" 3 4
extern int fcntl (int __fd, int __cmd, ...);
# 72 "/usr/include/fcntl.h" 3 4
extern int open (__const char *__file, int __oflag, ...) __attribute__ ((__nonnull__ (1)));
# 82 "/usr/include/fcntl.h" 3 4
extern int open64 (__const char *__file, int __oflag, ...) __attribute__ ((__nonnull__ (1)));
# 91 "/usr/include/fcntl.h" 3 4
extern int creat (__const char *__file, __mode_t __mode) __attribute__ ((__nonnull__ (1)));
# 101 "/usr/include/fcntl.h" 3 4
extern int creat64 (__const char *__file, __mode_t __mode) __attribute__ ((__nonnull__ (1)));
# 137 "/usr/include/fcntl.h" 3 4
extern int posix_fadvise (int __fd, __off_t __offset, __off_t __len,
     int __advise) throw ();
# 149 "/usr/include/fcntl.h" 3 4
extern int posix_fadvise64 (int __fd, __off64_t __offset, __off64_t __len,
       int __advise) throw ();
# 159 "/usr/include/fcntl.h" 3 4
extern int posix_fallocate (int __fd, __off_t __offset, __off_t __len);
# 170 "/usr/include/fcntl.h" 3 4
extern int posix_fallocate64 (int __fd, __off64_t __offset, __off64_t __len);



}
# 133 "./common/stdafx.h" 2
# 1 "/usr/include/stdlib.h" 1 3 4
# 33 "/usr/include/stdlib.h" 3 4
# 1 "/usr/lib/gcc/mipsel-linux-gnu/4.0.3/include/stddef.h" 1 3 4
# 34 "/usr/include/stdlib.h" 2 3 4

extern "C" {






# 1 "/usr/include/bits/waitflags.h" 1 3 4
# 43 "/usr/include/stdlib.h" 2 3 4
# 1 "/usr/include/bits/waitstatus.h" 1 3 4
# 67 "/usr/include/bits/waitstatus.h" 3 4
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 4
# 96 "/usr/include/stdlib.h" 3 4


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;


# 140 "/usr/include/stdlib.h" 3 4
extern size_t __ctype_get_mb_cur_max (void) throw ();




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

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

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





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





extern double strtod (__const char *__restrict __nptr,
        char **__restrict __endptr) throw () __attribute__ ((__nonnull__ (1)));





extern float strtof (__const char *__restrict __nptr,
       char **__restrict __endptr) throw () __attribute__ ((__nonnull__ (1)));

extern long double strtold (__const char *__restrict __nptr,
       char **__restrict __endptr)
     throw () __attribute__ ((__nonnull__ (1)));





extern long int strtol (__const char *__restrict __nptr,
   char **__restrict __endptr, int __base)
     throw () __attribute__ ((__nonnull__ (1)));

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




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

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





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

__extension__
extern unsigned long long int strtoull (__const char *__restrict __nptr,
     char **__restrict __endptr, int __base)
     throw () __attribute__ ((__nonnull__ (1)));

# 235 "/usr/include/stdlib.h" 3 4
# 1 "/usr/include/xlocale.h" 1 3 4
# 28 "/usr/include/xlocale.h" 3 4
typedef struct __locale_struct
{

  struct locale_data *__locales[13];


  const unsigned short int *__ctype_b;
  const int *__ctype_tolower;
  const int *__ctype_toupper;


  const char *__names[13];
} *__locale_t;
# 236 "/usr/include/stdlib.h" 2 3 4



extern long int strtol_l (__const char *__restrict __nptr,
     char **__restrict __endptr, int __base,
     __locale_t __loc) throw () __attribute__ ((__nonnull__ (1, 4)));

extern unsigned long int strtoul_l (__const char *__restrict __nptr,
        char **__restrict __endptr,
        int __base, __locale_t __loc)
     throw () __attribute__ ((__nonnull__ (1, 4)));

__extension__
extern long long int strtoll_l (__const char *__restrict __nptr,
    char **__restrict __endptr, int __base,
    __locale_t __loc)
     throw () __attribute__ ((__nonnull__ (1, 4)));

__extension__
extern unsigned long long int strtoull_l (__const char *__restrict __nptr,
       char **__restrict __endptr,
       int __base, __locale_t __loc)
     throw () __attribute__ ((__nonnull__ (1, 4)));

extern double strtod_l (__const char *__restrict __nptr,
   char **__restrict __endptr, __locale_t __loc)
     throw () __attribute__ ((__nonnull__ (1, 3)));

extern float strtof_l (__const char *__restrict __nptr,
         char **__restrict __endptr, __locale_t __loc)
     throw () __attribute__ ((__nonnull__ (1, 3)));

extern long double strtold_l (__const char *__restrict __nptr,
         char **__restrict __endptr,
         __locale_t __loc) throw () __attribute__ ((__nonnull__ (1, 3)));






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

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



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




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



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








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

{
  return __strtol_internal (__nptr, __endptr, __base, 0);
}
extern __inline unsigned long int
strtoul (__const char *__restrict __nptr, char **__restrict __endptr, int __base) throw ()

{
  return __strtoul_internal (__nptr, __endptr, __base, 0);
}




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




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

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

{
  return __strtoull_internal (__nptr, __endptr, __base, 0);
}




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

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

{
  return __strtoull_internal (__nptr, __endptr, __base, 0);
}




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




__extension__ extern __inline long long int
atoll (__const char *__nptr) throw ()
{
  return strtoll (__nptr, (char **) __null, 10);
}

# 424 "/usr/include/stdlib.h" 3 4
extern char *l64a (long int __n) throw ();


extern long int a64l (__const char *__s)
     throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
# 440 "/usr/include/stdlib.h" 3 4
extern long int random (void) throw ();


extern void srandom (unsigned int __seed) throw ();





extern char *initstate (unsigned int __seed, char *__statebuf,
   size_t __statelen) throw () __attribute__ ((__nonnull__ (2)));



extern char *setstate (char *__statebuf) throw () __attribute__ ((__nonnull__ (1)));







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) throw () __attribute__ ((__nonnull__ (1, 2)));

extern int srandom_r (unsigned int __seed, struct random_data *__buf)
     throw () __attribute__ ((__nonnull__ (2)));

extern int initstate_r (unsigned int __seed, char *__restrict __statebuf,
   size_t __statelen,
   struct random_data *__restrict __buf)
     throw () __attribute__ ((__nonnull__ (2, 4)));

extern int setstate_r (char *__restrict __statebuf,
         struct random_data *__restrict __buf)
     throw () __attribute__ ((__nonnull__ (1, 2)));






extern int rand (void) throw ();

extern void srand (unsigned int __seed) throw ();




extern int rand_r (unsigned int *__seed) throw ();







extern double drand48 (void) throw ();
extern double erand48 (unsigned short int __xsubi[3]) throw () __attribute__ ((__nonnull__ (1)));


extern long int lrand48 (void) throw ();
extern long int nrand48 (unsigned short int __xsubi[3])
     throw () __attribute__ ((__nonnull__ (1)));


extern long int mrand48 (void) throw ();
extern long int jrand48 (unsigned short int __xsubi[3])
     throw () __attribute__ ((__nonnull__ (1)));


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





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) throw () __attribute__ ((__nonnull__ (1, 2)));
extern int erand48_r (unsigned short int __xsubi[3],
        struct drand48_data *__restrict __buffer,
        double *__restrict __result) throw () __attribute__ ((__nonnull__ (1, 2)));


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


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


extern int srand48_r (long int __seedval, struct drand48_data *__buffer)
     throw () __attribute__ ((__nonnull__ (2)));

extern int seed48_r (unsigned short int __seed16v[3],
       struct drand48_data *__buffer) throw () __attribute__ ((__nonnull__ (1, 2)));

extern int lcong48_r (unsigned short int __param[7],
        struct drand48_data *__buffer)
     throw () __attribute__ ((__nonnull__ (1, 2)));









extern void *malloc (size_t __size) throw () __attribute__ ((__malloc__));

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







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

extern void free (void *__ptr) throw ();




extern void cfree (void *__ptr) throw ();



# 1 "/usr/include/alloca.h" 1 3 4
# 25 "/usr/include/alloca.h" 3 4
# 1 "/usr/lib/gcc/mipsel-linux-gnu/4.0.3/include/stddef.h" 1 3 4
# 26 "/usr/include/alloca.h" 2 3 4

extern "C" {





extern void *alloca (size_t __size) throw ();





}
# 607 "/usr/include/stdlib.h" 2 3 4




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




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




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



extern int atexit (void (*__func) (void)) throw () __attribute__ ((__nonnull__ (1)));





extern int on_exit (void (*__func) (int __status, void *__arg), void *__arg)
     throw () __attribute__ ((__nonnull__ (1)));






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






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






extern char *getenv (__const char *__name) throw () __attribute__ ((__nonnull__ (1)));




extern char *__secure_getenv (__const char *__name) throw () __attribute__ ((__nonnull__ (1)));





extern int putenv (char *__string) throw () __attribute__ ((__nonnull__ (1)));





extern int setenv (__const char *__name, __const char *__value, int __replace)
     throw () __attribute__ ((__nonnull__ (2)));


extern int unsetenv (__const char *__name) throw ();






extern int clearenv (void) throw ();
# 691 "/usr/include/stdlib.h" 3 4
extern char *mktemp (char *__template) throw () __attribute__ ((__nonnull__ (1)));
# 702 "/usr/include/stdlib.h" 3 4
extern int mkstemp (char *__template) __attribute__ ((__nonnull__ (1)));
# 711 "/usr/include/stdlib.h" 3 4
extern int mkstemp64 (char *__template) __attribute__ ((__nonnull__ (1)));
# 721 "/usr/include/stdlib.h" 3 4
extern char *mkdtemp (char *__template) throw () __attribute__ ((__nonnull__ (1)));








extern int system (__const char *__command);







extern char *canonicalize_file_name (__const char *__name)
     throw () __attribute__ ((__nonnull__ (1)));
# 749 "/usr/include/stdlib.h" 3 4
extern char *realpath (__const char *__restrict __name,
         char *__restrict __resolved) throw ();






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)
     __attribute__ ((__nonnull__ (1, 2, 5)));



extern void qsort (void *__base, size_t __nmemb, size_t __size,
     __compar_fn_t __compar) __attribute__ ((__nonnull__ (1, 4)));



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



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







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




__extension__ extern lldiv_t lldiv (long long int __numer,
        long long int __denom)
     throw () __attribute__ ((__const__));

# 814 "/usr/include/stdlib.h" 3 4
extern char *ecvt (double __value, int __ndigit, int *__restrict __decpt,
     int *__restrict __sign) throw () __attribute__ ((__nonnull__ (3, 4)));




extern char *fcvt (double __value, int __ndigit, int *__restrict __decpt,
     int *__restrict __sign) throw () __attribute__ ((__nonnull__ (3, 4)));




extern char *gcvt (double __value, int __ndigit, char *__buf)
     throw () __attribute__ ((__nonnull__ (3)));




extern char *qecvt (long double __value, int __ndigit,
      int *__restrict __decpt, int *__restrict __sign)
     throw () __attribute__ ((__nonnull__ (3, 4)));
extern char *qfcvt (long double __value, int __ndigit,
      int *__restrict __decpt, int *__restrict __sign)
     throw () __attribute__ ((__nonnull__ (3, 4)));
extern char *qgcvt (long double __value, int __ndigit, char *__buf)
     throw () __attribute__ ((__nonnull__ (3)));




extern int ecvt_r (double __value, int __ndigit, int *__restrict __decpt,
     int *__restrict __sign, char *__restrict __buf,
     size_t __len) throw () __attribute__ ((__nonnull__ (3, 4, 5)));
extern int fcvt_r (double __value, int __ndigit, int *__restrict __decpt,
     int *__restrict __sign, char *__restrict __buf,
     size_t __len) throw () __attribute__ ((__nonnull__ (3, 4, 5)));

extern int qecvt_r (long double __value, int __ndigit,
      int *__restrict __decpt, int *__restrict __sign,
      char *__restrict __buf, size_t __len)
     throw () __attribute__ ((__nonnull__ (3, 4, 5)));
extern int qfcvt_r (long double __value, int __ndigit,
      int *__restrict __decpt, int *__restrict __sign,
      char *__restrict __buf, size_t __len)
     throw () __attribute__ ((__nonnull__ (3, 4, 5)));







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


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


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



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

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








extern int rpmatch (__const char *__response) throw () __attribute__ ((__nonnull__ (1)));
# 902 "/usr/include/stdlib.h" 3 4
extern int getsubopt (char **__restrict __optionp,
        char *__const *__restrict __tokens,
        char **__restrict __valuep)
     throw () __attribute__ ((__nonnull__ (1, 2, 3)));





extern void setkey (__const char *__key) throw () __attribute__ ((__nonnull__ (1)));







extern int posix_openpt (int __oflag);







extern int grantpt (int __fd) throw ();



extern int unlockpt (int __fd) throw ();




extern char *ptsname (int __fd) throw ();






extern int ptsname_r (int __fd, char *__buf, size_t __buflen)
     throw () __attribute__ ((__nonnull__ (2)));


extern int getpt (void);






extern int getloadavg (double __loadavg[], int __nelem)
     throw () __attribute__ ((__nonnull__ (1)));





}
# 134 "./common/stdafx.h" 2
# 1 "/usr/include/string.h" 1 3 4
# 28 "/usr/include/string.h" 3 4
extern "C" {




# 1 "/usr/lib/gcc/mipsel-linux-gnu/4.0.3/include/stddef.h" 1 3 4
# 34 "/usr/include/string.h" 2 3 4




extern void *memcpy (void *__restrict __dest,
       __const void *__restrict __src, size_t __n)
     throw () __attribute__ ((__nonnull__ (1, 2)));


extern void *memmove (void *__dest, __const void *__src, size_t __n)
     throw () __attribute__ ((__nonnull__ (1, 2)));






extern void *memccpy (void *__restrict __dest, __const void *__restrict __src,
        int __c, size_t __n)
     throw () __attribute__ ((__nonnull__ (1, 2)));





extern void *memset (void *__s, int __c, size_t __n) throw () __attribute__ ((__nonnull__ (1)));


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


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





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


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





extern char *strcpy (char *__restrict __dest, __const char *__restrict __src)
     throw () __attribute__ ((__nonnull__ (1, 2)));

extern char *strncpy (char *__restrict __dest,
        __const char *__restrict __src, size_t __n)
     throw () __attribute__ ((__nonnull__ (1, 2)));


extern char *strcat (char *__restrict __dest, __const char *__restrict __src)
     throw () __attribute__ ((__nonnull__ (1, 2)));

extern char *strncat (char *__restrict __dest, __const char *__restrict __src,
        size_t __n) throw () __attribute__ ((__nonnull__ (1, 2)));


extern int strcmp (__const char *__s1, __const char *__s2)
     throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));

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


extern int strcoll (__const char *__s1, __const char *__s2)
     throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));

extern size_t strxfrm (char *__restrict __dest,
         __const char *__restrict __src, size_t __n)
     throw () __attribute__ ((__nonnull__ (2)));

# 121 "/usr/include/string.h" 3 4
extern int strcoll_l (__const char *__s1, __const char *__s2, __locale_t __l)
     throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2, 3)));

extern size_t strxfrm_l (char *__dest, __const char *__src, size_t __n,
    __locale_t __l) throw () __attribute__ ((__nonnull__ (2, 4)));




extern char *strdup (__const char *__s)
     throw () __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1)));






extern char *strndup (__const char *__string, size_t __n)
     throw () __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1)));
# 165 "/usr/include/string.h" 3 4


extern char *strchr (__const char *__s, int __c)
     throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));

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





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





extern size_t strcspn (__const char *__s, __const char *__reject)
     throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));


extern size_t strspn (__const char *__s, __const char *__accept)
     throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));

extern char *strpbrk (__const char *__s, __const char *__accept)
     throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));

extern char *strstr (__const char *__haystack, __const char *__needle)
     throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));



extern char *strtok (char *__restrict __s, __const char *__restrict __delim)
     throw () __attribute__ ((__nonnull__ (2)));




extern char *__strtok_r (char *__restrict __s,
    __const char *__restrict __delim,
    char **__restrict __save_ptr)
     throw () __attribute__ ((__nonnull__ (2, 3)));

extern char *strtok_r (char *__restrict __s, __const char *__restrict __delim,
         char **__restrict __save_ptr)
     throw () __attribute__ ((__nonnull__ (2, 3)));




extern char *strcasestr (__const char *__haystack, __const char *__needle)
     throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));






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



extern void *__mempcpy (void *__restrict __dest,
   __const void *__restrict __src, size_t __n)
     throw () __attribute__ ((__nonnull__ (1, 2)));
extern void *mempcpy (void *__restrict __dest,
        __const void *__restrict __src, size_t __n)
     throw () __attribute__ ((__nonnull__ (1, 2)));





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





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





extern char *strerror (int __errnum) throw ();

# 281 "/usr/include/string.h" 3 4
extern char *strerror_r (int __errnum, char *__buf, size_t __buflen)
     throw () __attribute__ ((__nonnull__ (2)));





extern void __bzero (void *__s, size_t __n) throw () __attribute__ ((__nonnull__ (1)));



extern void bcopy (__const void *__src, void *__dest, size_t __n)
     throw () __attribute__ ((__nonnull__ (1, 2)));


extern void bzero (void *__s, size_t __n) throw () __attribute__ ((__nonnull__ (1)));


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


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


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



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




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

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




extern int strcasecmp (__const char *__s1, __const char *__s2)
     throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));


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





extern int strcasecmp_l (__const char *__s1, __const char *__s2,
    __locale_t __loc)
     throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2, 3)));

extern int strncasecmp_l (__const char *__s1, __const char *__s2,
     size_t __n, __locale_t __loc)
     throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2, 4)));





extern char *strsep (char **__restrict __stringp,
       __const char *__restrict __delim)
     throw () __attribute__ ((__nonnull__ (1, 2)));




extern int strverscmp (__const char *__s1, __const char *__s2)
     throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));


extern char *strsignal (int __sig) throw ();


extern char *__stpcpy (char *__restrict __dest, __const char *__restrict __src)
     throw () __attribute__ ((__nonnull__ (1, 2)));
extern char *stpcpy (char *__restrict __dest, __const char *__restrict __src)
     throw () __attribute__ ((__nonnull__ (1, 2)));



extern char *__stpncpy (char *__restrict __dest,
   __const char *__restrict __src, size_t __n)
     throw () __attribute__ ((__nonnull__ (1, 2)));
extern char *stpncpy (char *__restrict __dest,
        __const char *__restrict __src, size_t __n)
     throw () __attribute__ ((__nonnull__ (1, 2)));


extern char *strfry (char *__string) throw () __attribute__ ((__nonnull__ (1)));


extern void *memfrob (void *__s, size_t __n) throw () __attribute__ ((__nonnull__ (1)));






extern char *basename (__const char *__filename) throw () __attribute__ ((__nonnull__ (1)));
# 426 "/usr/include/string.h" 3 4
}
# 135 "./common/stdafx.h" 2
# 1 "/usr/lib/gcc/mipsel-linux-gnu/4.0.3/include/stdarg.h" 1 3 4
# 136 "./common/stdafx.h" 2
# 1 "/usr/include/assert.h" 1 3 4
# 67 "/usr/include/assert.h" 3 4
extern "C" {


extern void __assert_fail (__const char *__assertion, __const char *__file,
      unsigned int __line, __const char *__function)
     throw () __attribute__ ((__noreturn__));


extern void __assert_perror_fail (int __errnum, __const char *__file,
      unsigned int __line,
      __const char *__function)
     throw () __attribute__ ((__noreturn__));




extern void __assert (const char *__assertion, const char *__file, int __line)
     throw () __attribute__ ((__noreturn__));


}
# 137 "./common/stdafx.h" 2
# 1 "/usr/include/ctype.h" 1 3 4
# 30 "/usr/include/ctype.h" 3 4
extern "C" {
# 48 "/usr/include/ctype.h" 3 4
enum
{
  _ISupper = ((0) < 8 ? ((1 << (0)) << 8) : ((1 << (0)) >> 8)),
  _ISlower = ((1) < 8 ? ((1 << (1)) << 8) : ((1 << (1)) >> 8)),
  _ISalpha = ((2) < 8 ? ((1 << (2)) << 8) : ((1 << (2)) >> 8)),
  _ISdigit = ((3) < 8 ? ((1 << (3)) << 8) : ((1 << (3)) >> 8)),
  _ISxdigit = ((4) < 8 ? ((1 << (4)) << 8) : ((1 << (4)) >> 8)),
  _ISspace = ((5) < 8 ? ((1 << (5)) << 8) : ((1 << (5)) >> 8)),
  _ISprint = ((6) < 8 ? ((1 << (6)) << 8) : ((1 << (6)) >> 8)),
  _ISgraph = ((7) < 8 ? ((1 << (7)) << 8) : ((1 << (7)) >> 8)),
  _ISblank = ((8) < 8 ? ((1 << (8)) << 8) : ((1 << (8)) >> 8)),
  _IScntrl = ((9) < 8 ? ((1 << (9)) << 8) : ((1 << (9)) >> 8)),
  _ISpunct = ((10) < 8 ? ((1 << (10)) << 8) : ((1 << (10)) >> 8)),
  _ISalnum = ((11) < 8 ? ((1 << (11)) << 8) : ((1 << (11)) >> 8))
};
# 81 "/usr/include/ctype.h" 3 4
extern __const unsigned short int **__ctype_b_loc (void)
     __attribute__ ((__const));
extern __const __int32_t **__ctype_tolower_loc (void)
     __attribute__ ((__const));
extern __const __int32_t **__ctype_toupper_loc (void)
     __attribute__ ((__const));
# 96 "/usr/include/ctype.h" 3 4






extern int isalnum (int) throw ();
extern int isalpha (int) throw ();
extern int iscntrl (int) throw ();
extern int isdigit (int) throw ();
extern int islower (int) throw ();
extern int isgraph (int) throw ();
extern int isprint (int) throw ();
extern int ispunct (int) throw ();
extern int isspace (int) throw ();
extern int isupper (int) throw ();
extern int isxdigit (int) throw ();



extern int tolower (int __c) throw ();


extern int toupper (int __c) throw ();








extern int isblank (int) throw ();






extern int isctype (int __c, int __mask) throw ();






extern int isascii (int __c) throw ();



extern int toascii (int __c) throw ();



extern int _toupper (int) throw ();
extern int _tolower (int) throw ();
# 247 "/usr/include/ctype.h" 3 4
extern int isalnum_l (int, __locale_t) throw ();
extern int isalpha_l (int, __locale_t) throw ();
extern int iscntrl_l (int, __locale_t) throw ();
extern int isdigit_l (int, __locale_t) throw ();
extern int islower_l (int, __locale_t) throw ();
extern int isgraph_l (int, __locale_t) throw ();
extern int isprint_l (int, __locale_t) throw ();
extern int ispunct_l (int, __locale_t) throw ();
extern int isspace_l (int, __locale_t) throw ();
extern int isupper_l (int, __locale_t) throw ();
extern int isxdigit_l (int, __locale_t) throw ();

extern int isblank_l (int, __locale_t) throw ();



extern int __tolower_l (int __c, __locale_t __l) throw ();
extern int tolower_l (int __c, __locale_t __l) throw ();


extern int __toupper_l (int __c, __locale_t __l) throw ();
extern int toupper_l (int __c, __locale_t __l) throw ();
# 323 "/usr/include/ctype.h" 3 4
}
# 138 "./common/stdafx.h" 2
# 1 "/usr/include/time.h" 1 3 4
# 30 "/usr/include/time.h" 3 4
extern "C" {







# 1 "/usr/lib/gcc/mipsel-linux-gnu/4.0.3/include/stddef.h" 1 3 4
# 39 "/usr/include/time.h" 2 3 4



# 1 "/usr/include/bits/time.h" 1 3 4
# 43 "/usr/include/time.h" 2 3 4
# 129 "/usr/include/time.h" 3 4


struct tm
{
  int tm_sec;
  int tm_min;
  int tm_hour;
  int tm_mday;
  int tm_mon;
  int tm_year;
  int tm_wday;
  int tm_yday;
  int tm_isdst;


  long int tm_gmtoff;
  __const char *tm_zone;




};








struct itimerspec
  {
    struct timespec it_interval;
    struct timespec it_value;
  };


struct sigevent;
# 178 "/usr/include/time.h" 3 4



extern clock_t clock (void) throw ();


extern time_t time (time_t *__timer) throw ();


extern double difftime (time_t __time1, time_t __time0)
     throw () __attribute__ ((__const__));


extern time_t mktime (struct tm *__tp) throw ();





extern size_t strftime (char *__restrict __s, size_t __maxsize,
   __const char *__restrict __format,
   __const struct tm *__restrict __tp) throw ();





extern char *strptime (__const char *__restrict __s,
         __const char *__restrict __fmt, struct tm *__tp)
     throw ();







extern size_t strftime_l (char *__restrict __s, size_t __maxsize,
     __const char *__restrict __format,
     __const struct tm *__restrict __tp,
     __locale_t __loc) throw ();

extern char *strptime_l (__const char *__restrict __s,
    __const char *__restrict __fmt, struct tm *__tp,
    __locale_t __loc) throw ();






extern struct tm *gmtime (__const time_t *__timer) throw ();



extern struct tm *localtime (__const time_t *__timer) throw ();





extern struct tm *gmtime_r (__const time_t *__restrict __timer,
       struct tm *__restrict __tp) throw ();



extern struct tm *localtime_r (__const time_t *__restrict __timer,
          struct tm *__restrict __tp) throw ();





extern char *asctime (__const struct tm *__tp) throw ();


extern char *ctime (__const time_t *__timer) throw ();







extern char *asctime_r (__const struct tm *__restrict __tp,
   char *__restrict __buf) throw ();


extern char *ctime_r (__const time_t *__restrict __timer,
        char *__restrict __buf) throw ();




extern char *__tzname[2];
extern int __daylight;
extern long int __timezone;




extern char *tzname[2];



extern void tzset (void) throw ();



extern int daylight;
extern long int timezone;





extern int stime (__const time_t *__when) throw ();
# 309 "/usr/include/time.h" 3 4
extern time_t timegm (struct tm *__tp) throw ();


extern time_t timelocal (struct tm *__tp) throw ();


extern int dysize (int __year) throw () __attribute__ ((__const__));
# 324 "/usr/include/time.h" 3 4
extern int nanosleep (__const struct timespec *__requested_time,
        struct timespec *__remaining);



extern int clock_getres (clockid_t __clock_id, struct timespec *__res) throw ();


extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) throw ();


extern int clock_settime (clockid_t __clock_id, __const struct timespec *__tp)
     throw ();






extern int clock_nanosleep (clockid_t __clock_id, int __flags,
       __const struct timespec *__req,
       struct timespec *__rem);


extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) throw ();




extern int timer_create (clockid_t __clock_id,
    struct sigevent *__restrict __evp,
    timer_t *__restrict __timerid) throw ();


extern int timer_delete (timer_t __timerid) throw ();


extern int timer_settime (timer_t __timerid, int __flags,
     __const struct itimerspec *__restrict __value,
     struct itimerspec *__restrict __ovalue) throw ();


extern int timer_gettime (timer_t __timerid, struct itimerspec *__value)
     throw ();


extern int timer_getoverrun (timer_t __timerid) throw ();
# 386 "/usr/include/time.h" 3 4
extern int getdate_err;
# 395 "/usr/include/time.h" 3 4
extern struct tm *getdate (__const char *__string);
# 409 "/usr/include/time.h" 3 4
extern int getdate_r (__const char *__restrict __string,
        struct tm *__restrict __resbufp);


}
# 139 "./common/stdafx.h" 2
# 1 "/usr/include/math.h" 1 3 4
# 29 "/usr/include/math.h" 3 4
extern "C" {



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

# 1 "/usr/include/bits/huge_valf.h" 1 3 4
# 36 "/usr/include/math.h" 2 3 4
# 1 "/usr/include/bits/huge_vall.h" 1 3 4
# 37 "/usr/include/math.h" 2 3 4


# 1 "/usr/include/bits/inf.h" 1 3 4
# 40 "/usr/include/math.h" 2 3 4


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



# 1 "/usr/include/bits/mathdef.h" 1 3 4
# 31 "/usr/include/bits/mathdef.h" 3 4
typedef double float_t;

typedef double double_t;
# 47 "/usr/include/math.h" 2 3 4
# 70 "/usr/include/math.h" 3 4
# 1 "/usr/include/bits/mathcalls.h" 1 3 4
# 53 "/usr/include/bits/mathcalls.h" 3 4


extern double acos (double __x) throw (); extern double __acos (double __x) throw ();

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

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

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


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

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

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




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

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

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




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






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

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

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







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


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


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


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


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


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




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

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





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


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


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






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


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








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


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





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






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








extern double ceil (double __x) throw () __attribute__ ((__const__)); extern double __ceil (double __x) throw () __attribute__ ((__const__));


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


extern double floor (double __x) throw () __attribute__ ((__const__)); extern double __floor (double __x) throw () __attribute__ ((__const__));


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




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


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





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


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


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



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





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






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





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



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


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






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






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





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






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







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


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

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



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



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



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




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



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



extern double round (double __x) throw () __attribute__ ((__const__)); extern double __round (double __x) throw () __attribute__ ((__const__));



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




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






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



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



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


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


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



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


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



extern double fma (double __x, double __y, double __z) throw (); extern double __fma (double __x, double __y, double __z) throw ();




extern double scalb (double __x, double __n) throw (); extern double __scalb (double __x, double __n) throw ();
# 71 "/usr/include/math.h" 2 3 4
# 93 "/usr/include/math.h" 3 4
# 1 "/usr/include/bits/mathcalls.h" 1 3 4
# 53 "/usr/include/bits/mathcalls.h" 3 4


extern float acosf (float __x) throw (); extern float __acosf (float __x) throw ();

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

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

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


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

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

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




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

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

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




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






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

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

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







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


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


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


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


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


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




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

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





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


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


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






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


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








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


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





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






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








extern float ceilf (float __x) throw () __attribute__ ((__const__)); extern float __ceilf (float __x) throw () __attribute__ ((__const__));


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


extern float floorf (float __x) throw () __attribute__ ((__const__)); extern float __floorf (float __x) throw () __attribute__ ((__const__));


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




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


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





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


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


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



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





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






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





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



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


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






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






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





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






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







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


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

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



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



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



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




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



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



extern float roundf (float __x) throw () __attribute__ ((__const__)); extern float __roundf (float __x) throw () __attribute__ ((__const__));



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




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






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



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



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


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


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



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


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



extern float fmaf (float __x, float __y, float __z) throw (); extern float __fmaf (float __x, float __y, float __z) throw ();




extern float scalbf (float __x, float __n) throw (); extern float __scalbf (float __x, float __n) throw ();
# 94 "/usr/include/math.h" 2 3 4
# 130 "/usr/include/math.h" 3 4
extern int signgam;
# 171 "/usr/include/math.h" 3 4
enum
  {
    FP_NAN,

    FP_INFINITE,

    FP_ZERO,

    FP_SUBNORMAL,

    FP_NORMAL

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




extern _LIB_VERSION_TYPE _LIB_VERSION;
# 280 "/usr/include/math.h" 3 4
struct __exception



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


extern int matherr (struct __exception *__exc) throw ();
# 382 "/usr/include/math.h" 3 4
# 1 "/usr/include/bits/mathinline.h" 1 3 4
# 383 "/usr/include/math.h" 2 3 4
# 438 "/usr/include/math.h" 3 4
}
# 140 "./common/stdafx.h" 2
# 24 "scumm/thumbnail.cpp" 2
# 1 "./common/system.h" 1
# 26 "./common/system.h"
# 1 "./common/scummsys.h" 1
# 34 "./common/scummsys.h"
# 1 "./config.h" 1
# 14 "./config.h"
typedef unsigned char byte;
typedef unsigned int uint;
typedef unsigned char uint8;
typedef unsigned short uint16;
typedef unsigned int uint32;
typedef signed char int8;
typedef signed short int16;
typedef signed int int32;
# 35 "./common/scummsys.h" 2
# 408 "./common/scummsys.h"
 typedef int16 OverlayColor;



# 1 "./common/endian.h" 1
# 25 "./common/endian.h"
# 1 "./common/scummsys.h" 1
# 26 "./common/endian.h" 2





inline uint32 SWAP_BYTES_32(uint32 a) {
 return ((a >> 24) & 0x000000FF) |
     ((a >> 8) & 0x0000FF00) |
     ((a << 8) & 0x00FF0000) |
     ((a << 24) & 0xFF000000);
}

inline uint16 SWAP_BYTES_16(uint16 a) {
 return ((a >> 8) & 0x00FF) + ((a << 8) & 0xFF00);
}
# 125 "./common/endian.h"
 inline uint16 READ_LE_UINT16(const void *ptr) {
  return *(const uint16 *)(ptr);
 }
 inline uint32 READ_LE_UINT32(const void *ptr) {
  return *(const uint32 *)(ptr);
 }
 inline void WRITE_LE_UINT16(void *ptr, uint16 value) {
  *(uint16 *)(ptr) = value;
 }
 inline void WRITE_LE_UINT32(void *ptr, uint32 value) {
  *(uint32 *)(ptr) = value;
 }




 inline uint16 READ_BE_UINT16(const void *ptr) {
  const byte *b = (const byte *)ptr;
  return (b[0] << 8) + b[1];
 }
 inline uint32 READ_BE_UINT32(const void *ptr) {
  const byte *b = (const byte*)ptr;
  return (b[0] << 24) + (b[1] << 16) + (b[2] << 8) + (b[3]);
 }
 inline void WRITE_BE_UINT16(void *ptr, uint16 value) {
  byte *b = (byte *)ptr;
  b[0] = (byte)(value >> 8);
  b[1] = (byte)(value >> 0);
 }
 inline void WRITE_BE_UINT32(void *ptr, uint32 value) {
  byte *b = (byte *)ptr;
  b[0] = (byte)(value >> 24);
  b[1] = (byte)(value >> 16);
  b[2] = (byte)(value >> 8);
  b[3] = (byte)(value >> 0);
 }
# 176 "./common/endian.h"
inline uint32 READ_LE_UINT24(const void *ptr) {
 const byte *b = (const byte *)ptr;
 return (b[2] << 16) + (b[1] << 8) + (b[0]);
}

inline uint32 READ_BE_UINT24(const void *ptr) {
 const byte *b = (const byte*)ptr;
 return (b[0] << 16) + (b[1] << 8) + (b[2]);
}
# 413 "./common/scummsys.h" 2
# 27 "./common/system.h" 2
# 1 "./common/mutex.h" 1
# 27 "./common/mutex.h"
namespace Common {

class Mutex;




typedef struct OpaqueMutex *MutexRef;





class StackLock {
 MutexRef _mutex;
 const char *_mutexName;

 void lock();
 void unlock();
public:
 StackLock(MutexRef mutex, const char *mutexName = __null);
 StackLock(const Mutex &mutex, const char *mutexName = __null);
 ~StackLock();
};





class Mutex {
 friend class StackLock;

 MutexRef _mutex;

public:
 Mutex();
 ~Mutex();

 void lock();
 void unlock();
};


}
# 28 "./common/system.h" 2
# 1 "./common/rect.h" 1
# 26 "./common/rect.h"
# 1 "./common/util.h" 1
# 31 "./common/util.h"
template<typename T> inline T ABS (T x) { return (x>=0) ? x : -x; }
# 42 "./common/util.h"
template<typename T> inline void SWAP(T &a, T &b) { T tmp = a; a = b; b = tmp; }



namespace Common {

class String;
# 57 "./common/util.h"
extern void hexdump(const byte * data, int len, int bytesPerLine = 16);





class RandomSource {
private:
 uint32 _randSeed;

public:
 RandomSource();
 void setSeed(uint32 seed);






 uint getRandomNumber(uint max);






 uint getRandomNumberRng(uint min, uint max);
};







enum Language {
 UNK_LANG = -1,
 EN_USA = 0,
 DE_DEU = 1,
 FR_FRA = 2,
 IT_ITA = 3,
 PT_BRA = 4,
 ES_ESP = 5,
 JA_JPN = 6,
 ZH_TWN = 7,
 KO_KOR = 8,
 SE_SWE = 9,
 EN_GRB = 10,
 HB_ISR = 20,
 RU_RUS = 21,
 CZ_CZE = 22,
 NL_NLD = 23,
 NB_NOR = 24
};

struct LanguageDescription {
 const char *code;
 const char *description;
 Common::Language id;
};

extern const LanguageDescription g_languages[];



extern Language parseLanguage(const String &str);
extern const char *getLanguageCode(Language id);
extern const char *getLanguageDescription(Language id);







enum Platform {
 kPlatformUnknown = -1,
 kPlatformPC = 0,
 kPlatformAmiga = 1,
 kPlatformAtariST = 2,
 kPlatformMacintosh = 3,
 kPlatformFMTowns = 4,
 kPlatformWindows = 5,
 kPlatformNES = 6,
 kPlatformC64 = 7,
 kPlatformLinux = 8




};

struct PlatformDescription {
 const char *code;
 const char *code2;
 const char *description;
 Common::Platform id;
};

extern const PlatformDescription g_platforms[];


extern Platform parsePlatform(const String &str);
extern const char *getPlatformCode(Platform id);
extern const char *getPlatformDescription(Platform id);







enum RenderMode {
 kRenderDefault = 0,
 kRenderEGA = 1,
 kRenderCGA = 2,
 kRenderHercG = 3,
 kRenderHercA = 4,
 kRenderAmiga = 5
};

enum HerculesDimesnions {
 kHercW = 720,
 kHercH = 350
};

struct RenderModeDescription {
 const char *code;
 const char *description;
 Common::RenderMode id;
};

extern const RenderModeDescription g_renderModes[];


extern RenderMode parseRenderMode(const String &str);
extern const char *getRenderModeCode(RenderMode id);
extern const char *getRenderModeDescription(RenderMode id);

}




void error(const char *s, ...) __attribute__((__noreturn__));




void warning(const char *s, ...);

void debug(int level, const char *s, ...);
void debug(const char *s, ...);
void checkHeap();

extern int gDebugLevel;
# 27 "./common/rect.h" 2

namespace Common {





struct Point {
 int16 x;
 int16 y;

 Point() : x(0), y(0) {};
 Point(const Point &p) : x(p.x), y(p.y) {};
 explicit Point(int16 x1, int16 y1) : x(x1), y(y1) {};
 Point & operator=(const Point & p) { x = p.x; y = p.y; return *this; };
 bool operator==(const Point & p) const { return x == p.x && y == p.y; };
 bool operator!=(const Point & p) const { return x != p.x || y != p.y; };
};
# 64 "./common/rect.h"
struct Rect {
 int16 top, left;
 int16 bottom, right;

 Rect() : top(0), left(0), bottom(0), right(0) {}
 Rect(int16 w, int16 h) : top(0), left(0), bottom(h), right(w) {}
 Rect(int16 x1, int16 y1, int16 x2, int16 y2) : top(y1), left(x1), bottom(y2), right(x2) {
  (static_cast<void> ((isValidRect()) ? 0 : (__assert_fail ("isValidRect()", "./common/rect.h", 71, __PRETTY_FUNCTION__), 0)));
 }
 int16 width() const { return right - left; }
 int16 height() const { return bottom - top; }

 void setWidth(int16 aWidth) {
  right = left + aWidth;
 }

 void setHeight(int16 aHeight) {
  bottom = top + aHeight;
 }
# 91 "./common/rect.h"
 bool contains(int16 x, int16 y) const {
  return (left <= x) && (x < right) && (top <= y) && (y < bottom);
 }







 bool contains(const Point &p) const {
  return contains(p.x, p.y);
 }







 bool intersects(const Rect &r) const {
  return (left < r.right) && (r.left < right) && (top < r.bottom) && (r.top < bottom);
 }





 void extend(const Rect &r) {
  left = (((left)<(r.left))?(left):(r.left));
  right = (((right)>(r.right))?(right):(r.right));
  top = (((top)<(r.top))?(top):(r.top));
  bottom = (((bottom)>(r.bottom))?(bottom):(r.bottom));
 }





 void grow(int16 offset) {
  top -= offset;
  left -= offset;
  bottom += offset;
  right += offset;
 }

 void clip(const Rect &r) {
  (static_cast<void> ((isValidRect()) ? 0 : (__assert_fail ("isValidRect()", "./common/rect.h", 138, __PRETTY_FUNCTION__), 0)));
  (static_cast<void> ((r.isValidRect()) ? 0 : (__assert_fail ("r.isValidRect()", "./common/rect.h", 139, __PRETTY_FUNCTION__), 0)));

  if (top < r.top) top = r.top;
  else if (top > r.bottom) top = r.bottom;

  if (left < r.left) left = r.left;
  else if (left > r.right) left = r.right;

  if (bottom > r.bottom) bottom = r.bottom;
  else if (bottom < r.top) bottom = r.top;

  if (right > r.right) right = r.right;
  else if (right < r.left) right = r.left;
 }

 void clip(int maxw, int maxh) {
  clip(Rect(0, 0, maxw, maxh));
 }

 bool isValidRect() const {
  return (left <= right && top <= bottom);
 }

 void moveTo(int16 x, int16 y) {
  bottom += y - top;
  right += x - left;
  top = y;
  left = x;
 }

 void moveTo(const Point &p) {
  moveTo(p.x, p.y);
 }

 void debugPrint(int debuglevel = 0, const char *caption = "Rect:") const {
  debug(debuglevel, "%s %d, %d, %d, %d", caption, left, top, right, bottom);
 }
};

}
# 29 "./common/system.h" 2
# 1 "./common/singleton.h" 1
# 26 "./common/singleton.h"
namespace Common {




template <class T>
class Singleton
{
private:
 Singleton<T>(const Singleton<T>&);
 Singleton<T>& operator= (const Singleton<T>&);

 static T* _singleton;
# 52 "./common/singleton.h"
 static T* makeInstance() {
  return new T();
 }


public:
 static T& instance() {







  if (!_singleton)
   _singleton = T::makeInstance();
  return *_singleton;
 }
protected:
 Singleton<T>() { }



 virtual ~Singleton<T>() { }


 typedef T SingletonBaseType;
};



}
# 30 "./common/system.h" 2

namespace Graphics {
 struct Surface;
}

namespace Common {
 class SaveFileManager;
}
# 49 "./common/system.h"
class OSystem : public Common::Singleton<OSystem> {
protected:
 static OSystem *makeInstance();
 friend class Common::Singleton<SingletonBaseType>;

public:





 virtual void initBackend() { }
# 72 "./common/system.h"
 enum Feature {




  kFeatureFullscreenMode,
# 92 "./common/system.h"
  kFeatureAspectRatioCorrection,






  kFeatureVirtualKeyboard,
# 111 "./common/system.h"
  kFeatureAutoComputeDirtyRects,







  kFeatureCursorHasPalette,




  kFeatureOverlaySupportsAlpha
 };




 virtual bool hasFeature(Feature f) { return false; }





 virtual void setFeatureState(Feature f, bool enable) {}





 virtual bool getFeatureState(Feature f) { return false; }
# 221 "./common/system.h"
 struct GraphicsMode {





  const char *name;




  const char *description;





  int id;
 };
# 249 "./common/system.h"
 virtual const GraphicsMode *getSupportedGraphicsModes() const = 0;
# 259 "./common/system.h"
 virtual int getDefaultGraphicsMode() const = 0;
# 268 "./common/system.h"
 virtual bool setGraphicsMode(int mode) = 0;
# 280 "./common/system.h"
 bool setGraphicsMode(const char *name);





 virtual int getGraphicsMode() const = 0;
# 306 "./common/system.h"
 virtual void initSize(uint width, uint height, int overlayScale = -1) = 0;
# 324 "./common/system.h"
 virtual void beginGFXTransaction() {};






 virtual void endGFXTransaction() {};







 virtual int16 getHeight() = 0;






 virtual int16 getWidth() = 0;
# 369 "./common/system.h"
 virtual void setPalette(const byte *colors, uint start, uint num) = 0;
# 379 "./common/system.h"
 virtual void grabPalette(byte *colors, uint start, uint num) = 0;
# 389 "./common/system.h"
 virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) = 0;
# 399 "./common/system.h"
 virtual bool grabRawScreen(Graphics::Surface *surf) { return false; }




 virtual void clearScreen() {}


 virtual void updateScreen() = 0;
# 422 "./common/system.h"
 virtual void setShakePos(int shakeOffset) = 0;
# 448 "./common/system.h"
 virtual void showOverlay() = 0;


 virtual void hideOverlay() = 0;
# 464 "./common/system.h"
 virtual void clearOverlay() = 0;





 virtual void grabOverlay(OverlayColor *buf, int pitch) = 0;







 virtual void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) = 0;





 virtual int16 getOverlayHeight() { return getHeight(); }





 virtual int16 getOverlayWidth() { return getWidth(); }

 virtual int screenToOverlayX(int x) { return x; }
 virtual int screenToOverlayY(int y) { return y; }
 virtual int overlayToScreenX(int x) { return x; }
 virtual int overlayToScreenY(int y) { return y; }
# 505 "./common/system.h"
 virtual OverlayColor RGBToColor(uint8 r, uint8 g, uint8 b) {
  return ((((r >> 3) & 0x1F) << 11) | (((g >> 2) & 0x3F) << 5) | ((b >> 3) & 0x1F));
 }
# 517 "./common/system.h"
 virtual void colorToRGB(OverlayColor color, uint8 &r, uint8 &g, uint8 &b) {
  r = (((color >> 11) & 0x1F) << 3);
  g = (((color >> 5) & 0x3F) << 2);
  b = ((color&0x1F) << 3);
 }
# 531 "./common/system.h"
 virtual OverlayColor ARGBToColor(uint8 a, uint8 r, uint8 g, uint8 b) {
  return RGBToColor(r, g, b);
 }
# 543 "./common/system.h"
 virtual void colorToARGB(OverlayColor color, uint8 &a, uint8 &r, uint8 &g, uint8 &b) {
  colorToRGB(color, r, g, b);
  a = 255;
 }
# 556 "./common/system.h"
 virtual bool showMouse(bool visible) = 0;







 virtual void warpMouse(int x, int y) = 0;
# 577 "./common/system.h"
 virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, byte keycolor = 255, int cursorTargetScale = 1) = 0;
# 589 "./common/system.h"
 virtual void setCursorPalette(const byte *colors, uint start, uint num) {};
# 601 "./common/system.h"
 virtual void disableCursorPalette(bool disable) {};
# 610 "./common/system.h"
 typedef int (*TimerProc)(int interval);
# 621 "./common/system.h"
 enum EventType {

  EVENT_KEYDOWN = 1,

  EVENT_KEYUP = 2,

  EVENT_MOUSEMOVE = 3,
  EVENT_LBUTTONDOWN = 4,
  EVENT_LBUTTONUP = 5,
  EVENT_RBUTTONDOWN = 6,
  EVENT_RBUTTONUP = 7,
  EVENT_WHEELUP = 8,
  EVENT_WHEELDOWN = 9,

  EVENT_QUIT = 10,
  EVENT_SCREEN_CHANGED = 11
 };




 enum {
  KBD_CTRL = 1 << 0,
  KBD_ALT = 1 << 1,
  KBD_SHIFT = 1 << 2
 };
# 676 "./common/system.h"
 struct Event {

  EventType type;




  struct {
# 694 "./common/system.h"
   int keycode;







   uint16 ascii;





   byte flags;
  } kbd;






  Common::Point mouse;
 };






 virtual bool pollEvent(Event &event) = 0;


 virtual uint32 getMillis() = 0;


 virtual void delayMillis(uint msecs) = 0;
# 750 "./common/system.h"
 virtual void setTimerCallback(TimerProc callback, int interval) = 0;
# 771 "./common/system.h"
 typedef Common::MutexRef MutexRef;





 virtual MutexRef createMutex() = 0;





 virtual void lockMutex(MutexRef mutex) = 0;





 virtual void unlockMutex(MutexRef mutex) = 0;







 virtual void deleteMutex(MutexRef mutex) = 0;







 typedef void (*SoundProc)(void *param, byte *buf, int len);







 virtual bool setSoundCallback(SoundProc proc, void *param) = 0;






 virtual void clearSoundCallback() = 0;
# 829 "./common/system.h"
 virtual int getOutputSampleRate() const = 0;
# 845 "./common/system.h"
 virtual bool openCD(int drive) = 0;





 virtual bool pollCD() = 0;
# 860 "./common/system.h"
 virtual void playCD(int track, int num_loops, int start_frame, int duration) = 0;




 virtual void stopCD() = 0;




 virtual void updateCD() = 0;
# 879 "./common/system.h"
 virtual void quit() = 0;






 virtual void setWindowCaption(const char *caption) {}
# 899 "./common/system.h"
 virtual void displayMessageOnOSD(const char *msg);


 virtual Common::SaveFileManager *getSavefileManager();


};
# 25 "scumm/thumbnail.cpp" 2
# 1 "./common/savefile.h" 1
# 25 "./common/savefile.h"
# 1 "./common/stdafx.h" 1
# 26 "./common/savefile.h" 2

# 1 "./common/stream.h" 1
# 28 "./common/stream.h"
namespace Common {

class String;




class Stream {
public:
 virtual ~Stream() {}
# 47 "./common/stream.h"
 virtual bool ioFailed() const { return false; }




 virtual void clearIOFailed() {}
};




class WriteStream : virtual public Stream {
public:
# 68 "./common/stream.h"
 virtual uint32 write(const void *dataPtr, uint32 dataSize) = 0;






 virtual void flush() {}




 void writeByte(byte value) {
  write(&value, 1);
 }

 void writeSByte(int8 value) {
  write(&value, 1);
 }

 void writeUint16LE(uint16 value) {
  writeByte((byte)(value & 0xff));
  writeByte((byte)(value >> 8));
 }

 void writeUint32LE(uint32 value) {
  writeUint16LE((uint16)(value & 0xffff));
  writeUint16LE((uint16)(value >> 16));
 }

 void writeUint16BE(uint16 value) {
  writeByte((byte)(value >> 8));
  writeByte((byte)(value & 0xff));
 }

 void writeUint32BE(uint32 value) {
  writeUint16BE((uint16)(value >> 16));
  writeUint16BE((uint16)(value & 0xffff));
 }

 void writeSint16LE(int16 value) {
  writeUint16LE((uint16)value);
 }

 void writeSint32LE(int32 value) {
  writeUint32LE((uint32)value);
 }

 void writeSint16BE(int16 value) {
  writeUint16BE((uint16)value);
 }

 void writeSint32BE(int32 value) {
  writeUint32BE((uint32)value);
 }

 void writeString(const String &str);
};





class ReadStream : virtual public Stream {
public:



 virtual bool eos() const = 0;
# 146 "./common/stream.h"
 virtual uint32 read(void *dataPtr, uint32 dataSize) = 0;





 byte readByte() {
  byte b = 0;
  read(&b, 1);
  return b;
 }

 int8 readSByte() {
  int8 b = 0;
  read(&b, 1);
  return b;
 }

 uint16 readUint16LE() {
  uint16 a = readByte();
  uint16 b = readByte();
  return a | (b << 8);
 }

 uint32 readUint32LE() {
  uint32 a = readUint16LE();
  uint32 b = readUint16LE();
  return (b << 16) | a;
 }

 uint16 readUint16BE() {
  uint16 b = readByte();
  uint16 a = readByte();
  return a | (b << 8);
 }

 uint32 readUint32BE() {
  uint32 b = readUint16BE();
  uint32 a = readUint16BE();
  return (b << 16) | a;
 }

 int16 readSint16LE() {
  return (int16)readUint16LE();
 }

 int32 readSint32LE() {
  return (int32)readUint32LE();
 }

 int16 readSint16BE() {
  return (int16)readUint16BE();
 }

 int32 readSint32BE() {
  return (int32)readUint32BE();
 }
};
# 212 "./common/stream.h"
class SeekableReadStream : public ReadStream {
public:

 virtual uint32 pos() const = 0;
 virtual uint32 size() const = 0;

 virtual void seek(int32 offs, int whence = 0) = 0;
# 230 "./common/stream.h"
 virtual char *readLine(char *buf, size_t bufSize);
};
# 242 "./common/stream.h"
class XORReadStream : public ReadStream {
private:
 byte _encbyte;
 ReadStream *_realStream;
public:
 XORReadStream(ReadStream *in = 0, byte enc = 0) : _encbyte(enc), _realStream(in) {}
 void setStream(ReadStream *in) { _realStream = in; }
 void setEnc(byte value) { _encbyte = value; }

 virtual bool eos() const { return _realStream->eos(); }
 virtual bool ioFailed() const { return _realStream->ioFailed(); }
 virtual void clearIOFailed() { _realStream->clearIOFailed(); }

 uint32 read(void *dataPtr, uint32 dataSize) {
  (static_cast<void> ((_realStream) ? 0 : (__assert_fail ("_realStream", "./common/stream.h", 256, __PRETTY_FUNCTION__), 0)));
  uint32 len = _realStream->read(dataPtr, dataSize);
  if (_encbyte) {
   byte *p = (byte *)dataPtr;
   byte *end = p + len;
   while (p < end)
    *p++ ^= _encbyte;
  }
  return len;
 }
};





class MemoryReadStream : public SeekableReadStream {
private:
 const byte *_ptr;
 const byte * const _ptrOrig;
 const uint32 _bufSize;
 uint32 _pos;
 byte _encbyte;

public:
 MemoryReadStream(const byte *buf, uint32 len) : _ptr(buf), _ptrOrig(buf), _bufSize(len), _pos(0), _encbyte(0) {}

 void setEnc(byte value) { _encbyte = value; }

 uint32 read(void *dataPtr, uint32 dataSize) {

  if (dataSize > _bufSize - _pos)
   dataSize = _bufSize - _pos;
  memcpy(dataPtr, _ptr, dataSize);

  if (_encbyte) {
   byte *p = (byte *)dataPtr;
   byte *end = p + dataSize;
   while (p < end)
    *p++ ^= _encbyte;
  }

  _ptr += dataSize;
  _pos += dataSize;

  return dataSize;
 }

 bool eos() const { return _pos == _bufSize; }
 uint32 pos() const { return _pos; }
 uint32 size() const { return _bufSize; }

 void seek(int32 offs, int whence = 0);
};





class MemoryWriteStream : public WriteStream {
private:
 byte *_ptr;
 const byte * const _ptrOrig;
 const uint32 _bufSize;
 uint32 _pos;
public:
 MemoryWriteStream(byte *buf, uint32 len) : _ptr(buf), _ptrOrig(buf), _bufSize(len), _pos(0) {}

 uint32 write(const void *dataPtr, uint32 dataSize) {

  if (dataSize > _bufSize - _pos)
   dataSize = _bufSize - _pos;
  memcpy(_ptr, dataPtr, dataSize);
  _ptr += dataSize;
  _pos += dataSize;
  return dataSize;
 }

 bool eos() const { return _pos == _bufSize; }
 uint32 pos() const { return _pos; }
 uint32 size() const { return _bufSize; }
};

}
# 28 "./common/savefile.h" 2

namespace Common {






class InSaveFile : public Common::ReadStream {
public:
 virtual ~InSaveFile() {}




 virtual void skip(uint32 offset) = 0;
};






class OutSaveFile : public Common::WriteStream {
public:
 virtual ~OutSaveFile() {}
};




class SaveFile : public InSaveFile, public OutSaveFile {
public:
};

class SaveFileManager {

public:
 virtual ~SaveFileManager() {}






 virtual OutSaveFile *openForSaving(const char *filename) = 0;






 virtual InSaveFile *openForLoading(const char *filename) = 0;

 virtual void listSavefiles(const char * , bool *marks, int num) = 0;


 virtual const char *getSavePath() const;
};

class DefaultSaveFileManager : public SaveFileManager {
public:
 virtual OutSaveFile *openForSaving(const char *filename);
 virtual InSaveFile *openForLoading(const char *filename);
 virtual void listSavefiles(const char * , bool *marks, int num);

protected:
 SaveFile *makeSaveFile(const char *filename, bool saveOrLoad);
};

}
# 26 "scumm/thumbnail.cpp" 2
# 1 "./common/scaler.h" 1
# 26 "./common/scaler.h"
# 1 "./graphics/surface.h" 1
# 24 "./graphics/surface.h"
# 1 "./common/scummsys.h" 1
# 25 "./graphics/surface.h" 2
# 1 "./common/rect.h" 1
# 26 "./graphics/surface.h" 2

namespace Graphics {






struct Surface {
 void *pixels;
 uint16 w;
 uint16 h;
 uint16 pitch;
 uint8 bytesPerPixel;
 Surface() : pixels(0), w(0), h(0), pitch(0), bytesPerPixel(0) {}

 inline const void *getBasePtr(int x, int y) const {

  return static_cast<const void *>(static_cast<byte *>(pixels) + y * pitch + x * bytesPerPixel);
 }

 inline void *getBasePtr(int x, int y) {
  return static_cast<void *>(static_cast<byte *>(pixels) + y * pitch + x * bytesPerPixel);
 }




 void create(uint16 width, uint16 height, uint8 bytesPP);





 void free();

 void drawLine(int x0, int y0, int x1, int y1, uint32 color);
 void hLine(int x, int y, int x2, uint32 color);
 void vLine(int x, int y, int y2, uint32 color);
 void fillRect(const Common::Rect &r, uint32 color);
 void frameRect(const Common::Rect &r, uint32 color);
};


}
# 27 "./common/scaler.h" 2

extern void InitScalers(uint32 BitFormat);

typedef void ScalerProc(const uint8 *srcPtr, uint32 srcPitch,
       uint8 *dstPtr, uint32 dstPitch, int width, int height);





extern void _2xSaI(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height);
extern void Super2xSaI(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height);
extern void SuperEagle(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height);
extern void AdvMame2x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height);
extern void AdvMame3x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height);
extern void Normal1x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height);
extern void Normal2x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height);
extern void Normal3x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height);
extern void Normal1o5x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height);
extern void TV2x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height);
extern void DotMatrix(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height);


extern void HQ2x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height);
extern void HQ3x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height);


inline int real2Aspect(int y) {
 return y + (y + 1) / 5;
}

inline int aspect2Real(int y) {
 return (y * 5 + 4) / 6;
}

extern void makeRectStretchable(int &x, int &y, int &w, int &h);

extern int stretch200To240(uint8 *buf, uint32 pitch, int width, int height, int srcX, int srcY, int origSrcY);




enum {
 kThumbnailWidth = 160,
 kThumbnailHeight1 = 100,
 kThumbnailHeight2 = 120
};
extern void createThumbnail(const uint8* src, uint32 srcPitch, uint8* dstPtr, uint32 dstPitch, int width, int height);






extern bool createThumbnailFromScreen(Graphics::Surface* surf);
# 27 "scumm/thumbnail.cpp" 2
# 1 "./scumm/scumm.h" 1
# 26 "./scumm/scumm.h"
# 1 "./base/engine.h" 1
# 23 "./base/engine.h"
# 1 "./common/stdafx.h" 1
# 24 "./base/engine.h" 2
# 1 "./common/scummsys.h" 1
# 25 "./base/engine.h" 2
# 1 "./common/str.h" 1
# 25 "./common/str.h"
# 1 "./common/array.h" 1
# 25 "./common/array.h"
# 1 "/usr/include/assert.h" 1 3 4
# 26 "./common/array.h" 2

namespace Common {

template <class T>
class Array {
protected:
 int _capacity;
 int _size;
 T *_data;

public:
 typedef T *iterator;
 typedef const T *const_iterator;

public:
 Array<T>() : _capacity(0), _size(0), _data(0) {}
 Array<T>(const Array<T>& array) : _capacity(0), _size(0), _data(0) {
  _size = array._size;
  _capacity = _size + 32;
  _data = new T[_capacity];
  for (int i = 0; i < _size; i++)
   _data[i] = array._data[i];
 }




 ~Array<T>()

 {
  if (_data)
   delete [] _data;
 }

 void push_back(const T& element) {
  ensureCapacity(_size + 1);
  _data[_size++] = element;
 }

 void push_back(const Array<T>& array) {
  ensureCapacity(_size + array._size);
  for (int i = 0; i < array._size; i++)
   _data[_size++] = array._data[i];
 }

 void insert_at(int idx, const T& element) {
  (static_cast<void> ((idx >= 0 && idx <= _size) ? 0 : (__assert_fail ("idx >= 0 && idx <= _size", "./common/array.h", 72, __PRETTY_FUNCTION__), 0)));
  ensureCapacity(_size + 1);





  for (int i = _size; i > idx; i--) {
   _data[i] = _data[i-1];
  }
  _data[idx] = element;
  _size++;
 }

 T remove_at(int idx) {
  (static_cast<void> ((idx >= 0 && idx < _size) ? 0 : (__assert_fail ("idx >= 0 && idx < _size", "./common/array.h", 87, __PRETTY_FUNCTION__), 0)));
  T tmp = _data[idx];
  for (int i = idx; i < _size - 1; i++)
   _data[i] = _data[i+1];
  _size--;
  return tmp;
 }



 T& operator [](int idx) {
  (static_cast<void> ((idx >= 0 && idx < _size) ? 0 : (__assert_fail ("idx >= 0 && idx < _size", "./common/array.h", 98, __PRETTY_FUNCTION__), 0)));
  return _data[idx];
 }

 const T& operator [](int idx) const {
  (static_cast<void> ((idx >= 0 && idx < _size) ? 0 : (__assert_fail ("idx >= 0 && idx < _size", "./common/array.h", 103, __PRETTY_FUNCTION__), 0)));
  return _data[idx];
 }

 Array<T>& operator =(const Array<T>& array) {
  if (_data)
   delete [] _data;
  _size = array._size;
  _capacity = _size + 32;
  _data = new T[_capacity];
  for (int i = 0; i < _size; i++)
   _data[i] = array._data[i];

  return *this;
 }

 uint size() const {
  return _size;
 }

 void clear() {
  if (_data) {
   delete [] _data;
   _data = 0;
  }
  _size = 0;
  _capacity = 0;
 }

 bool isEmpty() const {
  return (_size == 0);
 }


 iterator begin() {
  return _data;
 }

 iterator end() {
  return _data + _size;
 }

 const_iterator begin() const {
  return _data;
 }

 const_iterator end() const {
  return _data + _size;
 }

 bool contains(const T &key) const {
  for (const_iterator i = begin(); i != end(); ++i) {
   if (*i == key)
    return true;
  }
  return false;
 }


protected:
 void ensureCapacity(int new_len) {
  if (new_len <= _capacity)
   return;

  T *old_data = _data;
  _capacity = new_len + 32;
  _data = new T[_capacity];

  if (old_data) {

   for (int i = 0; i < _size; i++)
    _data[i] = old_data[i];
   delete [] old_data;
  }
 }
};

}
# 26 "./common/str.h" 2

# 1 "/usr/include/assert.h" 1 3 4
# 28 "./common/str.h" 2


namespace Common {

class String {
protected:
 char *_str;
 int _len;
 int *_refCount;
 int _capacity;

public:

 static const String emptyString;




 String() : _str(0), _len(0), _capacity(0) { _refCount = new int(1); }
 String(const char *str, int len = -1);
 String(const String &str);
 virtual ~String();

 String &operator =(const char *str);
 String &operator =(const String &str);
 String &operator =(char c);
 String &operator +=(const char *str);
 String &operator +=(const String &str);
 String &operator +=(char c);

 bool operator ==(const String &x) const;
 bool operator ==(const char *x) const;
 bool operator !=(const String &x) const;
 bool operator !=(const char *x) const;
 bool operator <(const String &x) const;
 bool operator <=(const String &x) const;
 bool operator >(const String &x) const;
 bool operator >=(const String &x) const;

 bool hasSuffix(const char *x) const;
 bool hasPrefix(const char *x) const;

 const char *c_str() const { return _str ? _str : ""; }
 uint size() const { return _len; }

 bool isEmpty() const { return (_len == 0); }
 char lastChar() const { return (_len > 0) ? _str[_len-1] : 0; }

 char operator [](int idx) const {
  (static_cast<void> ((_str && idx >= 0 && idx < _len) ? 0 : (__assert_fail ("_str && idx >= 0 && idx < _len", "./common/str.h", 77, __PRETTY_FUNCTION__), 0)));
  return _str[idx];
 }

 char &operator [](int idx) {
  (static_cast<void> ((_str && idx >= 0 && idx < _len) ? 0 : (__assert_fail ("_str && idx >= 0 && idx < _len", "./common/str.h", 82, __PRETTY_FUNCTION__), 0)));
  return _str[idx];
 }

 void deleteLastChar();
 void deleteChar(int p);
 void clear();
 void insertChar(char c, int p);

 void toLowercase();
 void toUppercase();

public:
 typedef char * iterator;
 typedef const char * const_iterator;

 iterator begin() {
  return _str;
 }

 iterator end() {
  return begin() + size();
 }

 const_iterator begin() const {
  return _str;
 }

 const_iterator end() const {
  return begin() + size();
 }

protected:
 void ensureCapacity(int new_len, bool keep_old);
 void decRefCount();
};


String operator +(const String &x, const String &y);
String operator +(const char *x, const String &y);
String operator +(const String &x, const char *y);


bool operator == (const char *x, const String &y);
bool operator != (const char *x, const String &y);

class StringList : public Array<String> {
public:
 void push_back(const char *str) {
  ensureCapacity(_size + 1);
  _data[_size++] = str;
 }

 void push_back(const String &str) {
  ensureCapacity(_size + 1);
  _data[_size++] = str;
 }
};

}
# 26 "./base/engine.h" 2

class GameDetector;
class OSystem;
namespace Audio {
 class Mixer;
}
namespace Common {
 class SaveFileManager;
 class Timer;
}

class Engine {
public:
 OSystem *_system;
 Audio::Mixer *_mixer;
 Common::Timer * _timer;

protected:
 const Common::String _gameDataPath;
 Common::SaveFileManager *_saveFileMan;

public:
 Engine(OSystem *syst);
 virtual ~Engine();





 virtual int init(GameDetector &detector) = 0;







 virtual int go() = 0;


 virtual const char *getGameDataPath() const;


 virtual void errorString(const char *buf_input, char *buf_output) = 0;

 void initCommonGFX(GameDetector &detector);


 void checkCD();
};

extern Engine *g_engine;
# 27 "./scumm/scumm.h" 2
# 1 "./common/file.h" 1
# 27 "./common/file.h"
# 1 "./common/str.h" 1
# 28 "./common/file.h" 2


namespace Common {

class File : public SeekableReadStream, public WriteStream {
protected:

 FILE *_handle;


 bool _ioFailed;


 int32 _refcount;


 String _name;


 static StringList _defaultDirectories;

public:
 enum AccessMode {
  kFileReadMode = 1,
  kFileWriteMode = 2
 };

 static void addDefaultDirectory(const String &directory);
 static void resetDefaultDirectories();

 File();
 virtual ~File();

 void incRef();
 void decRef();

 virtual bool open(const char *filename, AccessMode mode = kFileReadMode, const char *directory = __null);
 static bool exists(const char *filename, const char *directory = __null);

 virtual void close();
 bool isOpen() const;
 bool ioFailed() const;
 void clearIOFailed();
 bool eos() const { return eof(); }
 bool eof() const;
 uint32 pos() const;
 uint32 size() const;
 const char *name() const { return _name.c_str(); }
 void seek(int32 offs, int whence = 0);
 uint32 read(void *dataPtr, uint32 dataSize);
 uint32 write(const void *dataPtr, uint32 dataSize);
};

}
# 28 "./scumm/scumm.h" 2
# 1 "./common/rect.h" 1
# 29 "./scumm/scumm.h" 2
# 1 "./common/str.h" 1
# 30 "./scumm/scumm.h" 2
# 1 "./graphics/surface.h" 1
# 31 "./scumm/scumm.h" 2

# 1 "./scumm/gfx.h" 1
# 28 "./scumm/gfx.h"
namespace Scumm {

class ScummEngine;


enum {
 kNormalCameraMode = 1,
 kFollowActorCameraMode = 2,
 kPanningCameraMode = 3
};


struct CameraData {
 Common::Point _cur;
 Common::Point _dest;
 Common::Point _accel;
 Common::Point _last;
 int _leftTrigger, _rightTrigger;
 byte _follows, _mode;
 bool _movingToActor;
};


enum VirtScreenNumber {
 kMainVirtScreen = 0,
 kTextVirtScreen = 1,
 kVerbVirtScreen = 2,
 kUnkVirtScreen = 3
};
# 81 "./scumm/gfx.h"
struct VirtScreen : Graphics::Surface {




 VirtScreenNumber number;
# 96 "./scumm/gfx.h"
 uint16 topline;






 uint16 xstart;
# 113 "./scumm/gfx.h"
 bool hasTwoBuffers;
# 123 "./scumm/gfx.h"
 byte *backBuf;
# 132 "./scumm/gfx.h"
 uint16 tdirty[80 + 1];
# 141 "./scumm/gfx.h"
 uint16 bdirty[80 + 1];
# 151 "./scumm/gfx.h"
 void setDirtyRange(int top, int bottom) {
  for (int i = 0; i < 80 + 1; i++) {
   tdirty[i] = top;
   bdirty[i] = bottom;
  }
 }

 byte *getPixels(int x, int y) const {
  return (byte *)pixels + xstart + y * pitch + x;
 }

 byte *getBackPixels(int x, int y) const {
  return (byte *)backBuf + xstart + y * pitch + x;
 }
};


struct ColorCycle {
 uint16 delay;
 uint16 counter;
 uint16 flags;
 byte start;
 byte end;
};


struct BompDrawData {
 Graphics::Surface dst;

 int x, y;
 byte scale_x, scale_y;
 const byte *dataptr;
 int srcwidth, srcheight;
 uint16 shadowMode;

 byte *maskPtr;

 BompDrawData() { memset(this, 0, sizeof(*this)); }
};

struct StripTable;



class Gdi {
 ScummEngine *_vm;

public:
 int _numZBuffer;
 int _imgBufOffs[8];
 int32 _numStrips;

 Gdi(ScummEngine *vm);
 ~Gdi();

protected:
 byte _paletteMod;
 byte *_roomPalette;
 byte _transparentColor;
 byte _decomp_shr, _decomp_mask;
 uint32 _vertStripNextInc;

 bool _zbufferDisabled;


 bool _objectMode;


 struct {
  byte colors[4];
  byte charMap[2048], objectMap[2048], picMap[4096], colorMap[4096];
  byte maskMap[4096], maskChar[4096];
 } _C64;

 struct {
  byte nametable[16][64], nametableObj[16][64];
  byte attributes[64], attributesObj[64];
  byte masktable[16][8], masktableObj[16][8];
  int objX;
  bool hasmask;
 } _NES;


 StripTable *_roomStrips;


 bool decompressBitmap(byte *dst, int dstPitch, const byte *src, int numLinesToProcess);

 void drawStripEGA(byte *dst, int dstPitch, const byte *src, int height) const;
 void drawStripC64Object(byte *dst, int dstPitch, int stripnr, int width, int height);
 void drawStripC64Background(byte *dst, int dstPitch, int stripnr, int height);
 void drawStripNES(byte *dst, byte *mask, int dstPitch, int stripnr, int top, int height);

 void drawStripComplex(byte *dst, int dstPitch, const byte *src, int height, const bool transpCheck) const;
 void drawStripBasicH(byte *dst, int dstPitch, const byte *src, int height, const bool transpCheck) const;
 void drawStripBasicV(byte *dst, int dstPitch, const byte *src, int height, const bool transpCheck) const;

 void unkDecode7(byte *dst, int dstPitch, const byte *src, int height) const;
 void unkDecode8(byte *dst, int dstPitch, const byte *src, int height) const;
 void unkDecode9(byte *dst, int dstPitch, const byte *src, int height) const;
 void unkDecode10(byte *dst, int dstPitch, const byte *src, int height) const;
 void unkDecode11(byte *dst, int dstPitch, const byte *src, int height) const;
 void drawStrip3DO(byte *dst, int dstPitch, const byte *src, int height, const bool transpCheck) const;

 void drawStripHE(byte *dst, int dstPitch, const byte *src, int width, int height, const bool transpCheck) const;


 void drawStripC64Mask(byte *dst, int stripnr, int width, int height) const;
 void drawStripNESMask(byte *dst, int stripnr, int top, int height) const;
 void decompressTMSK(byte *dst, const byte *tmsk, const byte *src, int height) const;
 void decompressMaskImgOr(byte *dst, const byte *src, int height) const;
 void decompressMaskImg(byte *dst, const byte *src, int height) const;


 void decodeC64Gfx(const byte *src, byte *dst, int size) const;

 int getZPlanes(const byte *smap_ptr, const byte *zplane_list[9], bool bmapImage) const;

 StripTable *generateStripTable(const byte *src, int width, int height, StripTable *table) const;
 void drawBitmapV2Helper(const byte *ptr, VirtScreen *vs, int x, int y, const int width, const int height,
                 int stripnr, int numstrip);

public:
 void init();
 void roomChanged(byte *roomptr, uint32 IM00_offs, byte transparentColor);

 void drawBitmap(const byte *ptr, VirtScreen *vs, int x, int y, const int width, const int height,
                 int stripnr, int numstrip, byte flag);

 void decodeNESGfx(const byte *room);
 void decodeNESObject(const byte *ptr, int xpos, int ypos, int width, int height);

 void drawBMAPBg(const byte *ptr, VirtScreen *vs);
 void drawBMAPObject(const byte *ptr, VirtScreen *vs, int obj, int x, int y, int w, int h);

 void copyVirtScreenBuffers(Common::Rect rect, int dirtybit = 0);

 byte *getMaskBuffer(int x, int y, int z);
 void disableZBuffer() { _zbufferDisabled = true; }
 void enableZBuffer() { _zbufferDisabled = false; }

 void resetBackground(int top, int bottom, int strip);

 enum DrawBitmapFlags {
  dbAllowMaskOr = 1 << 0,
  dbDrawMaskOnAll = 1 << 1,
  dbObjectMode = 2 << 2
 };
};


}
# 33 "./scumm/scumm.h" 2
# 1 "./scumm/script.h" 1
# 28 "./scumm/script.h"
namespace Scumm {


enum {
 NUM_SCRIPT_SLOT = 80
};


enum {
 ssDead = 0,
 ssPaused = 1,
 ssRunning = 2
};

struct ScriptSlot {
 uint32 offs;
 int32 delay;
 uint16 number;
 uint16 delayFrameCount;
 bool freezeResistant, recursive;
 bool didexec;
 byte status;
 byte where;
 byte freezeCount;
 byte cutsceneOverride;
 byte cycle;
};

struct NestedScript {
 uint16 number;
 uint8 where;
 uint8 slot;
};

struct VirtualMachineState {
 uint32 cutScenePtr[5];
 byte cutSceneScript[5];
 int16 cutSceneData[5];
 int16 cutSceneScriptIndex;
 byte cutSceneStackPointer;
 ScriptSlot slot[NUM_SCRIPT_SLOT];
 int32 localvar[NUM_SCRIPT_SLOT][26];

 NestedScript nest[15];
 byte numNestedScripts;
};

}
# 34 "./scumm/scumm.h" 2

namespace GUI {
 class Dialog;
}
using GUI::Dialog;
class GameDetector;
namespace Common {
 class InSaveFile;
 class OutSaveFile;
}

namespace Scumm {

class Actor;
class BaseCostumeLoader;
class BaseCostumeRenderer;
class BaseScummFile;
class CharsetRenderer;
class IMuse;
class IMuseDigital;
class Insane;
class MusicEngine;
class ScummEngine;
class ScummDebugger;
class Serializer;
class Sound;

struct Box;
struct BoxCoords;
struct FindObjectInRoom;
struct ScummGameSettings;


extern ScummEngine *g_scumm;


enum {
 NUM_SENTENCE = 6,
 NUM_SHADOW_PALETTE = 8
};






enum GameFeatures {

 GF_NEW_CAMERA = 1 << 1,


 GF_NEW_COSTUMES = 1 << 2,


 GF_DIGI_IMUSE = 1 << 3,


 GF_USE_KEY = 1 << 4,


 GF_SMALL_HEADER = 1 << 5,


 GF_OLD_BUNDLE = 1 << 6,


 GF_16COLOR = 1 << 7,


 GF_OLD256 = 1 << 8,


 GF_AUDIOTRACKS = 1 << 9,


 GF_NO_SCALING = 1 << 10,





 GF_FEW_LOCALS = 1 << 11,


 GF_HE_CURSORLESS = 1 << 12,


 GF_HE_LOCALIZED = 1 << 13,





 GF_HE_985 = 1 << 14,


 GF_16BIT_COLOR = 1 << 15,


 GF_HE_NOSUBTITLES = 1 << 16,


 GF_DEMO = 1 << 17
};


void debugC(int level, const char *s, ...);

struct dbgChannelDesc {
 const char *channel, *desc;
 uint32 flag;
};

enum {
 DEBUG_GENERAL = 1 << 0,
 DEBUG_SCRIPTS = 1 << 2,
 DEBUG_OPCODES = 1 << 3,
 DEBUG_VARS = 1 << 4,
 DEBUG_RESOURCE = 1 << 5,
 DEBUG_IMUSE = 1 << 6,
 DEBUG_SOUND = 1 << 7,
 DEBUG_ACTORS = 1 << 8,
 DEBUG_INSANE = 1 << 9,
 DEBUG_SMUSH = 1 << 10
};

struct MemBlkHeader {
 uint32 size;
};

struct VerbSlot;
struct ObjectData;

struct V2MouseoverBox {
 Common::Rect rect;
 byte color;
 byte hicolor;
};

enum ResTypes {
 rtFirst = 1,
 rtRoom = 1,
 rtScript = 2,
 rtCostume = 3,
 rtSound = 4,
 rtInventory = 5,
 rtCharset = 6,
 rtString = 7,
 rtVerb = 8,
 rtActorName = 9,
 rtBuffer = 10,
 rtScaleTable = 11,
 rtTemp = 12,
 rtFlObject = 13,
 rtMatrix = 14,
 rtBox = 15,
 rtObjectName = 16,
 rtRoomScripts = 17,
 rtRoomImage = 18,
 rtImage = 19,
 rtTalkie = 20,
 rtLast = 20,
 rtNumTypes = 21
};

enum {
 LIGHTMODE_dark = 0,
 LIGHTMODE_actor_base = 1,
 LIGHTMODE_screen = 2,
 LIGHTMODE_flashlight = 4,
 LIGHTMODE_actor_color = 8
};

enum {
 MBS_LEFT_CLICK = 0x8000,
 MBS_RIGHT_CLICK = 0x4000,
 MBS_MOUSE_MASK = (MBS_LEFT_CLICK | MBS_RIGHT_CLICK),
 MBS_MAX_KEY = 0x0200
};

enum ScummGameId {
 GID_TENTACLE,
 GID_MONKEY2,
 GID_INDY4,
 GID_MONKEY,
 GID_SAMNMAX,
 GID_MONKEY_EGA,
 GID_PASS,
 GID_LOOM256,
 GID_ZAK256,
 GID_INDY3,
 GID_LOOM,
 GID_FT,
 GID_DIG,
 GID_MONKEY_VGA,
 GID_CMI,
 GID_MANIAC,
 GID_ZAK,
 GID_MONKEY_SEGA,
 GID_HEGAME,
 GID_FBEAR,
 GID_FUNPACK,
 GID_FREDDI2,
 GID_PUTTDEMO,
 GID_PUTTRACE,
 GID_FUNSHOP,
 GID_FOOTBALL
};

struct SentenceTab {
 byte verb;
 byte preposition;
 uint16 objectA;
 uint16 objectB;
 uint8 freezeCount;
};

struct StringSlot {
 int16 xpos;
 int16 ypos;
 int16 right;
 int16 height;
 byte color;
 byte charset;
 bool center;
 bool overhead;
 bool no_talk_anim;
};

struct StringTab : StringSlot {



 StringSlot _default;

 void saveDefault() {
  StringSlot &s = *this;
  _default = s;
 }

 void loadDefault() {
  StringSlot &s = *this;
  s = _default;
 }
};



enum WhereIsObject {
 WIO_NOT_FOUND = -1,
 WIO_INVENTORY = 0,
 WIO_ROOM = 1,
 WIO_GLOBAL = 2,
 WIO_LOCAL = 3,
 WIO_FLOBJECT = 4
};

struct LangIndexNode {
 char tag[12+1];
 int32 offset;
};

struct AuxBlock {
 bool visible;
 Common::Rect r;

 void reset() {
  visible = false;
  r.left = r.top = 0;
  r.right = r.bottom = -1;
 }
};

struct AuxEntry {
 int actorNum;
 int subIndex;
};

struct InfoStuff {
 uint32 date;
 uint16 time;
 uint32 playtime;
};

class ResourceManager {
 friend class ScummDebugger;
 friend class ScummEngine;
protected:
 ScummEngine *_vm;

public:
 byte mode[rtNumTypes];
 uint16 num[rtNumTypes];
 uint32 tags[rtNumTypes];
 const char *name[rtNumTypes];
 byte **address[rtNumTypes];
 byte *flags[rtNumTypes];
 byte *roomno[rtNumTypes];
 uint32 *roomoffs[rtNumTypes];
 uint32 *globsize[rtNumTypes];

 uint32 _allocatedSize;
 uint32 _maxHeapThreshold, _minHeapThreshold;
 byte _expireCounter;

public:
 ResourceManager(ScummEngine *vm);

 byte *createResource(int type, int index, uint32 size);
 void nukeResource(int type, int i);

 void freeResources();

 bool validateResource(const char *str, int type, int index) const;
 bool isResourceLoaded(int type, int index) const;

 void lock(int type, int i);
 void unlock(int type, int i);

 void setResourceCounter(int type, int index, byte flag);
 void increaseResourceCounter();

 void resourceStats();
 void expireResources(uint32 size);
};

class ScummEngine : public Engine {
 friend class ScummDebugger;
 friend class SmushPlayer;
 friend class Insane;
 friend class CharsetRenderer;
 friend class ResourceManager;

 void errorString(const char *buf_input, char *buf_output);
public:



 IMuse *_imuse;
 IMuseDigital *_imuseDigital;
 MusicEngine *_musicEngine;
 Sound *_sound;

 VerbSlot *_verbs;
 ObjectData *_objs;
 ObjectData *_storedFlObjects;
 ScummDebugger *_debugger;


 byte _gameId;
 byte _version;
 uint8 _heversion;
 uint32 _features;
 Common::Platform _platform;
 uint8 _gameMD5[16];


 Common::RandomSource _rnd;


 Gdi gdi;


 ResourceManager res;

protected:
 VirtualMachineState vm;

public:

 ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameSettings &gs, uint8 md5sum[16], int substResFileNameIndex);
 virtual ~ScummEngine();


 int go();


 int init(GameDetector &detector);

 virtual void setupScummVars();
 virtual void initScummVars();

 virtual void scummInit();

 void loadCJKFont();
 void setupMusic(int midi);
 void setupVolumes();


 int scummLoop(int delta);


 void parseEvents();
 void waitForTimer(int msec_delay);
 void processKbd(bool smushMode);
 void clearClickedStatus();


 uint32 _debugFlags;
 const char *getGameName() const { return _gameName.c_str(); }


 void updateCursor();
 virtual void animateCursor() {}
 virtual void updatePalette();





 bool _smushVideoShouldFinish;

 bool _smushPaused;

 bool _insaneRunning;

protected:
 Insane *_insane;

public:
 void pauseGame();
 void restart();
 void shutDown();


 bool _quit;

protected:
 Dialog *_pauseDialog;
 Dialog *_versionDialog;
 Dialog *_mainMenuDialog;

 int runDialog(Dialog &dialog);
 void confirmExitDialog();
 void confirmRestartDialog();
 void pauseDialog();
 void versionDialog();
 void mainMenuDialog();

 char displayMessage(const char *altButton, const char *message, ...);

 byte _fastMode;

 byte _numActors;
 Actor *_actors;
 Actor **_sortedActors;

 byte *_arraySlot;
 uint16 *_inventory;
 uint16 *_newNames;
public:



 int32& scummVar(byte var, const char *varName, const char *file, int line)
 {
  if (var == 0xFF) {
   error("Illegal access to variable %s in file %s, line %d", varName, file, line);
  }
  return _scummVars[var];
 }
 int32 scummVar(byte var, const char *varName, const char *file, int line) const
 {
  if (var == 0xFF) {
   error("Illegal access to variable %s in file %s, line %d", varName, file, line);
  }
  return _scummVars[var];
 }

protected:
 int16 _varwatch;
 int32 *_roomVars;
 int32 *_scummVars;
 byte *_bitVars;


 int _numVariables, _numBitVariables, _numLocalObjects;
 int _numGlobalObjects, _numArray, _numVerbs, _numFlObject;
 int _numInventory;
 int _numNewNames, _numGlobalScripts;
 int _numRoomVariables;
 int _numPalettes, _numSprites, _numTalkies, _numUnk;
 int _numStoredFlObjects;
 int _HEHeapSize;
public:
 int _numLocalScripts, _numImages, _numRooms, _numScripts, _numSounds;
 int _numCostumes;
 int _numCharsets;

 BaseCostumeLoader *_costumeLoader;
 BaseCostumeRenderer *_costumeRenderer;

 int _NESCostumeSet;
 void NES_loadCostumeSet(int n);
 byte *_NEScostdesc, *_NEScostlens, *_NEScostoffs, *_NEScostdata;
 byte _NESPatTable[2][4096];
 byte _NESPalette[2][16];
 byte _NESBaseTiles;

 int _NESStartStrip;

protected:

 byte _curActor;
 int _curVerb;
 int _curVerbSlot;
 int _curPalIndex;

public:
 byte _currentRoom;
 int _roomResource;
 bool _egoPositioned;

 int generateSubstResFileName(const char *filename, char *buf, int bufsize, int index = -3);
 int _substResFileNameIndex;
 int _substResFileNameIndexBundle;

protected:
 int _keyPressed;
 uint16 _lastKeyHit;
 bool _keyDownMap[512];

 Common::Point _mouse;
 Common::Point _virtualMouse;

 uint16 _mouseAndKeyboardStat;
 byte _leftBtnPressed, _rightBtnPressed;


 int _bootParam;


 bool _dumpScripts;
 bool _hexdumpScripts;
 bool _showStack;
 uint16 _debugMode;


 byte _saveLoadFlag, _saveLoadSlot;
 uint32 _lastSaveTime;
 bool _saveTemporaryState;
 char _saveLoadName[32];

 bool saveState(int slot, bool compat);
 bool loadState(int slot, bool compat);
 virtual void saveOrLoad(Serializer *s, uint32 savegameVersion);
 void saveLoadResource(Serializer *ser, int type, int index);
 void saveResource(Serializer *ser, int type, int index);
 void loadResource(Serializer *ser, int type, int index);
 void makeSavegameName(char *out, int slot, bool temporary);

 int getKeyState(int key);

public:
 bool getSavegameName(int slot, char *desc);
 void listSavegames(bool *marks, int num);

 void requestSave(int slot, const char *name, bool temporary = false);
 void requestLoad(int slot);


public:
 Graphics::Surface *loadThumbnailFromSlot(int slot);
 bool loadInfosFromSlot(int slot, InfoStuff *stuff);

protected:
 Graphics::Surface *loadThumbnail(Common::InSaveFile *file);
 bool loadInfos(Common::InSaveFile *file, InfoStuff *stuff);
 void saveThumbnail(Common::OutSaveFile *file);
 void saveInfos(Common::OutSaveFile* file);

 int32 _engineStartTime;
 int32 _dialogStartTime;

protected:

 uint32 _localScriptOffsets[1024];
 const byte *_scriptPointer, *_scriptOrgPointer;
 byte _opcode, _currentScript;
 uint16 _curExecScript;
 const byte * const *_lastCodePtr;
 int _resultVarNumber, _scummStackPos;
 int _vmStack[150];
 int _keyScriptKey, _keyScriptNo;

 virtual void setupOpcodes() = 0;
 virtual void executeOpcode(byte i) = 0;
 virtual const char *getOpcodeDesc(byte i) = 0;

 void initializeLocals(int slot, int *vars);
 int getScriptSlot();

 void startScene(int room, Actor *a, int b);
 void startManiac();

public:
 void runScript(int script, bool freezeResistant, bool recursive, int *lvarptr, int cycle = 0);
 void stopScript(int script);
 void nukeArrays(byte scriptSlot);

protected:
 void runObjectScript(int script, int entry, bool freezeResistant, bool recursive, int *vars, int slot = -1, int cycle = 0);
 void runScriptNested(int script);
 void executeScript();
 void updateScriptPtr();
 virtual void runInventoryScript(int i);
 void inventoryScript();
 void checkAndRunSentenceScript();
 void runExitScript();
 void runEntryScript();
 void runAllScripts();
 void freezeScripts(int scr);
 void unfreezeScripts();

 bool isScriptInUse(int script) const;
 bool isRoomScriptRunning(int script) const;
 bool isScriptRunning(int script) const;

 void killAllScriptsExceptCurrent();
 void killScriptsAndResources();
 void decreaseScriptDelay(int amount);

 void stopObjectCode();
 void stopObjectScript(int script);

 void getScriptBaseAddress();
 void getScriptEntryPoint();
 int getVerbEntrypoint(int obj, int entry);

 byte fetchScriptByte();
 virtual uint fetchScriptWord();
 virtual int fetchScriptWordSigned();
 void ignoreScriptWord() { fetchScriptWord(); }
 void ignoreScriptByte() { fetchScriptByte(); }
 virtual void getResultPos();
 void setResult(int result);
 void push(int a);
 int pop();
 virtual int readVar(uint var);
 virtual void writeVar(uint var, int value);

 void beginCutscene(int *args);
 void endCutscene();
 void abortCutscene();
 void beginOverride();
 void endOverride();

 void copyScriptString(byte *dst);
 int resStrLen(const byte *src) const;
 void doSentence(int c, int b, int a);


 BaseScummFile *_fileHandle;
 uint32 _fileOffset;
public:

 Common::String _containerFile;

 bool openFile(BaseScummFile &file, const char *filename);

protected:
 int _resourceHeaderSize;
 Common::String _gameName;
 Common::String _targetName;
 byte _resourceMapper[128];
 byte *_heV7DiskOffsets;
 uint32 *_heV7RoomIntOffsets;
 const byte *_resourceLastSearchBuf;
 uint32 _resourceLastSearchSize;

 virtual void allocateArrays();
 void openRoom(int room);
 void closeRoom();
 void deleteRoomOffsets();
 virtual void readRoomsOffsets();
 void askForDisk(const char *filename, int disknum);
 bool openResourceFile(const char *filename, byte encByte);

 void loadPtrToResource(int type, int i, const byte *ptr);
 virtual void readResTypeList(int id, uint32 tag, const char *name);
 void allocResTypeData(int id, uint32 tag, int num, const char *name, int mode);

 int loadResource(int type, int i);

 int getResourceSize(int type, int idx);

public:
 byte *getResourceAddress(int type, int i);
 virtual byte *getStringAddress(int i);
 byte *getStringAddressVar(int i);
 void ensureResourceLoaded(int type, int i);
 int getResourceRoomNr(int type, int index);

protected:
 int readSoundResource(int type, int index);
 int convert_extraflags(byte *ptr, byte * src_ptr);
 void convertMac0Resource(int type, int index, byte *ptr, int size);
 void convertADResource(int type, int index, byte *ptr, int size);
 int readSoundResourceSmallHeader(int type, int index);
 bool isResourceInUse(int type, int i) const;
 virtual void loadRoomSubBlocks();
 virtual void initRoomSubBlocks();
 void clearRoomObjects();
 void storeFlObject(int slot);
 void restoreFlObjects();
 virtual void loadRoomObjects();

 virtual void readArrayFromIndexFile();
 virtual void readMAXS(int blockSize) = 0;
 virtual void readGlobalObjects();
 virtual void readIndexFile();
 virtual void readIndexBlock(uint32 block, uint32 itemsize);
 virtual void loadCharset(int i);
 void nukeCharset(int i);

 int _lastLoadedRoom;
public:
 const byte *findResourceData(uint32 tag, const byte *ptr);
 const byte *findResource(uint32 tag, const byte *ptr);
 int getResourceDataSize(const byte *ptr) const;
 void dumpResource(const char *tag, int index, const byte *ptr, int length = -1);

public:

 byte OF_OWNER_ROOM;
 int getInventorySlot();
 int findInventory(int owner, int index);
 int getInventoryCount(int owner);

protected:
 byte *_objectOwnerTable, *_objectRoomTable, *_objectStateTable;
 int _numObjectsInRoom;

public:
 uint32 *_classData;

protected:
 virtual void setupRoomObject(ObjectData *od, const byte *room, const byte *searchptr = __null);
 void markObjectRectAsDirty(int obj);
 void loadFlObject(uint object, uint room);
 void nukeFlObjects(int min, int max);
 int findFlObjectSlot();
 int findLocalObjectSlot();
 void addObjectToInventory(uint obj, uint room);
 void updateObjectStates();
public:
 bool getClass(int obj, int cls) const;
protected:
 void putClass(int obj, int cls, bool set);
 int getState(int obj);
 void putState(int obj, int state);
 void setObjectState(int obj, int state, int x, int y);
 int getOwner(int obj) const;
 void putOwner(int obj, int owner);
 void setOwnerOf(int obj, int owner);
 void clearOwnerOf(int obj);
 int getObjectRoom(int obj) const;
 int getObjX(int obj);
 int getObjY(int obj);
 void getObjectXYPos(int object, int &x, int &y) { int dir; getObjectXYPos(object, x, y, dir); }
 void getObjectXYPos(int object, int &x, int &y, int &dir);
 int getObjOldDir(int obj);
 int getObjNewDir(int obj);
 int getObjectIndex(int object) const;
 int getObjectImageCount(int object);
 int whereIsObject(int object) const;
 int findObject(int x, int y);
 void findObjectInRoom(FindObjectInRoom *fo, byte findWhat, uint object, uint room);
public:
 int getObjectOrActorXY(int object, int &x, int &y);
protected:
 int getObjActToObjActDist(int a, int b);
 const byte *getObjOrActorName(int obj);
 void setObjectName(int obj);

 void addObjectToDrawQue(int object);
 void removeObjectFromDrawQue(int object);
 void clearDrawObjectQueue();
 void processDrawQue();

 virtual void clearDrawQueues();

 uint32 getOBCDOffs(int object) const;
 byte *getOBCDFromObject(int obj);
 const byte *getOBIMFromObjectData(const ObjectData &od);
 const byte *getObjectImage(const byte *ptr, int state);
 virtual int getObjectIdFromOBIM(const byte *obim);

 int getDistanceBetween(bool is_obj_1, int b, int c, bool is_obj_2, int e, int f);

protected:

 uint16 _verbMouseOver;
 int _inventoryOffset;
 int8 _userPut;
 uint16 _userState;

 int _activeObject;

 virtual void handleMouseOver(bool updateInventory);
 virtual void redrawVerbs();
 virtual void checkExecVerbs();

 void verbMouseOver(int verb);
 int findVerbAtPos(int x, int y) const;
 virtual void drawVerb(int verb, int mode);
 void runInputScript(int a, int cmd, int mode);
 void restoreVerbBG(int verb);
 void drawVerbBitmap(int verb, int x, int y);
 int getVerbSlot(int id, int mode) const;
 void killVerb(int slot);
 void setVerbObject(uint room, uint object, uint verb);

public:

 Actor *derefActor(int id, const char *errmsg = 0) const;
 Actor *derefActorSafe(int id, const char *errmsg) const;

 int getAngleFromPos(int x, int y) const;

protected:
 void walkActors();
 void playActorSounds();
 void redrawAllActors();
 void setActorRedrawFlags();
 void putActors();
 void showActors();
 void setupV1ActorTalkColor();
 void resetActorBgs();
 virtual void processActors();
 void processUpperActors();
 virtual int getActorFromPos(int x, int y);

public:

 byte _actorToPrintStrFor, _V1TalkingActor;
 int _sentenceNum;
 SentenceTab _sentence[NUM_SENTENCE];
 StringTab _string[6];
 int16 _talkDelay;
 int _NES_lastTalkingActor;
 int _NES_talkColor;

 virtual void actorTalk(const byte *msg);
 void stopTalk();
 int getTalkingActor();
 void setTalkingActor(int variable);


 bool isCostumeInUse(int i) const;


 struct {
  int16 cmd;
  int16 actor;
  int16 param1;
  int16 param2;
 } _akosQueue[32];
 int16 _akosQueuePos;

 Common::Rect _actorClipOverride;

 bool akos_increaseAnims(const byte *akos, Actor *a);
 bool akos_increaseAnim(Actor *a, int i, const byte *aksq, const uint16 *akfo, int numakfo);
 void akos_queCommand(byte cmd, Actor *a, int param_1, int param_2);
 virtual void akos_processQueue();

protected:

 uint16 _screenB, _screenH;
public:
 int _roomHeight, _roomWidth;
 int _screenHeight, _screenWidth;
 VirtScreen virtscr[4];
 CameraData camera;

 int _screenStartStrip, _screenEndStrip;
 int _screenTop;

 Common::RenderMode _renderMode;

protected:
 ColorCycle _colorCycle[16];

 uint32 _ENCD_offs, _EXCD_offs;
 uint32 _CLUT_offs, _EPAL_offs;
 uint32 _IM00_offs, _PALS_offs;


 bool _fullRedraw, _bgNeedsRedraw;
 bool _screenEffectFlag, _completeScreenRedraw;

 struct {
  int hotspotX, hotspotY, width, height;
  byte animate, animateIndex;
  int8 state;
 } _cursor;
 byte _grabbedCursor[8192];
 byte _currentCursor;

 byte _newEffect, _switchRoomEffect2, _switchRoomEffect;
 bool _doEffect;

 byte *_scrollBuffer;

 struct {
  int x, y, w, h;
  byte *buffer;
  uint16 xStrips, yStrips;
  bool isDrawn;
 } _flashlight;

public:
 bool isLightOn() const;

protected:
 void initScreens(int b, int h);
 void initVirtScreen(VirtScreenNumber slot, int top, int width, int height, bool twobufs, bool scrollable);
 void initBGBuffers(int height);
 void initCycl(const byte *ptr);

 void decodeNESBaseTiles();

 void drawObject(int obj, int arg);
 void drawRoomObjects(int arg);
 void drawRoomObject(int i, int arg);
 void drawBox(int x, int y, int x2, int y2, int color);

 void restoreBG(Common::Rect rect, byte backcolor = 0);
 void redrawBGStrip(int start, int num);
 virtual void redrawBGAreas();

 void cameraMoved();
 void setCameraAtEx(int at);
 virtual void setCameraAt(int pos_x, int pos_y);
 virtual void setCameraFollows(Actor *a);
 virtual void moveCamera();
 virtual void panCameraTo(int x, int y);
 void clampCameraPos(Common::Point *pt);
 void actorFollowCamera(int act);

 const byte *getPalettePtr(int palindex, int room);
 void setupC64Palette();
 void setupNESPalette();
 void setupAmigaPalette();
 void setupHercPalette();
 void setupCGAPalette();
 void setupEGAPalette();
 void setupV1ManiacPalette();
 void setupV1ZakPalette();
 void setPalette(int pal);
 void setRoomPalette(int pal, int room);
 virtual void setPaletteFromPtr(const byte *ptr, int numcolor = -1);
 virtual void setPalColor(int index, int r, int g, int b);
 void setDirtyColors(int min, int max);
 const byte *findPalInPals(const byte *pal, int index);
 void swapPalColors(int a, int b);
 virtual void copyPalColor(int dst, int src);
 void cyclePalette();
 void stopCycle(int i);
 virtual void palManipulateInit(int resID, int start, int end, int time);
 void palManipulate();
public:
 int remapPaletteColor(int r, int g, int b, int threshold);
protected:
 void moveMemInPalRes(int start, int end, byte direction);
 void setupShadowPalette(int slot, int redScale, int greenScale, int blueScale, int startColor, int endColor);
 void setupShadowPalette(int redScale, int greenScale, int blueScale, int startColor, int endColor, int start, int end);
 virtual void darkenPalette(int redScale, int greenScale, int blueScale, int startColor, int endColor);

 void setupCursor();

 void setCursorFromBuffer(const byte *ptr, int width, int height, int pitch);

public:
 void markRectAsDirty(VirtScreenNumber virt, int left, int right, int top, int bottom, int dirtybit = 0);
 void markRectAsDirty(VirtScreenNumber virt, const Common::Rect& rect, int dirtybit = 0) {
  markRectAsDirty(virt, rect.left, rect.right, rect.top, rect.bottom, dirtybit);
 }
protected:

 byte *_compositeBuf;
 byte *_herculesBuf;
 virtual void drawDirtyScreenParts();
 void updateDirtyScreen(VirtScreenNumber slot);
 void drawStripToScreen(VirtScreen *vs, int x, int w, int t, int b);
 void ditherCGA(byte *dst, int dstPitch, int x, int y, int width, int height) const;
 void ditherHerc(byte *src, byte *hercbuf, int srcPitch, int *x, int *y, int *width, int *height) const;

public:
 VirtScreen *findVirtScreen(int y);
 byte *getMaskBuffer(int x, int y, int z);

protected:
 void drawFlashlight();

 void fadeIn(int effect);
 void fadeOut(int effect);

 void unkScreenEffect6();
 void transitionEffect(int a);
 void dissolveEffect(int width, int height);
 void scrollEffect(int dir);


public:
 byte *_bompActorPalettePtr;
 void drawBomp(const BompDrawData &bd, bool mirror);

protected:
 bool _shakeEnabled;
 uint _shakeFrame;
 void setShake(int mode);

 int _drawObjectQueNr;
 byte _drawObjectQue[200];
# 1062 "./scumm/scumm.h"
 uint32 gfxUsageBits[410 * 3];

 void upgradeGfxUsageBits();
 void setGfxUsageBit(int strip, int bit);
 void clearGfxUsageBit(int strip, int bit);
 bool testGfxUsageBit(int strip, int bit);
 bool testGfxAnyUsageBits(int strip);
 bool testGfxOtherUsageBits(int strip, int bit);

public:
 uint8 *_hePalettes;
 byte _HEV7ActorPalette[256];
 byte _roomPalette[256];
 byte *_shadowPalette;
 bool _skipDrawObject;
 int _timers[4];
 int _voiceMode;

protected:
 int _shadowPaletteSize;
 byte _currentPalette[3 * 256];
 byte _darkenPalette[3 * 256];

 int _palDirtyMin, _palDirtyMax;

 byte _palManipStart, _palManipEnd;
 uint16 _palManipCounter;
 byte *_palManipPalette;
 byte *_palManipIntermediatePal;

 byte _haveMsg;
 bool _useTalkAnims;
 uint16 _defaultTalkDelay;
 int _tempMusic;
 int _saveSound;
 bool _native_mt32;
 bool _enable_gs;
 int _midi;
 int _midiDriver;
 bool _copyProtection;
 bool _demoMode;
 bool _confirmExit;

public:
 uint16 _extraBoxFlags[65];

 byte getNumBoxes();
 byte *getBoxMatrixBaseAddr();
 int getPathToDestBox(byte from, byte to);
 void getGates(int trap1, int trap2, Common::Point gateA[2], Common::Point gateB[2]);
 bool inBoxQuickReject(int box, int x, int y, int threshold);
 int getClosestPtOnBox(int box, int x, int y, int16& outX, int16& outY);
 int getSpecialBox(int param1, int param2);

 void setBoxFlags(int box, int val);
 void setBoxScale(int box, int b);

 bool checkXYInBoxBounds(int box, int x, int y);
 uint distanceFromPt(int x, int y, int ptx, int pty);
 void getBoxCoordinates(int boxnum, BoxCoords *bc);
 byte getMaskFromBox(int box);
 Box *getBoxBaseAddr(int box);
 byte getBoxFlags(int box);
 int getBoxScale(int box);

 int getScale(int box, int x, int y);
 int getScaleFromSlot(int slot, int x, int y);

protected:

 struct ScaleSlot {
  int x1, y1, scale1;
  int x2, y2, scale2;
 };
 ScaleSlot _scaleSlots[20];
 void setScaleSlot(int slot, int x1, int y1, int scale1, int x2, int y2, int scale2);
 void setBoxScaleSlot(int box, int slot);
 void convertScaleTableToScaleSlot(int slot);

 void createBoxMatrix();
 bool areBoxesNeighbours(int i, int j);


public:
 CharsetRenderer *_charset;
 byte _charsetColorMap[16];
protected:
 byte _charsetColor;
 byte _charsetData[15][16];

 int _charsetBufPos;
 byte _charsetBuffer[512];

 bool _keepText;

 virtual void initCharset(int charset);

 void printString(int m, const byte *msg);

 void CHARSET_1();
 void drawString(int a, const byte *msg);
 void debugMessage(const byte *msg);
 void showMessageDialog(const byte *msg);

 int convertMessageToString(const byte *msg, byte *dst, int dstSize);
 int convertIntMessage(byte *dst, int dstSize, int var);
 int convertVerbMessage(byte *dst, int dstSize, int var);
 int convertNameMessage(byte *dst, int dstSize, int var);
 int convertStringMessage(byte *dst, int dstSize, int var);

 virtual void loadLanguageBundle() {}

public:
 Common::Language _language;


 virtual void translateText(const byte *text, byte *trans_buff);


 bool _useCJKMode;
 int _2byteHeight;
 int _2byteWidth;
 byte *get2byteCharPtr(int idx);

protected:
 byte *_2byteFontPtr;

 uint32 fileReadDword();

public:


 byte VAR_LANGUAGE;
 byte VAR_KEYPRESS;
 byte VAR_SYNC;
 byte VAR_EGO;
 byte VAR_CAMERA_POS_X;
 byte VAR_HAVE_MSG;
 byte VAR_ROOM;
 byte VAR_OVERRIDE;
 byte VAR_MACHINE_SPEED;
 byte VAR_ME;
 byte VAR_NUM_ACTOR;
 byte VAR_CURRENT_LIGHTS;
 byte VAR_CURRENTDRIVE;
 byte VAR_CURRENTDISK;
 byte VAR_TMR_1;
 byte VAR_TMR_2;
 byte VAR_TMR_3;
 byte VAR_MUSIC_TIMER;
 byte VAR_ACTOR_RANGE_MIN;
 byte VAR_ACTOR_RANGE_MAX;
 byte VAR_CAMERA_MIN_X;
 byte VAR_CAMERA_MAX_X;
 byte VAR_TIMER_NEXT;
 byte VAR_VIRT_MOUSE_X;
 byte VAR_VIRT_MOUSE_Y;
 byte VAR_ROOM_RESOURCE;
 byte VAR_LAST_SOUND;
 byte VAR_CUTSCENEEXIT_KEY;
 byte VAR_OPTIONS_KEY;
 byte VAR_TALK_ACTOR;
 byte VAR_CAMERA_FAST_X;
 byte VAR_SCROLL_SCRIPT;
 byte VAR_ENTRY_SCRIPT;
 byte VAR_ENTRY_SCRIPT2;
 byte VAR_EXIT_SCRIPT;
 byte VAR_EXIT_SCRIPT2;
 byte VAR_VERB_SCRIPT;
 byte VAR_SENTENCE_SCRIPT;
 byte VAR_INVENTORY_SCRIPT;
 byte VAR_CUTSCENE_START_SCRIPT;
 byte VAR_CUTSCENE_END_SCRIPT;
 byte VAR_CHARINC;
 byte VAR_WALKTO_OBJ;
 byte VAR_DEBUGMODE;
 byte VAR_HEAPSPACE;
 byte VAR_RESTART_KEY;
 byte VAR_PAUSE_KEY;
 byte VAR_MOUSE_X;
 byte VAR_MOUSE_Y;
 byte VAR_TIMER;
 byte VAR_TMR_4;
 byte VAR_SOUNDCARD;
 byte VAR_VIDEOMODE;
 byte VAR_MAINMENU_KEY;
 byte VAR_FIXEDDISK;
 byte VAR_CURSORSTATE;
 byte VAR_USERPUT;
 byte VAR_SOUNDRESULT;
 byte VAR_TALKSTOP_KEY;
 byte VAR_FADE_DELAY;
 byte VAR_NOSUBTITLES;


 byte VAR_SOUNDPARAM;
 byte VAR_SOUNDPARAM2;
 byte VAR_SOUNDPARAM3;
 byte VAR_MOUSEPRESENT;
 byte VAR_MEMORY_PERFORMANCE;
 byte VAR_VIDEO_PERFORMANCE;
 byte VAR_ROOM_FLAG;
 byte VAR_GAME_LOADED;
 byte VAR_NEW_ROOM;


 byte VAR_V5_TALK_STRING_Y;


 byte VAR_ROOM_WIDTH;
 byte VAR_ROOM_HEIGHT;
 byte VAR_SUBTITLES;
 byte VAR_V6_EMSSPACE;


 byte VAR_CAMERA_POS_Y;
 byte VAR_CAMERA_MIN_Y;
 byte VAR_CAMERA_MAX_Y;
 byte VAR_CAMERA_THRESHOLD_X;
 byte VAR_CAMERA_THRESHOLD_Y;
 byte VAR_CAMERA_SPEED_X;
 byte VAR_CAMERA_SPEED_Y;
 byte VAR_CAMERA_ACCEL_X;
 byte VAR_CAMERA_ACCEL_Y;
 byte VAR_CAMERA_DEST_X;
 byte VAR_CAMERA_DEST_Y;
 byte VAR_CAMERA_FOLLOWED_ACTOR;


 byte VAR_VERSION_KEY;
 byte VAR_DEFAULT_TALK_DELAY;
 byte VAR_CUSTOMSCALETABLE;
 byte VAR_BLAST_ABOVE_TEXT;
 byte VAR_VOICE_MODE;
 byte VAR_MUSIC_BUNDLE_LOADED;
 byte VAR_VOICE_BUNDLE_LOADED;

 byte VAR_LEFTBTN_DOWN;
 byte VAR_RIGHTBTN_DOWN;
 byte VAR_LEFTBTN_HOLD;
 byte VAR_RIGHTBTN_HOLD;
 byte VAR_MOUSE_BUTTONS;
 byte VAR_MOUSE_HOLD;
 byte VAR_SAVELOAD_SCRIPT;
 byte VAR_SAVELOAD_SCRIPT2;


 byte VAR_CHARSET_MASK;


 byte VAR_V6_SOUNDMODE;


 byte VAR_CHARCOUNT;
 byte VAR_VERB_ALLOWED;
 byte VAR_ACTIVE_VERB;
 byte VAR_ACTIVE_OBJECT1;
 byte VAR_ACTIVE_OBJECT2;
 byte VAR_CLICK_AREA;


 byte VAR_SKIP_RESET_TALK_ACTOR;
 byte VAR_MUSIC_CHANNEL;
 byte VAR_SOUND_CHANNEL;

 byte VAR_SCRIPT_CYCLE;
 byte VAR_NUM_SCRIPT_CYCLES;

 byte VAR_KEY_STATE;
 byte VAR_MOUSE_STATE;


 byte VAR_NUM_GLOBAL_OBJS;
};

}
# 28 "scumm/thumbnail.cpp" 2

namespace Scumm {







struct ThumbnailHeader {
 uint32 type;
 uint32 size;
 byte version;
 uint16 width, height;
 byte bpp;
} __attribute__((packed));






inline void colorToRGB(uint16 color, uint8 &r, uint8 &g, uint8 &b) {
 r = (((color >> 11) & 0x1F) << 3);
 g = (((color >> 5) & 0x3F) << 2);
 b = ((color&0x1F) << 3);
}

Graphics::Surface *ScummEngine::loadThumbnail(Common::InSaveFile *file) {
 ThumbnailHeader header;
 file->read(&header.type, 4);



 if (header.type != ((uint32) ((('THMB') >> 24) & 0x000000FF) | ((('THMB') >> 8) & 0x0000FF00) | ((('THMB') << 8) & 0x00FF0000) | ((('THMB') << 24) & 0xFF000000)) && header.type != ((uint32) ((('BMHT') >> 24) & 0x000000FF) | ((('BMHT') >> 8) & 0x0000FF00) | ((('BMHT') << 8) & 0x00FF0000) | ((('BMHT') << 24) & 0xFF000000)))
  return 0;

 header.size = file->readUint32BE();
 header.version = file->readByte();

 if (header.version > 1) {
  file->skip(header.size - 9);
  warning("Loading a newer thumbnail version");
  return 0;
 }

 header.width = file->readUint16BE();
 header.height = file->readUint16BE();
 header.bpp = file->readByte();


 if (header.bpp != 2) {
  file->skip(header.size - 14);
  return 0;
 }

 Graphics::Surface *thumb = new Graphics::Surface();
 thumb->create(header.width, header.height, sizeof(uint16));

 uint16* pixels = (uint16 *)thumb->pixels;

 for (int y = 0; y < thumb->h; ++y) {
  for (int x = 0; x < thumb->w; ++x) {
   uint8 r, g, b;
   colorToRGB(file->readUint16BE(), r, g, b);


   *pixels++ = _system->RGBToColor(r, g, b);
  }
 }

 return thumb;
}

void ScummEngine::saveThumbnail(Common::OutSaveFile *file) {
 Graphics::Surface thumb;


 if (!createThumbnailFromScreen(&thumb))

  thumb.create(kThumbnailWidth, kThumbnailHeight2, sizeof(uint16));

 ThumbnailHeader header;
 header.type = ((uint32) ((('THMB') >> 24) & 0x000000FF) | ((('THMB') >> 8) & 0x0000FF00) | ((('THMB') << 8) & 0x00FF0000) | ((('THMB') << 24) & 0xFF000000));





 header.size = sizeof(header) + thumb.w*thumb.h*thumb.bytesPerPixel;

 header.version = 1;
 header.width = thumb.w;
 header.height = thumb.h;
 header.bpp = thumb.bytesPerPixel;

 file->write(&header.type, 4);
 file->writeUint32BE(header.size);
 file->writeByte(header.version);
 file->writeUint16BE(header.width);
 file->writeUint16BE(header.height);
 file->writeByte(header.bpp);


 uint16* pixels = (uint16 *)thumb.pixels;
 for (uint16 p = 0; p < thumb.w*thumb.h; ++p, ++pixels)
  file->writeUint16BE(*pixels);

 thumb.free();
}

}
