/*
**
** The C code is generated by ATS/Anairiats
** The compilation time is: 2020-11-4: 18h: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 */
/* external codes at top */
/* type definitions */
/* external typedefs */
/* external dynamic constructor declarations */
/* external dynamic constant declarations */
ATSextern_fun(ats_float_type, atspre_mul_float_float) (ats_float_type, ats_float_type) ;
ATSextern_fun(ats_double_type, atspre_mul_double_double) (ats_double_type, ats_double_type) ;
ATSextern_fun(ats_ldouble_type, atspre_mul_ldouble_ldouble) (ats_ldouble_type, ats_ldouble_type) ;
ATSextern_fun(ats_int_type, atspre_iadd) (ats_int_type, ats_int_type) ;
ATSextern_fun(ats_int_type, atspre_idiv) (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) ;

/* 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_float_type loop_1 (ats_float_type arg0, ats_int_type arg1, ats_float_type arg2) ;
static
ats_double_type loop_3 (ats_double_type arg0, ats_int_type arg1, ats_double_type arg2) ;
static
ats_ldouble_type loop_5 (ats_ldouble_type arg0, ats_int_type arg1, ats_ldouble_type arg2) ;

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

/* function implementations */

/*
// /nix/store/rfja8ixrs5wb4kj3kiwlch1apnh7qgvy-ats-0.2.12/lib/ats-anairiats-0.2.12/prelude/DATS/float.dats: 1748(line=50, offs=7) -- 2031(line=59, offs=6)
*/
ATSstaticdec()
ats_float_type
loop_1 (ats_float_type arg0, ats_int_type arg1, ats_float_type arg2) {
/* local vardec */
ATSlocal (ats_float_type, tmp1) ;
ATSlocal (ats_bool_type, tmp2) ;
ATSlocal (ats_int_type, tmp3) ;
ATSlocal (ats_float_type, tmp4) ;
ATSlocal (ats_bool_type, tmp5) ;
ATSlocal (ats_int_type, tmp6) ;
ATSlocal (ats_float_type, tmp7) ;
ATSlocal (ats_bool_type, tmp8) ;

__ats_lab_loop_1:
do {
/* branch: __ats_lab_0 */
__ats_lab_0_0:
__ats_lab_0_1:
tmp2 = atspre_igte (arg1, 2) ;
if (!tmp2) { goto __ats_lab_1_1 ; }
tmp3 = atspre_idiv (arg1, 2) ;
tmp4 = atspre_mul_float_float (arg0, arg0) ;
tmp6 = atspre_iadd (tmp3, tmp3) ;
tmp5 = atspre_igt (arg1, tmp6) ;
if (tmp5) {
tmp7 = atspre_mul_float_float (arg0, arg2) ;
arg0 = tmp4 ;
arg1 = tmp3 ;
arg2 = tmp7 ;
goto __ats_lab_loop_1 ; // tail call
} else {
arg0 = tmp4 ;
arg1 = tmp3 ;
arg2 = arg2 ;
goto __ats_lab_loop_1 ; // tail call
} /* end of [if] */
break ;

/* branch: __ats_lab_1 */
__ats_lab_1_0:
__ats_lab_1_1:
tmp8 = atspre_igte (arg1, 1) ;
if (!tmp8) { goto __ats_lab_2_1 ; }
tmp1 = atspre_mul_float_float (arg0, arg2) ;
break ;

/* branch: __ats_lab_2 */
__ats_lab_2_0:
__ats_lab_2_1:
tmp1 = arg2 ;
break ;
} while (0) ;
return (tmp1) ;
} /* end of [loop_1] */

/*
// /nix/store/rfja8ixrs5wb4kj3kiwlch1apnh7qgvy-ats-0.2.12/lib/ats-anairiats-0.2.12/prelude/DATS/float.dats: 1709(line=48, offs=26) -- 2077(line=62, offs=4)
*/
ATSglobaldec()
ats_float_type
ATS_2d0_2e2_2e12_2prelude_2SATS_2float_2esats__pow_float_int1 (ats_float_type arg0, ats_int_type arg1) {
/* local vardec */
ATSlocal (ats_float_type, tmp0) ;

__ats_lab_ATS_2d0_2e2_2e12_2prelude_2SATS_2float_2esats__pow_float_int1:
tmp0 = loop_1 (arg0, arg1, 1.0) ;
return (tmp0) ;
} /* end of [ATS_2d0_2e2_2e12_2prelude_2SATS_2float_2esats__pow_float_int1] */

/*
// /nix/store/rfja8ixrs5wb4kj3kiwlch1apnh7qgvy-ats-0.2.12/lib/ats-anairiats-0.2.12/prelude/DATS/float.dats: 2173(line=67, offs=7) -- 2456(line=76, offs=6)
*/
ATSstaticdec()
ats_double_type
loop_3 (ats_double_type arg0, ats_int_type arg1, ats_double_type arg2) {
/* local vardec */
ATSlocal (ats_double_type, tmp10) ;
ATSlocal (ats_bool_type, tmp11) ;
ATSlocal (ats_int_type, tmp12) ;
ATSlocal (ats_double_type, tmp13) ;
ATSlocal (ats_bool_type, tmp14) ;
ATSlocal (ats_int_type, tmp15) ;
ATSlocal (ats_double_type, tmp16) ;
ATSlocal (ats_bool_type, tmp17) ;

__ats_lab_loop_3:
do {
/* branch: __ats_lab_3 */
__ats_lab_3_0:
__ats_lab_3_1:
tmp11 = atspre_igte (arg1, 2) ;
if (!tmp11) { goto __ats_lab_4_1 ; }
tmp12 = atspre_idiv (arg1, 2) ;
tmp13 = atspre_mul_double_double (arg0, arg0) ;
tmp15 = atspre_iadd (tmp12, tmp12) ;
tmp14 = atspre_igt (arg1, tmp15) ;
if (tmp14) {
tmp16 = atspre_mul_double_double (arg0, arg2) ;
arg0 = tmp13 ;
arg1 = tmp12 ;
arg2 = tmp16 ;
goto __ats_lab_loop_3 ; // tail call
} else {
arg0 = tmp13 ;
arg1 = tmp12 ;
arg2 = arg2 ;
goto __ats_lab_loop_3 ; // tail call
} /* end of [if] */
break ;

/* branch: __ats_lab_4 */
__ats_lab_4_0:
__ats_lab_4_1:
tmp17 = atspre_igte (arg1, 1) ;
if (!tmp17) { goto __ats_lab_5_1 ; }
tmp10 = atspre_mul_double_double (arg0, arg2) ;
break ;

/* branch: __ats_lab_5 */
__ats_lab_5_0:
__ats_lab_5_1:
tmp10 = arg2 ;
break ;
} while (0) ;
return (tmp10) ;
} /* end of [loop_3] */

/*
// /nix/store/rfja8ixrs5wb4kj3kiwlch1apnh7qgvy-ats-0.2.12/lib/ats-anairiats-0.2.12/prelude/DATS/float.dats: 2133(line=65, offs=27) -- 2502(line=79, offs=4)
*/
ATSglobaldec()
ats_double_type
ATS_2d0_2e2_2e12_2prelude_2SATS_2float_2esats__pow_double_int1 (ats_double_type arg0, ats_int_type arg1) {
/* local vardec */
ATSlocal (ats_double_type, tmp9) ;

__ats_lab_ATS_2d0_2e2_2e12_2prelude_2SATS_2float_2esats__pow_double_int1:
tmp9 = loop_3 (arg0, arg1, 1.0) ;
return (tmp9) ;
} /* end of [ATS_2d0_2e2_2e12_2prelude_2SATS_2float_2esats__pow_double_int1] */

/*
// /nix/store/rfja8ixrs5wb4kj3kiwlch1apnh7qgvy-ats-0.2.12/lib/ats-anairiats-0.2.12/prelude/DATS/float.dats: 2601(line=84, offs=7) -- 2884(line=93, offs=6)
*/
ATSstaticdec()
ats_ldouble_type
loop_5 (ats_ldouble_type arg0, ats_int_type arg1, ats_ldouble_type arg2) {
/* local vardec */
ATSlocal (ats_ldouble_type, tmp19) ;
ATSlocal (ats_bool_type, tmp20) ;
ATSlocal (ats_int_type, tmp21) ;
ATSlocal (ats_ldouble_type, tmp22) ;
ATSlocal (ats_bool_type, tmp23) ;
ATSlocal (ats_int_type, tmp24) ;
ATSlocal (ats_ldouble_type, tmp25) ;
ATSlocal (ats_bool_type, tmp26) ;

__ats_lab_loop_5:
do {
/* branch: __ats_lab_6 */
__ats_lab_6_0:
__ats_lab_6_1:
tmp20 = atspre_igte (arg1, 2) ;
if (!tmp20) { goto __ats_lab_7_1 ; }
tmp21 = atspre_idiv (arg1, 2) ;
tmp22 = atspre_mul_ldouble_ldouble (arg0, arg0) ;
tmp24 = atspre_iadd (tmp21, tmp21) ;
tmp23 = atspre_igt (arg1, tmp24) ;
if (tmp23) {
tmp25 = atspre_mul_ldouble_ldouble (arg0, arg2) ;
arg0 = tmp22 ;
arg1 = tmp21 ;
arg2 = tmp25 ;
goto __ats_lab_loop_5 ; // tail call
} else {
arg0 = tmp22 ;
arg1 = tmp21 ;
arg2 = arg2 ;
goto __ats_lab_loop_5 ; // tail call
} /* end of [if] */
break ;

/* branch: __ats_lab_7 */
__ats_lab_7_0:
__ats_lab_7_1:
tmp26 = atspre_igte (arg1, 1) ;
if (!tmp26) { goto __ats_lab_8_1 ; }
tmp19 = atspre_mul_ldouble_ldouble (arg0, arg2) ;
break ;

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

/*
// /nix/store/rfja8ixrs5wb4kj3kiwlch1apnh7qgvy-ats-0.2.12/lib/ats-anairiats-0.2.12/prelude/DATS/float.dats: 2560(line=82, offs=28) -- 2930(line=96, offs=4)
*/
ATSglobaldec()
ats_ldouble_type
ATS_2d0_2e2_2e12_2prelude_2SATS_2float_2esats__pow_ldouble_int1 (ats_ldouble_type arg0, ats_int_type arg1) {
/* local vardec */
ATSlocal (ats_ldouble_type, tmp18) ;

__ats_lab_ATS_2d0_2e2_2e12_2prelude_2SATS_2float_2esats__pow_ldouble_int1:
tmp18 = loop_5 (arg0, arg1, 1.0) ;
return (tmp18) ;
} /* end of [ATS_2d0_2e2_2e12_2prelude_2SATS_2float_2esats__pow_ldouble_int1] */

/* static load function */

// extern ats_void_type ATS_2d0_2e2_2e12_2prelude_2SATS_2float_2esats__staload (void) ;

ats_void_type
ATS_2d0_2e2_2e12_2prelude_2DATS_2float_2edats__staload () {
static int ATS_2d0_2e2_2e12_2prelude_2DATS_2float_2edats__staload_flag = 0 ;
if (ATS_2d0_2e2_2e12_2prelude_2DATS_2float_2edats__staload_flag) return ;
ATS_2d0_2e2_2e12_2prelude_2DATS_2float_2edats__staload_flag = 1 ;

// ATS_2d0_2e2_2e12_2prelude_2SATS_2float_2esats__staload () ;

return ;
} /* staload function */

/* dynamic load function */

// dynload flag declaration
// extern ats_int_type ATS_2d0_2e2_2e12_2prelude_2DATS_2float_2edats__dynload_flag ;

ats_void_type
ATS_2d0_2e2_2e12_2prelude_2DATS_2float_2edats__dynload () {
// ATS_2d0_2e2_2e12_2prelude_2DATS_2float_2edats__dynload_flag = 1 ;
ATS_2d0_2e2_2e12_2prelude_2DATS_2float_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 [DATS_float_dats.c] */
