The move generation, eval, search, pv-node, cut-node, top-node, etc are all modifications of RobboLito's source code. Like RobboLito, Houdini does not support multi-pv. Robert Houdart was not inspired by IPPOLIT ideas as he would like you to believe, but rather that he took the entire source code as a starting base, modified it, and refuses to give attribution. Plagiarism is the right term for what Mr. Houdart has done -- and yes, he is dishonest.
Houdini's read fen:
Code: Select all
int __thiscall sub_419750(const char *this)
{
const char *v1; // esi@1
char *v2; // eax@1
char v3; // cl@2
const char *v4; // esi@3
char *v5; // eax@7
char v6; // cl@8
char *v7; // eax@43
char v8; // cl@44
int v9; // eax@46
char v10; // dl@48
bool v11; // zf@54
char *v12; // eax@63
char v13; // cl@64
const char *v14; // esi@65
char *v15; // eax@65
char v16; // dl@66
const char *v17; // esi@67
char *v18; // eax@67
char v19; // cl@68
int v20; // edi@69
const char *v22; // [sp-8h] [bp-41Ch]@42
char *v23; // [sp-4h] [bp-418h]@42
char v24; // [sp+8h] [bp-40Ch]@1
char v25; // [sp+9h] [bp-40Bh]@3
unsigned int v26; // [sp+40Ch] [bp-8h]@1
v26 = &v24 ^ __security_cookie;
v1 = this;
sscanf(this, "%s", &v24);
sub_4194D0(&v24);
memset(dword_5874F8, 0, 0x3A000u);
v2 = &v24;
dword_5854F0[0] = dword_5874F8;
do
v3 = *v2++;
while ( v3 );
v4 = &v1[v2 - &v25 + 1];
sscanf(v4, "%s", &v24);
if ( v24 == 'w' )
{
byte_5854EA[0] = 1;
}
else
{
if ( v24 != 'b' )
{
v23 = &v24;
v22 = "ERROR: fen invalid color <%s>";
goto LABEL_71;
}
byte_5854EA[0] = 0;
}
v5 = &v24;
do
v6 = *v5++;
while ( v6 );
v4 += v5 - &v25 + 1;
sscanf(v4, "%s", &v24);
*(dword_5854F0[0] + 25) = 16;
if ( !strcmp(&v24, "KQkq") )
*(dword_5854F0[0] + 25) = 15;
if ( !strcmp(&v24, "Qkq") )
*(dword_5854F0[0] + 25) = 14;
if ( !strcmp(&v24, "Kkq") )
*(dword_5854F0[0] + 25) = 13;
if ( !strcmp(&v24, "kq") )
*(dword_5854F0[0] + 25) = 12;
if ( !strcmp(&v24, "KQq") )
*(dword_5854F0[0] + 25) = 11;
if ( !strcmp(&v24, "Qq") )
*(dword_5854F0[0] + 25) = 10;
if ( !strcmp(&v24, "Kq") )
*(dword_5854F0[0] + 25) = 9;
if ( !strcmp(&v24, "q") )
*(dword_5854F0[0] + 25) = 8;
if ( !strcmp(&v24, "KQk") )
*(dword_5854F0[0] + 25) = 7;
if ( !strcmp(&v24, "Qk") )
*(dword_5854F0[0] + 25) = 6;
if ( !strcmp(&v24, "Kk") )
*(dword_5854F0[0] + 25) = 5;
if ( !strcmp(&v24, "k") )
*(dword_5854F0[0] + 25) = 4;
if ( !strcmp(&v24, "KQ") )
*(dword_5854F0[0] + 25) = 3;
if ( !strcmp(&v24, "Q") )
*(dword_5854F0[0] + 25) = 2;
if ( !strcmp(&v24, "K") )
*(dword_5854F0[0] + 25) = 1;
if ( !strcmp(&v24, "-") )
*(dword_5854F0[0] + 25) = 0;
if ( *(dword_5854F0[0] + 25) == 16 )
{
v23 = &v24;
v22 = "ERROR: fen invalid castle <%s>";
LABEL_71:
sub_427470(v22, v23);
return v4;
}
v7 = &v24;
do
v8 = *v7++;
while ( v8 );
v4 += v7 - &v25 + 1;
sscanf(v4, "%s", &v24);
*(dword_5854F0[0] + 26) = 0;
if ( strcmp(&v24, "-") )
{
v9 = v24 + 8 * v25 - 489;
if ( v9 > 63 )
{
v23 = &v24;
v22 = "ERROR: fen invalid en-passant <%s>";
goto LABEL_71;
}
v10 = 0;
if ( v24 + 8 * v25 != 489 )
{
if ( byte_5854EA[0] )
{
if ( v9 & 7 && byte_585377[v9] == 1 )
v10 = 1;
if ( (v9 & 7) == 7 )
goto LABEL_61;
v11 = byte_585379[v9] == 1;
}
else
{
if ( v9 & 7 && byte_585387[v9] == 9 )
v10 = 1;
if ( (v9 & 7) == 7 )
goto LABEL_61;
v11 = *(&dword_585388 + v9 + 1) == 9;
}
if ( v11 )
{
LABEL_62:
*(dword_5854F0[0] + 26) = v24 + 8 * v25 + 23;
goto LABEL_63;
}
LABEL_61:
if ( !v10 )
goto LABEL_63;
goto LABEL_62;
}
}
LABEL_63:
v12 = &v24;
do
v13 = *v12++;
while ( v13 );
v14 = &v4[v12 - &v25 + 1];
sscanf(v14, "%s", &v24);
*(dword_5854F0[0] + 227) = _atoi64(&v24);
v15 = &v24;
do
v16 = *v15++;
while ( v16 );
v17 = &v14[v15 - &v25 + 1];
sscanf(v17, "%s", &v24);
v18 = &v24;
do
v19 = *v18++;
while ( v19 );
v20 = v18 - &v25;
sub_4265A0();
return &v17[v20 + 1];
}
Code: Select all
char *law_fen( char *I )
{
char i[1024];
bool ok;
int en_passant;
sscanf(I, "%s", i);
fen_positional(i);
memset(dynamic_initial, 0, 256 * sizeof(type_dynamic));
DYNAMIC = dynamic_initial;
I += strlen(i) + 1;
sscanf(I, "%s", i);
if( i[0] == 'w' )
POSITION.white_en_move = TRUE;
else if( i[0] == 'b' )
POSITION.white_en_move = FALSE;
else
ERROR_fen("FEN wb %s\n", i);
I += strlen(i) + 1;
sscanf(I, "%s", i);
DYNAMIC->castle = 16;
if( !strcmp(i, "KQkq") )
DYNAMIC->castle = 15;
if( !strcmp(i, "Qkq") )
DYNAMIC->castle = 14;
if( !strcmp(i, "Kkq") )
DYNAMIC->castle = 13;
if( !strcmp(i, "kq") )
DYNAMIC->castle = 12;
if( !strcmp(i, "KQq") )
DYNAMIC->castle = 11;
if( !strcmp(i, "Qq") )
DYNAMIC->castle = 10;
if( !strcmp(i, "Kq") )
DYNAMIC->castle = 9;
if( !strcmp(i, "q") )
DYNAMIC->castle = 8;
if( !strcmp(i, "KQk") )
DYNAMIC->castle = 7;
if( !strcmp(i, "Qk") )
DYNAMIC->castle = 6;
if( !strcmp(i, "Kk") )
DYNAMIC->castle = 5;
if( !strcmp(i, "k") )
DYNAMIC->castle = 4;
if( !strcmp(i, "KQ") )
DYNAMIC->castle = 3;
if( !strcmp(i, "Q") )
DYNAMIC->castle = 2;
if( !strcmp(i, "K") )
DYNAMIC->castle = 1;
if( !strcmp(i, "-") )
DYNAMIC->castle = 0;
if( DYNAMIC->castle == 16 )
ERROR_fen("FEN oo %s\n", i);
I += strlen(i) + 1;
sscanf(I, "%s", i);
DYNAMIC->en_passant = 0;
if( !strcmp(i, "-") )
en_passant = 0;
else
{
en_passant = (i[0] - 'a') + 8 * (i[1] - '1');
if( en_passant > H8 )
ERROR_fen("FEN ep %s\n", i);
ok = 0;
}
if( en_passant )
{
if( POSITION.white_en_move )
{
if( FILE(en_passant) != CA && (QU[en_passant - 9] == count_pawn_white) )
ok = TRUE;
if( FILE(en_passant) != CH && (QU[en_passant - 7] == count_pawn_white) )
ok = TRUE;
}
else
{
if( FILE(en_passant) != CA && (QU[en_passant + 7] == count_pawn_black) )
ok = TRUE;
if( FILE(en_passant) != CH && (QU[en_passant + 9] == count_pawn_black) )
ok = TRUE;
}
if( ok )
DYNAMIC->en_passant = en_passant;
}
I += strlen(i) + 1;
sscanf(I, "%s", i);
DYNAMIC->move50 = (uint8)_atoi64(i);
I += strlen(i) + 1;
sscanf(I, "%s", i);
I += strlen(i) + 1;
bitboard_initialization();
return I;
}
Code: Select all
int __cdecl sub_4194D0(int a1)
{
int v1; // ebp@1
signed int v2; // edi@1
signed int v3; // esi@1
int result; // eax@3
int v5; // edx@10
int v6; // edx@18
v1 = 0;
v2 = 7;
v3 = 0;
memset(byte_585380, 0, 0x40u);
while ( 2 )
{
result = *(a1 + v1++);
if ( !result )
return result;
if ( v3 == 8 && result != 47 )
return sub_427470("ERROR: fen <%s> file <%d>, rank <%d>, piece <%d>", a1, 8, v2, result);
switch ( result )
{
case '/':
--v2;
v3 = 0;
goto LABEL_32;
case 'p':
*(&byte_585380[8 * v2] + v3) = 9;
goto LABEL_9;
case '1':
LABEL_9:
++v3;
goto LABEL_32;
case 'b':
v5 = v3 + 8 * v2;
result = dword_828A7C[2 * v5] & 0xAA55AA55 | dword_828A78[2 * v5] & 0xAA55AA55;
if ( result )
{
byte_585380[v5] = 13;
++v3;
}
else
{
byte_585380[v5] = 12;
++v3;
}
goto LABEL_32;
case 'n':
*(&byte_585380[8 * v2] + v3++) = 10;
goto LABEL_32;
case 'r':
*(&byte_585380[8 * v2] + v3++) = 14;
goto LABEL_32;
case 'q':
*(&byte_585380[8 * v2] + v3++) = 15;
goto LABEL_32;
case 'k':
*(&byte_585380[8 * v2] + v3++) = 11;
goto LABEL_32;
case 'P':
*(&byte_585380[8 * v2] + v3++) = 1;
goto LABEL_32;
case 'B':
v6 = v3 + 8 * v2;
result = dword_828A7C[2 * v6] & 0xAA55AA55 | dword_828A78[2 * v6] & 0xAA55AA55;
if ( result )
{
byte_585380[v6] = 5;
++v3;
}
else
{
byte_585380[v6] = 4;
++v3;
}
goto LABEL_32;
case 'N':
*(&byte_585380[8 * v2] + v3++) = 2;
goto LABEL_32;
case 'R':
*(&byte_585380[8 * v2] + v3++) = 6;
goto LABEL_32;
case 'Q':
*(&byte_585380[8 * v2] + v3++) = 7;
goto LABEL_32;
case 'K':
*(&byte_585380[8 * v2] + v3++) = 3;
goto LABEL_32;
case '2':
v3 += 2;
goto LABEL_32;
case '3':
v3 += 3;
goto LABEL_32;
case '4':
v3 += 4;
goto LABEL_32;
case '5':
v3 += 5;
goto LABEL_32;
case '6':
v3 += 6;
goto LABEL_32;
case '7':
v3 += 7;
goto LABEL_32;
case '8':
v3 += 8;
LABEL_32:
if ( !v2 )
{
if ( v3 >= 8 )
return result;
continue;
}
if ( v2 >= 0 && v3 <= 8 )
continue;
return sub_427470("ERROR: fen <%s> file <%d>, rank <%d>", a1, v3, v2);
default:
return sub_427470("ERROR: fen <%s> file <%d>, rank <%d>, piece <%d>", a1, v3, v2, result);
}
}
}
Code: Select all
static void fen_positional( char *I )
{
int tr = 7, co = 0, c = 0, i, p;
for ( i = A1; i <= H8; i++ )
QU[i] = 0;
while( 1 )
{
if( tr < 0 || co > 8 )
ERROR_fen("FEN %s col: %d tra: %d\n", I, co, tr);
p = I[c++];
if( p == 0 )
return;
if( co == 8 && p != '/' )
ERROR_fen("FEN %s col: %d tra: %d pez: %d\n", I, co, tr, p);
switch( p )
{
case '/':
tr--;
co = 0;
break;
case 'p':
QU[co + 8 * tr] = count_pawn_black;
co++;
break;
case 'b':
if( square_fixed[co + 8 * tr] & DARK )
QU[co + 8 * tr] = count_dark_black;
else
QU[co + 8 * tr] = count_clear_black;
co++;
break;
case 'n':
QU[co + 8 * tr] = count_knight_black;
co++;
break;
case 'r':
QU[co + 8 * tr] = count_rook_black;
co++;
break;
case 'q':
QU[co + 8 * tr] = count_queen_black;
co++;
break;
case 'k':
QU[co + 8 * tr] = count_king_black;
co++;
break;
case 'P':
QU[co + 8 * tr] = count_pawn_white;
co++;
break;
case 'B':
if( square_fixed[co + 8 * tr] & DARK )
QU[co + 8 * tr] = count_dark_white;
else
QU[co + 8 * tr] = count_clear_white;
co++;
break;
case 'N':
QU[co + 8 * tr] = count_knight_white;
co++;
break;
case 'R':
QU[co + 8 * tr] = count_rook_white;
co++;
break;
case 'Q':
QU[co + 8 * tr] = count_queen_white;
co++;
break;
case 'K':
QU[co + 8 * tr] = count_king_white;
co++;
break;
case '1':
co += 1;
break;
case '2':
co += 2;
break;
case '3':
co += 3;
break;
case '4':
co += 4;
break;
case '5':
co += 5;
break;
case '6':
co += 6;
break;
case '7':
co += 7;
break;
case '8':
co += 8;
break;
default:
ERROR_fen("FEN %s col:%d tra:%d pez:%d\n", I, co, tr, p);
}
if( (tr == 0) && (co >= 8) )
break;
}
}
Code: Select all
int __usercall sub_41A080<eax>(const char *this<ecx>, __int128 _XMM0<xmm0>)
{
const char *v2; // esi@1
int result; // eax@3
int v4; // [sp+4h] [bp-410h]@1
char v5; // [sp+8h] [bp-40Ch]@1
unsigned int v6; // [sp+40Ch] [bp-8h]@1
v6 = &v4 ^ __security_cookie;
_mm_storel_pd(&qword_8FC268, 0);
v2 = this;
_mm_storel_pd(&qword_926670, 0);
_mm_storel_pd(&qword_8F3160, 0);
sscanf(this, "%s", &v5);
if ( !strcmp(&v5, "startpos") )
{
sub_419750("rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1");
v2 += 9;
}
result = strcmp(&v5, "fen");
if ( !result )
{
result = sub_419750(v2 + 4);
v2 = result;
}
if ( *v2 )
{
sscanf(v2, "%s", &v5);
result = strcmp(&v5, "moves");
if ( !result )
result = sub_419DF0(v2 + 6);
}
if ( byte_484AAC )
result = sub_40FF60();
return result;
}
Code: Select all
static char position_original[80] = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1";
void positional_initialization( char *I )
{
char i[1024];
move_white_number = move_black_number = move_null_number = 0;
sscanf(I, "%s", i);
if( !strcmp(i, "startpos") )
{
law_fen(position_original);
I += strlen("startpos") + 1;
}
if( !strcmp(i, "fen") )
{
I += strlen("fen") + 1;
I = law_fen(I);
}
if( I[0] )
{
sscanf(I, "%s", i);
if( !strcmp(i, "moves") )
{
I += strlen("moves") + 1;
legal_moves(I);
}
}
if( GAME_NEW )
gain_reset();
}
Code: Select all
int __cdecl sub_419DF0(char *a1)
{
int result; // eax@1
char *v2; // ebp@1
int v3; // eax@3
int v4; // ecx@3
int v5; // edi@7
int v6; // eax@10
int v7; // eax@13
int v8; // ecx@16
int v9; // edx@16
unsigned int v10; // eax@16
int v11; // ebx@17
int v12; // esi@18
char *v13; // eax@29
char v14; // cl@30
char v15; // al@32
int v16; // edi@40
int v17; // esi@40
char *v18; // eax@47
char v19; // cl@48
bool v20; // zf@49
int v21[256]; // [sp+10h] [bp-508h]@1
char v22; // [sp+410h] [bp-108h]@29
_BYTE v23[3]; // [sp+411h] [bp-107h]@31
unsigned int v24; // [sp+514h] [bp-4h]@1
result = v21 ^ __security_cookie;
v24 = v21 ^ __security_cookie;
v2 = a1;
if ( *a1 )
{
while ( 1 )
{
sub_404AD0(-30000, 30000, 0, 0);
if ( byte_5854EA[0] )
{
v3 = *(dword_5854F0[0] + 200);
v4 = *(dword_5854F0[0] + 204);
}
else
{
v3 = *(dword_5854F0[0] + 208);
v4 = *(dword_5854F0[0] + 212);
}
if ( v4 | v3 )
{
if ( byte_5854EA[0] )
v5 = sub_409680(v21, -1i64) + 4;
else
v5 = sub_409EC0(-1, -1) + 4;
}
else
{
if ( byte_5854EA[0] )
v6 = sub_40A6E0(qword_5854E0[0] & qword_5854A0, (*qword_5854E0 & qword_5854A0) >> 32);
else
v6 = sub_40ADC0(qword_5854E0[0] & qword_585460, (*qword_5854E0 & qword_585460) >> 32);
if ( byte_5854EA[0] )
v7 = sub_40B4B0(v6);
else
v7 = sub_40BE30(v6);
v5 = v7;
}
v8 = v2[2] + 8 * (v2[3] + 8 * (*v2 + 8 * v2[1] - 392) - 776) - 489;
v9 = (v2[2] + 8 * (v2[3] + 8 * (*v2 + 8 * v2[1] + 120) - 8) + 23) & 0x3F;
v10 = ((v2[2] + 8 * (v2[3] + 8 * (*v2 + 8 * v2[1] - 392) - 776) - 489) >> 6) & 0x3F;
if ( v2[2] + 8 * (v2[3] + 8 * (*v2 + 8 * v2[1] - 392) - 776) == 489 )
{
v11 = 0;
}
else
{
v12 = byte_585380[v10];
if ( (v12 == 3 || v12 == 11) && (v9 - v10 == 2 || v10 - v9 == 2) )
v8 |= 0x1000u;
if ( v8 & 0x3F && (v8 & 0x3F) == *(dword_5854F0[0] + 26) && (v12 == 1 || v12 == 9) )
v8 |= 0x3000u;
v11 = v8;
}
sscanf(v2, "%s", &v22);
v13 = &v22;
do
v14 = *v13++;
while ( v14 );
if ( v13 - v23 == 5 )
{
v15 = v2[4];
if ( v15 == 'b' )
v11 |= 0x5000u;
if ( v15 == 'n' )
v11 |= 0x4000u;
if ( v15 == 'r' )
v11 |= 0x6000u;
if ( v15 == 'q' )
v11 |= 0x7000u;
}
v16 = (v5 - v21) >> 2;
v17 = 0;
if ( v16 > 0 )
{
while ( v11 != (v21[v17] & 0x7FFF) )
{
++v17;
if ( v17 >= v16 )
goto LABEL_47;
}
if ( byte_5854EA[0] )
sub_410440(v11);
else
sub_410B20(v11);
}
LABEL_47:
v18 = &v22;
if ( v17 == v16 )
break;
do
v19 = *v18++;
while ( v19 );
result = v18 - v23;
v20 = v2[result + 1] == 32;
v2 += result + 1;
if ( v20 )
{
do
++v2;
while ( *v2 == ' ' );
}
if ( !*v2 )
return result;
}
result = sub_427470("ERROR: invalid move <%s>", &v22);
}
return result;
}
Code: Select all
static void legal_moves( char *I )
{
type_list_move LIST[256], *list;
char T[256];
int i;
uint32 total;
while( I[0] )
{
mobility();
if( CHECK )
{
list = evasion_move(LIST, 0xffffffffffffffff);
list++;
}
else
{
list = capture_move(LIST, POSITION.occupied_black_white);
list = ordinary_move(list);
}
total = move_completa((I[2] - 'a') + ((I[3] - '1') << 3) + ((I[0] - 'a') << 6) + ((I[1] - '1') << 9));
sscanf(I, "%s", T);
if( strlen(T) == 5 )
{
if( I[4] == 'b' )
total |= flag_promotion_bishop;
if( I[4] == 'n' )
total |= flag_promotion_knight;
if( I[4] == 'r' )
total |= flag_promotion_rook;
if( I[4] == 'q' )
total |= flag_promotion_queen;
}
for ( i = 0; i < list - LIST; i++ )
{
if( total == (LIST[i].move & 0x7fff) )
{
make(total);
break;
}
}
if( i == list - LIST )
{
ERROR_("moves? %s\n", T);
}
I += strlen(T) + 1;
while( I[0] == ' ' )
I++;
}
}
Code: Select all
#define flag_en_passant 030000
#define flag_castling 010000
#define flag_hide 070000
#define flag_promotion_queen 070000
#define flag_promotion_rook 060000
#define flag_promotion_bishop 050000
#define flag_promotion_knight 040000
For example, you dont see "total = move_completa((I[2] - 'a') + ((I[3] - '1') << 3) + ((I[0] - 'a') << 6) + ((I[1] - '1') << 9));" in the disassembled code above, but it is computed there if you look a little closer.
RobboLito's, (position.c):
Code: Select all
static uint32 move_completa( uint32 x )
{
int piece, ai = AI(x), di = DI(x);
if( !x )
return x;
piece = QU[di];
if( piece == count_king_white || piece == count_king_black )
{
if( ai - di == 2 || di - ai == 2 )
x |= flag_castling;
}
if( AI(x) != 0 && AI(x) == DYNAMIC->en_passant && (piece == count_pawn_white || piece == count_pawn_black) )
x |= flag_en_passant;
return x;
}
RobboLito's (move_gen.c):
Code: Select all
#define pawn_queen ( 0xd8 << 24 )
#define pawn_knight ( 0xc2 << 24 )
#define flag_check 0x8000
#define move_ANNEX(L, x, piece, ai, sca) \
{ (L++)->move = (x) \
| ( (square_fixed[ai] & (sca) ) ? flag_check : 0) \
| ( history_value[piece][ai] << 16); }
#define ANNEX_AI_ORD(T, piece, sca) \
{ while (T) \
{ ai = BSF(T); \
move_ANNEX (LIST, (qu << 6) | ai, piece, ai, sca); \
bit_FREE (ai, T); } }
#define under_promotion_white() \
{ if ( (attack_knight[ai] & bitboard_black_king) == 0) \
move_ANNEX ( LIST, flag_promotion_knight | (qu << 6) | ai, \
count_pawn_white, ai, 0); \
move_ANNEX (LIST, flag_promotion_rook | (qu << 6) | ai, \
count_pawn_white, ai, 0); \
move_ANNEX (LIST, flag_promotion_bishop | (qu << 6) | ai, \
count_pawn_white, ai, 0); }
#define under_promotion_black() \
{ if ( (attack_knight[ai] & bitboard_white_king) == 0) \
move_ANNEX (LIST, flag_promotion_knight | (qu << 6) | ai, \
count_pawn_black, ai, 0); \
move_ANNEX (LIST, flag_promotion_rook | (qu << 6) | ai, \
count_pawn_black, ai, 0); \
move_ANNEX (LIST, flag_promotion_bishop | (qu << 6) | ai, \
count_pawn_black, ai, 0); }
#define OK(x) \
( ((x & 0x7fff) != s1) && ((x & 0x7fff) != s2) && ((x & 0x7fff) != s3) )
Code: Select all
int __usercall sub_409680<eax>(int result<eax>, __int64 a2)
{
int _EDX; // edx@1
bool _ZF; // zf@1
int _EBX; // ebx@1
int v8; // esi@1
int _EDI; // edi@1
int _EBX; // ebx@2
int v11; // ebp@3
int v12; // edx@3
int v13; // ecx@3
int v14; // edi@3
unsigned __int64 v15; // kr00_8@3
int v16; // ebp@4
int v17; // ebx@4
int v18; // esi@6
int v19; // esi@6
int v20; // edi@6
int v21; // esi@6
int v22; // edi@6
int v23; // ebp@6
int _EBX; // ebx@6
unsigned int _EDX; // edx@6
int _EDI; // edi@6
int _ECX; // ecx@6
int _ESI; // esi@7
int _ESI; // esi@8
int v30; // edi@9
int v31; // esi@10
int _ESI; // esi@12
int _ESI; // esi@13
int v34; // ebp@14
unsigned int v35; // ebx@16
int v36; // ebp@16
int _ESI; // esi@17
int _ESI; // esi@18
__int64 _QDI; // qdi@22
unsigned __int64 v40; // qt0@22
int _EDI; // edi@23
int _ESI; // esi@23
int _ECX; // ecx@23
int v44; // esi@24
int _ECX; // ecx@25
int v46; // edi@26
int v47; // ecx@26
int v48; // edx@30
unsigned __int64 v49; // qt0@30
int _ECX; // ecx@31
int v52; // esi@32
int _ECX; // ecx@33
int v54; // edi@34
int v55; // ecx@34
int v56; // ecx@37
unsigned __int64 v57; // qt0@38
int v58; // esi@41
unsigned __int64 v59; // qt0@41
__int64 _QDI; // qdi@44
int _ECX; // ecx@45
int _EDX; // edx@46
char v63; // dl@47
int v64; // ecx@47
unsigned int _EDX; // edx@51
int _ECX; // ecx@51
int _ESI; // esi@52
int _ESI; // esi@53
int v69; // ebp@54
char *v70; // edi@55
int v71; // esi@56
int _ECX; // ecx@56
int _EDX; // edx@56
int v74; // edi@57
int _ESI; // esi@58
int _ESI; // esi@59
int v77; // ebp@60
char *v78; // ebp@63
int v79; // esi@64
unsigned int v80; // edx@64
int _ECX; // ecx@64
int _EDI; // edi@64
int _EDX; // edx@66
int _EDX; // edx@67
char *v85; // ebp@71
int v86; // esi@72
unsigned int v87; // edx@72
int _ECX; // ecx@72
int _EDI; // edi@72
int _EDX; // edx@74
int _EDX; // edx@75
char *v92; // ebx@79
int v93; // edx@80
int v94; // edi@80
int v95; // ebp@80
int v96; // esi@80
unsigned int v97; // edi@80
unsigned int v98; // esi@80
int _EBP; // ebp@80
int _ECX; // ecx@80
int _ESI; // esi@82
int _EDX; // edx@83
__int64 v103; // [sp+4h] [bp-1Ch]@2
__int64 v104; // [sp+Ch] [bp-14h]@3
int v105; // [sp+14h] [bp-Ch]@80
unsigned int v106; // [sp+24h] [bp+4h]@16
int v107; // [sp+28h] [bp+8h]@16
_EDX = *(dword_5854F0[0] + 200);
__asm { bsf ebx, edx }
v8 = byte_5854E8[0];
_EDI = *(dword_5854F0[0] + 204);
if ( _ZF )
{
__asm { bsf ebx, edi }
LODWORD(v103) = _EBX;
_EBX = _EBX + 32;
}
LODWORD(v103) = _EBX;
v11 = __CFADD__(_EDX, -1) + _EDI - 1;
LODWORD(v104) = (_EDX - 1) & _EDX;
v12 = *(dword_5854F0[0] + 40);
v13 = *(dword_5854F0[0] + 44);
HIDWORD(v104) = v11 & _EDI;
v14 = _EBX;
v15 = a2 & __PAIR__(~HIDWORD(qword_585460) & ~v13, ~qword_585460 & ~v12);
if ( byte_585380[_EBX] == 9 )
{
v16 = dword_926678[2 * byte_5854E8[0]];
v17 = dword_92667C[2 * byte_5854E8[0]];
}
else
{
_mm_storel_pd(&v103, 0);
v17 = HIDWORD(v103);
v16 = v103;
}
v18 = v8 << 6;
LODWORD(v103) = v18;
v19 = 4 * (v14 + v18);
v20 = dword_91E270[2 * v19 / 4u];
v21 = 2 * v19;
v22 = v16 | v20;
v23 = v17 | *(dword_91E274 + v21);
_EBX = HIDWORD(v104);
_EDX = v22 & v15;
_EDI = v104;
_ECX = v23 & HIDWORD(v15);
if ( !v104 )
{
v35 = *(&dword_8F3368 + v21) & a2;
v36 = *(&dword_8F336C + v21) & HIDWORD(a2);
LODWORD(a2) = *(&dword_8F3368 + v21) & a2;
v107 = *(&dword_8F336C + v21) & HIDWORD(a2);
if ( __PAIR__(_ECX, _EDX) )
{
do
{
__asm { bsf esi, edx }
if ( _ZF )
{
__asm { bsf esi, ecx }
LODWORD(v104) = _ESI;
_ESI = _ESI + 32;
}
_ECX &= ((__PAIR__(_ECX, _EDX) - 1) >> 32) - 1;
_EDX &= _EDX - 1;
*result = dword_931450[byte_585380[_ESI]] | (_ESI + v103);
result += 4;
}
while ( __PAIR__(_ECX, _EDX) );
v36 = v107;
}
if ( v36 | v35 )
{
_QDI = qword_5854A0;
HIDWORD(v40) = qword_585468[1] & 0xFFFF7F7F;
LODWORD(v40) = qword_585468[0] & 0x7F7F7F7F;
if ( v36 & HIDWORD(qword_5854A0) & (v40 >> 23) | v35 & qword_5854A0 & ((qword_585468[0] & 0x7F7F7F7F) << 9) )
{
_EDI = v35 & qword_5854A0;
_ESI = v36 & HIDWORD(qword_5854A0);
__asm { bsf ecx, edi }
if ( _ZF )
{
__asm { bsf ecx, esi }
LODWORD(v104) = _ECX;
v44 = _ECX + 32;
}
else
{
v44 = _ECX;
}
v46 = byte_585380[v44];
v36 = v107;
v47 = v44 + ((v44 - 9) << 6);
if ( (v44 & 56) == 56 )
{
*result = v47 | (dword_9313D0[v46] + 536870912) | 0x7000;
*(result + 4) = v47 | 0x4000;
*(result + 8) = v47 | 0x6000;
*(result + 12) = v47 | 0x5000;
result += 16;
}
else
{
result += 4;
*(result - 4) = dword_9313D0[v46] | v47;
}
_QDI = qword_5854A0;
}
v48 = qword_585468[1];
HIDWORD(v49) = v48 & 0xFEFEFE;
LODWORD(v49) = qword_585468[0] & 0xFEFEFEFE;
if ( v36 & HIDWORD(_QDI) & (v49 >> 25) | v35 & _QDI & ((qword_585468[0] & 0xFEFEFEFE) << 7) )
{
LODWORD(_QDI) = v35 & _QDI;
HIDWORD(_QDI) &= v36;
__asm { bsf ecx, edi }
if ( _ZF )
{
__asm { bsf ecx, esi }
LODWORD(v104) = _ECX;
v52 = _ECX + 32;
}
else
{
v52 = _ECX;
}
v54 = byte_585380[v52];
v36 = v107;
v55 = v52 + ((v52 - 7) << 6);
if ( (v52 & 56) == 56 )
{
*result = v55 | (dword_9313D0[v54] + 536870912) | 0x7000;
*(result + 4) = v55 | 0x4000;
*(result + 8) = v55 | 0x6000;
*(result + 12) = v55 | 0x5000;
result += 16;
}
else
{
result += 4;
*(result - 4) = dword_9313D0[v54] | v55;
}
}
v56 = *(dword_5854F0[0] + 26);
if ( *(dword_5854F0[0] + 26) )
{
HIDWORD(v57) = qword_585468[1] & 0xFFFF7F7F;
LODWORD(v57) = qword_585468[0] & 0x7F7F7F7F;
if ( dword_828A7C[2 * v56] & (v57 >> 23) | dword_828A78[2 * v56] & ((qword_585468[0] & 0x7F7F7F7F) << 9)
&& v36 & dword_828A3C[2 * v56] | v35 & dword_828A38[2 * v56] )
{
*result = dword_9313F4 | (v56 + ((v56 - 9) << 6)) | 0x3000;
result += 4;
}
v58 = qword_585468[1];
HIDWORD(v59) = v58 & 0xFEFEFE;
LODWORD(v59) = qword_585468[0] & 0xFEFEFEFE;
if ( dword_828A7C[2 * v56] & (v59 >> 25) | dword_828A78[2 * v56] & ((qword_585468[0] & 0xFEFEFEFE) << 7)
&& v36 & dword_828A3C[2 * v56] | v35 & dword_828A38[2 * v56] )
{
*result = dword_9313F4 | (v56 + ((v56 - 7) << 6)) | 0x3000;
result += 4;
}
}
LODWORD(_QDI) = qword_585468[0] & (__PAIR__(v36, v35) >> 8) & (~*qword_5854E0 >> 8);
HIDWORD(_QDI) = qword_585468[1] & (v36 >> 8) & (~qword_5854E0[1] >> 8);
if ( __PAIR__(HIDWORD(_QDI), qword_585468[0] & (__PAIR__(v36, v35) >> 8) & (~*qword_5854E0 >> 8)) )
{
do
{
__asm { bsf ecx, edi }
if ( _ZF )
{
__asm { bsf edx, esi }
LODWORD(v104) = _EDX;
_ECX = _EDX + 32;
}
HIDWORD(_QDI) &= ((_QDI - 1) >> 32) - 1;
LODWORD(_QDI) = (_QDI - 1) & _QDI;
v63 = (_ECX + 8) & 0x38;
v64 = _ECX + 8 + (_ECX << 6);
if ( v63 == 0x38 )
{
*result = v64 | dword_9313D0[0] | 0x7000;
*(result + 4) = v64 | 0x4000;
*(result + 8) = v64 | 0x6000;
*(result + 12) = v64 | 0x5000;
result += 16;
}
else
{
result += 4;
*(result - 4) = dword_9313D0[0] | v64;
}
}
while ( _QDI );
}
_EDX = 0;
_ECX = qword_585468[0] & (HIWORD(v35) & (~*qword_5854E0 >> 8) & (~qword_5854E0[0] >> 16)) & 0xFF00;
if ( qword_585468[0] & (HIWORD(v35) & (~*qword_5854E0 >> 8) & (~qword_5854E0[0] >> 16)) & 0xFF00 )
{
do
{
__asm { bsf esi, ecx }
if ( _ZF )
{
__asm { bsf esi, edx }
LODWORD(v104) = _ESI;
_ESI = _ESI + 32;
}
v69 = __CFADD__(_ECX, -1) + _EDX - 1;
_ECX &= _ECX - 1;
_EDX &= v69;
*result = dword_9313D0[0] | (65 * _ESI + 16);
result += 4;
}
while ( __PAIR__(_ECX, _EDX) );
}
v70 = &byte_585401;
if ( byte_585401 != -1 )
{
do
{
v71 = *v70;
_ECX = v107 & dword_8F217C[2 * v71];
_EDX = v35 & dword_8F2178[2 * v71];
++v70;
_ZF = __PAIR__(_ECX, v35 & dword_8F2178[2 * v71]) == 0;
LODWORD(v103) = v70;
if ( !_ZF )
{
v74 = v71 << 6;
do
{
__asm { bsf esi, edx }
if ( _ZF )
{
__asm { bsf esi, ecx }
LODWORD(v104) = _ESI;
_ESI = _ESI + 32;
}
v77 = ((__PAIR__(_ECX, _EDX) - 1) >> 32) - 1;
_EDX &= _EDX - 1;
_ECX &= v77;
*result = dword_931410[byte_585380[_ESI]] | (v74 + _ESI);
result += 4;
}
while ( __PAIR__(_ECX, _EDX) );
v35 = v106;
v70 = v103;
}
}
while ( *v70 != -1 );
}
v78 = &byte_58540C;
if ( byte_58540C != -1 )
{
do
{
v79 = *v78++;
v80 = dword_8F2378[v79]
+ (((qword_5854E0[0] & dword_926270[2 * v79]) * dword_438B00[2 * v79] ^ dword_438B04[2 * v79]
* (qword_5854E0[1] & dword_926274[2 * v79])) >> dword_438F00[v79]);
_ECX = v107 & dword_926D04[2 * v80];
_EDI = v35 & dword_926D00[2 * v80];
if ( _ECX | v35 & dword_926D00[2 * v80] )
{
LODWORD(v103) = v79 << 6;
do
{
__asm { bsf edx, edi }
if ( _ZF )
{
__asm { bsf edx, ecx }
LODWORD(v104) = _EDX;
_EDX = _EDX + 32;
}
_ECX &= __CFADD__(_EDI, -1) + _ECX - 1;
_EDI &= _EDI - 1;
*result = dword_931490[byte_585380[_EDX]] | (_EDX + v103);
result += 4;
}
while ( _ECX | _EDI );
v35 = v106;
}
}
while ( *v78 != -1 );
}
v85 = &byte_585417;
if ( byte_585417 != -1 )
{
do
{
v86 = *v85++;
v87 = dword_8FBB68[v86]
+ (((qword_5854E0[0] & dword_829CB8[2 * v86]) * dword_438D00[2 * v86] ^ dword_438D04[2 * v86]
* (qword_5854E0[1] & dword_829CBC[2 * v86])) >> dword_439000[v86]);
_ECX = v107 & dword_829EFC[2 * v87];
_EDI = v35 & dword_829EF8[2 * v87];
if ( _ECX | v35 & dword_829EF8[2 * v87] )
{
LODWORD(v103) = v86 << 6;
do
{
__asm { bsf edx, edi }
if ( _ZF )
{
__asm { bsf edx, ecx }
LODWORD(v104) = _EDX;
_EDX = _EDX + 32;
}
_ECX &= __CFADD__(_EDI, -1) + _ECX - 1;
_EDI &= _EDI - 1;
*result = dword_931510[byte_585380[_EDX]] | (_EDX + v103);
result += 4;
}
while ( _ECX | _EDI );
v35 = v106;
}
}
while ( *v85 != -1 );
}
v92 = &byte_585422;
if ( byte_585422 != -1 )
{
do
{
v93 = *v92;
v94 = dword_438B04[2 * v93] * (qword_5854E0[1] & dword_926274[2 * v93]);
v95 = qword_5854E0[0] & dword_829CB8[2 * v93];
v96 = qword_5854E0[1] & dword_829CBC[2 * v93];
v105 = qword_5854E0[0] & dword_926270[2 * v93];
v97 = dword_8F2378[v93] + ((v105 * dword_438B00[2 * v93] ^ v94) >> dword_438F00[v93]);
++v92;
v98 = dword_8FBB68[v93] + ((v95 * dword_438D00[2 * v93] ^ (dword_438D04[2 * v93] * v96)) >> dword_439000[v93]);
_EBP = v106 & (dword_829EF8[2 * v98] | dword_926D00[2 * v97]);
_ECX = v107 & (dword_829EFC[2 * v98] | dword_926D04[2 * v97]);
if ( _ECX | v106 & (dword_829EF8[2 * v98] | dword_926D00[2 * v97]) )
{
LODWORD(v103) = v93 << 6;
do
{
__asm { bsf esi, ebp }
if ( _ZF )
{
__asm { bsf edx, ecx }
LODWORD(v104) = _EDX;
_ESI = _EDX + 32;
}
_ECX &= ((__PAIR__(_ECX, _EBP) - 1) >> 32) - 1;
_EBP &= _EBP - 1;
*result = dword_931550[byte_585380[_ESI]] | (_ESI + v103);
result += 4;
}
while ( _ECX | _EBP );
}
}
while ( *v92 != -1 );
}
}
goto LABEL_86;
}
__asm { bsf esi, edi }
if ( _ZF )
{
__asm { bsf esi, ebx }
_ESI = _ESI + 32;
}
v30 = v103;
if ( byte_585380[_ESI] != 9 )
{
v31 = v103 + _ESI;
_EDX &= dword_91E270[2 * v31];
_ECX &= dword_91E274[2 * v31];
}
if ( !__PAIR__(_ECX, _EDX) )
{
LABEL_86:
*result = 0;
return result;
}
do
{
__asm { bsf esi, edx }
if ( _ZF )
{
__asm { bsf esi, ecx }
_ESI = _ESI + 32;
}
v34 = ((__PAIR__(_ECX, _EDX) - 1) >> 32) - 1;
_EDX &= _EDX - 1;
_ECX &= v34;
*result = dword_931450[byte_585380[_ESI]] | (v30 + _ESI);
result += 4;
}
while ( __PAIR__(_ECX, _EDX) );
*result = _ECX | _EDX;
return result;
}
Code: Select all
type_list_move *my_evasion( type_list_move *LIST, uint64 c2 )
{
uint64 U, T, attack, cel;
int qu, ai, di, c, re, piece;
re = my_square_king;
attack = my_king_check;
qu = BSF(attack);
piece = QU[qu];
cel = ( ~your_attack) &(((piece == count_your_pawn) ? attack_king[re] : 0) | EVASION[re][qu]) & ( ~my_occupied) &c2;
bit_FREE(qu, attack);
if( attack )
{
qu = BSF(attack);
piece = QU[qu];
cel = cel &(your_pawn(piece) | EVASION[re][qu]);
qu = re;
ANNEX_AI(cel, capture_value[count_my_king][c]);
LIST->move = 0;
return LIST;
}
c2 &= INTERPOSITION[re][qu];
qu = re;
ANNEX_AI(cel, capture_value[count_my_king][c]);
if( !c2 )
{
LIST->move = 0;
return LIST;
}
if( capture_straight &(c2 & your_occupied) )
{
ai = BSF(c2 & your_occupied);
c = QU[ai];
if( RANK_EIGHT(ai) )
{
ADD(LIST, flag_promotion_queen | di_left(ai) | ai, (0x20 << 24) + capture_value[count_my_pawn][c]);
ADD(LIST, flag_promotion_knight | di_left(ai) | ai, 0);
ADD(LIST, flag_promotion_rook | di_left(ai) | ai, 0);
ADD(LIST, flag_promotion_bishop | di_left(ai) | ai, 0);
}
else
ADD(LIST, di_left(ai) | ai, capture_value[count_my_pawn][c]);
}
if( capture_left &(c2 & your_occupied) )
{
ai = BSF(c2 & your_occupied);
c = QU[ai];
if( RANK_EIGHT(ai) )
{
ADD(LIST, flag_promotion_queen | di_straight(ai) | ai, (0x20 << 24) + capture_value[count_my_pawn][c]);
ADD(LIST, flag_promotion_knight | di_straight(ai) | ai, 0);
ADD(LIST, flag_promotion_rook | di_straight(ai) | ai, 0);
ADD(LIST, flag_promotion_bishop | di_straight(ai) | ai, 0);
}
else
ADD(LIST, di_straight(ai) | ai, capture_value[count_my_pawn][c]);
}
ai = ep_plate;
if( ai )
{
if( capture_straight & square_fixed[ai] && square_fixed[back(ai)] & c2 )
ADD(LIST, flag_en_passant | di_left(ai) | ai, capture_value[count_my_pawn][count_your_pawn]);
if( capture_left & square_fixed[ai] && square_fixed[back(ai)] & c2 )
ADD(LIST, flag_en_passant | di_straight(ai) | ai, capture_value[count_my_pawn][count_your_pawn]);
}
T = bitboard_my_pawn & back_turn((c2 &your_occupied) ^ c2);
while( T )
{
di = BSF(T);
bit_FREE(di, T);
if( RANK_SEVEN(di) )
{
ADD(LIST, flag_promotion_queen | (di << 6) | forward(di), capture_value[count_my_pawn][0]);
ADD(LIST, flag_promotion_knight | (di << 6) | forward(di), 0);
ADD(LIST, flag_promotion_rook | (di << 6) | forward(di), 0);
ADD(LIST, flag_promotion_bishop | (di << 6) | forward(di), 0);
}
else
ADD(LIST, (di << 6) | forward(di), capture_value[count_my_pawn][0]);
}
T =
bitboard_my_pawn & back_turn_two((c2 &your_occupied)
^ c2) & RANK_SECOND & back_turn( ~POSITION.occupied_black_white);
while( T )
{
di = BSF(T);
bit_FREE(di, T);
ADD(LIST, (di << 6) | forward_two(di), capture_value[count_my_pawn][0]);
}
for ( U = bitboard_my_knight; U; bit_FREE(qu, U) )
{
qu = BSF(U);
T = attack_knight[qu] & c2;
ANNEX_AI(T, capture_value[count_my_knight][c]);
}
for ( U = bitboard_my_bishop; U; bit_FREE(qu, U) )
{
qu = BSF(U);
T = attack_bishop(qu) & c2;
ANNEX_AI(T, capture_value[count_my_clear][c]);
}
for ( U = bitboard_my_rook; U; bit_FREE(qu, U) )
{
qu = BSF(U);
T = attack_rook(qu) & c2;
ANNEX_AI(T, capture_value[count_my_rook][c]);
}
for ( U = bitboard_my_queen; U; bit_FREE(qu, U) )
{
qu = BSF(U);
T = attack_queen(qu) & c2;
ANNEX_AI(T, capture_value[count_my_queen][c]);
}
LIST->move = 0;
return LIST;
}
Code: Select all
int __usercall sub_40A6E0<eax>(int result<eax>, __int64 a2)
{
int v2; // ecx@1
int v3; // esi@1
int v4; // edi@2
unsigned __int64 v5; // qt0@2
unsigned __int64 v6; // qt0@4
int v7; // ebp@7
__int64 v8; // qt0@7
__int64 v11; // kr10_8@7
unsigned __int64 v18; // qt0@12
unsigned __int64 v21; // kr18_8@12
char *v24; // edi@16
int v25; // esi@17
int v28; // edi@18
int v31; // ebp@21
char *v32; // ebx@24
int v33; // esi@25
unsigned int v34; // edx@25
char *v39; // ebx@31
int v40; // esi@32
unsigned int v41; // edx@32
char *v46; // ebx@38
int v47; // edx@39
unsigned int v48; // edi@39
unsigned int v49; // esi@39
int v56; // edi@46
int v59; // ebp@49
int v60; // ebx@50
int v65; // esi@53
int v66; // edi@58
int v67; // ebp@58
int v68; // esi@63
int v69; // edi@63
int v70; // [sp+10h] [bp-18h]@40
int v71; // [sp+10h] [bp-18h]@53
char *v72; // [sp+1Ch] [bp-Ch]@17
v2 = *(dword_5854F0[0] + 26);
v3 = qword_585468[0];
if ( *(dword_5854F0[0] + 26) )
{
v4 = qword_585468[1];
HIDWORD(v5) = v4 & 0xFEFEFE;
LODWORD(v5) = qword_585468[0] & 0xFEFEFEFE;
if ( dword_828A7C[2 * v2] & (v5 >> 25) | dword_828A78[2 * v2] & ((qword_585468[0] & 0xFEFEFEFE) << 7) )
{
*result = dword_9313F4 | (v2 + ((v2 - 7) << 6)) | 0x3000;
v3 = qword_585468[0];
result += 4;
}
HIDWORD(v6) = qword_585468[1] & 0xFFFF7F7F;
LODWORD(v6) = v3 & 0x7F7F7F7F;
if ( dword_828A7C[2 * v2] & (v6 >> 23) | dword_828A78[2 * v2] & ((v3 & 0x7F7F7F7F) << 9) )
{
*result = dword_9313F4 | (v2 + ((v2 - 9) << 6)) | 0x3000;
v3 = qword_585468[0];
result += 4;
}
}
if ( a2 & *(dword_5854F0[0] + 32) )
{
v7 = a2;
HIDWORD(v8) = qword_585468[1] & 0xFEFE;
LODWORD(v8) = v3 & 0xFEFEFEFE;
v11 = a2 & (v8 << 7);
_ECX = v11 >> 32;
_EDX = v11;
if ( __PAIR__(_ECX, a2 & ((v3 & 0xFEFEFEFE) << 7)) )
{
do
{
__asm { bsf esi, edx }
if ( _ZF )
{
__asm { bsf esi, ecx }
_ESI = _ESI + 32;
}
_ECX &= ((__PAIR__(_ECX, _EDX) - 1) >> 32) - 1;
_EDX &= _EDX - 1;
*result = dword_9313D0[byte_585380[_ESI]] | (_ESI + ((_ESI - 7) << 6));
result += 4;
}
while ( __PAIR__(_ECX, _EDX) );
v3 = qword_585468[0];
}
HIDWORD(v18) = qword_585468[1] & 0x7F7F;
LODWORD(v18) = v3 & 0x7F7F7F7F;
v21 = a2 & __PAIR__(v18 >> 23, (v3 & 0x7F7F7F7Fu) << 9);
_ECX = v21 >> 32;
_EDX = v21;
if ( a2 & __PAIR__(v18 >> 23, (v3 & 0x7F7F7F7Fu) << 9) )
{
do
{
__asm { bsf esi, edx }
if ( _ZF )
{
__asm { bsf esi, ecx }
_ESI = _ESI + 32;
}
_ECX &= ((__PAIR__(_ECX, _EDX) - 1) >> 32) - 1;
_EDX &= _EDX - 1;
*result = dword_9313D0[byte_585380[_ESI]] | (_ESI + ((_ESI - 9) << 6));
result += 4;
}
while ( __PAIR__(_ECX, _EDX) );
}
v24 = &byte_585401;
if ( byte_585401 != -1 )
{
do
{
v25 = *v24;
_ECX = HIDWORD(a2) & dword_8F217C[2 * v25];
_EDX = v7 & dword_8F2178[2 * v25];
++v24;
v72 = v24;
if ( __PAIR__(_ECX, v7 & dword_8F2178[2 * v25]) )
{
v28 = v25 << 6;
do
{
__asm { bsf esi, edx }
if ( _ZF )
{
__asm { bsf esi, ecx }
_ESI = _ESI + 32;
}
v31 = ((__PAIR__(_ECX, _EDX) - 1) >> 32) - 1;
_EDX &= _EDX - 1;
_ECX &= v31;
*result = dword_931410[byte_585380[_ESI]] | (v28 + _ESI);
result += 4;
}
while ( __PAIR__(_ECX, _EDX) );
v7 = a2;
v24 = v72;
}
}
while ( *v24 != -1 );
}
v32 = &byte_58540C;
if ( byte_58540C != -1 )
{
do
{
v33 = *v32++;
v34 = dword_8F2378[v33]
+ (((qword_5854E0[0] & dword_926270[2 * v33]) * dword_438B00[2 * v33] ^ dword_438B04[2 * v33]
* (qword_5854E0[1] & dword_926274[2 * v33])) >> dword_438F00[v33]);
_ECX = HIDWORD(a2) & dword_926D04[2 * v34];
_EDI = v7 & dword_926D00[2 * v34];
if ( _ECX | v7 & dword_926D00[2 * v34] )
{
do
{
__asm { bsf edx, edi }
if ( _ZF )
{
__asm { bsf edx, ecx }
_EDX = _EDX + 32;
}
_ECX &= __CFADD__(_EDI, -1) + _ECX - 1;
_EDI &= _EDI - 1;
*result = dword_931490[byte_585380[_EDX]] | (_EDX + (v33 << 6));
result += 4;
}
while ( _ECX | _EDI );
v7 = a2;
}
}
while ( *v32 != -1 );
}
v39 = &byte_585417;
if ( byte_585417 != -1 )
{
do
{
v40 = *v39++;
v41 = dword_8FBB68[v40]
+ (((qword_5854E0[0] & dword_829CB8[2 * v40]) * dword_438D00[2 * v40] ^ dword_438D04[2 * v40]
* (qword_5854E0[1] & dword_829CBC[2 * v40])) >> dword_439000[v40]);
_ECX = HIDWORD(a2) & dword_829EFC[2 * v41];
_EDI = v7 & dword_829EF8[2 * v41];
if ( _ECX | v7 & dword_829EF8[2 * v41] )
{
do
{
__asm { bsf edx, edi }
if ( _ZF )
{
__asm { bsf edx, ecx }
_EDX = _EDX + 32;
}
_ECX &= __CFADD__(_EDI, -1) + _ECX - 1;
_EDI &= _EDI - 1;
*result = dword_931510[byte_585380[_EDX]] | (_EDX + (v40 << 6));
result += 4;
}
while ( _ECX | _EDI );
v7 = a2;
}
}
while ( *v39 != -1 );
}
v46 = &byte_585422;
if ( byte_585422 != -1 )
{
do
{
v47 = *v46;
v48 = dword_8F2378[v47]
+ (((qword_5854E0[0] & dword_926270[2 * v47]) * dword_438B00[2 * v47] ^ dword_438B04[2 * v47]
* (qword_5854E0[1] & dword_926274[2 * v47])) >> dword_438F00[v47]);
++v46;
v49 = dword_8FBB68[v47]
+ (((qword_5854E0[0] & dword_829CB8[2 * v47]) * dword_438D00[2 * v47] ^ dword_438D04[2 * v47]
* (qword_5854E0[1] & dword_829CBC[2 * v47])) >> dword_439000[v47]);
_EBP = a2 & (dword_829EF8[2 * v49] | dword_926D00[2 * v48]);
_ECX = HIDWORD(a2) & (dword_829EFC[2 * v49] | dword_926D04[2 * v48]);
if ( _ECX | a2 & (dword_829EF8[2 * v49] | dword_926D00[2 * v48]) )
{
v70 = v47 << 6;
do
{
__asm { bsf esi, ebp }
if ( _ZF )
{
__asm { bsf edx, ecx }
_ESI = _EDX + 32;
}
_ECX &= ((__PAIR__(_ECX, _EBP) - 1) >> 32) - 1;
_EBP &= _EBP - 1;
*result = dword_931550[byte_585380[_ESI]] | (_ESI + v70);
result += 4;
}
while ( _ECX | _EBP );
}
}
while ( *v46 != -1 );
}
_EDX = a2 & dword_926678[2 * byte_5854E8[0]] & ~*(dword_5854F0[0] + 40);
_ECX = HIDWORD(a2) & dword_92667C[2 * byte_5854E8[0]] & ~*(dword_5854F0[0] + 44);
if ( __PAIR__(_ECX, a2 & dword_926678[2 * byte_5854E8[0]] & ~*(dword_5854F0[0] + 40)) )
{
v56 = byte_5854E8[0] << 6;
do
{
__asm { bsf esi, edx }
if ( _ZF )
{
__asm { bsf esi, ecx }
_ESI = _ESI + 32;
}
v59 = ((__PAIR__(_ECX, _EDX) - 1) >> 32) - 1;
_EDX &= _EDX - 1;
_ECX &= v59;
*result = dword_931450[byte_585380[_ESI]] | (v56 + _ESI);
result += 4;
}
while ( __PAIR__(_ECX, _EDX) );
}
}
v60 = qword_585468[1];
_EBP = 0;
_EBX = v60 & 0xFF0000;
if ( _EBX )
{
do
{
__asm { bsf ecx, ebp }
if ( _ZF )
{
__asm { bsf edx, ebx }
_ECX = _EDX + 32;
}
v65 = __CFADD__(_EBP, -1) + _EBX - 1;
_EBP &= _EBP - 1;
_EBX &= v65;
v71 = _EBP;
if ( !*(&dword_585388 + _ECX) )
{
*result = (65 * _ECX + 8) | 0xD8007000;
result += 4;
if ( HIDWORD(qword_5854B8) & dword_8F21BC[2 * _ECX] | qword_5854B8 & dword_8F21B8[2 * _ECX] )
{
*result = (65 * _ECX + 8) | 0xC2004000;
result += 4;
}
}
if ( _ECX != 48 && HIDWORD(a2) & dword_828AB4[2 * _ECX] | a2 & dword_828AB0[2 * _ECX] )
{
v66 = byte_585387[_ECX];
v67 = 65 * _ECX + 7;
*result = v67 | (dword_9313D0[v66] + 0x28000000) | 0x7000;
result += 4;
if ( HIDWORD(qword_5854B8) & dword_8F21B4[2 * _ECX] | qword_5854B8 & dword_8F21B0[2 * _ECX] )
{
*result = v67 | (dword_9313D0[v66] + 0x1A000000) | 0x4000;
result += 4;
}
_EBP = v71;
}
if ( _ECX != 55 && HIDWORD(a2) & dword_828AC4[2 * _ECX] | a2 & dword_828AC0[2 * _ECX] )
{
v68 = *(&dword_585388 + _ECX + 1);
v69 = 65 * _ECX + 9;
*result = v69 | (dword_9313D0[v68] + 0x28000000) | 0x7000;
result += 4;
if ( HIDWORD(qword_5854B8) & dword_8F21C4[2 * _ECX] | qword_5854B8 & dword_8F21C0[2 * _ECX] )
{
*result = v69 | (dword_9313D0[v68] + 436207616) | 0x4000;
result += 4;
}
}
}
while ( _EBX | _EBP );
*result = 0;
}
else
{
*result = 0;
}
return result;
}
Code: Select all
type_list_move *my_capture( type_list_move *LIST, uint64 cel )
{
uint64 U, T, AT, AA;
int qu, ai, c;
ai = ep_plate;
if( ai )
{
if( capture_left & square_fixed[ai] )
ADD(LIST, flag_en_passant | di_straight(ai) | ai, capture_en_passant);
if( capture_straight & square_fixed[ai] )
ADD(LIST, flag_en_passant | di_left(ai) | ai, capture_en_passant);
}
if( (cel &my_attack) == 0 )
goto TAG_NOT;
T = capture_left &( ~bitboard_rank_eighth) & cel;
while( T )
{
ai = BSF(T);
c = QU[ai];
ADD(LIST, di_straight(ai) | ai, capture_value[count_my_pawn][c]);
bit_FREE(ai, T);
}
T = capture_straight &( ~bitboard_rank_eighth) & cel;
while( T )
{
ai = BSF(T);
c = QU[ai];
ADD(LIST, di_left(ai) | ai, capture_value[count_my_pawn][c]);
bit_FREE(ai, T);
}
for ( U = bitboard_my_knight; U; bit_FREE(qu, U) )
{
qu = BSF(U);
T = attack_knight[qu] & cel;
ANNEX_AI(T, capture_value[count_my_knight][c]);
}
for ( U = bitboard_my_bishop; U; bit_FREE(qu, U) )
{
qu = BSF(U);
AA = attack_bishop(qu);
T = AA & cel;
ANNEX_AI(T, capture_value[count_my_clear][c]);
}
for ( U = bitboard_my_rook; U; bit_FREE(qu, U) )
{
qu = BSF(U);
AT = attack_rook(qu);
T = AT & cel;
ANNEX_AI(T, capture_value[count_my_rook][c]);
}
for ( U = bitboard_my_queen; U; bit_FREE(qu, U) )
{
qu = BSF(U);
AT = attack_rook(qu);
AA = attack_bishop(qu);
T = (AA | AT) & cel;
ANNEX_AI(T, capture_value[count_my_queen][c]);
}
qu = BSF(bitboard_my_king);
T = attack_king[qu] & cel;
ANNEX_AI(T, capture_value[count_my_king][c]);
TAG_NOT:
for ( U = bitboard_my_pawn & bitboard_rank_seventh; U; bit_FREE(qu, U) )
{
qu = BSF(U);
ai = forward(qu);
if( QU[ai] == 0 )
{
ADD(LIST, flag_promotion_queen | (qu << 6) | ai, pawn_queen);
if( attack_knight[ai] & bitboard_your_king )
ADD(LIST, flag_promotion_knight | (qu << 6) | ai, pawn_knight);
}
ai = forward_left(qu);
if( qu != WHITE_A7 && square_fixed[ai] & cel )
{
c = QU[ai];
ADD(LIST, flag_promotion_queen | (qu << 6) | ai, promotion_queen_capture);
if( attack_knight[ai] & bitboard_your_king )
ADD(LIST, flag_promotion_knight | (qu << 6) | ai, promotion_knight_capture);
}
ai = forward_straight(qu);
if( qu != WHITE_H7 && square_fixed[ai] & cel )
{
c = QU[ai];
ADD(LIST, flag_promotion_queen | (qu << 6) | ai, promotion_queen_capture);
if( attack_knight[ai] & bitboard_your_king )
ADD(LIST, flag_promotion_knight | (qu << 6) | ai, promotion_knight_capture);
}
}
LIST->move = 0;
return LIST;
}
Code: Select all
int __cdecl sub_40B4B0(int a1)
{
int v1; // eax@1
int v2; // edx@1
int v3; // ebp@1
int v4; // esi@1
signed int v5; // edi@1
unsigned int v6; // esi@9
unsigned int v7; // esi@11
unsigned __int64 v8; // qt0@12
int v16; // edx@15
int v17; // esi@23
int v18; // edx@26
unsigned int v19; // edi@26
unsigned int v20; // esi@26
int v22; // eax@27
int v25; // esi@31
signed int v26; // eax@32
int v27; // esi@38
unsigned int v28; // edx@38
int v31; // eax@39
int v34; // esi@42
signed int v35; // ecx@43
int v36; // esi@49
signed int v41; // ecx@56
int v44; // esi@62
int v47; // ebx@65
char *v48; // ecx@66
int v49; // eax@67
int *v52; // ebx@68
int v55; // eax@72
signed int v56; // eax@73
int v57; // edi@77
int v62; // edx@80
int v63; // ecx@80
int v64; // edx@83
int v65; // ecx@84
int v66; // edx@88
int v67; // ecx@89
int v68; // eax@93
int result; // eax@95
int v70; // [sp+10h] [bp-3Ch]@27
int v71; // [sp+10h] [bp-3Ch]@50
int v72; // [sp+10h] [bp-3Ch]@68
int v73; // [sp+14h] [bp-38h]@15
int v74; // [sp+1Ch] [bp-30h]@8
int *v75; // [sp+1Ch] [bp-30h]@50
int v76; // [sp+20h] [bp-2Ch]@8
int v77; // [sp+28h] [bp-24h]@1
signed int v78; // [sp+2Ch] [bp-20h]@1
signed int v79; // [sp+30h] [bp-1Ch]@1
int v80; // [sp+34h] [bp-18h]@0
int v81; // [sp+38h] [bp-14h]@0
int v82; // [sp+3Ch] [bp-10h]@0
int v83; // [sp+40h] [bp-Ch]@0
signed int v84; // [sp+50h] [bp+4h]@17
char *v85; // [sp+50h] [bp+4h]@25
char *v86; // [sp+50h] [bp+4h]@37
char *v87; // [sp+50h] [bp+4h]@48
v1 = qword_5854E0[0];
v2 = byte_5854E9[0];
v3 = a1;
v4 = dword_5854F0[0];
v5 = ~qword_5854E0[0];
v78 = ~qword_5854E0[0];
v79 = ~qword_5854E0[1];
v77 = byte_5854E9[0];
if ( *(dword_5854F0[0] + 25) & 1 && !((LOBYTE(qword_5854E0[0]) | *(dword_5854F0[0] + 40)) & 0x60) )
{
*a1 = (word_8FB4F4 << 16) | 0x1106;
v1 = qword_5854E0[0];
v4 = dword_5854F0[0];
v3 = a1 + 4;
}
if ( *(v4 + 25) & 2 && !(v1 & 0xE) && !(*(v4 + 40) & 0xC) )
{
*v3 = (word_8FB4EC << 16) | 0x1102;
v1 = qword_5854E0[0];
v3 += 4;
}
v74 = LODWORD(qword_931990[v2]);
v76 = HIDWORD(qword_931990[v2]);
if ( qword_585498 | qword_585490 )
{
v6 = dword_8FBB68[v2]
+ (((v1 & dword_829CB8[2 * v2]) * dword_438D00[2 * v2] ^ dword_438D04[2 * v2]
* (qword_5854E0[1] & dword_829CBC[2 * v2])) >> dword_439000[v2]);
v80 = dword_829EF8[2 * v6];
v81 = dword_829EFC[2 * v6];
}
if ( qword_585498 | *qword_585480 | *qword_585488 )
{
v7 = dword_8F2378[v2]
+ (((v1 & dword_926270[2 * v2]) * dword_438B00[2 * v2] ^ dword_438B04[2 * v2]
* (qword_5854E0[1] & dword_926274[2 * v2])) >> dword_438F00[v2]);
v82 = dword_926D00[2 * v7];
v83 = dword_926D04[2 * v7];
}
HIDWORD(v8) = LOWORD(qword_585468[1]);
LODWORD(v8) = qword_585468[0] & 0xFFFFFF00;
HIDWORD(_QCX) = v79 & (v8 >> 24);
LODWORD(_QCX) = v5 & ((qword_585468[0] & 0xFFFFFF00) << 8);
if ( __PAIR__(HIDWORD(_QCX), v5 & ((qword_585468[0] & 0xFFFFFF00u) << 8)) )
{
do
{
__asm { bsf eax, ecx }
if ( _ZF )
{
__asm { bsf eax, ebx }
_EAX = _EAX + 32;
}
v73 = (_QCX - 1) & _QCX;
HIDWORD(_QCX) &= ((_QCX - 1) >> 32) - 1;
v16 = _EAX - 8;
if ( (_EAX & 0x38) == 16 && !*(&dword_585388 + _EAX) )
{
v84 = 32768;
if ( !(v76 & dword_828A7C[2 * (_EAX + 8)] | v74 & dword_828A78[2 * (_EAX + 8)]) )
v84 = 0;
v3 += 4;
*(v3 - 4) = v84 | (_EAX + 8 + (v16 << 6)) | (word_8FB3E8[_EAX + 8] << 16);
}
if ( v76 & dword_828A7C[2 * _EAX] | v74 & dword_828A78[2 * _EAX] )
LODWORD(_QCX) = 32768;
else
LODWORD(_QCX) = 0;
v17 = _QCX | (_EAX + (v16 << 6)) | (word_8FB3E8[_EAX] << 16);
LODWORD(_QCX) = v73;
*v3 = v17;
v3 += 4;
}
while ( _QCX );
v1 = qword_5854E0[0];
}
v85 = &byte_585422;
if ( byte_585422 != -1 )
{
do
{
v18 = *v85++;
v19 = dword_8F2378[v18]
+ (((v1 & dword_926270[2 * v18]) * dword_438B00[2 * v18] ^ dword_438B04[2 * v18]
* (qword_5854E0[1] & dword_926274[2 * v18])) >> dword_438F00[v18]);
v20 = dword_8FBB68[v18]
+ (((v1 & dword_829CB8[2 * v18]) * dword_438D00[2 * v18] ^ dword_438D04[2 * v18]
* (qword_5854E0[1] & dword_829CBC[2 * v18])) >> dword_439000[v18]);
HIDWORD(_QCX) = v78 & (dword_829EF8[2 * v20] | dword_926D00[2 * v19]);
LODWORD(_QCX) = v79 & (dword_829EFC[2 * v20] | dword_926D04[2 * v19]);
if ( _QCX | v78 & (dword_829EF8[2 * v20] | dword_926D00[2 * v19]) )
{
v22 = v80 | v82;
v70 = v18 << 6;
while ( 1 )
{
__asm { bsf edi, ebx }
if ( _ZF )
{
__asm { bsf edx, ecx }
_EDI = _EDX + 32;
}
v25 = ((__PAIR__(_QCX, HIDWORD(_QCX)) - 1) >> 32) - 1;
HIDWORD(_QCX) &= HIDWORD(_QCX) - 1;
LODWORD(_QCX) = v25 & _QCX;
v26 = (v81 | v83) & dword_828A7C[2 * _EDI] | v22 & dword_828A78[2 * _EDI] ? 32768 : 0;
*v3 = v26 | (_EDI + v70) | (word_8FB6E8[_EDI] << 16);
v3 += 4;
if ( !_QCX )
break;
v22 = v80 | v82;
}
v1 = qword_5854E0[0];
}
}
while ( *v85 != -1 );
}
v86 = &byte_585417;
if ( byte_585417 != -1 )
{
do
{
v27 = *v86++;
v28 = dword_8FBB68[v27]
+ (((v1 & dword_829CB8[2 * v27]) * dword_438D00[2 * v27] ^ dword_438D04[2 * v27]
* (qword_5854E0[1] & dword_829CBC[2 * v27])) >> dword_439000[v27]);
_EDI = v78 & dword_829EF8[2 * v28];
_EDX = v79 & dword_829EFC[2 * v28];
if ( _EDX | _EDI )
{
v31 = v27 << 6;
do
{
__asm { bsf ebx, edi }
if ( _ZF )
{
__asm { bsf ecx, edx }
_EBX = _ECX + 32;
}
v34 = __CFADD__(_EDI, -1) + _EDX - 1;
_EDI &= _EDI - 1;
_EDX &= v34;
if ( v81 & dword_828A7C[2 * _EBX] | v80 & dword_828A78[2 * _EBX] )
v35 = 32768;
else
v35 = 0;
*v3 = v35 | (v31 + _EBX) | (word_8FB668[_EBX] << 16);
v3 += 4;
}
while ( _EDX | _EDI );
v1 = qword_5854E0[0];
}
}
while ( *v86 != -1 );
}
v87 = &byte_58540C;
if ( byte_58540C != -1 )
{
do
{
v36 = *v87++;
HIDWORD(_QAX) = dword_8F2378[v36]
+ (((v1 & dword_926270[2 * v36]) * dword_438B00[2 * v36] ^ dword_438B04[2 * v36]
* (qword_5854E0[1] & dword_926274[2 * v36])) >> dword_438F00[v36]);
_EDI = v78 & dword_926D00[2 * HIDWORD(_QAX)];
HIDWORD(_QAX) = v79 & dword_926D04[2 * HIDWORD(_QAX)];
if ( HIDWORD(_QAX) | _EDI )
{
v75 = &dword_828A78[2 * v36];
v71 = v36 << 6;
do
{
__asm { bsf esi, edi }
if ( _ZF )
{
__asm { bsf ecx, edx }
_ESI = _ECX + 32;
}
LODWORD(_QAX) = _EDI;
HIDWORD(_QAX) &= ((_QAX - 1) >> 32) - 1;
_EDI &= _EDI - 1;
if ( v83 & dword_828A7C[2 * _ESI] | v82 & dword_828A78[2 * _ESI] )
LODWORD(_QAX) = 32768;
else
LODWORD(_QAX) = 0;
v41 = 5;
if ( !(v75[1] & 0xAA55AA55 | *v75 & 0xAA55AA55) )
v41 = 4;
*v3 = _QAX | (_ESI + v71) | (word_8FB368[_ESI + (v41 << 6)] << 16);
v3 += 4;
}
while ( HIDWORD(_QAX) | _EDI );
v1 = qword_5854E0[0];
}
}
while ( *v87 != -1 );
}
_ECX = v78 & dword_926678[2 * byte_5854E8[0]] & ~*(dword_5854F0[0] + 40);
_EAX = v79 & dword_92667C[2 * byte_5854E8[0]] & ~*(dword_5854F0[0] + 44);
if ( _EAX | v78 & dword_926678[2 * byte_5854E8[0]] & ~*(dword_5854F0[0] + 40) )
{
v44 = byte_5854E8[0] << 6;
do
{
__asm { bsf edx, ecx }
if ( _ZF )
{
__asm { bsf edx, eax }
_EDX = _EDX + 32;
}
v47 = __CFADD__(_ECX, -1) + _EAX - 1;
_ECX &= _ECX - 1;
_EAX &= v47;
*v3 = (v44 + _EDX) | (word_8FB4E8[_EDX] << 16);
v3 += 4;
}
while ( _EAX | _ECX );
}
v48 = &byte_585401;
if ( byte_585401 != -1 )
{
do
{
v49 = *v48;
_ESI = v78 & dword_8F2178[2 * v49];
_EDX = v79 & dword_8F217C[2 * v49];
++v48;
if ( _EDX | v78 & dword_8F2178[2 * v49] )
{
v52 = &dword_8F2178[2 * v77];
v72 = v49 << 6;
while ( 1 )
{
__asm { bsf edi, esi }
if ( _ZF )
{
__asm { bsf eax, edx }
_EDI = _EAX + 32;
}
v55 = __CFADD__(_ESI, -1) + _EDX - 1;
_ESI &= _ESI - 1;
_EDX &= v55;
v56 = v52[1] & dword_828A7C[2 * _EDI] | *v52 & dword_828A78[2 * _EDI] ? 32768 : 0;
*v3 = v56 | (_EDI + v72) | (word_8FB468[_EDI] << 16);
v3 += 4;
if ( !(_EDX | _ESI) )
break;
v52 = &dword_8F2178[2 * v77];
}
}
}
while ( *v48 != -1 );
}
v57 = qword_585468[1];
_EBX = 0;
_EDI = v57 & 0xFF0000;
if ( _EDI )
{
do
{
__asm { bsf eax, ebx }
if ( _ZF )
{
__asm { bsf edx, edi }
_EAX = _EDX + 32;
}
v62 = __CFADD__(_EBX, -1) + _EDI - 1;
_EBX &= _EBX - 1;
v63 = _EAX + 8;
_EDI &= v62;
if ( !byte_585380[_EAX + 8] )
{
if ( !(HIDWORD(qword_5854B8) & dword_8F217C[2 * v63] | qword_5854B8 & dword_8F2178[2 * v63]) )
{
*v3 = (v63 + (_EAX << 6)) | (word_8FB3E8[v63] << 16) | 0x4000;
v3 += 4;
}
v64 = v63 + (_EAX << 6);
*v3 = v64 | (word_8FB3E8[v63] << 16) | 0x6000;
*(v3 + 4) = v64 | (word_8FB3E8[v63] << 16) | 0x5000;
v3 += 8;
}
v65 = _EAX + 7;
if ( _EAX != 48 && HIDWORD(qword_5854A0) & dword_828A7C[2 * v65] | qword_5854A0 & dword_828A78[2 * v65] )
{
if ( !(HIDWORD(qword_5854B8) & dword_8F217C[2 * v65] | qword_5854B8 & dword_8F2178[2 * v65]) )
{
*v3 = (v65 + (_EAX << 6)) | (word_8FB3E8[v65] << 16) | 0x4000;
v3 += 4;
}
v66 = v65 + (_EAX << 6);
*v3 = v66 | (word_8FB3E8[v65] << 16) | 0x6000;
*(v3 + 4) = v66 | (word_8FB3E8[v65] << 16) | 0x5000;
v3 += 8;
}
v67 = _EAX + 9;
if ( _EAX != 55 && HIDWORD(qword_5854A0) & dword_828A7C[2 * v67] | qword_5854A0 & dword_828A78[2 * v67] )
{
if ( !(HIDWORD(qword_5854B8) & dword_8F217C[2 * v67] | qword_5854B8 & dword_8F2178[2 * v67]) )
{
*v3 = (v67 + (_EAX << 6)) | (word_8FB3E8[v67] << 16) | 0x4000;
v3 += 4;
}
v68 = v67 + (_EAX << 6);
*v3 = v68 | (word_8FB3E8[v67] << 16) | 0x6000;
*(v3 + 4) = v68 | (word_8FB3E8[v67] << 16) | 0x5000;
v3 += 8;
}
}
while ( _EDI | _EBX );
*v3 = 0;
result = v3;
}
else
{
*v3 = 0;
result = v3;
}
return result;
}
Code: Select all
type_list_move *my_ordinary( type_list_move *LIST )
{
uint64 empty = ~POSITION.occupied_black_white, U, T, TOR, ALF, RE;
int ai, qu, requ = your_square_king;
if( castling_oo && ((POSITION.occupied_black_white | your_attack) & WHITE_F1G1) == 0 )
move_ANNEX(LIST, flag_castling | (WHITE_E1 << 6) | WHITE_G1, count_my_king, WHITE_G1, 0);
if( castling_ooo && (POSITION.occupied_black_white &WHITE_B1C1D1) == 0 && (your_attack &WHITE_C1D1) == 0 )
move_ANNEX(LIST, flag_castling | (WHITE_E1 << 6) | WHITE_C1, count_my_king, WHITE_C1, 0);
RE = my_attack_pawn[requ];
if( bitboard_my_queen | bitboard_my_rook )
TOR = attack_rook(requ);
if( bitboard_my_queen | bitboard_my_bishop )
ALF = attack_bishop(requ);
for ( U = forward_turn(bitboard_my_pawn & RANK_SECOND_SIX) & empty; U; bit_FREE(qu, U) )
{
ai = BSF(U);
if( en_rank_third(ai) && QU[forward(ai)] == 0 )
move_ANNEX(LIST, (back(ai) << 6) | forward(ai), count_my_pawn, forward(ai), RE);
move_ANNEX(LIST, (back(ai) << 6) | ai, count_my_pawn, ai, RE);
}
for ( U = bitboard_my_queen; U; bit_FREE(qu, U) )
{
qu = BSF(U);
T = attack_queen(qu) & empty;
ANNEX_AI_ORD(T, count_my_queen, TOR | ALF);
}
for ( U = bitboard_my_rook; U; bit_FREE(qu, U) )
{
qu = BSF(U);
T = attack_rook(qu) & empty;
ANNEX_AI_ORD(T, count_my_rook, TOR);
}
for ( U = bitboard_my_bishop; U; bit_FREE(qu, U) )
{
qu = BSF(U);
T = attack_bishop(qu) & empty;
ANNEX_AI_ORD(T, ((square_fixed[qu]&DARK) ? count_my_dark : count_my_clear), ALF);
}
qu = BSF(bitboard_my_king);
T = attack_king[qu] & empty &( ~your_attack);
ANNEX_AI_ORD(T, count_my_king, 0);
for ( U = bitboard_my_knight; U; bit_FREE(qu, U) )
{
qu = BSF(U);
T = attack_knight[qu] & empty;
ANNEX_AI_ORD(T, count_my_knight, attack_knight[requ]);
}
for ( U = bitboard_my_pawn & bitboard_rank_seventh; U; bit_FREE(qu, U) )
{
qu = BSF(U);
ai = forward(qu);
if( POSITION.qu[ai] == 0 )
under_promotion();
ai = forward_left(qu);
if( qu != WHITE_A7 && square_fixed[ai] & your_occupied )
under_promotion();
ai = forward_straight(qu);
if( qu != WHITE_H7 && square_fixed[ai] & your_occupied )
under_promotion();
}
LIST->move = 0;
return LIST;
}
Code: Select all
int __thiscall sub_418AA0(void *this, int a2, signed int a3, signed int a4)
{
signed int v4; // ebp@1
int v5; // edi@1
void *v6; // esi@1
signed int v7; // ebx@5
int v8; // ecx@8
int v9; // eax@8
int v10; // esi@9
int v11; // esi@9
int v12; // ecx@19
int v13; // esi@20
bool v14; // zf@21
int v15; // eax@23
char v16; // bl@23
signed int v17; // esi@23
int v18; // ebp@33
signed __int64 v19; // qax@34
int v20; // eax@35
void *v21; // ecx@35
int v22; // ecx@35
int v23; // eax@35
int v24; // esi@38
int v25; // eax@40
int v26; // eax@51
signed __int64 v27; // qax@66
DWORD v28; // eax@68
int v29; // edx@77
int v30; // ecx@80
unsigned int v31; // eax@80
int v32; // eax@84
int v34; // [sp-8h] [bp-90h]@38
int v35; // [sp-8h] [bp-90h]@66
signed int v36; // [sp-4h] [bp-8Ch]@66
int v37; // [sp+10h] [bp-78h]@1
char v38; // [sp+17h] [bp-71h]@21
int v39; // [sp+18h] [bp-70h]@9
int v40; // [sp+1Ch] [bp-6Ch]@9
int v41; // [sp+20h] [bp-68h]@9
int v42; // [sp+24h] [bp-64h]@9
int v43; // [sp+28h] [bp-60h]@9
int v44; // [sp+2Ch] [bp-5Ch]@10
void *v45; // [sp+30h] [bp-58h]@1
int v46; // [sp+34h] [bp-54h]@1
int v47; // [sp+3Ch] [bp-4Ch]@34
unsigned int v48; // [sp+84h] [bp-4h]@1
v48 = &v37 ^ __security_cookie;
v4 = a3;
v5 = dword_5854F0[0];
v6 = this;
v45 = this;
v46 = dword_5854F0[0];
if ( a3 > 30000 )
{
a3 = 30000;
v4 = 30000;
}
if ( a2 < -30000 )
a2 = -30000;
v7 = a4;
if ( a4 >= 20 || a4 >= 12 && qword_8F28D0 > 500000 )
{
sub_428B5A(this, "info depth %d\n", a4 / 2);
v9 = sub_4287BF(v8);
fflush((v9 + 32));
}
v41 = v6;
v10 = *v6;
v43 = a2;
v11 = v10 & 0x7FFF;
v42 = -32750;
v40 = 0;
v39 = v11;
if ( !v11 )
{
LABEL_85:
dword_92687C = v7;
return v42;
}
v44 = 0;
while ( 1 )
{
if ( v7 > 18 && (v40 > 0 || dword_931100 >= 3) && !byte_8F28CE && !byte_932F90 )
sub_4252B0(v7 / 2);
if ( byte_933649 )
return v4;
sub_410440(v11);
v12 = dword_5854F0[0];
if ( *(dword_5854F0[0] + 228) )
{
v13 = dword_8F2878;
}
else
{
sub_404AD0(-30000, 30000, 0, v11);
v14 = *(v5 + 440) == 0i64;
v38 = 1;
if ( v14 )
v38 = 0;
v15 = v11 & 0x3F;
v16 = byte_585380[v15];
v17 = 0;
if ( v16 != 1 || v15 < 40 || qword_5854A8[1] & dword_8FBC6C[2 * v15] | qword_5854A8[0] & dword_8FBC68[2 * v15] )
{
if ( *(v46 + 458)
|| v38
|| v16 == 1
&& v15 >= 24
&& !(qword_5854A8[1] & dword_8FBC6C[2 * v15] | qword_5854A8[0] & dword_8FBC68[2 * v15]) )
v17 = 1;
}
else
{
v17 = 2;
}
v18 = v17 + a4 - 2;
if ( a4 >= 20 )
{
v19 = 1000i64 * timeGetTime() - qword_931108;
v47 = HIDWORD(v19);
if ( v19 > 4000000 )
{
v20 = sub_4264E0(v39);
sub_428B5A(v21, "info currmove %s currmovenumber %d\n", v20);
v23 = sub_4287BF(v22);
fflush((v23 + 32));
}
}
if ( v42 == -32750 || a4 <= 3 )
{
if ( v18 > 1 )
v26 = sub_418080(-a3, -a2, v18);
else
v26 = v38 ? sub_41E370(-a3, -a2, 1) : sub_41D680(-a3, -a2, 1);
v13 = -v26;
}
else
{
v24 = -a2;
v34 = -a2;
if ( v18 > 7 )
{
if ( v38 )
v25 = sub_415DB0(v34, v18);
else
v25 = sub_414D40(v34, v18);
}
else
{
if ( v38 )
v25 = sub_420530(v34, v18);
else
v25 = sub_41F7F0(v34, v18);
}
if ( -v25 <= a2
|| (byte_932F90 = 1, byte_484AAF = 0, -sub_418080(v24 - 1, v24, v18) <= a2)
|| (v13 = -sub_418080(-a3, v24, v18), v13 <= a2) )
v13 = a2;
}
v4 = a3;
v7 = a4;
}
sub_411200(v12);
if ( byte_933649 )
return v4;
if ( v13 <= v42 )
goto LABEL_76;
v42 = v13;
if ( v13 != -32750 && v13 <= a2 )
{
LABEL_77:
v29 = v41;
if ( !v40 )
{
byte_8F28CE = 1;
byte_484AAF = 0;
}
goto LABEL_83;
}
dword_931104 = v39;
dword_484AB4 = v13;
dword_92687C = v7;
if ( v7 >= 20 || v7 >= 12 && qword_8F28D0 > 500000 || byte_8F28CF )
{
if ( v13 <= a2 )
{
if ( v13 >= v4 )
goto LABEL_69;
v28 = timeGetTime();
v36 = v4;
v35 = a2;
}
else
{
if ( v13 < v4 )
{
v36 = v4;
v27 = 1000i64 * timeGetTime();
v35 = v13;
LABEL_72:
sub_41E8E0(v27 - qword_931108, (v27 - qword_931108) >> 32, v43, v35, v36);
goto LABEL_73;
}
LABEL_69:
if ( v13 <= a2 )
goto LABEL_73;
v28 = timeGetTime();
v36 = v4;
v35 = v4;
}
v27 = 1000i64 * v28;
goto LABEL_72;
}
LABEL_73:
if ( v13 < dword_484AA8 - 50 )
{
byte_8F28CE = 1;
byte_484AAF = 0;
}
else
{
byte_8F28CE = 0;
}
LABEL_76:
if ( v13 <= a2 )
goto LABEL_77;
v29 = v41;
a2 = v13;
if ( v41 > v45 )
{
v30 = *v41;
v31 = v41;
do
{
*v31 = *(v31 - 4);
v31 -= 4;
}
while ( v31 > v45 );
*v31 = v30;
}
LABEL_83:
++v40;
if ( v13 >= v4 || (v32 = *(v29 + 4), v44 += 4, v41 = v29 + 4, (v39 = v32 & 0x7FFF) == 0) )
goto LABEL_85;
v5 = v46;
v11 = v39;
}
}
Code: Select all
int my_node_top( int ALPHA, int BETA, int DEPTH )
{
int CNT, low_orig, value_better, cnt, check_move, hole_new, v, TEMPvalue;
type_list_move *p, *q;
type_dynamic *POSITION_0 = DYNAMIC;
uint32 move;
if( BETA > VALUE_MATE )
BETA = VALUE_MATE;
if( ALPHA < -VALUE_MATE )
ALPHA = -VALUE_MATE;
if( DEPTH > 8 && DEPTH <= 70 && TIME_DESIRED > 500000 )
{
printf("info depth %d\n", DEPTH / 2);
fflush(stdout);
}
CNT = 0;
for ( p = ROOT_LIST_MOVE; p->move; p++ )
{
CNT++;
p->move &= 0x7fff;
}
low_orig = ALPHA;
p = ROOT_LIST_MOVE;
v = value_better = -VALUE_INFINITE;
cnt = 0;
while( (move = p->move) )
{
DO(move);
call_value_full(move);
check_move = (move_check != 0);
hole_new = DEPTH - (2 - check_move);
if((DEPTH > 18) && ((clock_() - CLOCK_UCI) > 4000000))
{
printf("info currmove %s currmovenumber %d\n", move_notation(move, STRING1), (p - ROOT_LIST_MOVE) + 1);
fflush(stdout);
}
if( value_better == -VALUE_INFINITE || DEPTH <= 2 )
v = -your_node_pv(-BETA, -ALPHA, hole_new, check_move);
else
{
if( check_move )
{
if( hole_new <= 7 )
v = -your_search_half_check(-ALPHA, hole_new);
else
v = -your_node_cut_check(-ALPHA, hole_new);
}
else
{
if( hole_new <= 7 )
v = -your_search_half(-ALPHA, hole_new);
else
v = -your_node_cut(-ALPHA, hole_new);
}
if( v > ALPHA )
{
MOVE_BATTLE = 1;
EASY = 0;
}
if( v > ALPHA )
v = -your_node_pv(-ALPHA - 1, -ALPHA, hole_new, check_move);
if( v > ALPHA )
v = -your_node_pv(-BETA, -ALPHA, hole_new, check_move);
if( v <= ALPHA )
v = ALPHA;
}
CANCEL(move);
if( v <= ALPHA )
TEMPvalue = low_orig;
else
TEMPvalue = v;
p->move |= (TEMPvalue + 0x8000) << 16;
if( v > value_better )
{
value_better = v;
if( value_better == -VALUE_INFINITE || v > ALPHA )
{
root_move = move;
root_value = v;
root_hole = DEPTH;
if ((DEPTH > 10 && DEPTH <= 70 && TIME_DESIRED > 500000)
|| (DEPTH > 18 && DEPTH <= 70 && TIME_DESIRED > 50000)
|| (DEPTH > 70 && TIME_DESIRED > 30000000) || ANALYSIS)
{
if( v > ALPHA && v < BETA )
information(clock_() - CLOCK_UCI, low_orig, v, BETA);
else if( v < BETA )
information(clock_() - CLOCK_UCI, low_orig, ALPHA, BETA);
else if( v > ALPHA )
information(clock_() - CLOCK_UCI, low_orig, BETA, BETA);
}
if( v >= root_previous - 25 )
MOVE_BAD = 0;
else
{
MOVE_BAD = 1;
EASY = 0;
}
}
}
if( v <= ALPHA )
{
if( cnt == 0 )
{
MOVE_BAD = 1;
EASY = 0;
}
}
else
ALPHA = v;
cnt++;
if( v < BETA )
{
p++;
continue;
}
break;
}
for ( p = ROOT_LIST_MOVE + (CNT - 1); p >= ROOT_LIST_MOVE; p-- )
{
move = p->move;
for ( q = p + 1; q < ROOT_LIST_MOVE + CNT; q++ )
{
if( (move & 0xffff0000) < (q->move & 0xffff0000) )
(q - 1)->move = q->move;
else
break;
}
q--;
q->move = move;
}
root_hole = DEPTH;
return value_better;
}
Code: Select all
void __cdecl sub_4242E0()
{
int v0; // edi@1
int v1; // ebp@1
int v2; // ecx@1
char *v3; // eax@1
signed int v4; // edx@1
int v5; // ebx@1
signed int v6; // esi@26
int v7; // eax@34
bool v8; // zf@34
int v9; // edi@37
int v10; // eax@37
unsigned int v11; // eax@46
int v12; // eax@50
char *v13; // ebp@51
unsigned int v14; // esi@51
int v15; // ebx@52
int v16; // edi@53
int v17; // ecx@53
char *v18; // ecx@60
int v19; // esi@61
unsigned int v20; // eax@62
char v21; // dl@64
int v22; // edx@67
unsigned int v23; // esi@68
int i; // eax@68
int v25; // ecx@72
unsigned __int8 v26; // al@72
unsigned __int8 v27; // al@77
int v28; // edi@80
signed int v29; // ecx@80
int v30; // ebp@89
int v31; // esi@91
int v32; // ebx@91
int v33; // edi@91
int v34; // eax@96
signed int v35; // ebx@105
int v36; // esi@105
int v37; // edx@109
int v38; // eax@112
int j; // [sp+10h] [bp-45Ch]@1
char v40; // [sp+17h] [bp-455h]@80
int v41; // [sp+18h] [bp-454h]@1
int v42; // [sp+1Ch] [bp-450h]@1
int v43; // [sp+20h] [bp-44Ch]@1
int v44; // [sp+24h] [bp-448h]@1
int v45; // [sp+28h] [bp-444h]@1
int v46; // [sp+2Ch] [bp-440h]@1
int v47; // [sp+30h] [bp-43Ch]@1
int v48; // [sp+34h] [bp-438h]@1
int v49; // [sp+38h] [bp-434h]@1
int v50; // [sp+3Ch] [bp-430h]@1
int v51; // [sp+40h] [bp-42Ch]@1
int v52; // [sp+44h] [bp-428h]@1
int v53; // [sp+48h] [bp-424h]@1
int v54; // [sp+4Ch] [bp-420h]@1
int v55; // [sp+50h] [bp-41Ch]@1
int v56; // [sp+54h] [bp-418h]@1
int v57; // [sp+58h] [bp-414h]@1
int v58; // [sp+5Ch] [bp-410h]@1
char v59; // [sp+60h] [bp-40Ch]@51
int v60; // [sp+64h] [bp-408h]@102
unsigned int v61; // [sp+464h] [bp-8h]@1
v61 = &j ^ __security_cookie;
v0 = 0;
v42 = dword_5854F0;
v43 = 0;
v44 = 1;
v45 = 3;
v46 = 0;
v47 = 3;
v48 = 3;
v49 = 5;
v50 = 9;
v51 = 0;
v52 = 1;
v53 = 3;
v54 = 0;
v55 = 3;
v56 = 3;
v57 = 5;
v58 = 9;
sub_404AD0(-30000, 30000, 0, 0);
v1 = dword_5854F0;
v2 = *(dword_5854F0 + 4);
v3 = Memory + 16 * (dword_4840C0 & *dword_5854F0);
v4 = 0;
v5 = 0;
j = 0;
v41 = 0;
if ( *v3 == v2 )
{
if ( v3[4] & 0x10 )
{
v5 = *(v3 + 4);
v0 = *(v3 + 5);
v41 = v3[7];
}
if ( *(v3 + 4) && v3[7] > 0 )
{
v4 = v3[7];
j = *(v3 + 4);
}
}
if ( *(v3 + 4) == v2 )
{
if ( v3[20] & 0x10 )
{
v5 = *(v3 + 12);
v0 = *(v3 + 13);
v41 = v3[23];
}
if ( *(v3 + 12) && v3[23] > v4 )
{
v4 = v3[23];
j = *(v3 + 12);
}
}
if ( *(v3 + 8) == v2 )
{
if ( v3[36] & 0x10 )
{
v5 = *(v3 + 20);
v0 = *(v3 + 21);
v41 = v3[39];
}
if ( *(v3 + 20) && v3[39] > v4 )
{
v4 = v3[39];
j = *(v3 + 20);
}
v1 = dword_5854F0;
}
if ( *(v3 + 12) == v2 )
{
if ( v3[52] & 0x10 )
{
v5 = *(v3 + 28);
v0 = *(v3 + 29);
v41 = v3[55];
}
v2 = *(v3 + 28);
if ( v2 && v3[55] > v4 )
j = *(v3 + 28);
}
v6 = dword_484AB0;
byte_484AAF = 0;
if ( v41 < dword_484AB0 - 6
|| v5 != j
|| !v5
|| !dword_484ABC
|| dword_484AB0 < 18
|| !sub_40F7D0(v2, v5)
|| (v0 + 24999) > 49998
|| byte_8F28CF )
goto LABEL_45;
v7 = v6 / 2;
v8 = *(v1 + 200) == 0i64;
dword_484AB4 = v0;
if ( v8 )
{
if ( v7 >= 12 )
v7 = 12;
v9 = v0 - 100;
v10 = sub_416440(v9, v6 - v7, v5);
}
else
{
if ( v7 >= 12 )
v7 = 12;
v9 = v0 - 100;
v10 = sub_413790(v9, v6 - v7);
}
if ( v10 >= v9 )
{
LABEL_44:
v1 = dword_5854F0;
LABEL_45:
v8 = *(v1 + 200) == 0i64;
dword_484ABC = 1;
if ( v8 )
{
v12 = sub_40A6E0(qword_5854A0, HIDWORD(qword_5854A0));
v11 = sub_40B4B0(v12);
}
else
{
v11 = sub_409680(-1, -1);
}
v13 = &v59;
v41 = v11;
v14 = &v59;
if ( &v59 < v11 )
{
v15 = v42;
do
{
v16 = *v14 & 0x7FFF;
sub_410440(*v14 & 0x7FFF);
sub_404AD0(-30000, 30000, 0, 0);
v17 = *(v15 + 436) | *(v15 + 432);
if ( !*(v15 + 432) )
{
*v13 = v16;
v13 += 4;
}
sub_411200(v17);
v14 += 4;
}
while ( v14 < v41 );
}
*v13 = 0;
if ( v13 == &v59 )
{
v8 = *(dword_5854F0 + 200) == 0i64;
dword_484AB4 = -30000;
if ( v8 )
dword_484AB4 = 0;
dword_931104 = 0;
dword_92687C = 0;
return;
}
v18 = &v59;
if ( &v59 < v13 )
{
v19 = j;
do
{
v20 = *v18;
if ( *v18 == v19 )
{
*v18 = v20 | 0xFFFF0000;
}
else
{
v21 = byte_585380[*v18 & 0x3F];
if ( v21 )
*v18 = v20 | ((16 * (*(&v43 + v21) + 4080) - *(&v43 + byte_585380[(v20 >> 6) & 0x3F])) << 16);
}
v18 += 4;
}
while ( v18 < v13 );
}
v22 = (v13 - 8);
if ( v13 - 8 >= &v59 )
{
do
{
v23 = *v22;
for ( i = v22 + 4; i < v13; i += 4 )
{
if ( v23 >= *i )
break;
*(i - 4) = *i;
}
v22 -= 4;
*(i - 4) = v23;
}
while ( v22 >= &v59 );
}
v25 = dword_5854F0;
v26 = *(dword_5854F0 + 227);
if ( v26 > 0x32u && !(v26 & 2) && qword_8F28D0 > 1000000 )
{
sub_40F700();
v25 = dword_5854F0;
}
if ( byte_8F28CF || (v27 = *(v25 + 24), v27 <= 6u) )
dword_8F2878 = 0;
else
dword_8F2878 = -40 * v27 / 32;
dword_8F287C = 0;
v28 = dword_484AB4;
*(v25 + 27) = 1;
v29 = 2;
v40 = 0;
for ( j = 2; ; v29 = j )
{
byte_8F28CE = 0;
byte_932F90 = 0;
dword_931100 = 0;
if ( v29 == 70 )
{
if ( !byte_8F28CF && !*(dword_5854F0 + 24) && abs(v28) < 20 )
return;
}
else
{
if ( v29 < 14 )
goto LABEL_101;
}
if ( (v28 + 25000) <= 0xC350 )
{
v30 = abs(v28) / 24;
if ( v30 < 16 )
v30 = 16;
v31 = v28 - v30;
v32 = v30;
v33 = v30 + v28;
while ( 1 )
{
if ( v31 <= -5000 )
v31 = -30000;
if ( v33 >= 5000 )
v33 = 30000;
v34 = sub_418AA0(v31, v33, j);
if ( byte_933649 )
return;
if ( v34 > v31 )
{
if ( v34 < v33 )
goto LABEL_102;
++dword_931100;
dword_484AB4 = v33;
v33 += 2 * v30;
v30 = 3 * v30 - 12;
}
else
{
dword_484AB4 = v31;
v31 += -2 * v32;
v32 = 3 * v32 - 12;
dword_931100 = 0;
}
}
}
LABEL_101:
sub_418AA0(-30000, 30000, v29);
if ( byte_933649 )
return;
LABEL_102:
dword_484AA8 = dword_484AB4;
if ( !v60 && !byte_8F28CF && !byte_484AAE )
return;
v35 = j;
v36 = j / 2;
sub_4252B0(j / 2);
if ( v35 < 16 || v40 || byte_8F28CF || 1000i64 * timeGetTime() - qword_931108 < qword_933608 )
{
v28 = dword_484AB4;
}
else
{
v37 = *(dword_5854F0 + 204) | *(dword_5854F0 + 200);
v8 = *(dword_5854F0 + 200) == 0i64;
v40 = 1;
if ( v8 )
{
if ( v36 >= 12 )
v36 = v37 + 12;
v38 = sub_416440(dword_484AB4 - 300, v35 - v36, dword_931104 & 0x7FFF);
}
else
{
if ( v36 >= 12 )
v36 = 12;
v38 = sub_413790(dword_484AB4 - 300, v35 - v36);
}
if ( byte_933649 )
return;
v28 = dword_484AB4;
if ( v38 < dword_484AB4 - 300 )
{
if ( !byte_484AAE )
goto LABEL_48;
byte_484AAF = 1;
}
}
j = v35 + 2;
if ( v35 + 2 > 250 )
return;
}
}
if ( byte_484AAE )
{
byte_484AAF = 1;
goto LABEL_44;
}
dword_931104 = v5;
dword_92687C = v41;
LABEL_48:
dword_484ABC = 0;
}
RobboLito's (node_high.c)
Code: Select all
int __cdecl sub_415B50()
{
int v0; // ebx@1
int v1; // eax@2
int v2; // ecx@2
int v3; // esi@6
int v4; // ecx@7
int v5; // ebp@7
char *v6; // esi@7
__int64 v7; // qax@7
char *v8; // ecx@19
char *v9; // ecx@25
int v10; // esi@27
int v11; // edi@27
int v12; // ebp@33
int v13; // eax@43
int v14; // ecx@43
int v15; // esi@45
int result; // eax@46
int *v17; // edi@49
unsigned int i; // ebp@49
int v19; // esi@50
int v20; // edx@50
int v21; // ecx@50
int v22; // ebx@53
int *v23; // ecx@53
char v24; // dl@54
int *j; // ecx@57
int v26; // edx@61
unsigned int v27; // edi@62
unsigned int v28; // esi@63
unsigned int k; // eax@63
int v30; // eax@69
int v31; // ecx@69
signed int v32; // ebx@74
signed int v33; // esi@77
signed int v34; // ebp@77
signed int v35; // edi@77
signed int v36; // eax@81
signed int v37; // [sp+10h] [bp-5Ch]@1
int v38; // [sp+14h] [bp-58h]@1
int v39; // [sp+18h] [bp-54h]@1
int v40; // [sp+1Ch] [bp-50h]@1
int v41; // [sp+20h] [bp-4Ch]@5
int v42; // [sp+28h] [bp-44h]@1
int v43; // [sp+2Ch] [bp-40h]@1
int v44; // [sp+30h] [bp-3Ch]@1
int v45; // [sp+34h] [bp-38h]@1
int v46; // [sp+38h] [bp-34h]@1
int v47; // [sp+3Ch] [bp-30h]@1
int v48; // [sp+40h] [bp-2Ch]@1
int v49; // [sp+44h] [bp-28h]@1
int v50; // [sp+48h] [bp-24h]@1
int v51; // [sp+4Ch] [bp-20h]@1
int v52; // [sp+50h] [bp-1Ch]@1
int v53; // [sp+54h] [bp-18h]@1
int v54; // [sp+58h] [bp-14h]@1
int v55; // [sp+5Ch] [bp-10h]@1
int v56; // [sp+60h] [bp-Ch]@1
int v57; // [sp+64h] [bp-8h]@1
int v58; // [sp+68h] [bp-4h]@1
v0 = 0;
v42 = dword_740320;
v40 = 0;
v37 = 0;
v39 = 0;
v38 = 0;
v43 = 0;
v44 = 1;
v45 = 3;
v46 = 0;
v47 = 3;
v48 = 3;
v49 = 5;
v50 = 9;
v51 = 0;
v52 = 1;
v53 = 3;
v54 = 0;
v55 = 3;
v56 = 3;
v57 = 5;
v58 = 9;
sub_402E80(2147549184, 2147418112, 0);
if ( byte_7828E0 )
{
v1 = qword_782858 & *(dword_740320 + 40);
v2 = HIDWORD(qword_782858) & *(dword_740320 + 44);
}
else
{
v1 = qword_782898 & *(dword_740320 + 32);
v2 = HIDWORD(qword_782898) & *(dword_740320 + 36);
}
if ( v2 | v1 )
{
v41 = sub_40CD30(&dword_44BD60, -1i64);
}
else
{
v3 = sub_40DE80(qword_782880, HIDWORD(qword_782880));
v41 = sub_40E690(v3);
sub_4099A0(v41, v3, 0, 0, 0);
}
v4 = dword_740320;
v5 = *dword_740320 & dword_45CDE0;
v6 = dword_5F9300 + 16 * (*dword_740320 & dword_45CDE0);
LOBYTE(v4) = 32;
LODWORD(v7) = unknown_libname_83(v4, *(dword_740320 + 4));
if ( v7 == *v6 )
{
if ( v6[4] & 0x10 )
{
v40 = *(v6 + 6);
v39 = v6[7];
v0 = *(v6 + 4);
}
if ( *(v6 + 4) && v6[7] > 0 )
{
v37 = v6[7];
v38 = *(v6 + 4);
}
}
if ( v7 == *(v6 + 4) )
{
if ( v6[20] & 0x10 )
{
v39 = v6[23];
v0 = *(v6 + 12);
v40 = *(v6 + 14);
}
if ( *(v6 + 12) && v6[23] > v37 )
{
v37 = v6[23];
v38 = *(v6 + 12);
}
}
v8 = dword_5F9300 + 16 * (v5 + 2);
if ( v7 == *v8 )
{
if ( v8[4] & 0x10 )
{
v39 = v8[7];
v0 = *(v8 + 4);
v40 = *(v8 + 6);
}
if ( *(v8 + 4) && v8[7] > v37 )
{
v37 = v8[7];
v38 = *(v8 + 4);
}
}
v9 = dword_5F9300 + 16 * (v5 + 3);
if ( v7 == *v9 )
{
if ( v9[4] & 0x10 )
{
v10 = *(v9 + 6);
v11 = v9[7];
v0 = *(v9 + 4);
}
else
{
v11 = v39;
v10 = v40;
}
if ( *(v9 + 4) && v9[7] > v37 )
v38 = *(v9 + 4);
}
else
{
v11 = v39;
v10 = v40;
}
v12 = dword_44C164 - 6;
if ( v11 < dword_44C164 - 6
|| v0 != v38
|| !v0
|| !dword_44C184
|| dword_44C164 < 18
|| !sub_410410(v9)
|| (v10 + 24999) > 49998
|| byte_44C1A9
|| byte_44C174
|| ((dword_44C168 = v10, dword_44C1AC = v0, dword_44C190 = v11, dword_44C184 = 0, !byte_7828E0) ? (v13 = qword_782898 & *(dword_740320 + 32), v14 = HIDWORD(qword_782898) & *(dword_740320 + 36)) : (v13 = qword_782858 & *(dword_740320 + 40), v14 = HIDWORD(qword_782858) & *(dword_740320 + 44)),
(v15 = v10 - 50, v14 | v13) ? (result = sub_408050(v15, v12, v0)) : (result = sub_4078B0(v15, v12, v0)),
result >= v15) )
{
v17 = &dword_44BD60;
dword_44C184 = 1;
for ( i = &dword_44BD60; v17 < v41; ++v17 )
{
v19 = *v17 & 0x7FFF;
sub_410AD0(*v17 & 0x7FFF);
sub_402E80(-2147418112, 2147418112, 0);
if ( !*(v42 + 216) )
{
v21 = v19 & 0x7FFF;
*i = v21;
i += 4;
}
sub_409130(v21, v20);
}
v22 = dword_740320;
v23 = &dword_44BD60;
for ( *i = 0; v23 < i; ++v23 )
{
v24 = byte_782800[*v23 & 0x3F];
if ( v24 )
*v23 |= (16 * (*(&v43 + v24) + 4080) - *(&v43 + byte_782800[(*v23 >> 6) & 0x3F])) << 16;
}
for ( j = &dword_44BD60; j < i; ++j )
{
if ( *j == v38 )
*j |= 0xFFFF0000u;
}
v26 = i - 4;
if ( i - 4 >= &dword_44BD60 )
{
v27 = i;
do
{
v28 = *v26;
for ( k = v27; k < i; k += 4 )
{
if ( v28 >= *k )
break;
*(k - 4) = *k;
}
v26 -= 4;
v27 -= 4;
*(k - 4) = v28;
}
while ( v26 >= &dword_44BD60 );
}
if ( dword_44BD60 )
{
v32 = 2;
do
{
byte_44C1A8 = 0;
byte_44C1B0 = 0;
if ( v32 < 14 || (dword_44C168 + 25000) > 0xC350 )
{
sub_417800(-30000, 30000, v32);
}
else
{
v33 = dword_44C168 - 8;
v34 = 8;
v35 = dword_44C168 + 8;
if ( dword_44C168 - 8 < -25000 )
v33 = -30000;
if ( v35 > 25000 )
v35 = 30000;
while ( 1 )
{
while ( 1 )
{
v36 = sub_417800(v33, v35, v32);
if ( v36 > v33 )
break;
v33 -= v34;
v34 += v34 / 2;
dword_44C168 = v33;
}
if ( v36 < v35 )
break;
v35 += v34;
v34 += v34 / 2;
dword_44C168 = v35;
}
}
if ( v32 == 2 && (!dword_44BD64 || (dword_44BD60 - dword_44BD64) >= 0xC80000) )
byte_44BD40 = 1;
dword_44C160 = dword_44C168;
result = sub_422E40(v32 / 2);
v32 += 2;
}
while ( v32 <= 250 );
}
else
{
if ( byte_7828E0 )
{
v30 = qword_782858 & *(v22 + 40);
v31 = HIDWORD(qword_782858) & *(v22 + 44);
}
else
{
v30 = qword_782898 & *(v22 + 32);
v31 = HIDWORD(qword_782898) & *(v22 + 36);
}
result = v31 | v30;
dword_44C168 = -30000;
if ( !result )
dword_44C168 = 0;
dword_44C1AC = 0;
dword_44C190 = 0;
}
}
return result;
}
Code: Select all
void my_high()
{
int i, k, DEPTH, A, L, U, v, value = 0, trans_hole;
int move_hole = 0, precise_hole = 0;
uint32 move, zob_move = 0, precise_move = 0, ai, di;
type_list_move *p, *q, *list;
type_zobrist *tr;
type_dynamic *POSITION_0 = DYNAMIC;
int piece_value[16] =
{
0, 1, 3, 0, 3, 3, 5, 9, 0, 1, 3, 0, 3, 3, 5, 9
};
call_value_full(0);
if( check )
list = my_evasion(ROOT_LIST_MOVE, 0xffffffffffffffff);
else
{
q = my_capture(ROOT_LIST_MOVE, your_occupied);
list = my_ordinary(q);
sort_ordinary(list, q, 0, 0, 0);
}
k = DYNAMIC->Zobrist & list_hide;
for ( i = 0; i < 4; i++ )
{
tr = list_zobrist + (k + i);
if( (tr->zobrist ^ (DYNAMIC->Zobrist >> 32)) == 0 )
{
trans_hole = tr->hole_low;
move = tr->move;
if( zobrist_accurate(tr) )
{
precise_hole = trans_hole;
precise_move = move;
value = zobrist_value_high(tr);
}
if( move && trans_hole > move_hole )
{
move_hole = trans_hole;
zob_move = move;
}
}
}
if( precise_hole >= hole_previous - 6 && precise_move == zob_move && precise_move && root_rapid
&& hole_previous >= 18 && my_ensure(precise_move) && value < 25000 && value > -25000 && !ANALYSIS && !PONDERING )
{
root_value = value;
root_move = precise_move;
root_hole = precise_hole;
root_rapid = FALSE;
if( !check )
v = my_exclude(value - 50, hole_previous - 6, precise_move);
else
v = my_exclude_check(value - 50, hole_previous - 6, precise_move);
if( v < value - 50 && time_factor < 1.05)
{
return;
}
}
root_rapid = TRUE;
q = ROOT_LIST_MOVE;
for ( p = ROOT_LIST_MOVE; p < list; p++ )
{
move = p->move & 0x7fff;
DO(move);
call_value_full(0);
if( !move_illegal )
(q++)->move = move & 0x7fff;
CANCEL(move);
}
q->move = 0;
list = q;
for ( p = ROOT_LIST_MOVE; p < list; p++ )
{
if( QU[AI(p->move)] )
{
ai = QU[AI(p->move)];
di = QU[DI(p->move)];
p->move |= 0xff000000 + ((16 * piece_value[ai] - piece_value[di]) << 16);
}
}
for ( p = ROOT_LIST_MOVE; p < list; p++ )
if( p->move == zob_move )
p->move |= 0xffff0000;
for ( p = list - 1; p >= ROOT_LIST_MOVE; p-- )
{
move = p->move;
for ( q = p + 1; q < list; q++ )
{
if( move < q->move )
(q - 1)->move = q->move;
else
break;
}
q--;
q->move = move;
}
L = -VALUE_MATE;
U = VALUE_MATE;
if( !ROOT_LIST_MOVE[0].move )
{
if( check )
{
root_value = L;
}
else
{
root_value = 0;
}
root_move = 0;
root_hole = 0;
return;
}
for ( DEPTH = 2; DEPTH <= 250; DEPTH += 2 )
{
MOVE_BAD = FALSE;
MOVE_BATTLE = FALSE;
if( DEPTH >= 14 && root_value <= 25000 && -25000 <= root_value )
{
A = 8;
L = root_value - A;
U = root_value + A;
if( L < -25000 )
L = -VALUE_MATE;
if( U > 25000 )
U = VALUE_MATE;
MORE:
v = my_node_top(L, U, DEPTH);
if( v > L && v < U )
goto END;
if( v <= L )
{
L -= A;
A += A / 2;
root_value = L;
goto MORE;
}
else
{
U += A;
A += A / 2;
root_value = U;
goto MORE;
}
}
else
v = my_node_top(-VALUE_MATE, VALUE_MATE, DEPTH);
END:
if( DEPTH == 2 )
{
if( !ROOT_LIST_MOVE[1].move || (ROOT_LIST_MOVE[0].move - ROOT_LIST_MOVE[1].move >= (200 << 16)) )
EASY = TRUE;
}
root_previous = root_value;
resolve_term(DEPTH / 2);
}
}
Code: Select all
#define VALUE_MATE 30000
#define VALUE_INFINITE 32750