|
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
|
#include <stdio.h>
#include <stdint.h>
#include <string.h>
uint16_t r7;
uint16_t func1(uint16_t r0,uint16_t r1)
{
if(!r0)
{
return r1+1;
}
if(!r1)
{
return func1(r0-1,r7);
}
return func1(r0-1,func1(r0,r1-1));
}
uint16_t func2(uint16_t r0, uint16_t r1)
{
if(!r0)
{
return r1+1;
}
if(!r1)
{
return func2(r0-1,r7);
}
switch(r0)
{
case 1:
return r1+r7+1;
case 2:
return r1*(r7+1)+2*r7+1;
case 3:
return func2(r0-1,func2(r0,r1-1));
}
}
int main()
{
uint16_t r0;
uint16_t r1;
int i;
for(i = 1; i < 32768; i++)
{
r0 = 3;
r7 = i;
r1 = func2(r0,r7) % 32768;
if(func2(3,r1) == 6)
{
printf("===FOUND VALUE===\nr0: %d\nr1: %d\nr7: %d\n\n",r0,r1,r7);
break;
}
}
return 0;
}
|