qute

A software analysis framework built around the QBE intermediate language

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

 1// SPDX-FileCopyrightText: 2026 Sören Tempel <soeren+git@soeren-tempel.net>
 2//
 3// SPDX-License-Identifier: GPL-3.0-only
 4
 5#include <stdarg.h>
 6#include <stdio.h>
 7
 8int
 9vsum(int count, ...)
10{
11	va_list args;
12	va_start(args, count);
13
14	va_list copy;
15	va_copy(copy, args);
16
17	int sum = 0;
18	for (int i = 0; i < count; i++) {
19		sum += va_arg(copy, int);
20	}
21
22	va_end(copy);
23	va_end(args);
24
25	return sum;
26}
27
28int
29main(void)
30{
31	return vsum(4, 10, 20, 30, 40);
32}