Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* BEGIN cowbel runtime library
- *
- * Written in 2012 by David Given.
- *
- * To the extent possible under law, the author of the cowbel runtime
- * library (of which this code, up to the string 'END cowbel runtime library',
- * is part), has dedicated all copyright and related and neighboring rights
- * to this software to the public domain worldwide. This software is
- * distributed without any warranty.
- *
- * Please see the file COPYING.CC0 in the distribution package for more
- * information.
- */
- #include <stdlib.h>
- #include <stdio.h>
- #include <stdint.h>
- #include <stddef.h>
- #include <stdarg.h>
- #include <string.h>
- typedef int s_boolean_t;
- typedef int s_int_t;
- typedef struct s_string s_string_t;
- struct s_string
- {
- s_string_t* prev;
- s_string_t* next;
- const char* data;
- unsigned seglength;
- unsigned totallength;
- const char* cdata;
- };
- typedef void s_string_traverse_cb(s_string_t* s, void* user);
- static void s_string_traverse(s_string_t* s, s_string_traverse_cb* cb, void* user)
- {
- if (s->prev)
- s_string_traverse(s->prev, cb, user);
- cb(s, user);
- if (s->next)
- s_string_traverse(s->next, cb, user);
- }
- typedef struct s_array s_array_t;
- struct s_array
- {
- unsigned length;
- unsigned allocedlength;
- unsigned itemsize;
- char* data;
- };
- #define S_ALLOC_CONSTRUCTOR(type) \
- ((sizeof(type) > 0) ? ((type*) calloc(1, sizeof(type))) : NULL)
- #define S_CONSTRUCT_CONSTANT_STRING(data) \
- ((s_string_t
- static void s_throw(const char* message)
- {
- fflush(stdout);
- fprintf(stderr, "Runtime error: %s\n", message);
- exit(1);
- }
- /* Boolean methods */
- #define S_METHOD_BOOLEAN__NOT(b, z) (*z) = !(b)
- #define S_METHOD_BOOLEAN__OR(a, b, z) (*z) = (a) | (b)
- /* Integer methods */
- #define S_METHOD_INTEGER__ADD(a, b, z) (*z) = (a) + (b)
- #define S_METHOD_INTEGER__SUB(a, b, z) (*z) = (a) - (b)
- #define S_METHOD_INTEGER__MULTIPLY(a, b, z) (*z) = (a) * (b)
- #define S_METHOD_INTEGER__EQUALS(a, b, z) (*z) = (a) == (b)
- #define S_METHOD_INTEGER__NOTEQUALS(a, b, z) (*z) = (a) != (b)
- #define S_METHOD_INTEGER__GE(a, b, z) (*z) = (a) >= (b)
- #define S_METHOD_INTEGER__GT(a, b, z) (*z) = (a) > (b)
- #define S_METHOD_INTEGER__LE(a, b, z) (*z) = (a) <= (b)
- #define S_METHOD_INTEGER__LT(a, b, z) (*z) = (a) < (b)
- static void S_METHOD_INTEGER_TOSTRING(int value, s_string_t** result)
- {
- s_string_t* s = (s_string_t*) malloc(sizeof(s_string_t));
- s->prev = s->next = NULL;
- char* buffer = (char*) malloc(32);
- sprintf(buffer, "%d", value);
- s->data = s->cdata = buffer;
- s->seglength = s->totallength = strlen(buffer);
- *result = s;
- }
- /* String methods */
- static void s_method_string_print_cb(s_string_t* s, void* user)
- {
- fwrite(s->data, 1, s->seglength, stdout);
- }
- static void S_METHOD_STRING_PRINT(s_string_t* s)
- {
- s_string_traverse(s, s_method_string_print_cb, NULL);
- putchar('\n');
- }
- static void S_METHOD_STRING__ADD(s_string_t* left, s_string_t* right,
- s_string_t** result)
- {
- s_string_t* newstring = (s_string_t*) malloc(sizeof(s_string_t));
- newstring->prev = left;
- newstring->next = right;
- newstring->seglength = 0;
- newstring->totallength = left->totallength + right->totallength;
- newstring->data = newstring->cdata = NULL;
- *result = newstring;
- }
- static void S_METHOD_STRING__EQUALS(s_string_t* left, s_string_t* right,
- s_boolean_t* result)
- {
- int count;
- const char* pleft = NULL;
- int lseg = 0;
- const char* pright = NULL;
- int rseg = 0;
- if (left == right)
- goto success;
- if (left->totallength != right->totallength)
- goto fail;
- count = left->totallength;
- lseg = left->seglength;
- pleft = left->data;
- rseg = right->seglength;
- pright = right->data;
- while (count--)
- {
- while (lseg == 0)
- {
- left = left->next;
- lseg = left->seglength;
- pleft = left->data;
- }
- while (rseg == 0)
- {
- right = right->next;
- rseg = right->seglength;
- pright = right->data;
- }
- if (*pleft++ != *pright++)
- goto fail;
- lseg--;
- rseg--;
- }
- success:
- *result = 1;
- return;
- fail:
- *result = 0;
- return;
- }
- /* END cowbel runtime library */
- struct C0__main_;
- struct C1_get;
- struct C2_set;
- struct C3_get;
- struct C4_set;
- struct C5_Array;
- struct C6_Array;
- struct C7_fannkuch;
- struct C8_fannkuch;
- struct C9_fannkuch;
- struct C10_fannkuch;
- struct C11_fannkuch;
- struct C12_fannkuch;
- struct C13_fannkuch;
- struct C14_fannkuch;
- struct C15_fannkuch;
- struct C16_fannkuch;
- struct C17_fannkuch;
- struct C18_fannkuch;
- struct C19_fannkuch;
- struct C20_fannkuch;
- struct C21_fannkuch;
- struct C22_fannkuch;
- struct C23_Array;
- struct C24_Array;
- struct C25_Array;
- struct C26_Array;
- struct C27_get;
- struct C28_set;
- struct I0_32_interface32;
- static void cowbel_main();
- static void f0_get(void* vc24_Array, s_int_t s0_i, s_int_t* s1_result);
- static void f2_set(void* vc24_Array, s_int_t s2_i, s_int_t s3_value);
- static void f4_get(void* vc26_Array, s_int_t s4_i, s_int_t* s5_result);
- static void f6_set(void* vc26_Array, s_int_t s6_i, s_int_t s7_value);
- static void f8_Array(void* vc0__main_, s_int_t s8_size, s_int_t s9_initialiser, struct I0_32_interface32** s10__return_2);
- static void f11_fannkuch(void* vc0__main_, s_int_t s11_n, s_int_t* s12_sum, s_int_t* s13_maxflips);
- static void f14_Array(void* vc0__main_, s_int_t s14_size, s_int_t s15_initialiser, struct I0_32_interface32** s16__return_2);
- static void f17_Array(void* vc0__main_, s_int_t s17_size, s_int_t s18_initialiser, struct I0_32_interface32** s19__return_2);
- static void f20_get(void* vc6_Array, s_int_t s20_i, s_int_t* s21_result);
- static void f22_set(void* vc6_Array, s_int_t s22_i, s_int_t s23_value);
- static const char Ssc0__main_[] = {80, 102, 97, 110, 110, 107, 117, 99, 104, 101, 110, 40};
- static s_string_t sc0__main_ = { NULL, NULL, Ssc0__main_, 12, 12, NULL};
- static const char Ssc1__main_[] = {41, 32, 61, 32};
- static s_string_t sc1__main_ = { NULL, NULL, Ssc1__main_, 4, 4, NULL};
- struct I0_32_interface32
- {
- void* o;
- void (*m0_21)(void*, s_int_t, s_int_t*);
- void (*m1_20)(void*, s_int_t, s_int_t);
- };
- struct C0__main_
- {
- };
- struct C1_get
- {
- struct C23_Array* c23_Array;
- struct C24_Array* c24_Array;
- };
- struct C2_set
- {
- struct C23_Array* c23_Array;
- struct C24_Array* c24_Array;
- };
- struct C3_get
- {
- struct C25_Array* c25_Array;
- struct C26_Array* c26_Array;
- };
- struct C4_set
- {
- struct C25_Array* c25_Array;
- struct C26_Array* c26_Array;
- };
- struct C5_Array
- {
- void* s24_ptr;
- };
- struct C6_Array
- {
- struct C5_Array* c5_Array;
- struct I0_32_interface32 i1_32_interface32;
- };
- struct C7_fannkuch
- {
- struct C0__main_* c0__main_;
- };
- struct C8_fannkuch
- {
- struct C7_fannkuch* c7_fannkuch;
- };
- struct C9_fannkuch
- {
- struct C7_fannkuch* c7_fannkuch;
- };
- struct C10_fannkuch
- {
- struct C7_fannkuch* c7_fannkuch;
- struct C9_fannkuch* c9_fannkuch;
- };
- struct C11_fannkuch
- {
- struct C7_fannkuch* c7_fannkuch;
- struct C9_fannkuch* c9_fannkuch;
- struct C10_fannkuch* c10_fannkuch;
- };
- struct C12_fannkuch
- {
- struct C7_fannkuch* c7_fannkuch;
- struct C9_fannkuch* c9_fannkuch;
- struct C10_fannkuch* c10_fannkuch;
- };
- struct C13_fannkuch
- {
- struct C7_fannkuch* c7_fannkuch;
- struct C9_fannkuch* c9_fannkuch;
- struct C10_fannkuch* c10_fannkuch;
- struct C12_fannkuch* c12_fannkuch;
- };
- struct C14_fannkuch
- {
- struct C7_fannkuch* c7_fannkuch;
- struct C9_fannkuch* c9_fannkuch;
- struct C10_fannkuch* c10_fannkuch;
- struct C12_fannkuch* c12_fannkuch;
- struct C13_fannkuch* c13_fannkuch;
- };
- struct C15_fannkuch
- {
- struct C7_fannkuch* c7_fannkuch;
- struct C9_fannkuch* c9_fannkuch;
- struct C10_fannkuch* c10_fannkuch;
- struct C12_fannkuch* c12_fannkuch;
- };
- struct C16_fannkuch
- {
- struct C7_fannkuch* c7_fannkuch;
- struct C9_fannkuch* c9_fannkuch;
- struct C10_fannkuch* c10_fannkuch;
- struct C12_fannkuch* c12_fannkuch;
- struct C15_fannkuch* c15_fannkuch;
- };
- struct C17_fannkuch
- {
- struct C7_fannkuch* c7_fannkuch;
- struct C9_fannkuch* c9_fannkuch;
- };
- struct C18_fannkuch
- {
- struct C7_fannkuch* c7_fannkuch;
- struct C9_fannkuch* c9_fannkuch;
- };
- struct C19_fannkuch
- {
- struct C7_fannkuch* c7_fannkuch;
- struct C9_fannkuch* c9_fannkuch;
- struct C18_fannkuch* c18_fannkuch;
- };
- struct C20_fannkuch
- {
- struct C7_fannkuch* c7_fannkuch;
- struct C9_fannkuch* c9_fannkuch;
- struct C18_fannkuch* c18_fannkuch;
- struct C19_fannkuch* c19_fannkuch;
- };
- struct C21_fannkuch
- {
- };
- struct C22_fannkuch
- {
- struct C7_fannkuch* c7_fannkuch;
- struct C9_fannkuch* c9_fannkuch;
- struct C18_fannkuch* c18_fannkuch;
- struct C19_fannkuch* c19_fannkuch;
- };
- struct C23_Array
- {
- void* s25_ptr;
- };
- struct C24_Array
- {
- struct C23_Array* c23_Array;
- struct I0_32_interface32 i1_32_interface32;
- };
- struct C25_Array
- {
- void* s26_ptr;
- };
- struct C26_Array
- {
- struct C25_Array* c25_Array;
- struct I0_32_interface32 i1_32_interface32;
- };
- struct C27_get
- {
- struct C5_Array* c5_Array;
- struct C6_Array* c6_Array;
- };
- struct C28_set
- {
- struct C5_Array* c5_Array;
- struct C6_Array* c6_Array;
- };
- static void cowbel_main()
- {
- B0__main_:;
- struct C0__main_* c0__main_ = S_ALLOC_CONSTRUCTOR(struct C0__main_);
- s_int_t s27_n;
- s_int_t s28_sum;
- s_int_t s29_maxflips;
- s_int_t s30__temp_8;
- s_int_t s31__temp_9;
- s_int_t s32__temp_10;
- s_string_t* s33__temp_11;
- s_string_t* s34__temp_12;
- s_string_t* s35__temp_13;
- s_string_t* s36__temp_14;
- s_string_t* s37__temp_15;
- s_string_t* s38__temp_16;
- s_string_t* s39__temp_17;
- s_string_t* s40__temp_18;
- s30__temp_8 = 11;
- s27_n = s30__temp_8;
- f11_fannkuch(c0__main_, s27_n, &s31__temp_9, &s32__temp_10);
- s28_sum = s31__temp_9;
- s29_maxflips = s32__temp_10;
- S_METHOD_INTEGER_TOSTRING(s28_sum, &s33__temp_11);
- S_METHOD_STRING_PRINT(s33__temp_11);
- S_METHOD_INTEGER_TOSTRING(s29_maxflips, &s34__temp_12);
- s35__temp_13 = &sc1__main_;
- S_METHOD_INTEGER_TOSTRING(s27_n, &s36__temp_14);
- s37__temp_15 = &sc0__main_;
- S_METHOD_STRING__ADD(s37__temp_15, s36__temp_14, &s38__temp_16);
- S_METHOD_STRING__ADD(s38__temp_16, s35__temp_13, &s39__temp_17);
- S_METHOD_STRING__ADD(s39__temp_17, s34__temp_12, &s40__temp_18);
- S_METHOD_STRING_PRINT(s40__temp_18);
- goto B1__main_;
- B1__main_:;
- return;
- }
- static void f0_get(void* vc24_Array, s_int_t s0_i, s_int_t* s1_result)
- {
- struct C24_Array* c24_Array = vc24_Array;
- B2_get:;
- struct C1_get f0_storage;
- struct C1_get* c1_get = &f0_storage;
- c1_get->c23_Array = c24_Array->c23_Array;
- c1_get->c24_Array = c24_Array;
- *s1_result = ((typeof(*s1_result)*)c1_get->c23_Array->s25_ptr)[s0_i];
- goto B3_get;
- B3_get:;
- return;
- }
- static void f2_set(void* vc24_Array, s_int_t s2_i, s_int_t s3_value)
- {
- struct C24_Array* c24_Array = vc24_Array;
- B4_set:;
- struct C2_set f0_storage;
- struct C2_set* c2_set = &f0_storage;
- c2_set->c23_Array = c24_Array->c23_Array;
- c2_set->c24_Array = c24_Array;
- ((typeof(s3_value)*)c2_set->c23_Array->s25_ptr)[s2_i] = s3_value;
- goto B5_set;
- B5_set:;
- return;
- }
- static void f4_get(void* vc26_Array, s_int_t s4_i, s_int_t* s5_result)
- {
- struct C26_Array* c26_Array = vc26_Array;
- B6_get:;
- struct C3_get f0_storage;
- struct C3_get* c3_get = &f0_storage;
- c3_get->c25_Array = c26_Array->c25_Array;
- c3_get->c26_Array = c26_Array;
- *s5_result = ((typeof(*s5_result)*)c3_get->c25_Array->s26_ptr)[s4_i];
- goto B7_get;
- B7_get:;
- return;
- }
- static void f6_set(void* vc26_Array, s_int_t s6_i, s_int_t s7_value)
- {
- struct C26_Array* c26_Array = vc26_Array;
- B8_set:;
- struct C4_set f0_storage;
- struct C4_set* c4_set = &f0_storage;
- c4_set->c25_Array = c26_Array->c25_Array;
- c4_set->c26_Array = c26_Array;
- ((typeof(s7_value)*)c4_set->c25_Array->s26_ptr)[s6_i] = s7_value;
- goto B9_set;
- B9_set:;
- return;
- }
- static void f8_Array(void* vc0__main_, s_int_t s8_size, s_int_t s9_initialiser, struct I0_32_interface32** s10__return_2)
- {
- struct C0__main_* c0__main_ = vc0__main_;
- B10_Array:;
- struct C5_Array* c5_Array = S_ALLOC_CONSTRUCTOR(struct C5_Array);
- s_int_t s41__temp_19;
- void* s42__temp_20;
- struct C6_Array* s43__temp_21;
- struct I0_32_interface32* s44__temp_22;
- s41__temp_19 = 0;
- c5_Array->s24_ptr = s42__temp_20;
- c5_Array->s24_ptr = calloc(s8_size, sizeof(s9_initialiser));
- struct C6_Array* c6_Array = S_ALLOC_CONSTRUCTOR(struct C6_Array);
- c6_Array->c5_Array = c5_Array;
- c6_Array->i1_32_interface32.o = c6_Array;
- c6_Array->i1_32_interface32.m0_21 = f20_get;
- c6_Array->i1_32_interface32.m1_20 = f22_set;
- s43__temp_21 = c6_Array;
- s44__temp_22 = &s43__temp_21->i1_32_interface32;
- *s10__return_2 = s44__temp_22;
- goto B11_Array;
- B11_Array:;
- return;
- }
- static void f11_fannkuch(void* vc0__main_, s_int_t s11_n, s_int_t* s12_sum, s_int_t* s13_maxflips)
- {
- struct C0__main_* c0__main_ = vc0__main_;
- B12_fannkuch:;
- struct C7_fannkuch f0_storage;
- struct C7_fannkuch* c7_fannkuch = &f0_storage;
- c7_fannkuch->c0__main_ = c0__main_;
- struct I0_32_interface32* s45_p;
- struct I0_32_interface32* s46_q;
- struct I0_32_interface32* s47_s;
- s_int_t s48_sign;
- s_int_t s49_m;
- s_int_t s50__loop_counter_for_i_4;
- s_int_t s51__temp_23;
- struct I0_32_interface32* s52__temp_24;
- s_int_t s53__temp_25;
- struct I0_32_interface32* s54__temp_26;
- s_int_t s55__temp_27;
- struct I0_32_interface32* s56__temp_28;
- s_int_t s57__temp_29;
- s_int_t s58__temp_30;
- s_int_t s59__temp_31;
- s_int_t s60__temp_32;
- s_int_t s61__temp_33;
- s_int_t s62__temp_34;
- s_boolean_t s63__temp_35;
- s_boolean_t s64__temp_108;
- s51__temp_23 = 0;
- f8_Array(c7_fannkuch->c0__main_, s11_n, s51__temp_23, &s52__temp_24);
- s45_p = s52__temp_24;
- s53__temp_25 = 0;
- f14_Array(c7_fannkuch->c0__main_, s11_n, s53__temp_25, &s54__temp_26);
- s46_q = s54__temp_26;
- s55__temp_27 = 0;
- f17_Array(c7_fannkuch->c0__main_, s11_n, s55__temp_27, &s56__temp_28);
- s47_s = s56__temp_28;
- s57__temp_29 = 1;
- s48_sign = s57__temp_29;
- s58__temp_30 = 0;
- *s13_maxflips = s58__temp_30;
- s59__temp_31 = 0;
- *s12_sum = s59__temp_31;
- s60__temp_32 = 1;
- S_METHOD_INTEGER__SUB(s11_n, s60__temp_32, &s61__temp_33);
- s49_m = s61__temp_33;
- s62__temp_34 = 0;
- s50__loop_counter_for_i_4 = s62__temp_34;
- goto B13_fannkuch;
- B13_fannkuch:;
- S_METHOD_INTEGER__NOTEQUALS(s50__loop_counter_for_i_4, s11_n, &s63__temp_35);
- if (s63__temp_35) goto B14_fannkuch; else goto B15_fannkuch;
- B15_fannkuch:;
- goto B16_fannkuch;
- B14_fannkuch:;
- struct C8_fannkuch f1_storage;
- struct C8_fannkuch* c8_fannkuch = &f1_storage;
- c8_fannkuch->c7_fannkuch = c7_fannkuch;
- s_int_t s65_i;
- s_int_t s66__temp_36;
- s_int_t s67__temp_37;
- s65_i = s50__loop_counter_for_i_4;
- s45_p->m1_20(s45_p->o, s65_i, s65_i);
- s46_q->m1_20(s46_q->o, s65_i, s65_i);
- s47_s->m1_20(s47_s->o, s65_i, s65_i);
- s66__temp_36 = 1;
- S_METHOD_INTEGER__ADD(s50__loop_counter_for_i_4, s66__temp_36, &s67__temp_37);
- s50__loop_counter_for_i_4 = s67__temp_37;
- goto B13_fannkuch;
- B16_fannkuch:;
- struct C9_fannkuch f2_storage;
- struct C9_fannkuch* c9_fannkuch = &f2_storage;
- c9_fannkuch->c7_fannkuch = c7_fannkuch;
- s_int_t s68_q0;
- s_int_t s69__temp_38;
- s_int_t s70__temp_39;
- s_int_t s71__temp_40;
- s_boolean_t s72__temp_41;
- s_int_t s73__temp_69;
- s_boolean_t s74__temp_70;
- s69__temp_38 = 0;
- s45_p->m0_21(s45_p->o, s69__temp_38, &s70__temp_39);
- s68_q0 = s70__temp_39;
- s71__temp_40 = 0;
- S_METHOD_INTEGER__NOTEQUALS(s68_q0, s71__temp_40, &s72__temp_41);
- if (s72__temp_41) goto B17_fannkuch; else goto B18_fannkuch;
- B17_fannkuch:;
- struct C10_fannkuch f3_storage;
- struct C10_fannkuch* c10_fannkuch = &f3_storage;
- c10_fannkuch->c7_fannkuch = c7_fannkuch;
- c10_fannkuch->c9_fannkuch = c9_fannkuch;
- s_int_t s75__loop_counter_for_i_5;
- s_int_t s76_flips;
- s_int_t s77__temp_42;
- s_boolean_t s78__temp_43;
- s_int_t s79__temp_47;
- s_boolean_t s80__temp_68;
- s77__temp_42 = 1;
- s75__loop_counter_for_i_5 = s77__temp_42;
- goto B19_fannkuch;
- B18_fannkuch:;
- s73__temp_69 = 1;
- S_METHOD_INTEGER__EQUALS(s48_sign, s73__temp_69, &s74__temp_70);
- if (s74__temp_70) goto B20_fannkuch; else goto B21_fannkuch;
- B19_fannkuch:;
- S_METHOD_INTEGER__NOTEQUALS(s75__loop_counter_for_i_5, s11_n, &s78__temp_43);
- if (s78__temp_43) goto B22_fannkuch; else goto B23_fannkuch;
- B23_fannkuch:;
- s79__temp_47 = 1;
- s76_flips = s79__temp_47;
- goto B24_fannkuch;
- B22_fannkuch:;
- struct C11_fannkuch f4_storage;
- struct C11_fannkuch* c11_fannkuch = &f4_storage;
- c11_fannkuch->c7_fannkuch = c7_fannkuch;
- c11_fannkuch->c9_fannkuch = c9_fannkuch;
- c11_fannkuch->c10_fannkuch = c10_fannkuch;
- s_int_t s81_i;
- s_int_t s82__temp_44;
- s_int_t s83__temp_45;
- s_int_t s84__temp_46;
- s81_i = s75__loop_counter_for_i_5;
- s45_p->m0_21(s45_p->o, s81_i, &s82__temp_44);
- s46_q->m1_20(s46_q->o, s81_i, s82__temp_44);
- s83__temp_45 = 1;
- S_METHOD_INTEGER__ADD(s75__loop_counter_for_i_5, s83__temp_45, &s84__temp_46);
- s75__loop_counter_for_i_5 = s84__temp_46;
- goto B19_fannkuch;
- B24_fannkuch:;
- struct C12_fannkuch f5_storage;
- struct C12_fannkuch* c12_fannkuch = &f5_storage;
- c12_fannkuch->c7_fannkuch = c7_fannkuch;
- c12_fannkuch->c9_fannkuch = c9_fannkuch;
- c12_fannkuch->c10_fannkuch = c10_fannkuch;
- s_int_t s85_qq;
- s_int_t s86__temp_48;
- s_int_t s87__temp_49;
- s_boolean_t s88__temp_50;
- s_int_t s89__temp_54;
- s_boolean_t s90__temp_55;
- s_int_t s91__temp_66;
- s_int_t s92__temp_67;
- s46_q->m0_21(s46_q->o, s68_q0, &s86__temp_48);
- s85_qq = s86__temp_48;
- s87__temp_49 = 0;
- S_METHOD_INTEGER__EQUALS(s85_qq, s87__temp_49, &s88__temp_50);
- if (s88__temp_50) goto B25_fannkuch; else goto B26_fannkuch;
- B25_fannkuch:;
- struct C13_fannkuch f6_storage;
- struct C13_fannkuch* c13_fannkuch = &f6_storage;
- c13_fannkuch->c7_fannkuch = c7_fannkuch;
- c13_fannkuch->c9_fannkuch = c9_fannkuch;
- c13_fannkuch->c10_fannkuch = c10_fannkuch;
- c13_fannkuch->c12_fannkuch = c12_fannkuch;
- s_int_t s93__temp_51;
- s_int_t s94__temp_52;
- s_boolean_t s95__temp_53;
- S_METHOD_INTEGER__MULTIPLY(s48_sign, s76_flips, &s93__temp_51);
- S_METHOD_INTEGER__ADD(*s12_sum, s93__temp_51, &s94__temp_52);
- *s12_sum = s94__temp_52;
- S_METHOD_INTEGER__GT(s76_flips, *s13_maxflips, &s95__temp_53);
- if (s95__temp_53) goto B27_fannkuch; else goto B28_fannkuch;
- B26_fannkuch:;
- s46_q->m1_20(s46_q->o, s68_q0, s68_q0);
- s89__temp_54 = 3;
- S_METHOD_INTEGER__GE(s68_q0, s89__temp_54, &s90__temp_55);
- if (s90__temp_55) goto B29_fannkuch; else goto B30_fannkuch;
- B27_fannkuch:;
- struct C14_fannkuch f7_storage;
- struct C14_fannkuch* c14_fannkuch = &f7_storage;
- c14_fannkuch->c7_fannkuch = c7_fannkuch;
- c14_fannkuch->c9_fannkuch = c9_fannkuch;
- c14_fannkuch->c10_fannkuch = c10_fannkuch;
- c14_fannkuch->c12_fannkuch = c12_fannkuch;
- c14_fannkuch->c13_fannkuch = c13_fannkuch;
- *s13_maxflips = s76_flips;
- goto B28_fannkuch;
- B28_fannkuch:;
- goto B31_fannkuch;
- B31_fannkuch:;
- goto B18_fannkuch;
- B29_fannkuch:;
- struct C15_fannkuch f8_storage;
- struct C15_fannkuch* c15_fannkuch = &f8_storage;
- c15_fannkuch->c7_fannkuch = c7_fannkuch;
- c15_fannkuch->c9_fannkuch = c9_fannkuch;
- c15_fannkuch->c10_fannkuch = c10_fannkuch;
- c15_fannkuch->c12_fannkuch = c12_fannkuch;
- s_int_t s96_i;
- s_int_t s97_j;
- s_int_t s98__temp_56;
- s_int_t s99__temp_57;
- s_int_t s100__temp_58;
- s_boolean_t s101__temp_65;
- s98__temp_56 = 1;
- s96_i = s98__temp_56;
- s99__temp_57 = 1;
- S_METHOD_INTEGER__SUB(s68_q0, s99__temp_57, &s100__temp_58);
- s97_j = s100__temp_58;
- goto B32_fannkuch;
- B30_fannkuch:;
- s68_q0 = s85_qq;
- s91__temp_66 = 1;
- S_METHOD_INTEGER__ADD(s76_flips, s91__temp_66, &s92__temp_67);
- s76_flips = s92__temp_67;
- s80__temp_68 = 1;
- if (s80__temp_68) goto B24_fannkuch; else goto B31_fannkuch;
- B32_fannkuch:;
- struct C16_fannkuch f9_storage;
- struct C16_fannkuch* c16_fannkuch = &f9_storage;
- c16_fannkuch->c7_fannkuch = c7_fannkuch;
- c16_fannkuch->c9_fannkuch = c9_fannkuch;
- c16_fannkuch->c10_fannkuch = c10_fannkuch;
- c16_fannkuch->c12_fannkuch = c12_fannkuch;
- c16_fannkuch->c15_fannkuch = c15_fannkuch;
- s_int_t s102_t;
- s_int_t s103__temp_59;
- s_int_t s104__temp_60;
- s_int_t s105__temp_61;
- s_int_t s106__temp_62;
- s_int_t s107__temp_63;
- s_int_t s108__temp_64;
- s46_q->m0_21(s46_q->o, s96_i, &s103__temp_59);
- s102_t = s103__temp_59;
- s46_q->m0_21(s46_q->o, s97_j, &s104__temp_60);
- s46_q->m1_20(s46_q->o, s96_i, s104__temp_60);
- s46_q->m1_20(s46_q->o, s97_j, s102_t);
- s105__temp_61 = 1;
- S_METHOD_INTEGER__ADD(s96_i, s105__temp_61, &s106__temp_62);
- s96_i = s106__temp_62;
- s107__temp_63 = 1;
- S_METHOD_INTEGER__SUB(s97_j, s107__temp_63, &s108__temp_64);
- s97_j = s108__temp_64;
- S_METHOD_INTEGER__LT(s96_i, s97_j, &s101__temp_65);
- if (s101__temp_65) goto B32_fannkuch; else goto B33_fannkuch;
- B33_fannkuch:;
- goto B30_fannkuch;
- B20_fannkuch:;
- struct C17_fannkuch f10_storage;
- struct C17_fannkuch* c17_fannkuch = &f10_storage;
- c17_fannkuch->c7_fannkuch = c7_fannkuch;
- c17_fannkuch->c9_fannkuch = c9_fannkuch;
- s_int_t s109_t;
- s_int_t s110__temp_71;
- s_int_t s111__temp_72;
- s_int_t s112__temp_73;
- s_int_t s113__temp_74;
- s_int_t s114__temp_75;
- s_int_t s115__temp_76;
- s_int_t s116__temp_77;
- s110__temp_71 = 1;
- s45_p->m0_21(s45_p->o, s110__temp_71, &s111__temp_72);
- s109_t = s111__temp_72;
- s112__temp_73 = 1;
- s113__temp_74 = 0;
- s45_p->m0_21(s45_p->o, s113__temp_74, &s114__temp_75);
- s45_p->m1_20(s45_p->o, s112__temp_73, s114__temp_75);
- s115__temp_76 = 0;
- s45_p->m1_20(s45_p->o, s115__temp_76, s109_t);
- s116__temp_77 = -1;
- s48_sign = s116__temp_77;
- goto B34_fannkuch;
- B21_fannkuch:;
- struct C18_fannkuch f11_storage;
- struct C18_fannkuch* c18_fannkuch = &f11_storage;
- c18_fannkuch->c7_fannkuch = c7_fannkuch;
- c18_fannkuch->c9_fannkuch = c9_fannkuch;
- s_int_t s117_t;
- s_int_t s118__loop_counter_for_i_7;
- s_int_t s119__temp_78;
- s_int_t s120__temp_79;
- s_int_t s121__temp_80;
- s_int_t s122__temp_81;
- s_int_t s123__temp_82;
- s_int_t s124__temp_83;
- s_int_t s125__temp_84;
- s_int_t s126__temp_85;
- s_boolean_t s127__temp_86;
- s119__temp_78 = 1;
- s45_p->m0_21(s45_p->o, s119__temp_78, &s120__temp_79);
- s117_t = s120__temp_79;
- s121__temp_80 = 1;
- s122__temp_81 = 2;
- s45_p->m0_21(s45_p->o, s122__temp_81, &s123__temp_82);
- s45_p->m1_20(s45_p->o, s121__temp_80, s123__temp_82);
- s124__temp_83 = 2;
- s45_p->m1_20(s45_p->o, s124__temp_83, s117_t);
- s125__temp_84 = 1;
- s48_sign = s125__temp_84;
- s126__temp_85 = 2;
- s118__loop_counter_for_i_7 = s126__temp_85;
- goto B35_fannkuch;
- B34_fannkuch:;
- s64__temp_108 = 1;
- if (s64__temp_108) goto B16_fannkuch; else goto B36_fannkuch;
- B36_fannkuch:;
- goto B37_fannkuch;
- B37_fannkuch:;
- return;
- B35_fannkuch:;
- S_METHOD_INTEGER__NOTEQUALS(s118__loop_counter_for_i_7, s11_n, &s127__temp_86);
- if (s127__temp_86) goto B38_fannkuch; else goto B39_fannkuch;
- B39_fannkuch:;
- goto B34_fannkuch;
- B38_fannkuch:;
- struct C19_fannkuch f12_storage;
- struct C19_fannkuch* c19_fannkuch = &f12_storage;
- c19_fannkuch->c7_fannkuch = c7_fannkuch;
- c19_fannkuch->c9_fannkuch = c9_fannkuch;
- c19_fannkuch->c18_fannkuch = c18_fannkuch;
- s_int_t s128_i;
- s_int_t s129_sx;
- s_int_t s130__loop_counter_for_j_6;
- s_int_t s131__temp_87;
- s_int_t s132__temp_88;
- s_boolean_t s133__temp_89;
- s_boolean_t s134__temp_92;
- s_int_t s135__temp_93;
- s_int_t s136__temp_94;
- s_int_t s137__temp_95;
- s_int_t s138__temp_96;
- s_int_t s139__temp_97;
- s_boolean_t s140__temp_98;
- s_int_t s141__temp_104;
- s_int_t s142__temp_105;
- s_int_t s143__temp_106;
- s_int_t s144__temp_107;
- s128_i = s118__loop_counter_for_i_7;
- s47_s->m0_21(s47_s->o, s128_i, &s131__temp_87);
- s129_sx = s131__temp_87;
- s132__temp_88 = 0;
- S_METHOD_INTEGER__NOTEQUALS(s129_sx, s132__temp_88, &s133__temp_89);
- if (s133__temp_89) goto B40_fannkuch; else goto B41_fannkuch;
- B40_fannkuch:;
- struct C20_fannkuch f13_storage;
- struct C20_fannkuch* c20_fannkuch = &f13_storage;
- c20_fannkuch->c7_fannkuch = c7_fannkuch;
- c20_fannkuch->c9_fannkuch = c9_fannkuch;
- c20_fannkuch->c18_fannkuch = c18_fannkuch;
- c20_fannkuch->c19_fannkuch = c19_fannkuch;
- s_int_t s145__temp_90;
- s_int_t s146__temp_91;
- s145__temp_90 = 1;
- S_METHOD_INTEGER__SUB(s129_sx, s145__temp_90, &s146__temp_91);
- s47_s->m1_20(s47_s->o, s128_i, s146__temp_91);
- goto B39_fannkuch;
- B41_fannkuch:;
- S_METHOD_INTEGER__EQUALS(s128_i, s49_m, &s134__temp_92);
- if (s134__temp_92) goto B42_fannkuch; else goto B43_fannkuch;
- B42_fannkuch:;
- struct C21_fannkuch f14_storage;
- struct C21_fannkuch* c21_fannkuch = &f14_storage;
- goto B37_fannkuch;
- B43_fannkuch:;
- s47_s->m1_20(s47_s->o, s128_i, s128_i);
- s135__temp_93 = 0;
- s45_p->m0_21(s45_p->o, s135__temp_93, &s136__temp_94);
- s117_t = s136__temp_94;
- s137__temp_95 = 0;
- s130__loop_counter_for_j_6 = s137__temp_95;
- goto B44_fannkuch;
- B44_fannkuch:;
- s138__temp_96 = 1;
- S_METHOD_INTEGER__ADD(s128_i, s138__temp_96, &s139__temp_97);
- S_METHOD_INTEGER__NOTEQUALS(s130__loop_counter_for_j_6, s139__temp_97, &s140__temp_98);
- if (s140__temp_98) goto B45_fannkuch; else goto B46_fannkuch;
- B46_fannkuch:;
- s141__temp_104 = 1;
- S_METHOD_INTEGER__ADD(s128_i, s141__temp_104, &s142__temp_105);
- s45_p->m1_20(s45_p->o, s142__temp_105, s117_t);
- s143__temp_106 = 1;
- S_METHOD_INTEGER__ADD(s118__loop_counter_for_i_7, s143__temp_106, &s144__temp_107);
- s118__loop_counter_for_i_7 = s144__temp_107;
- goto B35_fannkuch;
- B45_fannkuch:;
- struct C22_fannkuch f15_storage;
- struct C22_fannkuch* c22_fannkuch = &f15_storage;
- c22_fannkuch->c7_fannkuch = c7_fannkuch;
- c22_fannkuch->c9_fannkuch = c9_fannkuch;
- c22_fannkuch->c18_fannkuch = c18_fannkuch;
- c22_fannkuch->c19_fannkuch = c19_fannkuch;
- s_int_t s147_j;
- s_int_t s148__temp_99;
- s_int_t s149__temp_100;
- s_int_t s150__temp_101;
- s_int_t s151__temp_102;
- s_int_t s152__temp_103;
- s147_j = s130__loop_counter_for_j_6;
- s148__temp_99 = 1;
- S_METHOD_INTEGER__ADD(s147_j, s148__temp_99, &s149__temp_100);
- s45_p->m0_21(s45_p->o, s149__temp_100, &s150__temp_101);
- s45_p->m1_20(s45_p->o, s147_j, s150__temp_101);
- s151__temp_102 = 1;
- S_METHOD_INTEGER__ADD(s130__loop_counter_for_j_6, s151__temp_102, &s152__temp_103);
- s130__loop_counter_for_j_6 = s152__temp_103;
- goto B44_fannkuch;
- }
- static void f14_Array(void* vc0__main_, s_int_t s14_size, s_int_t s15_initialiser, struct I0_32_interface32** s16__return_2)
- {
- struct C0__main_* c0__main_ = vc0__main_;
- B47_Array:;
- struct C23_Array* c23_Array = S_ALLOC_CONSTRUCTOR(struct C23_Array);
- s_int_t s153__temp_109;
- void* s154__temp_110;
- struct C24_Array* s155__temp_111;
- struct I0_32_interface32* s156__temp_112;
- s153__temp_109 = 0;
- c23_Array->s25_ptr = s154__temp_110;
- c23_Array->s25_ptr = calloc(s14_size, sizeof(s15_initialiser));
- struct C24_Array* c24_Array = S_ALLOC_CONSTRUCTOR(struct C24_Array);
- c24_Array->c23_Array = c23_Array;
- c24_Array->i1_32_interface32.o = c24_Array;
- c24_Array->i1_32_interface32.m0_21 = f0_get;
- c24_Array->i1_32_interface32.m1_20 = f2_set;
- s155__temp_111 = c24_Array;
- s156__temp_112 = &s155__temp_111->i1_32_interface32;
- *s16__return_2 = s156__temp_112;
- goto B48_Array;
- B48_Array:;
- return;
- }
- static void f17_Array(void* vc0__main_, s_int_t s17_size, s_int_t s18_initialiser, struct I0_32_interface32** s19__return_2)
- {
- struct C0__main_* c0__main_ = vc0__main_;
- B49_Array:;
- struct C25_Array* c25_Array = S_ALLOC_CONSTRUCTOR(struct C25_Array);
- s_int_t s157__temp_113;
- void* s158__temp_114;
- struct C26_Array* s159__temp_115;
- struct I0_32_interface32* s160__temp_116;
- s157__temp_113 = 0;
- c25_Array->s26_ptr = s158__temp_114;
- c25_Array->s26_ptr = calloc(s17_size, sizeof(s18_initialiser));
- struct C26_Array* c26_Array = S_ALLOC_CONSTRUCTOR(struct C26_Array);
- c26_Array->c25_Array = c25_Array;
- c26_Array->i1_32_interface32.o = c26_Array;
- c26_Array->i1_32_interface32.m0_21 = f4_get;
- c26_Array->i1_32_interface32.m1_20 = f6_set;
- s159__temp_115 = c26_Array;
- s160__temp_116 = &s159__temp_115->i1_32_interface32;
- *s19__return_2 = s160__temp_116;
- goto B50_Array;
- B50_Array:;
- return;
- }
- static void f20_get(void* vc6_Array, s_int_t s20_i, s_int_t* s21_result)
- {
- struct C6_Array* c6_Array = vc6_Array;
- B51_get:;
- struct C27_get f0_storage;
- struct C27_get* c27_get = &f0_storage;
- c27_get->c5_Array = c6_Array->c5_Array;
- c27_get->c6_Array = c6_Array;
- *s21_result = ((typeof(*s21_result)*)c27_get->c5_Array->s24_ptr)[s20_i];
- goto B52_get;
- B52_get:;
- return;
- }
- static void f22_set(void* vc6_Array, s_int_t s22_i, s_int_t s23_value)
- {
- struct C6_Array* c6_Array = vc6_Array;
- B53_set:;
- struct C28_set f0_storage;
- struct C28_set* c28_set = &f0_storage;
- c28_set->c5_Array = c6_Array->c5_Array;
- c28_set->c6_Array = c6_Array;
- ((typeof(s23_value)*)c28_set->c5_Array->s24_ptr)[s22_i] = s23_value;
- goto B54_set;
- B54_set:;
- return;
- }
- /* BEGIN cowbel runtime library
- *
- * Written in 2012 by David Given.
- *
- * To the extent possible under law, the author of the cowbel runtime
- * library (of which this code, up to the string 'END cowbel runtime library',
- * is part), has dedicated all copyright and related and neighboring rights
- * to this software to the public domain worldwide. This software is
- * distributed without any warranty.
- *
- * Please see the file COPYING.CC0 in the distribution package for more
- * information.
- */
- int main(int argc, const char* argv[])
- {
- cowbel_main();
- return 0;
- }
- /* END cowbel runtime library */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement