blob: 8a4aa73ba1b2170efa9cfdf20c3d4fe596f514fc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include <stdlib.h>
unsigned int crc32a(uint8_t *message, unsigned int size);
unsigned int fib(unsigned int n)
{
if (n == 0) {
return 0;
}
unsigned int a = 0;
unsigned int b = 1;
for (unsigned int i = 1; i < n; i++) {
unsigned int next = a + b;
a = b;
b = next;
}
return b;
}
void rot13(char *buf)
{
while (*buf) {
if ((*buf >= 'a' && *buf <= 'm') ||
(*buf >= 'A' && *buf <= 'M')) {
*buf += 13;
} else if ((*buf >= 'n' && *buf <= 'z') ||
(*buf >= 'N' && *buf <= 'Z')) {
*buf -= 13;
}
buf++;
}
}
size_t strlen(const char *buf)
{
int len = 0;
while (buf[len])
len++;
return len;
}
extern void *__malloc_freelist;
int main()
{
__malloc_freelist = 0;
volatile int i = 0;
int j = 0;
char fox[] = "The quick brown fox jumps of the lazy dog.";
unsigned int checksum = 0;
start:
while (i)
j++;
rot13(fox);
checksum ^= crc32a(fox, strlen(fox));
rot13(fox);
checksum ^= crc32a(fox, strlen(fox));
return checksum;
}
|