ats_void_type
ATS_2d0_2e2_2e10_2libc_2sys_2SATS_2socket_in_2esats__bind_in_exn (ats_int_type arg0, ats_ref_type arg1) {
/* local vardec */
// ATSlocal_void (tmp0) ;
ATSlocal (ats_int_type, tmp1) ;
ATSlocal (ats_int_type, tmp2) ;
ATSlocal (ats_bool_type, tmp3) ;
// ATSlocal_void (tmp4) ;
// ATSlocal_void (tmp5) ;

__ats_lab_ATS_2d0_2e2_2e10_2libc_2sys_2SATS_2socket_in_2esats__bind_in_exn:
tmp1 = atslib_bind_err (arg0, arg1, atslib_socklen_in) ;
tmp2 = ats_selsin_mac(tmp1, atslab_1) ;
tmp3 = atspre_igte (tmp2, 0) ;
if (tmp3) {
/* empty */
} else {
/* tmp4 = */ atslib_perror (ATSstrcst("bind")) ;
/* tmp5 = */ ats_exit (EXIT_FAILURE) ;
arg0 = arg0 ;
arg1 = arg1 ;
goto __ats_lab_ATS_2d0_2e2_2e10_2libc_2sys_2SATS_2socket_in_2esats__bind_in_exn ; // tail call
} /* end of [if] */
return /* (tmp0) */ ;
} /* end of [ATS_2d0_2e2_2e10_2libc_2sys_2SATS_2socket_in_2esats__bind_in_exn] */
ats_void_type
ATS_2d0_2e2_2e10_2libc_2sys_2SATS_2socket_in_2esats__connect_in_exn (ats_int_type arg0, ats_ref_type arg1) {
/* local vardec */
// ATSlocal_void (tmp6) ;
ATSlocal (ats_int_type, tmp7) ;
ATSlocal (ats_int_type, tmp8) ;
ATSlocal (ats_bool_type, tmp9) ;
// ATSlocal_void (tmp10) ;
// ATSlocal_void (tmp11) ;

__ats_lab_ATS_2d0_2e2_2e10_2libc_2sys_2SATS_2socket_in_2esats__connect_in_exn:
tmp7 = atslib_connect_err (arg0, arg1, atslib_socklen_in) ;
tmp8 = ats_selsin_mac(tmp7, atslab_1) ;
tmp9 = atspre_igte (tmp8, 0) ;
if (tmp9) {
/* empty */
} else {
/* tmp10 = */ atslib_perror (ATSstrcst("connect")) ;
/* tmp11 = */ ats_exit (EXIT_FAILURE) ;
arg0 = arg0 ;
arg1 = arg1 ;
goto __ats_lab_ATS_2d0_2e2_2e10_2libc_2sys_2SATS_2socket_in_2esats__connect_in_exn ; // tail call
} /* end of [if] */
return /* (tmp6) */ ;
} /* end of [ATS_2d0_2e2_2e10_2libc_2sys_2SATS_2socket_in_2esats__connect_in_exn] */
ats_size_type
atslib_fildes_read_all_exn (ats_int_type arg0, ats_ref_type arg1, ats_size_type arg2) {
/* local vardec */
ATSlocal (ats_size_type, tmp30) ;
ATSlocal (ats_ssize_type, tmp31) ;
ATSlocal (ats_bool_type, tmp32) ;
// ATSlocal_void (tmp33) ;

__ats_lab_atslib_fildes_read_all_exn:
tmp31 = atslib_fildes_read_all_err (arg0, arg1, arg2) ;
tmp32 = atspre_gte_ssize1_int1 (tmp31, 0) ;
if (tmp32) {
tmp30 = ats_castfn_mac(ats_size_type, tmp31) ;
} else {
/* tmp33 = */ atslib_perror (ATSstrcst("read")) ;
/* tmp30 = */ ats_exit_errmsg (EXIT_FAILURE, ATSstrcst("exit(ATS): [read_all] failed\n")) ;
} /* end of [if] */
return (tmp30) ;
} /* end of [atslib_fildes_read_all_exn] */
ats_void_type
atslib_fildes_write_all_exn (ats_int_type arg0, ats_ref_type arg1, ats_size_type arg2) {
/* local vardec */
// ATSlocal_void (tmp49) ;
ATSlocal (ats_int_type, tmp50) ;
ATSlocal (ats_ssize_type, tmp51) ;
ATSlocal (ats_bool_type, tmp53) ;
ATSlocal (ats_bool_type, tmp54) ;
ATSlocal (ats_int_type, tmp55) ;
ATSlocal (ats_int_type, tmp56) ;
ATSlocal (ats_bool_type, tmp57) ;
// ATSlocal_void (tmp58) ;

__ats_lab_atslib_fildes_write_all_exn:
/* ats_int_type tmp50 ; */
tmp50 = 0 ;
tmp51 = atslib_fildes_write_all_err (arg0, arg1, arg2) ;
tmp53 = atspre_gte_ssize1_int1 (tmp51, 0) ;
if (tmp53) {
tmp54 = atspre_lt_size1_size1 (ats_castfn_mac(ats_size_type, tmp51), arg2) ;
if (tmp54) {
tmp55 = atspre_iadd (tmp50, 1) ;
tmp50 = tmp55 ;
} else {
/* empty */
} /* end of [if] */
} else {
tmp56 = atspre_iadd (tmp50, 1) ;
tmp50 = tmp56 ;
} /* end of [if] */
tmp57 = atspre_gt_int_int (tmp50, 0) ;
if (tmp57) {
/* tmp58 = */ atslib_perror (ATSstrcst("write")) ;
/* tmp49 = */ ats_exit_errmsg (EXIT_FAILURE, ATSstrcst("exit(ATS): [write_all]: failed\n")) ;
} else {
/* empty */
} /* end of [if] */
return /* (tmp49) */ ;
} /* end of [atslib_fildes_write_all_exn] */
ats_void_type
ATS_2d0_2e2_2e12_2libc_2SATS_2fcntl_2esats__close_loop_exn (ats_int_type arg0) {
/* local vardec */
// ATSlocal_void (tmp7) ;
ATSlocal (ats_int_type, tmp8) ;
ATSlocal (ats_int_type, tmp9) ;
ATSlocal (ats_bool_type, tmp10) ;
// ATSlocal_void (tmp11) ;
// ATSlocal_void (tmp12) ;

__ats_lab_ATS_2d0_2e2_2e12_2libc_2SATS_2fcntl_2esats__close_loop_exn:
tmp8 = ATS_2d0_2e2_2e12_2libc_2SATS_2fcntl_2esats__close_loop_err (arg0) ;
tmp9 = ats_selsin_mac(tmp8, atslab_1) ;
tmp10 = atspre_igte (tmp9, 0) ;
if (tmp10) {
/* empty */
} else {
/* tmp11 = */ atslib_perror (ATSstrcst("close")) ;
/* tmp12 = */ atspre_prerrf_exn (ATSstrcst("exit(ATS): [close_loop] failed\n")) ;
/* tmp7 = */ ats_exit (EXIT_FAILURE) ;
} /* end of [if] */
return /* (tmp7) */ ;
} /* end of [ATS_2d0_2e2_2e12_2libc_2SATS_2fcntl_2esats__close_loop_exn] */
ats_pid_type
atslib_fork_exn () {
/* local vardec */
ATSlocal (ats_pid_type, tmp0) ;
ATSlocal (ats_pid_type, tmp1) ;
ATSlocal (ats_bool_type, tmp2) ;
// ATSlocal_void (tmp3) ;
ATSlocal (ats_int_type, tmp4) ;
// ATSlocal_void (tmp5) ;

__ats_lab_atslib_fork_exn:
tmp1 = atslib_fork_err () ;
tmp2 = atspre_lt_int_int (ats_castfn_mac(ats_int_type, tmp1), 0) ;
if (tmp2) {
tmp4 = atslib_errno_get () ;
/* tmp5 = */ atslib_perror (ATSstrcst("fork")) ;
/* tmp3 = */ ats_exit_errmsg (ats_castfn_mac(ats_int_type, tmp4), ATSstrcst("exit(ATS): [fork] failed.\n")) ;
} else {
/* empty */
} /* end of [if] */
tmp0 = tmp1 ;
return (tmp0) ;
} /* end of [atslib_fork_exn] */