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

/* 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_d2ecl_loc ;
ats_ptr_type atslab_d2ecl_node ;
} anairiats_rec_0 ;

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

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

typedef struct {
ats_ptr_type atslab_0 ;
ats_ptr_type atslab_1 ;
} anairiats_sum_3 ;

typedef struct {
ats_ptr_type atslab_0 ;
} anairiats_sum_4 ;

/* 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) ;

/* external dynamic constant declarations */
ATSextern_fun(ats_void_type, atspre_fprint_newline) (ats_ptr_type) ;
ATSextern_fun(ats_void_type, atspre_fprint_int) (ats_ptr_type, ats_int_type) ;
ATSextern_fun(ats_void_type, atspre_fprint_string) (ats_ptr_type, ats_ptr_type) ;
ATSextern_fun(ats_void_type, _2tmp_2ATS_2dPostiats_2src_2pats_symbol_2esats__fprint_symbol) (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_location_2esats__fprint_location) (ats_ptr_type, 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_name) (ats_ptr_type) ;
ATSextern_fun(ats_ptr_type, _2tmp_2ATS_2dPostiats_2src_2pats_staexp2_2esats__s2cst_get_dconlst) (ats_ptr_type) ;
ATSextern_fun(ats_ptr_type, _2tmp_2ATS_2dPostiats_2src_2pats_staexp2_2esats__d2con_get_sym) (ats_ptr_type) ;
ATSextern_fun(ats_int_type, _2tmp_2ATS_2dPostiats_2src_2pats_staexp2_2esats__d2con_get_tag) (ats_ptr_type) ;
ATSextern_fun(ats_ptr_type, _2tmp_2ATS_2dPostiats_2src_2pats_codegen2_2esats__codegen2_get_datype) (ats_ptr_type) ;

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

/* assuming abstract types */
/* sum constructor declarations */
/* exn constructor declarations */
/* global dynamic (non-functional) constant declarations */
/* internal function declarations */
static
ats_void_type auxerr_nil_0 (ats_ptr_type arg0, ats_ptr_type arg1) ;
static
ats_void_type auxerr_cons_1 (ats_ptr_type arg0, ats_ptr_type arg1, ats_ptr_type arg2) ;
static
ats_void_type auxfun0_3 (ats_ptr_type env0, ats_ptr_type env1) ;
static
ats_clo_ptr_type auxfun0_3_closure_make (ats_ptr_type env0, ats_ptr_type env1) ;
static
ats_void_type auxfun0_3_clofun (ats_clo_ptr_type cloptr) ;
static
ats_void_type auxfun1_4 (ats_ptr_type env0, ats_ptr_type env1, ats_ptr_type arg0) ;
static
ats_clo_ptr_type auxfun1_4_closure_make (ats_ptr_type env0, ats_ptr_type env1) ;
static
ats_void_type auxfun1_4_clofun (ats_clo_ptr_type cloptr, ats_ptr_type arg0) ;
static
ats_void_type auxcon_5 (ats_ptr_type env0, ats_ptr_type arg0) ;
static
ats_clo_ptr_type auxcon_5_closure_make (ats_ptr_type env0) ;
static
ats_void_type auxcon_5_clofun (ats_clo_ptr_type cloptr, ats_ptr_type arg0) ;
static
ats_void_type auxconlst_6 (ats_ptr_type env0, ats_ptr_type arg0) ;
static
ats_clo_ptr_type auxconlst_6_closure_make (ats_ptr_type env0) ;
static
ats_void_type auxconlst_6_clofun (ats_clo_ptr_type cloptr, ats_ptr_type arg0) ;
static
ats_void_type aux_datype_2 (ats_ptr_type arg0, ats_ptr_type arg1, ats_ptr_type arg2, ats_ptr_type arg3) ;
static
ats_void_type auxerr_nil_8 (ats_ptr_type arg0, ats_ptr_type arg1) ;
static
ats_void_type auxerr_cons_9 (ats_ptr_type arg0, ats_ptr_type arg1, ats_ptr_type arg2) ;
static
ats_void_type auxfun0_11 (ats_ptr_type env0, ats_ptr_type env1) ;
static
ats_clo_ptr_type auxfun0_11_closure_make (ats_ptr_type env0, ats_ptr_type env1) ;
static
ats_void_type auxfun0_11_clofun (ats_clo_ptr_type cloptr) ;
static
ats_void_type auxfun1_12 (ats_ptr_type env0, ats_ptr_type env1, ats_ptr_type arg0) ;
static
ats_clo_ptr_type auxfun1_12_closure_make (ats_ptr_type env0, ats_ptr_type env1) ;
static
ats_void_type auxfun1_12_clofun (ats_clo_ptr_type cloptr, ats_ptr_type arg0) ;
static
ats_void_type auxcon_13 (ats_ptr_type env0, ats_ptr_type arg0) ;
static
ats_clo_ptr_type auxcon_13_closure_make (ats_ptr_type env0) ;
static
ats_void_type auxcon_13_clofun (ats_clo_ptr_type cloptr, ats_ptr_type arg0) ;
static
ats_void_type auxconlst_14 (ats_ptr_type env0, ats_ptr_type arg0) ;
static
ats_clo_ptr_type auxconlst_14_closure_make (ats_ptr_type env0) ;
static
ats_void_type auxconlst_14_clofun (ats_clo_ptr_type cloptr, ats_ptr_type arg0) ;
static
ats_void_type aux_datype_10 (ats_ptr_type arg0, ats_ptr_type arg1, ats_ptr_type arg2, ats_ptr_type arg3) ;

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

/* function implementations */

/*
// /tmp/ATS-Postiats/src/pats_codegen2_datype.dats: 1813(line=66, offs=1) -- 2078(line=83, offs=2)
*/
ATSstaticdec()
ats_void_type
auxerr_nil_0 (ats_ptr_type arg0, ats_ptr_type arg1) {
/* local vardec */
// ATSlocal_void (tmp0) ;
ATSlocal (ats_ptr_type, tmp1) ;
// ATSlocal_void (tmp2) ;
// ATSlocal_void (tmp3) ;
// ATSlocal_void (tmp4) ;
// ATSlocal_void (tmp5) ;

__ats_lab_auxerr_nil_0:
tmp1 = ats_selbox_mac(ats_castptr_mac(anairiats_rec_0, arg1), atslab_d2ecl_loc) ;
/* tmp2 = */ atspre_fprint_string (arg0, ATSstrcst("(*\n")) ;
/* tmp3 = */ _2tmp_2ATS_2dPostiats_2src_2pats_location_2esats__fprint_location (arg0, tmp1) ;
/* tmp4 = */ atspre_fprint_string (arg0, ATSstrcst(": error(codegen2): no spec on datatype is given\n")) ;
/* tmp5 = */ atspre_fprint_string (arg0, ATSstrcst("*)")) ;
/* tmp0 = */ atspre_fprint_newline (arg0) ;
return /* (tmp0) */ ;
} /* end of [auxerr_nil_0] */

/*
// /tmp/ATS-Postiats/src/pats_codegen2_datype.dats: 2110(line=86, offs=1) -- 2388(line=105, offs=2)
*/
ATSstaticdec()
ats_void_type
auxerr_cons_1 (ats_ptr_type arg0, ats_ptr_type arg1, ats_ptr_type arg2) {
/* local vardec */
// ATSlocal_void (tmp6) ;
ATSlocal (ats_ptr_type, tmp7) ;
// ATSlocal_void (tmp8) ;
// ATSlocal_void (tmp9) ;
// ATSlocal_void (tmp10) ;
// ATSlocal_void (tmp11) ;

__ats_lab_auxerr_cons_1:
tmp7 = ats_selbox_mac(ats_castptr_mac(anairiats_rec_0, arg1), atslab_d2ecl_loc) ;
/* tmp8 = */ atspre_fprint_string (arg0, ATSstrcst("(*\n")) ;
/* tmp9 = */ _2tmp_2ATS_2dPostiats_2src_2pats_location_2esats__fprint_location (arg0, tmp7) ;
/* tmp10 = */ atspre_fprint_string (arg0, ATSstrcst(": error(codegen2): no datatype of the given spec\n")) ;
/* tmp11 = */ atspre_fprint_string (arg0, ATSstrcst("*)")) ;
/* tmp6 = */ atspre_fprint_newline (arg0) ;
return /* (tmp6) */ ;
} /* end of [auxerr_cons_1] */

/*
// /tmp/ATS-Postiats/src/pats_codegen2_datype.dats: 2512(line=115, offs=1) -- 2675(line=125, offs=4)
*/
ATSstaticdec()
ats_void_type
auxfun0_3 (ats_ptr_type env0, ats_ptr_type env1) {
/* local vardec */
// ATSlocal_void (tmp13) ;
ATSlocal (ats_ptr_type, tmp14) ;
ATSlocal (ats_ptr_type, tmp15) ;
// ATSlocal_void (tmp16) ;
// ATSlocal_void (tmp17) ;

__ats_lab_auxfun0_3:
tmp14 = _2tmp_2ATS_2dPostiats_2src_2pats_staexp2_2esats__s2cst_get_sym (env1) ;
tmp15 = _2tmp_2ATS_2dPostiats_2src_2pats_symbol_2esats__symbol_get_name (tmp14) ;
/* tmp16 = */ atspre_fprint_string (env0, ATSstrcst("datcon_")) ;
/* tmp17 = */ atspre_fprint_string (env0, tmp15) ;
/* tmp13 = */ atspre_fprint_string (env0, ATSstrcst("_")) ;
return /* (tmp13) */ ;
} /* end of [auxfun0_3] */

typedef struct {
ats_fun_ptr_type closure_fun ;
ats_ptr_type closure_env_0 ;
ats_ptr_type closure_env_1 ;
} auxfun0_3_closure_type ;

ats_void_type
auxfun0_3_clofun (ats_clo_ptr_type cloptr) {
auxfun0_3 (((auxfun0_3_closure_type*)cloptr)->closure_env_0, ((auxfun0_3_closure_type*)cloptr)->closure_env_1) ; return ;
} /* end of function */

ATSinline()
ats_void_type
auxfun0_3_closure_init (auxfun0_3_closure_type *p_clo, ats_ptr_type env0, ats_ptr_type env1) {
p_clo->closure_fun = (ats_fun_ptr_type)&auxfun0_3_clofun ;
p_clo->closure_env_0 = env0 ;
p_clo->closure_env_1 = env1 ;
return ;
} /* end of function */

ats_clo_ptr_type
auxfun0_3_closure_make (ats_ptr_type env0, ats_ptr_type env1) {
auxfun0_3_closure_type *p_clo = ATS_MALLOC(sizeof(auxfun0_3_closure_type)) ;
auxfun0_3_closure_init (p_clo, env0, env1) ;
return (ats_clo_ptr_type)p_clo ;
} /* end of function */

/*
// /tmp/ATS-Postiats/src/pats_codegen2_datype.dats: 2703(line=128, offs=1) -- 2942(line=141, offs=2)
*/
ATSstaticdec()
ats_void_type
auxfun1_4 (ats_ptr_type env0, ats_ptr_type env1, ats_ptr_type arg0) {
/* local vardec */
// ATSlocal_void (tmp18) ;
ATSlocal (ats_ptr_type, tmp19) ;
ATSlocal (ats_ptr_type, tmp20) ;
ATSlocal (ats_ptr_type, tmp21) ;

__ats_lab_auxfun1_4:
tmp19 = ats_selbox_mac(ats_castptr_mac(anairiats_rec_1, arg0), atslab_e1xp_node) ;
do {
/* branch: __ats_lab_0 */
__ats_lab_0_0:
if (((ats_sum_ptr_type)tmp19)->tag != 0) { goto __ats_lab_1_0 ; }
__ats_lab_0_1:
tmp20 = ats_caselptrlab_mac(anairiats_sum_2, tmp19, atslab_0) ;
/* tmp18 = */ _2tmp_2ATS_2dPostiats_2src_2pats_symbol_2esats__fprint_symbol (env0, tmp20) ;
break ;

/* branch: __ats_lab_1 */
__ats_lab_1_0:
if (((ats_sum_ptr_type)tmp19)->tag != 5) { goto __ats_lab_2_0 ; }
__ats_lab_1_1:
tmp21 = ats_caselptrlab_mac(anairiats_sum_2, tmp19, atslab_0) ;
/* tmp18 = */ atspre_fprint_string (env0, tmp21) ;
break ;

/* branch: __ats_lab_2 */
__ats_lab_2_0:
__ats_lab_2_1:
/* tmp18 = */ auxfun0_3 (env0, env1) ;
break ;
} while (0) ;
return /* (tmp18) */ ;
} /* end of [auxfun1_4] */

typedef struct {
ats_fun_ptr_type closure_fun ;
ats_ptr_type closure_env_0 ;
ats_ptr_type closure_env_1 ;
} auxfun1_4_closure_type ;

ats_void_type
auxfun1_4_clofun (ats_clo_ptr_type cloptr, ats_ptr_type arg0) {
auxfun1_4 (((auxfun1_4_closure_type*)cloptr)->closure_env_0, ((auxfun1_4_closure_type*)cloptr)->closure_env_1, arg0) ; return ;
} /* end of function */

ATSinline()
ats_void_type
auxfun1_4_closure_init (auxfun1_4_closure_type *p_clo, ats_ptr_type env0, ats_ptr_type env1) {
p_clo->closure_fun = (ats_fun_ptr_type)&auxfun1_4_clofun ;
p_clo->closure_env_0 = env0 ;
p_clo->closure_env_1 = env1 ;
return ;
} /* end of function */

ats_clo_ptr_type
auxfun1_4_closure_make (ats_ptr_type env0, ats_ptr_type env1) {
auxfun1_4_closure_type *p_clo = ATS_MALLOC(sizeof(auxfun1_4_closure_type)) ;
auxfun1_4_closure_init (p_clo, env0, env1) ;
return (ats_clo_ptr_type)p_clo ;
} /* end of function */

/*
// /tmp/ATS-Postiats/src/pats_codegen2_datype.dats: 2950(line=144, offs=1) -- 3128(line=154, offs=4)
*/
ATSstaticdec()
ats_void_type
auxcon_5 (ats_ptr_type env0, ats_ptr_type arg0) {
/* local vardec */
// ATSlocal_void (tmp22) ;
ATSlocal (ats_ptr_type, tmp23) ;
ATSlocal (ats_ptr_type, tmp24) ;
// ATSlocal_void (tmp25) ;
// ATSlocal_void (tmp26) ;
// ATSlocal_void (tmp27) ;
// ATSlocal_void (tmp28) ;
// ATSlocal_void (tmp29) ;

__ats_lab_auxcon_5:
tmp23 = _2tmp_2ATS_2dPostiats_2src_2pats_staexp2_2esats__d2con_get_sym (arg0) ;
tmp24 = _2tmp_2ATS_2dPostiats_2src_2pats_symbol_2esats__symbol_get_name (tmp23) ;
/* tmp25 = */ atspre_fprint_string (env0, ATSstrcst("| ")) ;
/* tmp26 = */ atspre_fprint_string (env0, tmp24) ;
/* tmp27 = */ atspre_fprint_string (env0, ATSstrcst(" _ => \"")) ;
/* tmp28 = */ atspre_fprint_string (env0, tmp24) ;
/* tmp29 = */ atspre_fprint_string (env0, ATSstrcst("\"")) ;
/* tmp22 = */ atspre_fprint_newline (env0) ;
return /* (tmp22) */ ;
} /* end of [auxcon_5] */

typedef struct {
ats_fun_ptr_type closure_fun ;
ats_ptr_type closure_env_0 ;
} auxcon_5_closure_type ;

ats_void_type
auxcon_5_clofun (ats_clo_ptr_type cloptr, ats_ptr_type arg0) {
auxcon_5 (((auxcon_5_closure_type*)cloptr)->closure_env_0, arg0) ; return ;
} /* end of function */

ATSinline()
ats_void_type
auxcon_5_closure_init (auxcon_5_closure_type *p_clo, ats_ptr_type env0) {
p_clo->closure_fun = (ats_fun_ptr_type)&auxcon_5_clofun ;
p_clo->closure_env_0 = env0 ;
return ;
} /* end of function */

ats_clo_ptr_type
auxcon_5_closure_make (ats_ptr_type env0) {
auxcon_5_closure_type *p_clo = ATS_MALLOC(sizeof(auxcon_5_closure_type)) ;
auxcon_5_closure_init (p_clo, env0) ;
return (ats_clo_ptr_type)p_clo ;
} /* end of function */

/*
// /tmp/ATS-Postiats/src/pats_codegen2_datype.dats: 3155(line=157, offs=1) -- 3316(line=166, offs=2)
*/
ATSstaticdec()
ats_void_type
auxconlst_6 (ats_ptr_type env0, ats_ptr_type arg0) {
/* local vardec */
// ATSlocal_void (tmp30) ;
ATSlocal (ats_ptr_type, tmp31) ;
ATSlocal (ats_ptr_type, tmp32) ;
// ATSlocal_void (tmp33) ;

__ats_lab_auxconlst_6:
do {
/* branch: __ats_lab_3 */
__ats_lab_3_0:
if (arg0 != (ats_sum_ptr_type)0) { goto __ats_lab_4_0 ; }
__ats_lab_3_1:
break ;

/* branch: __ats_lab_4 */
__ats_lab_4_0:
// if (arg0 == (ats_sum_ptr_type)0) { ats_deadcode_failure_handle () ; }
__ats_lab_4_1:
tmp31 = ats_caselptrlab_mac(anairiats_sum_3, arg0, atslab_0) ;
tmp32 = ats_caselptrlab_mac(anairiats_sum_3, arg0, atslab_1) ;
/* tmp33 = */ auxcon_5 (env0, tmp31) ;
arg0 = tmp32 ;
goto __ats_lab_auxconlst_6 ; // tail call
break ;
} while (0) ;
return /* (tmp30) */ ;
} /* end of [auxconlst_6] */

typedef struct {
ats_fun_ptr_type closure_fun ;
ats_ptr_type closure_env_0 ;
} auxconlst_6_closure_type ;

ats_void_type
auxconlst_6_clofun (ats_clo_ptr_type cloptr, ats_ptr_type arg0) {
auxconlst_6 (((auxconlst_6_closure_type*)cloptr)->closure_env_0, arg0) ; return ;
} /* end of function */

ATSinline()
ats_void_type
auxconlst_6_closure_init (auxconlst_6_closure_type *p_clo, ats_ptr_type env0) {
p_clo->closure_fun = (ats_fun_ptr_type)&auxconlst_6_clofun ;
p_clo->closure_env_0 = env0 ;
return ;
} /* end of function */

ats_clo_ptr_type
auxconlst_6_closure_make (ats_ptr_type env0) {
auxconlst_6_closure_type *p_clo = ATS_MALLOC(sizeof(auxconlst_6_closure_type)) ;
auxconlst_6_closure_init (p_clo, env0) ;
return (ats_clo_ptr_type)p_clo ;
} /* end of function */

/*
// /tmp/ATS-Postiats/src/pats_codegen2_datype.dats: 2421(line=108, offs=1) -- 4056(line=215, offs=4)
*/
ATSstaticdec()
ats_void_type
aux_datype_2 (ats_ptr_type arg0, ats_ptr_type arg1, ats_ptr_type arg2, ats_ptr_type arg3) {
/* local vardec */
// ATSlocal_void (tmp12) ;
ATSlocal (ats_ptr_type, tmp34) ;
ATSlocal (ats_ptr_type, tmp35) ;
ATSlocal (ats_ptr_type, tmp36) ;
// ATSlocal_void (tmp37) ;
// ATSlocal_void (tmp38) ;
// ATSlocal_void (tmp39) ;
// ATSlocal_void (tmp40) ;
// ATSlocal_void (tmp41) ;
ATSlocal (ats_ptr_type, tmp42) ;
// ATSlocal_void (tmp43) ;
// ATSlocal_void (tmp44) ;
// ATSlocal_void (tmp45) ;
// ATSlocal_void (tmp46) ;
// ATSlocal_void (tmp47) ;
// ATSlocal_void (tmp48) ;
// ATSlocal_void (tmp49) ;

__ats_lab_aux_datype_2:
tmp34 = _2tmp_2ATS_2dPostiats_2src_2pats_staexp2_2esats__s2cst_get_name (arg2) ;
tmp35 = _2tmp_2ATS_2dPostiats_2src_2pats_staexp2_2esats__s2cst_get_dconlst (arg2) ;
if (tmp35 == (ats_sum_ptr_type)0) { ats_caseof_failure_handle ("/tmp/ATS-Postiats/src/pats_codegen2_datype.dats: 3357(line=169, offs=5) -- 3394(line=169, offs=42)") ; }
tmp36 = ats_caselptrlab_mac(anairiats_sum_4, tmp35, atslab_0) ;
/* tmp37 = */ atspre_fprint_string (arg0, ATSstrcst("(* ****** ****** *)\n")) ;
/* tmp38 = */ atspre_fprint_string (arg0, ATSstrcst("//\n")) ;
/* tmp39 = */ atspre_fprint_string (arg0, ATSstrcst("implement\n")) ;
/* tmp40 = */ atspre_fprint_string (arg0, ATSstrcst("{}(*tmp*)\n")) ;
do {
/* branch: __ats_lab_5 */
__ats_lab_5_0:
if (arg3 != (ats_sum_ptr_type)0) { goto __ats_lab_6_0 ; }
__ats_lab_5_1:
/* tmp41 = */ auxfun0_3 (arg0, arg2) ;
break ;

/* branch: __ats_lab_6 */
__ats_lab_6_0:
// if (arg3 == (ats_sum_ptr_type)0) { ats_deadcode_failure_handle () ; }
__ats_lab_6_1:
tmp42 = ats_caselptrlab_mac(anairiats_sum_3, arg3, atslab_0) ;
/* tmp41 = */ auxfun1_4 (arg0, arg2, tmp42) ;
break ;
} while (0) ;
/* tmp43 = */ atspre_fprint_string (arg0, ATSstrcst("\n  ")) ;
/* tmp44 = */ atspre_fprint_string (arg0, ATSstrcst("(arg0) =\n")) ;
/* tmp45 = */ atspre_fprint_string (arg0, ATSstrcst("(\n")) ;
/* tmp46 = */ atspre_fprint_string (arg0, ATSstrcst("case+ arg0 of\n")) ;
/* tmp47 = */ auxconlst_6 (arg0, tmp36) ;
/* tmp48 = */ atspre_fprint_string (arg0, ATSstrcst(")\n")) ;
/* tmp49 = */ atspre_fprint_string (arg0, ATSstrcst("//\n")) ;
/* tmp12 = */ atspre_fprint_string (arg0, ATSstrcst("(* ****** ****** *)\n")) ;
return /* (tmp12) */ ;
} /* end of [aux_datype_2] */

/*
// /tmp/ATS-Postiats/src/pats_codegen2_datype.dats: 4131(line=221, offs=3) -- 4526(line=243, offs=4)
*/
ATSglobaldec()
ats_void_type
_2tmp_2ATS_2dPostiats_2src_2pats_codegen2_2esats__codegen2_datcon (ats_ptr_type arg0, ats_ptr_type arg1, ats_ptr_type arg2) {
/* local vardec */
// ATSlocal_void (tmp50) ;
ATSlocal (ats_ptr_type, tmp51) ;
ATSlocal (ats_ptr_type, tmp52) ;
ATSlocal (ats_ptr_type, tmp53) ;
ATSlocal (ats_ptr_type, tmp54) ;

__ats_lab__2tmp_2ATS_2dPostiats_2src_2pats_codegen2_2esats__codegen2_datcon:
do {
/* branch: __ats_lab_7 */
__ats_lab_7_0:
if (arg2 != (ats_sum_ptr_type)0) { goto __ats_lab_8_0 ; }
__ats_lab_7_1:
/* tmp50 = */ auxerr_nil_0 (arg0, arg1) ;
break ;

/* branch: __ats_lab_8 */
__ats_lab_8_0:
// if (arg2 == (ats_sum_ptr_type)0) { ats_deadcode_failure_handle () ; }
__ats_lab_8_1:
tmp51 = ats_caselptrlab_mac(anairiats_sum_3, arg2, atslab_0) ;
tmp52 = ats_caselptrlab_mac(anairiats_sum_3, arg2, atslab_1) ;
tmp53 = _2tmp_2ATS_2dPostiats_2src_2pats_codegen2_2esats__codegen2_get_datype (tmp51) ;
do {
/* branch: __ats_lab_9 */
__ats_lab_9_0:
if (tmp53 != (ats_sum_ptr_type)0) { goto __ats_lab_10_0 ; }
__ats_lab_9_1:
/* tmp50 = */ auxerr_cons_1 (arg0, arg1, tmp51) ;
break ;

/* branch: __ats_lab_10 */
__ats_lab_10_0:
// if (tmp53 == (ats_sum_ptr_type)0) { ats_deadcode_failure_handle () ; }
__ats_lab_10_1:
tmp54 = ats_caselptrlab_mac(anairiats_sum_4, tmp53, atslab_0) ;
ATS_FREE(tmp53) ;
/* tmp50 = */ aux_datype_2 (arg0, arg1, tmp54, tmp52) ;
break ;
} while (0) ;
break ;
} while (0) ;
return /* (tmp50) */ ;
} /* end of [_2tmp_2ATS_2dPostiats_2src_2pats_codegen2_2esats__codegen2_datcon] */

/*
// /tmp/ATS-Postiats/src/pats_codegen2_datype.dats: 4611(line=252, offs=1) -- 4876(line=269, offs=2)
*/
ATSstaticdec()
ats_void_type
auxerr_nil_8 (ats_ptr_type arg0, ats_ptr_type arg1) {
/* local vardec */
// ATSlocal_void (tmp55) ;
ATSlocal (ats_ptr_type, tmp56) ;
// ATSlocal_void (tmp57) ;
// ATSlocal_void (tmp58) ;
// ATSlocal_void (tmp59) ;

__ats_lab_auxerr_nil_8:
tmp56 = ats_selbox_mac(ats_castptr_mac(anairiats_rec_0, arg1), atslab_d2ecl_loc) ;
/* tmp57 = */ atspre_fprint_string (arg0, ATSstrcst("(*\n")) ;
/* tmp58 = */ _2tmp_2ATS_2dPostiats_2src_2pats_location_2esats__fprint_location (arg0, tmp56) ;
/* tmp59 = */ atspre_fprint_string (arg0, ATSstrcst(": error(codegen2): no spec on datatype is given\n")) ;
/* tmp55 = */ atspre_fprint_string (arg0, ATSstrcst("*)\n")) ;
return /* (tmp55) */ ;
} /* end of [auxerr_nil_8] */

/*
// /tmp/ATS-Postiats/src/pats_codegen2_datype.dats: 4908(line=272, offs=1) -- 5185(line=290, offs=2)
*/
ATSstaticdec()
ats_void_type
auxerr_cons_9 (ats_ptr_type arg0, ats_ptr_type arg1, ats_ptr_type arg2) {
/* local vardec */
// ATSlocal_void (tmp60) ;
ATSlocal (ats_ptr_type, tmp61) ;
// ATSlocal_void (tmp62) ;
// ATSlocal_void (tmp63) ;
// ATSlocal_void (tmp64) ;

__ats_lab_auxerr_cons_9:
tmp61 = ats_selbox_mac(ats_castptr_mac(anairiats_rec_0, arg1), atslab_d2ecl_loc) ;
/* tmp62 = */ atspre_fprint_string (arg0, ATSstrcst("(*\n")) ;
/* tmp63 = */ _2tmp_2ATS_2dPostiats_2src_2pats_location_2esats__fprint_location (arg0, tmp61) ;
/* tmp64 = */ atspre_fprint_string (arg0, ATSstrcst(": error(codegen2): no datatype of the given spec\n")) ;
/* tmp60 = */ atspre_fprint_string (arg0, ATSstrcst("*)\n")) ;
return /* (tmp60) */ ;
} /* end of [auxerr_cons_9] */

/*
// /tmp/ATS-Postiats/src/pats_codegen2_datype.dats: 5309(line=300, offs=1) -- 5475(line=310, offs=4)
*/
ATSstaticdec()
ats_void_type
auxfun0_11 (ats_ptr_type env0, ats_ptr_type env1) {
/* local vardec */
// ATSlocal_void (tmp66) ;
ATSlocal (ats_ptr_type, tmp67) ;
ATSlocal (ats_ptr_type, tmp68) ;
// ATSlocal_void (tmp69) ;
// ATSlocal_void (tmp70) ;

__ats_lab_auxfun0_11:
tmp67 = _2tmp_2ATS_2dPostiats_2src_2pats_staexp2_2esats__s2cst_get_sym (env1) ;
tmp68 = _2tmp_2ATS_2dPostiats_2src_2pats_symbol_2esats__symbol_get_name (tmp67) ;
/* tmp69 = */ atspre_fprint_string (env0, ATSstrcst("datcontag_")) ;
/* tmp70 = */ atspre_fprint_string (env0, tmp68) ;
/* tmp66 = */ atspre_fprint_string (env0, ATSstrcst("_")) ;
return /* (tmp66) */ ;
} /* end of [auxfun0_11] */

typedef struct {
ats_fun_ptr_type closure_fun ;
ats_ptr_type closure_env_0 ;
ats_ptr_type closure_env_1 ;
} auxfun0_11_closure_type ;

ats_void_type
auxfun0_11_clofun (ats_clo_ptr_type cloptr) {
auxfun0_11 (((auxfun0_11_closure_type*)cloptr)->closure_env_0, ((auxfun0_11_closure_type*)cloptr)->closure_env_1) ; return ;
} /* end of function */

ATSinline()
ats_void_type
auxfun0_11_closure_init (auxfun0_11_closure_type *p_clo, ats_ptr_type env0, ats_ptr_type env1) {
p_clo->closure_fun = (ats_fun_ptr_type)&auxfun0_11_clofun ;
p_clo->closure_env_0 = env0 ;
p_clo->closure_env_1 = env1 ;
return ;
} /* end of function */

ats_clo_ptr_type
auxfun0_11_closure_make (ats_ptr_type env0, ats_ptr_type env1) {
auxfun0_11_closure_type *p_clo = ATS_MALLOC(sizeof(auxfun0_11_closure_type)) ;
auxfun0_11_closure_init (p_clo, env0, env1) ;
return (ats_clo_ptr_type)p_clo ;
} /* end of function */

/*
// /tmp/ATS-Postiats/src/pats_codegen2_datype.dats: 5503(line=313, offs=1) -- 5744(line=326, offs=2)
*/
ATSstaticdec()
ats_void_type
auxfun1_12 (ats_ptr_type env0, ats_ptr_type env1, ats_ptr_type arg0) {
/* local vardec */
// ATSlocal_void (tmp71) ;
ATSlocal (ats_ptr_type, tmp72) ;
ATSlocal (ats_ptr_type, tmp73) ;
ATSlocal (ats_ptr_type, tmp74) ;

__ats_lab_auxfun1_12:
tmp72 = ats_selbox_mac(ats_castptr_mac(anairiats_rec_1, arg0), atslab_e1xp_node) ;
do {
/* branch: __ats_lab_11 */
__ats_lab_11_0:
if (((ats_sum_ptr_type)tmp72)->tag != 0) { goto __ats_lab_12_0 ; }
__ats_lab_11_1:
tmp73 = ats_caselptrlab_mac(anairiats_sum_2, tmp72, atslab_0) ;
/* tmp71 = */ _2tmp_2ATS_2dPostiats_2src_2pats_symbol_2esats__fprint_symbol (env0, tmp73) ;
break ;

/* branch: __ats_lab_12 */
__ats_lab_12_0:
if (((ats_sum_ptr_type)tmp72)->tag != 5) { goto __ats_lab_13_0 ; }
__ats_lab_12_1:
tmp74 = ats_caselptrlab_mac(anairiats_sum_2, tmp72, atslab_0) ;
/* tmp71 = */ atspre_fprint_string (env0, tmp74) ;
break ;

/* branch: __ats_lab_13 */
__ats_lab_13_0:
__ats_lab_13_1:
/* tmp71 = */ auxfun0_11 (env0, env1) ;
break ;
} while (0) ;
return /* (tmp71) */ ;
} /* end of [auxfun1_12] */

typedef struct {
ats_fun_ptr_type closure_fun ;
ats_ptr_type closure_env_0 ;
ats_ptr_type closure_env_1 ;
} auxfun1_12_closure_type ;

ats_void_type
auxfun1_12_clofun (ats_clo_ptr_type cloptr, ats_ptr_type arg0) {
auxfun1_12 (((auxfun1_12_closure_type*)cloptr)->closure_env_0, ((auxfun1_12_closure_type*)cloptr)->closure_env_1, arg0) ; return ;
} /* end of function */

ATSinline()
ats_void_type
auxfun1_12_closure_init (auxfun1_12_closure_type *p_clo, ats_ptr_type env0, ats_ptr_type env1) {
p_clo->closure_fun = (ats_fun_ptr_type)&auxfun1_12_clofun ;
p_clo->closure_env_0 = env0 ;
p_clo->closure_env_1 = env1 ;
return ;
} /* end of function */

ats_clo_ptr_type
auxfun1_12_closure_make (ats_ptr_type env0, ats_ptr_type env1) {
auxfun1_12_closure_type *p_clo = ATS_MALLOC(sizeof(auxfun1_12_closure_type)) ;
auxfun1_12_closure_init (p_clo, env0, env1) ;
return (ats_clo_ptr_type)p_clo ;
} /* end of function */

/*
// /tmp/ATS-Postiats/src/pats_codegen2_datype.dats: 5752(line=329, offs=1) -- 5950(line=340, offs=4)
*/
ATSstaticdec()
ats_void_type
auxcon_13 (ats_ptr_type env0, ats_ptr_type arg0) {
/* local vardec */
// ATSlocal_void (tmp75) ;
ATSlocal (ats_ptr_type, tmp76) ;
ATSlocal (ats_int_type, tmp77) ;
ATSlocal (ats_ptr_type, tmp78) ;
// ATSlocal_void (tmp79) ;
// ATSlocal_void (tmp80) ;
// ATSlocal_void (tmp81) ;
// ATSlocal_void (tmp82) ;

__ats_lab_auxcon_13:
tmp76 = _2tmp_2ATS_2dPostiats_2src_2pats_staexp2_2esats__d2con_get_sym (arg0) ;
tmp77 = _2tmp_2ATS_2dPostiats_2src_2pats_staexp2_2esats__d2con_get_tag (arg0) ;
tmp78 = _2tmp_2ATS_2dPostiats_2src_2pats_symbol_2esats__symbol_get_name (tmp76) ;
/* tmp79 = */ atspre_fprint_string (env0, ATSstrcst("| ")) ;
/* tmp80 = */ atspre_fprint_string (env0, tmp78) ;
/* tmp81 = */ atspre_fprint_string (env0, ATSstrcst(" _ => ")) ;
/* tmp82 = */ atspre_fprint_int (env0, tmp77) ;
/* tmp75 = */ atspre_fprint_newline (env0) ;
return /* (tmp75) */ ;
} /* end of [auxcon_13] */

typedef struct {
ats_fun_ptr_type closure_fun ;
ats_ptr_type closure_env_0 ;
} auxcon_13_closure_type ;

ats_void_type
auxcon_13_clofun (ats_clo_ptr_type cloptr, ats_ptr_type arg0) {
auxcon_13 (((auxcon_13_closure_type*)cloptr)->closure_env_0, arg0) ; return ;
} /* end of function */

ATSinline()
ats_void_type
auxcon_13_closure_init (auxcon_13_closure_type *p_clo, ats_ptr_type env0) {
p_clo->closure_fun = (ats_fun_ptr_type)&auxcon_13_clofun ;
p_clo->closure_env_0 = env0 ;
return ;
} /* end of function */

ats_clo_ptr_type
auxcon_13_closure_make (ats_ptr_type env0) {
auxcon_13_closure_type *p_clo = ATS_MALLOC(sizeof(auxcon_13_closure_type)) ;
auxcon_13_closure_init (p_clo, env0) ;
return (ats_clo_ptr_type)p_clo ;
} /* end of function */

/*
// /tmp/ATS-Postiats/src/pats_codegen2_datype.dats: 5980(line=343, offs=1) -- 6141(line=352, offs=2)
*/
ATSstaticdec()
ats_void_type
auxconlst_14 (ats_ptr_type env0, ats_ptr_type arg0) {
/* local vardec */
// ATSlocal_void (tmp83) ;
ATSlocal (ats_ptr_type, tmp84) ;
ATSlocal (ats_ptr_type, tmp85) ;
// ATSlocal_void (tmp86) ;

__ats_lab_auxconlst_14:
do {
/* branch: __ats_lab_14 */
__ats_lab_14_0:
if (arg0 != (ats_sum_ptr_type)0) { goto __ats_lab_15_0 ; }
__ats_lab_14_1:
break ;

/* branch: __ats_lab_15 */
__ats_lab_15_0:
// if (arg0 == (ats_sum_ptr_type)0) { ats_deadcode_failure_handle () ; }
__ats_lab_15_1:
tmp84 = ats_caselptrlab_mac(anairiats_sum_3, arg0, atslab_0) ;
tmp85 = ats_caselptrlab_mac(anairiats_sum_3, arg0, atslab_1) ;
/* tmp86 = */ auxcon_13 (env0, tmp84) ;
arg0 = tmp85 ;
goto __ats_lab_auxconlst_14 ; // tail call
break ;
} while (0) ;
return /* (tmp83) */ ;
} /* end of [auxconlst_14] */

typedef struct {
ats_fun_ptr_type closure_fun ;
ats_ptr_type closure_env_0 ;
} auxconlst_14_closure_type ;

ats_void_type
auxconlst_14_clofun (ats_clo_ptr_type cloptr, ats_ptr_type arg0) {
auxconlst_14 (((auxconlst_14_closure_type*)cloptr)->closure_env_0, arg0) ; return ;
} /* end of function */

ATSinline()
ats_void_type
auxconlst_14_closure_init (auxconlst_14_closure_type *p_clo, ats_ptr_type env0) {
p_clo->closure_fun = (ats_fun_ptr_type)&auxconlst_14_clofun ;
p_clo->closure_env_0 = env0 ;
return ;
} /* end of function */

ats_clo_ptr_type
auxconlst_14_closure_make (ats_ptr_type env0) {
auxconlst_14_closure_type *p_clo = ATS_MALLOC(sizeof(auxconlst_14_closure_type)) ;
auxconlst_14_closure_init (p_clo, env0) ;
return (ats_clo_ptr_type)p_clo ;
} /* end of function */

/*
// /tmp/ATS-Postiats/src/pats_codegen2_datype.dats: 5218(line=293, offs=1) -- 6890(line=402, offs=4)
*/
ATSstaticdec()
ats_void_type
aux_datype_10 (ats_ptr_type arg0, ats_ptr_type arg1, ats_ptr_type arg2, ats_ptr_type arg3) {
/* local vardec */
// ATSlocal_void (tmp65) ;
ATSlocal (ats_ptr_type, tmp87) ;
ATSlocal (ats_ptr_type, tmp88) ;
ATSlocal (ats_ptr_type, 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) ;

__ats_lab_aux_datype_10:
tmp87 = _2tmp_2ATS_2dPostiats_2src_2pats_staexp2_2esats__s2cst_get_name (arg2) ;
tmp88 = _2tmp_2ATS_2dPostiats_2src_2pats_staexp2_2esats__s2cst_get_dconlst (arg2) ;
if (tmp88 == (ats_sum_ptr_type)0) { ats_caseof_failure_handle ("/tmp/ATS-Postiats/src/pats_codegen2_datype.dats: 6182(line=355, offs=5) -- 6219(line=355, offs=42)") ; }
tmp89 = ats_caselptrlab_mac(anairiats_sum_4, tmp88, atslab_0) ;
/* tmp90 = */ atspre_fprint_string (arg0, ATSstrcst("(* ****** ****** *)\n")) ;
/* tmp91 = */ atspre_fprint_string (arg0, ATSstrcst("//\n")) ;
/* tmp92 = */ atspre_fprint_string (arg0, ATSstrcst("implement\n")) ;
/* tmp93 = */ atspre_fprint_string (arg0, ATSstrcst("{}(*tmp*)\n")) ;
do {
/* branch: __ats_lab_16 */
__ats_lab_16_0:
if (arg3 != (ats_sum_ptr_type)0) { goto __ats_lab_17_0 ; }
__ats_lab_16_1:
/* tmp94 = */ auxfun0_11 (arg0, arg2) ;
break ;

/* branch: __ats_lab_17 */
__ats_lab_17_0:
// if (arg3 == (ats_sum_ptr_type)0) { ats_deadcode_failure_handle () ; }
__ats_lab_17_1:
tmp95 = ats_caselptrlab_mac(anairiats_sum_3, arg3, atslab_0) ;
/* tmp94 = */ auxfun1_12 (arg0, arg2, tmp95) ;
break ;
} while (0) ;
/* tmp96 = */ atspre_fprint_string (arg0, ATSstrcst("\n  ")) ;
/* tmp97 = */ atspre_fprint_string (arg0, ATSstrcst("(arg0) =\n")) ;
/* tmp98 = */ atspre_fprint_string (arg0, ATSstrcst("(\n")) ;
/* tmp99 = */ atspre_fprint_string (arg0, ATSstrcst("case+ arg0 of\n")) ;
/* tmp100 = */ auxconlst_14 (arg0, tmp89) ;
/* tmp101 = */ atspre_fprint_string (arg0, ATSstrcst(")\n")) ;
/* tmp102 = */ atspre_fprint_string (arg0, ATSstrcst("//\n")) ;
/* tmp65 = */ atspre_fprint_string (arg0, ATSstrcst("(* ****** ****** *)\n")) ;
return /* (tmp65) */ ;
} /* end of [aux_datype_10] */

/*
// /tmp/ATS-Postiats/src/pats_codegen2_datype.dats: 6968(line=408, offs=3) -- 7366(line=430, offs=4)
*/
ATSglobaldec()
ats_void_type
_2tmp_2ATS_2dPostiats_2src_2pats_codegen2_2esats__codegen2_datcontag (ats_ptr_type arg0, ats_ptr_type arg1, ats_ptr_type arg2) {
/* local vardec */
// ATSlocal_void (tmp103) ;
ATSlocal (ats_ptr_type, tmp104) ;
ATSlocal (ats_ptr_type, tmp105) ;
ATSlocal (ats_ptr_type, tmp106) ;
ATSlocal (ats_ptr_type, tmp107) ;

__ats_lab__2tmp_2ATS_2dPostiats_2src_2pats_codegen2_2esats__codegen2_datcontag:
do {
/* branch: __ats_lab_18 */
__ats_lab_18_0:
if (arg2 != (ats_sum_ptr_type)0) { goto __ats_lab_19_0 ; }
__ats_lab_18_1:
/* tmp103 = */ auxerr_nil_8 (arg0, arg1) ;
break ;

/* branch: __ats_lab_19 */
__ats_lab_19_0:
// if (arg2 == (ats_sum_ptr_type)0) { ats_deadcode_failure_handle () ; }
__ats_lab_19_1:
tmp104 = ats_caselptrlab_mac(anairiats_sum_3, arg2, atslab_0) ;
tmp105 = ats_caselptrlab_mac(anairiats_sum_3, arg2, atslab_1) ;
tmp106 = _2tmp_2ATS_2dPostiats_2src_2pats_codegen2_2esats__codegen2_get_datype (tmp104) ;
do {
/* branch: __ats_lab_20 */
__ats_lab_20_0:
if (tmp106 != (ats_sum_ptr_type)0) { goto __ats_lab_21_0 ; }
__ats_lab_20_1:
/* tmp103 = */ auxerr_cons_9 (arg0, arg1, tmp104) ;
break ;

/* branch: __ats_lab_21 */
__ats_lab_21_0:
// if (tmp106 == (ats_sum_ptr_type)0) { ats_deadcode_failure_handle () ; }
__ats_lab_21_1:
tmp107 = ats_caselptrlab_mac(anairiats_sum_4, tmp106, atslab_0) ;
ATS_FREE(tmp106) ;
/* tmp103 = */ aux_datype_10 (arg0, arg1, tmp107, tmp105) ;
break ;
} while (0) ;
break ;
} while (0) ;
return /* (tmp103) */ ;
} /* end of [_2tmp_2ATS_2dPostiats_2src_2pats_codegen2_2esats__codegen2_datcontag] */

/* static load function */

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_datype_2edats__staload () {
static int _2tmp_2ATS_2dPostiats_2src_2pats_codegen2_datype_2edats__staload_flag = 0 ;
if (_2tmp_2ATS_2dPostiats_2src_2pats_codegen2_datype_2edats__staload_flag) return ;
_2tmp_2ATS_2dPostiats_2src_2pats_codegen2_datype_2edats__staload_flag = 1 ;

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

return ;
} /* staload function */

/* dynamic load function */

// dynload flag declaration
extern ats_int_type _2tmp_2ATS_2dPostiats_2src_2pats_codegen2_datype_2edats__dynload_flag ;

ats_void_type
_2tmp_2ATS_2dPostiats_2src_2pats_codegen2_datype_2edats__dynload () {
_2tmp_2ATS_2dPostiats_2src_2pats_codegen2_datype_2edats__dynload_flag = 1 ;
_2tmp_2ATS_2dPostiats_2src_2pats_codegen2_datype_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_datype_dats.c] */
