/*
**
** The C code is generated by ATS/Anairiats
** The compilation time is: 2016-7-18: 22h:45m
**
*/

/* include some .h files */
#ifndef _ATS_HEADER_NONE
#include "ats_config.h"
#include "ats_basics.h"
#include "ats_types.h"
#include "ats_exception.h"
#include "ats_memory.h"
#endif /* _ATS_HEADER_NONE */

/* include some .cats files */
#ifndef _ATS_PRELUDE_NONE
#include "prelude/CATS/basics.cats"
#include "prelude/CATS/integer.cats"
#include "prelude/CATS/sizetype.cats"
#include "prelude/CATS/integer_ptr.cats"
#include "prelude/CATS/integer_fixed.cats"
#include "prelude/CATS/pointer.cats"
#include "prelude/CATS/bool.cats"
#include "prelude/CATS/char.cats"
#include "prelude/CATS/byte.cats"
#include "prelude/CATS/float.cats"
#include "prelude/CATS/string.cats"
#include "prelude/CATS/reference.cats"
#include "prelude/CATS/lazy.cats"
#include "prelude/CATS/lazy_vt.cats"
#include "prelude/CATS/printf.cats"
#include "prelude/CATS/list.cats"
#include "prelude/CATS/option.cats"
#include "prelude/CATS/array.cats"
#include "prelude/CATS/matrix.cats"
#endif /* _ATS_PRELUDE_NONE */
/* prologues from statically loaded files */
/* external codes at top */
/* type definitions */
typedef struct {
ats_int_type atslab_0 ;
ats_int_type atslab_1 ;
ats_ptr_type atslab_2 ;
ats_ptr_type atslab_3 ;
} anairiats_sum_0 ;

/* external typedefs */
/* external dynamic constructor declarations */
ATSextern_val(ats_sum_type, ATS_2d0_2e2_2e12_2libats_2DATS_2linset_avltree_2edats__B_0) ;
ATSextern_val(ats_sum_type, ATS_2d0_2e2_2e12_2libats_2DATS_2linset_avltree_2edats__E_1) ;

/* external dynamic constant declarations */
ATSextern_fun(ats_bool_type, atspre_neg_bool) (ats_bool_type) ;
ATSextern_fun(ats_bool_type, atspre_lt_int_int) (ats_int_type, ats_int_type) ;
ATSextern_fun(ats_bool_type, atspre_gt_int_int) (ats_int_type, ats_int_type) ;
ATSextern_fun(ats_int_type, atspre_iadd) (ats_int_type, ats_int_type) ;
ATSextern_fun(ats_int_type, atspre_isub) (ats_int_type, ats_int_type) ;
ATSextern_fun(ats_bool_type, atspre_ilte) (ats_int_type, ats_int_type) ;
ATSextern_fun(ats_bool_type, atspre_igt) (ats_int_type, ats_int_type) ;
ATSextern_fun(ats_bool_type, atspre_igte) (ats_int_type, ats_int_type) ;
ATSextern_fun(ats_bool_type, atspre_ieq) (ats_int_type, ats_int_type) ;
ATSextern_fun(ats_int_type, atspre_imax) (ats_int_type, ats_int_type) ;
ATSextern_fun(ats_size_type, atspre_size_of_int1) (ats_int_type) ;
ATSextern_fun(ats_size_type, atspre_add_size_size) (ats_size_type, ats_size_type) ;
ATSextern_fun(ats_int_type, _2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_counter_2esats__count_get_int) (ats_int_type) ;
ATSextern_fun(ats_bool_type, _2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_counter_2esats__lt_count_count) (ats_int_type, ats_int_type) ;
ATSextern_fun(ats_bool_type, _2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_counter_2esats__lte_count_count) (ats_int_type, ats_int_type) ;
ATSextern_fun(ats_bool_type, _2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_counter_2esats__eq_count_count) (ats_int_type, ats_int_type) ;
ATSextern_fun(ats_bool_type, _2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_counter_2esats__neq_count_count) (ats_int_type, ats_int_type) ;
ATSextern_fun(ats_int_type, _2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_counter_2esats__compare_count_count) (ats_int_type, ats_int_type) ;
ATSextern_fun(ats_void_type, _2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_counter_2esats__fprint_count) (ats_ptr_type, ats_int_type) ;
ATSextern_fun(ats_ptr_type, _2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_counter_2esats__tostring_count) (ats_int_type) ;
ATSextern_fun(ats_ptr_type, _2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_counter_2esats__tostring_prefix_count) (ats_ptr_type, ats_int_type) ;
ATSextern_fun(ats_ptr_type, _2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_counter_2esats__counter_make) () ;
ATSextern_fun(ats_int_type, _2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_counter_2esats__counter_getinc) (ats_ptr_type) ;
ATSextern_fun(ats_int_type, _2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__compare_stamp_stamp) (ats_int_type, ats_int_type) ;

/* external dynamic terminating constant declarations */
#ifdef _ATS_PROOFCHECK
#endif /* _ATS_PROOFCHECK */

/* assuming abstract types */
int _2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__sasp__stampset_viewtype = 0 ;
int _2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__sasp__stamp_t0ype = 0 ;

/* sum constructor declarations */
/* exn constructor declarations */
/* global dynamic (non-functional) constant declarations */
/* internal function declarations */
static
ats_int_type __ats_fun_22 (ats_int_type arg0, ats_int_type arg1) ;
static
ats_clo_ptr_type __ats_fun_22_closure_make () ;
static
ats_int_type __ats_fun_22_clofun (ats_clo_ptr_type cloptr, ats_int_type arg0, ats_int_type arg1) ;
static
ats_ptr_type linset_make_nil_01771_ () ;
static
ats_bool_type linset_is_empty_01773_ (ats_ptr_type arg0) ;
static
ats_bool_type linset_isnot_empty_01774_ (ats_ptr_type arg0) ;
static
ats_int_type compare_elt_elt_01770_ats_int_type (ats_int_type arg0, ats_int_type arg1, ats_clo_ref_type arg2) ;
static
ats_bool_type aux_31 (ats_int_type env0, ats_clo_ref_type env1, ats_ptr_type arg0) ;
static
ats_clo_ptr_type aux_31_closure_make (ats_int_type env0, ats_clo_ref_type env1) ;
static
ats_bool_type aux_31_clofun (ats_clo_ptr_type cloptr, ats_ptr_type arg0) ;
static
ats_bool_type linset_is_member_01776_ats_int_type (ats_ptr_type arg0, ats_int_type arg1, ats_clo_ref_type arg2) ;
static
ats_int_type avltree_height_070_ats_int_type (ats_ptr_type arg0) ;
static
ats_ptr_type avltree_rrotate_0124_ats_int_type (ats_ptr_type arg0, ats_int_type arg1, ats_ptr_type arg2, ats_int_type arg3, ats_ptr_type arg4, ats_ptr_type arg5) ;
static
ats_ptr_type avltree_lrotate_0100_ats_int_type (ats_ptr_type arg0, ats_int_type arg1, ats_ptr_type arg2, ats_int_type arg3, ats_ptr_type arg4, ats_ptr_type arg5) ;
static
ats_bool_type insert_35 (ats_clo_ref_type env0, ats_ref_type arg0, ats_int_type arg1) ;
static
ats_clo_ptr_type insert_35_closure_make (ats_clo_ref_type env0) ;
static
ats_bool_type insert_35_clofun (ats_clo_ptr_type cloptr, ats_ref_type arg0, ats_int_type arg1) ;
static
ats_bool_type linset_insert_01780_ats_int_type (ats_ref_type arg0, ats_int_type arg1, ats_clo_ref_type arg2) ;
static
ats_void_type aux_41 (ats_ptr_type arg0) ;
static
ats_void_type linset_free_01778_ats_int_type (ats_ptr_type arg0) ;

/* partial value template declarations */
/* static temporary variable declarations */
ATSstatic (ats_ptr_type, statmp9) ;
ATSstatic (ats_ptr_type, statmp11) ;
ATSstatic (ats_ptr_type, statmp13) ;
ATSstatic (ats_ptr_type, statmp15) ;
ATSstatic (ats_ptr_type, statmp17) ;
ATSstatic (ats_ptr_type, statmp19) ;
ATSstatic (ats_ptr_type, statmp21) ;
ATSstatic (ats_ptr_type, statmp23) ;
ATSstatic (ats_ptr_type, statmp25) ;
ATSstatic (ats_ptr_type, statmp27) ;
ATSstatic (ats_ptr_type, statmp29) ;
ATSstatic (ats_ptr_type, statmp31) ;
ATSstatic (ats_ptr_type, statmp33) ;
ATSstatic (ats_ptr_type, statmp36) ;

/* external value variable declarations */

/* function implementations */

/*
// /home/hwxi/Research/ATS-Postiats/src/pats_stamp.dats: 1558(line=47, offs=15) -- 1586(line=47, offs=43)
*/
ATSglobaldec()
ats_int_type
_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__stamp_get_int (ats_int_type arg0) {
/* local vardec */
ATSlocal (ats_int_type, tmp0) ;

__ats_lab__2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__stamp_get_int:
tmp0 = _2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_counter_2esats__count_get_int (arg0) ;
return (tmp0) ;
} /* end of [_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__stamp_get_int] */

/*
// /home/hwxi/Research/ATS-Postiats/src/pats_stamp.dats: 1639(line=53, offs=3) -- 1679(line=53, offs=43)
*/
ATSglobaldec()
ats_bool_type
_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__lt_stamp_stamp (ats_int_type arg0, ats_int_type arg1) {
/* local vardec */
ATSlocal (ats_bool_type, tmp1) ;

__ats_lab__2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__lt_stamp_stamp:
tmp1 = _2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_counter_2esats__lt_count_count (arg0, arg1) ;
return (tmp1) ;
} /* end of [_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__lt_stamp_stamp] */

/*
// /home/hwxi/Research/ATS-Postiats/src/pats_stamp.dats: 1708(line=56, offs=3) -- 1749(line=56, offs=44)
*/
ATSglobaldec()
ats_bool_type
_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__lte_stamp_stamp (ats_int_type arg0, ats_int_type arg1) {
/* local vardec */
ATSlocal (ats_bool_type, tmp2) ;

__ats_lab__2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__lte_stamp_stamp:
tmp2 = _2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_counter_2esats__lte_count_count (arg0, arg1) ;
return (tmp2) ;
} /* end of [_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__lte_stamp_stamp] */

/*
// /home/hwxi/Research/ATS-Postiats/src/pats_stamp.dats: 1780(line=60, offs=3) -- 1820(line=60, offs=43)
*/
ATSglobaldec()
ats_bool_type
_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__eq_stamp_stamp (ats_int_type arg0, ats_int_type arg1) {
/* local vardec */
ATSlocal (ats_bool_type, tmp3) ;

__ats_lab__2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__eq_stamp_stamp:
tmp3 = _2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_counter_2esats__eq_count_count (arg0, arg1) ;
return (tmp3) ;
} /* end of [_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__eq_stamp_stamp] */

/*
// /home/hwxi/Research/ATS-Postiats/src/pats_stamp.dats: 1849(line=63, offs=3) -- 1890(line=63, offs=44)
*/
ATSglobaldec()
ats_bool_type
_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__neq_stamp_stamp (ats_int_type arg0, ats_int_type arg1) {
/* local vardec */
ATSlocal (ats_bool_type, tmp4) ;

__ats_lab__2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__neq_stamp_stamp:
tmp4 = _2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_counter_2esats__neq_count_count (arg0, arg1) ;
return (tmp4) ;
} /* end of [_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__neq_stamp_stamp] */

/*
// /home/hwxi/Research/ATS-Postiats/src/pats_stamp.dats: 1926(line=67, offs=3) -- 1971(line=67, offs=48)
*/
ATSglobaldec()
ats_int_type
_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__compare_stamp_stamp (ats_int_type arg0, ats_int_type arg1) {
/* local vardec */
ATSlocal (ats_int_type, tmp5) ;

__ats_lab__2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__compare_stamp_stamp:
tmp5 = _2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_counter_2esats__compare_count_count (arg0, arg1) ;
return (tmp5) ;
} /* end of [_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__compare_stamp_stamp] */

/*
// /home/hwxi/Research/ATS-Postiats/src/pats_stamp.dats: 2023(line=72, offs=16) -- 2052(line=72, offs=45)
*/
ATSglobaldec()
ats_ptr_type
_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__tostring_stamp (ats_int_type arg0) {
/* local vardec */
ATSlocal (ats_ptr_type, tmp6) ;

__ats_lab__2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__tostring_stamp:
tmp6 = _2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_counter_2esats__tostring_count (arg0) ;
return (tmp6) ;
} /* end of [_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__tostring_stamp] */

/*
// /home/hwxi/Research/ATS-Postiats/src/pats_stamp.dats: 2088(line=75, offs=3) -- 2135(line=75, offs=50)
*/
ATSglobaldec()
ats_ptr_type
_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__tostring_prefix_stamp (ats_ptr_type arg0, ats_int_type arg1) {
/* local vardec */
ATSlocal (ats_ptr_type, tmp7) ;

__ats_lab__2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__tostring_prefix_stamp:
tmp7 = _2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_counter_2esats__tostring_prefix_count (arg0, arg1) ;
return (tmp7) ;
} /* end of [_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__tostring_prefix_stamp] */

/*
// /home/hwxi/Research/ATS-Postiats/src/pats_stamp.dats: 2183(line=80, offs=14) -- 2221(line=80, offs=52)
*/
ATSglobaldec()
ats_void_type
_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__fprint_stamp (ats_ptr_type arg0, ats_int_type arg1) {
/* local vardec */
// ATSlocal_void (tmp8) ;

__ats_lab__2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__fprint_stamp:
/* tmp8 = */ _2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_counter_2esats__fprint_count (arg0, arg1) ;
return /* (tmp8) */ ;
} /* end of [_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__fprint_stamp] */

/*
// /home/hwxi/Research/ATS-Postiats/src/pats_stamp.dats: 2388(line=96, offs=20) -- 2419(line=96, offs=51)
*/
ATSglobaldec()
ats_int_type
_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__s2rtdat_stamp_make () {
/* local vardec */
ATSlocal (ats_int_type, tmp10) ;

__ats_lab__2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__s2rtdat_stamp_make:
tmp10 = _2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_counter_2esats__counter_getinc (statmp9) ;
return (tmp10) ;
} /* end of [_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__s2rtdat_stamp_make] */

/*
// /home/hwxi/Research/ATS-Postiats/src/pats_stamp.dats: 2546(line=109, offs=18) -- 2577(line=109, offs=49)
*/
ATSglobaldec()
ats_int_type
_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__s2cst_stamp_make () {
/* local vardec */
ATSlocal (ats_int_type, tmp12) ;

__ats_lab__2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__s2cst_stamp_make:
tmp12 = _2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_counter_2esats__counter_getinc (statmp11) ;
return (tmp12) ;
} /* end of [_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__s2cst_stamp_make] */

/*
// /home/hwxi/Research/ATS-Postiats/src/pats_stamp.dats: 2704(line=122, offs=18) -- 2735(line=122, offs=49)
*/
ATSglobaldec()
ats_int_type
_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__s2var_stamp_make () {
/* local vardec */
ATSlocal (ats_int_type, tmp14) ;

__ats_lab__2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__s2var_stamp_make:
tmp14 = _2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_counter_2esats__counter_getinc (statmp13) ;
return (tmp14) ;
} /* end of [_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__s2var_stamp_make] */

/*
// /home/hwxi/Research/ATS-Postiats/src/pats_stamp.dats: 2862(line=135, offs=18) -- 2893(line=135, offs=49)
*/
ATSglobaldec()
ats_int_type
_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__s2Var_stamp_make () {
/* local vardec */
ATSlocal (ats_int_type, tmp16) ;

__ats_lab__2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__s2Var_stamp_make:
tmp16 = _2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_counter_2esats__counter_getinc (statmp15) ;
return (tmp16) ;
} /* end of [_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__s2Var_stamp_make] */

/*
// /home/hwxi/Research/ATS-Postiats/src/pats_stamp.dats: 3021(line=148, offs=19) -- 3052(line=148, offs=50)
*/
ATSglobaldec()
ats_int_type
_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__s2hole_stamp_make () {
/* local vardec */
ATSlocal (ats_int_type, tmp18) ;

__ats_lab__2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__s2hole_stamp_make:
tmp18 = _2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_counter_2esats__counter_getinc (statmp17) ;
return (tmp18) ;
} /* end of [_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__s2hole_stamp_make] */

/*
// /home/hwxi/Research/ATS-Postiats/src/pats_stamp.dats: 3179(line=161, offs=18) -- 3210(line=161, offs=49)
*/
ATSglobaldec()
ats_int_type
_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__d2con_stamp_make () {
/* local vardec */
ATSlocal (ats_int_type, tmp20) ;

__ats_lab__2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__d2con_stamp_make:
tmp20 = _2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_counter_2esats__counter_getinc (statmp19) ;
return (tmp20) ;
} /* end of [_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__d2con_stamp_make] */

/*
// /home/hwxi/Research/ATS-Postiats/src/pats_stamp.dats: 3337(line=174, offs=18) -- 3368(line=174, offs=49)
*/
ATSglobaldec()
ats_int_type
_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__d2cst_stamp_make () {
/* local vardec */
ATSlocal (ats_int_type, tmp22) ;

__ats_lab__2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__d2cst_stamp_make:
tmp22 = _2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_counter_2esats__counter_getinc (statmp21) ;
return (tmp22) ;
} /* end of [_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__d2cst_stamp_make] */

/*
// /home/hwxi/Research/ATS-Postiats/src/pats_stamp.dats: 3495(line=187, offs=18) -- 3526(line=187, offs=49)
*/
ATSglobaldec()
ats_int_type
_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__d2mac_stamp_make () {
/* local vardec */
ATSlocal (ats_int_type, tmp24) ;

__ats_lab__2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__d2mac_stamp_make:
tmp24 = _2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_counter_2esats__counter_getinc (statmp23) ;
return (tmp24) ;
} /* end of [_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__d2mac_stamp_make] */

/*
// /home/hwxi/Research/ATS-Postiats/src/pats_stamp.dats: 3653(line=200, offs=18) -- 3684(line=200, offs=49)
*/
ATSglobaldec()
ats_int_type
_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__d2var_stamp_make () {
/* local vardec */
ATSlocal (ats_int_type, tmp26) ;

__ats_lab__2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__d2var_stamp_make:
tmp26 = _2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_counter_2esats__counter_getinc (statmp25) ;
return (tmp26) ;
} /* end of [_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__d2var_stamp_make] */

/*
// /home/hwxi/Research/ATS-Postiats/src/pats_stamp.dats: 3812(line=213, offs=19) -- 3843(line=213, offs=50)
*/
ATSglobaldec()
ats_int_type
_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__hitype_stamp_make () {
/* local vardec */
ATSlocal (ats_int_type, tmp28) ;

__ats_lab__2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__hitype_stamp_make:
tmp28 = _2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_counter_2esats__counter_getinc (statmp27) ;
return (tmp28) ;
} /* end of [_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__hitype_stamp_make] */

/*
// /home/hwxi/Research/ATS-Postiats/src/pats_stamp.dats: 3971(line=226, offs=19) -- 4002(line=226, offs=50)
*/
ATSglobaldec()
ats_int_type
_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__tmplab_stamp_make () {
/* local vardec */
ATSlocal (ats_int_type, tmp30) ;

__ats_lab__2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__tmplab_stamp_make:
tmp30 = _2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_counter_2esats__counter_getinc (statmp29) ;
return (tmp30) ;
} /* end of [_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__tmplab_stamp_make] */

/*
// /home/hwxi/Research/ATS-Postiats/src/pats_stamp.dats: 4130(line=239, offs=19) -- 4161(line=239, offs=50)
*/
ATSglobaldec()
ats_int_type
_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__tmpvar_stamp_make () {
/* local vardec */
ATSlocal (ats_int_type, tmp32) ;

__ats_lab__2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__tmpvar_stamp_make:
tmp32 = _2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_counter_2esats__counter_getinc (statmp31) ;
return (tmp32) ;
} /* end of [_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__tmpvar_stamp_make] */

/*
// /home/hwxi/Research/ATS-Postiats/src/pats_stamp.dats: 4289(line=252, offs=19) -- 4320(line=252, offs=50)
*/
ATSglobaldec()
ats_int_type
_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__funlab_stamp_make () {
/* local vardec */
ATSlocal (ats_int_type, tmp34) ;

__ats_lab__2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__funlab_stamp_make:
tmp34 = _2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_counter_2esats__counter_getinc (statmp33) ;
return (tmp34) ;
} /* end of [_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__funlab_stamp_make] */

/*
// /home/hwxi/Research/ATS-Postiats/src/pats_stamp.dats: 4484(line=265, offs=7) -- 4559(line=268, offs=47)
*/
ATSstaticdec()
ats_int_type
__ats_fun_22 (ats_int_type arg0, ats_int_type arg1) {
/* local vardec */
ATSlocal (ats_int_type, tmp35) ;

__ats_lab___ats_fun_22:
tmp35 = _2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__compare_stamp_stamp (arg0, arg1) ;
return (tmp35) ;
} /* end of [__ats_fun_22] */

typedef struct {
ats_fun_ptr_type closure_fun ;
} __ats_fun_22_closure_type ;

ats_int_type
__ats_fun_22_clofun (ats_clo_ptr_type cloptr, ats_int_type arg0, ats_int_type arg1) {
return __ats_fun_22 (arg0, arg1) ;
} /* end of function */

ATSinline()
ats_void_type
__ats_fun_22_closure_init (__ats_fun_22_closure_type *p_clo) {
p_clo->closure_fun = (ats_fun_ptr_type)&__ats_fun_22_clofun ;
return ;
} /* end of function */

ats_clo_ptr_type
__ats_fun_22_closure_make () {
__ats_fun_22_closure_type *p_clo = ATS_MALLOC(sizeof(__ats_fun_22_closure_type)) ;
__ats_fun_22_closure_init (p_clo) ;
return (ats_clo_ptr_type)p_clo ;
} /* end of function */

/*
// /home/hwxi/Research/ATS-Anairiats/libats/DATS/linset_avltree.dats: 2859(line=106, offs=17) -- 2868(line=106, offs=26)
*/
ATSstaticdec()
ats_ptr_type
linset_make_nil_01771_ () {
/* local vardec */
ATSlocal (ats_ptr_type, tmp38) ;

__ats_lab_linset_make_nil_01771_:
tmp38 = (ats_sum_ptr_type)0 ;
return (tmp38) ;
} /* end of [linset_make_nil_01771_] */

/*
// /home/hwxi/Research/ATS-Postiats/src/pats_stamp.dats: 4657(line=275, offs=17) -- 4684(line=275, offs=44)
*/
ATSglobaldec()
ats_ptr_type
_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__stampset_vt_nil () {
/* local vardec */
ATSlocal (ats_ptr_type, tmp37) ;

__ats_lab__2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__stampset_vt_nil:
tmp37 = linset_make_nil_01771_ () ;
return (tmp37) ;
} /* end of [_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__stampset_vt_nil] */

/*
// /home/hwxi/Research/ATS-Anairiats/libats/DATS/linset_avltree.dats: 2977(line=114, offs=17) -- 3047(line=115, offs=65)
*/
ATSstaticdec()
ats_bool_type
linset_is_empty_01773_ (ats_ptr_type arg0) {
/* local vardec */
ATSlocal (ats_bool_type, tmp40) ;

__ats_lab_linset_is_empty_01773_:
do {
/* branch: __ats_lab_0 */
__ats_lab_0_0:
if (arg0 == (ats_sum_ptr_type)0) { goto __ats_lab_1_0 ; }
__ats_lab_0_1:
tmp40 = ats_false_bool ;
break ;

/* branch: __ats_lab_1 */
__ats_lab_1_0:
// if (arg0 != (ats_sum_ptr_type)0) { ats_deadcode_failure_handle () ; }
__ats_lab_1_1:
tmp40 = ats_true_bool ;
break ;
} while (0) ;
return (tmp40) ;
} /* end of [linset_is_empty_01773_] */

/*
// /home/hwxi/Research/ATS-Postiats/src/pats_stamp.dats: 4715(line=278, offs=20) -- 4745(line=278, offs=50)
*/
ATSglobaldec()
ats_bool_type
_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__stampset_vt_is_nil (ats_ptr_type arg0) {
/* local vardec */
ATSlocal (ats_bool_type, tmp39) ;

__ats_lab__2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__stampset_vt_is_nil:
tmp39 = linset_is_empty_01773_ (arg0) ;
return (tmp39) ;
} /* end of [_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__stampset_vt_is_nil] */

/*
// /home/hwxi/Research/ATS-Anairiats/libats/DATS/linset_avltree.dats: 3108(line=119, offs=20) -- 3178(line=120, offs=65)
*/
ATSstaticdec()
ats_bool_type
linset_isnot_empty_01774_ (ats_ptr_type arg0) {
/* local vardec */
ATSlocal (ats_bool_type, tmp42) ;

__ats_lab_linset_isnot_empty_01774_:
do {
/* branch: __ats_lab_2 */
__ats_lab_2_0:
if (arg0 == (ats_sum_ptr_type)0) { goto __ats_lab_3_0 ; }
__ats_lab_2_1:
tmp42 = ats_true_bool ;
break ;

/* branch: __ats_lab_3 */
__ats_lab_3_0:
// if (arg0 != (ats_sum_ptr_type)0) { ats_deadcode_failure_handle () ; }
__ats_lab_3_1:
tmp42 = ats_false_bool ;
break ;
} while (0) ;
return (tmp42) ;
} /* end of [linset_isnot_empty_01774_] */

/*
// /home/hwxi/Research/ATS-Postiats/src/pats_stamp.dats: 4779(line=280, offs=23) -- 4812(line=280, offs=56)
*/
ATSglobaldec()
ats_bool_type
_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__stampset_vt_isnot_nil (ats_ptr_type arg0) {
/* local vardec */
ATSlocal (ats_bool_type, tmp41) ;

__ats_lab__2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__stampset_vt_isnot_nil:
tmp41 = linset_isnot_empty_01774_ (arg0) ;
return (tmp41) ;
} /* end of [_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__stampset_vt_isnot_nil] */

/*
// /home/hwxi/Research/ATS-Anairiats/libats/DATS/linset_avltree.dats: 2013(line=65, offs=17) -- 2041(line=65, offs=45)
*/
ATSstaticdec()
ats_int_type
compare_elt_elt_01770_ats_int_type (ats_int_type arg0, ats_int_type arg1, ats_clo_ref_type arg2) {
/* local vardec */
ATSlocal (ats_int_type, tmp50) ;

__ats_lab_compare_elt_elt_01770_ats_int_type:
tmp50 = ((ats_int_type(*)(ats_clo_ptr_type, ats_int_type, ats_int_type))(ats_closure_fun(arg2))) (arg2, arg0, arg1) ;
return (tmp50) ;
} /* end of [compare_elt_elt_01770_ats_int_type] */

/*
// /home/hwxi/Research/ATS-Anairiats/libats/DATS/linset_avltree.dats: 3861(line=149, offs=7) -- 4231(line=160, offs=33)
*/
ATSstaticdec()
ats_bool_type
aux_31 (ats_int_type env0, ats_clo_ref_type env1, ats_ptr_type arg0) {
/* local vardec */
ATSlocal (ats_bool_type, tmp45) ;
ATSlocal (ats_int_type, tmp46) ;
ATSlocal (ats_ptr_type, tmp47) ;
ATSlocal (ats_ptr_type, tmp48) ;
ATSlocal (ats_int_type, tmp49) ;
ATSlocal (ats_bool_type, tmp51) ;
ATSlocal (ats_ptr_type, tmp52) ;
ATSlocal (ats_bool_type, tmp53) ;
ATSlocal (ats_ptr_type, tmp54) ;

__ats_lab_aux_31:
do {
/* branch: __ats_lab_4 */
__ats_lab_4_0:
if (arg0 == (ats_sum_ptr_type)0) { goto __ats_lab_5_0 ; }
__ats_lab_4_1:
tmp46 = ats_caselptrlab_mac(anairiats_sum_0, arg0, atslab_1) ;
tmp47 = &ats_caselptrlab_mac(anairiats_sum_0, arg0, atslab_2) ;
tmp48 = &ats_caselptrlab_mac(anairiats_sum_0, arg0, atslab_3) ;
tmp49 = compare_elt_elt_01770_ats_int_type (env0, tmp46, env1) ;
tmp51 = atspre_lt_int_int (tmp49, 0) ;
if (tmp51) {
tmp52 = ats_ptrget_mac(ats_ptr_type, tmp47) ;
arg0 = tmp52 ;
goto __ats_lab_aux_31 ; // tail call
} else {
tmp53 = atspre_gt_int_int (tmp49, 0) ;
if (tmp53) {
tmp54 = ats_ptrget_mac(ats_ptr_type, tmp48) ;
arg0 = tmp54 ;
goto __ats_lab_aux_31 ; // tail call
} else {
tmp45 = ats_true_bool ;
} /* end of [if] */
} /* end of [if] */
break ;

/* branch: __ats_lab_5 */
__ats_lab_5_0:
// if (arg0 != (ats_sum_ptr_type)0) { ats_deadcode_failure_handle () ; }
__ats_lab_5_1:
tmp45 = ats_false_bool ;
break ;
} while (0) ;
return (tmp45) ;
} /* end of [aux_31] */

typedef struct {
ats_fun_ptr_type closure_fun ;
ats_int_type closure_env_0 ;
ats_clo_ref_type closure_env_1 ;
} aux_31_closure_type ;

ats_bool_type
aux_31_clofun (ats_clo_ptr_type cloptr, ats_ptr_type arg0) {
return aux_31 (((aux_31_closure_type*)cloptr)->closure_env_0, ((aux_31_closure_type*)cloptr)->closure_env_1, arg0) ;
} /* end of function */

ATSinline()
ats_void_type
aux_31_closure_init (aux_31_closure_type *p_clo, ats_int_type env0, ats_clo_ref_type env1) {
p_clo->closure_fun = (ats_fun_ptr_type)&aux_31_clofun ;
p_clo->closure_env_0 = env0 ;
p_clo->closure_env_1 = env1 ;
return ;
} /* end of function */

ats_clo_ptr_type
aux_31_closure_make (ats_int_type env0, ats_clo_ref_type env1) {
aux_31_closure_type *p_clo = ATS_MALLOC(sizeof(aux_31_closure_type)) ;
aux_31_closure_init (p_clo, env0, env1) ;
return (ats_clo_ptr_type)p_clo ;
} /* end of function */

/*
// /home/hwxi/Research/ATS-Anairiats/libats/DATS/linset_avltree.dats: 3822(line=148, offs=3) -- 4251(line=162, offs=2)
*/
ATSstaticdec()
ats_bool_type
linset_is_member_01776_ats_int_type (ats_ptr_type arg0, ats_int_type arg1, ats_clo_ref_type arg2) {
/* local vardec */
ATSlocal (ats_bool_type, tmp44) ;

__ats_lab_linset_is_member_01776_ats_int_type:
tmp44 = aux_31 (arg1, arg2, arg0) ;
return (tmp44) ;
} /* end of [linset_is_member_01776_ats_int_type] */

/*
// /home/hwxi/Research/ATS-Postiats/src/pats_stamp.dats: 4849(line=284, offs=3) -- 4892(line=284, offs=46)
*/
ATSglobaldec()
ats_bool_type
_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__stampset_vt_is_member (ats_ptr_type arg0, ats_int_type arg1) {
/* local vardec */
ATSlocal (ats_bool_type, tmp43) ;

__ats_lab__2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__stampset_vt_is_member:
tmp43 = linset_is_member_01776_ats_int_type (arg0, arg1, statmp36) ;
return (tmp43) ;
} /* end of [_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__stampset_vt_is_member] */

/*
// /home/hwxi/Research/ATS-Anairiats/libats/DATS/linset_avltree.dats: 3655(line=140, offs=3) -- 3740(line=141, offs=54)
*/
ATSstaticdec()
ats_int_type
avltree_height_070_ats_int_type (ats_ptr_type arg0) {
/* local vardec */
ATSlocal (ats_int_type, tmp69) ;
ATSlocal (ats_int_type, tmp70) ;

__ats_lab_avltree_height_070_ats_int_type:
do {
/* branch: __ats_lab_7 */
__ats_lab_7_0:
if (arg0 == (ats_sum_ptr_type)0) { goto __ats_lab_8_0 ; }
__ats_lab_7_1:
tmp70 = ats_caselptrlab_mac(anairiats_sum_0, arg0, atslab_0) ;
tmp69 = tmp70 ;
break ;

/* branch: __ats_lab_8 */
__ats_lab_8_0:
__ats_lab_8_1:
tmp69 = 0 ;
break ;
} while (0) ;
return (tmp69) ;
} /* end of [avltree_height_070_ats_int_type] */

/*
// /home/hwxi/Research/ATS-Anairiats/libats/DATS/linset_avltree.dats: 6846(line=274, offs=32) -- 8280(line=323, offs=4)
*/
ATSstaticdec()
ats_ptr_type
avltree_rrotate_0124_ats_int_type (ats_ptr_type arg0, ats_int_type arg1, ats_ptr_type arg2, ats_int_type arg3, ats_ptr_type arg4, ats_ptr_type arg5) {
/* local vardec */
ATSlocal (ats_ptr_type, tmp79) ;
ATSlocal (ats_ptr_type, tmp80) ;
ATSlocal (ats_ptr_type, tmp81) ;
ATSlocal (ats_ptr_type, tmp82) ;
ATSlocal (ats_ptr_type, tmp83) ;
ATSlocal (ats_int_type, tmp84) ;
ATSlocal (ats_ptr_type, tmp85) ;
ATSlocal (ats_int_type, tmp86) ;
ATSlocal (ats_ptr_type, tmp87) ;
ATSlocal (ats_bool_type, tmp88) ;
ATSlocal (ats_int_type, tmp89) ;
ATSlocal (ats_int_type, tmp90) ;
ATSlocal (ats_ptr_type, tmp91) ;
ATSlocal (ats_int_type, tmp92) ;
ATSlocal (ats_int_type, tmp93) ;
ATSlocal (ats_ptr_type, tmp94) ;
ATSlocal (ats_ptr_type, tmp95) ;
ATSlocal (ats_ptr_type, tmp96) ;
ATSlocal (ats_ptr_type, tmp97) ;
ATSlocal (ats_int_type, tmp98) ;
ATSlocal (ats_ptr_type, tmp99) ;
ATSlocal (ats_int_type, tmp100) ;
ATSlocal (ats_ptr_type, tmp101) ;
ATSlocal (ats_int_type, tmp102) ;
ATSlocal (ats_int_type, tmp103) ;
ATSlocal (ats_ptr_type, tmp104) ;
ATSlocal (ats_int_type, tmp105) ;
ATSlocal (ats_int_type, tmp106) ;
ATSlocal (ats_ptr_type, tmp107) ;

__ats_lab_avltree_rrotate_0124_ats_int_type:
tmp80 = ats_ptrget_mac(ats_ptr_type, arg2) ;
// if (tmp80 == (ats_sum_ptr_type)0) { ats_deadcode_failure_handle () ; }
tmp81 = &ats_caselptrlab_mac(anairiats_sum_0, tmp80, atslab_0) ;
tmp82 = &ats_caselptrlab_mac(anairiats_sum_0, tmp80, atslab_2) ;
tmp83 = &ats_caselptrlab_mac(anairiats_sum_0, tmp80, atslab_3) ;
tmp85 = ats_ptrget_mac(ats_ptr_type, tmp82) ;
tmp84 = avltree_height_070_ats_int_type (tmp85) ;
tmp87 = ats_ptrget_mac(ats_ptr_type, tmp83) ;
tmp86 = avltree_height_070_ats_int_type (tmp87) ;
tmp89 = atspre_iadd (tmp84, 0) ;
tmp88 = atspre_igte (tmp89, tmp86) ;
if (tmp88) {
tmp90 = atspre_iadd (tmp86, 1) ;
ats_ptrget_mac(ats_int_type, arg0) = tmp90 ;
tmp91 = ats_ptrget_mac(ats_ptr_type, tmp83) ;
ats_ptrget_mac(ats_ptr_type, arg2) = tmp91 ;
tmp93 = atspre_imax (tmp84, tmp90) ;
tmp92 = atspre_iadd (1, tmp93) ;
ats_ptrget_mac(ats_int_type, tmp81) = tmp92 ;
ats_ptrget_mac(ats_ptr_type, tmp83) = arg5 ;
tmp79 = tmp80 ;
} else {
tmp94 = ats_ptrget_mac(ats_ptr_type, tmp83) ;
// if (tmp94 == (ats_sum_ptr_type)0) { ats_deadcode_failure_handle () ; }
tmp95 = &ats_caselptrlab_mac(anairiats_sum_0, tmp94, atslab_0) ;
tmp96 = &ats_caselptrlab_mac(anairiats_sum_0, tmp94, atslab_2) ;
tmp97 = &ats_caselptrlab_mac(anairiats_sum_0, tmp94, atslab_3) ;
tmp99 = ats_ptrget_mac(ats_ptr_type, tmp96) ;
tmp98 = avltree_height_070_ats_int_type (tmp99) ;
tmp101 = ats_ptrget_mac(ats_ptr_type, tmp97) ;
tmp100 = avltree_height_070_ats_int_type (tmp101) ;
tmp103 = atspre_imax (tmp100, arg3) ;
tmp102 = atspre_iadd (1, tmp103) ;
ats_ptrget_mac(ats_int_type, arg0) = tmp102 ;
tmp104 = ats_ptrget_mac(ats_ptr_type, tmp97) ;
ats_ptrget_mac(ats_ptr_type, arg2) = tmp104 ;
tmp106 = atspre_imax (tmp84, tmp98) ;
tmp105 = atspre_iadd (1, tmp106) ;
ats_ptrget_mac(ats_int_type, tmp81) = tmp105 ;
tmp107 = ats_ptrget_mac(ats_ptr_type, tmp96) ;
ats_ptrget_mac(ats_ptr_type, tmp83) = tmp107 ;
ats_ptrget_mac(ats_int_type, tmp95) = arg1 ;
ats_ptrget_mac(ats_ptr_type, tmp96) = tmp80 ;
ats_ptrget_mac(ats_ptr_type, tmp97) = arg5 ;
tmp79 = tmp94 ;
} /* end of [if] */
return (tmp79) ;
} /* end of [avltree_rrotate_0124_ats_int_type] */

/*
// /home/hwxi/Research/ATS-Anairiats/libats/DATS/linset_avltree.dats: 5209(line=217, offs=32) -- 6673(line=266, offs=4)
*/
ATSstaticdec()
ats_ptr_type
avltree_lrotate_0100_ats_int_type (ats_ptr_type arg0, ats_int_type arg1, ats_ptr_type arg2, ats_int_type arg3, ats_ptr_type arg4, ats_ptr_type arg5) {
/* local vardec */
ATSlocal (ats_ptr_type, tmp119) ;
ATSlocal (ats_ptr_type, tmp120) ;
ATSlocal (ats_ptr_type, tmp121) ;
ATSlocal (ats_ptr_type, tmp122) ;
ATSlocal (ats_ptr_type, tmp123) ;
ATSlocal (ats_int_type, tmp124) ;
ATSlocal (ats_ptr_type, tmp125) ;
ATSlocal (ats_int_type, tmp126) ;
ATSlocal (ats_ptr_type, tmp127) ;
ATSlocal (ats_bool_type, tmp128) ;
ATSlocal (ats_int_type, tmp129) ;
ATSlocal (ats_int_type, tmp130) ;
ATSlocal (ats_ptr_type, tmp131) ;
ATSlocal (ats_int_type, tmp132) ;
ATSlocal (ats_int_type, tmp133) ;
ATSlocal (ats_ptr_type, tmp134) ;
ATSlocal (ats_ptr_type, tmp135) ;
ATSlocal (ats_ptr_type, tmp136) ;
ATSlocal (ats_ptr_type, tmp137) ;
ATSlocal (ats_int_type, tmp138) ;
ATSlocal (ats_ptr_type, tmp139) ;
ATSlocal (ats_int_type, tmp140) ;
ATSlocal (ats_ptr_type, tmp141) ;
ATSlocal (ats_int_type, tmp142) ;
ATSlocal (ats_int_type, tmp143) ;
ATSlocal (ats_ptr_type, tmp144) ;
ATSlocal (ats_int_type, tmp145) ;
ATSlocal (ats_int_type, tmp146) ;
ATSlocal (ats_ptr_type, tmp147) ;

__ats_lab_avltree_lrotate_0100_ats_int_type:
tmp120 = ats_ptrget_mac(ats_ptr_type, arg4) ;
// if (tmp120 == (ats_sum_ptr_type)0) { ats_deadcode_failure_handle () ; }
tmp121 = &ats_caselptrlab_mac(anairiats_sum_0, tmp120, atslab_0) ;
tmp122 = &ats_caselptrlab_mac(anairiats_sum_0, tmp120, atslab_2) ;
tmp123 = &ats_caselptrlab_mac(anairiats_sum_0, tmp120, atslab_3) ;
tmp125 = ats_ptrget_mac(ats_ptr_type, tmp122) ;
tmp124 = avltree_height_070_ats_int_type (tmp125) ;
tmp127 = ats_ptrget_mac(ats_ptr_type, tmp123) ;
tmp126 = avltree_height_070_ats_int_type (tmp127) ;
tmp129 = atspre_iadd (tmp126, 0) ;
tmp128 = atspre_ilte (tmp124, tmp129) ;
if (tmp128) {
tmp130 = atspre_iadd (tmp124, 1) ;
ats_ptrget_mac(ats_int_type, arg0) = tmp130 ;
tmp131 = ats_ptrget_mac(ats_ptr_type, tmp122) ;
ats_ptrget_mac(ats_ptr_type, arg4) = tmp131 ;
tmp133 = atspre_imax (tmp130, tmp126) ;
tmp132 = atspre_iadd (1, tmp133) ;
ats_ptrget_mac(ats_int_type, tmp121) = tmp132 ;
ats_ptrget_mac(ats_ptr_type, tmp122) = arg5 ;
tmp119 = tmp120 ;
} else {
tmp134 = ats_ptrget_mac(ats_ptr_type, tmp122) ;
// if (tmp134 == (ats_sum_ptr_type)0) { ats_deadcode_failure_handle () ; }
tmp135 = &ats_caselptrlab_mac(anairiats_sum_0, tmp134, atslab_0) ;
tmp136 = &ats_caselptrlab_mac(anairiats_sum_0, tmp134, atslab_2) ;
tmp137 = &ats_caselptrlab_mac(anairiats_sum_0, tmp134, atslab_3) ;
tmp139 = ats_ptrget_mac(ats_ptr_type, tmp136) ;
tmp138 = avltree_height_070_ats_int_type (tmp139) ;
tmp141 = ats_ptrget_mac(ats_ptr_type, tmp137) ;
tmp140 = avltree_height_070_ats_int_type (tmp141) ;
tmp143 = atspre_imax (arg1, tmp138) ;
tmp142 = atspre_iadd (1, tmp143) ;
ats_ptrget_mac(ats_int_type, arg0) = tmp142 ;
tmp144 = ats_ptrget_mac(ats_ptr_type, tmp136) ;
ats_ptrget_mac(ats_ptr_type, arg4) = tmp144 ;
tmp146 = atspre_imax (tmp140, tmp126) ;
tmp145 = atspre_iadd (1, tmp146) ;
ats_ptrget_mac(ats_int_type, tmp121) = tmp145 ;
tmp147 = ats_ptrget_mac(ats_ptr_type, tmp137) ;
ats_ptrget_mac(ats_ptr_type, tmp122) = tmp147 ;
ats_ptrget_mac(ats_int_type, tmp135) = arg3 ;
ats_ptrget_mac(ats_ptr_type, tmp136) = arg5 ;
ats_ptrget_mac(ats_ptr_type, tmp137) = tmp120 ;
tmp119 = tmp134 ;
} /* end of [if] */
return (tmp119) ;
} /* end of [avltree_lrotate_0100_ats_int_type] */

/*
// /home/hwxi/Research/ATS-Anairiats/libats/DATS/linset_avltree.dats: 8387(line=331, offs=5) -- 10085(line=382, offs=4)
*/
ATSstaticdec()
ats_bool_type
insert_35 (ats_clo_ref_type env0, ats_ref_type arg0, ats_int_type arg1) {
/* local vardec */
ATSlocal (ats_bool_type, tmp59) ;
ATSlocal (ats_ptr_type, tmp60) ;
ATSlocal (ats_ptr_type, tmp61) ;
ATSlocal (ats_ptr_type, tmp62) ;
ATSlocal (ats_ptr_type, tmp63) ;
ATSlocal (ats_int_type, tmp64) ;
ATSlocal (ats_int_type, tmp65) ;
ATSlocal (ats_bool_type, tmp66) ;
ATSlocal (ats_bool_type, tmp67) ;
ATSlocal (ats_int_type, tmp68) ;
ATSlocal (ats_ptr_type, tmp71) ;
ATSlocal (ats_int_type, tmp72) ;
ATSlocal (ats_ptr_type, tmp73) ;
ATSlocal (ats_bool_type, tmp74) ;
ATSlocal (ats_int_type, tmp75) ;
ATSlocal (ats_int_type, tmp76) ;
ATSlocal (ats_int_type, tmp77) ;
ATSlocal (ats_ptr_type, tmp78) ;
ATSlocal (ats_bool_type, tmp108) ;
ATSlocal (ats_bool_type, tmp109) ;
ATSlocal (ats_int_type, tmp110) ;
ATSlocal (ats_ptr_type, tmp111) ;
ATSlocal (ats_int_type, tmp112) ;
ATSlocal (ats_ptr_type, tmp113) ;
ATSlocal (ats_bool_type, tmp114) ;
ATSlocal (ats_int_type, tmp115) ;
ATSlocal (ats_int_type, tmp116) ;
ATSlocal (ats_int_type, tmp117) ;
ATSlocal (ats_ptr_type, tmp118) ;
ATSlocal (ats_ptr_type, tmp148) ;
ATSlocal (ats_ptr_type, tmp149) ;
ATSlocal (ats_ptr_type, tmp150) ;

__ats_lab_insert_35:
do {
/* branch: __ats_lab_6 */
__ats_lab_6_0:
if (ats_ptrget_mac(ats_ptr_type, arg0) == (ats_sum_ptr_type)0) { goto __ats_lab_9_0 ; }
__ats_lab_6_1:
tmp60 = &ats_caselptrlab_mac(anairiats_sum_0, ats_ptrget_mac(ats_ptr_type, arg0), atslab_0) ;
tmp61 = &ats_caselptrlab_mac(anairiats_sum_0, ats_ptrget_mac(ats_ptr_type, arg0), atslab_1) ;
tmp62 = &ats_caselptrlab_mac(anairiats_sum_0, ats_ptrget_mac(ats_ptr_type, arg0), atslab_2) ;
tmp63 = &ats_caselptrlab_mac(anairiats_sum_0, ats_ptrget_mac(ats_ptr_type, arg0), atslab_3) ;
tmp65 = ats_ptrget_mac(ats_int_type, tmp61) ;
tmp64 = compare_elt_elt_01770_ats_int_type (arg1, tmp65, env0) ;
tmp66 = atspre_lt_int_int (tmp64, 0) ;
if (tmp66) {
tmp67 = insert_35 (env0, tmp62, arg1) ;
tmp71 = ats_ptrget_mac(ats_ptr_type, tmp62) ;
tmp68 = avltree_height_070_ats_int_type (tmp71) ;
tmp73 = ats_ptrget_mac(ats_ptr_type, tmp63) ;
tmp72 = avltree_height_070_ats_int_type (tmp73) ;
tmp75 = atspre_isub (tmp68, tmp72) ;
tmp74 = atspre_ilte (tmp75, 1) ;
if (tmp74) {
tmp77 = atspre_imax (tmp68, tmp72) ;
tmp76 = atspre_iadd (1, tmp77) ;
ats_ptrget_mac(ats_int_type, tmp60) = tmp76 ;
tmp59 = tmp67 ;
} else {
tmp78 = avltree_rrotate_0124_ats_int_type (tmp60, tmp68, tmp62, tmp72, tmp63, ats_ptrget_mac(ats_ptr_type, arg0)) ;
ats_ptrget_mac(ats_ptr_type, arg0) = tmp78 ;
tmp59 = tmp67 ;
} /* end of [if] */
} else {
tmp108 = atspre_gt_int_int (tmp64, 0) ;
if (tmp108) {
tmp109 = insert_35 (env0, tmp63, arg1) ;
tmp111 = ats_ptrget_mac(ats_ptr_type, tmp62) ;
tmp110 = avltree_height_070_ats_int_type (tmp111) ;
tmp113 = ats_ptrget_mac(ats_ptr_type, tmp63) ;
tmp112 = avltree_height_070_ats_int_type (tmp113) ;
tmp115 = atspre_isub (tmp112, tmp110) ;
tmp114 = atspre_ilte (tmp115, 1) ;
if (tmp114) {
tmp117 = atspre_imax (tmp110, tmp112) ;
tmp116 = atspre_iadd (1, tmp117) ;
ats_ptrget_mac(ats_int_type, tmp60) = tmp116 ;
tmp59 = tmp109 ;
} else {
tmp118 = avltree_lrotate_0100_ats_int_type (tmp60, tmp110, tmp62, tmp112, tmp63, ats_ptrget_mac(ats_ptr_type, arg0)) ;
ats_ptrget_mac(ats_ptr_type, arg0) = tmp118 ;
tmp59 = tmp109 ;
} /* end of [if] */
} else {
tmp59 = ats_true_bool ;
} /* end of [if] */
} /* end of [if] */
break ;

/* branch: __ats_lab_9 */
__ats_lab_9_0:
// if (ats_ptrget_mac(ats_ptr_type, arg0) != (ats_sum_ptr_type)0) { ats_deadcode_failure_handle () ; }
__ats_lab_9_1:
tmp149 = (ats_sum_ptr_type)0 ;
tmp150 = (ats_sum_ptr_type)0 ;
tmp148 = ATS_MALLOC(sizeof(anairiats_sum_0)) ;
ats_selptrset_mac(anairiats_sum_0, tmp148, atslab_0, 1) ;
ats_selptrset_mac(anairiats_sum_0, tmp148, atslab_1, arg1) ;
ats_selptrset_mac(anairiats_sum_0, tmp148, atslab_2, tmp149) ;
ats_selptrset_mac(anairiats_sum_0, tmp148, atslab_3, tmp150) ;
ats_ptrget_mac(ats_ptr_type, arg0) = tmp148 ;
tmp59 = ats_false_bool ;
break ;
} while (0) ;
return (tmp59) ;
} /* end of [insert_35] */

typedef struct {
ats_fun_ptr_type closure_fun ;
ats_clo_ref_type closure_env_0 ;
} insert_35_closure_type ;

ats_bool_type
insert_35_clofun (ats_clo_ptr_type cloptr, ats_ref_type arg0, ats_int_type arg1) {
return insert_35 (((insert_35_closure_type*)cloptr)->closure_env_0, arg0, arg1) ;
} /* end of function */

ATSinline()
ats_void_type
insert_35_closure_init (insert_35_closure_type *p_clo, ats_clo_ref_type env0) {
p_clo->closure_fun = (ats_fun_ptr_type)&insert_35_clofun ;
p_clo->closure_env_0 = env0 ;
return ;
} /* end of function */

ats_clo_ptr_type
insert_35_closure_make (ats_clo_ref_type env0) {
insert_35_closure_type *p_clo = ATS_MALLOC(sizeof(insert_35_closure_type)) ;
insert_35_closure_init (p_clo, env0) ;
return (ats_clo_ptr_type)p_clo ;
} /* end of function */

/*
// /home/hwxi/Research/ATS-Anairiats/libats/DATS/linset_avltree.dats: 8360(line=329, offs=3) -- 10136(line=388, offs=4)
*/
ATSstaticdec()
ats_bool_type
linset_insert_01780_ats_int_type (ats_ref_type arg0, ats_int_type arg1, ats_clo_ref_type arg2) {
/* local vardec */
ATSlocal (ats_bool_type, tmp58) ;

__ats_lab_linset_insert_01780_ats_int_type:
tmp58 = insert_35 (arg2, arg0, arg1) ;
return (tmp58) ;
} /* end of [linset_insert_01780_ats_int_type] */

/*
// /home/hwxi/Research/ATS-Postiats/src/pats_stamp.dats: 4922(line=288, offs=3) -- 5011(line=291, offs=2)
*/
ATSglobaldec()
ats_ptr_type
_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__stampset_vt_add (ats_ptr_type arg0, ats_int_type arg1) {
/* local vardec */
ATSlocal (ats_ptr_type, tmp55) ;
ATSlocal (ats_ptr_type, tmp56) ;
ATSlocal (ats_bool_type, tmp57) ;

__ats_lab__2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__stampset_vt_add:
/* ats_ptr_type tmp56 ; */
tmp56 = arg0 ;
tmp57 = linset_insert_01780_ats_int_type ((&tmp56), arg1, statmp36) ;
tmp55 = tmp56 ;
return (tmp55) ;
} /* end of [_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__stampset_vt_add] */

/*
// /home/hwxi/Research/ATS-Anairiats/libats/DATS/linset_avltree.dats: 4427(line=171, offs=7) -- 4555(line=175, offs=18)
*/
ATSstaticdec()
ats_void_type
aux_41 (ats_ptr_type arg0) {
/* local vardec */
// ATSlocal_void (tmp153) ;
ATSlocal (ats_ptr_type, tmp154) ;
ATSlocal (ats_ptr_type, tmp155) ;
// ATSlocal_void (tmp156) ;

__ats_lab_aux_41:
do {
/* branch: __ats_lab_10 */
__ats_lab_10_0:
if (arg0 == (ats_sum_ptr_type)0) { goto __ats_lab_11_0 ; }
__ats_lab_10_1:
tmp154 = ats_caselptrlab_mac(anairiats_sum_0, arg0, atslab_2) ;
tmp155 = ats_caselptrlab_mac(anairiats_sum_0, arg0, atslab_3) ;
ATS_FREE(arg0) ;
/* tmp156 = */ aux_41 (tmp154) ;
arg0 = tmp155 ;
goto __ats_lab_aux_41 ; // tail call
break ;

/* branch: __ats_lab_11 */
__ats_lab_11_0:
// if (arg0 != (ats_sum_ptr_type)0) { ats_deadcode_failure_handle () ; }
__ats_lab_11_1:
break ;
} while (0) ;
return /* (tmp153) */ ;
} /* end of [aux_41] */

/*
// /home/hwxi/Research/ATS-Anairiats/libats/DATS/linset_avltree.dats: 4410(line=170, offs=13) -- 4591(line=179, offs=4)
*/
ATSstaticdec()
ats_void_type
linset_free_01778_ats_int_type (ats_ptr_type arg0) {
/* local vardec */
// ATSlocal_void (tmp152) ;

__ats_lab_linset_free_01778_ats_int_type:
/* tmp152 = */ aux_41 (arg0) ;
return /* (tmp152) */ ;
} /* end of [linset_free_01778_ats_int_type] */

/*
// /home/hwxi/Research/ATS-Postiats/src/pats_stamp.dats: 5068(line=294, offs=18) -- 5094(line=294, offs=44)
*/
ATSglobaldec()
ats_void_type
_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__stampset_vt_free (ats_ptr_type arg0) {
/* local vardec */
// ATSlocal_void (tmp151) ;

__ats_lab__2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__stampset_vt_free:
/* tmp151 = */ linset_free_01778_ats_int_type (arg0) ;
return /* (tmp151) */ ;
} /* end of [_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__stampset_vt_free] */

/* static load function */

extern ats_void_type _2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__staload (void) ;
extern ats_void_type _2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_counter_2esats__staload (void) ;
// extern ats_void_type ATS_2d0_2e2_2e12_2libats_2SATS_2linset_avltree_2esats__staload (void) ;
// extern ats_void_type ATS_2d0_2e2_2e12_2libats_2DATS_2linset_avltree_2edats__staload (void) ;

ats_void_type
_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2edats__staload () {
static int _2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2edats__staload_flag = 0 ;
if (_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2edats__staload_flag) return ;
_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2edats__staload_flag = 1 ;

_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2esats__staload () ;
_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_counter_2esats__staload () ;
// ATS_2d0_2e2_2e12_2libats_2SATS_2linset_avltree_2esats__staload () ;
// ATS_2d0_2e2_2e12_2libats_2DATS_2linset_avltree_2edats__staload () ;

return ;
} /* staload function */

/* dynamic load function */

// dynload flag declaration
extern ats_int_type _2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2edats__dynload_flag ;

ats_void_type
_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2edats__dynload () {
_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2edats__dynload_flag = 1 ;
_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_stamp_2edats__staload () ;

#ifdef _ATS_PROOFCHECK
#endif /* _ATS_PROOFCHECK */

/* marking static variables for GC */
ATS_GC_MARKROOT(&statmp9, sizeof(ats_ptr_type)) ;
ATS_GC_MARKROOT(&statmp11, sizeof(ats_ptr_type)) ;
ATS_GC_MARKROOT(&statmp13, sizeof(ats_ptr_type)) ;
ATS_GC_MARKROOT(&statmp15, sizeof(ats_ptr_type)) ;
ATS_GC_MARKROOT(&statmp17, sizeof(ats_ptr_type)) ;
ATS_GC_MARKROOT(&statmp19, sizeof(ats_ptr_type)) ;
ATS_GC_MARKROOT(&statmp21, sizeof(ats_ptr_type)) ;
ATS_GC_MARKROOT(&statmp23, sizeof(ats_ptr_type)) ;
ATS_GC_MARKROOT(&statmp25, sizeof(ats_ptr_type)) ;
ATS_GC_MARKROOT(&statmp27, sizeof(ats_ptr_type)) ;
ATS_GC_MARKROOT(&statmp29, sizeof(ats_ptr_type)) ;
ATS_GC_MARKROOT(&statmp31, sizeof(ats_ptr_type)) ;
ATS_GC_MARKROOT(&statmp33, sizeof(ats_ptr_type)) ;
ATS_GC_MARKROOT(&statmp36, sizeof(ats_ptr_type)) ;

/* marking external values for GC */

/* code for dynamic loading */
statmp9 = _2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_counter_2esats__counter_make () ;
statmp11 = _2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_counter_2esats__counter_make () ;
statmp13 = _2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_counter_2esats__counter_make () ;
statmp15 = _2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_counter_2esats__counter_make () ;
statmp17 = _2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_counter_2esats__counter_make () ;
statmp19 = _2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_counter_2esats__counter_make () ;
statmp21 = _2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_counter_2esats__counter_make () ;
statmp23 = _2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_counter_2esats__counter_make () ;
statmp25 = _2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_counter_2esats__counter_make () ;
statmp27 = _2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_counter_2esats__counter_make () ;
statmp29 = _2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_counter_2esats__counter_make () ;
statmp31 = _2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_counter_2esats__counter_make () ;
statmp33 = _2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_counter_2esats__counter_make () ;
statmp36 = __ats_fun_22_closure_make () ;
return ;
} /* end of [dynload function] */

/* external codes at mid */
/* external codes at bot */

/* ****** ****** */

/* end of [pats_stamp_dats.c] */
