This is a simple example of Proteus processing. Note that the ll file is provided so you may skip the production of this.
Produce the ll file
Below is a simple c program that generates numbers in the fibonacci series (src)
/*
Simple Program to generate fibonacci numbers
*/
#include <stdio.h>
int main(int argc, char * argv[]) {
int n;
int i;
int current;
int next;
int sum;
printf("How many Fibonacci numbers do you want to calculate? ");
scanf("%d", &n);
if (n<=0)
printf("The number should be positive.\n");
else {
printf("\n\tI \t Fibonacci(I) \n\t=====================\n");
next = current = 1;
for (i=1; i<=n; i++) {
printf("\t%d \t %d\n", i, current);
sum = current+next;
current = next;
next = sum;
}
}
}
Using the below command line the ll file was generated
llvm-gcc fibonacci.c -S --emit-llvm -o fibonacci.ll
Compile with Proteus
Now using this ll file generate an executable jar
To generate a jar in the current directory which contains all necessary classes
java -jar Proteus.jar fibonacci.ll
Run the generated java executable
java -jar fibonacci.jar