Computer Chess Biggest Liar

General discussion about computer chess...
hyatt
Posts: 1242
Joined: Thu Jun 10, 2010 2:13 am
Real Name: Bob Hyatt (Robert M. Hyatt)
Location: University of Alabama at Birmingham
Contact:

Re: Computer Chess Biggest Liar

Post by hyatt » Tue Oct 11, 2011 5:48 pm

Unless someone finds that ip* has some fruit code, or something that was added after fruit was copied/converted to create rybka. Vas still holds copyright on anything he added. GPL still sits on top of everything else. Either can unwind Houdini if someone chooses...

Hood
Posts: 200
Joined: Thu Jun 10, 2010 2:36 pm
Real Name: Krzych C.

Re: Computer Chess Biggest Liar

Post by Hood » Tue Oct 11, 2011 6:23 pm

Uly wrote:Religious discussion has been moved here:

http://www.open-chess.org/viewtopic.php?f=38&t=1653
it was not religious discussion but historical one
Smolensk 2010. Murder or accident... Cui bono ?

There are not bugs free programms. There are programms with undiscovered bugs.
Alleluia.

Jeremy Bernstein
Site Admin
Posts: 1226
Joined: Wed Jun 09, 2010 7:49 am
Real Name: Jeremy Bernstein
Location: Berlin, Germany
Contact:

Re: Computer Chess Biggest Liar

Post by Jeremy Bernstein » Tue Oct 11, 2011 6:27 pm

Hood wrote:
Uly wrote:Religious discussion has been moved here:

http://www.open-chess.org/viewtopic.php?f=38&t=1653
it was not religious discussion but historical one
Whatever you want to call it, It was off-topic and has been relocated.

User avatar
kingliveson
Posts: 1388
Joined: Thu Jun 10, 2010 1:22 am
Real Name: Franklin Titus
Location: 28°32'1"N 81°22'33"W

Re: Computer Chess Biggest Liar

Post by kingliveson » Tue Oct 11, 2011 8:54 pm

On chessprogramming.wikispaces.com, Gerd addresses the issue regarding how Houdini initializes materials' table found only in IPPOLIT (RobboLito). Now, if it were just that, then OK. But we are talking about all the functions and call order are pretty much exact except where they are modified, combined or separated.

What is the probability as shown here of two independent chess programs having the exact main(), calling the exact same functions (with the same code), in the exact same order? Not to mention the evaluation which right now is next on the todo list, but has already been shown to be the same as RobboLito through black-box approach here.
PAWN : Knight >> Bishop >> Rook >>Queen

User avatar
kingliveson
Posts: 1388
Joined: Thu Jun 10, 2010 1:22 am
Real Name: Franklin Titus
Location: 28°32'1"N 81°22'33"W

Re: Computer Chess Biggest Liar

Post by kingliveson » Wed Oct 12, 2011 12:05 pm

[quote]Houdini like RobboLito then initializes the board arrays/pile_initialization() (stack.c) and pawn_initialization() (p_value.c).
[/quote]

To reiterate, the difference with casual observation is due to modified/shuffled routines, compiler and optimization flags.

Houdini board array initialization:

Code: Select all

int __cdecl sub_12A1F80()
{
  signed int v0; // esi@1
  signed int v1; // esi@3
  signed int v2; // edi@3
  signed int v3; // ebx@4
  signed int v4; // ecx@5
  __int64 v5; // qax@6
  signed int v6; // ecx@9
  __int64 v7; // qax@10
  signed int v8; // ecx@13
  __int64 v9; // qax@14
  signed int v10; // ecx@17
  __int64 v11; // qax@18
  signed int v12; // edi@23
  signed int v13; // esi@24
  int v14; // ecx@25
  int v15; // eax@25
  int v16; // ecx@30
  signed int v17; // eax@31
  int v18; // ecx@32
  int v19; // edx@32
  int v20; // edi@32
  int v21; // ebx@32
  int v22; // ebp@32
  int v23; // esi@32
  int v24; // edi@32
  int v25; // ebx@32
  int v26; // ebp@32
  int v27; // edi@32
  int v28; // ebx@32
  int v29; // ebx@32
  int v30; // ebp@32
  int v31; // ecx@32
  int v32; // edx@32
  int v33; // ecx@32
  int v34; // ebp@32
  int v35; // esi@32
  int v36; // ebp@32
  int v37; // esi@32
  int v38; // ebp@32
  int v39; // ebp@32
  int v40; // edi@32
  int v41; // esi@32
  int v42; // ecx@32
  int v43; // edx@32
  int v44; // ecx@32
  int v45; // edx@32
  int v46; // ecx@32
  unsigned int v47; // eax@33
  int v48; // edx@34
  int v49; // ecx@34
  int v50; // edx@34
  unsigned int v51; // eax@35
  int v52; // edx@36
  int v53; // ecx@36
  int v54; // edx@36
  signed int v55; // edx@37
  signed int v56; // eax@38
  int v57; // ecx@38
  int v58; // ebx@39
  int v59; // ebx@41
  int v60; // ebx@43
  int v61; // ebx@45
  int v62; // esi@46
  int v63; // eax@46
  int v64; // ecx@47
  signed int v65; // eax@47
  int v66; // edx@48
  signed int v67; // ecx@49
  int v68; // ebx@49
  int v69; // ebp@49
  signed int v70; // esi@52
  signed int v71; // edx@53
  int v72; // eax@53
  signed int v73; // esi@53
  signed int v74; // ecx@54
  int v75; // ebp@55
  signed int v76; // ebx@58
  signed int v77; // edx@59
  int v78; // eax@59
  int v79; // esi@60
  int v80; // ST30_4@60
  int v81; // ecx@60
  int v82; // ST34_4@60
  int v83; // ST48_4@60
  int v84; // edi@60
  int v85; // ST4C_4@60
  int v86; // ebx@60
  int v87; // ST3C_4@60
  int v88; // ebp@60
  int v89; // esi@60
  int v90; // ST38_4@60
  int v91; // edi@60
  int v92; // ST10_4@60
  int v93; // ebx@60
  int v94; // ebp@60
  int v95; // ecx@60
  int v96; // esi@60
  int v97; // ecx@60
  int v98; // edi@60
  int v99; // ebx@60
  int v100; // ST28_4@60
  int v101; // ST2C_4@60
  int v102; // ST20_4@60
  int v103; // ST24_4@60
  int v104; // ebp@60
  int v105; // edi@60
  int v106; // ebx@60
  int v107; // ST1C_4@60
  int v108; // ebp@60
  int v109; // esi@60
  int v110; // edi@60
  int v111; // ST18_4@60
  int v112; // ebx@60
  int v113; // edi@60
  int v114; // ST10_4@60
  int v115; // ebx@60
  int v116; // ebp@60
  int v117; // ecx@60
  int v118; // esi@60
  int v119; // ebp@60
  int v120; // ST20_4@60
  int v121; // ST24_4@60
  int v122; // ST28_4@60
  int v123; // ST2C_4@60
  int v124; // ebx@60
  int v125; // ST1C_4@60
  int v126; // ebp@60
  int v127; // esi@60
  int v128; // ST18_4@60
  int v129; // edi@60
  int v130; // ST10_4@60
  int v131; // ebx@60
  int v132; // ebp@60
  int v133; // ebx@60
  int v134; // esi@60
  int v135; // ST20_4@60
  int v136; // ecx@60
  int v137; // ebx@60
  int v138; // ST24_4@60
  int v139; // ebp@60
  int v140; // ST28_4@60
  int v141; // edi@60
  int v142; // ST2C_4@60
  int v143; // ebx@60
  int v144; // ST18_4@60
  int v145; // ST1C_4@60
  int v146; // ebp@60
  int v147; // esi@60
  int v148; // edi@60
  int v149; // ST10_4@60
  int v150; // ebx@60
  int v151; // ebp@60
  int v152; // ecx@60
  signed int v153; // ebp@61
  int v154; // eax@61
  signed int v155; // ecx@61
  signed int v156; // eax@66
  int v157; // ebx@67
  signed int v158; // ecx@67
  signed int v159; // ebp@67
  signed int v160; // edi@69
  int v161; // esi@69
  int v162; // edx@71
  signed int v163; // ecx@72
  signed int i; // esi@72
  int v165; // edx@74
  int v166; // edi@74
  int v167; // edx@74
  int v168; // esi@77
  int v169; // edx@79
  int v170; // ecx@80
  signed int v171; // edi@81
  int v172; // esi@81
  int v173; // edx@83
  signed int v174; // esi@85
  int v175; // edi@86
  int v176; // edx@86
  signed int v177; // esi@87
  int v178; // eax@88
  int v179; // edx@90
  int v180; // ecx@90
  signed int v181; // eax@92
  signed int v182; // eax@101
  signed int v183; // ecx@102
  int v184; // ebp@102
  signed int v185; // ebx@102
  int *v186; // eax@102
  int v187; // esi@104
  signed int v188; // edx@104
  int v189; // esi@109
  signed int v190; // ebx@132
  signed int v191; // edx@132
  signed int v192; // eax@132
  signed int v193; // ecx@133
  int v194; // edi@134
  int v195; // ebp@134
  char *v196; // ecx@138
  int v197; // edi@138
  int v198; // ebp@138
  signed int v199; // esi@142
  int *v200; // edi@142
  int v201; // edx@145
  int v202; // ebp@145
  int v203; // eax@147
  signed int j; // ebp@152
  signed __int64 v205; // qax@153
  int v206; // eax@156
  signed int v207; // edi@156
  signed int v208; // ebp@158
  int v209; // ebx@158
  int v210; // edx@158
  int v211; // esi@158
  int v212; // eax@159
  signed __int64 v213; // qax@162
  int v214; // esi@163
  signed __int64 v215; // qax@165
  int v216; // esi@166
  signed __int64 v217; // qax@168
  int v218; // esi@169
  int v219; // ebx@169
  signed __int64 v220; // qax@171
  int v221; // eax@172
  int v222; // ecx@172
  int v223; // eax@172
  int v224; // ecx@172
  int v225; // edx@172
  signed int v226; // eax@172
  signed int v227; // ebp@173
  signed int v228; // edx@174
  char *v229; // ebx@174
  int v230; // eax@178
  int v231; // ecx@178
  int v232; // esi@180
  int v234; // [sp+10h] [bp-48h]@66
  signed int v235; // [sp+10h] [bp-48h]@101
  int v236; // [sp+10h] [bp-48h]@143
  int v237; // [sp+18h] [bp-40h]@67
  int v238; // [sp+18h] [bp-40h]@159
  signed int v239; // [sp+18h] [bp-40h]@163
  int v240; // [sp+18h] [bp-40h]@166
  signed int v241; // [sp+20h] [bp-38h]@102
  signed int v242; // [sp+20h] [bp-38h]@142
  int v243; // [sp+20h] [bp-38h]@159
  int v244; // [sp+48h] [bp-10h]@102
  int v245; // [sp+4Ch] [bp-Ch]@102

  v0 = 0;
  do
  {
    qword_16A8A78[2 * v0] = 1i64 << v0;
    qword_16A8A78[2 * v0 + 1] = (unsigned __int64)(1i64 << v0) >> 32;
    dword_1773168[2 * v0] = ~(unsigned int)(1i64 << v0);
    dword_177316C[2 * v0] = ~((unsigned __int64)(1i64 << v0) >> 32);
    ++v0;
  }
  while ( v0 <= 63 );
  v1 = 0;
  v2 = (signed int)dword_1772178;
  do
  {
    *(_DWORD *)v2 = 0;
    *(_DWORD *)(v2 + 4) = 0;
    v3 = (signed int)&unk_12B8AE4;
    do
    {
      v4 = v1 + *(_DWORD *)(v3 - 4);
      if ( (unsigned int)v4 <= 0x3F )
      {
        v5 = (v1 & 7) - (v4 & 7);
        if ( (signed int)((HIDWORD(v5) ^ v5) - HIDWORD(v5)) <= 2 )
        {
          if ( abs((v1 >> 3) - (v4 >> 3)) <= 2 )
          {
            *(_DWORD *)v2 |= 1i64 << v4;
            *(_DWORD *)(v2 + 4) |= (unsigned __int64)(1i64 << v4) >> 32;
          }
        }
      }
      v6 = v1 + *(_DWORD *)v3;
      if ( (unsigned int)v6 <= 0x3F )
      {
        v7 = (v1 & 7) - (v6 & 7);
        if ( (signed int)((HIDWORD(v7) ^ v7) - HIDWORD(v7)) <= 2 )
        {
          if ( abs((v1 >> 3) - (v6 >> 3)) <= 2 )
          {
            *(_DWORD *)v2 |= 1i64 << v6;
            *(_DWORD *)(v2 + 4) |= (unsigned __int64)(1i64 << v6) >> 32;
          }
        }
      }
      v8 = v1 + *(_DWORD *)(v3 + 4);
      if ( (unsigned int)v8 <= 0x3F )
      {
        v9 = (v1 & 7) - (v8 & 7);
        if ( (signed int)((HIDWORD(v9) ^ v9) - HIDWORD(v9)) <= 2 )
        {
          if ( abs((v1 >> 3) - (v8 >> 3)) <= 2 )
          {
            *(_DWORD *)v2 |= 1i64 << v8;
            *(_DWORD *)(v2 + 4) |= (unsigned __int64)(1i64 << v8) >> 32;
          }
        }
      }
      v10 = v1 + *(_DWORD *)(v3 + 8);
      if ( (unsigned int)v10 <= 0x3F )
      {
        v11 = (v1 & 7) - (v10 & 7);
        if ( (signed int)((HIDWORD(v11) ^ v11) - HIDWORD(v11)) <= 2 )
        {
          if ( abs((v1 >> 3) - (v10 >> 3)) <= 2 )
          {
            *(_DWORD *)v2 |= 1i64 << v10;
            *(_DWORD *)(v2 + 4) |= (unsigned __int64)(1i64 << v10) >> 32;
          }
        }
      }
      v3 += 16;
    }
    while ( v3 < (signed int)dword_12B8B04 );
    v2 += 8;
    ++v1;
  }
  while ( v2 <= (signed int)&unk_1772370 );
  v12 = 0;
  do
  {
    v13 = 0;
    dword_17A6678[2 * v12] = 0;
    dword_17A667C[2 * v12] = 0;
    do
    {
      v14 = abs((v12 & 7) - (v13 & 7));
      v15 = abs((v12 >> 3) - (v13 >> 3));
      if ( v14 >= v15 )
        v15 = v14;
      if ( v15 == 1 )
      {
        dword_17A6678[2 * v12] |= 1i64 << v13;
        dword_17A667C[2 * v12] |= (unsigned __int64)(1i64 << v13) >> 32;
      }
      ++v13;
    }
    while ( v13 <= 63 );
    v16 = dword_17A667C[2 * v12] | qword_16A8A78[2 * v12 + 1];
    dword_177C068[2 * v12] = dword_17A6678[2 * v12] | qword_16A8A78[2 * v12];
    dword_177C06C[2 * v12++] = v16;
  }
  while ( v12 <= 63 );
  dword_17B1B90[0] = dword_16A8AC0[0] | qword_16A8AB0[0];
  dword_17B1B94[0] = dword_16A8AC4[0] | qword_16A8AB0[1];
  dword_17B1B98 = dword_16A8AC8 | dword_16A8AB8[0];
  dword_17B1B9C = dword_16A8ACC | dword_16A8ABC[0];
  dword_17B1BA4 = dword_16A8AC4[0] | dword_16A8AD4;
  dword_17B1BA0 = dword_16A8AC0[0] | dword_16A8AD0;
  dword_17B1BAC = dword_16A8ACC | dword_16A8ADC;
  dword_17B1BA8 = dword_16A8AC8 | dword_16A8AD8;
  _mm_storel_pd((double *)&qword_17B1998, 0);
  _mm_storel_pd((double *)&qword_17B19A0, 0);
  dword_17B1BB4 = dword_16A8AD4 | dword_16A8AE4;
  _mm_storel_pd((double *)&qword_17B19A8, 0);
  dword_17B1BB8 = dword_16A8AE8[0] | dword_16A8AD8;
  dword_17B1BBC = dword_16A8AEC[0] | dword_16A8ADC;
  _mm_storel_pd((double *)&qword_17B19B0, 0);
  _mm_storel_pd((double *)&qword_17B19B8, 0);
  dword_17B1BC8[0] = dword_16A8AE8[0] | dword_16A8AF8[0];
  dword_17B1BB0 = dword_16A8AD0 | dword_16A8AE0;
  _mm_storel_pd((double *)&qword_17B19C0, 0);
  dword_17B1BC0 = dword_16A8AF0[0] | dword_16A8AE0;
  dword_17B1BC4 = dword_16A8AF4[0] | dword_16A8AE4;
  dword_17B1BCC[0] = dword_16A8AEC[0] | dword_16A8AFC[0];
  v17 = 0;
  do
  {
    v18 = dword_16A8A80[v17];
    v19 = dword_16A8A84[v17];
    v20 = dword_16A8A74[v17];
    v21 = dword_16A8AF0[v17];
    v22 = dword_16A8B04[v17] | dword_16A8AF4[v17];
    dword_17B19D0[v17] = v18 | dword_16A8A70[v17];
    v23 = dword_16A8B00[v17];
    dword_17B19D4[v17] = v19 | v20;
    v24 = qword_16A8A78[v17] | dword_16A8A88[v17];
    dword_17B1BD0[v17] = v23 | v21;
    v25 = qword_16A8A78[v17 + 1] | dword_16A8A8C[v17];
    dword_17B1BD4[v17] = v22;
    v26 = dword_16A8B08[v17] | dword_16A8AF8[v17];
    dword_17B19D8[v17] = v24;
    v27 = dword_16A8B0C[v17];
    dword_17B19DC[v17] = v25;
    v28 = v27 | dword_16A8AFC[v17];
    dword_17B1BD8[v17] = v26;
    dword_17B1BDC[v17] = v28;
    v29 = dword_16A8A90[v17];
    v30 = v18 | dword_16A8A90[v17];
    v31 = v19 | dword_16A8A94[v17];
    v32 = dword_16A8B14[v17];
    dword_17B19E4[v17] = v31;
    v33 = dword_16A8B10[v17];
    dword_17B19E0[v17] = v30;
    v34 = v23 | v33;
    v35 = dword_16A8B04[v17] | v32;
    dword_17B1BE0[v17] = v34;
    v36 = dword_16A8A8C[v17] | dword_16A8A9C[v17];
    dword_17B1BE4[v17] = v35;
    v37 = dword_16A8A88[v17] | dword_16A8A98[v17];
    dword_17B19EC[v17] = v36;
    v38 = dword_16A8B1C[v17];
    dword_17B19E8[v17] = v37;
    v39 = v27 | v38;
    v40 = dword_16A8A94[v17] | dword_16A8AA4[v17];
    dword_17B1BE8[v17] = dword_16A8B08[v17] | dword_16A8B18[v17];
    dword_17B19F0[v17] = v29 | dword_16A8AA0[v17];
    v41 = v33 | dword_16A8B20[v17];
    v42 = v32 | dword_16A8B24[v17];
    v43 = dword_16A8A98[v17] | dword_16A8AA8[v17];
    dword_17B1BF4[v17] = v42;
    v44 = dword_16A8A9C[v17] | dword_16A8AAC[v17];
    dword_17B19F8[v17] = v43;
    v45 = dword_16A8B18[v17] | dword_16A8B28[v17];
    dword_17B19FC[v17] = v44;
    v46 = dword_16A8B1C[v17] | dword_16A8B2C[v17];
    dword_17B1BEC[v17] = v39;
    dword_17B19F4[v17] = v40;
    dword_17B1BF0[v17] = v41;
    dword_17B1BF8[v17] = v45;
    dword_17B1BFC[v17] = v46;
    v17 += 12;
  }
  while ( v17 <= 94 );
  dword_17B1B50 = dword_16A8BF0 | dword_16A8C00;
  dword_17B1B54 = dword_16A8BF4 | dword_16A8C04;
  qword_17B1B58 = qword_16A8BF8 | qword_16A8C08;
  dword_17B1B60 = dword_16A8C00 | dword_16A8C10;
  dword_17B1B64 = dword_16A8C04 | dword_16A8C14;
  qword_17B1B68 = qword_16A8C08 | qword_16A8C18;
  dword_17B1B70 = dword_16A8C10 | dword_16A8C20;
  dword_17B1B74 = dword_16A8C14 | dword_16A8C24;
  _mm_storel_pd((double *)&qword_17B1D58, 0);
  _mm_storel_pd((double *)&qword_17B1D60, 0);
  dword_17B1B80 = dword_16A8C20 | dword_16A8C30;
  _mm_storel_pd((double *)&qword_17B1D68, 0);
  _mm_storel_pd((double *)&qword_17B1D70, 0);
  _mm_storel_pd((double *)&qword_17B1D78, 0);
  qword_17B1B78 = qword_16A8C18 | qword_16A8C28;
  _mm_storel_pd((double *)&qword_17B1D80, 0);
  dword_17B1B84 = dword_16A8C24 | dword_16A8C34;
  qword_17B1B88 = qword_16A8C28 | qword_16A8C38;
  v47 = 0;
  do
  {
    v48 = dword_16A8A44[v47 / 4];
    LODWORD(qword_17B1990[v47 / 8]) = dword_16A8A40[v47 / 4];
    v49 = dword_16A8AC0[v47 / 4];
    HIDWORD(qword_17B1990[v47 / 8]) = v48;
    v50 = dword_16A8AC4[v47 / 4];
    dword_17B1B90[v47 / 4] = v49;
    dword_17B1B94[v47 / 4] = v50;
    v47 += 64;
  }
  while ( (signed int)v47 <= 448 );
  v51 = 0;
  do
  {
    v52 = dword_16A8A6C[v51 / 4];
    LODWORD(qword_17B19C8[v51 / 8]) = dword_16A8A68[v51 / 4];
    v53 = dword_16A8AE8[v51 / 4];
    HIDWORD(qword_17B19C8[v51 / 8]) = v52;
    v54 = dword_16A8AEC[v51 / 4];
    dword_17B1BC8[v51 / 4] = v53;
    dword_17B1BCC[v51 / 4] = v54;
    v51 += 64;
  }
  while ( (signed int)v51 <= 448 );
  dword_16A8C78[0] = 33686018;
  dword_16A8C7C[0] = 33686018;
  dword_16A8CB0 = 1077952576;
  dword_16A8CB4 = 1077952576;
  dword_16A8C80 = 84215045;
  dword_16A8C84 = 84215045;
  dword_16A8C88 = 168430090;
  dword_16A8C8C = 168430090;
  dword_16A8C90 = 336860180;
  dword_16A8C94 = 336860180;
  _mm_storel_pd((double *)qword_17B1990, 0);
  dword_16A8C98 = 673720360;
  dword_16A8C9C = 673720360;
  _mm_storel_pd((double *)&qword_17B1D50, 0);
  dword_16A8CA0 = 1347440720;
  dword_16A8CA4 = 1347440720;
  _mm_storel_pd((double *)qword_17B19C8, 0);
  _mm_storel_pd((double *)&qword_17B1D88, 0);
  dword_16A8CA8 = -1600085856;
  dword_16A8CAC = -1600085856;
  v55 = 0;
  do
  {
    v56 = v55 >> 3;
    v57 = v55 & 7;
    dword_17728D8[2 * v55] = 0;
    dword_17728DC[2 * v55] = 0;
    dword_1772AD8[2 * v55] = 0;
    dword_1772ADC[2 * v55] = 0;
    if ( v55 >> 3 < 7 )
    {
      v58 = dword_16A8C7C[2 * v57] & dword_12B8A5C[2 * v56];
      dword_17728D8[2 * v55] = dword_16A8C78[2 * v57] & dword_12B8A58[2 * v56];
      dword_17728DC[2 * v55] = v58;
    }
    if ( v56 < 6 )
    {
      v59 = dword_16A8C7C[2 * v57] & dword_12B8A64[2 * v56];
      dword_17728D8[2 * v55] |= dword_16A8C78[2 * v57] & dword_12B8A60[2 * v56];
      dword_17728DC[2 * v55] |= v59;
    }
    if ( v56 > 0 )
    {
      v60 = dword_16A8C7C[2 * v57] & dword_12B8A4C[2 * v56];
      dword_1772AD8[2 * v55] = dword_16A8C78[2 * v57] & dword_12B8A48[2 * v56];
      dword_1772ADC[2 * v55] = v60;
    }
    if ( v56 > 1 )
    {
      v61 = dword_16A8C7C[2 * v57] & dword_12B8A44[2 * v56];
      dword_1772AD8[2 * v55] |= dword_16A8C78[2 * v57] & dword_12B8A40[2 * v56];
      dword_1772ADC[2 * v55] |= v61;
    }
    v62 = dword_1772AD8[2 * v55] | dword_17728D8[2 * v55] | dword_16A8C78[2 * v57] & dword_12B8A50[2 * v56];
    v63 = dword_1772ADC[2 * v55] | dword_17728DC[2 * v55] | dword_16A8C7C[2 * v57] & dword_12B8A54[2 * v56];
    dword_17B1790[2 * v55] = v62;
    dword_17B1794[2 * v55++] = v63;
  }
  while ( v55 <= 63 );
  v64 = 0;
  v65 = 0;
  do
  {
    v66 = v64 + 1;
    dword_1773120[v65] = 0;
    dword_1773124[v65] = 0;
    if ( v64 + 1 <= 7 )
    {
      v67 = (signed int)&dword_12B8A58[v65];
      v68 = 0;
      v69 = 0;
      do
      {
        v68 |= *(_DWORD *)v67;
        v69 |= *(_DWORD *)(v67 + 4);
        v67 += 8;
      }
      while ( v67 <= (signed int)&unk_12B8A88 );
      dword_1773124[v65] = v69;
      dword_1773120[v65] = v68;
    }
    v70 = ~dword_1773124[v65];
    dword_17B1350[v65] = ~dword_1773120[v65];
    dword_17B1354[v65] = v70;
    v65 += 2;
    v64 = v66;
  }
  while ( v65 <= 14 );
  v71 = 6;
  v72 = 0;
  v73 = 8;
  do
  {
    dword_1772D10[v72] = 0;
    dword_1772D14[v72] = 0;
    v74 = v71;
    if ( v71 >= 0 )
    {
      v75 = 0;
      do
      {
        v75 |= dword_12B8A50[2 * v74];
        dword_1772D14[v72] |= dword_12B8A54[2 * v74--];
      }
      while ( v74 >= 0 );
      dword_1772D10[v72] = v75;
    }
    v76 = ~dword_1772D14[v72];
    dword_17A6CB8[v72] = ~dword_1772D10[v72];
    dword_17A6CBC[v72] = v76;
    --v71;
    v72 -= 2;
    --v73;
  }
  while ( v73 );
  v77 = 2;
  v78 = 0;
  do
  {
    v79 = ((_BYTE)v77 - 2) & 7;
    v80 = dword_16A8C78[2 * v79];
    v81 = (v77 - 2) >> 3;
    v82 = dword_16A8C7C[2 * v79];
    v83 = dword_1773120[2 * v81];
    v84 = dword_1773124[2 * v81] & v82;
    v85 = dword_1773124[2 * v81];
    v87 = dword_1772CDC[2 * v81];
    v86 = dword_1772CDC[2 * v81];
    dword_1772478[v78] = dword_1773120[2 * v81] & v80;
    dword_177267C[v78] = v82 & v86;
    v88 = dword_12B8A90[2 * v79];
    v89 = dword_12B8A94[2 * v79];
    dword_177247C[v78] = v84;
    v90 = dword_1772CD8[2 * v81];
    dword_177BC6C[v78] = v85 & (v89 | v82);
    dword_1772678[v78] = v80 & v90;
    v91 = v88 | v80;
    dword_177BE6C[v78] = v87 & (v89 | v82);
    v92 = v88;
    dword_17A6880[v78] = v80 & dword_17B1350[2 * v81];
    v93 = v80 & dword_17A6C80[2 * v81];
    dword_177BC68[v78] = v83 & (v88 | v80);
    v94 = dword_17B1354[2 * v81];
    v95 = dword_17A6C84[2 * v81];
    dword_177BE68[v78] = v90 & v91;
    dword_17A6A84[v78] = v82 & v95;
    dword_17A6A80[v78] = v93;
    dword_16A8678[v78] = v92 & v83;
    dword_16A867C[v78] = v89 & v85;
    dword_16A8878[v78] = v92 & v90;
    dword_16A887C[v78] = v89 & v87;
    v96 = ((_BYTE)v77 - 1) & 7;
    v97 = (v77 - 1) >> 3;
    v98 = dword_1773120[2 * v97];
    v99 = dword_1773124[2 * v97];
    dword_17A6884[v78] = v82 & v94;
    v100 = v98;
    v101 = v99;
    v102 = dword_16A8C78[2 * v96];
    v103 = dword_16A8C7C[2 * v96];
    v104 = v98 & v102;
    v105 = v99 & v103;
    v106 = dword_1772CDC[2 * v97];
    dword_1772480[v78] = v104;
    v107 = v106;
    dword_1772684[v78] = v103 & v106;
    v108 = dword_12B8A90[2 * v96];
    v109 = dword_12B8A94[2 * v96];
    dword_1772484[v78] = v105;
    v110 = dword_1772CD8[2 * v97];
    dword_177BC74[v78] = v101 & (v109 | v103);
    v111 = v110;
    dword_177BE74[v78] = v106 & (v109 | v103);
    v112 = v102 & dword_17B1350[2 * v97];
    dword_1772680[v78] = v102 & v110;
    v113 = v108 | v102;
    v114 = v108;
    dword_17A6888[v78] = v112;
    v115 = v102 & dword_17A6C80[2 * v97];
    dword_177BC70[v78] = v100 & (v108 | v102);
    v116 = dword_17B1354[2 * v97];
    v117 = dword_17A6C84[2 * v97];
    dword_177BE70[v78] = v111 & v113;
    dword_17A6A88[v78] = v115;
    dword_17A6A8C[v78] = v103 & v117;
    dword_16A8684[v78] = v109 & v101;
    dword_16A8680[v78] = v114 & v100;
    dword_16A8884[v78] = v109 & v107;
    dword_17A688C[v78] = v103 & v116;
    v118 = v77 & 7;
    v119 = dword_16A8C78[2 * v118];
    dword_16A8880[v78] = v114 & v111;
    v120 = v119;
    v121 = dword_16A8C7C[2 * v118];
    v122 = dword_1773120[2 * (v77 >> 3)];
    v123 = dword_1773124[2 * (v77 >> 3)];
    v125 = dword_1772CDC[2 * (v77 >> 3)];
    v124 = dword_1772CDC[2 * (v77 >> 3)];
    dword_1772488[v78] = v122 & v119;
    dword_177268C[v78] = v121 & v124;
    v126 = dword_12B8A90[2 * v118];
    v127 = dword_12B8A94[2 * v118];
    dword_177248C[v78] = v123 & v121;
    v128 = dword_1772CD8[2 * (v77 >> 3)];
    dword_177BC7C[v78] = v123 & (v127 | v121);
    dword_1772688[v78] = v120 & v128;
    v129 = v126 | v120;
    v130 = v126;
    dword_177BE7C[v78] = v125 & (v127 | v121);
    v131 = v120 & dword_17B1350[2 * (v77 >> 3)];
    dword_177BC78[v78] = v122 & (v126 | v120);
    v132 = dword_17B1354[2 * (v77 >> 3)];
    dword_177BE78[v78] = v128 & v129;
    dword_17A6890[v78] = v131;
    v133 = v120 & dword_17A6C80[2 * (v77 >> 3)];
    dword_17A6A94[v78] = v121 & dword_17A6C84[2 * (v77 >> 3)];
    dword_17A6A90[v78] = v133;
    dword_16A8688[v78] = v130 & v122;
    dword_16A868C[v78] = v127 & v123;
    dword_16A8888[v78] = v130 & v128;
    dword_16A888C[v78] = v127 & v125;
    dword_17A6894[v78] = v121 & v132;
    v134 = ((_BYTE)v77 + 1) & 7;
    v135 = dword_16A8C78[2 * v134];
    v136 = (v77 + 1) >> 3;
    v137 = dword_1773124[2 * v136];
    v138 = dword_16A8C7C[2 * v134];
    v139 = dword_1773120[2 * v136] & v135;
    v140 = dword_1773120[2 * v136];
    dword_1772494[v78] = v137 & v138;
    v141 = dword_1772CD8[2 * v136];
    v142 = v137;
    v143 = dword_1772CDC[2 * v136];
    dword_1772490[v78] = v139;
    v144 = v141;
    v145 = v143;
    dword_1772694[v78] = v138 & v143;
    v146 = dword_12B8A90[2 * v134];
    v147 = dword_12B8A94[2 * v134];
    dword_177BC84[v78] = v142 & (v147 | v138);
    dword_1772690[v78] = v135 & v141;
    v148 = v146 | v135;
    dword_177BE84[v78] = v143 & (v147 | v138);
    v149 = v146;
    dword_17A6898[v78] = v135 & dword_17B1350[2 * v136];
    v150 = v135 & dword_17A6C80[2 * v136];
    dword_177BC80[v78] = v140 & (v146 | v135);
    v151 = dword_17B1354[2 * v136];
    v152 = dword_17A6C84[2 * v136];
    dword_177BE80[v78] = v144 & v148;
    dword_17A6A9C[v78] = v138 & v152;
    dword_17A6A98[v78] = v150;
    dword_16A8690[v78] = v149 & v140;
    dword_16A8694[v78] = v147 & v142;
    v77 += 4;
    dword_16A8890[v78] = v149 & v144;
    dword_17A689C[v78] = v138 & v151;
    dword_16A8894[v78] = v147 & v145;
    v78 += 8;
  }
  while ( v77 - 2 <= 63 );
  v153 = 0;
  v154 = 0;
  v155 = (signed int)&qword_16A8A78[-4];
  do
  {
    if ( (v154 & 7) < 2 )
    {
      dword_1772D18[2 * v154] = 0;
      dword_1772D1C[2 * v154] = 0;
    }
    else
    {
      dword_1772D18[2 * v154] = *(_DWORD *)v155;
      dword_1772D1C[2 * v154] = *(_DWORD *)(v155 + 4);
    }
    v155 += 8;
    ++v154;
  }
  while ( v155 <= (signed int)&unk_16A8C60 );
  v234 = 0;
  v156 = (signed int)dword_17B33A0;
  do
  {
    v157 = v153 & 7;
    v158 = v157;
    v159 = v153 >> 3;
    v237 = v157;
    *(_DWORD *)v156 = 0;
    *(_DWORD *)(v156 + 4) = 0;
    if ( v157 > 3 )
    {
      if ( v157 > 0 )
      {
        v168 = 8 * v159;
        do
        {
          if ( v168 >= 56 )
            break;
          --v158;
          v168 += 8;
          v169 = qword_16A8A78[2 * (v168 + v158) + 1];
          *(_DWORD *)v156 |= qword_16A8A78[2 * (v168 + v158)];
          *(_DWORD *)(v156 + 4) |= v169;
        }
        while ( v158 > 0 );
      }
      v170 = v157;
      if ( v157 > 0 )
      {
        v171 = v159;
        v172 = 8 * v159;
        do
        {
          if ( v171 <= 0 )
            break;
          --v170;
          v172 -= 8;
          v173 = qword_16A8A78[2 * (v172 + v170) + 1];
          *(_DWORD *)v156 |= qword_16A8A78[2 * (v172 + v170)];
          *(_DWORD *)(v156 + 4) |= v173;
          --v171;
        }
        while ( v170 > 0 );
      }
    }
    else
    {
      if ( v157 < 7 )
      {
        v160 = v159;
        v161 = 8 * v159;
        do
        {
          if ( v160 >= 7 )
            break;
          ++v158;
          v161 += 8;
          v162 = qword_16A8A78[2 * (v161 + v158) + 1];
          *(_DWORD *)v156 |= qword_16A8A78[2 * (v161 + v158)];
          *(_DWORD *)(v156 + 4) |= v162;
          v157 = v237;
          ++v160;
        }
        while ( v158 < 7 );
      }
      v163 = v157;
      for ( i = v159; v163 < 7; *(_DWORD *)(v156 + 4) |= v167 )
      {
        if ( i <= 0 )
          break;
        ++v163;
        --i;
        v165 = v163 + 8 * i;
        v166 = qword_16A8A78[2 * v165];
        v167 = qword_16A8A78[2 * v165 + 1];
        *(_DWORD *)v156 |= v166;
      }
    }
    v153 = v234 + 1;
    v156 += 8;
    ++v234;
  }
  while ( v156 <= (signed int)&unk_17B3598 );
  v174 = 0;
  do
  {
    v175 = v174 & 7;
    v176 = dword_12B8A94[2 * v175] ^ ((unsigned __int64)(1i64 << v174) >> 32);
    dword_17B1D90[2 * v174] = dword_12B8A90[2 * v175] ^ (unsigned __int64)(1i64 << v174);
    dword_17B1D94[2 * v174++] = v176;
  }
  while ( v174 <= 63 );
  v177 = 0;
  do
  {
    v178 = v177 & 7;
    dword_17B31A0[2 * v177] = 0;
    dword_17B31A4[2 * v177] = 0;
    dword_1772F18[2 * v177] = 0;
    dword_1772F1C[2 * v177] = 0;
    if ( v177 & 7 && v178 != 7 )
    {
      v179 = dword_16A8C78[2 * v178] | dword_12B8A90[2 * v178];
      v180 = dword_16A8C7C[2 * v178] | dword_12B8A94[2 * v178];
    }
    else
    {
      v179 = dword_16A8C78[2 * v178];
      v180 = dword_16A8C7C[2 * v178];
    }
    v181 = v177 >> 3;
    if ( v177 >> 3 >= 5 )
    {
      dword_1772F18[2 * v177] = 0;
      dword_1772F1C[2 * v177] = v180 & 0xFF000000;
    }
    if ( v181 >= 4 )
    {
      dword_1772F18[2 * v177] = dword_1772F18[2 * v177];
      dword_1772F1C[2 * v177] |= v180 & 0xFF0000;
    }
    if ( v181 <= 2 )
    {
      dword_17B31A0[2 * v177] = (unsigned __int8)v179;
      dword_17B31A4[2 * v177] = 0;
    }
    if ( v181 <= 3 )
    {
      dword_17B31A0[2 * v177] |= v179 & 0xFF00;
      dword_17B31A4[2 * v177] = dword_17B31A4[2 * v177];
    }
    ++v177;
  }
  while ( v177 <= 63 );
  v182 = 0;
  v235 = 0;
  do
  {
    v183 = 0;
    v184 = v182 & 7;
    v244 = qword_16A8A78[2 * v182];
    v185 = v182 >> 3;
    v241 = v182 >> 3;
    v245 = qword_16A8A78[2 * v182 + 1];
    v186 = &dword_179E270[2 * v182];
    while ( 1 )
    {
      v187 = dword_17A667C[2 * v183];
      *v186 = dword_17A6678[2 * v183];
      v188 = v183 >> 3;
      v186[1] = v187;
      if ( v183 >> 3 == v185 )
      {
        if ( v183 & 7 )
        {
          *v186 ^= dword_16A8A70[2 * v183];
          v186[1] ^= dword_16A8A74[2 * v183];
        }
        if ( (v183 & 7) != 7 )
        {
          *v186 ^= dword_16A8A80[2 * v183];
          v186[1] ^= dword_16A8A84[2 * v183];
        }
      }
      v189 = v183 & 7;
      if ( v189 == v184 )
      {
        if ( v188 )
        {
          *v186 ^= dword_16A8A38[2 * v183];
          v186[1] ^= dword_16A8A3C[2 * v183];
        }
        if ( v188 != 7 )
        {
          *v186 ^= dword_16A8AB8[2 * v183];
          v186[1] ^= dword_16A8ABC[2 * v183];
        }
      }
      if ( v188 - v185 == v189 - v184 )
      {
        if ( v188 != 7 && v189 != 7 )
        {
          *v186 ^= dword_16A8AC0[2 * v183];
          v186[1] ^= dword_16A8AC4[2 * v183];
        }
        if ( v188 && v183 & 7 )
        {
          *v186 ^= dword_16A8A30[2 * v183];
          v186[1] ^= dword_16A8A34[2 * v183];
        }
      }
      if ( v188 - v185 == v184 - v189 )
      {
        if ( v188 != 7 && v183 & 7 )
        {
          *v186 ^= qword_16A8AB0[2 * v183];
          v186[1] ^= qword_16A8AB0[2 * v183 + 1];
        }
        if ( v188 && v189 != 7 )
        {
          *v186 ^= dword_16A8A40[2 * v183];
          v186[1] ^= dword_16A8A44[2 * v183];
        }
      }
      if ( dword_17A667C[2 * v183] & v245 | dword_17A6678[2 * v183] & v244 )
      {
        *v186 |= v244;
        v186[1] |= v245;
      }
      ++v183;
      v186 += 128;
      if ( v183 > 63 )
        break;
      v185 = v241;
    }
    v182 = v235 + 1;
    v235 = v182;
  }
  while ( v182 <= 63 );
  v190 = 0;
  v191 = 0;
  v192 = 0;
  do
  {
    v193 = 0;
    dword_17B1310[v192] = 0;
    dword_17B1314[v192] = 0;
    dword_16A9EB8[v192] = 0;
    dword_16A9EBC[v192] = 0;
    if ( v191 > 0 )
    {
      v194 = 0;
      v195 = 0;
      do
      {
        v194 |= dword_12B8A90[2 * v193];
        v195 |= dword_12B8A94[2 * v193++];
      }
      while ( v193 < v191 );
      dword_16A9EBC[v192] = v195;
      dword_16A9EB8[v192] = v194;
    }
    ++v191;
    if ( v191 <= 7 )
    {
      v196 = (char *)&unk_12B8A98 + v192 * 4;
      v197 = 0;
      v198 = 0;
      do
      {
        v197 |= *(_DWORD *)v196;
        v198 |= *((_DWORD *)v196 + 1);
        v196 += 8;
      }
      while ( (signed int)v196 <= (signed int)&unk_12B8AC8 );
      dword_17B1314[v192] = v198;
      dword_17B1310[v192] = v197;
    }
    v192 += 2;
  }
  while ( v192 <= 14 );
  do
  {
    v199 = 0;
    v242 = v190 >> 3;
    v200 = &dword_1773368[2 * v190];
    do
    {
      *v200 = qword_16A8A78[2 * v190];
      v200[1] = qword_16A8A78[2 * v190 + 1];
      v236 = 0;
      if ( v199 >> 3 == v242 )
        v236 = 2 * (v199 > v190) - 1;
      v201 = v190 & 7;
      v202 = v199 & 7;
      if ( v202 == (v190 & 7) )
      {
        v236 = (((v199 <= v190) - 1) & 0x10) - 8;
        v201 = v190 & 7;
      }
      v203 = (v199 >> 3) - v242;
      if ( v203 == v202 - v201 )
        v236 = (((v199 <= v190) - 1) & 0x12) - 9;
      if ( v203 == v201 - v202 )
      {
        v236 = (((v199 <= v190) - 1) & 0xE) - 7;
      }
      else
      {
        if ( !v236 )
          goto LABEL_154;
      }
      for ( j = v190; j != v199; *(_QWORD *)v200 |= v205 )
      {
        v205 = 1i64 << j;
        j += v236;
      }
LABEL_154:
      ++v199;
      v200 += 128;
    }
    while ( v199 <= 63 );
    ++v190;
  }
  while ( v190 <= 63 );
  v206 = 0;
  v207 = 0;
  while ( 1 )
  {
    v208 = v207 >> 3;
    v209 = v207 & 7;
    v210 = dword_12B8A94[2 * v209] | dword_12B8A54[2 * (v207 >> 3)];
    v211 = v207 & 7;
    dword_17B1110[2 * v207] = dword_12B8A90[2 * v209] | dword_12B8A50[2 * (v207 >> 3)];
    dword_17B1114[2 * v207] = v210;
    dword_17A6470[2 * v207] = v206;
    dword_17A6474[2 * v207] = v206;
    if ( v211 <= 7 )
    {
      v212 = v211 + v208 - v209;
      v238 = v211 + v208 - v209;
      v243 = 8 * v212;
      while ( v212 <= 7 )
      {
        v213 = 1i64 << ((unsigned __int8)v243 + (unsigned __int8)v211);
        dword_17A6470[2 * v207] |= v213;
        dword_17A6474[2 * v207] |= HIDWORD(v213);
        v243 += 8;
        ++v238;
        ++v211;
        if ( v211 > 7 )
          break;
        v212 = v238;
      }
    }
    v214 = v207 & 7;
    v239 = v207 >> 3;
    if ( v209 <= 7 )
    {
      do
      {
        if ( v239 < 0 )
          break;
        v215 = 1i64 << ((unsigned __int8)v214 + 8 * (unsigned __int8)v239);
        dword_17A6470[2 * v207] |= v215;
        dword_17A6474[2 * v207] |= HIDWORD(v215);
        --v239;
        ++v214;
      }
      while ( v214 <= 7 );
    }
    v216 = v207 & 7;
    v240 = 8 * v208;
    do
    {
      if ( v240 > 56 )
        break;
      v217 = 1i64 << ((unsigned __int8)v240 + (unsigned __int8)v216);
      dword_17A6470[2 * v207] |= v217;
      dword_17A6474[2 * v207] |= HIDWORD(v217);
      v240 += 8;
      --v216;
    }
    while ( v216 >= 0 );
    v218 = v207 & 7;
    v219 = 8 * v208;
    do
    {
      if ( v208 < 0 )
        break;
      v220 = 1i64 << ((unsigned __int8)v219 + (unsigned __int8)v218);
      dword_17A6470[2 * v207] |= v220;
      dword_17A6474[2 * v207] |= HIDWORD(v220);
      v219 -= 8;
      --v208;
      --v218;
    }
    while ( v218 >= 0 );
    v221 = dword_1773168[2 * v207];
    dword_17A6470[2 * v207] &= v221;
    dword_17B1110[2 * v207] &= v221;
    v222 = dword_177316C[2 * v207];
    v223 = dword_17B1110[2 * v207];
    dword_17A6474[2 * v207] &= v222;
    dword_17B1114[2 * v207] &= v222;
    v224 = dword_17B1114[2 * v207];
    v225 = dword_17A6470[2 * v207];
    dword_1771F78[2 * v207] = ~v223;
    v226 = ~dword_17A6474[2 * v207];
    dword_1771F7C[2 * v207] = ~v224;
    dword_17B2F98[2 * v207] = ~v225;
    dword_17B2F9C[2 * v207++] = v226;
    if ( v207 > 63 )
      break;
    v206 = 0;
  }
  v227 = 0;
  do
  {
    v228 = 0;
    v229 = &byte_16A8CB8[v227];
    do
    {
      *v229 = 0;
      if ( v228 != v227 )
      {
        if ( v227 >> 3 == v228 >> 3 )
          *v229 = 4;
        v230 = v227 & 7;
        v231 = v228 & 7;
        if ( v230 == v231 )
          *v229 = 8;
        v232 = (v228 >> 3) - (v227 >> 3);
        if ( v231 - v230 == v232 )
          *v229 = 2;
        if ( v230 - v231 == v232 )
          *v229 = 1;
      }
      ++v228;
      v229 += 64;
    }
    while ( v228 <= 63 );
    ++v227;
  }
  while ( v227 <= 63 );
  sub_12A1E10();
  return sub_12A38C0();
}

RobboLito:

Code: Select all

int __cdecl sub_41A5F0()
{
  int v0; // esi@1
  signed int v1; // eax@1
  int v2; // ecx@2
  int v3; // edx@2
  int v4; // ecx@2
  int v5; // edx@2
  int v6; // ecx@2
  int v7; // edx@2
  int v8; // ecx@2
  int v9; // edx@2
  int v10; // ecx@2
  int v11; // edx@2
  int v12; // ecx@2
  int v13; // edx@2
  int v14; // ecx@2
  signed int v15; // eax@3
  signed int v16; // ecx@3
  signed int v17; // edx@3
  signed int v18; // eax@5
  signed int v19; // edx@7
  signed int v20; // eax@10
  signed int v21; // edx@11
  int v22; // eax@15
  int v23; // ecx@16
  int v24; // edx@16
  signed int v25; // esi@17
  signed int v26; // esi@19
  signed __int64 v27; // qax@20
  char v28; // cl@20
  signed __int64 v29; // qax@20
  char v30; // cl@20
  signed int v31; // esi@21
  signed int v32; // edi@21
  signed int v33; // ebx@22
  signed int v34; // ecx@23
  __int64 v35; // qax@24
  signed int v36; // ecx@27
  __int64 v37; // qax@28
  signed int v38; // ecx@31
  __int64 v39; // qax@32
  signed int v40; // ecx@35
  __int64 v41; // qax@36
  signed int v42; // edi@41
  signed int v43; // esi@42
  int v44; // ecx@43
  int v45; // eax@43
  signed int v46; // eax@49
  int v47; // ecx@50
  int v48; // ebx@50
  int v49; // edx@50
  int v50; // edi@50
  int v51; // esi@50
  int v52; // ebx@50
  int v53; // esi@50
  int v54; // edi@50
  int v55; // ebx@50
  int v56; // esi@50
  int v57; // edi@50
  int v58; // ecx@50
  int v59; // ebx@50
  int v60; // edx@50
  int v61; // ecx@50
  int v62; // edx@50
  int v63; // ecx@50
  int v64; // edx@50
  int v65; // ecx@50
  int v66; // edx@50
  int v67; // ecx@50
  int v68; // edx@50
  int v69; // ecx@50
  int v70; // edx@50
  int v71; // ecx@50
  int v72; // esi@51
  signed int v73; // eax@51
  int v74; // ecx@52
  int v75; // edx@52
  int v76; // ecx@52
  signed int v77; // eax@53
  int v78; // ecx@54
  int v79; // edx@54
  int v80; // ecx@54
  signed int v81; // edx@55
  signed int v82; // eax@56
  int v83; // ecx@56
  int v84; // edi@57
  int v85; // edi@59
  int v86; // edi@61
  int v87; // edi@63
  int v88; // edi@64
  int v89; // eax@64
  int v90; // ecx@65
  signed int v91; // eax@65
  int v92; // edx@66
  signed int v93; // ecx@67
  int v94; // ebx@67
  signed int v95; // edi@70
  signed int v96; // edx@71
  int v97; // eax@71
  signed int v98; // edi@71
  signed int v99; // ecx@72
  signed int v100; // ebx@74
  char *v101; // ecx@76
  unsigned int v102; // esi@77
  unsigned int v103; // ebx@77
  unsigned __int64 v104; // qax@78
  unsigned __int64 v105; // qax@83
  signed int v106; // edx@87
  signed int v107; // edx@89
  int v108; // eax@89
  int v109; // edi@90
  int v110; // ebx@90
  int v111; // ecx@90
  int v112; // esi@90
  int v113; // edi@90
  int v114; // ebx@90
  int v115; // ecx@90
  int v116; // esi@90
  int v117; // esi@90
  int v118; // edi@90
  int v119; // esi@90
  int v120; // ecx@90
  int v121; // ebx@90
  int v122; // ST0C_4@90
  int v123; // edi@90
  int v124; // ecx@90
  int v125; // ebx@90
  int v126; // esi@90
  int v127; // edi@90
  int v128; // ecx@90
  int v129; // esi@90
  int v130; // ecx@90
  int v131; // esi@90
  int v132; // eax@91
  signed int v133; // edx@91
  int v134; // ecx@92
  int v135; // esi@104
  signed int v136; // edx@105
  int v137; // ecx@106
  int v138; // esi@106
  int v139; // edi@106
  int v140; // esi@106
  int v141; // ebx@106
  int v142; // edi@106
  int v143; // ecx@106
  int v144; // esi@106
  int v145; // edi@106
  int v146; // esi@106
  int v147; // ebx@106
  int v148; // edi@106
  int v149; // ecx@106
  int v150; // esi@106
  int v151; // edi@106
  int v152; // esi@106
  int v153; // ebx@106
  int v154; // edi@106
  int v155; // ecx@106
  int v156; // esi@106
  int v157; // edi@106
  int v158; // esi@106
  int v159; // ebx@106
  int v160; // ST24_4@106
  int v161; // edi@106
  int v162; // edi@106
  signed int v163; // eax@107
  int v164; // ecx@108
  signed int v165; // ebx@108
  signed int v166; // edi@110
  int v167; // esi@110
  int v168; // edx@112
  int v169; // ecx@113
  signed int v170; // esi@113
  int v171; // edx@115
  int v172; // edi@115
  int v173; // edx@115
  int v174; // esi@118
  int v175; // edx@120
  int v176; // ecx@121
  signed int v177; // edi@122
  int v178; // esi@122
  int v179; // edx@124
  signed int v180; // ecx@126
  _UNKNOWN *v181; // eax@126
  int v182; // esi@127
  int v183; // edx@127
  int v184; // edi@127
  int v185; // esi@127
  int v186; // edx@127
  int v187; // edi@127
  int v188; // esi@127
  int v189; // esi@127
  int v190; // edi@127
  int v191; // esi@127
  int v192; // edx@127
  int v193; // edi@127
  int v194; // esi@127
  signed int v195; // ecx@128
  _UNKNOWN *v196; // eax@128
  int v197; // esi@129
  int v198; // edx@129
  int v199; // edi@129
  int v200; // esi@129
  int v201; // edx@129
  int v202; // edi@129
  int v203; // esi@129
  int v204; // esi@129
  int v205; // edi@129
  int v206; // esi@129
  int v207; // edx@129
  int v208; // edi@129
  int v209; // esi@129
  signed int v210; // ebx@130
  signed int v211; // esi@130
  int v212; // edi@131
  int v213; // edx@131
  signed int v214; // ecx@132
  signed int v215; // edi@133
  int v216; // eax@134
  int v217; // edx@134
  int v218; // esi@134
  int v219; // eax@134
  int v227; // eax@138
  int v228; // ebx@138
  int v229; // ebx@138
  int v230; // esi@144
  int v231; // ecx@144
  int v232; // eax@144
  signed int v233; // ebx@145
  unsigned int v234; // edi@145
  int v235; // ecx@149
  unsigned int v236; // edi@149
  signed int v237; // ebx@149
  int v238; // edi@154
  unsigned int v240; // esi@154
  int v241; // eax@155
  int v242; // ebx@158
  int v243; // ecx@158
  int v244; // esi@163
  int v245; // ecx@163
  int v246; // eax@163
  signed int v247; // ebx@164
  unsigned int v248; // edi@164
  int v249; // ecx@168
  unsigned int v250; // edi@168
  signed int v251; // ebx@168
  int v252; // edi@173
  unsigned int v253; // edx@173
  unsigned int v254; // esi@173
  int v258; // eax@177
  int v259; // ebx@177
  int v260; // eax@177
  int v261; // ecx@177
  int v262; // eax@177
  signed int v263; // ebx@181
  signed int v264; // ecx@181
  signed int v265; // esi@181
  __int64 v266; // qax@183
  int v267; // ecx@184
  int v268; // esi@186
  int v269; // edi@186
  int v270; // eax@186
  int v271; // eax@190
  signed int v272; // ecx@195
  int v273; // ecx@199
  signed int v274; // esi@199
  __int64 v275; // qax@201
  signed int v276; // ebx@201
  int v277; // ecx@202
  int v278; // esi@204
  int v279; // edi@204
  int v280; // eax@204
  int v281; // eax@208
  signed int v282; // ecx@213
  signed int v283; // esi@216
  int v284; // eax@217
  int v285; // edx@219
  int v286; // ecx@219
  signed int v287; // eax@221
  signed int v288; // eax@230
  signed int v289; // ecx@231
  int v290; // edx@233
  int v291; // esi@233
  int v292; // edx@237
  int v293; // esi@237
  int v294; // edx@241
  int v295; // esi@241
  int v296; // ecx@245
  int v297; // edx@245
  signed int v298; // eax@248
  signed int v299; // ecx@249
  signed int v300; // ebx@249
  int *v301; // eax@249
  int v302; // esi@251
  signed int v303; // edx@251
  int v304; // esi@256
  signed int v305; // edx@279
  signed int v306; // eax@279
  signed int v307; // ecx@280
  int v308; // ebx@281
  char *v309; // ecx@285
  int v310; // ebx@285
  signed int v311; // esi@290
  int *v312; // edi@290
  int v313; // ecx@293
  int v314; // eax@295
  signed int i; // ebx@300
  signed __int64 v316; // qax@301
  signed int v317; // esi@304
  int v318; // ebx@305
  int v319; // edx@305
  int v320; // edi@305
  int v321; // ecx@306
  int v322; // eax@306
  signed __int64 v323; // qax@309
  int v324; // edi@310
  signed __int64 v325; // qax@312
  int v326; // edi@313
  signed __int64 v327; // qax@315
  int v328; // edi@316
  signed int v329; // eax@316
  int v330; // ebx@316
  signed __int64 v331; // qax@319
  int v332; // eax@320
  int v333; // ecx@320
  int v334; // eax@320
  int v335; // ecx@320
  int v336; // edi@320
  int v337; // ecx@320
  int v338; // edx@320
  signed int v339; // edi@320
  signed int v340; // edi@321
  signed int v341; // edx@322
  char *v342; // ebx@322
  signed int v343; // edi@324
  int v344; // eax@326
  int v345; // ecx@326
  int v346; // esi@328
  unsigned int v348; // [sp+Ch] [bp-28h]@78
  unsigned int v349; // [sp+Ch] [bp-28h]@83
  int v350; // [sp+Ch] [bp-28h]@134
  __int64 v351; // [sp+Ch] [bp-28h]@144
  unsigned __int64 v352; // [sp+Ch] [bp-28h]@154
  __int64 v353; // [sp+Ch] [bp-28h]@163
  unsigned __int64 v354; // [sp+Ch] [bp-28h]@173
  int v355; // [sp+Ch] [bp-28h]@249
  int v356; // [sp+Ch] [bp-28h]@290
  int v357; // [sp+10h] [bp-24h]@134
  int v358; // [sp+10h] [bp-24h]@249
  int v359; // [sp+10h] [bp-24h]@290
  signed int v360; // [sp+18h] [bp-1Ch]@183
  int v361; // [sp+18h] [bp-1Ch]@201
  int v362; // [sp+18h] [bp-1Ch]@306
  signed int v363; // [sp+18h] [bp-1Ch]@316
  signed int v364; // [sp+20h] [bp-14h]@41
  signed int v365; // [sp+20h] [bp-14h]@76
  signed int v366; // [sp+20h] [bp-14h]@143
  signed int v367; // [sp+20h] [bp-14h]@162
  int v368; // [sp+20h] [bp-14h]@183
  int v369; // [sp+20h] [bp-14h]@201
  int v370; // [sp+20h] [bp-14h]@291
  int v371; // [sp+20h] [bp-14h]@306
  signed int v372; // [sp+20h] [bp-14h]@310
  int v373; // [sp+20h] [bp-14h]@313
  signed int v374; // [sp+20h] [bp-14h]@321
  signed int v375; // [sp+28h] [bp-Ch]@76
  int v376; // [sp+28h] [bp-Ch]@183
  int v377; // [sp+28h] [bp-Ch]@201
  signed int v378; // [sp+28h] [bp-Ch]@249
  signed int v379; // [sp+28h] [bp-Ch]@290
  signed int v380; // [sp+28h] [bp-Ch]@305
  signed int v381; // [sp+2Ch] [bp-8h]@75
  int v382; // [sp+2Ch] [bp-8h]@108
  signed int v383; // [sp+2Ch] [bp-8h]@142
  signed int v384; // [sp+2Ch] [bp-8h]@161
  int v385; // [sp+2Ch] [bp-8h]@183
  int v386; // [sp+2Ch] [bp-8h]@249
  int v387; // [sp+2Ch] [bp-8h]@290
  signed int v388; // [sp+30h] [bp-4h]@107
  int v389; // [sp+30h] [bp-4h]@132
  int v390; // [sp+30h] [bp-4h]@143
  int v391; // [sp+30h] [bp-4h]@162
  signed int v392; // [sp+30h] [bp-4h]@180
  signed int v393; // [sp+30h] [bp-4h]@198
  signed int v394; // [sp+30h] [bp-4h]@248
  signed int v395; // [sp+30h] [bp-4h]@289

  v0 = 0;
  v1 = 0;
  do
  {
    v2 = (unsigned __int8)byte_42A688[v1];
    dword_68F7A0[v1] = dword_43A020[(unsigned __int8)byte_42A648[v1]];
    v3 = dword_43A020[v2];
    v4 = (unsigned __int8)byte_42A649[v1];
    dword_68F8A0[v1] = v3;
    v5 = dword_43A020[v4];
    v6 = (unsigned __int8)byte_42A689[v1];
    dword_68F7A4[v1] = v5;
    v7 = dword_43A020[v6];
    v8 = (unsigned __int8)byte_42A64A[v1];
    dword_68F8A4[v1] = v7;
    v9 = dword_43A020[v8];
    v10 = (unsigned __int8)byte_42A68A[v1];
    dword_68F7A8[v1] = v9;
    v11 = dword_43A020[v10];
    v12 = (unsigned __int8)byte_42A64B[v1];
    dword_68F8A8[v1] = v11;
    v13 = dword_43A020[v12];
    v14 = (unsigned __int8)byte_42A68B[v1];
    dword_68F7AC[v1] = v13;
    dword_68F8AC[v1] = dword_43A020[v14];
    v1 += 4;
  }
  while ( v1 <= 63 );
  v15 = 0;
  v16 = 3;
  v17 = 1;
  do
  {
    dword_68F9A0[v15] = (v15 & 0x38) + 1;
    dword_68FAA0[v15] = (byte_42A608[v17 - 1] & 0x38) + 1;
    dword_68F9A4[v15] = (v17 & 0x38) + 1;
    dword_68FAA4[v15] = (byte_42A608[v17] & 0x38) + 1;
    dword_68F9A8[v15] = (((_BYTE)v16 - 1) & 0x38) + 1;
    dword_68FAA8[v15] = (byte_42A60A[v16 - 3] & 0x38) + 1;
    dword_68F9AC[v15] = (v16 & 0x38) + 1;
    dword_68FAAC[v15] = (byte_42A608[v16] & 0x38) + 1;
    v15 += 4;
    v17 += 4;
    v16 += 4;
  }
  while ( v15 <= 63 );
  v18 = 1;
  do
  {
    if ( v18 >= 1 )
    {
      v19 = 1;
      memset32(&dword_43AC18[v0], v18, v18);
      do
        *(_DWORD *)&dword_43AB18[4 * v0++] = v19++ - 1;
      while ( v19 <= v18 );
    }
    ++v18;
  }
  while ( v18 <= 8 );
  v20 = 7;
  do
  {
    v21 = 1;
    if ( v20 >= 1 )
    {
      memset32(&dword_43AC18[v0], v20, v20);
      do
        *(_DWORD *)&dword_43AB18[4 * v0++] = v21++ - 1;
      while ( v21 <= v20 );
    }
    --v20;
  }
  while ( v20 >= 1 );
  v22 = 0;
  do
  {
    v23 = (unsigned __int8)byte_42A608[v22];
    dword_43AD18[(unsigned __int8)byte_42A648[v22]] = v22;
    v24 = (unsigned __int8)byte_42A688[v22];
    dword_43A918[v23] = v22;
    dword_43AA18[v24] = v22++;
  }
  while ( v22 <= 63 );
  v25 = 0;
  do
  {
    dword_628420[2 * v25] = 1i64 << v25;
    dword_628424[2 * v25] = (unsigned __int64)(1i64 << v25) >> 32;
    dword_62A2E0[2 * v25] = ~(unsigned int)(1i64 << v25);
    dword_62A2E4[2 * v25] = ~((unsigned __int64)(1i64 << v25) >> 32);
    ++v25;
  }
  while ( v25 <= 63 );
  v26 = 0;
  do
  {
    v27 = 1i64 << byte_42A608[v26];
    v28 = byte_42A648[v26];
    dword_62ADA4[2 * v26] = HIDWORD(v27);
    HIDWORD(v27) = v27;
    dword_62ADA0[2 * v26] = v27;
    LODWORD(v27) = ~dword_62ADA4[2 * v26];
    dword_62B9C0[2 * v26] = ~HIDWORD(v27);
    dword_62B9C4[2 * v26] = v27;
    v29 = 1i64 << v28;
    v30 = byte_42A688[v26];
    dword_48B660[2 * v26] = v29;
    dword_48B664[2 * v26] = HIDWORD(v29);
    dword_48B8A0[2 * v26] = ~(_DWORD)v29;
    dword_48B8A4[2 * v26] = ~HIDWORD(v29);
    dword_62AFC0[2 * v26] = 1i64 << v30;
    dword_62AFC4[2 * v26] = (unsigned __int64)(1i64 << v30) >> 32;
    dword_629EC0[2 * v26] = ~(unsigned int)(1i64 << v30);
    dword_629EC4[2 * v26++] = ~((unsigned __int64)(1i64 << v30) >> 32);
  }
  while ( v26 <= 63 );
  v31 = 0;
  v32 = (signed int)&dword_629AC0;
  do
  {
    *(_DWORD *)v32 = 0;
    *(_DWORD *)(v32 + 4) = 0;
    v33 = (signed int)&unk_43A124;
    do
    {
      v34 = v31 + *(_DWORD *)(v33 - 4);
      if ( (unsigned int)v34 <= 0x3F )
      {
        v35 = (v31 & 7) - (v34 & 7);
        if ( (signed int)((HIDWORD(v35) ^ v35) - HIDWORD(v35)) <= 2 )
        {
          if ( abs((v31 >> 3) - (v34 >> 3)) <= 2 )
          {
            *(_DWORD *)v32 |= 1i64 << v34;
            *(_DWORD *)(v32 + 4) |= (unsigned __int64)(1i64 << v34) >> 32;
          }
        }
      }
      v36 = v31 + *(_DWORD *)v33;
      if ( (unsigned int)v36 <= 0x3F )
      {
        v37 = (v31 & 7) - (v36 & 7);
        if ( (signed int)((HIDWORD(v37) ^ v37) - HIDWORD(v37)) <= 2 )
        {
          if ( abs((v31 >> 3) - (v36 >> 3)) <= 2 )
          {
            *(_DWORD *)v32 |= 1i64 << v36;
            *(_DWORD *)(v32 + 4) |= (unsigned __int64)(1i64 << v36) >> 32;
          }
        }
      }
      v38 = v31 + *(_DWORD *)(v33 + 4);
      if ( (unsigned int)v38 <= 0x3F )
      {
        v39 = (v31 & 7) - (v38 & 7);
        if ( (signed int)((HIDWORD(v39) ^ v39) - HIDWORD(v39)) <= 2 )
        {
          if ( abs((v31 >> 3) - (v38 >> 3)) <= 2 )
          {
            *(_DWORD *)v32 |= 1i64 << v38;
            *(_DWORD *)(v32 + 4) |= (unsigned __int64)(1i64 << v38) >> 32;
          }
        }
      }
      v40 = v31 + *(_DWORD *)(v33 + 8);
      if ( (unsigned int)v40 <= 0x3F )
      {
        v41 = (v31 & 7) - (v40 & 7);
        if ( (signed int)((HIDWORD(v41) ^ v41) - HIDWORD(v41)) <= 2 )
        {
          if ( abs((v31 >> 3) - (v40 >> 3)) <= 2 )
          {
            *(_DWORD *)v32 |= 1i64 << v40;
            *(_DWORD *)(v32 + 4) |= (unsigned __int64)(1i64 << v40) >> 32;
          }
        }
      }
      v33 += 16;
    }
    while ( v33 < (signed int)&dword_43A144 );
    v32 += 8;
    ++v31;
  }
  while ( v32 <= (signed int)&unk_629CB8 );
  v364 = 0;
  v42 = (signed int)dword_68CCC0;
  do
  {
    v43 = 0;
    *(_DWORD *)v42 = 0;
    *(_DWORD *)(v42 + 4) = 0;
    do
    {
      v44 = abs((v364 & 7) - (v43 & 7));
      v45 = abs((v364 >> 3) - (v43 >> 3));
      if ( v44 >= v45 )
        v45 = v44;
      if ( v45 == 1 )
      {
        *(_DWORD *)v42 |= 1i64 << v43;
        *(_DWORD *)(v42 + 4) |= (unsigned __int64)(1i64 << v43) >> 32;
      }
      ++v43;
    }
    while ( v43 <= 63 );
    ++v364;
    v42 += 8;
  }
  while ( v42 <= (signed int)&unk_68CEB8 );
  dword_68FFAC = dword_628474 | dword_628464[0];
  dword_68FFA0[0] = dword_628468[0] | dword_628458[0];
  dword_68FFB4 = dword_62846C[0] | dword_62847C;
  dword_68FFA4[0] = dword_62846C[0] | dword_62845C[0];
  dword_68F168 = 0;
  dword_68F16C = 0;
  dword_68FFB0 = dword_628468[0] | dword_628478;
  dword_68FFBC = dword_628474 | dword_628484;
  dword_68FFB8 = dword_628470 | dword_628480;
  dword_68FFA8 = dword_628470 | dword_628460[0];
  dword_68F170 = 0;
  dword_68F174 = 0;
  dword_68F178 = 0;
  dword_68F17C = 0;
  dword_68F180 = 0;
  dword_68F184 = 0;
  dword_68FFC0 = dword_628478 | dword_628488;
  dword_68FFC8 = dword_628490[0] | dword_628480;
  dword_68FFCC = dword_628494[0] | dword_628484;
  dword_68FFC4 = dword_62847C | dword_62848C;
  dword_68FFD8[0] = dword_628490[0] | dword_6284A0[0];
  dword_68F188 = 0;
  dword_68F18C = 0;
  dword_68F190 = 0;
  dword_68F194 = 0;
  dword_68FFD0 = dword_628498[0] | dword_628488;
  dword_68FFD4 = dword_62849C[0] | dword_62848C;
  dword_68FFDC[0] = dword_628494[0] | dword_6284A4[0];
  v46 = 0;
  do
  {
    v47 = dword_628428[v46];
    v48 = dword_6284A8[v46] | dword_628498[v46];
    v49 = dword_62842C[v46];
    v50 = v49 | dword_62841C[v46];
    dword_68F1A0[v46] = v47 | dword_628418[v46];
    v51 = dword_6284AC[v46] | dword_62849C[v46];
    dword_68FFE0[v46] = v48;
    v52 = dword_628430[v46] | dword_628420[v46];
    dword_68FFE4[v46] = v51;
    v53 = dword_628434[v46] | dword_628424[v46];
    dword_68F1A4[v46] = v50;
    v54 = dword_6284A4[v46];
    dword_68F1A8[v46] = v52;
    v55 = dword_6284B0[v46] | dword_6284A0[v46];
    dword_68F1AC[v46] = v53;
    v56 = dword_6284B4[v46];
    dword_68FFEC[v46] = v56 | v54;
    v57 = dword_628438[v46];
    dword_68F1B0[v46] = v57 | v47;
    v58 = dword_6284A8[v46] | dword_6284B8[v46];
    dword_68FFE8[v46] = v55;
    v59 = dword_62843C[v46];
    dword_68F1B4[v46] = v59 | v49;
    v60 = dword_6284AC[v46] | dword_6284BC[v46];
    dword_68FFF0[v46] = v58;
    v61 = dword_628430[v46] | dword_628440[v46];
    dword_68FFF4[v46] = v60;
    v62 = dword_628434[v46] | dword_628444[v46];
    dword_68F1B8[v46] = v61;
    v63 = dword_6284B0[v46] | dword_6284C0[v46];
    dword_68F1BC[v46] = v62;
    v64 = v56 | dword_6284C4[v46];
    dword_68FFF8[v46] = v63;
    v65 = dword_62844C[v46];
    dword_68FFFC[v46] = v64;
    dword_68F1C0[v46] = v57 | dword_628448[v46];
    v66 = dword_6284B8[v46] | dword_6284C8[v46];
    dword_68F1C4[v46] = v59 | v65;
    v67 = dword_6284BC[v46] | dword_6284CC[v46];
    dword_690000[v46] = v66;
    v68 = dword_628440[v46] | dword_628450[v46];
    dword_690004[v46] = v67;
    v69 = dword_628444[v46] | dword_628454[v46];
    dword_68F1C8[v46] = v68;
    v70 = dword_6284C0[v46] | dword_6284D0[v46];
    dword_68F1CC[v46] = v69;
    v71 = dword_6284C4[v46] | dword_6284D4[v46];
    dword_690008[v46] = v70;
    dword_69000C[v46] = v71;
    v46 += 12;
  }
  while ( v46 <= 94 );
  dword_68F32C = dword_6285A4 | dword_6285B4;
  dword_68F320 = dword_628598 | dword_6285A8;
  dword_68F328 = dword_6285A0 | dword_6285B0;
  dword_68F334 = dword_6285AC | dword_6285BC;
  dword_68F330 = dword_6285A8 | dword_6285B8;
  dword_68F338 = dword_6285B0 | dword_6285C0;
  dword_68F33C = dword_6285B4 | dword_6285C4;
  dword_68F340 = dword_6285B8 | dword_6285C8;
  dword_68F344 = dword_6285BC | dword_6285CC;
  dword_68F34C = dword_6285C4 | dword_6285D4;
  dword_68F350 = dword_6285C8 | dword_6285D8;
  dword_68F324 = dword_62859C | dword_6285AC;
  v72 = 0;
  dword_68F358 = dword_6285D0 | dword_6285E0;
  dword_690168 = 0;
  dword_69016C = 0;
  dword_690170 = 0;
  dword_690174 = 0;
  dword_690178 = 0;
  dword_69017C = 0;
  dword_690180 = 0;
  dword_690184 = 0;
  dword_690188 = 0;
  dword_69018C = 0;
  dword_68F348 = dword_6285C0 | dword_6285D0;
  dword_690190 = 0;
  dword_690194 = 0;
  dword_68F354 = dword_6285CC | dword_6285DC;
  dword_68F35C = dword_6285D4 | dword_6285E4;
  v73 = 0;
  do
  {
    v74 = dword_6283EC[v73];
    dword_68F160[v73] = dword_6283E8[v73];
    v75 = dword_628468[v73];
    dword_68F164[v73] = v74;
    v76 = dword_62846C[v73];
    dword_68FFA0[v73] = v75;
    dword_68FFA4[v73] = v76;
    v73 += 16;
  }
  while ( v73 <= 112 );
  v77 = 0;
  do
  {
    v78 = dword_628414[v77];
    dword_68F198[v77] = dword_628410[v77];
    v79 = dword_628490[v77];
    dword_68F19C[v77] = v78;
    v80 = dword_628494[v77];
    dword_68FFD8[v77] = v79;
    dword_68FFDC[v77] = v80;
    v77 += 16;
  }
  while ( v77 <= 112 );
  dword_68F1A4[0] = dword_62842C[0];
  dword_68F1D8 = dword_628450[0];
  dword_69015C = dword_628614;
  dword_628660[0] = 33686018;
  dword_628664[0] = 33686018;
  dword_628698 = 1077952576;
  dword_62869C = 1077952576;
  dword_628668 = 84215045;
  dword_62866C = 84215045;
  dword_628670 = 168430090;
  dword_628674 = 168430090;
  dword_628678 = 336860180;
  dword_62867C = 336860180;
  dword_68F1A0[0] = dword_628428[0];
  dword_628680 = 673720360;
  dword_628684 = 673720360;
  dword_690124 = dword_6285EC;
  dword_690120 = dword_6285E8;
  dword_628688 = 1347440720;
  dword_62868C = 1347440720;
  dword_690158 = dword_628610;
  dword_68F160[0] = 0;
  dword_68F164[0] = 0;
  dword_690160 = 0;
  dword_690164 = 0;
  dword_68F198[0] = 0;
  dword_68F19C[0] = 0;
  dword_68F1DC = dword_628454[0];
  dword_690198 = 0;
  dword_69019C = 0;
  dword_628690 = -1600085856;
  dword_628694 = -1600085856;
  v81 = 0;
  do
  {
    v82 = v81 >> 3;
    v83 = v81 & 7;
    dword_68EF20[2 * v81] = v72;
    dword_68EF24[2 * v81] = v72;
    dword_629CC0[2 * v81] = v72;
    dword_629CC4[2 * v81] = v72;
    if ( v81 >> 3 < 7 )
    {
      v84 = dword_628664[2 * v83] & dword_42A6D4[2 * v82];
      dword_68EF20[2 * v81] = dword_628660[2 * v83] & dword_42A6D0[2 * v82];
      dword_68EF24[2 * v81] = v84;
      v72 = 0;
    }
    if ( v82 < 6 )
    {
      v85 = dword_628664[2 * v83] & dword_42A6DC[2 * v82];
      dword_68EF20[2 * v81] |= dword_628660[2 * v83] & dword_42A6D8[2 * v82];
      dword_68EF24[2 * v81] |= v85;
      v72 = 0;
    }
    if ( v82 > v72 )
    {
      v86 = dword_628664[2 * v83] & dword_42A6C4[2 * v82];
      dword_629CC0[2 * v81] = dword_628660[2 * v83] & dword_42A6C0[2 * v82];
      dword_629CC4[2 * v81] = v86;
      v72 = 0;
    }
    if ( v82 > 1 )
    {
      v87 = dword_628664[2 * v83] & dword_42A6BC[2 * v82];
      dword_629CC0[2 * v81] |= dword_628660[2 * v83] & dword_42A6B8[2 * v82];
      dword_629CC4[2 * v81] |= v87;
      v72 = 0;
    }
    v88 = dword_68EF20[2 * v81] | dword_629CC0[2 * v81] | dword_628660[2 * v83] & dword_42A6C8[2 * v82];
    v89 = dword_68EF24[2 * v81] | dword_629CC4[2 * v81] | dword_628664[2 * v83] & dword_42A6CC[2 * v82];
    dword_68FBA0[2 * v81] = v88;
    dword_68FBA4[2 * v81++] = v89;
  }
  while ( v81 <= 63 );
  v90 = 0;
  v91 = 0;
  do
  {
    v92 = v90 + 1;
    dword_62AD20[v91] = v72;
    dword_62AD24[v91] = v72;
    if ( v90 + 1 <= 7 )
    {
      v93 = (signed int)&dword_42A6D0[v91];
      v94 = v72;
      do
      {
        v94 |= *(_DWORD *)v93;
        dword_62AD24[v91] |= *(_DWORD *)(v93 + 4);
        v93 += 8;
      }
      while ( v93 <= (signed int)&unk_42A700 );
      dword_62AD20[v91] = v94;
    }
    v95 = ~dword_62AD24[v91];
    dword_68F560[v91] = ~dword_62AD20[v91];
    dword_68F564[v91] = v95;
    v91 += 2;
    v90 = v92;
  }
  while ( v91 <= 14 );
  v96 = 6;
  v97 = 0;
  v98 = 8;
  do
  {
    dword_62A518[v97] = v72;
    dword_62A51C[v97] = v72;
    v99 = v96;
    if ( v96 >= v72 )
    {
      do
      {
        dword_62A518[v97] |= dword_42A6C8[2 * v99];
        dword_62A51C[v97] |= dword_42A6CC[2 * v99--];
      }
      while ( v99 >= 0 );
    }
    v100 = ~dword_62A51C[v97];
    dword_68EEF8[v97] = ~dword_62A518[v97];
    dword_68EEFC[v97] = v100;
    --v96;
    v97 -= 2;
    --v98;
  }
  while ( v98 );
  v381 = v72;
  do
  {
    v365 = 0;
    v375 = 1;
    v101 = (char *)&unk_67D440 + 8 * (v381 >> 1);
    do
    {
      v102 = 0;
      v103 = 0;
      if ( v365 < 7 )
      {
        LODWORD(v104) = __ROL__(v375, 1);
        v348 = v104;
        if ( (unsigned __int64)(signed int)v104 < 0x100 )
        {
          v104 = (signed int)v104;
          do
          {
            v102 |= v104;
            v103 |= HIDWORD(v104);
            if ( v104 & v381 )
              break;
            v104 = 2 * __PAIR__(HIDWORD(v104), v348);
            v348 = v104;
          }
          while ( v104 < 0x100 );
        }
      }
      if ( v365 > 0 )
      {
        LODWORD(v105) = __ROR__(v375, 1);
        v105 = (signed int)v105;
        v349 = v105;
        if ( (unsigned __int64)(signed int)v105 >> 32 || (_DWORD)v105 )
        {
          do
          {
            v102 |= v105;
            v103 |= HIDWORD(v105);
            if ( v105 & v381 )
              break;
            v105 = __PAIR__(HIDWORD(v105), v349) >> 1;
            v349 = v105;
          }
          while ( v105 );
        }
      }
      *((_DWORD *)v101 - 1024) = v102;
      *((_DWORD *)v101 - 1023) = v103;
      *(_QWORD *)v101 = __PAIR__(v103, v102) << 8;
      *((_QWORD *)v101 + 512) = __PAIR__(v103, v102) << 16;
      *((_QWORD *)v101 + 1024) = __PAIR__(v103, v102) << 24;
      *((_DWORD *)v101 + 3072) = 0;
      *((_DWORD *)v101 + 3073) = v102;
      *((_DWORD *)v101 + 4096) = 0;
      *((_DWORD *)v101 + 4097) = v102 << 8;
      *((_DWORD *)v101 + 5120) = 0;
      *((_DWORD *)v101 + 5121) = v102 << 16;
      *((_DWORD *)v101 + 6144) = 0;
      *((_DWORD *)v101 + 6145) = v102 << 24;
      v101 += 512;
      v106 = __ROL__(v375, 1);
      ++v365;
      v375 = v106;
    }
    while ( v365 <= 7 );
    v381 += 2;
  }
  while ( v381 < 128 );
  v107 = 2;
  v108 = 0;
  do
  {
    v109 = dword_628660[2 * (((_BYTE)v107 - 2) & 7)] | dword_42A708[2 * (((_BYTE)v107 - 2) & 7)];
    v110 = dword_628664[2 * (((_BYTE)v107 - 2) & 7)] | dword_42A70C[2 * (((_BYTE)v107 - 2) & 7)];
    dword_48BD00[v108] = v109 & dword_62AD20[2 * ((v107 - 2) >> 3)];
    v111 = 2 * ((v107 - 2) >> 3);
    dword_48BD04[v108] = v110 & dword_62AD24[2 * ((v107 - 2) >> 3)];
    v112 = dword_62A4E0[v111];
    dword_66C244[v108] = v110 & dword_62A4E4[v111];
    dword_66C240[v108] = v109 & v112;
    v113 = dword_628660[2 * (((_BYTE)v107 - 1) & 7)] | dword_42A708[2 * (((_BYTE)v107 - 1) & 7)];
    v114 = dword_628664[2 * (((_BYTE)v107 - 1) & 7)] | dword_42A70C[2 * (((_BYTE)v107 - 1) & 7)];
    dword_48BD08[v108] = v113 & dword_62AD20[2 * ((v107 - 1) >> 3)];
    v115 = 2 * ((v107 - 1) >> 3);
    dword_48BD0C[v108] = v114 & dword_62AD24[2 * ((v107 - 1) >> 3)];
    v116 = dword_62A4E0[v115];
    dword_66C24C[v108] = v114 & dword_62A4E4[v115];
    v117 = v113 & v116;
    v118 = dword_628660[2 * (v107 & 7)] | dword_42A708[2 * (v107 & 7)];
    dword_66C248[v108] = v117;
    v119 = dword_628664[2 * (v107 & 7)] | dword_42A70C[2 * (v107 & 7)];
    v120 = 2 * (v107 >> 3);
    v121 = v118 & dword_62AD20[2 * (v107 >> 3)];
    v122 = v118;
    dword_48BD14[v108] = v119 & dword_62AD24[v120];
    v123 = dword_62A4E0[v120];
    v124 = dword_62A4E4[v120];
    dword_48BD10[v108] = v121;
    dword_66C254[v108] = v119 & v124;
    v125 = dword_628664[2 * (((_BYTE)v107 + 1) & 7)] | dword_42A70C[2 * (((_BYTE)v107 + 1) & 7)];
    v126 = 2 * ((v107 + 1) >> 3);
    dword_66C250[v108] = v122 & v123;
    v127 = dword_628660[2 * (((_BYTE)v107 + 1) & 7)] | dword_42A708[2 * (((_BYTE)v107 + 1) & 7)];
    v128 = dword_62AD20[v126];
    v129 = dword_62AD24[v126];
    dword_48BD18[v108] = v127 & v128;
    v130 = 2 * ((v107 + 1) >> 3);
    dword_48BD1C[v108] = v125 & v129;
    v131 = v127 & dword_62A4E0[v130];
    v107 += 4;
    dword_66C25C[v108] = v125 & dword_62A4E4[v130];
    dword_66C258[v108] = v131;
    v108 += 8;
  }
  while ( v107 - 2 <= 63 );
  v132 = 0;
  v133 = 0;
  do
  {
    v134 = v133 & 7;
    if ( v134 < 2 )
    {
      dword_62A520[2 * v133] = 0;
      dword_62A524[2 * v133] = 0;
    }
    else
    {
      dword_62A520[2 * v133] = dword_628410[2 * v133];
      dword_62A524[2 * v133] = dword_628414[2 * v133];
    }
    if ( v134 > 5 )
    {
      dword_7914C0[2 * v133] = 0;
      dword_7914C4[2 * v133] = 0;
    }
    else
    {
      dword_7914C0[2 * v133] = dword_628430[2 * v133];
      dword_7914C4[2 * v133] = dword_628434[2 * v133];
    }
    if ( v134 < 1 )
    {
      dword_48E120[2 * v133] = 0;
      dword_48E124[2 * v133] = 0;
    }
    else
    {
      dword_48E120[2 * v133] = dword_628418[2 * v133];
      dword_48E124[2 * v133] = dword_62841C[2 * v133];
    }
    if ( v134 > 6 )
    {
      dword_64BC40[2 * v133] = 0;
      dword_64BC44[2 * v133] = 0;
    }
    else
    {
      dword_64BC40[2 * v133] = dword_628428[2 * v133];
      dword_64BC44[2 * v133] = dword_62842C[2 * v133];
    }
    v135 = dword_64BC44[2 * v133] | dword_48E124[2 * v133];
    dword_48DF00[2 * v133] = dword_64BC40[2 * v133] | dword_48E120[2 * v133];
    dword_48DF04[2 * v133++] = v135;
  }
  while ( v133 <= 63 );
  v136 = 2;
  do
  {
    v137 = 2 * ((v136 - 2) >> 3);
    v138 = (v136 - 2) & 7;
    v139 = dword_628660[2 * v138];
    v140 = dword_628664[2 * v138];
    v141 = v139 & dword_68F560[2 * ((v136 - 2) >> 3)];
    dword_62A924[v132] = v140 & dword_68F564[v137];
    v142 = v139 & dword_68EEC0[v137];
    dword_68C864[v132] = v140 & dword_68EEC4[v137];
    dword_68C860[v132] = v142;
    v143 = 2 * ((v136 - 1) >> 3);
    v144 = (v136 - 1) & 7;
    v145 = dword_628660[2 * v144];
    v146 = dword_628664[2 * v144];
    dword_62A920[v132] = v141;
    v147 = v145 & dword_68F560[v143];
    dword_62A92C[v132] = v146 & dword_68F564[v143];
    v148 = v145 & dword_68EEC0[v143];
    dword_68C86C[v132] = v146 & dword_68EEC4[v143];
    v149 = 2 * (v136 >> 3);
    dword_68C868[v132] = v148;
    dword_62A928[v132] = v147;
    v150 = v136 & 7;
    v151 = dword_628660[2 * v150];
    v152 = dword_628664[2 * v150];
    v153 = v151 & dword_68F560[v149];
    dword_62A934[v132] = v152 & dword_68F564[v149];
    v154 = v151 & dword_68EEC0[v149];
    dword_68C874[v132] = v152 & dword_68EEC4[v149];
    v155 = 2 * ((v136 + 1) >> 3);
    v156 = (v136 + 1) & 7;
    dword_68C870[v132] = v154;
    v157 = dword_628660[2 * v156];
    v158 = dword_628664[2 * v156];
    dword_62A930[v132] = v153;
    v159 = v157 & dword_68F560[v155];
    v160 = v157;
    v161 = v158 & dword_68F564[v155];
    dword_62A938[v132] = v159;
    dword_62A93C[v132] = v161;
    v162 = v160 & dword_68EEC0[v155];
    v136 += 4;
    dword_68C87C[v132] = v158 & dword_68EEC4[v155];
    dword_68C878[v132] = v162;
    v132 += 8;
  }
  while ( v136 - 2 <= 63 );
  v388 = 0;
  v163 = (signed int)&dword_791B40;
  do
  {
    v164 = v388 & 7;
    v165 = v388 >> 3;
    v382 = v388 & 7;
    *(_DWORD *)v163 = 0;
    *(_DWORD *)(v163 + 4) = 0;
    if ( v164 > 3 )
    {
      if ( v164 > 0 )
      {
        v174 = 8 * v165;
        do
        {
          if ( v174 >= 56 )
            break;
          --v164;
          v174 += 8;
          v175 = dword_628424[2 * (v174 + v164)];
          *(_DWORD *)v163 |= dword_628420[2 * (v174 + v164)];
          *(_DWORD *)(v163 + 4) |= v175;
        }
        while ( v164 > 0 );
      }
      v176 = v388 & 7;
      if ( v382 > 0 )
      {
        v177 = v388 >> 3;
        v178 = 8 * v165;
        do
        {
          if ( v177 <= 0 )
            break;
          --v176;
          v178 -= 8;
          v179 = dword_628424[2 * (v178 + v176)];
          *(_DWORD *)v163 |= dword_628420[2 * (v178 + v176)];
          *(_DWORD *)(v163 + 4) |= v179;
          --v177;
        }
        while ( v176 > 0 );
      }
    }
    else
    {
      if ( v164 < 7 )
      {
        v166 = v388 >> 3;
        v167 = 8 * v165;
        do
        {
          if ( v166 >= 7 )
            break;
          ++v164;
          v167 += 8;
          v168 = dword_628424[2 * (v167 + v164)];
          *(_DWORD *)v163 |= dword_628420[2 * (v167 + v164)];
          *(_DWORD *)(v163 + 4) |= v168;
          v165 = v388 >> 3;
          ++v166;
        }
        while ( v164 < 7 );
      }
      v169 = v388 & 7;
      v170 = v165;
      if ( v382 < 7 )
      {
        do
        {
          if ( v170 <= 0 )
            break;
          ++v169;
          --v170;
          v171 = v169 + 8 * v170;
          v172 = dword_628420[2 * v171];
          v173 = dword_628424[2 * v171];
          *(_DWORD *)v163 |= v172;
          *(_DWORD *)(v163 + 4) |= v173;
        }
        while ( v169 < 7 );
      }
    }
    ++v388;
    v163 += 8;
  }
  while ( v163 <= (signed int)&unk_791D38 );
  v180 = 2;
  v181 = &unk_68C668;
  do
  {
    v182 = (v180 - 2) >> 3;
    v183 = (v180 - 2) & 7;
    v184 = dword_42A708[2 * v183] & dword_62AD20[2 * v182];
    *((_DWORD *)v181 - 1) = dword_42A70C[2 * v183] & dword_62AD24[2 * v182];
    v185 = (v180 - 1) >> 3;
    v186 = (v180 - 1) & 7;
    *((_DWORD *)v181 - 2) = v184;
    v187 = dword_42A708[2 * v186] & dword_62AD20[2 * v185];
    v188 = dword_42A70C[2 * v186] & dword_62AD24[2 * v185];
    *(_DWORD *)v181 = v187;
    *((_DWORD *)v181 + 1) = v188;
    v189 = v180 & 7;
    v190 = dword_42A708[2 * v189] & dword_62AD20[2 * (v180 >> 3)];
    *((_DWORD *)v181 + 3) = dword_42A70C[2 * v189] & dword_62AD24[2 * (v180 >> 3)];
    v191 = (v180 + 1) >> 3;
    *((_DWORD *)v181 + 2) = v190;
    v192 = (v180 + 1) & 7;
    v193 = dword_42A708[2 * v192] & dword_62AD20[2 * v191];
    v194 = dword_42A70C[2 * v192] & dword_62AD24[2 * v191];
    v180 += 4;
    *((_DWORD *)v181 + 4) = v193;
    *((_DWORD *)v181 + 5) = v194;
    v181 = (char *)v181 + 32;
  }
  while ( v180 - 2 <= 63 );
  v195 = 2;
  v196 = &unk_62AB28;
  do
  {
    v197 = (v195 - 2) >> 3;
    v198 = (v195 - 2) & 7;
    v199 = dword_42A708[2 * v198] & dword_62A4E0[2 * v197];
    *((_DWORD *)v196 - 1) = dword_42A70C[2 * v198] & dword_62A4E4[2 * v197];
    v200 = (v195 - 1) >> 3;
    v201 = (v195 - 1) & 7;
    *((_DWORD *)v196 - 2) = v199;
    v202 = dword_42A708[2 * v201] & dword_62A4E0[2 * v200];
    v203 = dword_42A70C[2 * v201] & dword_62A4E4[2 * v200];
    *(_DWORD *)v196 = v202;
    *((_DWORD *)v196 + 1) = v203;
    v204 = v195 & 7;
    v205 = dword_42A708[2 * v204] & dword_62A4E0[2 * (v195 >> 3)];
    *((_DWORD *)v196 + 3) = dword_42A70C[2 * v204] & dword_62A4E4[2 * (v195 >> 3)];
    v206 = (v195 + 1) >> 3;
    *((_DWORD *)v196 + 2) = v205;
    v207 = (v195 + 1) & 7;
    v208 = dword_42A708[2 * v207] & dword_62A4E0[2 * v206];
    v209 = dword_42A70C[2 * v207] & dword_62A4E4[2 * v206];
    v195 += 4;
    *((_DWORD *)v196 + 4) = v208;
    *((_DWORD *)v196 + 5) = v209;
    v196 = (char *)v196 + 32;
  }
  while ( v195 - 2 <= 63 );
  v210 = 0;
  v211 = 0;
  do
  {
    v212 = v211 & 7;
    v213 = dword_42A70C[2 * v212] ^ ((unsigned __int64)(1i64 << v211) >> 32);
    dword_68FDA0[2 * v211] = dword_42A708[2 * v212] ^ (unsigned __int64)(1i64 << v211);
    dword_68FDA4[2 * v211++] = v213;
  }
  while ( v211 <= 63 );
  v389 = 0;
  v214 = (signed int)&dword_684440;
  do
  {
    v215 = 0;
    do
    {
      v216 = v215 + ((unsigned __int8)byte_42A608[v389] << 6);
      v217 = dword_67C440[2 * v216];
      v218 = dword_67C444[2 * v216];
      v219 = v218 | dword_67C440[2 * v216];
      v350 = v217;
      v357 = v218;
      *(_DWORD *)v214 = v210;
      *(_DWORD *)(v214 + 4) = v210;
      if ( v219 )
      {
        do
        {
          _EAX = v350;
          if ( v350 )
          {
            __asm { bsf     eax, eax }
          }
          else
          {
            __asm { bsf     eax, dword ptr [ebp+var_28+4] }
            _EAX = _EAX + 32;
          }
          v227 = dword_43A918[_EAX];
          v228 = dword_628420[2 * v227];
          *(_DWORD *)(v214 + 4) |= dword_628424[2 * v227];
          *(_DWORD *)v214 |= v228;
          v229 = __CFADD__(v217, -1) + v218 - 1;
          v217 &= v217 - 1;
          v218 &= v229;
          v350 = v217;
          v357 = v218;
        }
        while ( v218 | v217 );
        v210 = 0;
      }
      ++v215;
      v214 += 8;
    }
    while ( v215 < 64 );
    ++v389;
  }
  while ( v214 <= (signed int)&unk_68C240 );
  v383 = v210;
  do
  {
    v390 = 0;
    v366 = v383 >> 1;
    do
    {
      v230 = dword_43AC18[v390];
      v231 = *(_DWORD *)&dword_43AB18[4 * v390];
      v232 = v366 + (dword_43AA18[v390] << 6);
      v351 = 0i64;
      dword_674440[2 * v232] = 0;
      dword_674444[2 * v232] = 0;
      if ( v231 < v230 )
      {
        v233 = 1 << (*(_DWORD *)&dword_43AB18[4 * v390] + 1);
        v234 = (unsigned __int64)(1 << (*(_DWORD *)&dword_43AB18[4 * v390] + 1)) >> 32;
        if ( 1 << (*(_DWORD *)&dword_43AB18[4 * v390] + 1) < (unsigned __int64)(1 << v230) )
        {
          do
          {
            LODWORD(v351) = v233 | v351;
            HIDWORD(v351) |= v234;
            if ( v234 & ((unsigned __int64)v383 >> 32) | v233 & (unsigned int)v383 )
              break;
            v234 = __PAIR__(v234, v233) >> 31;
            v233 *= 2;
          }
          while ( __PAIR__(v234, v233) < 1 << v230 );
        }
      }
      if ( *(_DWORD *)&dword_43AB18[4 * v390] > 0 )
      {
        v235 = *(_DWORD *)&dword_43AB18[4 * v390] - 1;
        v236 = (unsigned __int64)(1 << v235) >> 32;
        v237 = 1 << v235;
        if ( v236 || v237 )
        {
          while ( 1 )
          {
            LODWORD(v351) = v237 | v351;
            HIDWORD(v351) |= v236;
            if ( v236 & ((unsigned __int64)v383 >> 32) | v237 & (unsigned int)v383 )
              break;
            v237 = __PAIR__(v236, v237) >> 1;
            v236 >>= 1;
            if ( !v236 )
            {
              if ( !v237 )
                break;
            }
          }
        }
      }
      v238 = v390;
      _QAX = v351 << ((unsigned __int8)v390 - dword_43AB18[4 * v390]);
      v240 = v351 << ((unsigned __int8)v390 - dword_43AB18[4 * v390]);
      v352 = _QAX;
      if ( _QAX )
      {
        do
        {
          v241 = v352;
          if ( (_DWORD)v352 )
          {
            __asm { bsf     eax, eax }
          }
          else
          {
            __asm { bsf     eax, dword ptr [ebp+var_28+4] }
            LODWORD(_QAX) = _QAX + 32;
          }
          LODWORD(_QAX) = dword_43AA18[(signed int)_QAX];
          v242 = dword_628420[2 * (signed int)_QAX];
          LODWORD(_QAX) = dword_628424[2 * (signed int)_QAX];
          v243 = v366 + (dword_43AA18[v390] << 6);
          dword_674440[2 * v243] |= v242;
          dword_674444[2 * v243] |= _QAX;
          LODWORD(_QAX) = __CFADD__(v240, -1) + HIDWORD(_QAX) - 1;
          v240 &= v240 - 1;
          HIDWORD(_QAX) &= _QAX;
          v352 = __PAIR__(HIDWORD(_QAX), v240);
        }
        while ( HIDWORD(_QAX) | v240 );
      }
      ++v390;
    }
    while ( v238 + 1 <= 63 );
    v383 += 2;
  }
  while ( v383 < 128 );
  v384 = 0;
  do
  {
    v391 = 0;
    v367 = v384 >> 1;
    do
    {
      v244 = dword_43AC18[v391];
      v245 = *(_DWORD *)&dword_43AB18[4 * v391];
      v246 = v367 + (dword_43AD18[v391] << 6);
      v353 = 0i64;
      dword_66C440[2 * v246] = 0;
      dword_66C444[2 * v246] = 0;
      if ( v245 < v244 )
      {
        v247 = 1 << (*(_DWORD *)&dword_43AB18[4 * v391] + 1);
        v248 = (unsigned __int64)(1 << (*(_DWORD *)&dword_43AB18[4 * v391] + 1)) >> 32;
        if ( 1 << (*(_DWORD *)&dword_43AB18[4 * v391] + 1) < (unsigned __int64)(1 << v244) )
        {
          do
          {
            LODWORD(v353) = v247 | v353;
            HIDWORD(v353) |= v248;
            if ( v248 & ((unsigned __int64)v384 >> 32) | v247 & (unsigned int)v384 )
              break;
            v248 = __PAIR__(v248, v247) >> 31;
            v247 *= 2;
          }
          while ( __PAIR__(v248, v247) < 1 << v244 );
        }
      }
      if ( *(_DWORD *)&dword_43AB18[4 * v391] > 0 )
      {
        v249 = *(_DWORD *)&dword_43AB18[4 * v391] - 1;
        v250 = (unsigned __int64)(1 << v249) >> 32;
        v251 = 1 << v249;
        if ( v250 || v251 )
        {
          while ( 1 )
          {
            LODWORD(v353) = v251 | v353;
            HIDWORD(v353) |= v250;
            if ( v250 & ((unsigned __int64)v384 >> 32) | v251 & (unsigned int)v384 )
              break;
            v251 = __PAIR__(v250, v251) >> 1;
            v250 >>= 1;
            if ( !v250 )
            {
              if ( !v251 )
                break;
            }
          }
        }
      }
      v252 = v391;
      v254 = v353 << ((unsigned __int8)v391 - dword_43AB18[4 * v391]);
      v354 = v353 << ((unsigned __int8)v391 - dword_43AB18[4 * v391]);
      v253 = HIDWORD(v354);
      if ( v354 )
      {
        do
        {
          _EAX = v354;
          if ( (_DWORD)v354 )
          {
            __asm { bsf     eax, eax }
          }
          else
          {
            __asm { bsf     eax, dword ptr [ebp+var_28+4] }
            _EAX = _EAX + 32;
          }
          v258 = dword_43AD18[_EAX];
          v259 = dword_628420[2 * v258];
          v260 = dword_628424[2 * v258];
          v261 = v367 + (dword_43AD18[v391] << 6);
          dword_66C440[2 * v261] |= v259;
          dword_66C444[2 * v261] |= v260;
          v262 = __CFADD__(v254, -1) + v253 - 1;
          v254 &= v254 - 1;
          v253 &= v262;
          v354 = __PAIR__(v253, v254);
        }
        while ( v253 | v254 );
      }
      ++v391;
    }
    while ( v252 + 1 <= 63 );
    v384 += 2;
  }
  while ( v384 < 128 );
  v392 = 0;
  do
  {
    v263 = 0;
    v264 = (v392 & 7) + 56;
    dword_66BE40[2 * v392] = 0;
    dword_66BE44[2 * v392] = 0;
    dword_6901A0[2 * v392] = 0;
    dword_6901A4[2 * v392] = 0;
    v265 = v392 + 8;
    if ( (v392 & 0xFFFFFFF8) != 8 )
      v265 = v392;
    v385 = v264 & 7;
    v266 = (v265 & 7) - (v264 & 7);
    v368 = (HIDWORD(v266) ^ v266) - HIDWORD(v266);
    v360 = v264 >> 3;
    v376 = abs((v265 >> 3) - (v264 >> 3));
    do
    {
      v267 = v376;
      if ( v368 >= v376 )
        v267 = v368;
      v268 = abs(v385 - (v263 & 7));
      v269 = abs(v360 - (v263 >> 3));
      v270 = v268;
      if ( v268 < v269 )
        v270 = v269;
      if ( v267 < v270 - 1 )
      {
        dword_66BE40[2 * v392] |= 1i64 << v263;
        dword_66BE44[2 * v392] |= (unsigned __int64)(1i64 << v263) >> 32;
      }
      v271 = v368;
      if ( v368 < v376 )
        v271 = v376;
      if ( v268 < v269 )
        v268 = v269;
      if ( v271 < v268 )
      {
        v272 = v392;
        dword_6901A0[2 * v272] |= 1i64 << v263;
        dword_6901A4[2 * v272] |= (unsigned __int64)(1i64 << v263) >> 32;
      }
      ++v263;
    }
    while ( v263 <= 63 );
    ++v392;
  }
  while ( v392 <= 63 );
  v393 = 0;
  do
  {
    dword_48BAC0[2 * v393] = 0;
    dword_48BAC4[2 * v393] = 0;
    dword_68C440[2 * v393] = 0;
    dword_68C444[2 * v393] = 0;
    v273 = v393 & 7;
    v274 = v393 - 8;
    if ( (v393 & 0xFFFFFFF8) != 48 )
      v274 = v393;
    v275 = (v274 & 7) - (v393 & 7);
    v369 = (HIDWORD(v275) ^ v275) - HIDWORD(v275);
    v276 = 0;
    v361 = v273 >> 3;
    v377 = abs((v274 >> 3) - (v273 >> 3));
    do
    {
      v277 = v377;
      if ( v369 >= v377 )
        v277 = v369;
      v278 = abs((v393 & 7) - (v276 & 7));
      v279 = abs(v361 - (v276 >> 3));
      v280 = v278;
      if ( v278 < v279 )
        v280 = v279;
      if ( v277 < v280 - 1 )
      {
        dword_68C440[2 * v393] |= 1i64 << v276;
        dword_68C444[2 * v393] |= (unsigned __int64)(1i64 << v276) >> 32;
      }
      v281 = v369;
      if ( v369 < v377 )
        v281 = v377;
      if ( v278 < v279 )
        v278 = v279;
      if ( v281 < v278 )
      {
        v282 = v393;
        dword_48BAC0[2 * v282] |= 1i64 << v276;
        dword_48BAC4[2 * v282] |= (unsigned __int64)(1i64 << v276) >> 32;
      }
      ++v276;
    }
    while ( v276 <= 63 );
    ++v393;
  }
  while ( v393 <= 63 );
  v283 = 0;
  do
  {
    v284 = v283 & 7;
    dword_791940[2 * v283] = 0;
    dword_791944[2 * v283] = 0;
    dword_62A720[2 * v283] = 0;
    dword_62A724[2 * v283] = 0;
    if ( v283 & 7 && v284 != 7 )
    {
      v285 = dword_628660[2 * v284] | dword_42A708[2 * v284];
      v286 = dword_628664[2 * v284] | dword_42A70C[2 * v284];
    }
    else
    {
      v285 = dword_628660[2 * v284];
      v286 = dword_628664[2 * v284];
    }
    v287 = v283 >> 3;
    if ( v283 >> 3 >= 5 )
    {
      dword_62A720[2 * v283] = 0;
      dword_62A724[2 * v283] = v286 & 0xFF000000;
    }
    if ( v287 >= 4 )
    {
      dword_62A720[2 * v283] = dword_62A720[2 * v283];
      dword_62A724[2 * v283] |= v286 & 0xFF0000;
    }
    if ( v287 <= 2 )
    {
      dword_791940[2 * v283] = (unsigned __int8)v285;
      dword_791944[2 * v283] = 0;
    }
    if ( v287 <= 3 )
    {
      dword_791940[2 * v283] |= v285 & 0xFF00;
      dword_791944[2 * v283] = dword_791944[2 * v283];
    }
    ++v283;
  }
  while ( v283 <= 63 );
  v288 = 0;
  do
  {
    v289 = v288 >> 3;
    if ( v288 >> 3 != 7 && v288 & 7 )
    {
      v290 = dword_628458[2 * v288];
      v291 = dword_62845C[2 * v288];
    }
    else
    {
      v290 = 0;
      v291 = 0;
    }
    dword_791D40[2 * v288] = v290;
    dword_791D44[2 * v288] = v291;
    if ( v289 == 7 || (v288 & 7) == 7 )
    {
      v292 = 0;
      v293 = 0;
    }
    else
    {
      v292 = dword_628468[2 * v288];
      v293 = dword_62846C[2 * v288];
    }
    dword_62A0C0[2 * v288] = v292;
    dword_62A0C4[2 * v288] = v293;
    if ( v289 && v288 & 7 )
    {
      v294 = dword_6283D8[2 * v288];
      v295 = dword_6283DC[2 * v288];
    }
    else
    {
      v294 = 0;
      v295 = 0;
    }
    dword_6298C0[2 * v288] = v294;
    dword_6298C4[2 * v288] = v295;
    if ( v289 && (v288 & 7) != 7 )
    {
      v296 = dword_6283E8[2 * v288];
      v297 = dword_6283EC[2 * v288];
    }
    else
    {
      v296 = 0;
      v297 = 0;
    }
    dword_68F5A0[2 * v288] = v296;
    dword_68F5A4[2 * v288++] = v297;
  }
  while ( v288 <= 63 );
  v298 = 0;
  v394 = 0;
  do
  {
    v386 = v298 & 7;
    v299 = 0;
    v355 = dword_628420[2 * v298];
    v300 = v298 >> 3;
    v378 = v298 >> 3;
    v358 = dword_628424[2 * v298];
    v301 = &dword_483660[2 * v298];
    while ( 1 )
    {
      v302 = dword_68CCC4[2 * v299];
      *v301 = dword_68CCC0[2 * v299];
      v303 = v299 >> 3;
      v301[1] = v302;
      if ( v299 >> 3 == v300 )
      {
        if ( v299 & 7 )
        {
          *v301 ^= dword_628418[2 * v299];
          v301[1] ^= dword_62841C[2 * v299];
        }
        if ( (v299 & 7) != 7 )
        {
          *v301 ^= dword_628428[2 * v299];
          v301[1] ^= dword_62842C[2 * v299];
        }
      }
      v304 = v299 & 7;
      if ( v304 == v386 )
      {
        if ( v303 )
        {
          *v301 ^= dword_6283E0[2 * v299];
          v301[1] ^= dword_6283E4[2 * v299];
        }
        if ( v303 != 7 )
        {
          *v301 ^= dword_628460[2 * v299];
          v301[1] ^= dword_628464[2 * v299];
        }
      }
      if ( v303 - v300 == v304 - v386 )
      {
        if ( v303 != 7 && v304 != 7 )
        {
          *v301 ^= dword_628468[2 * v299];
          v301[1] ^= dword_62846C[2 * v299];
        }
        if ( v303 && v299 & 7 )
        {
          *v301 ^= dword_6283D8[2 * v299];
          v301[1] ^= dword_6283DC[2 * v299];
        }
      }
      if ( v303 - v300 == v386 - v304 )
      {
        if ( v303 != 7 && v299 & 7 )
        {
          *v301 ^= dword_628458[2 * v299];
          v301[1] ^= dword_62845C[2 * v299];
        }
        if ( v303 && v304 != 7 )
        {
          *v301 ^= dword_6283E8[2 * v299];
          v301[1] ^= dword_6283EC[2 * v299];
        }
      }
      if ( dword_68CCC4[2 * v299] & v358 | dword_68CCC0[2 * v299] & v355 )
      {
        *v301 |= v355;
        v301[1] |= v358;
      }
      ++v299;
      v301 += 128;
      if ( v299 > 63 )
        break;
      v300 = v378;
    }
    v298 = v394 + 1;
    v394 = v298;
  }
  while ( v298 <= 63 );
  v305 = 0;
  v306 = 0;
  do
  {
    v307 = 0;
    dword_48BCC0[v306] = 0;
    dword_48BCC4[v306] = 0;
    dword_68F120[v306] = 0;
    dword_68F124[v306] = 0;
    if ( v305 > 0 )
    {
      v308 = 0;
      do
      {
        v308 |= dword_42A708[2 * v307];
        dword_68F124[v306] |= dword_42A70C[2 * v307++];
      }
      while ( v307 < v305 );
      dword_68F120[v306] = v308;
    }
    ++v305;
    if ( v305 <= 7 )
    {
      v309 = (char *)&unk_42A710 + v306 * 4;
      v310 = 0;
      do
      {
        v310 |= *(_DWORD *)v309;
        dword_48BCC4[v306] |= *((_DWORD *)v309 + 1);
        v309 += 8;
      }
      while ( (signed int)v309 <= (signed int)&unk_42A740 );
      dword_48BCC0[v306] = v310;
    }
    v306 += 2;
  }
  while ( v306 <= 14 );
  v395 = 0;
  do
  {
    v356 = dword_628420[2 * v395];
    v387 = v395 & 7;
    v311 = 0;
    v359 = dword_628424[2 * v395];
    v379 = v395 >> 3;
    v312 = &dword_47B640[2 * v395];
    do
    {
      *v312 = v356;
      v312[1] = v359;
      v370 = 0;
      if ( v311 >> 3 == v379 )
        v370 = 2 * (v311 > v395) - 1;
      v313 = v311 & 7;
      if ( v313 == v387 )
        v370 = (((v311 <= v395) - 1) & 0x10) - 8;
      v314 = (v311 >> 3) - v379;
      if ( v314 == v313 - v387 )
        v370 = (((v311 <= v395) - 1) & 0x12) - 9;
      if ( v314 == v387 - v313 )
      {
        v370 = (((v311 <= v395) - 1) & 0xE) - 7;
      }
      else
      {
        if ( !v370 )
          goto LABEL_302;
      }
      for ( i = v395; i != v311; *(_QWORD *)v312 |= v316 )
      {
        v316 = 1i64 << i;
        i += v370;
      }
LABEL_302:
      ++v311;
      v312 += 128;
    }
    while ( v311 <= 63 );
    ++v395;
  }
  while ( v395 <= 63 );
  v317 = 0;
  do
  {
    v318 = v317 & 7;
    v319 = dword_42A708[2 * v318] | dword_42A6C8[2 * (v317 >> 3)];
    dword_68F364[2 * v317] = dword_42A70C[2 * v318] | dword_42A6CC[2 * (v317 >> 3)];
    v320 = v317 & 7;
    v380 = v317 >> 3;
    dword_68F360[2 * v317] = v319;
    dword_68CA60[2 * v317] = 0;
    dword_68CA64[2 * v317] = 0;
    if ( v320 <= 7 )
    {
      v321 = (v317 >> 3) - v318;
      v322 = v321 + v320;
      v371 = v321 + v320;
      v362 = 8 * (v321 + v320);
      while ( v322 <= 7 )
      {
        v323 = 1i64 << ((unsigned __int8)v362 + (unsigned __int8)v320);
        dword_68CA60[2 * v317] |= v323;
        dword_68CA64[2 * v317] |= HIDWORD(v323);
        v362 += 8;
        ++v371;
        ++v320;
        if ( v320 > 7 )
          break;
        v322 = v371;
      }
    }
    v324 = v317 & 7;
    v372 = v317 >> 3;
    if ( v318 <= 7 )
    {
      do
      {
        if ( v372 < 0 )
          break;
        v325 = 1i64 << ((unsigned __int8)v324 + 8 * (unsigned __int8)v372);
        dword_68CA60[2 * v317] |= v325;
        dword_68CA64[2 * v317] |= HIDWORD(v325);
        --v372;
        ++v324;
      }
      while ( v324 <= 7 );
    }
    v326 = v317 & 7;
    v373 = 8 * v380;
    do
    {
      if ( v373 > 56 )
        break;
      v327 = 1i64 << ((unsigned __int8)v326 + (unsigned __int8)v373);
      dword_68CA60[2 * v317] |= v327;
      dword_68CA64[2 * v317] |= HIDWORD(v327);
      v373 += 8;
      --v326;
    }
    while ( v326 >= 0 );
    v328 = v317 & 7;
    v329 = v317 >> 3;
    v363 = v317 >> 3;
    v330 = 8 * v380;
    while ( v329 >= 0 )
    {
      v331 = 1i64 << ((unsigned __int8)v330 + (unsigned __int8)v328);
      dword_68CA60[2 * v317] |= v331;
      dword_68CA64[2 * v317] |= HIDWORD(v331);
      --v363;
      v330 -= 8;
      --v328;
      if ( v328 < 0 )
        break;
      v329 = v363;
    }
    v332 = dword_62A2E0[2 * v317];
    dword_68CA60[2 * v317] &= v332;
    v333 = dword_62A2E4[2 * v317];
    dword_68F360[2 * v317] &= v332;
    dword_68CA64[2 * v317] &= v333;
    dword_68F364[2 * v317] &= v333;
    v334 = dword_68F360[2 * v317];
    v335 = dword_68F364[2 * v317];
    v336 = v335;
    v337 = dword_68CA64[2 * v317] | v335;
    dword_6296A0[2 * v317] = ~dword_68F360[2 * v317];
    v338 = dword_68CA60[2 * v317];
    dword_6296A4[2 * v317] = ~v336;
    v339 = ~dword_68CA64[2 * v317];
    dword_7916C0[2 * v317] = ~v338;
    dword_7916C4[2 * v317] = v339;
    dword_66C040[2 * v317] = v338 | v334;
    dword_66C044[2 * v317++] = v337;
  }
  while ( v317 <= 63 );
  v340 = 0;
  v374 = 0;
  do
  {
    v341 = 0;
    v342 = &byte_6286A0[v340];
    do
    {
      *v342 = 37;
      if ( v341 != v340 )
      {
        v343 = v340 >> 3;
        if ( v343 == v341 >> 3 )
          *v342 = 2;
        v344 = v374 & 7;
        v345 = v341 & 7;
        if ( v344 == v345 )
          *v342 = 3;
        v346 = (v341 >> 3) - v343;
        if ( v345 - v344 == v346 )
          *v342 = 1;
        if ( v344 - v345 == v346 )
          *v342 = 0;
      }
      v340 = v374;
      ++v341;
      v342 += 64;
    }
    while ( v341 <= 63 );
    v340 = v374 + 1;
    v374 = v340;
  }
  while ( v340 <= 63 );
  return sub_41A490();
}
RobboLito pile_initialization() (stack.c)

Code: Select all

void pile_initialization()
    {
    int qu2, l, w, i, qu = 0, j, u, co, tr, re, dir;
    uint64 T, b, s;

    for ( i = A1; i <= H8; i++ )
        {
        turn_left45[i] = TURN[left45[i]];
        turn_straight45[i] = TURN[straight45[i]];
        }

    for ( i = A1; i <= H8; i++ )
        {
        turn_normal[i] = 1 + (i & 56);
        turn_left90[i] = 1 + (left90[i] & 56);
        }

    for ( i = 1; i <= 8; i++ )
        for ( j = 1; j <= i; j++ )
            {
            LENGTH[qu] = i;
            WHERE[qu++] = j - 1;
            }

    for ( i = 7; i >= 1; i-- )
        for ( j = 1; j <= i; j++ )
            {
            LENGTH[qu] = i;
            WHERE[qu++] = j - 1;
            }

    for ( i = A1; i <= H8; i++ )
        {
        left54[left45[i]] = i;
        left09[left90[i]] = i;
        straight54[straight45[i]] = i;
        }

    for ( i = A1; i <= H8; i++ )
        {
        square_fixed[i] = 0;
        bitFIXED(i, square_fixed[i]);
        square_free[i] = ~square_fixed[i];
        }

    for ( i = A1; i <= H8; i++ )
        {
        left90_fixed[i] = 0;
        bitFIXED(left90[i], left90_fixed[i]);
        left90_reset[i] = ~left90_fixed[i];
        left45_fixed[i] = 0;
        bitFIXED(left45[i], left45_fixed[i]);
        left45_reset[i] = ~left45_fixed[i];
        straight45_fixed[i] = 0;
        bitFIXED(straight45[i], straight45_fixed[i]);
        straight45_reset[i] = ~straight45_fixed[i];
        }

    for ( i = A1; i <= H8; i++ )
        {
        attack_knight[i] = 0;

        for ( j = 0; j < 8; j++ )
            {
            qu = i + JUMP[j];

            if( (qu < A1) || (qu > H8) )
                continue;

            if( (file_detach(i, qu) > 2) || (rank_detach(i, qu) > 2) )
                continue;

            bitFIXED(qu, attack_knight[i]);
            }
        }

    for ( i = A1; i <= H8; i++ )
        {
        attack_king[i] = 0;

        for ( j = A1; j <= H8; j++ )
            {
            if( MAXIMUM(file_detach(i, j), rank_detach(i, j)) == 1 )
                bitFIXED(j, attack_king[i]);
            }
        }

    for ( i = A1; i <= H1; i++ )
        {
        attack_pawn_white[i] = 0;
        attack_pawn_black[i] = square_fixed[i + 7] | square_fixed[i + 9];
        }

    for ( i = A2; i <= H7; i++ )
        {
        attack_pawn_white[i] = square_fixed[i - 7] | square_fixed[i - 9];
        attack_pawn_black[i] = square_fixed[i + 7] | square_fixed[i + 9];
        }

    for ( i = A8; i <= H8; i++ )
        {
        attack_pawn_black[i] = 0;
        attack_pawn_white[i] = square_fixed[i - 7] | square_fixed[i - 9];
        }

    for ( i = A1; i <= A8; i += 8 )
        {
        attack_pawn_white[i] = square_fixed[i - 7];
        attack_pawn_black[i] = square_fixed[i + 9];
        }

    for ( i = H1; i <= H8; i += 8 )
        {
        attack_pawn_white[i] = square_fixed[i - 9];
        attack_pawn_black[i] = square_fixed[i + 7];
        }
    attack_pawn_white[A1] = 0;
    attack_pawn_white[A2] = square_fixed[B1];
    attack_pawn_black[A7] = square_fixed[B8];
    attack_pawn_black[A8] = 0;
    attack_pawn_white[H1] = 0;
    attack_pawn_white[H2] = square_fixed[G1];
    attack_pawn_black[H7] = square_fixed[G8];
    attack_pawn_black[H8] = 0;

    file_isolated[CA] = FILEb;
    file_isolated[CH] = FILEg;

    for ( co = CB; co <= CG; co++ )
        file_isolated[co] = pile_file[co - 1] | pile_file[co + 1];

    for ( qu = A1; qu <= H8; qu++ )
        {
        pile_isolated_white[qu] = 0;
        pile_isolated_black[qu] = 0;
        co = FILE(qu);
        tr = RANK(qu);

        if( tr < T8 )
            pile_isolated_white[qu] |= file_isolated[co] & pile_rank[tr + 1];

        if( tr < T7 )
            pile_isolated_white[qu] |= file_isolated[co] & pile_rank[tr + 2];

        if( tr > T1 )
            pile_isolated_black[qu] |= file_isolated[co] & pile_rank[tr - 1];

        if( tr > T2 )
            pile_isolated_black[qu] |= file_isolated[co] & pile_rank[tr - 2];
        pawn_connected[qu] = pile_isolated_white[qu] | pile_isolated_black[qu] | (pile_rank[tr]&file_isolated[co]);
        }

    for ( tr = T1; tr <= T8; tr++ )
        {
        infront_white[tr] = 0;

        for ( j = tr + 1; j <= T8; j++ )
            infront_white[tr] |= pile_rank[j];
        not_infront_white[tr] = ~infront_white[tr];
        }

    for ( tr = T8; tr >= T1; tr-- )
        {
        infront_black[tr] = 0;

        for ( j = tr - 1; j >= T1; j-- )
            infront_black[tr] |= pile_rank[j];
        not_infront_black[tr] = ~infront_black[tr];
        }

    for ( u = 0; u < 128; u += 2 )
        for ( co = CA; co <= CH; co++ )
            {
            T = 0;

            if( co < 7 )
                {
                s = 1 << (co + 1);

                while( s < 256 )
                    {
                    T |= s;

                    if( u & s )
                        break;

                    s <<= 1;
                    }
                }

            if( co > 0 )
                {
                s = 1 << (co - 1);

                while( s > 0 )
                    {
                    T |= s;

                    if( u & s )
                        break;

                    s >>= 1;
                    }
                }

            for ( i = 0; i < 8; i++ )
                attack_normal[co + 8 * i][u >> 1] = T << (8 * i);
            }

    for ( qu = A1; qu <= H8; qu++ )
        {
        pawn_free_white[qu] = (file_isolated[FILE(qu)] | pile_file[FILE(qu)]) & infront_white[RANK(qu)];
        pawn_free_black[qu] = (file_isolated[FILE(qu)] | pile_file[FILE(qu)]) & infront_black[RANK(qu)];
        }

    for ( qu = A1; qu <= H8; qu++ )
        {
        if( FILE(qu) >= CC )
            west_2[qu] = square_fixed[qu - 2];
        else
            west_2[qu] = 0;

        if( FILE(qu) <= CF )
            east_2[qu] = square_fixed[qu + 2];
        else
            east_2[qu] = 0;

        if( FILE(qu) >= CB )
            west_1[qu] = square_fixed[qu - 1];
        else
            west_1[qu] = 0;

        if( FILE(qu) <= CG )
            east_1[qu] = square_fixed[qu + 1];
        else
            east_1[qu] = 0;
        adjacent[qu] = west_1[qu] | east_1[qu];
        }

    for ( qu = A1; qu <= H8; qu++ )
        {
        pawn_protected_white[qu] = (file_isolated[FILE(qu)]) &not_infront_white[RANK(qu)];
        pawn_protected_black[qu] = (file_isolated[FILE(qu)]) &not_infront_black[RANK(qu)];
        }

    for ( qu = A1; qu <= H8; qu++ )
        {
        co = FILE(qu);
        tr = RANK(qu);
        diagonal_length[qu] = 0;

        if( co <= CD )
            {
            while( co < CH && tr < T8 )
                {
                co++;
                tr++;
                diagonal_length[qu] |= square_fixed[8 * tr + co];
                }
            co = FILE(qu);
            tr = RANK(qu);

            while( co < CH && tr > T1 )
                {
                co++;
                tr--;
                diagonal_length[qu] |= square_fixed[8 * tr + co];
                }
            }
        else
            {
            while( co > CA && tr < T8 )
                {
                co--;
                tr++;
                diagonal_length[qu] |= square_fixed[8 * tr + co];
                }
            co = FILE(qu);
            tr = RANK(qu);

            while( co > CA && tr > T1 )
                {
                co--;
                tr--;
                diagonal_length[qu] |= square_fixed[8 * tr + co];
                }
            }
        }

    for ( qu = A1; qu <= H8; qu++ )
        file_open_white[qu] = pile_file[FILE(qu)] & infront_white[RANK(qu)];

    for ( qu = A1; qu <= H8; qu++ )
        file_open_black[qu] = pile_file[FILE(qu)] & infront_black[RANK(qu)];

    for ( qu = A1; qu <= H8; qu++ )
        DOUBLE_[qu] = pile_file[FILE(qu)] ^ (((uint64)1) << qu);

    for ( qu = A1; qu <= H8; qu++ )
        for ( i = 0; i < 64; i++ )
            {
            T = attack_normal[left90[qu]][i];
            attack_left90[qu][i] = 0;

            while( T )
                {
                b = BSF(T);
                attack_left90[qu][i] |= square_fixed[left09[b]];
                bit_FREE(b, T);
                }
            }

    for ( u = 0; u < 128; u += 2 )
        for ( qu = A1; qu <= H8; qu++ )
            {
            T = 0;
            l = LENGTH[qu];
            w = WHERE[qu];
            attack_straight45[straight54[qu]][u >> 1] = 0;

            if( w < l )
                {
                s = 1 << (w + 1);

                while( s < (1 << l) )
                    {
                    T |= s;

                    if( u & s )
                        break;

                    s <<= 1;
                    }
                }

            if( w > 0 )
                {
                s = 1 << (w - 1);

                while( s > 0 )
                    {
                    T |= s;

                    if( u & s )
                        break;

                    s >>= 1;
                    }
                }
            T <<= (qu - w);

            while( T )
                {
                b = BSF(T);
                attack_straight45[straight54[qu]][u >> 1] |= square_fixed[straight54[b]];
                bit_FREE(b, T);
                }
            }

    for ( u = 0; u < 128; u += 2 )
        for ( qu = A1; qu <= H8; qu++ )
            {
            T = 0;
            l = LENGTH[qu];
            w = WHERE[qu];
            attack_left45[left54[qu]][u >> 1] = 0;

            if( w < l )
                {
                s = 1 << (w + 1);

                while( s < (1 << l) )
                    {
                    T |= s;

                    if( u & s )
                        break;

                    s <<= 1;
                    }
                }

            if( w > 0 )
                {
                s = 1 << (w - 1);

                while( s > 0 )
                    {
                    T |= s;

                    if( u & s )
                        break;

                    s >>= 1;
                    }
                }
            T <<= (qu - w);

            while( T )
                {
                b = BSF(T);
                attack_left45[left54[qu]][u >> 1] |= square_fixed[left54[b]];
                bit_FREE(b, T);
                }
            }

#define DISTANCE(i, j) \
    ( MAXIMUM (file_detach (i, j), rank_detach (i, j)) )

    for ( qu = A1; qu <= H8; qu++ )
        {
        quadrant_black_move_white[qu] = quadrant_black_move_black[qu] = 0;
        j = (qu & 7) + 56;

        if( RANK(qu) == T2 )
            qu2 = qu + 8;
        else
            qu2 = qu;

        for ( i = A1; i <= H8; i++ )
            {
            if( DISTANCE(qu2, j) < DISTANCE(j, i) - 1 )
                bitFIXED(i, quadrant_black_move_black[qu]);

            if( DISTANCE(qu2, j) < DISTANCE(j, i) )
                bitFIXED(i, quadrant_black_move_white[qu]);
            }
        }

    for ( qu = A1; qu <= H8; qu++ )
        {
        quadrant_white_move_white[qu] = quadrant_white_move_black[qu] = 0;
        j = (qu & 7);

        if( RANK(qu) == T7 )
            qu2 = qu - 8;
        else
            qu2 = qu;

        for ( i = A1; i <= H8; i++ )
            {
            if( DISTANCE(qu2, j) < DISTANCE(j, i) - 1 )
                bitFIXED(i, quadrant_white_move_white[qu]);

            if( DISTANCE(qu2, j) < DISTANCE(j, i) )
                bitFIXED(i, quadrant_white_move_black[qu]);
            }
        }

    for ( qu = A1; qu <= H8; qu++ )
        {
        white_guide[qu] = black_guide[qu] = 0;
        co = FILE(qu);

        if( co == CA || co == CH )
            T = file_isolated[co];
        else
            T = file_isolated[co] | pile_file[co];

        if( RANK(qu) >= T6 )
            white_guide[qu] |= (T &RANK8);

        if( RANK(qu) >= T5 )
            white_guide[qu] |= (T &RANK7);

        if( RANK(qu) <= T3 )
            black_guide[qu] |= (T &RANK1);

        if( RANK(qu) <= T4 )
            black_guide[qu] |= (T &RANK2);
        }

    for ( qu = A1; qu <= H8; qu++ )
        {
        north_west[qu] = (RANK(qu) != T8 && FILE(qu) != CA) ? square_fixed[qu + 7] : 0;
        north_east[qu] = (RANK(qu) != T8 && FILE(qu) != CH) ? square_fixed[qu + 9] : 0;
        south_west[qu] = (RANK(qu) != T1 && FILE(qu) != CA) ? square_fixed[qu - 9] : 0;
        south_east[qu] = (RANK(qu) != T1 && FILE(qu) != CH) ? square_fixed[qu - 7] : 0;
        }

    for ( qu = A1; qu <= H8; qu++ )
        for ( re = A1; re <= H8; re++ )
            {
            EVASION[re][qu] = attack_king[re];

            if( RANK(re) == RANK(qu) )
                {
                if( FILE(re) != CA )
                    EVASION[re][qu] ^= square_fixed[re - 1];

                if( FILE(re) != CH )
                    EVASION[re][qu] ^= square_fixed[re + 1];
                }

            if( FILE(re) == FILE(qu) )
                {
                if( RANK(re) != T1 )
                    EVASION[re][qu] ^= square_fixed[re - 8];

                if( RANK(re) != T8 )
                    EVASION[re][qu] ^= square_fixed[re + 8];
                }

            if( (RANK(re) - RANK(qu)) == (FILE(re) - FILE(qu)) )
                {
                if( RANK(re) != T8 && FILE(re) != CH )
                    EVASION[re][qu] ^= square_fixed[re + 9];

                if( RANK(re) != T1 && FILE(re) != CA )
                    EVASION[re][qu] ^= square_fixed[re - 9];
                }

            if( (RANK(re) - RANK(qu)) == (FILE(qu) - FILE(re)) )
                {
                if( RANK(re) != T8 && FILE(re) != CA )
                    EVASION[re][qu] ^= square_fixed[re + 7];

                if( RANK(re) != T1 && FILE(re) != CH )
                    EVASION[re][qu] ^= square_fixed[re - 7];
                }

            if( attack_king[re] & square_fixed[qu] )
                EVASION[re][qu] |= square_fixed[qu];
            }

    for ( co = CA; co <= CH; co++ )
        {
        files_lefts[co] = files_straights[co] = 0;

        for ( i = CA; i < co; i++ )
            files_lefts[co] |= pile_file[i];

        for ( i = co + 1; i <= CH; i++ )
            files_straights[co] |= pile_file[i];
        }

    for ( qu = A1; qu <= H8; qu++ )
        for ( re = A1; re <= H8; re++ )
            {
            INTERPOSITION[re][qu] = square_fixed[qu];
            dir = 0;

            if( RANK(re) == RANK(qu) )
                {
                if( re > qu )
                    dir = 1;
                else
                    dir = -1;
                }

            if( FILE(re) == FILE(qu) )
                {
                if( re > qu )
                    dir = 8;
                else
                    dir = -8;
                }

            if( (RANK(re) - RANK(qu)) == (FILE(re) - FILE(qu)) )
                {
                if( re > qu )
                    dir = 9;
                else
                    dir = -9;
                }

            if( (RANK(re) - RANK(qu)) == (FILE(qu) - FILE(re)) )
                {
                if( re > qu )
                    dir = 7;
                else
                    dir = -7;
                }

            if( dir )
                for ( i = qu; i != re; i += dir )
                    bitFIXED(i, INTERPOSITION[re][qu]);
            }

    for ( qu = A1; qu <= H8; qu++ )
        {
        perpendicular[qu] = pile_rank[RANK(qu)] | pile_file[FILE(qu)];
        diagonal[qu] = 0;

        for ( co = FILE(qu), tr = RANK(qu); co <= CH && tr <= T8; co++, tr++ )
            bitFIXED(8 * tr + co, diagonal[qu]);

        for ( co = FILE(qu), tr = RANK(qu); co <= CH && tr >= T1; co++, tr-- )
            bitFIXED(8 * tr + co, diagonal[qu]);

        for ( co = FILE(qu), tr = RANK(qu); co >= CA && tr <= T8; co--, tr++ )
            bitFIXED(8 * tr + co, diagonal[qu]);

        for ( co = FILE(qu), tr = RANK(qu); co >= CA && tr >= T1; co--, tr-- )
            bitFIXED(8 * tr + co, diagonal[qu]);
        perpendicular[qu] &= square_free[qu];
        diagonal[qu] &= square_free[qu];
        not_perpendicular[qu] = ~perpendicular[qu];
        not_diagonal[qu] = ~diagonal[qu];
        ortodiagonal[qu] = perpendicular[qu] | diagonal[qu];
        }

    for ( j = A1; j <= H8; j++ )
        for ( i = A1; i <= H8; i++ )
            {
            index_line[i][j] = direction_sick;

            if( i == j )
                continue;

            if( RANK(j) == RANK(i) )
                index_line[i][j] = direction_horizontal;

            if( FILE(j) == FILE(i) )
                index_line[i][j] = direction_vertical;

            if( (FILE(i) - FILE(j)) == (RANK(i) - RANK(j)) )
                index_line[i][j] = direction_a1h8;

            if( (FILE(j) - FILE(i)) == (RANK(i) - RANK(j)) )
                index_line[i][j] = direction_h1a8;
            }

    zobrist_init();
    }
The above function then calls zobrist_init() at the end, which since Houdini is modified RobboLito, does the same.

Houdini calls zobrist_init():

Code: Select all

int __cdecl sub_12A1E10()
{
  int v0; // edx@1
  int v1; // edx@1
  int v2; // edx@1
  int v3; // edx@1
  int v4; // edx@1
  unsigned int v5; // edi@1
  signed int v6; // esi@1
  signed int v7; // eax@3
  signed int v8; // esi@8
  signed int v9; // edi@9
  int v10; // edx@10
  signed int v11; // esi@12
  int result; // eax@13
  int v13; // edx@13

  sub_12918F0(dword_13040D8, -1823790641);
  dword_1773118[0] = sub_1291830();
  dword_177311C[0] = v0;
  _mm_storel_pd((double *)qword_1771EF8, 0);
  dword_1771F00 = sub_1291830();
  dword_1771F04 = v1;
  dword_1771F08 = sub_1291830();
  dword_1771F0C = v2;
  dword_1771F18 = sub_1291830();
  dword_1771F1C = v3;
  dword_1771F38 = sub_1291830();
  dword_1771F3C = v4;
  v5 = 0;
  v6 = (signed int)qword_1771EF8;
  do
  {
    if ( (char)(286331153
              * (((v5 - ((v5 >> 1) & 0x55555555)) & 0x33333333)
               + ((((unsigned __int64)(signed int)v5 >> 32)
                 - (((unsigned int)((unsigned __int64)(signed int)v5 >> 32) >> 1) & 0x55555555)) & 0x33333333)
               + (((v5 - ((v5 >> 1) & 0x55555555)) >> 2) & 0x33333333)
               + (((unsigned int)(((unsigned __int64)(signed int)v5 >> 32)
                                - (((unsigned int)((unsigned __int64)(signed int)v5 >> 32) >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 28) >= 2 )
    {
      *(_DWORD *)v6 = 0;
      *(_DWORD *)(v6 + 4) = 0;
      v7 = 1;
      do
      {
        if ( v7 & v5 )
        {
          *(_DWORD *)v6 ^= LODWORD(qword_1771EF8[v7]);
          *(_DWORD *)(v6 + 4) ^= HIDWORD(qword_1771EF8[v7]);
        }
        v7 *= 2;
      }
      while ( v7 < 16 );
    }
    v6 += 8;
    ++v5;
  }
  while ( v6 < (signed int)dword_1771F78 );
  v8 = (signed int)dword_179C270;
  do
  {
    v9 = 64;
    do
    {
      *(_DWORD *)v8 = sub_1291830();
      *(_DWORD *)(v8 + 4) = v10;
      v8 += 8;
      --v9;
    }
    while ( v9 );
  }
  while ( v8 < (signed int)dword_179E270 );
  v11 = (signed int)dword_17A6CC0;
  do
  {
    result = sub_1291830();
    *(_DWORD *)v11 = result;
    *(_DWORD *)(v11 + 4) = v13;
    v11 += 8;
  }
  while ( v11 <= (signed int)&unk_17A6CF8 );
  return result;
}
RobboLito:

Code: Select all

int __cdecl sub_41A490()
{
  unsigned int v0; // ebx@1
  int v1; // edx@1
  int v2; // edx@1
  int v3; // edx@1
  int v4; // edx@1
  int v5; // edx@1
  signed int v6; // edi@1
  unsigned int v7; // eax@2
  signed int v8; // eax@3
  signed int v9; // esi@8
  signed int v10; // edi@9
  int v11; // edx@10
  signed int v12; // esi@12
  int result; // eax@13
  int v14; // edx@13

  v0 = 0;
  dword_62A2C0 = sub_41A3B0();
  dword_62A2C4 = v1;
  dword_7918C0[0] = 0;
  dword_7918C4[0] = 0;
  dword_7918C8 = sub_41A3B0();
  dword_7918CC = v2;
  dword_7918D0 = sub_41A3B0();
  dword_7918D4 = v3;
  dword_7918E0 = sub_41A3B0();
  dword_7918E4 = v4;
  dword_791900 = sub_41A3B0();
  dword_791904 = v5;
  v6 = (signed int)dword_7918C0;
  do
  {
    v7 = ((v0 - ((v0 >> 1) & 0x55555555)) & 0x33333333) + (((v0 - ((v0 >> 1) & 0x55555555)) >> 2) & 0x33333333);
    if ( (signed int)((16843009 * ((v7 + (v7 >> 4)) & 0xF0F0F0F) >> 24)
                    + (16843009
                     * ((((((unsigned __int64)(signed int)v0 >> 32)
                         - (((unsigned int)((unsigned __int64)(signed int)v0 >> 32) >> 1) & 0x55555555)) & 0x33333333)
                       + (((unsigned int)(((unsigned __int64)(signed int)v0 >> 32)
                                        - (((unsigned int)((unsigned __int64)(signed int)v0 >> 32) >> 1) & 0x55555555)) >> 2) & 0x33333333)
                       + ((((((unsigned __int64)(signed int)v0 >> 32)
                           - (((unsigned int)((unsigned __int64)(signed int)v0 >> 32) >> 1) & 0x55555555)) & 0x33333333)
                         + (((unsigned int)(((unsigned __int64)(signed int)v0 >> 32)
                                          - (((unsigned int)((unsigned __int64)(signed int)v0 >> 32) >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 4)) & 0xF0F0F0F) >> 24)) >= 2 )
    {
      *(_DWORD *)v6 = 0;
      *(_DWORD *)(v6 + 4) = 0;
      v8 = 1;
      do
      {
        if ( v8 & v0 )
        {
          *(_DWORD *)v6 ^= dword_7918C0[2 * v8];
          *(_DWORD *)(v6 + 4) ^= dword_7918C4[2 * v8];
        }
        v8 *= 2;
      }
      while ( v8 < 16 );
    }
    v6 += 8;
    ++v0;
  }
  while ( v6 < (signed int)dword_791940 );
  v9 = (signed int)&dword_48BF00;
  do
  {
    v10 = 64;
    do
    {
      *(_DWORD *)v9 = sub_41A3B0();
      *(_DWORD *)(v9 + 4) = v11;
      v9 += 8;
      --v10;
    }
    while ( v10 );
  }
  while ( v9 < (signed int)dword_48DF00 );
  v12 = (signed int)&dword_64BBC0;
  do
  {
    result = sub_41A3B0();
    *(_DWORD *)v12 = result;
    *(_DWORD *)(v12 + 4) = v14;
    v12 += 8;
  }
  while ( v12 <= (signed int)&unk_64BBF8 );
  return result;
}
RobboLIto's zobrist_init() (stack.c)

Code: Select all

void zobrist_init()
    {
    int i, j;
    zobrist_move_white = RAND64();
    zobrist_oo[0] = 0;
    zobrist_oo[1] = RAND64();
    zobrist_oo[2] = RAND64();
    zobrist_oo[4] = RAND64();
    zobrist_oo[8] = RAND64();

    for ( i = 0; i < 16; i++ )
        {
        if( POPCNT(i) < 2 )
            continue;
        zobrist_oo[i] = 0;

        for ( j = 1; j < 16; j <<= 1 )
            if( i & j )
                zobrist_oo[i] ^= zobrist_oo[j];
        }

    for ( i = 0; i < 16; i++ )
        for ( j = A1; j <= H8; j++ )
            ZOBRIST[i][j] = RAND64();

    for ( i = CA; i <= CH; i++ )
        zobrist_ep[i] = RAND64();
    }
PAWN : Knight >> Bishop >> Rook >>Queen

User avatar
kingliveson
Posts: 1388
Joined: Thu Jun 10, 2010 1:22 am
Real Name: Franklin Titus
Location: 28°32'1"N 81°22'33"W

Re: Computer Chess Biggest Liar

Post by kingliveson » Wed Oct 12, 2011 1:15 pm

There's probably a good answer for these:
RobboLito's game_new( bool total ) (utils.c)

Code: Select all

void game_new( bool total )
    {
    int i;

    for ( i = A1; i <= H8; i++ )
        QU[i] = 0;
    memset(dynamic_initial, 0, 256 * sizeof(type_dynamic));
    DYNAMIC = dynamic_initial;
    POSITION.white_en_move = TRUE;
    DYNAMIC->castle = 0x0f;
    DYNAMIC->en_passant = 0;
    DYNAMIC->move50 = 0;

    for ( i = A2; i <= H2; i++ )
        QU[i] = count_pawn_white;

    for ( i = A7; i <= H7; i++ )
        QU[i] = count_pawn_black;
    QU[D1] = count_queen_white;
    QU[D8] = count_queen_black;
    QU[E1] = count_king_white;
    QU[E8] = count_king_black;
    QU[A1] = QU[H1] = count_rook_white;
    QU[A8] = QU[H8] = count_rook_black;
    QU[B1] = QU[G1] = count_knight_white;
    QU[B8] = QU[G8] = count_knight_black;
    QU[C1] = count_dark_white;
    QU[F1] = count_clear_white;
    QU[C8] = count_clear_black;
    QU[F8] = count_dark_black;
    hole_previous = 1000;
    root_rapid = FALSE;
    GAME_NEW = TRUE;
    stack_height = 0;
    bitboard_initialization();

    if( !total )
        return;
    zobrist_free();
    value_zobrist_free();
    history_reset();
    gain_reset();
    }
The decompiled Houdini and accompanied RobboLito version are on the previous page. To be clear, this is not a copy/paste situation but rather code modification. The above function is where the bitboard initialization is called.

Houdini bitboard initialization sub_12A65A0():

Code: Select all

int __cdecl sub_12A65A0()
{
  signed int v0; // edx@1
  int v1; // ecx@2
  int v2; // eax@3
  int v3; // esi@5
  int v4; // eax@6
  int v5; // eax@6
  int v6; // ebp@12
  int v7; // ebx@12
  __int64 v8; // qdi@12
  int v9; // ecx@23
  int v10; // eax@24
  void *v11; // ecx@61
  int v12; // ST08_4@61
  void **v13; // eax@61
  int result; // eax@61
  int v22; // esi@67
  char v23; // dl@67
  void *v24; // ecx@80
  int v25; // ST08_4@80
  void **v26; // eax@80
  int v27; // eax@81
  int v28; // ecx@81
  char v29; // al@81
  int v30; // eax@82
  int v31; // eax@83
  int v32; // ecx@83
  int v33; // edi@83
  int v34; // edx@85
  int v35; // ecx@86
  void *v36; // ecx@87
  int v37; // ST08_4@87
  void **v38; // eax@87
  int v39; // ecx@89
  void *v40; // ecx@90
  int v41; // ST08_4@90
  void **v42; // eax@90
  char v43; // [sp+14h] [bp-8h]@63

  _mm_storel_pd((double *)qword_1405460, 0);
  memcpy(qword_1405468, qword_1405460, 0x78u);
  *(_DWORD *)(dword_14054F0[0] + 8) = 0;
  *(_DWORD *)(dword_14054F0[0] + 12) = 0;
  *(_DWORD *)dword_14054F0[0] = 0;
  *(_DWORD *)(dword_14054F0[0] + 4) = 0;
  *(_DWORD *)(dword_14054F0[0] + 16) = 0;
  byte_17728CC = 0;
  *(_DWORD *)(dword_14054F0[0] + 20) = 0;
  memset(byte_1405400, 255, 0x60u);
  v0 = 0;
  do
  {
    v1 = (unsigned __int8)byte_1405380[v0];
    if ( byte_1405380[v0] )
    {
      v2 = v0 + (v1 << 6);
      *(_DWORD *)(dword_14054F0[0] + 20) += dword_17B1F90[v2];
      *(_DWORD *)dword_14054F0[0] ^= dword_179C270[2 * v2];
      *(_DWORD *)(dword_14054F0[0] + 4) ^= dword_179C274[2 * v2];
      if ( v1 == 1 || v1 == 9 )
      {
        v3 = dword_14054F0[0];
        *(_DWORD *)(v3 + 8) ^= dword_179C270[2 * v2];
        *(_DWORD *)(v3 + 12) ^= dword_179C274[2 * v2];
      }
      *(_DWORD *)(dword_14054F0[0] + 16) += dword_12B8A08[v1];
      v4 = (unsigned __int8)byte_1405380[v0];
      LODWORD(qword_1405460[v4]) |= qword_16A8A78[2 * v0];
      HIDWORD(qword_1405460[v4]) |= qword_16A8A78[2 * v0 + 1];
      v5 = (unsigned __int8)byte_12B8AD0[v1];
      if ( byte_12B8AD0[v1] )
      {
        for ( ; byte_1405400[v5] != -1; ++v5 )
          ;
        byte_1405400[v5] = v0;
      }
      byte_14053C0[v0] = v5;
    }
    ++v0;
  }
  while ( v0 <= 63 );
  v6 = HIDWORD(qword_14054B8[0]) | qword_14054D8[1] | HIDWORD(qword_14054D0[0]) | HIDWORD(qword_14054C0[0]) | HIDWORD(qword_14054C8[0]) | HIDWORD(qword_14054B0[0]) | HIDWORD(qword_14054A8[0]);
  v7 = LODWORD(qword_14054B8[0]) | qword_14054D8[0] | LODWORD(qword_14054D0[0]) | LODWORD(qword_14054C0[0]) | LODWORD(qword_14054C8[0]) | LODWORD(qword_14054B0[0]) | LODWORD(qword_14054A8[0]);
  v8 = qword_1405478[0] | qword_1405498 | qword_1405490[0] | qword_1405480[0] | qword_1405488[0] | qword_1405470[0] | qword_1405468[0];
  qword_14054E0[0] = v8 | qword_14054B8[0] | *(_QWORD *)qword_14054D8 | qword_14054D0[0] | qword_14054C0[0] | qword_14054C8[0] | qword_14054B0[0] | qword_14054A8[0];
  qword_1405460[0] = qword_1405478[0] | qword_1405498 | qword_1405490[0] | qword_1405480[0] | qword_1405488[0] | qword_1405470[0] | qword_1405468[0];
  qword_14054A0[0] = qword_14054B8[0] | *(_QWORD *)qword_14054D8 | qword_14054D0[0] | qword_14054C0[0] | qword_14054C8[0] | qword_14054B0[0] | qword_14054A8[0];
  if ( (char)(286331153
            * ((((_DWORD)qword_1405498 - (((unsigned int)qword_1405498 >> 1) & 0x55555555)) & 0x33333333)
             + ((HIDWORD(qword_1405498) - ((HIDWORD(qword_1405498) >> 1) & 0x55555555)) & 0x33333333)
             + ((((unsigned int)qword_1405498 - (((unsigned int)qword_1405498 >> 1) & 0x55555555)) >> 2) & 0x33333333)
             + (((HIDWORD(qword_1405498) - ((HIDWORD(qword_1405498) >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 28) > 1
    || (char)(286331153
            * (((qword_14054D8[0] - (((unsigned int)qword_14054D8[0] >> 1) & 0x55555555)) & 0x33333333)
             + ((qword_14054D8[1] - (((unsigned int)qword_14054D8[1] >> 1) & 0x55555555)) & 0x33333333)
             + (((qword_14054D8[0] - (((unsigned int)qword_14054D8[0] >> 1) & 0x55555555)) >> 2) & 0x33333333)
             + (((qword_14054D8[1] - (((unsigned int)qword_14054D8[1] >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 28) > 1
    || (char)(286331153
            * (((LODWORD(qword_1405490[0]) - ((LODWORD(qword_1405490[0]) >> 1) & 0x55555555)) & 0x33333333)
             + ((HIDWORD(qword_1405490[0]) - ((HIDWORD(qword_1405490[0]) >> 1) & 0x55555555)) & 0x33333333)
             + (((LODWORD(qword_1405490[0]) - ((LODWORD(qword_1405490[0]) >> 1) & 0x55555555)) >> 2) & 0x33333333)
             + (((HIDWORD(qword_1405490[0]) - ((HIDWORD(qword_1405490[0]) >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 28) > 2
    || (char)(286331153
            * (((LODWORD(qword_14054D0[0]) - ((LODWORD(qword_14054D0[0]) >> 1) & 0x55555555)) & 0x33333333)
             + ((HIDWORD(qword_14054D0[0]) - ((HIDWORD(qword_14054D0[0]) >> 1) & 0x55555555)) & 0x33333333)
             + (((LODWORD(qword_14054D0[0]) - ((LODWORD(qword_14054D0[0]) >> 1) & 0x55555555)) >> 2) & 0x33333333)
             + (((HIDWORD(qword_14054D0[0]) - ((HIDWORD(qword_14054D0[0]) >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 28) > 2
    || (char)(286331153
            * (((LODWORD(qword_1405480[0]) - ((LODWORD(qword_1405480[0]) >> 1) & 0x55555555)) & 0x33333333)
             + ((HIDWORD(qword_1405480[0]) - ((HIDWORD(qword_1405480[0]) >> 1) & 0x55555555)) & 0x33333333)
             + (((LODWORD(qword_1405480[0]) - ((LODWORD(qword_1405480[0]) >> 1) & 0x55555555)) >> 2) & 0x33333333)
             + (((HIDWORD(qword_1405480[0]) - ((HIDWORD(qword_1405480[0]) >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 28) > 1
    || (char)(286331153
            * (((LODWORD(qword_14054C0[0]) - ((LODWORD(qword_14054C0[0]) >> 1) & 0x55555555)) & 0x33333333)
             + ((HIDWORD(qword_14054C0[0]) - ((HIDWORD(qword_14054C0[0]) >> 1) & 0x55555555)) & 0x33333333)
             + (((LODWORD(qword_14054C0[0]) - ((LODWORD(qword_14054C0[0]) >> 1) & 0x55555555)) >> 2) & 0x33333333)
             + (((HIDWORD(qword_14054C0[0]) - ((HIDWORD(qword_14054C0[0]) >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 28) > 1
    || (char)(286331153
            * (((LODWORD(qword_1405470[0]) - ((LODWORD(qword_1405470[0]) >> 1) & 0x55555555)) & 0x33333333)
             + ((HIDWORD(qword_1405470[0]) - ((HIDWORD(qword_1405470[0]) >> 1) & 0x55555555)) & 0x33333333)
             + (((LODWORD(qword_1405470[0]) - ((LODWORD(qword_1405470[0]) >> 1) & 0x55555555)) >> 2) & 0x33333333)
             + (((HIDWORD(qword_1405470[0]) - ((HIDWORD(qword_1405470[0]) >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 28) > 2
    || (char)(286331153
            * (((LODWORD(qword_14054B0[0]) - ((LODWORD(qword_14054B0[0]) >> 1) & 0x55555555)) & 0x33333333)
             + ((HIDWORD(qword_14054B0[0]) - ((HIDWORD(qword_14054B0[0]) >> 1) & 0x55555555)) & 0x33333333)
             + (((LODWORD(qword_14054B0[0]) - ((LODWORD(qword_14054B0[0]) >> 1) & 0x55555555)) >> 2) & 0x33333333)
             + (((HIDWORD(qword_14054B0[0]) - ((HIDWORD(qword_14054B0[0]) >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 28) > 2
    || (char)(286331153
            * (((LODWORD(qword_1405488[0]) - ((LODWORD(qword_1405488[0]) >> 1) & 0x55555555)) & 0x33333333)
             + ((HIDWORD(qword_1405488[0]) - ((HIDWORD(qword_1405488[0]) >> 1) & 0x55555555)) & 0x33333333)
             + (((LODWORD(qword_1405488[0]) - ((LODWORD(qword_1405488[0]) >> 1) & 0x55555555)) >> 2) & 0x33333333)
             + (((HIDWORD(qword_1405488[0]) - ((HIDWORD(qword_1405488[0]) >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 28) > 1
    || sub_1281040(LODWORD(qword_14054C8[0]), HIDWORD(qword_14054C8[0])) > 1 )
  {
    *(_DWORD *)(dword_14054F0[0] + 16) |= 0x80000000u;
    v6 = HIDWORD(qword_14054A0[0]);
    v7 = LODWORD(qword_14054A0[0]);
    v8 = qword_1405460[0];
  }
  v9 = (HIDWORD(qword_1405478[0]) - ((HIDWORD(qword_1405478[0]) >> 1) & 0x55555555)) & 0x33333333;
  if ( (286331153
      * (((LODWORD(qword_1405478[0]) - ((LODWORD(qword_1405478[0]) >> 1) & 0x55555555)) & 0x33333333)
       + v9
       + (((LODWORD(qword_1405478[0]) - ((LODWORD(qword_1405478[0]) >> 1) & 0x55555555)) >> 2) & 0x33333333)
       + (((HIDWORD(qword_1405478[0]) - ((HIDWORD(qword_1405478[0]) >> 1) & 0x55555555)) >> 2) & 0x33333333)) & 0xF0000000) != 268435456 )
  {
    v10 = (int)"ONE white king required";
LABEL_61:
    sub_12A8B5A((void *)v9, (int)"ERROR: Invalid position - %s\n", v10);
    sub_12A8B5A(v11, (int)"Internal board reset to start position\n", v12);
    v13 = sub_12A87BF();
    fflush((FILE *)v13 + 1);
    return sub_12A74B0(0);
  }
  v9 = (HIDWORD(qword_14054B8[0]) - ((HIDWORD(qword_14054B8[0]) >> 1) & 0x55555555)) & 0x33333333;
  if ( (286331153
      * (((LODWORD(qword_14054B8[0]) - ((LODWORD(qword_14054B8[0]) >> 1) & 0x55555555)) & 0x33333333)
       + v9
       + (((LODWORD(qword_14054B8[0]) - ((LODWORD(qword_14054B8[0]) >> 1) & 0x55555555)) >> 2) & 0x33333333)
       + (((HIDWORD(qword_14054B8[0]) - ((HIDWORD(qword_14054B8[0]) >> 1) & 0x55555555)) >> 2) & 0x33333333)) & 0xF0000000) != 268435456 )
  {
    v10 = (int)"ONE black king required";
    goto LABEL_61;
  }
  v9 = (HIDWORD(qword_1405498) - ((HIDWORD(qword_1405498) >> 1) & 0x55555555)) & 0x33333333;
  if ( (char)(286331153
            * ((((_DWORD)qword_1405498 - (((unsigned int)qword_1405498 >> 1) & 0x55555555)) & 0x33333333)
             + v9
             + ((((unsigned int)qword_1405498 - (((unsigned int)qword_1405498 >> 1) & 0x55555555)) >> 2) & 0x33333333)
             + (((HIDWORD(qword_1405498) - ((HIDWORD(qword_1405498) >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 28) > 9 )
  {
    v10 = (int)"Too many white queens";
    goto LABEL_61;
  }
  v9 = (qword_14054D8[1] - (((unsigned int)qword_14054D8[1] >> 1) & 0x55555555)) & 0x33333333;
  if ( (char)(286331153
            * (((qword_14054D8[0] - (((unsigned int)qword_14054D8[0] >> 1) & 0x55555555)) & 0x33333333)
             + v9
             + (((qword_14054D8[0] - (((unsigned int)qword_14054D8[0] >> 1) & 0x55555555)) >> 2) & 0x33333333)
             + (((qword_14054D8[1] - (((unsigned int)qword_14054D8[1] >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 28) > 9 )
  {
    v10 = (int)"Too many black queens";
    goto LABEL_61;
  }
  v9 = (HIDWORD(qword_1405490[0]) - ((HIDWORD(qword_1405490[0]) >> 1) & 0x55555555)) & 0x33333333;
  if ( (char)(286331153
            * (((LODWORD(qword_1405490[0]) - ((LODWORD(qword_1405490[0]) >> 1) & 0x55555555)) & 0x33333333)
             + v9
             + (((LODWORD(qword_1405490[0]) - ((LODWORD(qword_1405490[0]) >> 1) & 0x55555555)) >> 2) & 0x33333333)
             + (((HIDWORD(qword_1405490[0]) - ((HIDWORD(qword_1405490[0]) >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 28) > 10 )
  {
    v10 = (int)"Too many white rooks";
    goto LABEL_61;
  }
  v9 = (HIDWORD(qword_14054D0[0]) - ((HIDWORD(qword_14054D0[0]) >> 1) & 0x55555555)) & 0x33333333;
  if ( (char)(286331153
            * (((LODWORD(qword_14054D0[0]) - ((LODWORD(qword_14054D0[0]) >> 1) & 0x55555555)) & 0x33333333)
             + v9
             + (((LODWORD(qword_14054D0[0]) - ((LODWORD(qword_14054D0[0]) >> 1) & 0x55555555)) >> 2) & 0x33333333)
             + (((HIDWORD(qword_14054D0[0]) - ((HIDWORD(qword_14054D0[0]) >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 28) > 10 )
  {
    v10 = (int)"Too many black rooks";
    goto LABEL_61;
  }
  v9 = (HIDWORD(qword_1405480[0]) - ((HIDWORD(qword_1405480[0]) >> 1) & 0x55555555)) & 0x33333333;
  if ( (char)(286331153
            * (((LODWORD(qword_1405480[0]) - ((LODWORD(qword_1405480[0]) >> 1) & 0x55555555)) & 0x33333333)
             + v9
             + (((LODWORD(qword_1405480[0]) - ((LODWORD(qword_1405480[0]) >> 1) & 0x55555555)) >> 2) & 0x33333333)
             + (((HIDWORD(qword_1405480[0]) - ((HIDWORD(qword_1405480[0]) >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 28) > 9 )
  {
    v10 = (int)"Too many light-squared white bishops";
    goto LABEL_61;
  }
  v9 = (HIDWORD(qword_14054C0[0]) - ((HIDWORD(qword_14054C0[0]) >> 1) & 0x55555555)) & 0x33333333;
  if ( (char)(286331153
            * (((LODWORD(qword_14054C0[0]) - ((LODWORD(qword_14054C0[0]) >> 1) & 0x55555555)) & 0x33333333)
             + v9
             + (((LODWORD(qword_14054C0[0]) - ((LODWORD(qword_14054C0[0]) >> 1) & 0x55555555)) >> 2) & 0x33333333)
             + (((HIDWORD(qword_14054C0[0]) - ((HIDWORD(qword_14054C0[0]) >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 28) > 9 )
  {
    v10 = (int)"Too many light-squared black bishops";
    goto LABEL_61;
  }
  v9 = (HIDWORD(qword_1405488[0]) - ((HIDWORD(qword_1405488[0]) >> 1) & 0x55555555)) & 0x33333333;
  if ( (char)(286331153
            * (((LODWORD(qword_1405488[0]) - ((LODWORD(qword_1405488[0]) >> 1) & 0x55555555)) & 0x33333333)
             + v9
             + (((LODWORD(qword_1405488[0]) - ((LODWORD(qword_1405488[0]) >> 1) & 0x55555555)) >> 2) & 0x33333333)
             + (((HIDWORD(qword_1405488[0]) - ((HIDWORD(qword_1405488[0]) >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 28) > 9 )
  {
    v10 = (int)"Too many dark-squared white bishops";
    goto LABEL_61;
  }
  if ( sub_1281040(LODWORD(qword_14054C8[0]), HIDWORD(qword_14054C8[0])) > 9 )
  {
    v10 = (int)"Too many dark-squared black bishops";
    goto LABEL_61;
  }
  if ( sub_1281040(
         LODWORD(qword_1405480[0]) | LODWORD(qword_1405488[0]),
         (unsigned __int64)(qword_1405480[0] | qword_1405488[0]) >> 32) > 10 )
  {
    v10 = (int)"Too many white bishops";
    goto LABEL_61;
  }
  if ( sub_1281040(
         LODWORD(qword_14054C0[0]) | LODWORD(qword_14054C8[0]),
         (unsigned __int64)(qword_14054C0[0] | qword_14054C8[0]) >> 32) > 10 )
  {
    v10 = (int)"Too many black bishops";
    goto LABEL_61;
  }
  if ( sub_1281040(LODWORD(qword_1405470[0]), HIDWORD(qword_1405470[0])) > 10 )
  {
    v10 = (int)"Too many white knights";
    goto LABEL_61;
  }
  if ( sub_1281040(LODWORD(qword_14054B0[0]), HIDWORD(qword_14054B0[0])) > 10 )
  {
    v10 = (int)"Too many black knights";
    goto LABEL_61;
  }
  if ( sub_1281040(LODWORD(qword_1405468[0]), HIDWORD(qword_1405468[0])) > 8 )
  {
    v10 = (int)"Too many white pawns";
    goto LABEL_61;
  }
  if ( sub_1281040(LODWORD(qword_14054A8[0]), HIDWORD(qword_14054A8[0])) > 8 )
  {
    v10 = (int)"Too many black pawns";
    goto LABEL_61;
  }
  if ( sub_1281040(v8, HIDWORD(v8)) > 16 )
  {
    v10 = (int)"Too many white pieces";
    goto LABEL_61;
  }
  if ( sub_1281040(v7, v6) > 16 )
  {
    v10 = (int)"Too many black pieces";
    goto LABEL_61;
  }
  v9 = (HIDWORD(qword_1405468[0]) | HIDWORD(qword_14054A8[0])) & 0xFF000000;
  if ( v9 | (unsigned __int8)(LOBYTE(qword_1405468[0]) | LOBYTE(qword_14054A8[0])) )
  {
    v10 = (int)"Pawn at rank 1 or 8";
    goto LABEL_61;
  }
  __asm { bsf     eax, dword ptr qword_1405478 }
  if ( _ZF )
  {
    __asm { bsf     eax, dword ptr qword_1405478+4 }
    v9 = _EAX + 32;
    v43 = _EAX + 32;
    LOBYTE(_EAX) = _EAX + 32;
  }
  else
  {
    v43 = _EAX;
  }
  __asm { bsf     ebx, dword ptr qword_14054B8 }
  byte_14054E8[0] = _EAX;
  if ( _ZF )
  {
    __asm { bsf     edx, dword ptr qword_14054B8+4 }
    LOBYTE(_EBX) = _EDX + 32;
  }
  v22 = dword_14054F0[0];
  byte_14054E9[0] = _EBX;
  v23 = *(_BYTE *)(dword_14054F0[0] + 25);
  if ( !(v23 & 1) )
  {
LABEL_71:
    if ( !(v23 & 2)
      || (_BYTE)_EAX == 4
      && (v9 = HIDWORD(qword_1405490[0]) & qword_16A8A78[1], qword_1405490[0] & *(_QWORD *)qword_16A8A78) )
    {
      if ( !(v23 & 4)
        || (_BYTE)_EBX == 60
        && (v9 = HIDWORD(qword_14054D0[0]) & HIDWORD(qword_16A8C70), qword_14054D0[0] & qword_16A8C70) )
      {
        if ( !(v23 & 8)
          || (_BYTE)_EBX == 60
          && (v9 = HIDWORD(qword_14054D0[0]) & HIDWORD(qword_16A8C38), qword_14054D0[0] & qword_16A8C38) )
          goto LABEL_81;
      }
    }
    goto LABEL_80;
  }
  if ( (_BYTE)_EAX == 4 )
  {
    v9 = HIDWORD(qword_1405490[0]) & qword_16A8AB0[1];
    if ( qword_1405490[0] & *(_QWORD *)qword_16A8AB0 )
    {
      LOBYTE(_EAX) = v43;
      goto LABEL_71;
    }
  }
LABEL_80:
  sub_12A8B5A((void *)v9, (int)"ERROR: Invalid position - %s\n", (int)"Illegal castling");
  sub_12A8B5A(v24, (int)"Internal board reset to start position\n", v25);
  v26 = sub_12A87BF();
  fflush((FILE *)v26 + 1);
  sub_12A74B0(0);
  v22 = dword_14054F0[0];
LABEL_81:
  v27 = *(_BYTE *)(v22 + 25);
  *(_DWORD *)v22 ^= LODWORD(qword_1771EF8[v27]);
  *(_DWORD *)(dword_14054F0[0] + 4) ^= HIDWORD(qword_1771EF8[v27]);
  v28 = dword_14054F0[0];
  v29 = *(_BYTE *)(dword_14054F0[0] + 26);
  if ( v29 )
  {
    v30 = v29 & 7;
    *(_DWORD *)dword_14054F0[0] ^= dword_17A6CC0[2 * v30];
    *(_DWORD *)(dword_14054F0[0] + 4) ^= dword_17A6CC4[2 * v30];
    v28 = dword_14054F0[0];
  }
  v31 = v28 + 8;
  v32 = *(_BYTE *)(v28 + 25);
  v33 = *(_DWORD *)(v31 + 4) ^ dword_179C874[2 * (unsigned __int8)byte_14054E8[0]] ^ dword_179D874[2
                                                                                                 * (unsigned __int8)byte_14054E9[0]] ^ HIDWORD(qword_1771EF8[v32]) ^ 0x74D3C012;
  *(_DWORD *)v31 ^= dword_179C870[2 * (unsigned __int8)byte_14054E8[0]] ^ dword_179D870[2
                                                                                      * (unsigned __int8)byte_14054E9[0]] ^ LODWORD(qword_1771EF8[v32]) ^ 0xA8BF965E;
  *(_DWORD *)(v31 + 4) = v33;
  if ( byte_14054EA[0] )
  {
    *(_DWORD *)dword_14054F0[0] ^= dword_1773118[0];
    *(_DWORD *)(dword_14054F0[0] + 4) ^= dword_177311C[0];
  }
  sub_1284AD0(-30000, 30000, 0, 0);
  v34 = dword_14054F0[0];
  if ( !byte_14054EA[0] )
    goto LABEL_94;
  v35 = HIDWORD(qword_14054B8[0]) & *(_DWORD *)(dword_14054F0[0] + 36);
  result = v35 | qword_14054B8[0] & *(_DWORD *)(dword_14054F0[0] + 32);
  if ( qword_14054B8[0] & *(_QWORD *)(dword_14054F0[0] + 32) )
  {
    sub_12A8B5A((void *)v35, (int)"ERROR: Invalid position - %s\n", (int)"Black king can be captured");
    sub_12A8B5A(v36, (int)"Internal board reset to start position\n", v37);
    v38 = sub_12A87BF();
    fflush((FILE *)v38 + 1);
    result = sub_12A74B0(0);
    v34 = dword_14054F0[0];
  }
  if ( !byte_14054EA[0] )
  {
LABEL_94:
    v39 = HIDWORD(qword_1405478[0]) & *(_DWORD *)(v34 + 44);
    result = v39 | qword_1405478[0] & *(_DWORD *)(v34 + 40);
    if ( qword_1405478[0] & *(_QWORD *)(v34 + 40) )
    {
      sub_12A8B5A((void *)v39, (int)"ERROR: Invalid position - %s\n", (int)"White king can be captured");
      sub_12A8B5A(v40, (int)"Internal board reset to start position\n", v41);
      v42 = sub_12A87BF();
      fflush((FILE *)v42 + 1);
      result = sub_12A74B0(0);
    }
  }
  byte_17728CC = 1;
  return result;
}
RobboLIto:

Code: Select all

int __cdecl sub_424270()
{
  int v0; // esi@1
  signed int v1; // edi@1
  int v2; // ebx@2
  int v3; // eax@3
  int v4; // ebx@7
  int v5; // eax@8
  signed __int64 v6; // qax@11
  int v7; // ebx@12
  int v8; // eax@13
  signed __int64 v9; // qax@16
  int v10; // ebx@17
  int v11; // eax@18
  signed __int64 v12; // qax@21
  unsigned int v13; // edi@23
  unsigned int v14; // ebx@23
  int v15; // ecx@35
  int v16; // eax@35
  int v17; // ecx@37
  int v18; // eax@37
  int v19; // ecx@39
  int v20; // eax@39
  int v21; // ecx@41
  int v22; // eax@41
  int v23; // ecx@43
  int v24; // eax@43
  int v25; // ecx@45
  int v26; // eax@45
  int v27; // ecx@47
  int v28; // eax@47
  int v29; // ecx@49
  int v30; // eax@49
  int v31; // ecx@51
  int v32; // eax@51
  int v33; // ecx@53
  int v34; // eax@53
  int v35; // ecx@55
  int v36; // eax@55
  int v37; // ecx@57
  int v38; // eax@57
  int v39; // ecx@59
  int v40; // eax@59
  int v41; // ecx@61
  int v42; // eax@61
  int v43; // ecx@63
  int v44; // eax@63
  int v45; // ecx@65
  int v46; // eax@65
  int v47; // ecx@67
  int v48; // eax@67
  int v49; // ecx@69
  int v50; // eax@69
  int v51; // ecx@71
  int v52; // eax@71
  __int64 v53; // qcx@73
  unsigned int v54; // edi@73
  int v62; // ecx@84
  char v63; // bl@84
  char v64; // al@84
  int v65; // ecx@96
  int v66; // eax@96
  int v67; // eax@97
  char v68; // dl@97
  int v69; // edx@98
  int v70; // esi@99
  int v71; // edx@100
  int v72; // edx@101
  int result; // eax@102
  int v74; // ecx@103
  int v75; // eax@103
  int v76; // ecx@106
  int v77; // eax@106
  __int64 v78; // [sp+8h] [bp-10h]@23

  qword_782840[0] = 0i64;
  byte_5F8EE0 = 0;
  memcpy(&qword_782848, qword_782840, 0x78u);
  v0 = dword_740320;
  *(_DWORD *)(dword_740320 + 8) = 0;
  *(_DWORD *)(v0 + 12) = 0;
  *(_DWORD *)v0 = 0;
  *(_DWORD *)(v0 + 4) = 0;
  *(_DWORD *)(v0 + 16) = 0;
  *(_DWORD *)(v0 + 20) = 0;
  v1 = 0;
  do
  {
    v2 = (unsigned __int8)byte_782800[v1];
    if ( byte_782800[v1] )
    {
      v3 = v1 + (v2 << 6);
      *(_DWORD *)(v0 + 20) += dword_781800[v3];
      *(_DWORD *)v0 ^= dword_71B460[2 * v3];
      *(_DWORD *)(v0 + 4) ^= dword_71B464[2 * v3];
      if ( v2 == 1 || v2 == 9 )
      {
        *(_DWORD *)(v0 + 8) ^= dword_71B460[2 * v3];
        *(_DWORD *)(v0 + 12) ^= dword_71B464[2 * v3];
      }
      *(_DWORD *)(v0 + 16) += dword_437BC0[v2];
      LODWORD(qword_782840[v2]) |= 1i64 << v1;
      HIDWORD(qword_782840[v2]) |= (unsigned __int64)(1i64 << v1) >> 32;
    }
    v4 = (unsigned __int8)byte_782801[v1];
    if ( byte_782801[v1] )
    {
      v5 = (v4 << 6) + v1;
      *(_DWORD *)(v0 + 20) += dword_781804[v5];
      *(_DWORD *)v0 ^= dword_71B468[2 * v5];
      *(_DWORD *)(v0 + 4) ^= dword_71B46C[2 * v5];
      if ( v4 == 1 || v4 == 9 )
      {
        *(_DWORD *)(v0 + 8) ^= dword_71B468[2 * v5];
        *(_DWORD *)(v0 + 12) ^= dword_71B46C[2 * v5];
      }
      *(_DWORD *)(v0 + 16) += dword_437BC0[v4];
      v6 = 1i64 << ((unsigned __int8)byte_782800 + (unsigned __int8)v1 + 1 - (unsigned __int8)byte_782800);
      LODWORD(qword_782840[v4]) |= v6;
      HIDWORD(qword_782840[v4]) |= HIDWORD(v6);
    }
    v7 = (unsigned __int8)byte_782802[v1];
    if ( byte_782802[v1] )
    {
      v8 = v1 + (v7 << 6);
      *(_DWORD *)(v0 + 20) += dword_781808[v8];
      *(_DWORD *)v0 ^= dword_71B470[2 * v8];
      *(_DWORD *)(v0 + 4) ^= dword_71B474[2 * v8];
      if ( v7 == 1 || v7 == 9 )
      {
        *(_DWORD *)(v0 + 8) ^= dword_71B470[2 * v8];
        *(_DWORD *)(v0 + 12) ^= dword_71B474[2 * v8];
      }
      *(_DWORD *)(v0 + 16) += dword_437BC0[v7];
      v9 = 1i64 << ((unsigned __int8)byte_782800 + (unsigned __int8)v1 + 2 - (unsigned __int8)byte_782800);
      LODWORD(qword_782840[v7]) |= v9;
      HIDWORD(qword_782840[v7]) |= HIDWORD(v9);
    }
    v10 = (unsigned __int8)byte_782803[v1];
    if ( byte_782803[v1] )
    {
      v11 = v1 + (v10 << 6);
      *(_DWORD *)(v0 + 20) += dword_78180C[v11];
      *(_DWORD *)v0 ^= dword_71B478[2 * v11];
      *(_DWORD *)(v0 + 4) ^= dword_71B47C[2 * v11];
      if ( v10 == 1 || v10 == 9 )
      {
        *(_DWORD *)(v0 + 8) ^= dword_71B478[2 * v11];
        *(_DWORD *)(v0 + 12) ^= dword_71B47C[2 * v11];
      }
      *(_DWORD *)(v0 + 16) += dword_437BC0[v10];
      v12 = 1i64 << ((unsigned __int8)byte_782800 + (unsigned __int8)v1 + 3 - (unsigned __int8)byte_782800);
      LODWORD(qword_782840[v10]) |= v12;
      HIDWORD(qword_782840[v10]) |= HIDWORD(v12);
    }
    v1 += 4;
  }
  while ( v1 <= 63 );
  v13 = qword_782858;
  qword_782840[0] = qword_782858 | qword_782878 | qword_782870 | qword_782860 | qword_782868 | qword_782850 | qword_782848;
  v14 = HIDWORD(qword_782858);
  qword_782880 = qword_782898 | qword_7828B8 | qword_7828B0 | qword_7828A0 | qword_7828A8 | qword_782890 | qword_782888;
  qword_7828C0 = qword_782858 | qword_782878 | qword_782870 | qword_782860 | qword_782868 | qword_782850 | qword_782848 | qword_782880;
  v78 = qword_782858 | qword_782878 | qword_782870 | qword_782860 | qword_782868 | qword_782850 | qword_782848 | qword_782880;
  qword_7828D8 = 0i64;
  qword_7828D0 = 0i64;
  qword_7828C8 = 0i64;
  if ( (signed int)((16843009
                   * (((((_DWORD)qword_782878 - (((unsigned int)qword_782878 >> 1) & 0x55555555)) & 0x33333333)
                     + ((((unsigned int)qword_782878 - (((unsigned int)qword_782878 >> 1) & 0x55555555)) >> 2) & 0x33333333)
                     + (((((_DWORD)qword_782878 - (((unsigned int)qword_782878 >> 1) & 0x55555555)) & 0x33333333)
                       + ((((unsigned int)qword_782878 - (((unsigned int)qword_782878 >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 4)) & 0xF0F0F0F) >> 24)
                  + (16843009
                   * ((((HIDWORD(qword_782878) - ((HIDWORD(qword_782878) >> 1) & 0x55555555)) & 0x33333333)
                     + (((HIDWORD(qword_782878) - ((HIDWORD(qword_782878) >> 1) & 0x55555555)) >> 2) & 0x33333333)
                     + ((((HIDWORD(qword_782878) - ((HIDWORD(qword_782878) >> 1) & 0x55555555)) & 0x33333333)
                       + (((HIDWORD(qword_782878) - ((HIDWORD(qword_782878) >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 4)) & 0xF0F0F0F) >> 24)) > 1
    || (signed int)((16843009
                   * (((((_DWORD)qword_7828B8 - (((unsigned int)qword_7828B8 >> 1) & 0x55555555)) & 0x33333333)
                     + ((((unsigned int)qword_7828B8 - (((unsigned int)qword_7828B8 >> 1) & 0x55555555)) >> 2) & 0x33333333)
                     + (((((_DWORD)qword_7828B8 - (((unsigned int)qword_7828B8 >> 1) & 0x55555555)) & 0x33333333)
                       + ((((unsigned int)qword_7828B8 - (((unsigned int)qword_7828B8 >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 4)) & 0xF0F0F0F) >> 24)
                  + (16843009
                   * ((((HIDWORD(qword_7828B8) - ((HIDWORD(qword_7828B8) >> 1) & 0x55555555)) & 0x33333333)
                     + (((HIDWORD(qword_7828B8) - ((HIDWORD(qword_7828B8) >> 1) & 0x55555555)) >> 2) & 0x33333333)
                     + ((((HIDWORD(qword_7828B8) - ((HIDWORD(qword_7828B8) >> 1) & 0x55555555)) & 0x33333333)
                       + (((HIDWORD(qword_7828B8) - ((HIDWORD(qword_7828B8) >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 4)) & 0xF0F0F0F) >> 24)) > 1
    || (signed int)((16843009
                   * (((((_DWORD)qword_782870 - (((unsigned int)qword_782870 >> 1) & 0x55555555)) & 0x33333333)
                     + ((((unsigned int)qword_782870 - (((unsigned int)qword_782870 >> 1) & 0x55555555)) >> 2) & 0x33333333)
                     + (((((_DWORD)qword_782870 - (((unsigned int)qword_782870 >> 1) & 0x55555555)) & 0x33333333)
                       + ((((unsigned int)qword_782870 - (((unsigned int)qword_782870 >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 4)) & 0xF0F0F0F) >> 24)
                  + (16843009
                   * ((((HIDWORD(qword_782870) - ((HIDWORD(qword_782870) >> 1) & 0x55555555)) & 0x33333333)
                     + (((HIDWORD(qword_782870) - ((HIDWORD(qword_782870) >> 1) & 0x55555555)) >> 2) & 0x33333333)
                     + ((((HIDWORD(qword_782870) - ((HIDWORD(qword_782870) >> 1) & 0x55555555)) & 0x33333333)
                       + (((HIDWORD(qword_782870) - ((HIDWORD(qword_782870) >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 4)) & 0xF0F0F0F) >> 24)) > 2
    || (signed int)((16843009
                   * (((((_DWORD)qword_7828B0 - (((unsigned int)qword_7828B0 >> 1) & 0x55555555)) & 0x33333333)
                     + ((((unsigned int)qword_7828B0 - (((unsigned int)qword_7828B0 >> 1) & 0x55555555)) >> 2) & 0x33333333)
                     + (((((_DWORD)qword_7828B0 - (((unsigned int)qword_7828B0 >> 1) & 0x55555555)) & 0x33333333)
                       + ((((unsigned int)qword_7828B0 - (((unsigned int)qword_7828B0 >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 4)) & 0xF0F0F0F) >> 24)
                  + (16843009
                   * ((((HIDWORD(qword_7828B0) - ((HIDWORD(qword_7828B0) >> 1) & 0x55555555)) & 0x33333333)
                     + (((HIDWORD(qword_7828B0) - ((HIDWORD(qword_7828B0) >> 1) & 0x55555555)) >> 2) & 0x33333333)
                     + ((((HIDWORD(qword_7828B0) - ((HIDWORD(qword_7828B0) >> 1) & 0x55555555)) & 0x33333333)
                       + (((HIDWORD(qword_7828B0) - ((HIDWORD(qword_7828B0) >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 4)) & 0xF0F0F0F) >> 24)) > 2
    || sub_401000(qword_782860, HIDWORD(qword_782860)) > 1
    || sub_401000(qword_7828A0, HIDWORD(qword_7828A0)) > 1
    || sub_401000(qword_782850, HIDWORD(qword_782850)) > 2
    || sub_401000(qword_782890, HIDWORD(qword_782890)) > 2
    || sub_401000(qword_782868, HIDWORD(qword_782868)) > 1
    || sub_401000(qword_7828A8, HIDWORD(qword_7828A8)) > 1 )
    *(_DWORD *)(v0 + 16) |= 0x80000000u;
  if ( (16843009
      * ((((v13 - ((v13 >> 1) & 0x55555555)) & 0x33333333)
        + (((v13 - ((v13 >> 1) & 0x55555555)) >> 2) & 0x33333333)
        + ((((v13 - ((v13 >> 1) & 0x55555555)) & 0x33333333) + (((v13 - ((v13 >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 4)) & 0xF0F0F0F) >> 24)
     + (16843009
      * ((((v14 - ((v14 >> 1) & 0x55555555)) & 0x33333333)
        + (((v14 - ((v14 >> 1) & 0x55555555)) >> 2) & 0x33333333)
        + ((((v14 - ((v14 >> 1) & 0x55555555)) & 0x33333333) + (((v14 - ((v14 >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 4)) & 0xF0F0F0F) >> 24) != 1 )
  {
    sub_4274E8((int)"error positional: %s\n", (int)"king white != 1");
    v16 = sub_42714D(v15);
    fflush((FILE *)(v16 + 32));
  }
  if ( (16843009
      * (((((_DWORD)qword_782898 - (((unsigned int)qword_782898 >> 1) & 0x55555555)) & 0x33333333)
        + ((((unsigned int)qword_782898 - (((unsigned int)qword_782898 >> 1) & 0x55555555)) >> 2) & 0x33333333)
        + (((((_DWORD)qword_782898 - (((unsigned int)qword_782898 >> 1) & 0x55555555)) & 0x33333333)
          + ((((unsigned int)qword_782898 - (((unsigned int)qword_782898 >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 4)) & 0xF0F0F0F) >> 24)
     + (16843009
      * ((((HIDWORD(qword_782898) - ((HIDWORD(qword_782898) >> 1) & 0x55555555)) & 0x33333333)
        + (((HIDWORD(qword_782898) - ((HIDWORD(qword_782898) >> 1) & 0x55555555)) >> 2) & 0x33333333)
        + ((((HIDWORD(qword_782898) - ((HIDWORD(qword_782898) >> 1) & 0x55555555)) & 0x33333333)
          + (((HIDWORD(qword_782898) - ((HIDWORD(qword_782898) >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 4)) & 0xF0F0F0F) >> 24) != 1 )
  {
    sub_4274E8((int)"error positional: %s\n", (int)"king black != 1");
    v18 = sub_42714D(v17);
    fflush((FILE *)(v18 + 32));
  }
  if ( (signed int)((16843009
                   * (((((_DWORD)qword_782878 - (((unsigned int)qword_782878 >> 1) & 0x55555555)) & 0x33333333)
                     + ((((unsigned int)qword_782878 - (((unsigned int)qword_782878 >> 1) & 0x55555555)) >> 2) & 0x33333333)
                     + (((((_DWORD)qword_782878 - (((unsigned int)qword_782878 >> 1) & 0x55555555)) & 0x33333333)
                       + ((((unsigned int)qword_782878 - (((unsigned int)qword_782878 >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 4)) & 0xF0F0F0F) >> 24)
                  + (16843009
                   * ((((HIDWORD(qword_782878) - ((HIDWORD(qword_782878) >> 1) & 0x55555555)) & 0x33333333)
                     + (((HIDWORD(qword_782878) - ((HIDWORD(qword_782878) >> 1) & 0x55555555)) >> 2) & 0x33333333)
                     + ((((HIDWORD(qword_782878) - ((HIDWORD(qword_782878) >> 1) & 0x55555555)) & 0x33333333)
                       + (((HIDWORD(qword_782878) - ((HIDWORD(qword_782878) >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 4)) & 0xF0F0F0F) >> 24)) > 9 )
  {
    sub_4274E8((int)"error positional: %s\n", (int)"queen white > 9");
    v20 = sub_42714D(v19);
    fflush((FILE *)(v20 + 32));
  }
  if ( (signed int)((16843009
                   * (((((_DWORD)qword_7828B8 - (((unsigned int)qword_7828B8 >> 1) & 0x55555555)) & 0x33333333)
                     + ((((unsigned int)qword_7828B8 - (((unsigned int)qword_7828B8 >> 1) & 0x55555555)) >> 2) & 0x33333333)
                     + (((((_DWORD)qword_7828B8 - (((unsigned int)qword_7828B8 >> 1) & 0x55555555)) & 0x33333333)
                       + ((((unsigned int)qword_7828B8 - (((unsigned int)qword_7828B8 >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 4)) & 0xF0F0F0F) >> 24)
                  + (16843009
                   * ((((HIDWORD(qword_7828B8) - ((HIDWORD(qword_7828B8) >> 1) & 0x55555555)) & 0x33333333)
                     + (((HIDWORD(qword_7828B8) - ((HIDWORD(qword_7828B8) >> 1) & 0x55555555)) >> 2) & 0x33333333)
                     + ((((HIDWORD(qword_7828B8) - ((HIDWORD(qword_7828B8) >> 1) & 0x55555555)) & 0x33333333)
                       + (((HIDWORD(qword_7828B8) - ((HIDWORD(qword_7828B8) >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 4)) & 0xF0F0F0F) >> 24)) > 9 )
  {
    sub_4274E8((int)"error positional: %s\n", (int)"queen black > 9");
    v22 = sub_42714D(v21);
    fflush((FILE *)(v22 + 32));
  }
  if ( (signed int)((16843009
                   * (((((_DWORD)qword_782870 - (((unsigned int)qword_782870 >> 1) & 0x55555555)) & 0x33333333)
                     + ((((unsigned int)qword_782870 - (((unsigned int)qword_782870 >> 1) & 0x55555555)) >> 2) & 0x33333333)
                     + (((((_DWORD)qword_782870 - (((unsigned int)qword_782870 >> 1) & 0x55555555)) & 0x33333333)
                       + ((((unsigned int)qword_782870 - (((unsigned int)qword_782870 >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 4)) & 0xF0F0F0F) >> 24)
                  + (16843009
                   * ((((HIDWORD(qword_782870) - ((HIDWORD(qword_782870) >> 1) & 0x55555555)) & 0x33333333)
                     + (((HIDWORD(qword_782870) - ((HIDWORD(qword_782870) >> 1) & 0x55555555)) >> 2) & 0x33333333)
                     + ((((HIDWORD(qword_782870) - ((HIDWORD(qword_782870) >> 1) & 0x55555555)) & 0x33333333)
                       + (((HIDWORD(qword_782870) - ((HIDWORD(qword_782870) >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 4)) & 0xF0F0F0F) >> 24)) > 10 )
  {
    sub_4274E8((int)"error positional: %s\n", (int)"rook white > 10");
    v24 = sub_42714D(v23);
    fflush((FILE *)(v24 + 32));
  }
  if ( (signed int)((16843009
                   * (((((_DWORD)qword_7828B0 - (((unsigned int)qword_7828B0 >> 1) & 0x55555555)) & 0x33333333)
                     + ((((unsigned int)qword_7828B0 - (((unsigned int)qword_7828B0 >> 1) & 0x55555555)) >> 2) & 0x33333333)
                     + (((((_DWORD)qword_7828B0 - (((unsigned int)qword_7828B0 >> 1) & 0x55555555)) & 0x33333333)
                       + ((((unsigned int)qword_7828B0 - (((unsigned int)qword_7828B0 >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 4)) & 0xF0F0F0F) >> 24)
                  + (16843009
                   * ((((HIDWORD(qword_7828B0) - ((HIDWORD(qword_7828B0) >> 1) & 0x55555555)) & 0x33333333)
                     + (((HIDWORD(qword_7828B0) - ((HIDWORD(qword_7828B0) >> 1) & 0x55555555)) >> 2) & 0x33333333)
                     + ((((HIDWORD(qword_7828B0) - ((HIDWORD(qword_7828B0) >> 1) & 0x55555555)) & 0x33333333)
                       + (((HIDWORD(qword_7828B0) - ((HIDWORD(qword_7828B0) >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 4)) & 0xF0F0F0F) >> 24)) > 10 )
  {
    sub_4274E8((int)"error positional: %s\n", (int)"rook black > 10");
    v26 = sub_42714D(v25);
    fflush((FILE *)(v26 + 32));
  }
  if ( (signed int)((16843009
                   * (((((_DWORD)qword_782860 - (((unsigned int)qword_782860 >> 1) & 0x55555555)) & 0x33333333)
                     + ((((unsigned int)qword_782860 - (((unsigned int)qword_782860 >> 1) & 0x55555555)) >> 2) & 0x33333333)
                     + (((((_DWORD)qword_782860 - (((unsigned int)qword_782860 >> 1) & 0x55555555)) & 0x33333333)
                       + ((((unsigned int)qword_782860 - (((unsigned int)qword_782860 >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 4)) & 0xF0F0F0F) >> 24)
                  + (16843009
                   * ((((HIDWORD(qword_782860) - ((HIDWORD(qword_782860) >> 1) & 0x55555555)) & 0x33333333)
                     + (((HIDWORD(qword_782860) - ((HIDWORD(qword_782860) >> 1) & 0x55555555)) >> 2) & 0x33333333)
                     + ((((HIDWORD(qword_782860) - ((HIDWORD(qword_782860) >> 1) & 0x55555555)) & 0x33333333)
                       + (((HIDWORD(qword_782860) - ((HIDWORD(qword_782860) >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 4)) & 0xF0F0F0F) >> 24)) > 9 )
  {
    sub_4274E8((int)"error positional: %s\n", (int)"chiaro white > 9");
    v28 = sub_42714D(v27);
    fflush((FILE *)(v28 + 32));
  }
  if ( (signed int)((16843009
                   * (((((_DWORD)qword_7828A0 - (((unsigned int)qword_7828A0 >> 1) & 0x55555555)) & 0x33333333)
                     + ((((unsigned int)qword_7828A0 - (((unsigned int)qword_7828A0 >> 1) & 0x55555555)) >> 2) & 0x33333333)
                     + (((((_DWORD)qword_7828A0 - (((unsigned int)qword_7828A0 >> 1) & 0x55555555)) & 0x33333333)
                       + ((((unsigned int)qword_7828A0 - (((unsigned int)qword_7828A0 >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 4)) & 0xF0F0F0F) >> 24)
                  + (16843009
                   * ((((HIDWORD(qword_7828A0) - ((HIDWORD(qword_7828A0) >> 1) & 0x55555555)) & 0x33333333)
                     + (((HIDWORD(qword_7828A0) - ((HIDWORD(qword_7828A0) >> 1) & 0x55555555)) >> 2) & 0x33333333)
                     + ((((HIDWORD(qword_7828A0) - ((HIDWORD(qword_7828A0) >> 1) & 0x55555555)) & 0x33333333)
                       + (((HIDWORD(qword_7828A0) - ((HIDWORD(qword_7828A0) >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 4)) & 0xF0F0F0F) >> 24)) > 9 )
  {
    sub_4274E8((int)"error positional: %s\n", (int)"chiaro black > 9");
    v30 = sub_42714D(v29);
    fflush((FILE *)(v30 + 32));
  }
  if ( (signed int)((16843009
                   * (((((_DWORD)qword_782868 - (((unsigned int)qword_782868 >> 1) & 0x55555555)) & 0x33333333)
                     + ((((unsigned int)qword_782868 - (((unsigned int)qword_782868 >> 1) & 0x55555555)) >> 2) & 0x33333333)
                     + (((((_DWORD)qword_782868 - (((unsigned int)qword_782868 >> 1) & 0x55555555)) & 0x33333333)
                       + ((((unsigned int)qword_782868 - (((unsigned int)qword_782868 >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 4)) & 0xF0F0F0F) >> 24)
                  + (16843009
                   * ((((HIDWORD(qword_782868) - ((HIDWORD(qword_782868) >> 1) & 0x55555555)) & 0x33333333)
                     + (((HIDWORD(qword_782868) - ((HIDWORD(qword_782868) >> 1) & 0x55555555)) >> 2) & 0x33333333)
                     + ((((HIDWORD(qword_782868) - ((HIDWORD(qword_782868) >> 1) & 0x55555555)) & 0x33333333)
                       + (((HIDWORD(qword_782868) - ((HIDWORD(qword_782868) >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 4)) & 0xF0F0F0F) >> 24)) > 9 )
  {
    sub_4274E8((int)"error positional: %s\n", (int)"dark white > 9");
    v32 = sub_42714D(v31);
    fflush((FILE *)(v32 + 32));
  }
  if ( (signed int)((16843009
                   * (((((_DWORD)qword_7828A8 - (((unsigned int)qword_7828A8 >> 1) & 0x55555555)) & 0x33333333)
                     + ((((unsigned int)qword_7828A8 - (((unsigned int)qword_7828A8 >> 1) & 0x55555555)) >> 2) & 0x33333333)
                     + (((((_DWORD)qword_7828A8 - (((unsigned int)qword_7828A8 >> 1) & 0x55555555)) & 0x33333333)
                       + ((((unsigned int)qword_7828A8 - (((unsigned int)qword_7828A8 >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 4)) & 0xF0F0F0F) >> 24)
                  + (16843009
                   * ((((HIDWORD(qword_7828A8) - ((HIDWORD(qword_7828A8) >> 1) & 0x55555555)) & 0x33333333)
                     + (((HIDWORD(qword_7828A8) - ((HIDWORD(qword_7828A8) >> 1) & 0x55555555)) >> 2) & 0x33333333)
                     + ((((HIDWORD(qword_7828A8) - ((HIDWORD(qword_7828A8) >> 1) & 0x55555555)) & 0x33333333)
                       + (((HIDWORD(qword_7828A8) - ((HIDWORD(qword_7828A8) >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 4)) & 0xF0F0F0F) >> 24)) > 9 )
  {
    sub_4274E8((int)"error positional: %s\n", (int)"dark black > 9");
    v34 = sub_42714D(v33);
    fflush((FILE *)(v34 + 32));
  }
  if ( (signed int)((16843009
                   * ((((((unsigned int)qword_782860 | (unsigned int)qword_782868)
                       - ((((unsigned int)qword_782860 | (unsigned int)qword_782868) >> 1) & 0x55555555)) & 0x33333333)
                     + (((((unsigned int)qword_782860 | (unsigned int)qword_782868)
                        - ((((unsigned int)qword_782860 | (unsigned int)qword_782868) >> 1) & 0x55555555)) >> 2) & 0x33333333)
                     + ((((((unsigned int)qword_782860 | (unsigned int)qword_782868)
                         - ((((unsigned int)qword_782860 | (unsigned int)qword_782868) >> 1) & 0x55555555)) & 0x33333333)
                       + (((((unsigned int)qword_782860 | (unsigned int)qword_782868)
                          - ((((unsigned int)qword_782860 | (unsigned int)qword_782868) >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 4)) & 0xF0F0F0F) >> 24)
                  + (16843009
                   * (((((HIDWORD(qword_782860) | HIDWORD(qword_782868))
                       - (((unsigned int)(HIDWORD(qword_782860) | HIDWORD(qword_782868)) >> 1) & 0x55555555)) & 0x33333333)
                     + ((((HIDWORD(qword_782860) | HIDWORD(qword_782868))
                        - (((unsigned int)(HIDWORD(qword_782860) | HIDWORD(qword_782868)) >> 1) & 0x55555555)) >> 2) & 0x33333333)
                     + (((((HIDWORD(qword_782860) | HIDWORD(qword_782868))
                         - (((unsigned int)(HIDWORD(qword_782860) | HIDWORD(qword_782868)) >> 1) & 0x55555555)) & 0x33333333)
                       + ((((HIDWORD(qword_782860) | HIDWORD(qword_782868))
                          - (((unsigned int)(HIDWORD(qword_782860) | HIDWORD(qword_782868)) >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 4)) & 0xF0F0F0F) >> 24)) > 10 )
  {
    sub_4274E8((int)"error positional: %s\n", (int)"bishop white > 10");
    v36 = sub_42714D(v35);
    fflush((FILE *)(v36 + 32));
  }
  if ( (signed int)((16843009
                   * ((((((unsigned int)qword_7828A0 | (unsigned int)qword_7828A8)
                       - ((((unsigned int)qword_7828A0 | (unsigned int)qword_7828A8) >> 1) & 0x55555555)) & 0x33333333)
                     + (((((unsigned int)qword_7828A0 | (unsigned int)qword_7828A8)
                        - ((((unsigned int)qword_7828A0 | (unsigned int)qword_7828A8) >> 1) & 0x55555555)) >> 2) & 0x33333333)
                     + ((((((unsigned int)qword_7828A0 | (unsigned int)qword_7828A8)
                         - ((((unsigned int)qword_7828A0 | (unsigned int)qword_7828A8) >> 1) & 0x55555555)) & 0x33333333)
                       + (((((unsigned int)qword_7828A0 | (unsigned int)qword_7828A8)
                          - ((((unsigned int)qword_7828A0 | (unsigned int)qword_7828A8) >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 4)) & 0xF0F0F0F) >> 24)
                  + (16843009
                   * (((((HIDWORD(qword_7828A0) | HIDWORD(qword_7828A8))
                       - (((unsigned int)(HIDWORD(qword_7828A0) | HIDWORD(qword_7828A8)) >> 1) & 0x55555555)) & 0x33333333)
                     + ((((HIDWORD(qword_7828A0) | HIDWORD(qword_7828A8))
                        - (((unsigned int)(HIDWORD(qword_7828A0) | HIDWORD(qword_7828A8)) >> 1) & 0x55555555)) >> 2) & 0x33333333)
                     + (((((HIDWORD(qword_7828A0) | HIDWORD(qword_7828A8))
                         - (((unsigned int)(HIDWORD(qword_7828A0) | HIDWORD(qword_7828A8)) >> 1) & 0x55555555)) & 0x33333333)
                       + ((((HIDWORD(qword_7828A0) | HIDWORD(qword_7828A8))
                          - (((unsigned int)(HIDWORD(qword_7828A0) | HIDWORD(qword_7828A8)) >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 4)) & 0xF0F0F0F) >> 24)) > 10 )
  {
    sub_4274E8((int)"error positional: %s\n", (int)"bishop black > 10");
    v38 = sub_42714D(v37);
    fflush((FILE *)(v38 + 32));
  }
  if ( (signed int)((16843009
                   * (((((_DWORD)qword_782850 - (((unsigned int)qword_782850 >> 1) & 0x55555555)) & 0x33333333)
                     + ((((unsigned int)qword_782850 - (((unsigned int)qword_782850 >> 1) & 0x55555555)) >> 2) & 0x33333333)
                     + (((((_DWORD)qword_782850 - (((unsigned int)qword_782850 >> 1) & 0x55555555)) & 0x33333333)
                       + ((((unsigned int)qword_782850 - (((unsigned int)qword_782850 >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 4)) & 0xF0F0F0F) >> 24)
                  + (16843009
                   * ((((HIDWORD(qword_782850) - ((HIDWORD(qword_782850) >> 1) & 0x55555555)) & 0x33333333)
                     + (((HIDWORD(qword_782850) - ((HIDWORD(qword_782850) >> 1) & 0x55555555)) >> 2) & 0x33333333)
                     + ((((HIDWORD(qword_782850) - ((HIDWORD(qword_782850) >> 1) & 0x55555555)) & 0x33333333)
                       + (((HIDWORD(qword_782850) - ((HIDWORD(qword_782850) >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 4)) & 0xF0F0F0F) >> 24)) > 10 )
  {
    sub_4274E8((int)"error positional: %s\n", (int)"knight white > 10");
    v40 = sub_42714D(v39);
    fflush((FILE *)(v40 + 32));
  }
  if ( (signed int)((16843009
                   * (((((_DWORD)qword_782890 - (((unsigned int)qword_782890 >> 1) & 0x55555555)) & 0x33333333)
                     + ((((unsigned int)qword_782890 - (((unsigned int)qword_782890 >> 1) & 0x55555555)) >> 2) & 0x33333333)
                     + (((((_DWORD)qword_782890 - (((unsigned int)qword_782890 >> 1) & 0x55555555)) & 0x33333333)
                       + ((((unsigned int)qword_782890 - (((unsigned int)qword_782890 >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 4)) & 0xF0F0F0F) >> 24)
                  + (16843009
                   * ((((HIDWORD(qword_782890) - ((HIDWORD(qword_782890) >> 1) & 0x55555555)) & 0x33333333)
                     + (((HIDWORD(qword_782890) - ((HIDWORD(qword_782890) >> 1) & 0x55555555)) >> 2) & 0x33333333)
                     + ((((HIDWORD(qword_782890) - ((HIDWORD(qword_782890) >> 1) & 0x55555555)) & 0x33333333)
                       + (((HIDWORD(qword_782890) - ((HIDWORD(qword_782890) >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 4)) & 0xF0F0F0F) >> 24)) > 10 )
  {
    sub_4274E8((int)"error positional: %s\n", (int)"knight black > 10");
    v42 = sub_42714D(v41);
    fflush((FILE *)(v42 + 32));
  }
  if ( (signed int)((16843009
                   * (((((_DWORD)qword_782848 - (((unsigned int)qword_782848 >> 1) & 0x55555555)) & 0x33333333)
                     + ((((unsigned int)qword_782848 - (((unsigned int)qword_782848 >> 1) & 0x55555555)) >> 2) & 0x33333333)
                     + (((((_DWORD)qword_782848 - (((unsigned int)qword_782848 >> 1) & 0x55555555)) & 0x33333333)
                       + ((((unsigned int)qword_782848 - (((unsigned int)qword_782848 >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 4)) & 0xF0F0F0F) >> 24)
                  + (16843009
                   * ((((HIDWORD(qword_782848) - ((HIDWORD(qword_782848) >> 1) & 0x55555555)) & 0x33333333)
                     + (((HIDWORD(qword_782848) - ((HIDWORD(qword_782848) >> 1) & 0x55555555)) >> 2) & 0x33333333)
                     + ((((HIDWORD(qword_782848) - ((HIDWORD(qword_782848) >> 1) & 0x55555555)) & 0x33333333)
                       + (((HIDWORD(qword_782848) - ((HIDWORD(qword_782848) >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 4)) & 0xF0F0F0F) >> 24)) > 8 )
  {
    sub_4274E8((int)"error positional: %s\n", (int)"pawn white > 8");
    v44 = sub_42714D(v43);
    fflush((FILE *)(v44 + 32));
  }
  if ( (signed int)((16843009
                   * (((((_DWORD)qword_782888 - (((unsigned int)qword_782888 >> 1) & 0x55555555)) & 0x33333333)
                     + ((((unsigned int)qword_782888 - (((unsigned int)qword_782888 >> 1) & 0x55555555)) >> 2) & 0x33333333)
                     + (((((_DWORD)qword_782888 - (((unsigned int)qword_782888 >> 1) & 0x55555555)) & 0x33333333)
                       + ((((unsigned int)qword_782888 - (((unsigned int)qword_782888 >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 4)) & 0xF0F0F0F) >> 24)
                  + (16843009
                   * ((((HIDWORD(qword_782888) - ((HIDWORD(qword_782888) >> 1) & 0x55555555)) & 0x33333333)
                     + (((HIDWORD(qword_782888) - ((HIDWORD(qword_782888) >> 1) & 0x55555555)) >> 2) & 0x33333333)
                     + ((((HIDWORD(qword_782888) - ((HIDWORD(qword_782888) >> 1) & 0x55555555)) & 0x33333333)
                       + (((HIDWORD(qword_782888) - ((HIDWORD(qword_782888) >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 4)) & 0xF0F0F0F) >> 24)) > 8 )
  {
    sub_4274E8((int)"error positional: %s\n", (int)"pawn black > 8");
    v46 = sub_42714D(v45);
    fflush((FILE *)(v46 + 32));
  }
  if ( (signed int)((16843009
                   * ((((LODWORD(qword_782840[0]) - ((LODWORD(qword_782840[0]) >> 1) & 0x55555555)) & 0x33333333)
                     + (((LODWORD(qword_782840[0]) - ((LODWORD(qword_782840[0]) >> 1) & 0x55555555)) >> 2) & 0x33333333)
                     + ((((LODWORD(qword_782840[0]) - ((LODWORD(qword_782840[0]) >> 1) & 0x55555555)) & 0x33333333)
                       + (((LODWORD(qword_782840[0]) - ((LODWORD(qword_782840[0]) >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 4)) & 0xF0F0F0F) >> 24)
                  + (16843009
                   * ((((HIDWORD(qword_782840[0]) - ((HIDWORD(qword_782840[0]) >> 1) & 0x55555555)) & 0x33333333)
                     + (((HIDWORD(qword_782840[0]) - ((HIDWORD(qword_782840[0]) >> 1) & 0x55555555)) >> 2) & 0x33333333)
                     + ((((HIDWORD(qword_782840[0]) - ((HIDWORD(qword_782840[0]) >> 1) & 0x55555555)) & 0x33333333)
                       + (((HIDWORD(qword_782840[0]) - ((HIDWORD(qword_782840[0]) >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 4)) & 0xF0F0F0F) >> 24)) > 16 )
  {
    sub_4274E8((int)"error positional: %s\n", (int)"piece white > 16");
    v48 = sub_42714D(v47);
    fflush((FILE *)(v48 + 32));
  }
  if ( (signed int)((16843009
                   * (((((_DWORD)qword_782880 - (((unsigned int)qword_782880 >> 1) & 0x55555555)) & 0x33333333)
                     + ((((unsigned int)qword_782880 - (((unsigned int)qword_782880 >> 1) & 0x55555555)) >> 2) & 0x33333333)
                     + (((((_DWORD)qword_782880 - (((unsigned int)qword_782880 >> 1) & 0x55555555)) & 0x33333333)
                       + ((((unsigned int)qword_782880 - (((unsigned int)qword_782880 >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 4)) & 0xF0F0F0F) >> 24)
                  + (16843009
                   * ((((HIDWORD(qword_782880) - ((HIDWORD(qword_782880) >> 1) & 0x55555555)) & 0x33333333)
                     + (((HIDWORD(qword_782880) - ((HIDWORD(qword_782880) >> 1) & 0x55555555)) >> 2) & 0x33333333)
                     + ((((HIDWORD(qword_782880) - ((HIDWORD(qword_782880) >> 1) & 0x55555555)) & 0x33333333)
                       + (((HIDWORD(qword_782880) - ((HIDWORD(qword_782880) >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 4)) & 0xF0F0F0F) >> 24)) > 16 )
  {
    sub_4274E8((int)"error positional: %s\n", (int)"piece black > 16");
    v50 = sub_42714D(v49);
    fflush((FILE *)(v50 + 32));
  }
  if ( (HIDWORD(qword_782848) | HIDWORD(qword_782888)) & 0xFF000000 | (unsigned __int8)(qword_782848 | (unsigned __int8)qword_782888) )
  {
    sub_4274E8((int)"error positional: %s\n", (int)"pawn rank one or eight");
    v52 = sub_42714D(v51);
    fflush((FILE *)(v52 + 32));
  }
  if ( v78 )
  {
    HIDWORD(v53) = HIDWORD(v78);
    v54 = v78;
    do
    {
      __asm { bsf     eax, dword ptr [ebp+var_10] }
      if ( _ZF )
      {
        __asm { bsf     eax, dword ptr [ebp+var_10+4] }
        if ( !_ZF )
          _EAX += 32;
      }
      LODWORD(v53) = v54;
      v54 &= v54 - 1;
      HIDWORD(v53) &= ((unsigned __int64)(v53 - 1) >> 32) - 1;
      v78 = __PAIR__(HIDWORD(v53), v54);
      qword_7828C8 |= 1i64 << byte_4374E0[_EAX];
      qword_7828D0 |= 1i64 << byte_437520[_EAX];
      qword_7828D8 |= 1i64 << byte_437560[_EAX];
    }
    while ( HIDWORD(v53) | v54 );
  }
  __asm { bsf     eax, dword ptr qword_782858 }
  if ( _ZF )
  {
    __asm { bsf     eax, dword ptr qword_782858+4 }
    if ( !_ZF )
      LOBYTE(_EAX) = _EAX + 32;
  }
  byte_7828E1 = _EAX;
  __asm { bsf     eax, dword ptr qword_782898 }
  if ( _ZF )
  {
    __asm { bsf     eax, dword ptr qword_782898+4 }
    if ( !_ZF )
      LOBYTE(_EAX) = _EAX + 32;
  }
  v62 = dword_740320;
  v63 = _EAX;
  v64 = *(_BYTE *)(dword_740320 + 24);
  byte_7828E2 = v63;
  if ( v64 & 1 && (byte_7828E1 != 4 || !(qword_782870 & *(_QWORD *)qword_5F79D8))
    || v64 & 2 && (byte_7828E1 != 4 || !(qword_782870 & *(_QWORD *)qword_5F79A0))
    || v64 & 4 && (v63 != 60 || !(qword_7828B0 & qword_5F7B98))
    || v64 & 8 && (v63 != 60 || !(qword_7828B0 & qword_5F7B60)) )
  {
    sub_4274E8((int)"error positional: %s\n", (int)"illegal castling");
    v66 = sub_42714D(v65);
    fflush((FILE *)(v66 + 32));
    v62 = dword_740320;
  }
  v67 = *(_BYTE *)(v62 + 24);
  *(_DWORD *)v62 ^= dword_5F8C60[2 * v67];
  *(_DWORD *)(v62 + 4) ^= dword_5F8C64[2 * v67];
  v68 = *(_BYTE *)(v62 + 26);
  if ( v68 )
  {
    v69 = v68 & 7;
    *(_DWORD *)v62 ^= dword_740340[2 * v69];
    *(_DWORD *)(v62 + 4) ^= dword_740344[2 * v69];
  }
  v70 = *(_DWORD *)(v62 + 12) ^ dword_5F8C64[2 * v67] ^ dword_71BA64[2 * (unsigned __int8)byte_7828E1] ^ dword_71CA64[2 * (unsigned __int8)byte_7828E2] ^ 0x74D3C012;
  _ZF = byte_7828E0 == 0;
  *(_DWORD *)(v62 + 8) ^= dword_5F8C60[2 * v67] ^ dword_71BA60[2 * (unsigned __int8)byte_7828E1] ^ dword_71CA60[2 * (unsigned __int8)byte_7828E2] ^ 0xA8BF965E;
  *(_DWORD *)(v62 + 12) = v70;
  if ( !_ZF )
  {
    v71 = dword_6FA164;
    *(_DWORD *)v62 ^= dword_6FA160;
    *(_DWORD *)(v62 + 4) ^= v71;
  }
  sub_402E80(-2147418112, 2147418112, 0);
  v72 = dword_740320;
  if ( !byte_7828E0 )
    goto LABEL_110;
  result = HIDWORD(qword_782898) & *(_DWORD *)(dword_740320 + 36) | qword_782898 & *(_DWORD *)(dword_740320 + 32);
  if ( qword_782898 & *(_QWORD *)(dword_740320 + 32) )
  {
    sub_4274E8((int)"error positional: %s\n", (int)"white captures king");
    v75 = sub_42714D(v74);
    result = fflush((FILE *)(v75 + 32));
    v72 = dword_740320;
  }
  if ( !byte_7828E0 )
  {
LABEL_110:
    result = HIDWORD(qword_782858) & *(_DWORD *)(v72 + 44) | qword_782858 & *(_DWORD *)(v72 + 40);
    if ( qword_782858 & *(_QWORD *)(v72 + 40) )
    {
      sub_4274E8((int)"error positional: %s\n", (int)"black captures king");
      v77 = sub_42714D(v76);
      result = fflush((FILE *)(v77 + 32));
    }
  }
  byte_5F8EE0 = 1;
  return result;
}
RobboLito's bitboard_initialization() (utils.c):

Code: Select all

void bitboard_initialization()
    {
    int i, b, piece;
    uint64 O;
    border_legitimate = FALSE;

    for ( i = 0; i < 16; i++ )
        POSITION.bitboard[i] = 0;
    DYNAMIC->Zobrist = DYNAMIC->ZobristPawn = 0;
    DYNAMIC->material_ = 0;
    DYNAMIC->statik = 0;

    for ( i = A1; i <= H8; i++ )
        {
        if( (piece = QU[i]) )
            {
            DYNAMIC->statik += static_value[piece][i];
            DYNAMIC->Zobrist ^= ZOBRIST[piece][i];

            if( piece == count_pawn_white || piece == count_pawn_black )
                DYNAMIC->ZobristPawn ^= ZOBRIST[piece][i];
            DYNAMIC->material_ += value_material_[piece];
            bitFIXED(i, POSITION.bitboard[QU[i]]);
            }
        }
    bitboard_occupied_white =
        bitboard_white_king | bitboard_white_queen | bitboard_white_rook | bitboard_white_bishop | bitboard_white_knight
            | bitboard_white_pawn;
    bitboard_occupied_black =
        bitboard_black_king | bitboard_black_queen | bitboard_black_rook | bitboard_black_bishop | bitboard_black_knight
            | bitboard_black_pawn;
    POSITION.occupied_black_white = bitboard_occupied_white | bitboard_occupied_black;
    POSITION.occupied_left90 = POSITION.occupied_left45 = POSITION.occupied_straight45 = 0;
    O = POSITION.occupied_black_white;

    if( POPCNT(bitboard_white_queen) > 1 || POPCNT(bitboard_black_queen) > 1 || POPCNT(bitboard_white_rook) > 2
        || POPCNT(bitboard_black_rook) > 2 || POPCNT(bitboard_white_clear) > 1 || POPCNT(bitboard_black_clear) > 1
        || POPCNT(bitboard_white_knight) > 2 || POPCNT(bitboard_black_knight) > 2 || POPCNT(bitboard_white_dark) > 1
        || POPCNT(bitboard_black_dark) > 1 )
        DYNAMIC->material_ |= 0x80000000;

    if( POPCNT(bitboard_white_king) != 1 )
        ERROR_pos("king white != 1");

    if( POPCNT(bitboard_black_king) != 1 )
        ERROR_pos("king black != 1");

    if( POPCNT(bitboard_white_queen) > 9 )
        ERROR_pos("queen white > 9");

    if( POPCNT(bitboard_black_queen) > 9 )
        ERROR_pos("queen black > 9");

    if( POPCNT(bitboard_white_rook) > 10 )
        ERROR_pos("rook white > 10");

    if( POPCNT(bitboard_black_rook) > 10 )
        ERROR_pos("rook black > 10");

    if( POPCNT(bitboard_white_clear) > 9 )
        ERROR_pos("chiaro white > 9");

    if( POPCNT(bitboard_black_clear) > 9 )
        ERROR_pos("chiaro black > 9");

    if( POPCNT(bitboard_white_dark) > 9 )
        ERROR_pos("dark white > 9");

    if( POPCNT(bitboard_black_dark) > 9 )
        ERROR_pos("dark black > 9");

    if( POPCNT(bitboard_white_clear | bitboard_white_dark) > 10 )
        ERROR_pos("bishop white > 10");

    if( POPCNT(bitboard_black_clear | bitboard_black_dark) > 10 )
        ERROR_pos("bishop black > 10");

    if( POPCNT(bitboard_white_knight) > 10 )
        ERROR_pos("knight white > 10");

    if( POPCNT(bitboard_black_knight) > 10 )
        ERROR_pos("knight black > 10");

    if( POPCNT(bitboard_white_pawn) > 8 )
        ERROR_pos("pawn white > 8");

    if( POPCNT(bitboard_black_pawn) > 8 )
        ERROR_pos("pawn black > 8");

    if( POPCNT(bitboard_occupied_white) > 16 )
        ERROR_pos("piece white > 16");

    if( POPCNT(bitboard_occupied_black) > 16 )
        ERROR_pos("piece black > 16");

    if( (bitboard_white_pawn | bitboard_black_pawn) & (RANK1 | RANK8) )
        ERROR_pos("pawn rank one or eight");

    while( O )
        {
        b = BSF(O);
        bit_FREE(b, O);
        bitFIXED(left90[b], POSITION.occupied_left90);
        bitFIXED(left45[b], POSITION.occupied_left45);
        bitFIXED(straight45[b], POSITION.occupied_straight45);
        }
    POSITION.white_king_square = BSF(bitboard_white_king);
    POSITION.black_king_square = BSF(bitboard_black_king);

    if( (castling_white_oo && (POSITION.white_king_square != E1 || !(bitboard_white_rook &square_fixed[H1])))
        || (castling_white_ooo && (POSITION.white_king_square != E1 || !(bitboard_white_rook &square_fixed[A1])))
            || (castling_black_oo && (POSITION.black_king_square != E8 || !(bitboard_black_rook &square_fixed[H8])))
            || (castling_black_ooo && (POSITION.black_king_square != E8 || !(bitboard_black_rook &square_fixed[A8]))) )
        ERROR_pos("castle illegale");
    DYNAMIC->Zobrist ^= zobrist_oo[DYNAMIC->castle];

    if( DYNAMIC->en_passant )
        DYNAMIC->Zobrist ^= zobrist_ep[DYNAMIC->en_passant & 7];
    DYNAMIC->ZobristPawn ^=
        zobrist_oo[DYNAMIC->castle] ^ PINCH ^ ZOBRIST[count_king_white][POSITION.white_king_square]
            ^ ZOBRIST[count_king_black][POSITION.black_king_square];

    if( POSITION.white_en_move )
        DYNAMIC->Zobrist ^= zobrist_move_white;
    call_value_full(0);

    if( POSITION.white_en_move && DYNAMIC->attak_white & bitboard_black_king )
        ERROR_pos("white capture re");

    if( !POSITION.white_en_move && DYNAMIC->attak_black & bitboard_white_king )
        ERROR_pos("black catture re");
    border_legitimate = TRUE;
    }
Houdini has modified the output but it's essentially the same code.
PAWN : Knight >> Bishop >> Rook >>Queen

Hood
Posts: 200
Joined: Thu Jun 10, 2010 2:36 pm
Real Name: Krzych C.

Re: Computer Chess Biggest Liar

Post by Hood » Wed Oct 12, 2011 2:24 pm

Jeremy Bernstein wrote:
Hood wrote:
Uly wrote:Religious discussion has been moved here:

http://www.open-chess.org/viewtopic.php?f=38&t=1653
it was not religious discussion but historical one
Whatever you want to call it, It was off-topic and has been relocated.
I wonder if that thread is of topic at all. That it is not in good taste it is for sure.
it is a personal attack, is not it ?
Smolensk 2010. Murder or accident... Cui bono ?

There are not bugs free programms. There are programms with undiscovered bugs.
Alleluia.

User avatar
kingliveson
Posts: 1388
Joined: Thu Jun 10, 2010 1:22 am
Real Name: Franklin Titus
Location: 28°32'1"N 81°22'33"W

Re: Computer Chess Biggest Liar

Post by kingliveson » Wed Oct 12, 2011 2:36 pm

Jeremy Bernstein wrote:
Someone needs to post the link to your post around, although some might consider that a witch hunt. That's pretty definitive evidence.

Not that it matters. ChessOK will continue to sell it, Houdart will continue to deny it, folks will continue to buy it...

jb
It seems that some people are hyper-sensitive to facts; and as you predicted, think that it's a witch-hunt. Well, how did we get here?

The day Houdini was released, I was the person who asked Robert a direct question regarding the engine's origin and whether it was based on RobboLito. The thread is now on one of the non-public forums on talkchess. Robert replied, paraphrasing, "based on, no, but taken ideas from." Since then, he has danced around the question using vague wording and cunning language, and recently, flat-out denying any IPPOLIT code in Houdini.

When has it become cool to accept and tolerate a bold-face lie -- in this case, a bold text lie? I happen to think that Houdini passes the legal test, but that's besides the point. There's a clear distinction between using ideas and taking an open-source program, modifying it, and refusing to acknowledge the derivation.

Although tough, a clear winner is definitely emerging per the initial question on the thread.
PAWN : Knight >> Bishop >> Rook >>Queen

User avatar
Uly
Posts: 838
Joined: Thu Jun 10, 2010 5:33 am

Re: Computer Chess Biggest Liar

Post by Uly » Wed Oct 12, 2011 7:57 pm

Hood wrote:I wonder if that thread is of topic at all.
All the content on that thread was unrelated to "Computer Chess Biggest Liar", so definitively off-topic.

Hood
Posts: 200
Joined: Thu Jun 10, 2010 2:36 pm
Real Name: Krzych C.

Re: Computer Chess Biggest Liar

Post by Hood » Wed Oct 12, 2011 9:14 pm

Uly wrote:
Hood wrote:I wonder if that thread is of topic at all.
All the content on that thread was unrelated to "Computer Chess Biggest Liar", so definitively off-topic.
You did not understand what i meant :-(

It seems that you forgot that forum is not the place for the personal attacks. The net-etiquette is forbiding that.
It allows to argue with views, opinions but disallows to estimate or offend someone.

So it is allowed to call sth as not true but is disallowed to call someone a liar etc.

Rgds
Hood
Smolensk 2010. Murder or accident... Cui bono ?

There are not bugs free programms. There are programms with undiscovered bugs.
Alleluia.

Post Reply