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: 2025 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 200
 9
10extern void quebex_symbolic_array(void *, size_t, size_t, const char *);
11
12static unsigned
13first_divisor(unsigned a)
14{
15	unsigned i;
16
17	for (i = 2; i < a; i++) {
18		if (a % i == 0) {
19			return i;
20		}
21	}
22
23	return a;
24}
25
26int
27main(void)
28{
29	unsigned a;
30	quebex_symbolic_array(&a, 1, sizeof(a), "a");
31
32	if (a <= MAX) {
33		if (a > 1 && first_divisor(a) == a) {
34			return 1;
35		} else {
36			return 0;
37		}
38	}
39
40	return 0;
41}