struct atest_2314 { char dummy; }; struct atest_2526 { char dummy; }; struct node_2760 { INT data_2761; struct node_2760 * next_2763; struct node_2760 * prev_2765; }; struct list_2738 { struct node_2760 * head_2771; struct node_2760 * tail_2773; struct node_2760 * point_node_2775; INT list_length_2777; }; struct node_3470 { INT data_3471; struct node_3470 * next_3473; }; struct slist_3453 { struct node_3470 * head_3479; struct node_3470 * point_node_3481; }; struct context1891 { /* gen ref string string.token */ long state; string *con2; string *retval4371; string *tokstr_1861; string retspace4182; string retspace4178; string l_1863; string s_1865; }; struct context2245 { /* gen ref int upto */ long state; INT *retval4378; INT from_2222; INT to_2223; }; struct context2277 { /* gen ref int downto */ long state; INT *retval4385; INT from_2254; INT to_2255; }; struct context2832 { /* gen ref int list.all */ long state; struct list_2738 *con2; struct node_2760 * p_2834; }; struct context3527 { /* gen ref int slist.all */ long state; struct slist_3453 *con2; struct node_3470 * p_3529; }; struct context2245 *gencontext2245(); INT *upto_2245(); /* gen ref int upto */ INT length_2782(); /* func int list.length */ INT *L3041(); /* func ref int list.[] */ INT *first_3015(); /* func ref int list.first */ INT *last_3028(); /* func ref int list.last */ struct context2277 *gencontext2277(); INT *downto_2277(); /* gen ref int downto */ bool search_2865(); /* func bool list.search */ struct context2832 *gencontext2832(); INT *all_2832(); /* gen ref int list.all */ INT length_3483(); /* func int slist.length */ INT *L3755(); /* func ref int slist.[] */ INT *first_3711(); /* func ref int slist.first */ INT *last_3724(); /* func ref int slist.last */ bool search_3560(); /* func bool slist.search */ struct context3527 *gencontext3527(); INT *all_3527(); /* gen ref int slist.all */ #include "runtime.h" #include "bx.out.h" string const214; string const224; string const1655; string const1884; string const2351; string const2440; string const2504; string const2563; string const2652; string const2716; string const3347; main() { runtime_init(); const214 = str_save("Testing double list\n"); const224 = str_save("Testing single list\n"); const1655 = str_save(""); const1884 = str_save(""); const2351 = str_save("\tList length is "); const2440 = str_save("\tList length is "); const2504 = str_save("\tList length is "); const2563 = str_save("\tList length is "); const2652 = str_save("\tList length is "); const2716 = str_save("\tList length is "); const3347 = str_save("\n"); main_235(); exit(0); } main_235() /* proc main */ { struct atest_2314 l_210; struct atest_2526 m_213; ref_putline(&const214); test_2316(&l_210); ref_putline(&const224); test_2528(&m_213); funcend235:; } test_2316(con2) /* proc atest.test */ struct atest_2314 *con2; { string retspace4230; string retspace4226; string retspace4222; INT retspace4218; string retspace4214; string retspace4210; string retspace4206; INT retspace4202; string retspace4198; string retspace4194; string retspace4190; INT retspace4186; struct list_2738 l_2318; INT len_2321; struct context2245 *frame2324; INT *loopvar2324; struct context2245 *frame2413; INT *loopvar2413; struct context2277 *frame2458; INT *loopvar2458; string_init(&retspace4230); string_init(&retspace4226); string_init(&retspace4222); ZERO(&retspace4218); string_init(&retspace4214); string_init(&retspace4210); string_init(&retspace4206); ZERO(&retspace4202); string_init(&retspace4198); string_init(&retspace4194); string_init(&retspace4190); ZERO(&retspace4186); ZERO(&len_2321); auto_init_3450(&l_2318); /* for setup: i := upto(retspace, (INT) 1, (INT) 250) */ frame2324 = gencontext2245(&retspace4186, (INT) 1, (INT) 250); forloop2323:; loopvar2324 = upto_2245(frame2324); if (loopvar2324 == NULL) goto fordone2323; append_2891(&l_2318, *loopvar2324); goto forloop2323; fordone2323:; if (frame2324->state != -1) { frame2324->state = -2; upto_2245(frame2324); } free(frame2324); ASSIGN(&len_2321, length_2782(&l_2318)); ref_putline(string_plus_c(string_plus(&const2351, &retspace4190, int_to_string(len_2321, &retspace4194)), &retspace4198, '\n')); if (!EQ(len_2321, (INT) 250)) bxasfail("list.b", 13L); if (!EQ(*L3041(&l_2318, (INT) 1), *first_3015(&l_2318))) bxasfail("list.b", 15L); if (!EQ(*L3041(&l_2318, (INT) 10), (INT) 10)) bxasfail("list.b", 16L); if (!EQ(*L3041(&l_2318, (INT) 100), (INT) 100)) bxasfail("list.b", 17L); if (!EQ(*L3041(&l_2318, (INT) 250), *last_3028(&l_2318))) bxasfail("list.b", 18L); /* for setup: i := upto(retspace, (INT) 251, (INT) 500) */ frame2413 = gencontext2245(&retspace4202, (INT) 251, (INT) 500); forloop2412:; loopvar2413 = upto_2245(frame2413); if (loopvar2413 == NULL) goto fordone2412; prepend_2953(&l_2318, loopvar2413); goto forloop2412; fordone2412:; if (frame2413->state != -1) { frame2413->state = -2; upto_2245(frame2413); } free(frame2413); ASSIGN(&len_2321, length_2782(&l_2318)); ref_putline(string_plus_c(string_plus(&const2440, &retspace4206, int_to_string(len_2321, &retspace4210)), &retspace4214, '\n')); if (!EQ(len_2321, (INT) 500)) bxasfail("list.b", 26L); /* for setup: i := downto(retspace, (INT) 500, (INT) 1) */ frame2458 = gencontext2277(&retspace4218, (INT) 500, (INT) 1); forloop2457:; loopvar2458 = downto_2277(frame2458); if (loopvar2458 == NULL) goto fordone2457; if (!search_2865(&l_2318, *loopvar2458)) bxasfail("list.b", 29L); goto forloop2457; fordone2457:; if (frame2458->state != -1) { frame2458->state = -2; downto_2277(frame2458); } free(frame2458); if (!search_2865(&l_2318, (INT) 1)) bxasfail("list.b", 32L); delete_point_3241(&l_2318); if (!NOT(search_2865(&l_2318, (INT) 1))) bxasfail("list.b", 34L); ASSIGN(&len_2321, length_2782(&l_2318)); ref_putline(string_plus_c(string_plus(&const2504, &retspace4222, int_to_string(len_2321, &retspace4226)), &retspace4230, '\n')); if (!EQ(len_2321, (INT) 499)) bxasfail("list.b", 37L); auto_done_3248(&l_2318); string_done(&retspace4190); string_done(&retspace4194); string_done(&retspace4198); string_done(&retspace4206); string_done(&retspace4210); string_done(&retspace4214); string_done(&retspace4222); string_done(&retspace4226); string_done(&retspace4230); funcend2316:; } auto_init_3450(con2) /* proc list.auto_init */ struct list_2738 *con2; { ZERO(&(con2->list_length_2777)); ASSIGN(&(con2->list_length_2777), (INT) 0); ZERO(&(con2->point_node_2775)); ZERO(&(con2->tail_2773)); ZERO(&(con2->head_2771)); funcend3450:; } struct context2245 * gencontext2245(retval4378, from_2222, to_2223) /* gen ref int upto */ INT *retval4378; INT from_2222; INT to_2223; { struct context2245 *self = (struct context2245 *) bx_malloc(sizeof(struct context2245)); self->retval4378 = retval4378; self->from_2222 = from_2222; self->to_2223 = to_2223; self->state = 0; return self; } INT * upto_2245(self) /* gen ref int upto */ struct context2245 *self; { switch(self->state) { case 0: break; case -1: return NULL; case -2: goto funcend2245; case 2232: goto yield2232; } while4062:; if (LE(self->from_2222, self->to_2223)) { ASSIGN(self->retval4378, self->from_2222); self->state = 2232; return self->retval4378; yield2232:; ASSIGN(&(self->from_2222), PLUS(self->from_2222, (INT) 1)); goto while4062; } funcend2245:; self->state = -1; return NULL; } append_2891(con2, elem_2892) /* proc list.append */ struct list_2738 *con2; INT elem_2892; { if (ISNULL(con2->head_2771)) { new_3937(&(con2->head_2771)); ASSIGN(&(con2->tail_2773), con2->head_2771); } else { new_3937(&(DEREF(con2->tail_2773)->next_2763)); ASSIGN(&(DEREF(DEREF(con2->tail_2773)->next_2763)->prev_2765), con2->tail_2773); ASSIGN(&(con2->tail_2773), DEREF(con2->tail_2773)->next_2763); } ASSIGN(&(con2->point_node_2775), con2->tail_2773); ASSIGN(&(DEREF(con2->tail_2773)->data_2761), elem_2892); ASSIGN(&(con2->list_length_2777), PLUS(con2->list_length_2777, (INT) 1)); funcend2891:; } new_3937(con2) /* proc pointer.new */ struct node_2760 * *con2; { ptr_alloc(con2 /* non-atomic */, (INT) sizeof(struct node_2760)); auto_init_2767(DEREF(*con2 /* atomic */), con2 /* non-atomic */); if (!NOTNULL(*con2 /* atomic */)) bxasfail("/usr/lib/bx/libbx/pointer.b", 22L); if (!NOT(ISNULL(*con2 /* atomic */))) bxasfail("/usr/lib/bx/libbx/pointer.b", 23L); funcend3937:; } auto_init_2767(con3, con2) /* proc list.node.auto_init */ struct node_2760 *con3; struct list_2738 *con2; { ZERO(&(con3->prev_2765)); ZERO(&(con3->next_2763)); ZERO(&(con3->data_2761)); funcend2767:; } INT length_2782(con2) /* func int list.length */ struct list_2738 *con2; { INT ret; ret = con2->list_length_2777; goto funcend2782; funcend2782:; return ret; } INT * L3041(con2, n_3042) /* func ref int list.[] */ struct list_2738 *con2; INT n_3042; { INT *ret; struct node_2760 * p_3045; INT i_3101; ZERO(&p_3045); if (!AND(GT(n_3042, (INT) 0), LE(n_3042, con2->list_length_2777))) bxasfail("/usr/lib/bx/libbx/list.b", 111L); if (LT(n_3042, DIV(con2->list_length_2777, (INT) 2))) { ASSIGN(&p_3045, con2->head_2771); while4070:; if (GT(n_3042, (INT) 1)) { ASSIGN(&p_3045, DEREF(p_3045)->next_2763); ASSIGN(&n_3042, MINUS(n_3042, (INT) 1)); goto while4070; } } else { ZERO(&i_3101); ASSIGN(&i_3101, con2->list_length_2777); ASSIGN(&p_3045, con2->tail_2773); while4072:; if (GT(i_3101, n_3042)) { ASSIGN(&p_3045, DEREF(p_3045)->prev_2765); ASSIGN(&i_3101, MINUS(i_3101, (INT) 1)); goto while4072; } } ASSIGN(&(con2->point_node_2775), p_3045); ret = &(DEREF(p_3045)->data_2761); goto funcend3041; funcend3041:; return ret; } INT * first_3015(con2) /* func ref int list.first */ struct list_2738 *con2; { INT *ret; ASSIGN(&(con2->point_node_2775), con2->head_2771); ret = &(DEREF(con2->head_2771)->data_2761); goto funcend3015; funcend3015:; return ret; } INT * last_3028(con2) /* func ref int list.last */ struct list_2738 *con2; { INT *ret; ASSIGN(&(con2->point_node_2775), con2->tail_2773); ret = &(DEREF(con2->tail_2773)->data_2761); goto funcend3028; funcend3028:; return ret; } prepend_2953(con2, elem_2954) /* proc list.prepend */ struct list_2738 *con2; INT *elem_2954; { if (ISNULL(con2->head_2771)) { new_3937(&(con2->head_2771)); ASSIGN(&(con2->tail_2773), con2->head_2771); } else { new_3937(&(DEREF(con2->head_2771)->prev_2765)); ASSIGN(&(DEREF(DEREF(con2->head_2771)->prev_2765)->next_2763), con2->head_2771); ASSIGN(&(con2->head_2771), DEREF(con2->head_2771)->prev_2765); } ASSIGN(&(DEREF(con2->head_2771)->data_2761), *elem_2954); ASSIGN(&(con2->point_node_2775), con2->head_2771); ASSIGN(&(con2->list_length_2777), PLUS(con2->list_length_2777, (INT) 1)); funcend2953:; } struct context2277 * gencontext2277(retval4385, from_2254, to_2255) /* gen ref int downto */ INT *retval4385; INT from_2254; INT to_2255; { struct context2277 *self = (struct context2277 *) bx_malloc(sizeof(struct context2277)); self->retval4385 = retval4385; self->from_2254 = from_2254; self->to_2255 = to_2255; self->state = 0; return self; } INT * downto_2277(self) /* gen ref int downto */ struct context2277 *self; { switch(self->state) { case 0: break; case -1: return NULL; case -2: goto funcend2277; case 2264: goto yield2264; } while4064:; if (GE(self->from_2254, self->to_2255)) { ASSIGN(self->retval4385, self->from_2254); self->state = 2264; return self->retval4385; yield2264:; ASSIGN(&(self->from_2254), MINUS(self->from_2254, (INT) 1)); goto while4064; } funcend2277:; self->state = -1; return NULL; } bool search_2865(con2, v_2866) /* func bool list.search */ struct list_2738 *con2; INT v_2866; { bool ret; struct context2832 *frame2870; INT *loopvar2870; /* for setup: i := all */ frame2870 = gencontext2832(con2 /* non-atomic */); forloop2869:; loopvar2870 = all_2832(frame2870); if (loopvar2870 == NULL) goto fordone2869; if (EQ(*loopvar2870, v_2866)) { ret = TRUE; goto funcend2865; } goto forloop2869; fordone2869:; if (frame2870->state != -1) { frame2870->state = -2; all_2832(frame2870); } free(frame2870); ret = FALSE; goto funcend2865; funcend2865:; return ret; } struct context2832 * gencontext2832(con2) /* gen ref int list.all */ struct list_2738 *con2; { struct context2832 *self = (struct context2832 *) bx_malloc(sizeof(struct context2832)); self->con2 = con2; self->state = 0; return self; } INT * all_2832(self) /* gen ref int list.all */ struct context2832 *self; { switch(self->state) { case 0: break; case -1: return NULL; case -2: goto funcend2832; case 2855: goto yield2855; } ZERO(&(self->p_2834)); ASSIGN(&(self->p_2834), self->con2->head_2771); while4068:; if (NOTNULL(self->p_2834)) { ASSIGN(&(self->con2->point_node_2775), self->p_2834); ASSIGN(&(self->p_2834), DEREF(self->p_2834)->next_2763); self->state = 2855; return &(DEREF(self->con2->point_node_2775)->data_2761); yield2855:; goto while4068; } ZERO(&(self->con2->point_node_2775)); funcend2832:; self->state = -1; return NULL; } delete_point_3241(con2) /* proc list.delete_point */ struct list_2738 *con2; { delete_node_3144(con2 /* non-atomic */, &(con2->point_node_2775)); funcend3241:; } delete_node_3144(con2, x_3145) /* proc list.delete_node */ struct list_2738 *con2; struct node_2760 * *x_3145; { if (EQ(con2->head_2771, *x_3145)) { ASSIGN(&(con2->head_2771), DEREF(con2->head_2771)->next_2763); } if (EQ(con2->tail_2773, *x_3145)) { ASSIGN(&(con2->tail_2773), DEREF(con2->tail_2773)->next_2763); } if (NOTNULL(DEREF(*x_3145)->next_2763)) { ASSIGN(&(DEREF(DEREF(*x_3145)->next_2763)->prev_2765), DEREF(*x_3145)->prev_2765); } if (NOTNULL(DEREF(*x_3145)->prev_2765)) { ASSIGN(&(DEREF(DEREF(*x_3145)->prev_2765)->next_2763), DEREF(*x_3145)->next_2763); } free_3957(x_3145); ZERO(&(con2->point_node_2775)); ASSIGN(&(con2->list_length_2777), MINUS(con2->list_length_2777, (INT) 1)); funcend3144:; } free_3957(con2) /* proc pointer.free */ struct node_2760 * *con2; { ptr_free(con2 /* non-atomic */); funcend3957:; } auto_done_3248(con2) /* proc list.auto_done */ struct list_2738 *con2; { struct node_2760 * q_3250; struct node_2760 * p_3252; ZERO(&p_3252); ASSIGN(&p_3252, con2->head_2771); ZERO(&q_3250); while4074:; if (NOTNULL(p_3252)) { ASSIGN(&q_3250, p_3252); ASSIGN(&p_3252, DEREF(p_3252)->next_2763); free_3957(&q_3250); goto while4074; } ZERO(&(con2->head_2771)); ZERO(&(con2->tail_2773)); ZERO(&(con2->point_node_2775)); ASSIGN(&(con2->list_length_2777), (INT) 0); funcend3248:; } test_2528(con2) /* proc atest.test */ struct atest_2526 *con2; { string retspace4278; string retspace4274; string retspace4270; INT retspace4266; string retspace4262; string retspace4258; string retspace4254; INT retspace4250; string retspace4246; string retspace4242; string retspace4238; INT retspace4234; struct slist_3453 l_2530; INT len_2533; struct context2245 *frame2536; INT *loopvar2536; struct context2245 *frame2625; INT *loopvar2625; struct context2277 *frame2670; INT *loopvar2670; string_init(&retspace4278); string_init(&retspace4274); string_init(&retspace4270); ZERO(&retspace4266); string_init(&retspace4262); string_init(&retspace4258); string_init(&retspace4254); ZERO(&retspace4250); string_init(&retspace4246); string_init(&retspace4242); string_init(&retspace4238); ZERO(&retspace4234); ZERO(&len_2533); auto_init_3888(&l_2530); /* for setup: i := upto(retspace, (INT) 1, (INT) 250) */ frame2536 = gencontext2245(&retspace4234, (INT) 1, (INT) 250); forloop2535:; loopvar2536 = upto_2245(frame2536); if (loopvar2536 == NULL) goto fordone2535; append_3586(&l_2530, *loopvar2536); goto forloop2535; fordone2535:; if (frame2536->state != -1) { frame2536->state = -2; upto_2245(frame2536); } free(frame2536); ASSIGN(&len_2533, length_3483(&l_2530)); ref_putline(string_plus_c(string_plus(&const2563, &retspace4238, int_to_string(len_2533, &retspace4242)), &retspace4246, '\n')); if (!EQ(len_2533, (INT) 250)) bxasfail("list.b", 13L); if (!EQ(*L3755(&l_2530, (INT) 1), *first_3711(&l_2530))) bxasfail("list.b", 15L); if (!EQ(*L3755(&l_2530, (INT) 10), (INT) 10)) bxasfail("list.b", 16L); if (!EQ(*L3755(&l_2530, (INT) 100), (INT) 100)) bxasfail("list.b", 17L); if (!EQ(*L3755(&l_2530, (INT) 250), *last_3724(&l_2530))) bxasfail("list.b", 18L); /* for setup: i := upto(retspace, (INT) 251, (INT) 500) */ frame2625 = gencontext2245(&retspace4250, (INT) 251, (INT) 500); forloop2624:; loopvar2625 = upto_2245(frame2625); if (loopvar2625 == NULL) goto fordone2624; prepend_3667(&l_2530, *loopvar2625); goto forloop2624; fordone2624:; if (frame2625->state != -1) { frame2625->state = -2; upto_2245(frame2625); } free(frame2625); ASSIGN(&len_2533, length_3483(&l_2530)); ref_putline(string_plus_c(string_plus(&const2652, &retspace4254, int_to_string(len_2533, &retspace4258)), &retspace4262, '\n')); if (!EQ(len_2533, (INT) 500)) bxasfail("list.b", 26L); /* for setup: i := downto(retspace, (INT) 500, (INT) 1) */ frame2670 = gencontext2277(&retspace4266, (INT) 500, (INT) 1); forloop2669:; loopvar2670 = downto_2277(frame2670); if (loopvar2670 == NULL) goto fordone2669; if (!search_3560(&l_2530, *loopvar2670)) bxasfail("list.b", 29L); goto forloop2669; fordone2669:; if (frame2670->state != -1) { frame2670->state = -2; downto_2277(frame2670); } free(frame2670); if (!search_3560(&l_2530, (INT) 1)) bxasfail("list.b", 32L); delete_point_3877(&l_2530); if (!NOT(search_3560(&l_2530, (INT) 1))) bxasfail("list.b", 34L); ASSIGN(&len_2533, length_3483(&l_2530)); ref_putline(string_plus_c(string_plus(&const2716, &retspace4270, int_to_string(len_2533, &retspace4274)), &retspace4278, '\n')); if (!EQ(len_2533, (INT) 499)) bxasfail("list.b", 37L); string_done(&retspace4238); string_done(&retspace4242); string_done(&retspace4246); string_done(&retspace4254); string_done(&retspace4258); string_done(&retspace4262); string_done(&retspace4270); string_done(&retspace4274); string_done(&retspace4278); funcend2528:; } auto_init_3888(con2) /* proc slist.auto_init */ struct slist_3453 *con2; { ZERO(&(con2->point_node_3481)); ZERO(&(con2->head_3479)); funcend3888:; } append_3586(con2, elem_3587) /* proc slist.append */ struct slist_3453 *con2; INT elem_3587; { struct node_3470 * p_3590; ZERO(&p_3590); if (ISNULL(con2->head_3479)) { new_4018(&(con2->head_3479)); if (!NOTNULL(con2->head_3479)) bxasfail("/usr/lib/bx/libbx/slist.b", 66L); if (!NOT(ISNULL(con2->head_3479))) bxasfail("/usr/lib/bx/libbx/slist.b", 67L); ASSIGN(&(DEREF(con2->head_3479)->data_3471), elem_3587); ASSIGN(&(con2->point_node_3481), con2->head_3479); goto funcend3586; } ASSIGN(&p_3590, con2->head_3479); while4082:; if (NOTNULL(DEREF(p_3590)->next_3473)) { ASSIGN(&p_3590, DEREF(p_3590)->next_3473); goto while4082; } new_4018(&(DEREF(p_3590)->next_3473)); ASSIGN(&p_3590, DEREF(p_3590)->next_3473); ASSIGN(&(DEREF(p_3590)->data_3471), elem_3587); ASSIGN(&(con2->point_node_3481), p_3590); funcend3586:; } new_4018(con2) /* proc pointer.new */ struct node_3470 * *con2; { ptr_alloc(con2 /* non-atomic */, (INT) sizeof(struct node_3470)); auto_init_3475(DEREF(*con2 /* atomic */), con2 /* non-atomic */); if (!NOTNULL(*con2 /* atomic */)) bxasfail("/usr/lib/bx/libbx/pointer.b", 22L); if (!NOT(ISNULL(*con2 /* atomic */))) bxasfail("/usr/lib/bx/libbx/pointer.b", 23L); funcend4018:; } auto_init_3475(con3, con2) /* proc slist.node.auto_init */ struct node_3470 *con3; struct slist_3453 *con2; { ZERO(&(con3->next_3473)); ZERO(&(con3->data_3471)); funcend3475:; } INT length_3483(con2) /* func int slist.length */ struct slist_3453 *con2; { INT ret; INT n_3485; struct node_3470 * p_3490; ZERO(&p_3490); ASSIGN(&p_3490, con2->head_3479); ZERO(&n_3485); ASSIGN(&n_3485, (INT) 0); while4078:; if (NOTNULL(p_3490)) { ASSIGN(&n_3485, PLUS(n_3485, (INT) 1)); ASSIGN(&p_3490, DEREF(p_3490)->next_3473); goto while4078; } ret = n_3485; goto funcend3483; funcend3483:; return ret; } INT * L3755(con2, n_3756) /* func ref int slist.[] */ struct slist_3453 *con2; INT n_3756; { INT *ret; struct node_3470 * p_3759; ZERO(&p_3759); ASSIGN(&p_3759, con2->head_3479); while4086:; if (GT(n_3756, (INT) 1)) { if (!NOTNULL(p_3759)) bxasfail("/usr/lib/bx/libbx/slist.b", 121L); ASSIGN(&p_3759, DEREF(p_3759)->next_3473); ASSIGN(&n_3756, MINUS(n_3756, (INT) 1)); goto while4086; } if (!NOTNULL(p_3759)) bxasfail("/usr/lib/bx/libbx/slist.b", 127L); ASSIGN(&(con2->point_node_3481), p_3759); ret = &(DEREF(p_3759)->data_3471); goto funcend3755; funcend3755:; return ret; } INT * first_3711(con2) /* func ref int slist.first */ struct slist_3453 *con2; { INT *ret; ASSIGN(&(con2->point_node_3481), con2->head_3479); ret = &(DEREF(con2->head_3479)->data_3471); goto funcend3711; funcend3711:; return ret; } INT * last_3724(con2) /* func ref int slist.last */ struct slist_3453 *con2; { INT *ret; struct node_3470 * p_3726; ZERO(&p_3726); ASSIGN(&p_3726, con2->head_3479); while4084:; if (NOTNULL(DEREF(p_3726)->next_3473)) { ASSIGN(&p_3726, DEREF(p_3726)->next_3473); goto while4084; } ASSIGN(&(con2->point_node_3481), p_3726); ret = &(DEREF(p_3726)->data_3471); goto funcend3724; funcend3724:; return ret; } prepend_3667(con2, elem_3668) /* proc slist.prepend */ struct slist_3453 *con2; INT elem_3668; { struct node_3470 * p_3671; ZERO(&p_3671); if (ISNULL(con2->head_3479)) { new_4018(&(con2->head_3479)); } else { ASSIGN(&p_3671, con2->head_3479); new_4018(&(con2->head_3479)); ASSIGN(&(DEREF(con2->head_3479)->next_3473), p_3671); } ASSIGN(&(DEREF(con2->head_3479)->data_3471), elem_3668); ASSIGN(&(con2->point_node_3481), con2->head_3479); funcend3667:; } bool search_3560(con2, v_3561) /* func bool slist.search */ struct slist_3453 *con2; INT v_3561; { bool ret; struct context3527 *frame3565; INT *loopvar3565; /* for setup: i := all */ frame3565 = gencontext3527(con2 /* non-atomic */); forloop3564:; loopvar3565 = all_3527(frame3565); if (loopvar3565 == NULL) goto fordone3564; if (EQ(*loopvar3565, v_3561)) { ret = TRUE; goto funcend3560; } goto forloop3564; fordone3564:; if (frame3565->state != -1) { frame3565->state = -2; all_3527(frame3565); } free(frame3565); ret = FALSE; goto funcend3560; funcend3560:; return ret; } struct context3527 * gencontext3527(con2) /* gen ref int slist.all */ struct slist_3453 *con2; { struct context3527 *self = (struct context3527 *) bx_malloc(sizeof(struct context3527)); self->con2 = con2; self->state = 0; return self; } INT * all_3527(self) /* gen ref int slist.all */ struct context3527 *self; { switch(self->state) { case 0: break; case -1: return NULL; case -2: goto funcend3527; case 3550: goto yield3550; } ZERO(&(self->p_3529)); ASSIGN(&(self->p_3529), self->con2->head_3479); while4080:; if (NOTNULL(self->p_3529)) { ASSIGN(&(self->con2->point_node_3481), self->p_3529); ASSIGN(&(self->p_3529), DEREF(self->p_3529)->next_3473); self->state = 3550; return &(DEREF(self->con2->point_node_3481)->data_3471); yield3550:; goto while4080; } ZERO(&(self->con2->point_node_3481)); funcend3527:; self->state = -1; return NULL; } delete_point_3877(con2) /* proc slist.delete_point */ struct slist_3453 *con2; { if (!NOTNULL(con2->point_node_3481)) bxasfail("/usr/lib/bx/libbx/slist.b", 158L); delete_node_3806(con2 /* non-atomic */, &(con2->point_node_3481)); funcend3877:; } delete_node_3806(con2, x_3807) /* proc slist.delete_node */ struct slist_3453 *con2; struct node_3470 * *x_3807; { struct node_3470 * p_3810; ZERO(&p_3810); if (EQ(con2->head_3479, *x_3807)) { ASSIGN(&(con2->head_3479), DEREF(*x_3807)->next_3473); } else { ASSIGN(&p_3810, con2->head_3479); while4088:; if (NE(DEREF(p_3810)->next_3473, *x_3807)) { ASSIGN(&p_3810, DEREF(p_3810)->next_3473); goto while4088; } ASSIGN(&(DEREF(p_3810)->next_3473), DEREF(*x_3807)->next_3473); } free_4038(x_3807); ZERO(&(con2->point_node_3481)); funcend3806:; } free_4038(con2) /* proc pointer.free */ struct node_3470 * *con2; { ptr_free(con2 /* non-atomic */); funcend4038:; }