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
 6static unsigned
 7first_divisor(unsigned a)
 8{
 9	unsigned i;
10
11	for (i = 2; i < a; i++) {
12		if (a % i == 0) {
13			return i;
14		}
15	}
16
17	return a;
18}
19
20unsigned
21entry(unsigned a)
22{
23	if (a <= 200) {
24		if (a > 1 && first_divisor(a) == a) {
25			return 1;
26		} else {
27			return 0;
28		}
29	}
30
31	return 0;
32}