/*
**
** The C code is generated by ATS/Anairiats
** The compilation time is: 2020-11-6:  1h:52m
**
*/

/* 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/bool.cats"
#include "prelude/CATS/char.cats"
#include "prelude/CATS/byte.cats"
#include "prelude/CATS/float.cats"
#include "prelude/CATS/integer.cats"
#include "prelude/CATS/integer_ptr.cats"
#include "prelude/CATS/integer_fixed.cats"
#include "prelude/CATS/sizetype.cats"
#include "prelude/CATS/pointer.cats"
#include "prelude/CATS/reference.cats"
#include "prelude/CATS/string.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 */

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_lexbuf.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_lexbuf.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_lexbuf.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_lexbuf.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_lexbuf.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_lexbuf.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_lexbuf.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_lexbuf.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_lexbuf.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_lexbuf.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_lexbuf.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_lexbuf.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_lexbuf.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_lexbuf.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_lexbuf.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_lexbuf.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_lexbuf.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_location.cats"

#include "pats_lexbuf.cats"

#include "pats_location.cats"

#include "pats_location.cats"
/* external codes at top */
/* type definitions */
typedef struct {
ats_ptr_type atslab_0 ;
ats_ptr_type atslab_1 ;
} anairiats_sum_0 ;

typedef
struct {
ats_ptr_type atslab_s2exp_srt ;
ats_ptr_type atslab_s2exp_node ;
} anairiats_rec_1 ;

typedef struct {
int tag ;
ats_ptr_type atslab_0 ;
ats_ptr_type atslab_1 ;
} anairiats_sum_2 ;

typedef struct {
int tag ;
ats_ptr_type atslab_0 ;
} anairiats_sum_3 ;

typedef struct {
ats_ptr_type atslab_0 ;
ats_ptr_type atslab_1 ;
ats_ptr_type atslab_2 ;
} anairiats_sum_4 ;

typedef struct {
ats_ptr_type atslab_0 ;
} anairiats_sum_5 ;

typedef
struct {
ats_ptr_type atslab_d2ecl_loc ;
ats_ptr_type atslab_d2ecl_node ;
} anairiats_rec_6 ;

typedef
struct {
ats_ptr_type atslab_e1xp_loc ;
ats_ptr_type atslab_e1xp_node ;
} anairiats_rec_7 ;

typedef struct {
int tag ;
ats_ptr_type atslab_0 ;
ats_int_type atslab_1 ;
ats_ptr_type atslab_2 ;
} anairiats_sum_8 ;

/* external typedefs */
/* external dynamic constructor declarations */
ATSextern_val(ats_sum_type, ATS_2d0_2e2_2e12_2prelude_2basics_sta_2esats__list_cons_0) ;
ATSextern_val(ats_sum_type, ATS_2d0_2e2_2e12_2prelude_2basics_sta_2esats__list_nil_1) ;
ATSextern_val(ats_sum_type, ATS_2d0_2e2_2e12_2prelude_2basics_sta_2esats__Some_1) ;
ATSextern_val(ats_sum_type, ATS_2d0_2e2_2e12_2prelude_2basics_sta_2esats__None_vt_0) ;
ATSextern_val(ats_sum_type, ATS_2d0_2e2_2e12_2prelude_2basics_sta_2esats__Some_vt_1) ;
ATSextern_val(ats_sum_type, _2tmp_2ATS_2dPostiats_2src_2pats_staexp1_2esats__E1XPide_0) ;
ATSextern_val(ats_sum_type, _2tmp_2ATS_2dPostiats_2src_2pats_staexp1_2esats__E1XPstring_5) ;
ATSextern_val(ats_sum_type, _2tmp_2ATS_2dPostiats_2src_2pats_staexp2_2esats__SLABELED_0) ;
ATSextern_val(ats_sum_type, _2tmp_2ATS_2dPostiats_2src_2pats_staexp2_2esats__S2Ecst_4) ;
ATSextern_val(ats_sum_type, _2tmp_2ATS_2dPostiats_2src_2pats_staexp2_2esats__S2Eapp_17) ;
ATSextern_val(ats_sum_type, _2tmp_2ATS_2dPostiats_2src_2pats_staexp2_2esats__S2Elam_18) ;
ATSextern_val(ats_sum_type, _2tmp_2ATS_2dPostiats_2src_2pats_staexp2_2esats__S2Etyrec_25) ;
ATSextern_val(ats_sum_type, _2tmp_2ATS_2dPostiats_2src_2pats_codegen2_absrec_2edats__ABSRECFLDget_0) ;
ATSextern_val(ats_sum_type, _2tmp_2ATS_2dPostiats_2src_2pats_codegen2_absrec_2edats__ABSRECFLDset_1) ;
ATSextern_val(ats_sum_type, _2tmp_2ATS_2dPostiats_2src_2pats_codegen2_absrec_2edats__ABSRECFLDgetset_2) ;
ATSextern_val(ats_sum_type, _2tmp_2ATS_2dPostiats_2src_2pats_codegen2_absrec_2edats__ABSRECFLDexch_3) ;
ATSextern_val(ats_sum_type, _2tmp_2ATS_2dPostiats_2src_2pats_codegen2_absrec_2edats__ABSRECFLDgetref_4) ;
ATSextern_val(ats_sum_type, _2tmp_2ATS_2dPostiats_2src_2pats_codegen2_absrec_2edats__ABSRECFLDunknown_5) ;

/* external dynamic constant declarations */
ATSextern_fun(ats_void_type, atspre_fprint_newline) (ats_ptr_type) ;
ATSextern_fun(ats_bool_type, atspre_neg_bool) (ats_bool_type) ;
ATSextern_fun(ats_int_type, atspre_add_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_bool_type, atspre_eq_string_string) (ats_ptr_type, ats_ptr_type) ;
ATSextern_fun(ats_void_type, atspre_fprint_string) (ats_ptr_type, ats_ptr_type) ;
ATSextern_fun(ats_ptr_type, atspre_string_append) (ats_ptr_type, ats_ptr_type) ;
ATSextern_fun(ats_ptr_type, _2tmp_2ATS_2dPostiats_2src_2pats_symbol_2esats__symbol_get_name) (ats_ptr_type) ;
ATSextern_fun(ats_void_type, _2tmp_2ATS_2dPostiats_2src_2pats_label_2esats__fprint_label) (ats_ptr_type, ats_ptr_type) ;
ATSextern_fun(ats_void_type, _2tmp_2ATS_2dPostiats_2src_2pats_location_2esats__fprint_location) (ats_ptr_type, ats_ptr_type) ;
ATSextern_fun(ats_bool_type, _2tmp_2ATS_2dPostiats_2src_2pats_staexp2_2esats__s2rt_is_lin_fun) (ats_ptr_type) ;
ATSextern_fun(ats_bool_type, _2tmp_2ATS_2dPostiats_2src_2pats_staexp2_2esats__s2rt_is_boxed_fun) (ats_ptr_type) ;
ATSextern_fun(ats_ptr_type, _2tmp_2ATS_2dPostiats_2src_2pats_staexp2_2esats__s2cst_get_sym) (ats_ptr_type) ;
ATSextern_fun(ats_ptr_type, _2tmp_2ATS_2dPostiats_2src_2pats_staexp2_2esats__s2cst_get_srt) (ats_ptr_type) ;
ATSextern_fun(ats_ptr_type, _2tmp_2ATS_2dPostiats_2src_2pats_staexp2_2esats__s2cst_get_def) (ats_ptr_type) ;
ATSextern_fun(ats_void_type, _2tmp_2ATS_2dPostiats_2src_2pats_staexp2_2esats__fprint_s2cst) (ats_ptr_type, ats_ptr_type) ;
ATSextern_fun(ats_ptr_type, _2tmp_2ATS_2dPostiats_2src_2pats_staexp2_2esats__s2var_get_srt) (ats_ptr_type) ;
ATSextern_fun(ats_ptr_type, _2tmp_2ATS_2dPostiats_2src_2pats_codegen2_2esats__codegen2_get_tydef) (ats_ptr_type) ;
ATSextern_fun(ats_void_type, _2tmp_2ATS_2dPostiats_2src_2pats_codegen2_2esats__codegen2_emit_s2rt) (ats_ptr_type, ats_ptr_type) ;
ATSextern_fun(ats_void_type, _2tmp_2ATS_2dPostiats_2src_2pats_codegen2_2esats__codegen2_emit_s2var) (ats_ptr_type, ats_ptr_type) ;
ATSextern_fun(ats_void_type, _2tmp_2ATS_2dPostiats_2src_2pats_codegen2_2esats__codegen2_emit_s2exp) (ats_ptr_type, ats_ptr_type) ;
ATSextern_fun(ats_void_type, _2tmp_2ATS_2dPostiats_2src_2pats_codegen2_absrec_2edats__absrec_emit_tydef_uni) (ats_ptr_type, ats_ptr_type) ;
ATSextern_fun(ats_void_type, _2tmp_2ATS_2dPostiats_2src_2pats_codegen2_absrec_2edats__absrec_emit_tydef_arg) (ats_ptr_type, ats_ptr_type) ;
ATSextern_fun(ats_ptr_type, _2tmp_2ATS_2dPostiats_2src_2pats_codegen2_absrec_2edats__absrecfld_of_s2exp) (ats_ptr_type) ;
ATSextern_fun(ats_void_type, _2tmp_2ATS_2dPostiats_2src_2pats_codegen2_absrec_2edats__absrec_emit_tyrecfld) (ats_ptr_type, ats_ptr_type, ats_ptr_type, ats_ptr_type) ;
ATSextern_fun(ats_void_type, _2tmp_2ATS_2dPostiats_2src_2pats_codegen2_absrec_2edats__absrec_emit_tyrecfldlst) (ats_ptr_type, ats_ptr_type, ats_ptr_type, ats_ptr_type) ;
ATSextern_fun(ats_ptr_type, _2tmp_2ATS_2dPostiats_2src_2pats_codegen2_absrec_2edats__absrec_s2cst_get_tyrec) (ats_ptr_type) ;

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

/* assuming abstract types */
/* sum constructor declarations */
ATSglobal(ats_sum_type, _2tmp_2ATS_2dPostiats_2src_2pats_codegen2_absrec_2edats__ABSRECFLDget_0) ;
ATSglobal(ats_sum_type, _2tmp_2ATS_2dPostiats_2src_2pats_codegen2_absrec_2edats__ABSRECFLDset_1) ;
ATSglobal(ats_sum_type, _2tmp_2ATS_2dPostiats_2src_2pats_codegen2_absrec_2edats__ABSRECFLDgetset_2) ;
ATSglobal(ats_sum_type, _2tmp_2ATS_2dPostiats_2src_2pats_codegen2_absrec_2edats__ABSRECFLDexch_3) ;
ATSglobal(ats_sum_type, _2tmp_2ATS_2dPostiats_2src_2pats_codegen2_absrec_2edats__ABSRECFLDgetref_4) ;
ATSglobal(ats_sum_type, _2tmp_2ATS_2dPostiats_2src_2pats_codegen2_absrec_2edats__ABSRECFLDunknown_5) ;

/* exn constructor declarations */
/* global dynamic (non-functional) constant declarations */
/* internal function declarations */
static
ats_ptr_type s2cst_get_name_0 (ats_ptr_type arg0) ;
static
ats_void_type aux_s2varlst_2 (ats_ptr_type arg0, ats_ptr_type arg1, ats_int_type arg2) ;
static
ats_void_type aux_s2varlst_4 (ats_ptr_type arg0, ats_ptr_type arg1, ats_int_type arg2) ;
static
ats_void_type auxdecl_8 (ats_ptr_type env0, ats_ptr_type env1, ats_ptr_type env2, ats_ptr_type env3, ats_ptr_type arg0, ats_ptr_type arg1) ;
static
ats_clo_ptr_type auxdecl_8_closure_make (ats_ptr_type env0, ats_ptr_type env1, ats_ptr_type env2, ats_ptr_type env3) ;
static
ats_void_type auxdecl_8_clofun (ats_clo_ptr_type cloptr, ats_ptr_type arg0, ats_ptr_type arg1) ;
static
ats_void_type auxproc_7 (ats_ptr_type env0, ats_ptr_type env1, ats_ptr_type env2, ats_ptr_type env3, ats_ptr_type arg0) ;
static
ats_clo_ptr_type auxproc_7_closure_make (ats_ptr_type env0, ats_ptr_type env1, ats_ptr_type env2, ats_ptr_type env3) ;
static
ats_void_type auxproc_7_clofun (ats_clo_ptr_type cloptr, ats_ptr_type arg0) ;
static
ats_ptr_type auxget_11 (ats_ptr_type arg0) ;
static
ats_void_type auxerr_nil_12 (ats_ptr_type arg0, ats_ptr_type arg1) ;
static
ats_void_type auxerr_s2cst_13 (ats_ptr_type arg0, ats_ptr_type arg1) ;
static
ats_void_type auxerr_s2cst_tyrec_14 (ats_ptr_type arg0, ats_ptr_type arg1, ats_ptr_type arg2) ;
static
ats_void_type aux_tydef_15 (ats_ptr_type arg0, ats_ptr_type arg1, ats_ptr_type arg2, ats_ptr_type arg3) ;
static
ats_void_type aux_tydef_tyrec_16 (ats_ptr_type arg0, ats_ptr_type arg1, ats_ptr_type arg2, ats_ptr_type arg3, ats_ptr_type arg4) ;

/* partial value template declarations */
/* static temporary variable declarations */
/* external value variable declarations */

/* function implementations */

/*
// /tmp/ATS-Postiats/src/pats_codegen2_absrec.dats: 1861(line=70, offs=1) -- 1947(line=74, offs=2)
*/
ATSstaticdec()
ats_ptr_type
s2cst_get_name_0 (ats_ptr_type arg0) {
/* local vardec */
ATSlocal (ats_ptr_type, tmp0) ;
ATSlocal (ats_ptr_type, tmp1) ;

__ats_lab_s2cst_get_name_0:
tmp1 = _2tmp_2ATS_2dPostiats_2src_2pats_staexp2_2esats__s2cst_get_sym (arg0) ;
tmp0 = _2tmp_2ATS_2dPostiats_2src_2pats_symbol_2esats__symbol_get_name (tmp1) ;
return (tmp0) ;
} /* end of [s2cst_get_name_0] */

/*
// /tmp/ATS-Postiats/src/pats_codegen2_absrec.dats: 2155(line=90, offs=1) -- 2616(line=115, offs=2)
*/
ATSstaticdec()
ats_void_type
aux_s2varlst_2 (ats_ptr_type arg0, ats_ptr_type arg1, ats_int_type arg2) {
/* local vardec */
// ATSlocal_void (tmp3) ;
ATSlocal (ats_ptr_type, tmp4) ;
ATSlocal (ats_ptr_type, tmp5) ;
// ATSlocal_void (tmp6) ;
ATSlocal (ats_bool_type, tmp7) ;
ATSlocal (ats_ptr_type, tmp8) ;
// ATSlocal_void (tmp9) ;
// ATSlocal_void (tmp10) ;
// ATSlocal_void (tmp11) ;
ATSlocal (ats_int_type, tmp12) ;

__ats_lab_aux_s2varlst_2:
do {
/* branch: __ats_lab_0 */
__ats_lab_0_0:
if (arg1 != (ats_sum_ptr_type)0) { goto __ats_lab_1_0 ; }
__ats_lab_0_1:
break ;

/* branch: __ats_lab_1 */
__ats_lab_1_0:
// if (arg1 == (ats_sum_ptr_type)0) { ats_deadcode_failure_handle () ; }
__ats_lab_1_1:
tmp4 = ats_caselptrlab_mac(anairiats_sum_0, arg1, atslab_0) ;
tmp5 = ats_caselptrlab_mac(anairiats_sum_0, arg1, atslab_1) ;
tmp7 = atspre_gt_int_int (arg2, 0) ;
if (tmp7) {
/* tmp6 = */ atspre_fprint_string (arg0, ATSstrcst(";")) ;
} else {
/* empty */
} /* end of [if] */
tmp8 = _2tmp_2ATS_2dPostiats_2src_2pats_staexp2_2esats__s2var_get_srt (tmp4) ;
/* tmp9 = */ _2tmp_2ATS_2dPostiats_2src_2pats_codegen2_2esats__codegen2_emit_s2var (arg0, tmp4) ;
/* tmp10 = */ atspre_fprint_string (arg0, ATSstrcst(":")) ;
/* tmp11 = */ _2tmp_2ATS_2dPostiats_2src_2pats_codegen2_2esats__codegen2_emit_s2rt (arg0, tmp8) ;
tmp12 = atspre_add_int_int (arg2, 1) ;
arg0 = arg0 ;
arg1 = tmp5 ;
arg2 = tmp12 ;
goto __ats_lab_aux_s2varlst_2 ; // tail call
break ;
} while (0) ;
return /* (tmp3) */ ;
} /* end of [aux_s2varlst_2] */

/*
// /tmp/ATS-Postiats/src/pats_codegen2_absrec.dats: 2130(line=87, offs=3) -- 2940(line=134, offs=4)
*/
ATSglobaldec()
ats_void_type
_2tmp_2ATS_2dPostiats_2src_2pats_codegen2_absrec_2edats__absrec_emit_tydef_uni (ats_ptr_type arg0, ats_ptr_type arg1) {
/* local vardec */
// ATSlocal_void (tmp2) ;
ATSlocal (ats_ptr_type, tmp13) ;
ATSlocal (ats_ptr_type, tmp14) ;
ATSlocal (ats_ptr_type, tmp15) ;
// ATSlocal_void (tmp16) ;
// ATSlocal_void (tmp17) ;
// ATSlocal_void (tmp18) ;

__ats_lab__2tmp_2ATS_2dPostiats_2src_2pats_codegen2_absrec_2edats__absrec_emit_tydef_uni:
tmp13 = ats_selbox_mac(ats_castptr_mac(anairiats_rec_1, arg1), atslab_s2exp_node) ;
do {
/* branch: __ats_lab_2 */
__ats_lab_2_0:
if (((ats_sum_ptr_type)tmp13)->tag != 18) { goto __ats_lab_3_0 ; }
__ats_lab_2_1:
tmp14 = ats_caselptrlab_mac(anairiats_sum_2, tmp13, atslab_0) ;
tmp15 = ats_caselptrlab_mac(anairiats_sum_2, tmp13, atslab_1) ;
/* tmp16 = */ atspre_fprint_string (arg0, ATSstrcst("{")) ;
/* tmp17 = */ aux_s2varlst_2 (arg0, tmp14, 0) ;
/* tmp18 = */ atspre_fprint_string (arg0, ATSstrcst("}")) ;
arg0 = arg0 ;
arg1 = tmp15 ;
goto __ats_lab__2tmp_2ATS_2dPostiats_2src_2pats_codegen2_absrec_2edats__absrec_emit_tydef_uni ; // tail call
break ;

/* branch: __ats_lab_3 */
__ats_lab_3_0:
__ats_lab_3_1:
break ;
} while (0) ;
return /* (tmp2) */ ;
} /* end of [_2tmp_2ATS_2dPostiats_2src_2pats_codegen2_absrec_2edats__absrec_emit_tydef_uni] */

/*
// /tmp/ATS-Postiats/src/pats_codegen2_absrec.dats: 3154(line=150, offs=1) -- 3520(line=173, offs=2)
*/
ATSstaticdec()
ats_void_type
aux_s2varlst_4 (ats_ptr_type arg0, ats_ptr_type arg1, ats_int_type arg2) {
/* local vardec */
// ATSlocal_void (tmp20) ;
ATSlocal (ats_ptr_type, tmp21) ;
ATSlocal (ats_ptr_type, tmp22) ;
// ATSlocal_void (tmp23) ;
ATSlocal (ats_bool_type, tmp24) ;
// ATSlocal_void (tmp25) ;
ATSlocal (ats_int_type, tmp26) ;

__ats_lab_aux_s2varlst_4:
do {
/* branch: __ats_lab_4 */
__ats_lab_4_0:
if (arg1 != (ats_sum_ptr_type)0) { goto __ats_lab_5_0 ; }
__ats_lab_4_1:
break ;

/* branch: __ats_lab_5 */
__ats_lab_5_0:
// if (arg1 == (ats_sum_ptr_type)0) { ats_deadcode_failure_handle () ; }
__ats_lab_5_1:
tmp21 = ats_caselptrlab_mac(anairiats_sum_0, arg1, atslab_0) ;
tmp22 = ats_caselptrlab_mac(anairiats_sum_0, arg1, atslab_1) ;
tmp24 = atspre_gt_int_int (arg2, 0) ;
if (tmp24) {
/* tmp23 = */ atspre_fprint_string (arg0, ATSstrcst(", ")) ;
} else {
/* empty */
} /* end of [if] */
/* tmp25 = */ _2tmp_2ATS_2dPostiats_2src_2pats_codegen2_2esats__codegen2_emit_s2var (arg0, tmp21) ;
tmp26 = atspre_add_int_int (arg2, 1) ;
arg0 = arg0 ;
arg1 = tmp22 ;
arg2 = tmp26 ;
goto __ats_lab_aux_s2varlst_4 ; // tail call
break ;
} while (0) ;
return /* (tmp20) */ ;
} /* end of [aux_s2varlst_4] */

/*
// /tmp/ATS-Postiats/src/pats_codegen2_absrec.dats: 3129(line=147, offs=3) -- 3844(line=192, offs=4)
*/
ATSglobaldec()
ats_void_type
_2tmp_2ATS_2dPostiats_2src_2pats_codegen2_absrec_2edats__absrec_emit_tydef_arg (ats_ptr_type arg0, ats_ptr_type arg1) {
/* local vardec */
// ATSlocal_void (tmp19) ;
ATSlocal (ats_ptr_type, tmp27) ;
ATSlocal (ats_ptr_type, tmp28) ;
ATSlocal (ats_ptr_type, tmp29) ;
// ATSlocal_void (tmp30) ;
// ATSlocal_void (tmp31) ;
// ATSlocal_void (tmp32) ;

__ats_lab__2tmp_2ATS_2dPostiats_2src_2pats_codegen2_absrec_2edats__absrec_emit_tydef_arg:
tmp27 = ats_selbox_mac(ats_castptr_mac(anairiats_rec_1, arg1), atslab_s2exp_node) ;
do {
/* branch: __ats_lab_6 */
__ats_lab_6_0:
if (((ats_sum_ptr_type)tmp27)->tag != 18) { goto __ats_lab_7_0 ; }
__ats_lab_6_1:
tmp28 = ats_caselptrlab_mac(anairiats_sum_2, tmp27, atslab_0) ;
tmp29 = ats_caselptrlab_mac(anairiats_sum_2, tmp27, atslab_1) ;
/* tmp30 = */ atspre_fprint_string (arg0, ATSstrcst("(")) ;
/* tmp31 = */ aux_s2varlst_4 (arg0, tmp28, 0) ;
/* tmp32 = */ atspre_fprint_string (arg0, ATSstrcst(")")) ;
arg0 = arg0 ;
arg1 = tmp29 ;
goto __ats_lab__2tmp_2ATS_2dPostiats_2src_2pats_codegen2_absrec_2edats__absrec_emit_tydef_arg ; // tail call
break ;

/* branch: __ats_lab_7 */
__ats_lab_7_0:
__ats_lab_7_1:
break ;
} while (0) ;
return /* (tmp19) */ ;
} /* end of [_2tmp_2ATS_2dPostiats_2src_2pats_codegen2_absrec_2edats__absrec_emit_tydef_arg] */

/*
// /tmp/ATS-Postiats/src/pats_codegen2_absrec.dats: 4289(line=223, offs=3) -- 5604(line=292, offs=4)
*/
ATSglobaldec()
ats_ptr_type
_2tmp_2ATS_2dPostiats_2src_2pats_codegen2_absrec_2edats__absrecfld_of_s2exp (ats_ptr_type arg0) {
/* local vardec */
ATSlocal (ats_ptr_type, tmp33) ;
ATSlocal (ats_ptr_type, tmp34) ;
ATSlocal (ats_ptr_type, tmp35) ;
ATSlocal (ats_ptr_type, tmp36) ;
ATSlocal (ats_ptr_type, tmp37) ;
ATSlocal (ats_ptr_type, tmp38) ;
ATSlocal (ats_ptr_type, tmp39) ;
ATSlocal (ats_ptr_type, tmp40) ;
ATSlocal (ats_ptr_type, tmp41) ;
ATSlocal (ats_bool_type, tmp42) ;
ATSlocal (ats_bool_type, tmp43) ;
ATSlocal (ats_bool_type, tmp44) ;
ATSlocal (ats_bool_type, tmp45) ;
ATSlocal (ats_bool_type, tmp46) ;

__ats_lab__2tmp_2ATS_2dPostiats_2src_2pats_codegen2_absrec_2edats__absrecfld_of_s2exp:
tmp34 = ats_selbox_mac(ats_castptr_mac(anairiats_rec_1, arg0), atslab_s2exp_node) ;
do {
/* branch: __ats_lab_8 */
__ats_lab_8_0:
if (((ats_sum_ptr_type)tmp34)->tag != 17) { goto __ats_lab_9_0 ; }
tmp35 = ats_caselptrlab_mac(anairiats_sum_2, tmp34, atslab_1) ;
if (tmp35 != (ats_sum_ptr_type)0) { goto __ats_lab_9_0 ; }
__ats_lab_8_1:
tmp33 = ATS_MALLOC(sizeof(anairiats_sum_3)) ;
((ats_sum_ptr_type)tmp33)->tag = 5 ;
ats_selptrset_mac(anairiats_sum_3, tmp33, atslab_0, arg0) ;
break ;

/* branch: __ats_lab_9 */
__ats_lab_9_0:
if (((ats_sum_ptr_type)tmp34)->tag != 17) { goto __ats_lab_18_0 ; }
tmp36 = ats_caselptrlab_mac(anairiats_sum_2, tmp34, atslab_1) ;
if (tmp36 == (ats_sum_ptr_type)0) { goto __ats_lab_18_0 ; }
__ats_lab_9_1:
tmp37 = ats_caselptrlab_mac(anairiats_sum_2, tmp34, atslab_0) ;
tmp38 = ats_caselptrlab_mac(anairiats_sum_0, tmp36, atslab_0) ;
tmp39 = ats_selbox_mac(ats_castptr_mac(anairiats_rec_1, tmp37), atslab_s2exp_node) ;
do {
/* branch: __ats_lab_10 */
__ats_lab_10_0:
if (((ats_sum_ptr_type)tmp39)->tag != 4) { goto __ats_lab_17_0 ; }
__ats_lab_10_1:
tmp40 = ats_caselptrlab_mac(anairiats_sum_3, tmp39, atslab_0) ;
tmp41 = s2cst_get_name_0 (tmp40) ;
do {
/* branch: __ats_lab_11 */
__ats_lab_11_0:
__ats_lab_11_1:
tmp42 = atspre_eq_string_string (tmp41, ATSstrcst("get")) ;
if (!tmp42) { goto __ats_lab_12_1 ; }
tmp33 = ATS_MALLOC(sizeof(anairiats_sum_3)) ;
((ats_sum_ptr_type)tmp33)->tag = 0 ;
ats_selptrset_mac(anairiats_sum_3, tmp33, atslab_0, tmp38) ;
break ;

/* branch: __ats_lab_12 */
__ats_lab_12_0:
__ats_lab_12_1:
tmp43 = atspre_eq_string_string (tmp41, ATSstrcst("set")) ;
if (!tmp43) { goto __ats_lab_13_1 ; }
tmp33 = ATS_MALLOC(sizeof(anairiats_sum_3)) ;
((ats_sum_ptr_type)tmp33)->tag = 1 ;
ats_selptrset_mac(anairiats_sum_3, tmp33, atslab_0, tmp38) ;
break ;

/* branch: __ats_lab_13 */
__ats_lab_13_0:
__ats_lab_13_1:
tmp44 = atspre_eq_string_string (tmp41, ATSstrcst("getset")) ;
if (!tmp44) { goto __ats_lab_14_1 ; }
tmp33 = ATS_MALLOC(sizeof(anairiats_sum_3)) ;
((ats_sum_ptr_type)tmp33)->tag = 2 ;
ats_selptrset_mac(anairiats_sum_3, tmp33, atslab_0, tmp38) ;
break ;

/* branch: __ats_lab_14 */
__ats_lab_14_0:
__ats_lab_14_1:
tmp45 = atspre_eq_string_string (tmp41, ATSstrcst("exch")) ;
if (!tmp45) { goto __ats_lab_15_1 ; }
tmp33 = ATS_MALLOC(sizeof(anairiats_sum_3)) ;
((ats_sum_ptr_type)tmp33)->tag = 3 ;
ats_selptrset_mac(anairiats_sum_3, tmp33, atslab_0, tmp38) ;
break ;

/* branch: __ats_lab_15 */
__ats_lab_15_0:
__ats_lab_15_1:
tmp46 = atspre_eq_string_string (tmp41, ATSstrcst("getref")) ;
if (!tmp46) { goto __ats_lab_16_1 ; }
tmp33 = ATS_MALLOC(sizeof(anairiats_sum_3)) ;
((ats_sum_ptr_type)tmp33)->tag = 4 ;
ats_selptrset_mac(anairiats_sum_3, tmp33, atslab_0, tmp38) ;
break ;

/* branch: __ats_lab_16 */
__ats_lab_16_0:
__ats_lab_16_1:
tmp33 = ATS_MALLOC(sizeof(anairiats_sum_3)) ;
((ats_sum_ptr_type)tmp33)->tag = 5 ;
ats_selptrset_mac(anairiats_sum_3, tmp33, atslab_0, arg0) ;
break ;
} while (0) ;
break ;

/* branch: __ats_lab_17 */
__ats_lab_17_0:
__ats_lab_17_1:
tmp33 = ATS_MALLOC(sizeof(anairiats_sum_3)) ;
((ats_sum_ptr_type)tmp33)->tag = 5 ;
ats_selptrset_mac(anairiats_sum_3, tmp33, atslab_0, arg0) ;
break ;
} while (0) ;
break ;

/* branch: __ats_lab_18 */
__ats_lab_18_0:
__ats_lab_18_1:
tmp33 = ATS_MALLOC(sizeof(anairiats_sum_3)) ;
((ats_sum_ptr_type)tmp33)->tag = 5 ;
ats_selptrset_mac(anairiats_sum_3, tmp33, atslab_0, arg0) ;
break ;
} while (0) ;
return (tmp33) ;
} /* end of [_2tmp_2ATS_2dPostiats_2src_2pats_codegen2_absrec_2edats__absrecfld_of_s2exp] */

/*
// /tmp/ATS-Postiats/src/pats_codegen2_absrec.dats: 6001(line=323, offs=1) -- 6833(line=382, offs=2)
*/
ATSstaticdec()
ats_void_type
auxdecl_8 (ats_ptr_type env0, ats_ptr_type env1, ats_ptr_type env2, ats_ptr_type env3, ats_ptr_type arg0, ats_ptr_type arg1) {
/* local vardec */
// ATSlocal_void (tmp52) ;
ATSlocal (ats_ptr_type, tmp53) ;
ATSlocal (ats_ptr_type, tmp54) ;
ATSlocal (ats_ptr_type, tmp55) ;
// ATSlocal_void (tmp56) ;
// ATSlocal_void (tmp57) ;
// ATSlocal_void (tmp58) ;
// ATSlocal_void (tmp59) ;
// ATSlocal_void (tmp60) ;
// ATSlocal_void (tmp61) ;
// ATSlocal_void (tmp62) ;
// ATSlocal_void (tmp63) ;
// ATSlocal_void (tmp64) ;
ATSlocal (ats_bool_type, tmp65) ;
ATSlocal (ats_bool_type, tmp66) ;
// ATSlocal_void (tmp67) ;
ATSlocal (ats_bool_type, tmp68) ;
ATSlocal (ats_bool_type, tmp69) ;
// ATSlocal_void (tmp70) ;
// ATSlocal_void (tmp71) ;
// ATSlocal_void (tmp72) ;
// ATSlocal_void (tmp73) ;
// ATSlocal_void (tmp74) ;

__ats_lab_auxdecl_8:
tmp53 = _2tmp_2ATS_2dPostiats_2src_2pats_staexp2_2esats__s2cst_get_srt (env1) ;
tmp54 = _2tmp_2ATS_2dPostiats_2src_2pats_staexp2_2esats__s2cst_get_def (env1) ;
if (tmp54 == (ats_sum_ptr_type)0) { ats_caseof_failure_handle ("/tmp/ATS-Postiats/src/pats_codegen2_absrec.dats: 6098(line=332, offs=1) -- 6131(line=332, offs=34)") ; }
tmp55 = ats_caselptrlab_mac(anairiats_sum_5, tmp54, atslab_0) ;
/* tmp56 = */ atspre_fprint_string (env0, ATSstrcst("extern\nfun{}\n")) ;
/* tmp57 = */ atspre_fprint_string (env0, env2) ;
/* tmp58 = */ atspre_fprint_string (env0, arg0) ;
/* tmp59 = */ atspre_fprint_string (env0, ATSstrcst("_")) ;
/* tmp60 = */ _2tmp_2ATS_2dPostiats_2src_2pats_label_2esats__fprint_label (env0, env3) ;
/* tmp61 = */ _2tmp_2ATS_2dPostiats_2src_2pats_codegen2_absrec_2edats__absrec_emit_tydef_uni (env0, tmp55) ;
/* tmp62 = */ atspre_fprint_string (env0, ATSstrcst(" : absrec_")) ;
/* tmp63 = */ atspre_fprint_string (env0, arg0) ;
/* tmp64 = */ atspre_fprint_string (env0, ATSstrcst("_fun_")) ;
tmp65 = _2tmp_2ATS_2dPostiats_2src_2pats_staexp2_2esats__s2rt_is_lin_fun (tmp53) ;
tmp66 = _2tmp_2ATS_2dPostiats_2src_2pats_staexp2_2esats__s2rt_is_boxed_fun (tmp53) ;
if (tmp66) {
tmp68 = atspre_neg_bool (tmp65) ;
if (tmp68) {
/* tmp67 = */ atspre_fprint_string (env0, ATSstrcst("type")) ;
} else {
/* tmp67 = */ atspre_fprint_string (env0, ATSstrcst("vtype")) ;
} /* end of [if] */
} else {
tmp69 = atspre_neg_bool (tmp65) ;
if (tmp69) {
/* tmp67 = */ atspre_fprint_string (env0, ATSstrcst("t0ype")) ;
} else {
/* tmp67 = */ atspre_fprint_string (env0, ATSstrcst("vt0ype")) ;
} /* end of [if] */
} /* end of [if] */
/* tmp70 = */ atspre_fprint_string (env0, ATSstrcst("(")) ;
/* tmp71 = */ _2tmp_2ATS_2dPostiats_2src_2pats_staexp2_2esats__fprint_s2cst (env0, env1) ;
/* tmp72 = */ _2tmp_2ATS_2dPostiats_2src_2pats_codegen2_absrec_2edats__absrec_emit_tydef_arg (env0, tmp55) ;
/* tmp73 = */ atspre_fprint_string (env0, ATSstrcst(", ")) ;
/* tmp74 = */ _2tmp_2ATS_2dPostiats_2src_2pats_codegen2_2esats__codegen2_emit_s2exp (env0, arg1) ;
/* tmp52 = */ atspre_fprint_string (env0, ATSstrcst(")\n")) ;
return /* (tmp52) */ ;
} /* end of [auxdecl_8] */

typedef struct {
ats_fun_ptr_type closure_fun ;
ats_ptr_type closure_env_0 ;
ats_ptr_type closure_env_1 ;
ats_ptr_type closure_env_2 ;
ats_ptr_type closure_env_3 ;
} auxdecl_8_closure_type ;

ats_void_type
auxdecl_8_clofun (ats_clo_ptr_type cloptr, ats_ptr_type arg0, ats_ptr_type arg1) {
auxdecl_8 (((auxdecl_8_closure_type*)cloptr)->closure_env_0, ((auxdecl_8_closure_type*)cloptr)->closure_env_1, ((auxdecl_8_closure_type*)cloptr)->closure_env_2, ((auxdecl_8_closure_type*)cloptr)->closure_env_3, arg0, arg1) ; return ;
} /* end of function */

ATSinline()
ats_void_type
auxdecl_8_closure_init (auxdecl_8_closure_type *p_clo, ats_ptr_type env0, ats_ptr_type env1, ats_ptr_type env2, ats_ptr_type env3) {
p_clo->closure_fun = (ats_fun_ptr_type)&auxdecl_8_clofun ;
p_clo->closure_env_0 = env0 ;
p_clo->closure_env_1 = env1 ;
p_clo->closure_env_2 = env2 ;
p_clo->closure_env_3 = env3 ;
return ;
} /* end of function */

ats_clo_ptr_type
auxdecl_8_closure_make (ats_ptr_type env0, ats_ptr_type env1, ats_ptr_type env2, ats_ptr_type env3) {
auxdecl_8_closure_type *p_clo = ATS_MALLOC(sizeof(auxdecl_8_closure_type)) ;
auxdecl_8_closure_init (p_clo, env0, env1, env2, env3) ;
return (ats_clo_ptr_type)p_clo ;
} /* end of function */

/*
// /tmp/ATS-Postiats/src/pats_codegen2_absrec.dats: 5943(line=317, offs=1) -- 7851(line=431, offs=4)
*/
ATSstaticdec()
ats_void_type
auxproc_7 (ats_ptr_type env0, ats_ptr_type env1, ats_ptr_type env2, ats_ptr_type env3, ats_ptr_type arg0) {
/* local vardec */
// ATSlocal_void (tmp51) ;
ATSlocal (ats_ptr_type, tmp75) ;
// ATSlocal_void (tmp76) ;
// ATSlocal_void (tmp77) ;
// ATSlocal_void (tmp78) ;
// ATSlocal_void (tmp79) ;
// ATSlocal_void (tmp80) ;
// ATSlocal_void (tmp81) ;
// ATSlocal_void (tmp82) ;
// ATSlocal_void (tmp83) ;
// ATSlocal_void (tmp84) ;
ATSlocal (ats_ptr_type, tmp85) ;
// ATSlocal_void (tmp86) ;
// ATSlocal_void (tmp87) ;
// ATSlocal_void (tmp88) ;
// ATSlocal_void (tmp89) ;
// ATSlocal_void (tmp90) ;
// ATSlocal_void (tmp91) ;
// ATSlocal_void (tmp92) ;
// ATSlocal_void (tmp93) ;
// ATSlocal_void (tmp94) ;
ATSlocal (ats_ptr_type, tmp95) ;
// ATSlocal_void (tmp96) ;
// ATSlocal_void (tmp97) ;
// ATSlocal_void (tmp98) ;
// ATSlocal_void (tmp99) ;
// ATSlocal_void (tmp100) ;
// ATSlocal_void (tmp101) ;
// ATSlocal_void (tmp102) ;
// ATSlocal_void (tmp103) ;
// ATSlocal_void (tmp104) ;
// ATSlocal_void (tmp105) ;
// ATSlocal_void (tmp106) ;
// ATSlocal_void (tmp107) ;
// ATSlocal_void (tmp108) ;
// ATSlocal_void (tmp109) ;
// ATSlocal_void (tmp110) ;
// ATSlocal_void (tmp111) ;
// ATSlocal_void (tmp112) ;
// ATSlocal_void (tmp113) ;
ATSlocal (ats_ptr_type, tmp114) ;
// ATSlocal_void (tmp115) ;
ATSlocal (ats_ptr_type, tmp116) ;
// ATSlocal_void (tmp117) ;

__ats_lab_auxproc_7:
do {
/* branch: __ats_lab_19 */
__ats_lab_19_0:
if (((ats_sum_ptr_type)arg0)->tag != 0) { goto __ats_lab_20_0 ; }
__ats_lab_19_1:
tmp75 = ats_caselptrlab_mac(anairiats_sum_3, arg0, atslab_0) ;
/* tmp76 = */ auxdecl_8 (env0, env1, env2, env3, ATSstrcst("get"), tmp75) ;
/* tmp77 = */ atspre_fprint_string (env0, ATSstrcst("overload ")) ;
/* tmp78 = */ atspre_fprint_string (env0, ATSstrcst(".")) ;
/* tmp79 = */ _2tmp_2ATS_2dPostiats_2src_2pats_label_2esats__fprint_label (env0, env3) ;
/* tmp80 = */ atspre_fprint_string (env0, ATSstrcst(" with ")) ;
/* tmp81 = */ atspre_fprint_string (env0, env2) ;
/* tmp82 = */ atspre_fprint_string (env0, ATSstrcst("get_")) ;
/* tmp83 = */ _2tmp_2ATS_2dPostiats_2src_2pats_label_2esats__fprint_label (env0, env3) ;
/* tmp84 = */ atspre_fprint_string (env0, ATSstrcst("\n")) ;
/* tmp51 = */ atspre_fprint_newline (env0) ;
break ;

/* branch: __ats_lab_20 */
__ats_lab_20_0:
if (((ats_sum_ptr_type)arg0)->tag != 1) { goto __ats_lab_21_0 ; }
__ats_lab_20_1:
tmp85 = ats_caselptrlab_mac(anairiats_sum_3, arg0, atslab_0) ;
/* tmp86 = */ auxdecl_8 (env0, env1, env2, env3, ATSstrcst("set"), tmp85) ;
/* tmp87 = */ atspre_fprint_string (env0, ATSstrcst("overload ")) ;
/* tmp88 = */ atspre_fprint_string (env0, ATSstrcst(".")) ;
/* tmp89 = */ _2tmp_2ATS_2dPostiats_2src_2pats_label_2esats__fprint_label (env0, env3) ;
/* tmp90 = */ atspre_fprint_string (env0, ATSstrcst(" with ")) ;
/* tmp91 = */ atspre_fprint_string (env0, env2) ;
/* tmp92 = */ atspre_fprint_string (env0, ATSstrcst("set_")) ;
/* tmp93 = */ _2tmp_2ATS_2dPostiats_2src_2pats_label_2esats__fprint_label (env0, env3) ;
/* tmp94 = */ atspre_fprint_string (env0, ATSstrcst("\n")) ;
/* tmp51 = */ atspre_fprint_newline (env0) ;
break ;

/* branch: __ats_lab_21 */
__ats_lab_21_0:
if (((ats_sum_ptr_type)arg0)->tag != 2) { goto __ats_lab_22_0 ; }
__ats_lab_21_1:
tmp95 = ats_caselptrlab_mac(anairiats_sum_3, arg0, atslab_0) ;
/* tmp96 = */ auxdecl_8 (env0, env1, env2, env3, ATSstrcst("get"), tmp95) ;
/* tmp97 = */ atspre_fprint_string (env0, ATSstrcst("overload ")) ;
/* tmp98 = */ atspre_fprint_string (env0, ATSstrcst(".")) ;
/* tmp99 = */ _2tmp_2ATS_2dPostiats_2src_2pats_label_2esats__fprint_label (env0, env3) ;
/* tmp100 = */ atspre_fprint_string (env0, ATSstrcst(" with ")) ;
/* tmp101 = */ atspre_fprint_string (env0, env2) ;
/* tmp102 = */ atspre_fprint_string (env0, ATSstrcst("get_")) ;
/* tmp103 = */ _2tmp_2ATS_2dPostiats_2src_2pats_label_2esats__fprint_label (env0, env3) ;
/* tmp104 = */ atspre_fprint_string (env0, ATSstrcst("\n")) ;
/* tmp105 = */ auxdecl_8 (env0, env1, env2, env3, ATSstrcst("set"), tmp95) ;
/* tmp106 = */ atspre_fprint_string (env0, ATSstrcst("overload ")) ;
/* tmp107 = */ atspre_fprint_string (env0, ATSstrcst(".")) ;
/* tmp108 = */ _2tmp_2ATS_2dPostiats_2src_2pats_label_2esats__fprint_label (env0, env3) ;
/* tmp109 = */ atspre_fprint_string (env0, ATSstrcst(" with ")) ;
/* tmp110 = */ atspre_fprint_string (env0, env2) ;
/* tmp111 = */ atspre_fprint_string (env0, ATSstrcst("set_")) ;
/* tmp112 = */ _2tmp_2ATS_2dPostiats_2src_2pats_label_2esats__fprint_label (env0, env3) ;
/* tmp113 = */ atspre_fprint_string (env0, ATSstrcst("\n")) ;
/* tmp51 = */ atspre_fprint_newline (env0) ;
break ;

/* branch: __ats_lab_22 */
__ats_lab_22_0:
if (((ats_sum_ptr_type)arg0)->tag != 3) { goto __ats_lab_23_0 ; }
__ats_lab_22_1:
tmp114 = ats_caselptrlab_mac(anairiats_sum_3, arg0, atslab_0) ;
/* tmp115 = */ auxdecl_8 (env0, env1, env2, env3, ATSstrcst("exec"), tmp114) ;
/* tmp51 = */ atspre_fprint_newline (env0) ;
break ;

/* branch: __ats_lab_23 */
__ats_lab_23_0:
if (((ats_sum_ptr_type)arg0)->tag != 4) { goto __ats_lab_24_0 ; }
__ats_lab_23_1:
tmp116 = ats_caselptrlab_mac(anairiats_sum_3, arg0, atslab_0) ;
/* tmp117 = */ auxdecl_8 (env0, env1, env2, env3, ATSstrcst("getref"), tmp116) ;
/* tmp51 = */ atspre_fprint_newline (env0) ;
break ;

/* branch: __ats_lab_24 */
__ats_lab_24_0:
__ats_lab_24_1:
break ;
} while (0) ;
return /* (tmp51) */ ;
} /* end of [auxproc_7] */

typedef struct {
ats_fun_ptr_type closure_fun ;
ats_ptr_type closure_env_0 ;
ats_ptr_type closure_env_1 ;
ats_ptr_type closure_env_2 ;
ats_ptr_type closure_env_3 ;
} auxproc_7_closure_type ;

ats_void_type
auxproc_7_clofun (ats_clo_ptr_type cloptr, ats_ptr_type arg0) {
auxproc_7 (((auxproc_7_closure_type*)cloptr)->closure_env_0, ((auxproc_7_closure_type*)cloptr)->closure_env_1, ((auxproc_7_closure_type*)cloptr)->closure_env_2, ((auxproc_7_closure_type*)cloptr)->closure_env_3, arg0) ; return ;
} /* end of function */

ATSinline()
ats_void_type
auxproc_7_closure_init (auxproc_7_closure_type *p_clo, ats_ptr_type env0, ats_ptr_type env1, ats_ptr_type env2, ats_ptr_type env3) {
p_clo->closure_fun = (ats_fun_ptr_type)&auxproc_7_clofun ;
p_clo->closure_env_0 = env0 ;
p_clo->closure_env_1 = env1 ;
p_clo->closure_env_2 = env2 ;
p_clo->closure_env_3 = env3 ;
return ;
} /* end of function */

ats_clo_ptr_type
auxproc_7_closure_make (ats_ptr_type env0, ats_ptr_type env1, ats_ptr_type env2, ats_ptr_type env3) {
auxproc_7_closure_type *p_clo = ATS_MALLOC(sizeof(auxproc_7_closure_type)) ;
auxproc_7_closure_init (p_clo, env0, env1, env2, env3) ;
return (ats_clo_ptr_type)p_clo ;
} /* end of function */

/*
// /tmp/ATS-Postiats/src/pats_codegen2_absrec.dats: 5828(line=305, offs=1) -- 7902(line=437, offs=4)
*/
ATSglobaldec()
ats_void_type
_2tmp_2ATS_2dPostiats_2src_2pats_codegen2_absrec_2edats__absrec_emit_tyrecfld (ats_ptr_type arg0, ats_ptr_type arg1, ats_ptr_type arg2, ats_ptr_type arg3) {
/* local vardec */
// ATSlocal_void (tmp47) ;
ATSlocal (ats_ptr_type, tmp48) ;
ATSlocal (ats_ptr_type, tmp49) ;
ATSlocal (ats_ptr_type, tmp50) ;

__ats_lab__2tmp_2ATS_2dPostiats_2src_2pats_codegen2_absrec_2edats__absrec_emit_tyrecfld:

tmp48 = ats_caselptrlab_mac(anairiats_sum_4, arg3, atslab_0) ;
tmp49 = ats_caselptrlab_mac(anairiats_sum_4, arg3, atslab_2) ;
tmp50 = _2tmp_2ATS_2dPostiats_2src_2pats_codegen2_absrec_2edats__absrecfld_of_s2exp (tmp49) ;
/* tmp47 = */ auxproc_7 (arg0, arg1, arg2, tmp48, tmp50) ;
return /* (tmp47) */ ;
} /* end of [_2tmp_2ATS_2dPostiats_2src_2pats_codegen2_absrec_2edats__absrec_emit_tyrecfld] */

/*
// /tmp/ATS-Postiats/src/pats_codegen2_absrec.dats: 8144(line=450, offs=1) -- 8364(line=460, offs=4)
*/
ATSglobaldec()
ats_void_type
_2tmp_2ATS_2dPostiats_2src_2pats_codegen2_absrec_2edats__absrec_emit_tyrecfldlst (ats_ptr_type arg0, ats_ptr_type arg1, ats_ptr_type arg2, ats_ptr_type arg3) {
/* local vardec */
// ATSlocal_void (tmp118) ;
ATSlocal (ats_ptr_type, tmp119) ;
ATSlocal (ats_ptr_type, tmp120) ;
// ATSlocal_void (tmp121) ;

__ats_lab__2tmp_2ATS_2dPostiats_2src_2pats_codegen2_absrec_2edats__absrec_emit_tyrecfldlst:
do {
/* branch: __ats_lab_25 */
__ats_lab_25_0:
if (arg3 != (ats_sum_ptr_type)0) { goto __ats_lab_26_0 ; }
__ats_lab_25_1:
break ;

/* branch: __ats_lab_26 */
__ats_lab_26_0:
// if (arg3 == (ats_sum_ptr_type)0) { ats_deadcode_failure_handle () ; }
__ats_lab_26_1:
tmp119 = ats_caselptrlab_mac(anairiats_sum_0, arg3, atslab_0) ;
tmp120 = ats_caselptrlab_mac(anairiats_sum_0, arg3, atslab_1) ;
/* tmp121 = */ _2tmp_2ATS_2dPostiats_2src_2pats_codegen2_absrec_2edats__absrec_emit_tyrecfld (arg0, arg1, arg2, tmp119) ;
arg0 = arg0 ;
arg1 = arg1 ;
arg2 = arg2 ;
arg3 = tmp120 ;
goto __ats_lab__2tmp_2ATS_2dPostiats_2src_2pats_codegen2_absrec_2edats__absrec_emit_tyrecfldlst ; // tail call
break ;
} while (0) ;
return /* (tmp118) */ ;
} /* end of [_2tmp_2ATS_2dPostiats_2src_2pats_codegen2_absrec_2edats__absrec_emit_tyrecfldlst] */

/*
// /tmp/ATS-Postiats/src/pats_codegen2_absrec.dats: 8584(line=478, offs=1) -- 8926(line=502, offs=4)
*/
ATSstaticdec()
ats_ptr_type
auxget_11 (ats_ptr_type arg0) {
/* local vardec */
ATSlocal (ats_ptr_type, tmp123) ;
ATSlocal (ats_ptr_type, tmp124) ;
ATSlocal (ats_ptr_type, tmp125) ;

__ats_lab_auxget_11:
tmp124 = ats_selbox_mac(ats_castptr_mac(anairiats_rec_1, arg0), atslab_s2exp_node) ;
do {
/* branch: __ats_lab_27 */
__ats_lab_27_0:
if (((ats_sum_ptr_type)tmp124)->tag != 25) { goto __ats_lab_28_0 ; }
__ats_lab_27_1:
tmp123 = ATS_MALLOC(sizeof(anairiats_sum_5)) ;
ats_selptrset_mac(anairiats_sum_5, tmp123, atslab_0, arg0) ;
break ;

/* branch: __ats_lab_28 */
__ats_lab_28_0:
if (((ats_sum_ptr_type)tmp124)->tag != 18) { goto __ats_lab_29_0 ; }
__ats_lab_28_1:
tmp125 = ats_caselptrlab_mac(anairiats_sum_2, tmp124, atslab_1) ;
arg0 = tmp125 ;
goto __ats_lab_auxget_11 ; // tail call
break ;

/* branch: __ats_lab_29 */
__ats_lab_29_0:
__ats_lab_29_1:
tmp123 = (ats_sum_ptr_type)0 ;
break ;
} while (0) ;
return (tmp123) ;
} /* end of [auxget_11] */

/*
// /tmp/ATS-Postiats/src/pats_codegen2_absrec.dats: 8564(line=475, offs=3) -- 9010(line=508, offs=4)
*/
ATSglobaldec()
ats_ptr_type
_2tmp_2ATS_2dPostiats_2src_2pats_codegen2_absrec_2edats__absrec_s2cst_get_tyrec (ats_ptr_type arg0) {
/* local vardec */
ATSlocal (ats_ptr_type, tmp122) ;
ATSlocal (ats_ptr_type, tmp126) ;
ATSlocal (ats_ptr_type, tmp127) ;

__ats_lab__2tmp_2ATS_2dPostiats_2src_2pats_codegen2_absrec_2edats__absrec_s2cst_get_tyrec:
tmp126 = _2tmp_2ATS_2dPostiats_2src_2pats_staexp2_2esats__s2cst_get_def (arg0) ;
if (tmp126 == (ats_sum_ptr_type)0) { ats_caseof_failure_handle ("/tmp/ATS-Postiats/src/pats_codegen2_absrec.dats: 8953(line=504, offs=5) -- 8985(line=504, offs=37)") ; }
tmp127 = ats_caselptrlab_mac(anairiats_sum_5, tmp126, atslab_0) ;
tmp122 = auxget_11 (tmp127) ;
return (tmp122) ;
} /* end of [_2tmp_2ATS_2dPostiats_2src_2pats_codegen2_absrec_2edats__absrec_s2cst_get_tyrec] */

/*
// /tmp/ATS-Postiats/src/pats_codegen2_absrec.dats: 9079(line=515, offs=1) -- 9351(line=532, offs=2)
*/
ATSstaticdec()
ats_void_type
auxerr_nil_12 (ats_ptr_type arg0, ats_ptr_type arg1) {
/* local vardec */
// ATSlocal_void (tmp128) ;
ATSlocal (ats_ptr_type, tmp129) ;
// ATSlocal_void (tmp130) ;
// ATSlocal_void (tmp131) ;
// ATSlocal_void (tmp132) ;
// ATSlocal_void (tmp133) ;

__ats_lab_auxerr_nil_12:
tmp129 = ats_selbox_mac(ats_castptr_mac(anairiats_rec_6, arg1), atslab_d2ecl_loc) ;
/* tmp130 = */ atspre_fprint_string (arg0, ATSstrcst("(*\n")) ;
/* tmp131 = */ _2tmp_2ATS_2dPostiats_2src_2pats_location_2esats__fprint_location (arg0, tmp129) ;
/* tmp132 = */ atspre_fprint_string (arg0, ATSstrcst(": error(codegen2): absrec: no spec on typedef is given\n")) ;
/* tmp133 = */ atspre_fprint_string (arg0, ATSstrcst("*)")) ;
/* tmp128 = */ atspre_fprint_newline (arg0) ;
return /* (tmp128) */ ;
} /* end of [auxerr_nil_12] */

/*
// /tmp/ATS-Postiats/src/pats_codegen2_absrec.dats: 9383(line=535, offs=1) -- 9657(line=552, offs=2)
*/
ATSstaticdec()
ats_void_type
auxerr_s2cst_13 (ats_ptr_type arg0, ats_ptr_type arg1) {
/* local vardec */
// ATSlocal_void (tmp134) ;
ATSlocal (ats_ptr_type, tmp135) ;
// ATSlocal_void (tmp136) ;
// ATSlocal_void (tmp137) ;
// ATSlocal_void (tmp138) ;
// ATSlocal_void (tmp139) ;

__ats_lab_auxerr_s2cst_13:
tmp135 = ats_selbox_mac(ats_castptr_mac(anairiats_rec_6, arg1), atslab_d2ecl_loc) ;
/* tmp136 = */ atspre_fprint_string (arg0, ATSstrcst("(*\n")) ;
/* tmp137 = */ _2tmp_2ATS_2dPostiats_2src_2pats_location_2esats__fprint_location (arg0, tmp135) ;
/* tmp138 = */ atspre_fprint_string (arg0, ATSstrcst(": error(codegen2): absrec: no typedef of the given spec\n")) ;
/* tmp139 = */ atspre_fprint_string (arg0, ATSstrcst("*)")) ;
/* tmp134 = */ atspre_fprint_newline (arg0) ;
return /* (tmp134) */ ;
} /* end of [auxerr_s2cst_13] */

/*
// /tmp/ATS-Postiats/src/pats_codegen2_absrec.dats: 9691(line=555, offs=1) -- 9993(line=572, offs=2)
*/
ATSstaticdec()
ats_void_type
auxerr_s2cst_tyrec_14 (ats_ptr_type arg0, ats_ptr_type arg1, ats_ptr_type arg2) {
/* local vardec */
// ATSlocal_void (tmp140) ;
ATSlocal (ats_ptr_type, tmp141) ;
// ATSlocal_void (tmp142) ;
// ATSlocal_void (tmp143) ;
// ATSlocal_void (tmp144) ;
// ATSlocal_void (tmp145) ;
// ATSlocal_void (tmp146) ;
// ATSlocal_void (tmp147) ;

__ats_lab_auxerr_s2cst_tyrec_14:
tmp141 = ats_selbox_mac(ats_castptr_mac(anairiats_rec_6, arg1), atslab_d2ecl_loc) ;
/* tmp142 = */ atspre_fprint_string (arg0, ATSstrcst("(*\n")) ;
/* tmp143 = */ _2tmp_2ATS_2dPostiats_2src_2pats_location_2esats__fprint_location (arg0, tmp141) ;
/* tmp144 = */ atspre_fprint_string (arg0, ATSstrcst(": error(codegen2): absrec: [")) ;
/* tmp145 = */ _2tmp_2ATS_2dPostiats_2src_2pats_staexp2_2esats__fprint_s2cst (arg0, arg2) ;
/* tmp146 = */ atspre_fprint_string (arg0, ATSstrcst("] does not refer to a record\n")) ;
/* tmp147 = */ atspre_fprint_string (arg0, ATSstrcst("*)")) ;
/* tmp140 = */ atspre_fprint_newline (arg0) ;
return /* (tmp140) */ ;
} /* end of [auxerr_s2cst_tyrec_14] */

/*
// /tmp/ATS-Postiats/src/pats_codegen2_absrec.dats: 10033(line=575, offs=1) -- 10409(line=602, offs=4)
*/
ATSstaticdec()
ats_void_type
aux_tydef_15 (ats_ptr_type arg0, ats_ptr_type arg1, ats_ptr_type arg2, ats_ptr_type arg3) {
/* local vardec */
// ATSlocal_void (tmp148) ;
ATSlocal (ats_ptr_type, tmp149) ;
ATSlocal (ats_ptr_type, tmp150) ;

__ats_lab_aux_tydef_15:
tmp149 = _2tmp_2ATS_2dPostiats_2src_2pats_codegen2_absrec_2edats__absrec_s2cst_get_tyrec (arg2) ;
do {
/* branch: __ats_lab_30 */
__ats_lab_30_0:
if (tmp149 != (ats_sum_ptr_type)0) { goto __ats_lab_31_0 ; }
__ats_lab_30_1:
/* tmp148 = */ auxerr_s2cst_tyrec_14 (arg0, arg1, arg2) ;
break ;

/* branch: __ats_lab_31 */
__ats_lab_31_0:
// if (tmp149 == (ats_sum_ptr_type)0) { ats_deadcode_failure_handle () ; }
__ats_lab_31_1:
tmp150 = ats_caselptrlab_mac(anairiats_sum_5, tmp149, atslab_0) ;
ATS_FREE(tmp149) ;
/* tmp148 = */ aux_tydef_tyrec_16 (arg0, arg1, arg2, tmp150, arg3) ;
break ;
} while (0) ;
return /* (tmp148) */ ;
} /* end of [aux_tydef_15] */

/*
// /tmp/ATS-Postiats/src/pats_codegen2_absrec.dats: 10440(line=605, offs=1) -- 11120(line=649, offs=4)
*/
ATSstaticdec()
ats_void_type
aux_tydef_tyrec_16 (ats_ptr_type arg0, ats_ptr_type arg1, ats_ptr_type arg2, ats_ptr_type arg3, ats_ptr_type arg4) {
/* local vardec */
// ATSlocal_void (tmp151) ;
ATSlocal (ats_ptr_type, tmp152) ;
ATSlocal (ats_ptr_type, tmp153) ;
ATSlocal (ats_ptr_type, tmp154) ;
ATSlocal (ats_ptr_type, tmp155) ;
ATSlocal (ats_ptr_type, tmp156) ;
ATSlocal (ats_ptr_type, tmp157) ;
ATSlocal (ats_ptr_type, tmp158) ;
ATSlocal (ats_ptr_type, tmp159) ;

__ats_lab_aux_tydef_tyrec_16:
do {
/* branch: __ats_lab_32 */
__ats_lab_32_0:
if (arg4 != (ats_sum_ptr_type)0) { goto __ats_lab_33_0 ; }
__ats_lab_32_1:
tmp152 = s2cst_get_name_0 (arg2) ;
break ;

/* branch: __ats_lab_33 */
__ats_lab_33_0:
// if (arg4 == (ats_sum_ptr_type)0) { ats_deadcode_failure_handle () ; }
__ats_lab_33_1:
tmp153 = ats_caselptrlab_mac(anairiats_sum_0, arg4, atslab_0) ;
tmp154 = ats_selbox_mac(ats_castptr_mac(anairiats_rec_7, tmp153), atslab_e1xp_node) ;
do {
/* branch: __ats_lab_34 */
__ats_lab_34_0:
if (((ats_sum_ptr_type)tmp154)->tag != 0) { goto __ats_lab_35_0 ; }
__ats_lab_34_1:
tmp155 = ats_caselptrlab_mac(anairiats_sum_3, tmp154, atslab_0) ;
tmp152 = _2tmp_2ATS_2dPostiats_2src_2pats_symbol_2esats__symbol_get_name (tmp155) ;
break ;

/* branch: __ats_lab_35 */
__ats_lab_35_0:
if (((ats_sum_ptr_type)tmp154)->tag != 5) { goto __ats_lab_36_0 ; }
__ats_lab_35_1:
tmp156 = ats_caselptrlab_mac(anairiats_sum_3, tmp154, atslab_0) ;
tmp152 = tmp156 ;
break ;

/* branch: __ats_lab_36 */
__ats_lab_36_0:
__ats_lab_36_1:
tmp157 = s2cst_get_name_0 (arg2) ;
tmp152 = atspre_string_append (tmp157, ATSstrcst("_")) ;
break ;
} while (0) ;
break ;
} while (0) ;
tmp158 = ats_selbox_mac(ats_castptr_mac(anairiats_rec_1, arg3), atslab_s2exp_node) ;
if (((ats_sum_ptr_type)tmp158)->tag != 25) { ats_caseof_failure_handle ("/tmp/ATS-Postiats/src/pats_codegen2_absrec.dats: 11014(line=644, offs=1) -- 11061(line=645, offs=39)") ; }
tmp159 = ats_caselptrlab_mac(anairiats_sum_8, tmp158, atslab_2) ;
/* tmp151 = */ _2tmp_2ATS_2dPostiats_2src_2pats_codegen2_absrec_2edats__absrec_emit_tyrecfldlst (arg0, arg2, tmp152, tmp159) ;
return /* (tmp151) */ ;
} /* end of [aux_tydef_tyrec_16] */

/*
// /tmp/ATS-Postiats/src/pats_codegen2_absrec.dats: 11200(line=655, offs=3) -- 11588(line=677, offs=4)
*/
ATSglobaldec()
ats_void_type
_2tmp_2ATS_2dPostiats_2src_2pats_codegen2_2esats__codegen2_absrec (ats_ptr_type arg0, ats_ptr_type arg1, ats_ptr_type arg2) {
/* local vardec */
// ATSlocal_void (tmp160) ;
ATSlocal (ats_ptr_type, tmp161) ;
ATSlocal (ats_ptr_type, tmp162) ;
ATSlocal (ats_ptr_type, tmp163) ;
ATSlocal (ats_ptr_type, tmp164) ;

__ats_lab__2tmp_2ATS_2dPostiats_2src_2pats_codegen2_2esats__codegen2_absrec:
do {
/* branch: __ats_lab_37 */
__ats_lab_37_0:
if (arg2 != (ats_sum_ptr_type)0) { goto __ats_lab_38_0 ; }
__ats_lab_37_1:
/* tmp160 = */ auxerr_nil_12 (arg0, arg1) ;
break ;

/* branch: __ats_lab_38 */
__ats_lab_38_0:
// if (arg2 == (ats_sum_ptr_type)0) { ats_deadcode_failure_handle () ; }
__ats_lab_38_1:
tmp161 = ats_caselptrlab_mac(anairiats_sum_0, arg2, atslab_0) ;
tmp162 = ats_caselptrlab_mac(anairiats_sum_0, arg2, atslab_1) ;
tmp163 = _2tmp_2ATS_2dPostiats_2src_2pats_codegen2_2esats__codegen2_get_tydef (tmp161) ;
do {
/* branch: __ats_lab_39 */
__ats_lab_39_0:
if (tmp163 != (ats_sum_ptr_type)0) { goto __ats_lab_40_0 ; }
__ats_lab_39_1:
/* tmp160 = */ auxerr_s2cst_13 (arg0, arg1) ;
break ;

/* branch: __ats_lab_40 */
__ats_lab_40_0:
// if (tmp163 == (ats_sum_ptr_type)0) { ats_deadcode_failure_handle () ; }
__ats_lab_40_1:
tmp164 = ats_caselptrlab_mac(anairiats_sum_5, tmp163, atslab_0) ;
ATS_FREE(tmp163) ;
/* tmp160 = */ aux_tydef_15 (arg0, arg1, tmp164, tmp162) ;
break ;
} while (0) ;
break ;
} while (0) ;
return /* (tmp160) */ ;
} /* end of [_2tmp_2ATS_2dPostiats_2src_2pats_codegen2_2esats__codegen2_absrec] */

/* static load function */

extern ats_void_type _2tmp_2ATS_2dPostiats_2src_2pats_label_2esats__staload (void) ;
extern ats_void_type _2tmp_2ATS_2dPostiats_2src_2pats_location_2esats__staload (void) ;
extern ats_void_type _2tmp_2ATS_2dPostiats_2src_2pats_symbol_2esats__staload (void) ;
extern ats_void_type _2tmp_2ATS_2dPostiats_2src_2pats_staexp1_2esats__staload (void) ;
extern ats_void_type _2tmp_2ATS_2dPostiats_2src_2pats_staexp2_2esats__staload (void) ;
extern ats_void_type _2tmp_2ATS_2dPostiats_2src_2pats_dynexp2_2esats__staload (void) ;
extern ats_void_type _2tmp_2ATS_2dPostiats_2src_2pats_codegen2_2esats__staload (void) ;

ats_void_type
_2tmp_2ATS_2dPostiats_2src_2pats_codegen2_absrec_2edats__staload () {
static int _2tmp_2ATS_2dPostiats_2src_2pats_codegen2_absrec_2edats__staload_flag = 0 ;
if (_2tmp_2ATS_2dPostiats_2src_2pats_codegen2_absrec_2edats__staload_flag) return ;
_2tmp_2ATS_2dPostiats_2src_2pats_codegen2_absrec_2edats__staload_flag = 1 ;

_2tmp_2ATS_2dPostiats_2src_2pats_label_2esats__staload () ;
_2tmp_2ATS_2dPostiats_2src_2pats_location_2esats__staload () ;
_2tmp_2ATS_2dPostiats_2src_2pats_symbol_2esats__staload () ;
_2tmp_2ATS_2dPostiats_2src_2pats_staexp1_2esats__staload () ;
_2tmp_2ATS_2dPostiats_2src_2pats_staexp2_2esats__staload () ;
_2tmp_2ATS_2dPostiats_2src_2pats_dynexp2_2esats__staload () ;
_2tmp_2ATS_2dPostiats_2src_2pats_codegen2_2esats__staload () ;

// _2tmp_2ATS_2dPostiats_2src_2pats_codegen2_absrec_2edats__ABSRECFLDget_0.tag = 0 ;
// _2tmp_2ATS_2dPostiats_2src_2pats_codegen2_absrec_2edats__ABSRECFLDset_1.tag = 1 ;
// _2tmp_2ATS_2dPostiats_2src_2pats_codegen2_absrec_2edats__ABSRECFLDgetset_2.tag = 2 ;
// _2tmp_2ATS_2dPostiats_2src_2pats_codegen2_absrec_2edats__ABSRECFLDexch_3.tag = 3 ;
// _2tmp_2ATS_2dPostiats_2src_2pats_codegen2_absrec_2edats__ABSRECFLDgetref_4.tag = 4 ;
// _2tmp_2ATS_2dPostiats_2src_2pats_codegen2_absrec_2edats__ABSRECFLDunknown_5.tag = 5 ;
return ;
} /* staload function */

/* dynamic load function */

// dynload flag declaration
extern ats_int_type _2tmp_2ATS_2dPostiats_2src_2pats_codegen2_absrec_2edats__dynload_flag ;

ats_void_type
_2tmp_2ATS_2dPostiats_2src_2pats_codegen2_absrec_2edats__dynload () {
_2tmp_2ATS_2dPostiats_2src_2pats_codegen2_absrec_2edats__dynload_flag = 1 ;
_2tmp_2ATS_2dPostiats_2src_2pats_codegen2_absrec_2edats__staload () ;

#ifdef _ATS_PROOFCHECK
#endif /* _ATS_PROOFCHECK */

/* marking static variables for GC */

/* marking external values for GC */

/* code for dynamic loading */
return ;
} /* end of [dynload function] */

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

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

/* end of [pats_codegen2_absrec_dats.c] */
