PageRenderTime 75ms CodeModel.GetById 38ms RepoModel.GetById 0ms app.codeStats 0ms

/cyclone/bin/genfiles/string.c

https://bitbucket.org/mirrorbot/cyclone-full
C | 1074 lines | 1014 code | 33 blank | 27 comment | 104 complexity | 50a8a3e9196512a1586b47de5639a1d6 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1, LGPL-2.0, BSD-3-Clause

Large files files are truncated, but you can click here to view the full file

  1. #include <setjmp.h>
  2. /* This is a C header used by the output of the Cyclone to
  3. C translator. Corresponding definitions are in file lib/runtime_*.c */
  4. #ifndef _CYC_INCLUDE_H_
  5. #define _CYC_INCLUDE_H_
  6. /* Need one of these per thread (see runtime_stack.c). The runtime maintains
  7. a stack that contains either _handler_cons structs or _RegionHandle structs.
  8. The tag is 0 for a handler_cons and 1 for a region handle. */
  9. struct _RuntimeStack {
  10. int tag;
  11. struct _RuntimeStack *next;
  12. void (*cleanup)(struct _RuntimeStack *frame);
  13. };
  14. #ifndef offsetof
  15. /* should be size_t but int is fine */
  16. #define offsetof(t,n) ((int)(&(((t*)0)->n)))
  17. #endif
  18. /* Fat pointers */
  19. struct _fat_ptr {
  20. unsigned char *curr;
  21. unsigned char *base;
  22. unsigned char *last_plus_one;
  23. };
  24. /* Regions */
  25. struct _RegionPage
  26. {
  27. #ifdef CYC_REGION_PROFILE
  28. unsigned total_bytes;
  29. unsigned free_bytes;
  30. #endif
  31. struct _RegionPage *next;
  32. char data[1];
  33. };
  34. struct _pool;
  35. struct bget_region_key;
  36. struct _RegionAllocFunctions;
  37. struct _RegionHandle {
  38. struct _RuntimeStack s;
  39. struct _RegionPage *curr;
  40. #if(defined(__linux__) && defined(__KERNEL__))
  41. struct _RegionPage *vpage;
  42. #endif
  43. struct _RegionAllocFunctions *fcns;
  44. char *offset;
  45. char *last_plus_one;
  46. struct _pool *released_ptrs;
  47. struct bget_region_key *key;
  48. #ifdef CYC_REGION_PROFILE
  49. const char *name;
  50. #endif
  51. unsigned used_bytes;
  52. unsigned wasted_bytes;
  53. };
  54. // A dynamic region is just a region handle. The wrapper struct is for type
  55. // abstraction.
  56. struct Cyc_Core_DynamicRegion {
  57. struct _RegionHandle h;
  58. };
  59. /* Alias qualifier stuff */
  60. typedef unsigned int _AliasQualHandle_t; // must match aqualt_type() in toc.cyc
  61. struct _RegionHandle _new_region(unsigned int, const char*);
  62. void* _region_malloc(struct _RegionHandle*, _AliasQualHandle_t, unsigned);
  63. void* _region_calloc(struct _RegionHandle*, _AliasQualHandle_t, unsigned t, unsigned n);
  64. void* _region_vmalloc(struct _RegionHandle*, unsigned);
  65. void * _aqual_malloc(_AliasQualHandle_t aq, unsigned int s);
  66. void * _aqual_calloc(_AliasQualHandle_t aq, unsigned int n, unsigned int t);
  67. void _free_region(struct _RegionHandle*);
  68. /* Exceptions */
  69. struct _handler_cons {
  70. struct _RuntimeStack s;
  71. jmp_buf handler;
  72. };
  73. void _push_handler(struct _handler_cons*);
  74. void _push_region(struct _RegionHandle*);
  75. void _npop_handler(int);
  76. void _pop_handler();
  77. void _pop_region();
  78. #ifndef _throw
  79. void* _throw_null_fn(const char*,unsigned);
  80. void* _throw_arraybounds_fn(const char*,unsigned);
  81. void* _throw_badalloc_fn(const char*,unsigned);
  82. void* _throw_match_fn(const char*,unsigned);
  83. void* _throw_assert_fn(const char *,unsigned);
  84. void* _throw_fn(void*,const char*,unsigned);
  85. void* _rethrow(void*);
  86. #define _throw_null() (_throw_null_fn(__FILE__,__LINE__))
  87. #define _throw_arraybounds() (_throw_arraybounds_fn(__FILE__,__LINE__))
  88. #define _throw_badalloc() (_throw_badalloc_fn(__FILE__,__LINE__))
  89. #define _throw_match() (_throw_match_fn(__FILE__,__LINE__))
  90. #define _throw_assert() (_throw_assert_fn(__FILE__,__LINE__))
  91. #define _throw(e) (_throw_fn((e),__FILE__,__LINE__))
  92. #endif
  93. void* Cyc_Core_get_exn_thrown();
  94. /* Built-in Exceptions */
  95. struct Cyc_Null_Exception_exn_struct { char *tag; };
  96. struct Cyc_Array_bounds_exn_struct { char *tag; };
  97. struct Cyc_Match_Exception_exn_struct { char *tag; };
  98. struct Cyc_Bad_alloc_exn_struct { char *tag; };
  99. struct Cyc_Assert_exn_struct { char *tag; };
  100. extern char Cyc_Null_Exception[];
  101. extern char Cyc_Array_bounds[];
  102. extern char Cyc_Match_Exception[];
  103. extern char Cyc_Bad_alloc[];
  104. extern char Cyc_Assert[];
  105. /* Built-in Run-time Checks and company */
  106. #ifdef NO_CYC_NULL_CHECKS
  107. #define _check_null(ptr) (ptr)
  108. #else
  109. #define _check_null(ptr) \
  110. ({ typeof(ptr) _cks_null = (ptr); \
  111. if (!_cks_null) _throw_null(); \
  112. _cks_null; })
  113. #endif
  114. #ifdef NO_CYC_BOUNDS_CHECKS
  115. #define _check_known_subscript_notnull(ptr,bound,elt_sz,index)\
  116. (((char*)ptr) + (elt_sz)*(index))
  117. #ifdef NO_CYC_NULL_CHECKS
  118. #define _check_known_subscript_null _check_known_subscript_notnull
  119. #else
  120. #define _check_known_subscript_null(ptr,bound,elt_sz,index) ({ \
  121. char*_cks_ptr = (char*)(ptr);\
  122. int _index = (index);\
  123. if (!_cks_ptr) _throw_null(); \
  124. _cks_ptr + (elt_sz)*_index; })
  125. #endif
  126. #define _zero_arr_plus_char_fn(orig_x,orig_sz,orig_i,f,l) ((orig_x)+(orig_i))
  127. #define _zero_arr_plus_other_fn(t_sz,orig_x,orig_sz,orig_i,f,l)((orig_x)+(orig_i))
  128. #else
  129. #define _check_known_subscript_null(ptr,bound,elt_sz,index) ({ \
  130. char*_cks_ptr = (char*)(ptr); \
  131. unsigned _cks_index = (index); \
  132. if (!_cks_ptr) _throw_null(); \
  133. if (_cks_index >= (bound)) _throw_arraybounds(); \
  134. _cks_ptr + (elt_sz)*_cks_index; })
  135. #define _check_known_subscript_notnull(ptr,bound,elt_sz,index) ({ \
  136. char*_cks_ptr = (char*)(ptr); \
  137. unsigned _cks_index = (index); \
  138. if (_cks_index >= (bound)) _throw_arraybounds(); \
  139. _cks_ptr + (elt_sz)*_cks_index; })
  140. /* _zero_arr_plus_*_fn(x,sz,i,filename,lineno) adds i to zero-terminated ptr
  141. x that has at least sz elements */
  142. char* _zero_arr_plus_char_fn(char*,unsigned,int,const char*,unsigned);
  143. void* _zero_arr_plus_other_fn(unsigned,void*,unsigned,int,const char*,unsigned);
  144. #endif
  145. /* _get_zero_arr_size_*(x,sz) returns the number of elements in a
  146. zero-terminated array that is NULL or has at least sz elements */
  147. unsigned _get_zero_arr_size_char(const char*,unsigned);
  148. unsigned _get_zero_arr_size_other(unsigned,const void*,unsigned);
  149. /* _zero_arr_inplace_plus_*_fn(x,i,filename,lineno) sets
  150. zero-terminated pointer *x to *x + i */
  151. char* _zero_arr_inplace_plus_char_fn(char**,int,const char*,unsigned);
  152. char* _zero_arr_inplace_plus_post_char_fn(char**,int,const char*,unsigned);
  153. // note: must cast result in toc.cyc
  154. void* _zero_arr_inplace_plus_other_fn(unsigned,void**,int,const char*,unsigned);
  155. void* _zero_arr_inplace_plus_post_other_fn(unsigned,void**,int,const char*,unsigned);
  156. #define _zero_arr_plus_char(x,s,i) \
  157. (_zero_arr_plus_char_fn(x,s,i,__FILE__,__LINE__))
  158. #define _zero_arr_inplace_plus_char(x,i) \
  159. _zero_arr_inplace_plus_char_fn((char**)(x),i,__FILE__,__LINE__)
  160. #define _zero_arr_inplace_plus_post_char(x,i) \
  161. _zero_arr_inplace_plus_post_char_fn((char**)(x),(i),__FILE__,__LINE__)
  162. #define _zero_arr_plus_other(t,x,s,i) \
  163. (_zero_arr_plus_other_fn(t,x,s,i,__FILE__,__LINE__))
  164. #define _zero_arr_inplace_plus_other(t,x,i) \
  165. _zero_arr_inplace_plus_other_fn(t,(void**)(x),i,__FILE__,__LINE__)
  166. #define _zero_arr_inplace_plus_post_other(t,x,i) \
  167. _zero_arr_inplace_plus_post_other_fn(t,(void**)(x),(i),__FILE__,__LINE__)
  168. #ifdef NO_CYC_BOUNDS_CHECKS
  169. #define _check_fat_subscript(arr,elt_sz,index) ((arr).curr + (elt_sz) * (index))
  170. #define _untag_fat_ptr(arr,elt_sz,num_elts) ((arr).curr)
  171. #define _untag_fat_ptr_check_bound(arr,elt_sz,num_elts) ((arr).curr)
  172. #define _check_fat_at_base(arr) (arr)
  173. #else
  174. #define _check_fat_subscript(arr,elt_sz,index) ({ \
  175. struct _fat_ptr _cus_arr = (arr); \
  176. unsigned char *_cus_ans = _cus_arr.curr + (elt_sz) * (index); \
  177. /* JGM: not needed! if (!_cus_arr.base) _throw_null();*/ \
  178. if (_cus_ans < _cus_arr.base || _cus_ans >= _cus_arr.last_plus_one) \
  179. _throw_arraybounds(); \
  180. _cus_ans; })
  181. #define _untag_fat_ptr(arr,elt_sz,num_elts) ((arr).curr)
  182. #define _untag_fat_ptr_check_bound(arr,elt_sz,num_elts) ({ \
  183. struct _fat_ptr _arr = (arr); \
  184. unsigned char *_curr = _arr.curr; \
  185. if ((_curr < _arr.base || _curr + (elt_sz) * (num_elts) > _arr.last_plus_one) &&\
  186. _curr != (unsigned char*)0) \
  187. _throw_arraybounds(); \
  188. _curr; })
  189. #define _check_fat_at_base(arr) ({ \
  190. struct _fat_ptr _arr = (arr); \
  191. if (_arr.base != _arr.curr) _throw_arraybounds(); \
  192. _arr; })
  193. #endif
  194. #define _tag_fat(tcurr,elt_sz,num_elts) ({ \
  195. struct _fat_ptr _ans; \
  196. unsigned _num_elts = (num_elts);\
  197. _ans.base = _ans.curr = (void*)(tcurr); \
  198. /* JGM: if we're tagging NULL, ignore num_elts */ \
  199. _ans.last_plus_one = _ans.base ? (_ans.base + (elt_sz) * _num_elts) : 0; \
  200. _ans; })
  201. #define _get_fat_size(arr,elt_sz) \
  202. ({struct _fat_ptr _arr = (arr); \
  203. unsigned char *_arr_curr=_arr.curr; \
  204. unsigned char *_arr_last=_arr.last_plus_one; \
  205. (_arr_curr < _arr.base || _arr_curr >= _arr_last) ? 0 : \
  206. ((_arr_last - _arr_curr) / (elt_sz));})
  207. #define _fat_ptr_plus(arr,elt_sz,change) ({ \
  208. struct _fat_ptr _ans = (arr); \
  209. int _change = (change);\
  210. _ans.curr += (elt_sz) * _change;\
  211. _ans; })
  212. #define _fat_ptr_inplace_plus(arr_ptr,elt_sz,change) ({ \
  213. struct _fat_ptr * _arr_ptr = (arr_ptr); \
  214. _arr_ptr->curr += (elt_sz) * (change);\
  215. *_arr_ptr; })
  216. #define _fat_ptr_inplace_plus_post(arr_ptr,elt_sz,change) ({ \
  217. struct _fat_ptr * _arr_ptr = (arr_ptr); \
  218. struct _fat_ptr _ans = *_arr_ptr; \
  219. _arr_ptr->curr += (elt_sz) * (change);\
  220. _ans; })
  221. //Not a macro since initialization order matters. Defined in runtime_zeroterm.c.
  222. struct _fat_ptr _fat_ptr_decrease_size(struct _fat_ptr,unsigned sz,unsigned numelts);
  223. #ifdef CYC_GC_PTHREAD_REDIRECTS
  224. # define pthread_create GC_pthread_create
  225. # define pthread_sigmask GC_pthread_sigmask
  226. # define pthread_join GC_pthread_join
  227. # define pthread_detach GC_pthread_detach
  228. # define dlopen GC_dlopen
  229. #endif
  230. /* Allocation */
  231. void* GC_malloc(int);
  232. void* GC_malloc_atomic(int);
  233. void* GC_calloc(unsigned,unsigned);
  234. void* GC_calloc_atomic(unsigned,unsigned);
  235. #if(defined(__linux__) && defined(__KERNEL__))
  236. void *cyc_vmalloc(unsigned);
  237. void cyc_vfree(void*);
  238. #endif
  239. // bound the allocation size to be < MAX_ALLOC_SIZE. See macros below for usage.
  240. #define MAX_MALLOC_SIZE (1 << 28)
  241. void* _bounded_GC_malloc(int,const char*,int);
  242. void* _bounded_GC_malloc_atomic(int,const char*,int);
  243. void* _bounded_GC_calloc(unsigned,unsigned,const char*,int);
  244. void* _bounded_GC_calloc_atomic(unsigned,unsigned,const char*,int);
  245. /* these macros are overridden below ifdef CYC_REGION_PROFILE */
  246. #ifndef CYC_REGION_PROFILE
  247. #define _cycalloc(n) _bounded_GC_malloc(n,__FILE__,__LINE__)
  248. #define _cycalloc_atomic(n) _bounded_GC_malloc_atomic(n,__FILE__,__LINE__)
  249. #define _cyccalloc(n,s) _bounded_GC_calloc(n,s,__FILE__,__LINE__)
  250. #define _cyccalloc_atomic(n,s) _bounded_GC_calloc_atomic(n,s,__FILE__,__LINE__)
  251. #endif
  252. static inline unsigned int _check_times(unsigned x, unsigned y) {
  253. unsigned long long whole_ans =
  254. ((unsigned long long) x)*((unsigned long long)y);
  255. unsigned word_ans = (unsigned)whole_ans;
  256. if(word_ans < whole_ans || word_ans > MAX_MALLOC_SIZE)
  257. _throw_badalloc();
  258. return word_ans;
  259. }
  260. #define _CYC_MAX_REGION_CONST 0
  261. #define _CYC_MIN_ALIGNMENT (sizeof(double))
  262. #ifdef CYC_REGION_PROFILE
  263. extern int rgn_total_bytes;
  264. #endif
  265. static inline void*_fast_region_malloc(struct _RegionHandle*r, _AliasQualHandle_t aq, unsigned orig_s) {
  266. if (r > (struct _RegionHandle*)_CYC_MAX_REGION_CONST && r->curr != 0) {
  267. #ifdef CYC_NOALIGN
  268. unsigned s = orig_s;
  269. #else
  270. unsigned s = (orig_s + _CYC_MIN_ALIGNMENT - 1) & (~(_CYC_MIN_ALIGNMENT -1));
  271. #endif
  272. char *result;
  273. result = r->offset;
  274. if (s <= (r->last_plus_one - result)) {
  275. r->offset = result + s;
  276. #ifdef CYC_REGION_PROFILE
  277. r->curr->free_bytes = r->curr->free_bytes - s;
  278. rgn_total_bytes += s;
  279. #endif
  280. return result;
  281. }
  282. }
  283. return _region_malloc(r,aq,orig_s);
  284. }
  285. //doesn't make sense to fast malloc with reaps
  286. #ifndef DISABLE_REAPS
  287. #define _fast_region_malloc _region_malloc
  288. #endif
  289. #ifdef CYC_REGION_PROFILE
  290. /* see macros below for usage. defined in runtime_memory.c */
  291. void* _profile_GC_malloc(int,const char*,const char*,int);
  292. void* _profile_GC_malloc_atomic(int,const char*,const char*,int);
  293. void* _profile_GC_calloc(unsigned,unsigned,const char*,const char*,int);
  294. void* _profile_GC_calloc_atomic(unsigned,unsigned,const char*,const char*,int);
  295. void* _profile_region_malloc(struct _RegionHandle*,_AliasQualHandle_t,unsigned,const char*,const char*,int);
  296. void* _profile_region_calloc(struct _RegionHandle*,_AliasQualHandle_t,unsigned,unsigned,const char *,const char*,int);
  297. void * _profile_aqual_malloc(_AliasQualHandle_t aq, unsigned int s,const char *file, const char *func, int lineno);
  298. void * _profile_aqual_calloc(_AliasQualHandle_t aq, unsigned int t1,unsigned int t2,const char *file, const char *func, int lineno);
  299. struct _RegionHandle _profile_new_region(unsigned int i, const char*,const char*,const char*,int);
  300. void _profile_free_region(struct _RegionHandle*,const char*,const char*,int);
  301. #ifndef RUNTIME_CYC
  302. #define _new_region(i,n) _profile_new_region(i,n,__FILE__,__FUNCTION__,__LINE__)
  303. #define _free_region(r) _profile_free_region(r,__FILE__,__FUNCTION__,__LINE__)
  304. #define _region_malloc(rh,aq,n) _profile_region_malloc(rh,aq,n,__FILE__,__FUNCTION__,__LINE__)
  305. #define _region_calloc(rh,aq,n,t) _profile_region_calloc(rh,aq,n,t,__FILE__,__FUNCTION__,__LINE__)
  306. #define _aqual_malloc(aq,n) _profile_aqual_malloc(aq,n,__FILE__,__FUNCTION__,__LINE__)
  307. #define _aqual_calloc(aq,n,t) _profile_aqual_calloc(aq,n,t,__FILE__,__FUNCTION__,__LINE__)
  308. #endif
  309. #define _cycalloc(n) _profile_GC_malloc(n,__FILE__,__FUNCTION__,__LINE__)
  310. #define _cycalloc_atomic(n) _profile_GC_malloc_atomic(n,__FILE__,__FUNCTION__,__LINE__)
  311. #define _cyccalloc(n,s) _profile_GC_calloc(n,s,__FILE__,__FUNCTION__,__LINE__)
  312. #define _cyccalloc_atomic(n,s) _profile_GC_calloc_atomic(n,s,__FILE__,__FUNCTION__,__LINE__)
  313. #endif //CYC_REGION_PROFILE
  314. #endif //_CYC_INCLUDE_H
  315. # 95 "core.h"
  316. struct _fat_ptr Cyc_Core_new_string(unsigned);
  317. # 100
  318. struct _fat_ptr Cyc_Core_rnew_string(struct _RegionHandle*,unsigned);
  319. # 105
  320. struct _fat_ptr Cyc_Core_rqnew_string(struct _RegionHandle*,unsigned,unsigned);extern char Cyc_Core_Invalid_argument[17U];struct Cyc_Core_Invalid_argument_exn_struct{char*tag;struct _fat_ptr f1;};extern char Cyc_Core_Impossible[11U];struct Cyc_Core_Impossible_exn_struct{char*tag;struct _fat_ptr f1;};
  321. # 173
  322. extern struct _RegionHandle*Cyc_Core_heap_region;
  323. # 179
  324. extern unsigned Cyc_Core_aliasable_qual;
  325. # 351 "core.h"
  326. struct _fat_ptr Cyc_Core_mkfat(void*,unsigned,unsigned);struct Cyc_List_List{void*hd;struct Cyc_List_List*tl;};
  327. # 61 "list.h"
  328. extern int Cyc_List_length(struct Cyc_List_List*);
  329. # 310 "cycboot.h"
  330. extern int toupper(int);
  331. # 72 "string.h"
  332. struct _fat_ptr Cyc_strncpy(struct _fat_ptr,struct _fat_ptr,unsigned long);
  333. # 106 "string.h"
  334. struct _fat_ptr Cyc_rstrdup(struct _RegionHandle*,struct _fat_ptr);
  335. # 37 "string.cyc"
  336. unsigned long Cyc_strlen(struct _fat_ptr s){struct _fat_ptr _T0;struct _fat_ptr _T1;unsigned char*_T2;const char*_T3;const char*_T4;unsigned long _T5;int _T6;char _T7;int _T8;unsigned long _T9;unsigned long _TA;
  337. # 39
  338. unsigned long i;_T0=s;{
  339. unsigned sz=_get_fat_size(_T0,sizeof(char));
  340. i=0U;_TL3: if(1)goto _TL4;else{goto _TL2;}_TL4: if(i < sz)goto _TL1;else{goto _TL2;}
  341. _TL1: _T1=s;_T2=_T1.curr;_T3=(const char*)_T2;_T4=_check_null(_T3);_T5=i;_T6=(int)_T5;_T7=_T4[_T6];_T8=(int)_T7;if(_T8!=0)goto _TL5;_T9=i;
  342. return _T9;_TL5:
  343. # 41
  344. i=i + 1;goto _TL3;_TL2: _TA=i;
  345. # 44
  346. return _TA;}}
  347. # 47
  348. inline static unsigned Cyc_umin(unsigned i,unsigned j){unsigned _T0;unsigned _T1;
  349. # 49
  350. if(i >= j)goto _TL7;_T0=i;return _T0;_TL7: _T1=j;return _T1;}
  351. # 51
  352. inline static unsigned Cyc_umax(unsigned i,unsigned j){unsigned _T0;unsigned _T1;
  353. # 53
  354. if(i <= j)goto _TL9;_T0=i;return _T0;_TL9: _T1=j;return _T1;}
  355. # 59
  356. int Cyc_strcmp(struct _fat_ptr s1,struct _fat_ptr s2){struct _fat_ptr _T0;unsigned char*_T1;char*_T2;struct _fat_ptr _T3;unsigned char*_T4;char*_T5;struct _fat_ptr _T6;struct _fat_ptr _T7;int _T8;unsigned _T9;unsigned _TA;struct _fat_ptr _TB;unsigned char*_TC;const char*_TD;const char*_TE;int _TF;struct _fat_ptr _T10;unsigned char*_T11;const char*_T12;const char*_T13;int _T14;char _T15;int _T16;int _T17;char _T18;int _T19;char _T1A;int _T1B;char _T1C;int _T1D;char _T1E;int _T1F;int _T20;int _T21;struct _fat_ptr _T22;unsigned char*_T23;const char*_T24;const char*_T25;int _T26;char _T27;int _T28;int _T29;struct _fat_ptr _T2A;unsigned char*_T2B;const char*_T2C;const char*_T2D;int _T2E;char _T2F;int _T30;_T0=s1;_T1=_T0.curr;_T2=(char*)_T1;_T3=s2;_T4=_T3.curr;_T5=(char*)_T4;
  357. if(_T2!=_T5)goto _TLB;
  358. return 0;_TLB: {
  359. int i=0;_T6=s1;{
  360. unsigned sz1=_get_fat_size(_T6,sizeof(char));_T7=s2;{
  361. unsigned sz2=_get_fat_size(_T7,sizeof(char));
  362. unsigned minsz=Cyc_umin(sz1,sz2);
  363. # 67
  364. _TL10: if(1)goto _TL11;else{goto _TLF;}_TL11: _T8=i;_T9=(unsigned)_T8;_TA=minsz;if(_T9 < _TA)goto _TLE;else{goto _TLF;}
  365. _TLE: _TB=s1;_TC=_TB.curr;_TD=(const char*)_TC;_TE=_check_null(_TD);_TF=i;{char c1=_TE[_TF];_T10=s2;_T11=_T10.curr;_T12=(const char*)_T11;_T13=
  366. _check_null(_T12);_T14=i;{char c2=_T13[_T14];_T15=c1;_T16=(int)_T15;
  367. if(_T16!=0)goto _TL12;_T18=c2;_T19=(int)_T18;
  368. if(_T19!=0)goto _TL14;_T17=0;goto _TL15;_TL14: _T17=- 1;_TL15: return _T17;_TL12: _T1A=c2;_T1B=(int)_T1A;
  369. if(_T1B!=0)goto _TL16;return 1;_TL16: _T1C=c1;_T1D=(int)_T1C;_T1E=c2;_T1F=(int)_T1E;{
  370. int diff=_T1D - _T1F;
  371. if(diff==0)goto _TL18;_T20=diff;return _T20;_TL18:;}}}
  372. # 67
  373. i=i + 1;goto _TL10;_TLF:
  374. # 76
  375. if(sz1!=sz2)goto _TL1A;return 0;_TL1A:
  376. if(sz1 >= sz2)goto _TL1C;_T22=s2;_T23=_T22.curr;_T24=(const char*)_T23;_T25=_check_null(_T24);_T26=i;_T27=_T25[_T26];_T28=(int)_T27;if(_T28!=0)goto _TL1E;_T21=0;goto _TL1F;_TL1E: _T21=- 1;_TL1F: return _T21;_TL1C: _T2A=s1;_T2B=_T2A.curr;_T2C=(const char*)_T2B;_T2D=
  377. # 79
  378. _check_null(_T2C);_T2E=i;_T2F=_T2D[_T2E];_T30=(int)_T2F;if(_T30!=0)goto _TL20;_T29=0;goto _TL21;_TL20: _T29=1;_TL21: return _T29;}}}}
  379. # 82
  380. int Cyc_strptrcmp(struct _fat_ptr*s1,struct _fat_ptr*s2){struct _fat_ptr*_T0;struct _fat_ptr _T1;struct _fat_ptr*_T2;struct _fat_ptr _T3;int _T4;_T0=s1;_T1=*_T0;_T2=s2;_T3=*_T2;_T4=
  381. Cyc_strcmp(_T1,_T3);return _T4;}
  382. # 86
  383. inline static int Cyc_ncmp(struct _fat_ptr s1,unsigned long len1,struct _fat_ptr s2,unsigned long len2,unsigned long n){struct _fat_ptr _T0;unsigned char*_T1;const char*_T2;const char*_T3;unsigned _T4;int _T5;char _T6;int _T7;struct _fat_ptr _T8;unsigned char*_T9;const char*_TA;const char*_TB;unsigned _TC;int _TD;char _TE;int _TF;int _T10;int _T11;unsigned long _T12;int _T13;unsigned long _T14;int _T15;int _T16;
  384. # 89
  385. if(n > 0U)goto _TL22;return 0;_TL22: {
  386. # 91
  387. unsigned long min_len=Cyc_umin(len1,len2);
  388. unsigned long bound=Cyc_umin(min_len,n);{
  389. # 94
  390. unsigned i=0U;_TL27: if(i < bound)goto _TL25;else{goto _TL26;}
  391. _TL25:{int retc;_T0=s1;_T1=_T0.curr;_T2=(const char*)_T1;_T3=
  392. _check_null(_T2);_T4=i;_T5=(int)_T4;_T6=_T3[_T5];_T7=(int)_T6;_T8=s2;_T9=_T8.curr;_TA=(const char*)_T9;_TB=_check_null(_TA);_TC=i;_TD=(int)_TC;_TE=_TB[_TD];_TF=(int)_TE;retc=_T7 - _TF;_T10=retc;if(_T10==0)goto _TL28;_T11=retc;
  393. return _T11;_TL28:;}
  394. # 94
  395. i=i + 1;goto _TL27;_TL26:;}
  396. # 99
  397. if(len1 < n)goto _TL2C;else{goto _TL2D;}_TL2D: if(len2 < n)goto _TL2C;else{goto _TL2A;}
  398. _TL2C: _T12=len1;_T13=(int)_T12;_T14=len2;_T15=(int)_T14;_T16=_T13 - _T15;return _T16;_TL2A:
  399. return 0;}}
  400. # 106
  401. int Cyc_strncmp(struct _fat_ptr s1,struct _fat_ptr s2,unsigned long n){int _T0;
  402. unsigned long len1=Cyc_strlen(s1);
  403. unsigned long len2=Cyc_strlen(s2);_T0=
  404. # 110
  405. Cyc_ncmp(s1,len1,s2,len2,n);return _T0;}
  406. # 117
  407. int Cyc_zstrcmp(struct _fat_ptr a,struct _fat_ptr b){struct _fat_ptr _T0;unsigned char*_T1;char*_T2;struct _fat_ptr _T3;unsigned char*_T4;char*_T5;struct _fat_ptr _T6;struct _fat_ptr _T7;int _T8;unsigned long _T9;unsigned long _TA;int _TB;int _TC;struct _fat_ptr _TD;unsigned char*_TE;const char*_TF;const char*_T10;int _T11;char _T12;int _T13;struct _fat_ptr _T14;unsigned char*_T15;const char*_T16;const char*_T17;int _T18;char _T19;int _T1A;int _T1B;unsigned long _T1C;int _T1D;unsigned long _T1E;int _T1F;int _T20;_T0=a;_T1=_T0.curr;_T2=(char*)_T1;_T3=b;_T4=_T3.curr;_T5=(char*)_T4;
  408. if(_T2!=_T5)goto _TL2E;
  409. return 0;_TL2E: _T6=a;{
  410. unsigned long as=_get_fat_size(_T6,sizeof(char));_T7=b;{
  411. unsigned long bs=_get_fat_size(_T7,sizeof(char));
  412. unsigned long min_length=Cyc_umin(as,bs);
  413. int i=- 1;
  414. # 127
  415. _TL30: i=i + 1;_T8=i;_T9=(unsigned long)_T8;_TA=min_length;_TB=_T9 < _TA;_TC=_TB;if(_TC)goto _TL31;else{goto _TL32;}
  416. _TL31: _TD=a;_TE=_TD.curr;_TF=(const char*)_TE;_T10=_check_null(_TF);_T11=i;_T12=_T10[_T11];_T13=(int)_T12;_T14=b;_T15=_T14.curr;_T16=(const char*)_T15;_T17=_check_null(_T16);_T18=i;_T19=_T17[_T18];_T1A=(int)_T19;{int diff=_T13 - _T1A;
  417. if(diff==0)goto _TL33;_T1B=diff;
  418. return _T1B;_TL33:;}goto _TL30;_TL32: _T1C=as;_T1D=(int)_T1C;_T1E=bs;_T1F=(int)_T1E;_T20=_T1D - _T1F;
  419. # 132
  420. return _T20;}}}
  421. # 135
  422. int Cyc_zstrncmp(struct _fat_ptr s1,struct _fat_ptr s2,unsigned long n){struct _fat_ptr _T0;struct _fat_ptr _T1;int _T2;unsigned long _T3;unsigned long _T4;struct _fat_ptr _T5;unsigned char*_T6;const char*_T7;const char*_T8;int _T9;char _TA;int _TB;struct _fat_ptr _TC;unsigned char*_TD;const char*_TE;const char*_TF;int _T10;char _T11;int _T12;int _T13;struct _fat_ptr _T14;unsigned char*_T15;const char*_T16;int _T17;char _T18;int _T19;struct _fat_ptr _T1A;unsigned char*_T1B;const char*_T1C;int _T1D;char _T1E;int _T1F;int _T20;
  423. if(n > 0U)goto _TL35;return 0;_TL35: _T0=s1;{
  424. # 138
  425. unsigned long s1size=_get_fat_size(_T0,sizeof(char));_T1=s2;{
  426. unsigned long s2size=_get_fat_size(_T1,sizeof(char));
  427. unsigned long min_size=Cyc_umin(s1size,s2size);
  428. unsigned long bound=Cyc_umin(n,min_size);{
  429. # 145
  430. int i=0;_TL3A: _T2=i;_T3=(unsigned long)_T2;_T4=bound;if(_T3 < _T4)goto _TL38;else{goto _TL39;}
  431. _TL38: _T5=s1;_T6=_T5.curr;_T7=(const char*)_T6;_T8=_check_null(_T7);_T9=i;_TA=_T8[_T9];_TB=(int)_TA;_TC=s2;_TD=_TC.curr;_TE=(const char*)_TD;_TF=_check_null(_TE);_T10=i;_T11=_TF[_T10];_T12=(int)_T11;if(_TB >= _T12)goto _TL3B;_T13=- 1;
  432. return _T13;_TL3B: _T14=s2;_T15=_T14.curr;_T16=(const char*)_T15;_T17=i;_T18=_T16[_T17];_T19=(int)_T18;_T1A=s1;_T1B=_T1A.curr;_T1C=(const char*)_T1B;_T1D=i;_T1E=_T1C[_T1D];_T1F=(int)_T1E;
  433. if(_T19 >= _T1F)goto _TL3D;
  434. return 1;_TL3D:
  435. # 145
  436. i=i + 1;goto _TL3A;_TL39:;}
  437. # 151
  438. if(min_size > bound)goto _TL3F;
  439. return 0;_TL3F:
  440. if(s1size >= s2size)goto _TL41;_T20=- 1;
  441. return _T20;_TL41:
  442. return 1;}}}
  443. # 159
  444. int Cyc_zstrptrcmp(struct _fat_ptr*a,struct _fat_ptr*b){struct _fat_ptr*_T0;int _T1;struct _fat_ptr*_T2;int _T3;struct _fat_ptr*_T4;struct _fat_ptr _T5;struct _fat_ptr*_T6;struct _fat_ptr _T7;int _T8;_T0=a;_T1=(int)_T0;_T2=b;_T3=(int)_T2;
  445. if(_T1!=_T3)goto _TL43;return 0;_TL43: _T4=a;_T5=*_T4;_T6=b;_T7=*_T6;_T8=
  446. Cyc_zstrcmp(_T5,_T7);return _T8;}
  447. # 169
  448. inline static struct _fat_ptr Cyc_int_strcato(struct _fat_ptr dest,struct _fat_ptr src){struct _fat_ptr _T0;unsigned long _T1;int _T2;struct _fat_ptr _T3;int _T4;unsigned long _T5;unsigned long _T6;struct _fat_ptr _T7;int _T8;unsigned char*_T9;char*_TA;char*_TB;struct _fat_ptr _TC;unsigned char*_TD;const char*_TE;const char*_TF;int _T10;unsigned _T11;unsigned char*_T12;char*_T13;int _T14;unsigned long _T15;unsigned long _T16;struct _fat_ptr _T17;int _T18;unsigned char*_T19;char*_T1A;char*_T1B;unsigned _T1C;unsigned char*_T1D;char*_T1E;struct Cyc_Core_Invalid_argument_exn_struct*_T1F;void*_T20;struct _fat_ptr _T21;
  449. int i;
  450. unsigned long dsize;unsigned long slen;unsigned long dlen;unsigned long dplen;
  451. # 173
  452. dlen=Cyc_strlen(dest);_T0=dest;_T1=dlen;_T2=(int)_T1;{
  453. struct _fat_ptr dp=_fat_ptr_plus(_T0,sizeof(char),_T2);_T3=dp;
  454. dplen=_get_fat_size(_T3,sizeof(char));
  455. slen=Cyc_strlen(src);
  456. # 178
  457. if(slen > dplen)goto _TL45;
  458. # 180
  459. i=0;_TL4A: _T4=i;_T5=(unsigned long)_T4;_T6=slen;if(_T5 < _T6)goto _TL48;else{goto _TL49;}
  460. _TL48: _T7=dp;_T8=i;{struct _fat_ptr _T22=_fat_ptr_plus(_T7,sizeof(char),_T8);_T9=_T22.curr;_TA=(char*)_T9;_TB=_check_null(_TA);{char _T23=*_TB;_TC=src;_TD=_TC.curr;_TE=(const char*)_TD;_TF=_check_null(_TE);_T10=i;{char _T24=_TF[_T10];_T11=_get_fat_size(_T22,sizeof(char));if(_T11!=1U)goto _TL4B;if(_T23!=0)goto _TL4B;if(_T24==0)goto _TL4B;_throw_arraybounds();goto _TL4C;_TL4B: _TL4C: _T12=_T22.curr;_T13=(char*)_T12;*_T13=_T24;}}}
  461. # 180
  462. i=i + 1;goto _TL4A;_TL49: _T14=i;_T15=(unsigned long)_T14;_T16=dplen;
  463. # 183
  464. if(_T15 >= _T16)goto _TL4D;_T17=dp;_T18=i;{struct _fat_ptr _T22=_fat_ptr_plus(_T17,sizeof(char),_T18);_T19=_T22.curr;_T1A=(char*)_T19;_T1B=_check_null(_T1A);{char _T23=*_T1B;char _T24='\000';_T1C=_get_fat_size(_T22,sizeof(char));if(_T1C!=1U)goto _TL4F;if(_T23!=0)goto _TL4F;if(_T24==0)goto _TL4F;_throw_arraybounds();goto _TL50;_TL4F: _TL50: _T1D=_T22.curr;_T1E=(char*)_T1D;*_T1E=_T24;}}goto _TL4E;_TL4D: _TL4E: goto _TL46;
  465. # 187
  466. _TL45:{struct Cyc_Core_Invalid_argument_exn_struct*_T22=_cycalloc(sizeof(struct Cyc_Core_Invalid_argument_exn_struct));_T22->tag=Cyc_Core_Invalid_argument;_T22->f1=_tag_fat("strcat",sizeof(char),7U);_T1F=(struct Cyc_Core_Invalid_argument_exn_struct*)_T22;}_T20=(void*)_T1F;_throw(_T20);_TL46: _T21=dest;
  467. return _T21;}}
  468. # 193
  469. struct _fat_ptr Cyc_strcat(struct _fat_ptr dest,struct _fat_ptr src){struct _fat_ptr _T0;_T0=
  470. Cyc_int_strcato(dest,src);return _T0;}
  471. # 198
  472. struct _fat_ptr Cyc_rstrconcat(struct _RegionHandle*r,struct _fat_ptr a,struct _fat_ptr b){struct _RegionHandle*_T0;unsigned _T1;unsigned _T2;struct _fat_ptr _T3;unsigned _T4;int _T5;unsigned _T6;struct _fat_ptr _T7;unsigned _T8;struct Cyc_Core_Impossible_exn_struct*_T9;void*_TA;struct _fat_ptr _TB;unsigned _TC;int _TD;unsigned char*_TE;char*_TF;char*_T10;struct _fat_ptr _T11;unsigned char*_T12;const char*_T13;const char*_T14;unsigned _T15;int _T16;unsigned _T17;unsigned char*_T18;char*_T19;unsigned _T1A;struct _fat_ptr _T1B;unsigned _T1C;struct Cyc_Core_Impossible_exn_struct*_T1D;void*_T1E;struct _fat_ptr _T1F;unsigned _T20;int _T21;unsigned char*_T22;char*_T23;char*_T24;struct _fat_ptr _T25;unsigned char*_T26;const char*_T27;const char*_T28;unsigned _T29;int _T2A;unsigned _T2B;unsigned char*_T2C;char*_T2D;struct _fat_ptr _T2E;
  473. unsigned alen=Cyc_strlen(a);
  474. unsigned blen=Cyc_strlen(b);_T0=r;_T1=alen + blen;_T2=_T1 + 1U;{
  475. struct _fat_ptr ans=Cyc_Core_rnew_string(_T0,_T2);_T3=ans;_T4=alen;_T5=(int)_T4;{
  476. struct _fat_ptr ansb=_fat_ptr_plus(_T3,sizeof(char),_T5);
  477. unsigned i;unsigned j;_T6=alen;_T7=ans;_T8=
  478. _get_fat_size(_T7,sizeof(char));if(_T6 <= _T8)goto _TL51;{struct Cyc_Core_Impossible_exn_struct*_T2F=_cycalloc(sizeof(struct Cyc_Core_Impossible_exn_struct));_T2F->tag=Cyc_Core_Impossible;_T2F->f1=_tag_fat("rstrconcat 1",sizeof(char),13U);_T9=(struct Cyc_Core_Impossible_exn_struct*)_T2F;}_TA=(void*)_T9;_throw(_TA);goto _TL52;_TL51: _TL52:
  479. i=0U;_TL56: if(i < alen)goto _TL54;else{goto _TL55;}
  480. _TL54: _TB=ans;_TC=i;_TD=(int)_TC;{struct _fat_ptr _T2F=_fat_ptr_plus(_TB,sizeof(char),_TD);_TE=_T2F.curr;_TF=(char*)_TE;_T10=_check_null(_TF);{char _T30=*_T10;_T11=a;_T12=_T11.curr;_T13=(const char*)_T12;_T14=_check_null(_T13);_T15=i;_T16=(int)_T15;{char _T31=_T14[_T16];_T17=_get_fat_size(_T2F,sizeof(char));if(_T17!=1U)goto _TL57;if(_T30!=0)goto _TL57;if(_T31==0)goto _TL57;_throw_arraybounds();goto _TL58;_TL57: _TL58: _T18=_T2F.curr;_T19=(char*)_T18;*_T19=_T31;}}}
  481. # 205
  482. i=i + 1;goto _TL56;_TL55: _T1A=blen;_T1B=ansb;_T1C=
  483. # 207
  484. _get_fat_size(_T1B,sizeof(char));if(_T1A <= _T1C)goto _TL59;{struct Cyc_Core_Impossible_exn_struct*_T2F=_cycalloc(sizeof(struct Cyc_Core_Impossible_exn_struct));_T2F->tag=Cyc_Core_Impossible;_T2F->f1=_tag_fat("rstrconcat 1",sizeof(char),13U);_T1D=(struct Cyc_Core_Impossible_exn_struct*)_T2F;}_T1E=(void*)_T1D;_throw(_T1E);goto _TL5A;_TL59: _TL5A:
  485. j=0U;_TL5E: if(j < blen)goto _TL5C;else{goto _TL5D;}
  486. _TL5C: _T1F=ansb;_T20=j;_T21=(int)_T20;{struct _fat_ptr _T2F=_fat_ptr_plus(_T1F,sizeof(char),_T21);_T22=_T2F.curr;_T23=(char*)_T22;_T24=_check_null(_T23);{char _T30=*_T24;_T25=b;_T26=_T25.curr;_T27=(const char*)_T26;_T28=_check_null(_T27);_T29=j;_T2A=(int)_T29;{char _T31=_T28[_T2A];_T2B=_get_fat_size(_T2F,sizeof(char));if(_T2B!=1U)goto _TL5F;if(_T30!=0)goto _TL5F;if(_T31==0)goto _TL5F;_throw_arraybounds();goto _TL60;_TL5F: _TL60: _T2C=_T2F.curr;_T2D=(char*)_T2C;*_T2D=_T31;}}}
  487. # 208
  488. j=j + 1;goto _TL5E;_TL5D: _T2E=ans;
  489. # 210
  490. return _T2E;}}}
  491. # 213
  492. struct _fat_ptr Cyc_strconcat(struct _fat_ptr a,struct _fat_ptr b){struct _fat_ptr _T0;_T0=
  493. Cyc_rstrconcat(Cyc_Core_heap_region,a,b);return _T0;}
  494. # 218
  495. struct _fat_ptr Cyc_rstrconcat_l(struct _RegionHandle*r,struct Cyc_List_List*strs){struct _RegionHandle*_T0;struct Cyc_List_List*_T1;struct Cyc_List_List*_T2;struct Cyc_List_List*_T3;void*_T4;struct _fat_ptr*_T5;struct _fat_ptr _T6;unsigned long _T7;struct _RegionHandle*_T8;struct Cyc_List_List*_T9;unsigned long _TA;struct Cyc_List_List*_TB;struct Cyc_List_List*_TC;struct Cyc_List_List*_TD;struct Cyc_List_List*_TE;struct _RegionHandle*_TF;unsigned long _T10;struct Cyc_List_List*_T11;void*_T12;struct _fat_ptr*_T13;struct Cyc_List_List*_T14;void*_T15;struct _fat_ptr _T16;unsigned long _T17;int _T18;struct _fat_ptr _T19;struct _fat_ptr _T1A;struct _fat_ptr _T1B;unsigned long _T1C;unsigned long _T1D;struct Cyc_List_List*_T1E;struct Cyc_List_List*_T1F;
  496. # 220
  497. unsigned long len;
  498. unsigned long total_len=0U;
  499. struct _fat_ptr ans;struct _RegionHandle _T20=_new_region(0U,"temp");struct _RegionHandle*temp=& _T20;_push_region(temp);{
  500. # 224
  501. struct Cyc_List_List*lens;_T0=temp;lens=_region_malloc(_T0,0U,sizeof(struct Cyc_List_List));_T1=lens;
  502. _T1->hd=(void*)0U;_T2=lens;
  503. _T2->tl=0;{
  504. struct Cyc_List_List*end=lens;{
  505. struct Cyc_List_List*p=strs;_TL64: if(p!=0)goto _TL62;else{goto _TL63;}
  506. _TL62: _T3=p;_T4=_T3->hd;_T5=(struct _fat_ptr*)_T4;_T6=*_T5;len=Cyc_strlen(_T6);_T7=len;
  507. total_len=total_len + _T7;{
  508. struct Cyc_List_List*q;_T8=temp;q=_region_malloc(_T8,0U,sizeof(struct Cyc_List_List));_T9=q;_TA=len;_T9->hd=(void*)_TA;_TB=q;_TB->tl=0;_TC=end;
  509. _TC->tl=q;
  510. end=q;}_TD=p;
  511. # 228
  512. p=_TD->tl;goto _TL64;_TL63:;}_TE=lens;
  513. # 235
  514. lens=_TE->tl;_TF=r;_T10=total_len + 1U;
  515. ans=Cyc_Core_rnew_string(_TF,_T10);{
  516. unsigned long i=0U;
  517. _TL65: if(strs!=0)goto _TL66;else{goto _TL67;}
  518. _TL66: _T11=strs;_T12=_T11->hd;_T13=(struct _fat_ptr*)_T12;{struct _fat_ptr next=*_T13;_T14=
  519. _check_null(lens);_T15=_T14->hd;len=(unsigned long)_T15;_T16=ans;_T17=i;_T18=(int)_T17;_T19=
  520. _fat_ptr_plus(_T16,sizeof(char),_T18);_T1A=_fat_ptr_decrease_size(_T19,sizeof(char),1U);_T1B=next;_T1C=len;Cyc_strncpy(_T1A,_T1B,_T1C);_T1D=len;
  521. i=i + _T1D;_T1E=strs;
  522. strs=_T1E->tl;_T1F=lens;
  523. lens=_T1F->tl;}goto _TL65;_TL67:;}}}{struct _fat_ptr _T21=ans;_npop_handler(0);return _T21;}_pop_region();}
  524. # 250
  525. struct _fat_ptr Cyc_strconcat_l(struct Cyc_List_List*strs){struct _fat_ptr _T0;_T0=
  526. Cyc_rstrconcat_l(Cyc_Core_heap_region,strs);return _T0;}
  527. # 256
  528. struct _fat_ptr Cyc_rstr_sepstr(struct _RegionHandle*r,struct Cyc_List_List*strs,struct _fat_ptr separator){struct _fat_ptr _T0;struct Cyc_List_List*_T1;struct Cyc_List_List*_T2;struct _RegionHandle*_T3;struct Cyc_List_List*_T4;void*_T5;struct _fat_ptr*_T6;struct _fat_ptr _T7;struct _fat_ptr _T8;struct _RegionHandle*_T9;struct Cyc_List_List*_TA;struct Cyc_List_List*_TB;struct Cyc_List_List*_TC;void*_TD;struct _fat_ptr*_TE;struct _fat_ptr _TF;unsigned long _T10;struct _RegionHandle*_T11;struct Cyc_List_List*_T12;unsigned long _T13;struct Cyc_List_List*_T14;struct Cyc_List_List*_T15;struct Cyc_List_List*_T16;struct Cyc_List_List*_T17;unsigned long _T18;unsigned long _T19;unsigned long _T1A;struct _RegionHandle*_T1B;unsigned long _T1C;struct Cyc_List_List*_T1D;struct Cyc_List_List*_T1E;struct Cyc_List_List*_T1F;void*_T20;struct _fat_ptr*_T21;struct Cyc_List_List*_T22;void*_T23;struct _fat_ptr _T24;unsigned long _T25;int _T26;struct _fat_ptr _T27;struct _fat_ptr _T28;struct _fat_ptr _T29;unsigned long _T2A;unsigned long _T2B;struct _fat_ptr _T2C;unsigned long _T2D;int _T2E;struct _fat_ptr _T2F;struct _fat_ptr _T30;struct _fat_ptr _T31;unsigned long _T32;unsigned long _T33;struct Cyc_List_List*_T34;struct Cyc_List_List*_T35;struct _fat_ptr _T36;unsigned long _T37;int _T38;struct _fat_ptr _T39;struct _fat_ptr _T3A;struct Cyc_List_List*_T3B;void*_T3C;struct _fat_ptr*_T3D;struct _fat_ptr _T3E;struct Cyc_List_List*_T3F;void*_T40;unsigned long _T41;
  529. if(strs!=0)goto _TL68;_T0=Cyc_Core_rnew_string(r,0U);return _T0;_TL68: _T1=strs;_T2=_T1->tl;
  530. if(_T2!=0)goto _TL6A;_T3=r;_T4=strs;_T5=_T4->hd;_T6=(struct _fat_ptr*)_T5;_T7=*_T6;_T8=Cyc_rstrdup(_T3,_T7);return _T8;_TL6A: {
  531. struct Cyc_List_List*p=strs;struct _RegionHandle _T42=_new_region(0U,"temp");struct _RegionHandle*temp=& _T42;_push_region(temp);{
  532. # 261
  533. struct Cyc_List_List*lens;_T9=temp;lens=_region_malloc(_T9,0U,sizeof(struct Cyc_List_List));_TA=lens;_TA->hd=(void*)0U;_TB=lens;_TB->tl=0;{
  534. struct Cyc_List_List*end=lens;
  535. unsigned long len;
  536. unsigned long total_len=0U;
  537. unsigned long list_len=0U;
  538. _TL6F: if(p!=0)goto _TL6D;else{goto _TL6E;}
  539. _TL6D: _TC=p;_TD=_TC->hd;_TE=(struct _fat_ptr*)_TD;_TF=*_TE;len=Cyc_strlen(_TF);_T10=len;
  540. total_len=total_len + _T10;{
  541. struct Cyc_List_List*q;_T11=temp;q=_region_malloc(_T11,0U,sizeof(struct Cyc_List_List));_T12=q;_T13=len;_T12->hd=(void*)_T13;_T14=q;_T14->tl=0;_T15=end;
  542. _T15->tl=q;
  543. end=q;
  544. list_len=list_len + 1;}_T16=p;
  545. # 266
  546. p=_T16->tl;goto _TL6F;_TL6E: _T17=lens;
  547. # 274
  548. lens=_T17->tl;{
  549. unsigned long seplen=Cyc_strlen(separator);_T18=list_len - 1U;_T19=seplen;_T1A=_T18 * _T19;
  550. total_len=total_len + _T1A;_T1B=r;_T1C=total_len + 1U;{
  551. struct _fat_ptr ans=Cyc_Core_rnew_string(_T1B,_T1C);
  552. unsigned long i=0U;
  553. _TL70: _T1D=_check_null(strs);_T1E=_T1D->tl;if(_T1E!=0)goto _TL71;else{goto _TL72;}
  554. _TL71: _T1F=strs;_T20=_T1F->hd;_T21=(struct _fat_ptr*)_T20;{struct _fat_ptr next=*_T21;_T22=
  555. _check_null(lens);_T23=_T22->hd;len=(unsigned long)_T23;_T24=ans;_T25=i;_T26=(int)_T25;_T27=
  556. _fat_ptr_plus(_T24,sizeof(char),_T26);_T28=_fat_ptr_decrease_size(_T27,sizeof(char),1U);_T29=next;_T2A=len;Cyc_strncpy(_T28,_T29,_T2A);_T2B=len;
  557. i=i + _T2B;_T2C=ans;_T2D=i;_T2E=(int)_T2D;_T2F=
  558. _fat_ptr_plus(_T2C,sizeof(char),_T2E);_T30=_fat_ptr_decrease_size(_T2F,sizeof(char),1U);_T31=separator;_T32=seplen;Cyc_strncpy(_T30,_T31,_T32);_T33=seplen;
  559. i=i + _T33;_T34=strs;
  560. strs=_T34->tl;_T35=lens;
  561. lens=_T35->tl;}goto _TL70;_TL72: _T36=ans;_T37=i;_T38=(int)_T37;_T39=
  562. # 289
  563. _fat_ptr_plus(_T36,sizeof(char),_T38);_T3A=_fat_ptr_decrease_size(_T39,sizeof(char),1U);_T3B=strs;_T3C=_T3B->hd;_T3D=(struct _fat_ptr*)_T3C;_T3E=*_T3D;_T3F=_check_null(lens);_T40=_T3F->hd;_T41=(unsigned long)_T40;Cyc_strncpy(_T3A,_T3E,_T41);{struct _fat_ptr _T43=ans;_npop_handler(0);return _T43;}}}}}_pop_region();}}
  564. # 294
  565. struct _fat_ptr Cyc_str_sepstr(struct Cyc_List_List*strs,struct _fat_ptr separator){struct _fat_ptr _T0;_T0=
  566. Cyc_rstr_sepstr(Cyc_Core_heap_region,strs,separator);return _T0;}
  567. # 299
  568. struct _fat_ptr Cyc_strncpy(struct _fat_ptr dest,struct _fat_ptr src,unsigned long n){unsigned long _T0;struct _fat_ptr _T1;unsigned _T2;unsigned long _T3;struct _fat_ptr _T4;unsigned _T5;struct Cyc_Core_Invalid_argument_exn_struct*_T6;void*_T7;struct _fat_ptr _T8;unsigned char*_T9;const char*_TA;const char*_TB;unsigned _TC;int _TD;char _TE;int _TF;struct _fat_ptr _T10;unsigned char*_T11;char*_T12;char*_T13;unsigned _T14;int _T15;struct _fat_ptr _T16;unsigned char*_T17;char*_T18;char*_T19;unsigned _T1A;int _T1B;struct _fat_ptr _T1C;
  569. unsigned i;_T0=n;_T1=src;_T2=
  570. _get_fat_size(_T1,sizeof(char));if(_T0 > _T2)goto _TL75;else{goto _TL76;}_TL76: _T3=n;_T4=dest;_T5=_get_fat_size(_T4,sizeof(char));if(_T3 > _T5)goto _TL75;else{goto _TL73;}
  571. _TL75:{struct Cyc_Core_Invalid_argument_exn_struct*_T1D=_cycalloc(sizeof(struct Cyc_Core_Invalid_argument_exn_struct));_T1D->tag=Cyc_Core_Invalid_argument;_T1D->f1=_tag_fat("strncpy",sizeof(char),8U);_T6=(struct Cyc_Core_Invalid_argument_exn_struct*)_T1D;}_T7=(void*)_T6;_throw(_T7);goto _TL74;_TL73: _TL74:
  572. i=0U;_TL7A: if(i < n)goto _TL78;else{goto _TL79;}
  573. _TL78: _T8=src;_T9=_T8.curr;_TA=(const char*)_T9;_TB=_check_null(_TA);_TC=i;_TD=(int)_TC;{char srcChar=_TB[_TD];_TE=srcChar;_TF=(int)_TE;
  574. if(_TF!=0)goto _TL7B;goto _TL79;_TL7B: _T10=dest;_T11=_T10.curr;_T12=(char*)_T11;_T13=
  575. _check_null(_T12);_T14=i;_T15=(int)_T14;_T13[_T15]=srcChar;}
  576. # 303
  577. i=i + 1;goto _TL7A;_TL79:
  578. # 308
  579. _TL80: if(i < n)goto _TL7E;else{goto _TL7F;}
  580. _TL7E: _T16=dest;_T17=_T16.curr;_T18=(char*)_T17;_T19=_check_null(_T18);_T1A=i;_T1B=(int)_T1A;_T19[_T1B]='\000';
  581. # 308
  582. i=i + 1;goto _TL80;_TL7F: _T1C=dest;
  583. # 311
  584. return _T1C;}
  585. # 315
  586. struct _fat_ptr Cyc_zstrncpy(struct _fat_ptr dest,struct _fat_ptr src,unsigned long n){unsigned long _T0;struct _fat_ptr _T1;unsigned _T2;unsigned long _T3;struct _fat_ptr _T4;unsigned _T5;struct Cyc_Core_Invalid_argument_exn_struct*_T6;void*_T7;struct _fat_ptr _T8;unsigned char*_T9;char*_TA;char*_TB;unsigned _TC;int _TD;struct _fat_ptr _TE;unsigned char*_TF;const char*_T10;const char*_T11;unsigned _T12;int _T13;struct _fat_ptr _T14;_T0=n;_T1=dest;_T2=
  587. _get_fat_size(_T1,sizeof(char));if(_T0 > _T2)goto _TL83;else{goto _TL84;}_TL84: _T3=n;_T4=src;_T5=_get_fat_size(_T4,sizeof(char));if(_T3 > _T5)goto _TL83;else{goto _TL81;}
  588. _TL83:{struct Cyc_Core_Invalid_argument_exn_struct*_T15=_cycalloc(sizeof(struct Cyc_Core_Invalid_argument_exn_struct));_T15->tag=Cyc_Core_Invalid_argument;_T15->f1=_tag_fat("zstrncpy",sizeof(char),9U);_T6=(struct Cyc_Core_Invalid_argument_exn_struct*)_T15;}_T7=(void*)_T6;_throw(_T7);goto _TL82;_TL81: _TL82: {
  589. unsigned i;
  590. i=0U;_TL88: if(i < n)goto _TL86;else{goto _TL87;}
  591. _TL86: _T8=dest;_T9=_T8.curr;_TA=(char*)_T9;_TB=_check_null(_TA);_TC=i;_TD=(int)_TC;_TE=src;_TF=_TE.curr;_T10=(const char*)_TF;_T11=_check_null(_T10);_T12=i;_T13=(int)_T12;_TB[_TD]=_T11[_T13];
  592. # 319
  593. i=i + 1;goto _TL88;_TL87: _T14=dest;
  594. # 321
  595. return _T14;}}
  596. # 324
  597. struct _fat_ptr Cyc_strcpy(struct _fat_ptr dest,struct _fat_ptr src){struct _fat_ptr _T0;struct _fat_ptr _T1;struct _fat_ptr _T2;unsigned char*_T3;const char*_T4;const char*_T5;unsigned _T6;int _T7;struct _fat_ptr _T8;unsigned _T9;int _TA;unsigned char*_TB;char*_TC;char*_TD;unsigned _TE;unsigned char*_TF;char*_T10;char _T11;int _T12;struct _fat_ptr _T13;struct _fat_ptr _T14;struct _fat_ptr _T15;unsigned long _T16;unsigned long _T17;struct _fat_ptr _T18;unsigned _T19;struct _fat_ptr _T1A;unsigned long _T1B;int _T1C;unsigned char*_T1D;char*_T1E;char*_T1F;unsigned _T20;unsigned char*_T21;char*_T22;struct _fat_ptr _T23;_T0=src;{
  598. unsigned ssz=_get_fat_size(_T0,sizeof(char));_T1=dest;{
  599. unsigned dsz=_get_fat_size(_T1,sizeof(char));
  600. if(ssz > dsz)goto _TL89;{
  601. unsigned i;
  602. i=0U;_TL8E: if(i < ssz)goto _TL8C;else{goto _TL8D;}
  603. _TL8C: _T2=src;_T3=_T2.curr;_T4=(const char*)_T3;_T5=_check_null(_T4);_T6=i;_T7=(int)_T6;{char srcChar=_T5[_T7];_T8=dest;_T9=i;_TA=(int)_T9;{struct _fat_ptr _T24=_fat_ptr_plus(_T8,sizeof(char),_TA);_TB=_T24.curr;_TC=(char*)_TB;_TD=_check_null(_TC);{char _T25=*_TD;char _T26=srcChar;_TE=_get_fat_size(_T24,sizeof(char));if(_TE!=1U)goto _TL8F;if(_T25!=0)goto _TL8F;if(_T26==0)goto _TL8F;_throw_arraybounds();goto _TL90;_TL8F: _TL90: _TF=_T24.curr;_T10=(char*)_TF;*_T10=_T26;}}_T11=srcChar;_T12=(int)_T11;
  604. # 332
  605. if(_T12!=0)goto _TL91;goto _TL8D;_TL91:;}
  606. # 329
  607. i=i + 1;goto _TL8E;_TL8D:;}goto _TL8A;
  608. # 336
  609. _TL89:{unsigned long len=Cyc_strlen(src);_T13=dest;_T14=
  610. _fat_ptr_decrease_size(_T13,sizeof(char),1U);_T15=src;_T16=len;Cyc_strncpy(_T14,_T15,_T16);_T17=len;_T18=dest;_T19=
  611. _get_fat_size(_T18,sizeof(char));if(_T17 >= _T19)goto _TL93;_T1A=dest;_T1B=len;_T1C=(int)_T1B;{struct _fat_ptr _T24=_fat_ptr_plus(_T1A,sizeof(char),_T1C);_T1D=_T24.curr;_T1E=(char*)_T1D;_T1F=_check_null(_T1E);{char _T25=*_T1F;char _T26='\000';_T20=_get_fat_size(_T24,sizeof(char));if(_T20!=1U)goto _TL95;if(_T25!=0)goto _TL95;if(_T26==0)goto _TL95;_throw_arraybounds();goto _TL96;_TL95: _TL96: _T21=_T24.curr;_T22=(char*)_T21;*_T22=_T26;}}goto _TL94;_TL93: _TL94:;}_TL8A: _T23=dest;
  612. # 341
  613. return _T23;}}}
  614. # 347
  615. struct _fat_ptr Cyc_rstrdup(struct _RegionHandle*r,struct _fat_ptr src){struct _RegionHandle*_T0;unsigned long _T1;struct _fat_ptr _T2;struct _fat_ptr _T3;
  616. unsigned long len;
  617. struct _fat_ptr temp;
  618. # 351
  619. len=Cyc_strlen(src);_T0=r;_T1=len + 1U;
  620. temp=Cyc_Core_rnew_string(_T0,_T1);_T2=temp;{
  621. struct _fat_ptr temp2=_fat_ptr_decrease_size(_T2,sizeof(char),1U);struct _fat_ptr _T4;_T4=temp2;{struct _fat_ptr dst=_T4;
  622. # 355
  623. Cyc_strncpy(dst,src,len);}}_T3=temp;
  624. # 357
  625. return _T3;}
  626. # 360
  627. struct _fat_ptr Cyc_rqstrdup(struct _RegionHandle*r,unsigned q,struct _fat_ptr src){struct _RegionHandle*_T0;unsigned _T1;unsigned long _T2;struct _fat_ptr _T3;struct _fat_ptr _T4;
  628. unsigned long len=Cyc_strlen(src);_T0=r;_T1=q;_T2=len + 1U;{
  629. struct _fat_ptr temp=Cyc_Core_rqnew_string(_T0,_T1,_T2);_T3=temp;{
  630. # 364
  631. struct _fat_ptr temp2=_fat_ptr_decrease_size(_T3,sizeof(char),1U);struct _fat_ptr _T5;_T5=temp2;{struct _fat_ptr dst=_T5;
  632. # 366
  633. Cyc_strncpy(dst,src,len);}}_T4=temp;
  634. # 368
  635. return _T4;}}
  636. # 371
  637. struct _fat_ptr Cyc_strdup(struct _fat_ptr src){struct _fat_ptr _T0;_T0=
  638. Cyc_rstrdup(Cyc_Core_heap_region,src);return _T0;}
  639. # 375
  640. struct _fat_ptr Cyc_rqrealloc(struct _RegionHandle*r,unsigned q,struct _fat_ptr s,unsigned long sz){struct _fat_ptr _T0;unsigned long _T1;struct _fat_ptr _T2;struct _RegionHandle*_T3;unsigned _T4;void*_T5;struct _fat_ptr _T6;struct _fat_ptr _T7;struct _fat_ptr _T8;unsigned long _T9;struct _fat_ptr _TA;
  641. struct _fat_ptr temp;
  642. unsigned long slen;_T0=s;
  643. # 379
  644. slen=_get_fat_size(_T0,sizeof(char));
  645. if(sz <= slen)goto _TL97;_T1=sz;goto _TL98;_TL97: _T1=slen;_TL98: sz=_T1;{unsigned _TB=sz;_T3=r;_T4=q;_T5=_region_calloc(_T3,_T4,sizeof(char),_TB);_T2=_tag_fat(_T5,sizeof(char),_TB);}
  646. temp=_T2;{struct _fat_ptr _TB;_TB=temp;{struct _fat_ptr dst=_TB;_T6=dst;_T7=_T6;_T8=s;_T9=slen;
  647. # 384
  648. Cyc_strncpy(_T7,_T8,_T9);}}_TA=temp;
  649. # 387
  650. return _TA;}
  651. # 390
  652. struct _fat_ptr Cyc_rrealloc(struct _RegionHandle*r,struct _fat_ptr s,unsigned long sz){struct _fat_ptr _T0;_T0=
  653. Cyc_rqrealloc(r,Cyc_Core_aliasable_qual,s,sz);return _T0;}
  654. # 394
  655. struct _fat_ptr Cyc_rexpand(struct _RegionHandle*r,struct _fat_ptr s,unsigned long sz){unsigned long _T0;struct _fat_ptr _T1;struct _fat_ptr _T2;struct _fat_ptr _T3;unsigned long _T4;unsigned long _T5;struct _fat_ptr _T6;unsigned _T7;struct _fat_ptr _T8;unsigned long _T9;int _TA;unsigned char*_TB;char*_TC;unsigned _TD;unsigned char*_TE;char*_TF;struct _fat_ptr _T10;
  656. struct _fat_ptr temp;
  657. unsigned long slen;
  658. # 398
  659. slen=Cyc_strlen(s);
  660. if(sz <= slen)goto _TL99;_T0=sz;goto _TL9A;_TL99: _T0=slen;_TL9A: sz=_T0;
  661. temp=Cyc_Core_rnew_string(r,sz);{struct _fat_ptr _T11;_T11=temp;{struct _fat_ptr dst=_T11;_T1=dst;_T2=_T1;_T3=s;_T4=slen;
  662. # 403
  663. Cyc_strncpy(_T2,_T3,_T4);}}_T5=slen;_T6=s;_T7=
  664. # 406
  665. _get_fat_size(_T6,sizeof(char));if(_T5==_T7)goto _TL9B;_T8=temp;_T9=slen;_TA=(int)_T9;{struct _fat_ptr _T11=_fat_ptr_plus(_T8,sizeof(char),_TA);_TB=_check_fat_subscript(_T11,sizeof(char),0U);_TC=(char*)_TB;{char _T12=*_TC;char _T13='\000';_TD=_get_fat_size(_T11,sizeof(char));if(_TD!=1U)goto _TL9D;if(_T12!=0)goto _TL9D;if(_T13==0)goto _TL9D;_throw_arraybounds();goto _TL9E;_TL9D: _TL9E: _TE=_T11.curr;_TF=(char*)_TE;*_TF=_T13;}}goto _TL9C;_TL9B: _TL9C: _T10=temp;
  666. # 409
  667. return _T10;}
  668. # 412
  669. struct _fat_ptr Cyc_expand(struct _fat_ptr s,unsigned long sz){struct _fat_ptr _T0;_T0=
  670. Cyc_rexpand(Cyc_Core_heap_region,s,sz);return _T0;}
  671. # 416
  672. struct _fat_ptr Cyc_cond_rrealloc_str(struct _RegionHandle*r,struct _fat_ptr str,unsigned long sz){struct _fat_ptr _T0;struct _fat_ptr _T1;unsigned char*_T2;char*_T3;char*_T4;unsigned _T5;unsigned char*_T6;char*_T7;unsigned long _T8;unsigned long _T9;unsigned long _TA;unsigned long _TB;unsigned long _TC;struct _fat_ptr _TD;_T0=str;{
  673. unsigned long maxsizeP=_get_fat_size(_T0,sizeof(char));
  674. struct _fat_ptr res=_tag_fat(0,0,0);
  675. # 420
  676. if(maxsizeP!=0U)goto _TL9F;
  677. maxsizeP=Cyc_umax(30U,sz);
  678. res=Cyc_Core_rnew_string(r,maxsizeP);_T1=res;{struct _fat_ptr _TE=_fat_ptr_plus(_T1,sizeof(char),0);_T2=_TE.curr;_T3=(char*)_T2;_T4=_check_null(_T3);{char _TF=*_T4;char _T10='\000';_T5=_get_fat_size(_TE,sizeof(char));if(_T5!=1U)goto _TLA1;if(_TF!=0)goto _TLA1;if(_T10==0)goto _TLA1;_throw_arraybounds();goto _TLA2;_TLA1: _TLA2: _T6=_TE.curr;_T7=(char*)_T6;*_T7=_T10;}}goto _TLA0;
  679. # 425
  680. _TL9F: if(sz <= maxsizeP)goto _TLA3;_T9=maxsizeP * 2U;_TA=sz * 5U;_TB=_TA / 4U;
  681. if(_T9 <= _TB)goto _TLA5;_T8=maxsizeP * 2U;goto _TLA6;_TLA5: _TC=sz * 5U;_T8=_TC / 4U;_TLA6: maxsizeP=_T8;{struct _fat_ptr _TE;_TE=str;{struct _fat_ptr dst=_TE;
  682. # 428
  683. res=Cyc_rexpand(r,dst,maxsizeP);}}goto _TLA4;_TLA3: _TLA4: _TLA0: _TD=res;
  684. # 432
  685. return _TD;}}
  686. # 435
  687. struct _fat_ptr Cyc_realloc_str(struct _fat_ptr str,unsigned long sz){struct _fat_ptr _T0;unsigned char*_T1;char*_T2;struct _fat_ptr _T3;struct _fat_ptr _T4;
  688. struct _fat_ptr res=Cyc_cond_rrealloc_str(Cyc_Core_heap_region,str,sz);_T0=res;_T1=_T0.curr;_T2=(char*)_T1;
  689. if(_T2!=0)goto _TLA7;_T3=str;return _T3;
  690. _TLA7: _T4=res;return _T4;}
  691. # 446
  692. struct _fat_ptr Cyc_rsubstring(struct _RegionHandle*r,struct _fat_ptr s,int start,unsigned long amt){struct _RegionHandle*_T0;unsigned long _T1;struct _fat_ptr _T2;int _T3;unsigned long _T4;struct _fat_ptr _T5;unsigned _T6;unsigned long _T7;struct _fat_ptr _T8;unsigned _T9;struct Cyc_Core_Invalid_argument_exn_struct*_TA;void*_TB;struct _fat_ptr _TC;unsigned long _TD;int _TE;unsigned char*_TF;char*_T10;char*_T11;struct _fat_ptr _T12;unsigned char*_T13;const char*_T14;const char*_T15;unsigned long _T16;int _T17;unsigned _T18;unsigned char*_T19;char*_T1A;struct _fat_ptr _T1B;unsigned long _T1C;int _T1D;unsigned char*_T1E;char*_T1F;char*_T20;unsigned _T21;unsigned char*_T22;char*_T23;struct _fat_ptr _T24;_T0=r;_T1=amt + 1U;{
  693. # 450
  694. struct _fat_ptr ans=Cyc_Core_rnew_string(_T0,_T1);_T2=s;_T3=start;
  695. s=_fat_ptr_plus(_T2,sizeof(char),_T3);_T4=amt;_T5=ans;_T6=
  696. _get_fat_size(_T5,sizeof(char));if(_T4 > _T6)goto _TLAB;else{goto _TLAC;}_TLAC: _T7=amt;_T8=s;_T9=_get_fat_size(_T8,sizeof(char));if(_T7 > _T9)goto _TLAB;else{goto _TLA9;}
  697. _TLAB:{struct Cyc_Core_Invalid_argument_exn_struct*_T25=_cycalloc(sizeof(struct Cyc_Core_Invalid_argument_exn_struct));_T25->tag=Cyc_Core_Invalid_argument;_T25->f1=_tag_fat("rsubstring",sizeof(char),11U);_TA=(struct Cyc_Core_Invalid_argument_exn_struct*)_T25;}_TB=(void*)_TA;_throw(_TB);goto _TLAA;_TLA9: _TLAA:{
  698. unsigned long i=0U;_TLB0: if(i < amt)goto _TLAE;else{goto _TLAF;}
  699. _TLAE: _TC=ans;_TD=i;_TE=(int)_TD;{struct _fat_ptr _T25=_fat_ptr_plus(_TC,sizeof(char),_TE);_TF=_T25.curr;_T10=(char*)_TF;_T11=_check_null(_T10);{char _T26=*_T11;_T12=s;_T13=_T12.curr;_T14=(const char*)_T13;_T15=_check_null(_T14);_T16=i;_T17=(int)_T16;{char _T27=_T15[_T17];_T18=_get_fat_size(_T25,sizeof(char));if(_T18!=1U)goto _TLB1;if(_T26!=0)goto _TLB1;if(_T27==0)goto _TLB1;_throw_arraybounds();goto _TLB2;_TLB1: _TLB2: _T19=_T25.curr;_T1A=(char*)_T19;*_T1A=_T27;}}}
  700. # 454
  701. i=i + 1;goto _TLB0;_TLAF:;}_T1B=ans;_T1C=amt;_T1D=(int)_T1C;{struct _fat_ptr _T25=_fat_ptr_plus(_T1B,sizeof(char),_T1D);_T1E=_T25.curr;_T1F=(char*)_T1E;_T20=_check_null(_T1F);{char _T26=*_T20;char _T27='\000';_T21=_get_fat_size(_T25,sizeof(char));if(_T21!=1U)goto _TLB3;if(_T26!=0)goto _TLB3;if(_T27==0)goto _TLB3;_throw_arraybounds();goto _TLB4;_TLB3: _TLB4: _T22=_T25.curr;_T23=(char*)_T22;*_T23=_T27;}}_T24=ans;
  702. # 457
  703. return _T24;}}
  704. # 460
  705. struct _fat_ptr Cyc_substring(struct _fat_ptr s,int start,unsigned long amt){struct _fat_ptr _T0;_T0=
  706. Cyc_rsubstring(Cyc_Core_heap_region,s,start,amt);return _T0;}
  707. # 466
  708. struct _fat_ptr Cyc_rreplace_suffix(struct _RegionHandle*r,struct _fat_ptr src,struct _fat_ptr curr_suffix,struct _fat_ptr new_suffix){struct _fat_ptr _T0;struct _fat_ptr _T1;struct Cyc_Core_Invalid_argument_exn_struct*_T2;void*_T3;struct _fat_ptr _T4;unsigned long _T5;int _T6;unsigned char*_T7;const char*_T8;char _T9;int _TA;struct _fat_ptr _TB;unsigned long _TC;int _TD;unsigned char*_TE;const char*_TF;char _T10;int _T11;struct Cyc_Core_Invalid_argument_exn_struct*_T12;void*_T13;struct _RegionHandle*_T14;unsigned long _T15;struct _fat_ptr _T16;unsigned _T17;unsigned long _T18;unsigned long _T19;struct _fat_ptr _T1A;struct _fat_ptr _T1B;struct _fat_ptr _T1C;unsigned long _T1D;struct _fat_ptr _T1E;unsigned long _T1F;int _T20;struct _fat_ptr _T21;struct _fat_ptr _T22;struct _fat_ptr _T23;struct _fat_ptr _T24;unsigned _T25;struct _fat_ptr _T26;_T0=src;{
  709. unsigned long m=_get_fat_size(_T0,sizeof(char));_T1=curr_suffix;{
  710. unsigned long n=_get_fat_size(_T1,sizeof(char));
  711. struct _fat_ptr err=_tag_fat("replace_suffix",sizeof(char),15U);
  712. if(m >= n)goto _TLB5;{struct Cyc_Core_Invalid_argument_exn_struct*_T27=_cycalloc(sizeof(struct Cyc_Core_Invalid_argument_exn_struct));_T27->tag=Cyc_Core_Invalid_argument;
  713. _T27->f1=err;_T2=(struct Cyc_Core_Invalid_argument_exn_struct*)_T27;}_T3=(void*)_T2;_throw(_T3);goto _TLB6;_TLB5: _TLB6:{
  714. unsigned long i=1U;_TLBA: if(i <= n)goto _TLB8;else{goto _TLB9;}
  715. _TLB8: _T4=src;_T5=m - i;_T6=(int)_T5;_T7=_check_fat_subscript(_T4,sizeof(char),_T6);_T8=(const char*)_T7;_T9=*_T8;_TA=(int)_T9;_TB=curr_suffix;_TC=n - i;_TD=(int)_TC;_TE=_check_fat_subscript(_TB,sizeof(char),_TD);_TF=(const char*)_TE;_T10=*_TF;_T11=(int)_T10;if(_TA==_T11)goto _TLBB;{struct Cyc_Core_Invalid_argument_exn_struct*_T27=_cycalloc(sizeof(struct Cyc_Core_Invalid_argument_exn_struct));_T27->tag=Cyc_Core_Invalid_argument;
  716. _T27->f1=err;_T12=(struct Cyc_Core_Invalid_argument_exn_struct*)_T27;}_T13=(void*)_T12;_throw(_T13);goto _TLBC;_TLBB: _TLBC:
  717. # 472
  718. i=i + 1;goto _TLBA;_TLB9:;}_T14=r;_T15=m - n;_T16=new_suffix;_T17=
  719. # 475
  720. _get_fat_size(_T16,sizeof(char));_T18=_T15 + _T17;_T19=_T18 + 1U;{struct _fat_ptr ans=Cyc_Core_rnew_string(_T14,_T19);_T1A=ans;_T1B=
  721. _fat_ptr_decrease_size(_T1A,sizeof(char),1U);_T1C=src;_T1D=m - n;Cyc_strncpy(_T1B,_T1C,_T1D);_T1E=ans;_T1F=m - n;_T20=(int)_T1F;_T21=
  722. _fat_ptr_plus(_T1E,sizeof(char),_T20);_T22=_fat_ptr_decrease_size(_T21,sizeof(char),1U);_T23=new_suffix;_T24=new_suffix;_T25=_get_fat_size(_T24,sizeof(char));Cyc_strncpy(_T22,_T23,_T25);_T26=ans;
  723. return _T26;}}}}
  724. # 481
  725. struct _fat_ptr Cyc_replace_suffix(struct _fat_ptr src,struct _fat_ptr curr_suffix,struct _fat_ptr new_suffix){struct _fat_ptr _T0;_T0=
  726. Cyc_rreplace_suffix(Cyc_Core_heap_region,src,curr_suffix,new_suffix);return _T0;}
  727. # 488
  728. struct _fat_ptr Cyc_strpbrk(struct _fat_ptr s,struct _fat_ptr accept){struct _fat_ptr _T0;unsigned _T1;struct _fat_ptr _T2;unsigned _T3;int _T4;unsigned _T5;struct _fat_ptr _T6;unsigned char*_T7;const char*_T8;const char*_T9;unsigned _TA;int _TB;char _TC;int _TD;char _TE;int _TF;struct _fat_ptr _T10;unsigned char*_T11;const char*_T12;const char*_T13;unsigned _T14;int _T15;char _T16;int _T17;struct _fat_ptr _T18;unsigned _T19;int _T1A;struct _fat_ptr _T1B;struct _fat_ptr _T1C;_T0=s;_T1=
  729. _get_fat_size(_T0,sizeof(char));{int len=(int)_T1;_T2=accept;{
  730. unsigned asize=_get_fat_size(_T2,sizeof(char));
  731. char c;
  732. unsigned i;
  733. i=0U;_TLC0: _T3=i;_T4=len;_T5=(unsigned)_T4;if(_T3 < _T5)goto _TLC1;else{goto _TLBF;}_TLC1: _T6=s;_T7=_T6.curr;_T8=(const char*)_T7;_T9=_check_null(_T8);_TA=i;_TB=(int)_TA;c=_T9[_TB];_TC=c;_TD=(int)_TC;if(_TD!=0)goto _TLBE;else{goto _TLBF;}
  734. _TLBE:{unsigned j=0U;_TLC5: if(j < asiz

Large files files are truncated, but you can click here to view the full file