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
#include "cielib.h"
#include <algorithm>
#include <set>

int ppos[500];

int main()
{
  int callx = std::min((podajR()+podajD())%std::max(1,podajK()/30),2);
  int call = std::max(podajK()-callx,2);
  for (int i = 0; i < call; i++)
    czyCieplo(ppos);
  unsigned char* vv = (unsigned char*)(void*) &znalazlem;
  std::set<size_t> ss;

  for (int oo = 0; oo < 300; oo++) {
    if (vv[0] == 0x3B && (vv[1] == 0x4 || vv[1] == 0xc || vv[1] == 0x1c || vv[1] == 0x14 || vv[1] == 0x2c || vv[1] == 0x34 || vv[1] == 0x3c) && (vv[2] == 0x85 || vv[2] == 0x8d || vv[2] == 0x95 || vv[2] == 0x9d || vv[2] == 0xad || vv[2] == 0xbd || vv[2] == 0xb5)) {

//printf("instr1: %x %x %x %x %x %x %x\n", vv[0], vv[1], vv[2], vv[3], vv[4], vv[5], vv[6]);

      size_t o = *((unsigned int*)&vv[3]);
      unsigned char*oo=(unsigned char*)&o;
      int* thetrueoff = (int*)(void*) o;
      for(int i=0;i<500;i++)
        ppos[i] = thetrueoff[i];
      znalazlem(ppos);
      return 0;
    }
    vv++;
  }
  vv = (unsigned char*)(void*) &znalazlem;

  for (int oo = 0; oo < 300; oo++) {
    if (vv[0] == 0x8D) {
//printf("instr: %x %x %x %x %x %x %x\n", vv[0], vv[1], vv[2], vv[3], vv[4], vv[5], vv[6]);
      unsigned int theoff = *((unsigned int*)&vv[2]);
      int* thetrueoff = (int*)(void*)((size_t)(void*)vv + 6 + theoff);
      if (ss.count((size_t)thetrueoff) > 0) {
        for(int i=0;i<500;i++)
          ppos[i] = thetrueoff[i];
        znalazlem(ppos);
        return 0;
      }
      ss.insert((size_t)thetrueoff);
      //break;
    } else if (vv[0] == 0x8B && (vv[1] == 0x4 || vv[1] == 0xc || vv[1] == 0x1c || vv[1] == 0x14 || vv[1] == 0x2c || vv[1] == 0x34 || vv[1] == 0x3c) && (vv[2] == 0x85 || vv[2] == 0x8d || vv[2] == 0x95 || vv[2] == 0x9d || vv[2] == 0xad || vv[2] == 0xbd || vv[2] == 0xb5)) {
//printf("instr: %x %x %x %x %x %x %x\n", vv[0], vv[1], vv[2], vv[3], vv[4], vv[5], vv[6]);
      //char cccc[4];
      //cccc[0] = vv[3+3]; cccc[1] = vv[3+2]; cccc[2] = vv[3+1]; cccc[3] = vv[3];
      size_t o = *((unsigned int*)&vv[3]);
      unsigned char*oo=(unsigned char*)&o;
      int* thetrueoff = (int*)(void*) o;
//printf("%x %x\n", thetrueoff, thetrueoff[0]);
      //if (ss.count((size_t)thetrueoff) > 0) {
        for(int i=0;i<500;i++)
          ppos[i] = thetrueoff[i];
        znalazlem(ppos);
        return 0;
      //}
      //ss.insert((size_t)thetrueoff);
    }
    vv++;
  }

  return -1;
}