Rizin
unix-like reverse engineering framework and cli tools
bcj_test.c
Go to the documentation of this file.
1 //
13 //
14 // Author: Lasse Collin
15 //
16 // This file has been put into the public domain.
17 // You can do whatever you want with this file.
18 //
20 
21 extern int jump(int a, int b);
22 
23 
24 extern int
25 call(int a, int b)
26 {
27  if (a < b)
28  a = jump(a, b);
29 
30  return a;
31 }
32 
33 
34 extern int
35 jump(int a, int b)
36 {
37  // The loop generates conditional jump backwards.
38  while (1) {
39  if (a < b) {
40  a *= 2;
41  a += 3 * b;
42  break;
43  } else {
44  // Put enough code here to prevent JMP SHORT on x86.
45  a += b;
46  a /= 2;
47  b += b % 5;
48  a -= b / 3;
49  b = 2 * b + a - 1;
50  a *= b + a + 1;
51  b += a - 1;
52  a += b * 2 - a / 5;
53  }
54  }
55 
56  return a;
57 }
58 
59 
60 int
61 main(int argc, char **argv)
62 {
63  int a = call(argc, argc + 1);
64  return a == 0;
65 }
int jump(int a, int b)
Definition: bcj_test.c:35
int main(int argc, char **argv)
Definition: bcj_test.c:61
int call(int a, int b)
Definition: bcj_test.c:25
static static fork const void static count static fd const char const char static newpath char char argv
Definition: sflib.h:40
#define b(i)
Definition: sha256.c:42
#define a(i)
Definition: sha256.c:41