quebex

A software analysis framework built around the QBE intermediate language

git clone https://git.8pit.net/quebex.git

 1// SPDX-FileCopyrightText: 2024 University of Bremen
 2// SPDX-FileCopyrightText: 2026 Sören Tempel <soeren+git@soeren-tempel.net>
 3//
 4// SPDX-License-Identifier: MIT AND GPL-3.0-only
 5
 6#include <stddef.h>
 7
 8#define MAX 50
 9
10extern void quebex_make_symbolic(void *, size_t, size_t, const char *);
11
12_Noreturn void __assert_fail(void) {
13	__builtin_unreachable();
14}
15
16#define assert(x) \
17	((void)((x) || (__assert_fail(),0)))
18
19static int
20first_divisor(int a)
21{
22	int i;
23
24	for (i = 2; i < a; i++) {
25		if (a % i == 0) {
26			return i;
27		}
28	}
29
30	return a;
31}
32
33int main(void) {
34	int a;
35	quebex_make_symbolic(&a, 1, sizeof(a), "prime");
36
37	if (a <= MAX) {
38		if (a > 1 && first_divisor(a) == a) {
39			assert(a != 43);
40			return 1;
41		} else {
42			return 0;
43		}
44	}
45
46	return 0;
47}