Ejemplo n.º 1
0
int main()
{
    struct list *data = NULL;

int c = 0;

    while (__VERIFIER_nondet_int() && c < 4) {

	c++;

        struct node *node = malloc(sizeof *node);
        if (!node)
            abort();

        node->next = node;

	   if(c == 1 || c == 2) {
	     value = value - c + 7*value;
	   } else if(__VERIFIER_nondet_int)  {
	     value = value + c - 7*value;
	   } else {
	     value = value/2;
	   }


        struct list *item = malloc(sizeof *item);
        if (!item)
            abort();

        item->slist = node;
        item->next = data;
        data = item;
    }

    if (!data)
        return EXIT_SUCCESS;

    inspect_before(data);

    // do O(log N) iterations
    while (data->next)
        data = seq_sort_core(data);

    inspect_after(data);

    struct node *node = data->slist;
    free(data);

    while (node) {
        struct node *snext = node->next;
        free(node);
        node = snext;
    }

    return EXIT_SUCCESS;
}
Ejemplo n.º 2
0
int main()
{
    struct list *data = NULL;
    while (__VERIFIER_nondet_int()) {
        struct node *node = malloc(sizeof *node);
        if (!node)
            abort();

        node->next = NULL;
        node->value = __VERIFIER_nondet_int();

        struct list *item = malloc(sizeof *item);
        if (!item)
            abort();

        item->slist = node;
        item->next = data;
        data = item;
    }

    if (!data)
        return EXIT_SUCCESS;

    inspect_before(data);

    // do O(log N) iterations
    while (data->next)
        data = seq_sort_core(data);

    inspect_after(data);

    struct node *node = data->slist;
    free(data);

    while (node) {
        struct node *snext = node->next;
        free(node);
        node = snext;
    }

    return EXIT_SUCCESS;
}
Ejemplo n.º 3
0
Archivo: main.c Proyecto: olivo/BP
int main(void)
{   struct list *data ;
    struct node *node ;
    void *tmp ;
    struct list *item ;
    void *tmp___0 ;
    int tmp___1 ;
    struct node *node___0 ;
    struct node *snext ;
    void *__cil_tmp9 ;
    unsigned int __cil_tmp10 ;
    unsigned int __cil_tmp11 ;
    unsigned int __cil_tmp12 ;
    unsigned int __cil_tmp13 ;
    unsigned int __cil_tmp14 ;
    unsigned int __cil_tmp15 ;
    unsigned int __cil_tmp16 ;
    unsigned int __cil_tmp17 ;
    void *__cil_tmp18 ;
    void *__cil_tmp19 ;

    {
#line 111
        __cil_tmp9 = (void *)0;
#line 111
        data = (struct list *)__cil_tmp9;
        {
#line 112
            while (1) {
while_17_continue: /* CIL Label */
                ;
                {
#line 112
                    tmp___1 = __VERIFIER_nondet_int();
                }
#line 112
                if (tmp___1) {

                } else {
                    goto while_17_break;
                }
                {
#line 113
                    __cil_tmp10 = (unsigned int )8UL;
#line 113
                    tmp = malloc(__cil_tmp10);
#line 113
                    node = (struct node *)tmp;
                }
#line 114
                if (! node) {
                    {
#line 115
                        abort();
                    }
                } else {

                }
                {
#line 117
                    *((struct node **)node) = node;
#line 118
                    __cil_tmp11 = (unsigned int )node;
#line 118
                    __cil_tmp12 = __cil_tmp11 + 4;
#line 118
                    *((int *)__cil_tmp12) = __VERIFIER_nondet_int();
#line 120
                    __cil_tmp13 = (unsigned int )8UL;
#line 120
                    tmp___0 = malloc(__cil_tmp13);
#line 120
                    item = (struct list *)tmp___0;
                }
#line 121
                if (! item) {
                    {
#line 122
                        abort();
                    }
                } else {

                }
#line 124
                *((struct node **)item) = node;
#line 125
                __cil_tmp14 = (unsigned int )item;
#line 125
                __cil_tmp15 = __cil_tmp14 + 4;
#line 125
                *((struct list **)__cil_tmp15) = data;
#line 126
                data = item;
            }
while_17_break: /* CIL Label */
            ;
        }
#line 129
        if (! data) {
#line 130
            return (0);
        } else {

        }
        {
#line 132
            inspect_before(data);
        }
        {
#line 135
            while (1) {
while_18_continue: /* CIL Label */
                ;
                {
#line 135
                    __cil_tmp16 = (unsigned int )data;
#line 135
                    __cil_tmp17 = __cil_tmp16 + 4;
#line 135
                    if (*((struct list **)__cil_tmp17)) {

                    } else {
                        goto while_18_break;
                    }
                }
                {
#line 136
                    data = seq_sort_core(data);
                }
            }
while_18_break: /* CIL Label */
            ;
        }
        {
#line 138
            inspect_after(data);
#line 140
            node___0 = *((struct node **)data);
#line 141
            __cil_tmp18 = (void *)data;
#line 141
            free(__cil_tmp18);
        }
        {
#line 143
            while (1) {
while_19_continue: /* CIL Label */
                ;
#line 143
                if (node___0) {

                } else {
                    goto while_19_break;
                }
                {
#line 144
                    snext = *((struct node **)node___0);
#line 145
                    __cil_tmp19 = (void *)node___0;
#line 145
                    free(__cil_tmp19);
#line 146
                    node___0 = snext;
                }
            }
while_19_break: /* CIL Label */
            ;
        }
#line 149
        return (0);
    }
}
int main()
{
		init_MEM();
		TRACK_VALUE[0] = 0;
		if (!__VERIFIER_nondet_int())
		{
				goto __exit_loop_5;
		}

		{
				TRACK_VALUE[1] = my_malloc(1 * 2);
				WRITE_NORMAL(TRACK_VALUE[1], TRACK_VALUE[1]);
				WRITE_NORMAL(TRACK_VALUE[1] + 1, __VERIFIER_nondet_int());
				TRACK_VALUE[2] = my_malloc(1 * 2);
				WRITE_NORMAL(TRACK_VALUE[2], TRACK_VALUE[1]);
				WRITE_NORMAL(TRACK_VALUE[2] + 1, TRACK_VALUE[0]);
				TRACK_VALUE[0] = TRACK_VALUE[2];
		}
		if (!__VERIFIER_nondet_int())
		{
				goto __exit_loop_5;
		}

		{
				TRACK_VALUE[1] = my_malloc(1 * 2);
				WRITE_NORMAL(TRACK_VALUE[1], TRACK_VALUE[1]);
				WRITE_NORMAL(TRACK_VALUE[1] + 1, __VERIFIER_nondet_int());
				TRACK_VALUE[2] = my_malloc(1 * 2);
				WRITE_NORMAL(TRACK_VALUE[2], TRACK_VALUE[1]);
				WRITE_NORMAL(TRACK_VALUE[2] + 1, TRACK_VALUE[0]);
				TRACK_VALUE[0] = TRACK_VALUE[2];
		}
		if (!__VERIFIER_nondet_int())
		{
				goto __exit_loop_5;
		}

		{
				TRACK_VALUE[1] = my_malloc(1 * 2);
				WRITE_NORMAL(TRACK_VALUE[1], TRACK_VALUE[1]);
				WRITE_NORMAL(TRACK_VALUE[1] + 1, __VERIFIER_nondet_int());
				TRACK_VALUE[2] = my_malloc(1 * 2);
				WRITE_NORMAL(TRACK_VALUE[2], TRACK_VALUE[1]);
				WRITE_NORMAL(TRACK_VALUE[2] + 1, TRACK_VALUE[0]);
				TRACK_VALUE[0] = TRACK_VALUE[2];
		}
		if (!__VERIFIER_nondet_int())
		{
				goto __exit_loop_5;
		}

		{
				TRACK_VALUE[1] = my_malloc(1 * 2);
				WRITE_NORMAL(TRACK_VALUE[1], TRACK_VALUE[1]);
				WRITE_NORMAL(TRACK_VALUE[1] + 1, __VERIFIER_nondet_int());
				TRACK_VALUE[2] = my_malloc(1 * 2);
				WRITE_NORMAL(TRACK_VALUE[2], TRACK_VALUE[1]);
				WRITE_NORMAL(TRACK_VALUE[2] + 1, TRACK_VALUE[0]);
				TRACK_VALUE[0] = TRACK_VALUE[2];
		}
		if (!__VERIFIER_nondet_int())
		{
				goto __exit_loop_5;
		}

		{
				TRACK_VALUE[1] = my_malloc(1 * 2);
				WRITE_NORMAL(TRACK_VALUE[1], TRACK_VALUE[1]);
				WRITE_NORMAL(TRACK_VALUE[1] + 1, __VERIFIER_nondet_int());
				TRACK_VALUE[2] = my_malloc(1 * 2);
				WRITE_NORMAL(TRACK_VALUE[2], TRACK_VALUE[1]);
				WRITE_NORMAL(TRACK_VALUE[2] + 1, TRACK_VALUE[0]);
				TRACK_VALUE[0] = TRACK_VALUE[2];
		}
		if (!__VERIFIER_nondet_int())
		{
				goto __exit_loop_5;
		}

		{
				TRACK_VALUE[1] = my_malloc(1 * 2);
				WRITE_NORMAL(TRACK_VALUE[1], TRACK_VALUE[1]);
				WRITE_NORMAL(TRACK_VALUE[1] + 1, __VERIFIER_nondet_int());
				TRACK_VALUE[2] = my_malloc(1 * 2);
				WRITE_NORMAL(TRACK_VALUE[2], TRACK_VALUE[1]);
				WRITE_NORMAL(TRACK_VALUE[2] + 1, TRACK_VALUE[0]);
				TRACK_VALUE[0] = TRACK_VALUE[2];
		}
		if (!__VERIFIER_nondet_int())
		{
				goto __exit_loop_5;
		}

		{
				TRACK_VALUE[1] = my_malloc(1 * 2);
				WRITE_NORMAL(TRACK_VALUE[1], TRACK_VALUE[1]);
				WRITE_NORMAL(TRACK_VALUE[1] + 1, __VERIFIER_nondet_int());
				TRACK_VALUE[2] = my_malloc(1 * 2);
				WRITE_NORMAL(TRACK_VALUE[2], TRACK_VALUE[1]);
				WRITE_NORMAL(TRACK_VALUE[2] + 1, TRACK_VALUE[0]);
				TRACK_VALUE[0] = TRACK_VALUE[2];
		}
		assume(!__VERIFIER_nondet_int());
		__exit_loop_5:
		;

		inspect_before(TRACK_VALUE[0]);
		if (!READ_NORMAL(TRACK_VALUE[0] + 1))
		{
				goto __exit_loop_6;
		}

		{
				TRACK_VALUE[0] = seq_sort_core(TRACK_VALUE[0]);
		}
		if (!READ_NORMAL(TRACK_VALUE[0] + 1))
		{
				goto __exit_loop_6;
		}

		{
				TRACK_VALUE[0] = seq_sort_core(TRACK_VALUE[0]);
		}
		if (!READ_NORMAL(TRACK_VALUE[0] + 1))
		{
				goto __exit_loop_6;
		}

		{
				TRACK_VALUE[0] = seq_sort_core(TRACK_VALUE[0]);
		}
		if (!READ_NORMAL(TRACK_VALUE[0] + 1))
		{
				goto __exit_loop_6;
		}

		{
				TRACK_VALUE[0] = seq_sort_core(TRACK_VALUE[0]);
		}
		if (!READ_NORMAL(TRACK_VALUE[0] + 1))
		{
				goto __exit_loop_6;
		}

		{
				TRACK_VALUE[0] = seq_sort_core(TRACK_VALUE[0]);
		}
		if (!READ_NORMAL(TRACK_VALUE[0] + 1))
		{
				goto __exit_loop_6;
		}

		{
				TRACK_VALUE[0] = seq_sort_core(TRACK_VALUE[0]);
		}
		if (!READ_NORMAL(TRACK_VALUE[0] + 1))
		{
				goto __exit_loop_6;
		}

		{
				TRACK_VALUE[0] = seq_sort_core(TRACK_VALUE[0]);
		}
		assume(!READ_NORMAL(TRACK_VALUE[0] + 1));
		__exit_loop_6:
		;

		inspect_after(TRACK_VALUE[0]);
		TRACK_VALUE[3] = READ_NORMAL(TRACK_VALUE[0]);
		my_free(TRACK_VALUE[0]);
		if (!TRACK_VALUE[3])
		{
				goto __exit_loop_7;
		}

		{
				TRACK_VALUE[4] = READ_NORMAL(TRACK_VALUE[3]);
				my_free(TRACK_VALUE[4]);
				TRACK_VALUE[3] = TRACK_VALUE[4];
		}
		if (!TRACK_VALUE[3])
		{
				goto __exit_loop_7;
		}

		{
				TRACK_VALUE[4] = READ_NORMAL(TRACK_VALUE[3]);
				my_free(TRACK_VALUE[4]);
				TRACK_VALUE[3] = TRACK_VALUE[4];
		}
		if (!TRACK_VALUE[3])
		{
				goto __exit_loop_7;
		}

		{
				TRACK_VALUE[4] = READ_NORMAL(TRACK_VALUE[3]);
				my_free(TRACK_VALUE[4]);
				TRACK_VALUE[3] = TRACK_VALUE[4];
		}
		if (!TRACK_VALUE[3])
		{
				goto __exit_loop_7;
		}

		{
				TRACK_VALUE[4] = READ_NORMAL(TRACK_VALUE[3]);
				my_free(TRACK_VALUE[4]);
				TRACK_VALUE[3] = TRACK_VALUE[4];
		}
		if (!TRACK_VALUE[3])
		{
				goto __exit_loop_7;
		}

		{
				TRACK_VALUE[4] = READ_NORMAL(TRACK_VALUE[3]);
				my_free(TRACK_VALUE[4]);
				TRACK_VALUE[3] = TRACK_VALUE[4];
		}
		if (!TRACK_VALUE[3])
		{
				goto __exit_loop_7;
		}

		{
				TRACK_VALUE[4] = READ_NORMAL(TRACK_VALUE[3]);
				my_free(TRACK_VALUE[4]);
				TRACK_VALUE[3] = TRACK_VALUE[4];
		}
		if (!TRACK_VALUE[3])
		{
				goto __exit_loop_7;
		}

		{
				TRACK_VALUE[4] = READ_NORMAL(TRACK_VALUE[3]);
				my_free(TRACK_VALUE[4]);
				TRACK_VALUE[3] = TRACK_VALUE[4];
		}
		assume(!TRACK_VALUE[3]);
		__exit_loop_7:
		;

		return 0;
}