Computer Chess Biggest Liar

General discussion about computer chess...
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 » Sat Oct 15, 2011 9:46 pm

On pages 2, 3, & 6 of this thread, it has been demonstrated that Houdini chess is RobboLito (IPPOLIT) modified. It should be stressed one more time that the difference with casual observation is of course due to modified/shuffled routines, compiler, and optimization flags.

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];
}
RobboLito's, (position.c):

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;
    }
Houdini's fen_positional:

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);
    }
  }
}
RobboLito's, (position.c):

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;
        }
    }
Houdini's positional_initialization:

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;
}
RobboLito's, (position.c):

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();
    }
Houdini's legal_moves:

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;
}
RobboLito's, (position.c):

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++;
        }
    }
Some RobboLito costants to make things a little clearer (robbolito.h):

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
move_completa( uint32 x ) is called in legal_moves( char *I ), and the values are computed there in the above disassembled code. It has nothing to do with modification, but rather the way compilers handle certain routine calls depending on optimization. The same type of deal is seen with the evaluation and mobility functions.

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;
    }
The following should make de-compiled routines below a little clearer:

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) )
Houdini's *my_evasion:

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;
}
RobboLito's, (move_gen.c):

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;
    }
Houdini's *my_capture:

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;
}
RobboLito's, (move_gen.c)

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;
    }
Houdini's *my_ordinary:

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;
}
RobboLito's, (move_gen.c):

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;
    }
Houdini's my_node_top:

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;
  }
}
RobboLito's, (node_superior.c)

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;
    }
Houdini's my_high:

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;
}
Houdini's my_high() has been modified -- for comparison, see RobboLito's disassembled/source below.

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;
}
RobboLito's (node_high.c):

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);
        }
    }
robbolito.h:

Code: Select all

#define VALUE_MATE 30000
#define VALUE_INFINITE 32750
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 » Sat Oct 15, 2011 10:18 pm

Continued...
Houdini's value_material:

Code: Select all

unsigned int __cdecl sub_4082B0()
{
  unsigned int v0; // esi@1
  unsigned int v1; // eax@1
  unsigned int v2; // edx@1
  unsigned int result; // eax@1

  v0 = (qword_5854C0[0] | qword_5854C8[0]) - (((unsigned int)(qword_5854C0[0] | qword_5854C8[0]) >> 1) & 0x55555555);
  v1 = (286331153
      * ((((_DWORD)qword_585470 - (((unsigned int)qword_585470 >> 1) & 0x55555555)) & 0x33333333)
       + ((HIDWORD(qword_585470) - ((HIDWORD(qword_585470) >> 1) & 0x55555555)) & 0x33333333)
       + ((((unsigned int)qword_585470 - (((unsigned int)qword_585470 >> 1) & 0x55555555)) >> 2) & 0x33333333)
       + (((HIDWORD(qword_585470) - ((HIDWORD(qword_585470) >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 28)
     + 3
     * ((286331153
       * ((((_DWORD)qword_585498 - (((unsigned int)qword_585498 >> 1) & 0x55555555)) & 0x33333333)
        + ((HIDWORD(qword_585498) - ((HIDWORD(qword_585498) >> 1) & 0x55555555)) & 0x33333333)
        + ((((unsigned int)qword_585498 - (((unsigned int)qword_585498 >> 1) & 0x55555555)) >> 2) & 0x33333333)
        + (((HIDWORD(qword_585498) - ((HIDWORD(qword_585498) >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 28)
      - (286331153
       * ((((_DWORD)qword_5854D8 - (((unsigned int)qword_5854D8 >> 1) & 0x55555555)) & 0x33333333)
        + ((HIDWORD(qword_5854D8) - ((HIDWORD(qword_5854D8) >> 1) & 0x55555555)) & 0x33333333)
        + ((((unsigned int)qword_5854D8 - (((unsigned int)qword_5854D8 >> 1) & 0x55555555)) >> 2) & 0x33333333)
        + (((HIDWORD(qword_5854D8) - ((HIDWORD(qword_5854D8) >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 28))
     - (286331153
      * ((((_DWORD)qword_5854B0 - (((unsigned int)qword_5854B0 >> 1) & 0x55555555)) & 0x33333333)
       + ((HIDWORD(qword_5854B0) - ((HIDWORD(qword_5854B0) >> 1) & 0x55555555)) & 0x33333333)
       + ((((unsigned int)qword_5854B0 - (((unsigned int)qword_5854B0 >> 1) & 0x55555555)) >> 2) & 0x33333333)
       + (((HIDWORD(qword_5854B0) - ((HIDWORD(qword_5854B0) >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 28)
     - (286331153
      * ((v0 & 0x33333333)
       + (((qword_5854C0[1] | qword_5854C8[1]) - (((unsigned int)(qword_5854C0[1] | qword_5854C8[1]) >> 1) & 0x55555555)) & 0x33333333)
       + ((v0 >> 2) & 0x33333333)
       + ((((qword_5854C0[1] | qword_5854C8[1]) - (((unsigned int)(qword_5854C0[1] | qword_5854C8[1]) >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 28);
  v2 = (qword_585468[1] - (((unsigned int)qword_585468[1] >> 1) & 0x55555555)) & 0x33333333;
  result = 200
         * ((286331153
           * (((qword_585468[0] - (((unsigned int)qword_585468[0] >> 1) & 0x55555555)) & 0x33333333)
            + v2
            + (((qword_585468[0] - (((unsigned int)qword_585468[0] >> 1) & 0x55555555)) >> 2) & 0x33333333)
            + (((qword_585468[1] - (((unsigned int)qword_585468[1] >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 28)
          + 5
          * ((286331153
            * ((((_DWORD)qword_585490 - (((unsigned int)qword_585490 >> 1) & 0x55555555)) & 0x33333333)
             + ((HIDWORD(qword_585490) - ((HIDWORD(qword_585490) >> 1) & 0x55555555)) & 0x33333333)
             + ((((unsigned int)qword_585490 - (((unsigned int)qword_585490 >> 1) & 0x55555555)) >> 2) & 0x33333333)
             + (((HIDWORD(qword_585490) - ((HIDWORD(qword_585490) >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 28)
           - (286331153
            * ((((_DWORD)qword_5854D0 - (((unsigned int)qword_5854D0 >> 1) & 0x55555555)) & 0x33333333)
             + ((HIDWORD(qword_5854D0) - ((HIDWORD(qword_5854D0) >> 1) & 0x55555555)) & 0x33333333)
             + ((((unsigned int)qword_5854D0 - (((unsigned int)qword_5854D0 >> 1) & 0x55555555)) >> 2) & 0x33333333)
             + (((HIDWORD(qword_5854D0) - ((HIDWORD(qword_5854D0) >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 28))
          - (286331153
           * (((qword_5854A8[0] - (((unsigned int)qword_5854A8[0] >> 1) & 0x55555555)) & 0x33333333)
            + ((qword_5854A8[1] - (((unsigned int)qword_5854A8[1] >> 1) & 0x55555555)) & 0x33333333)
            + (((qword_5854A8[0] - (((unsigned int)qword_5854A8[0] >> 1) & 0x55555555)) >> 2) & 0x33333333)
            + (((qword_5854A8[1] - (((unsigned int)qword_5854A8[1] >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 28))
         + 650
         * ((286331153
           * ((((qword_585480[0] | qword_585488[0])
              - (((unsigned int)(qword_585480[0] | qword_585488[0]) >> 1) & 0x55555555)) & 0x33333333)
            + (((qword_585480[1] | qword_585488[1])
              - (((unsigned int)(qword_585480[1] | qword_585488[1]) >> 1) & 0x55555555)) & 0x33333333)
            + ((((qword_585480[0] | qword_585488[0])
               - (((unsigned int)(qword_585480[0] | qword_585488[0]) >> 1) & 0x55555555)) >> 2) & 0x33333333)
            + ((((qword_585480[1] | qword_585488[1])
               - (((unsigned int)(qword_585480[1] | qword_585488[1]) >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 28)
          + v1);
  if ( *(_QWORD *)qword_585480 && *(_QWORD *)qword_585488 )
    result += 100;
  if ( *(_QWORD *)qword_5854C0 )
  {
    if ( *(_QWORD *)qword_5854C8 )
      result -= 100;
  }
  return result;
}
RobboLito's value_material disassembled:

Code: Select all

int __cdecl sub_402020()
{
  int v0; // esi@1
  int v1; // esi@1
  int v2; // esi@1
  int v3; // eax@1
  int v4; // ebx@1
  int v5; // edi@1
  int v6; // esi@1
  int v7; // esi@1
  int v8; // ebp@1
  int v9; // ebp@1
  int v10; // ebp@1
  int v11; // esi@1

  v0 = sub_401000(qword_7828B8, HIDWORD(qword_7828B8));
  v1 = 3 * (sub_401000(qword_782878, HIDWORD(qword_782878)) - v0);
  v2 = v1 - sub_401000(qword_7828A0 | qword_7828A8, (qword_7828A0 | qword_7828A8) >> 32);
  v3 = sub_401000(qword_782890, HIDWORD(qword_782890));
  v4 = HIDWORD(qword_782860);
  v5 = qword_782860;
  v6 = sub_401000(qword_782860 | qword_782868, (qword_782860 | qword_782868) >> 32) + v2 - v3;
  v7 = 325 * (sub_401000(qword_782850, HIDWORD(qword_782850)) + v6);
  v8 = sub_401000(qword_7828B0, HIDWORD(qword_7828B0));
  v9 = 5 * (sub_401000(qword_782870, HIDWORD(qword_782870)) - v8);
  v10 = v9 - sub_401000(qword_782888, HIDWORD(qword_782888));
  v11 = 100 * (sub_401000(qword_782848, HIDWORD(qword_782848)) + v10) + v7;
  if ( v4 | v5 && qword_782868 )
    v11 += 50;
  if ( qword_7828A0 && qword_7828A8 )
    v11 -= 50;
  return v11;
}
RobboLito's, (value.c):

Code: Select all

static int value_material ()
{
	int value =
		975 * (POPCNT (bitboard_white_queen) - POPCNT (bitboard_black_queen));
	value +=
		500 * (POPCNT (bitboard_white_rook) - POPCNT (bitboard_black_rook));
	value +=
		325 * (POPCNT (bitboard_white_bishop) - POPCNT (bitboard_black_bishop));
	value +=
		325 * (POPCNT (bitboard_white_knight) - POPCNT (bitboard_black_knight));
	value +=
		100 * (POPCNT (bitboard_white_pawn) - POPCNT (bitboard_black_pawn));
	if (bitboard_white_clear && bitboard_white_dark)
		value += 50;
	if (bitboard_black_clear && bitboard_black_dark)
		value -= 50;
	return value;
}
Houdini's evaluation of course is just a slight modification of RobboLito's. The above are functions called by both immediately, but you see that values in Houdini have been tweaked.

Houdini's evaluation:

Code: Select all

int __cdecl sub_404AD0(int a1, int a2, int a3, signed int a4)
{
  int v4; // eax@1
  int v5; // eax@1
  char v6; // dl@1
  int v7; // esi@1
  int v8; // eax@13
  int v9; // ecx@19
  unsigned int v10; // esi@19
  int v11; // ecx@19
  unsigned __int64 v12; // qt0@19
  int v13; // eax@19
  int v14; // ST94_4@19
  int v15; // eax@19
  int v16; // ST98_4@19
  int v17; // ecx@19
  int v18; // edi@19
  int v19; // ecx@19
  int v20; // eax@19
  int v21; // esi@19
  int v22; // edi@19
  int v23; // eax@19
  int v24; // edx@19
  unsigned int v25; // ecx@19
  int v26; // ebx@19
  int v27; // esi@19
  int v28; // edi@19
  int v29; // eax@19
  int v30; // ebx@19
  int v31; // edx@19
  int v32; // ecx@19
  int v33; // ecx@19
  int v34; // eax@19
  int v35; // ecx@20
  int v36; // eax@20
  int v37; // ecx@20
  int v38; // eax@20
  int v39; // ecx@21
  int v40; // ebp@21
  int v41; // eax@21
  int v42; // edx@21
  __int64 *v43; // ebp@21
  unsigned __int8 v44; // al@22
  int v45; // edx@22
  int v46; // eax@25
  int result; // eax@30
  int v48; // eax@33
  int v49; // ebp@33
  int v50; // esi@34
  signed int v51; // eax@43
  char v52; // al@45
  int v53; // edx@54
  int v54; // eax@54
  __int64 v55; // qax@56
  int v56; // ebx@56
  char v57; // al@58
  int v58; // ebx@60
  int v59; // ecx@66
  signed int v60; // esi@70
  signed int v61; // edi@70
  int v62; // ebx@74
  unsigned int v63; // esi@74
  unsigned int v64; // eax@74
  unsigned int v65; // ecx@74
  int v66; // edx@75
  unsigned int v67; // eax@75
  int v68; // edi@75
  int v69; // ebp@75
  int v70; // eax@77
  unsigned int v71; // eax@78
  int _ECX; // ecx@78
  int _EAX; // eax@78
  bool _ZF; // zf@79
  int _ESI; // esi@79
  int _ESI; // esi@80
  int v79; // esi@81
  int _ECX; // ecx@81
  int v81; // eax@82
  int _EAX; // eax@83
  unsigned int v83; // eax@86
  int v84; // esi@86
  int v85; // eax@88
  unsigned int v86; // eax@89
  int v87; // ecx@89
  int _EAX; // eax@89
  int _ECX; // ecx@89
  int _ESI; // esi@90
  int _ESI; // esi@91
  int v92; // esi@92
  int _ECX; // ecx@92
  int _EAX; // eax@93
  int v95; // ebp@95
  int v96; // eax@95
  int v97; // edi@95
  unsigned int v98; // ecx@99
  unsigned int v99; // eax@99
  int v100; // ecx@105
  char *v101; // eax@109
  signed int v102; // edx@110
  unsigned int v103; // eax@110
  int v104; // edi@110
  int v105; // ebp@110
  int v106; // eax@110
  int v107; // eax@112
  unsigned int v108; // eax@113
  int _ECX; // ecx@113
  int _EAX; // eax@113
  int _ESI; // esi@114
  int _ESI; // esi@115
  int v113; // esi@116
  int _ECX; // ecx@116
  int v115; // eax@117
  int _EAX; // eax@118
  unsigned int v117; // eax@120
  int v118; // esi@126
  int v119; // ecx@126
  int v120; // ebx@132
  int _EDI; // edi@133
  int _EAX; // eax@133
  int v123; // edi@134
  int v124; // ebx@134
  int _ECX; // ecx@134
  int _ESI; // esi@134
  int _ECX; // ecx@136
  int _ECX; // ecx@137
  int _ECX; // ecx@141
  int _EAX; // eax@142
  __int64 v131; // qdi@145
  signed int v132; // edx@153
  int v133; // eax@159
  char *v134; // eax@165
  int v135; // ebp@166
  signed int v136; // edx@167
  unsigned int v137; // eax@167
  int v138; // ebx@167
  int v139; // edi@167
  int v140; // eax@167
  int v141; // eax@169
  unsigned int v142; // eax@170
  int _ECX; // ecx@170
  int _EAX; // eax@170
  int _ESI; // esi@171
  int _ESI; // esi@172
  int v147; // esi@173
  int _ECX; // ecx@173
  int _EAX; // eax@175
  unsigned int v150; // eax@177
  int v151; // ecx@181
  unsigned int v152; // ebp@181
  int v153; // eax@189
  int v154; // esi@189
  int v155; // eax@189
  unsigned int v156; // esi@190
  unsigned int v157; // eax@190
  int v158; // ecx@190
  unsigned int v159; // esi@190
  int v160; // eax@190
  unsigned int v161; // esi@191
  unsigned int v162; // eax@191
  char *v163; // eax@201
  signed int v164; // edi@202
  int v165; // edx@202
  int v166; // esi@202
  int v167; // eax@202
  int v168; // eax@203
  unsigned int v169; // ecx@208
  unsigned int v170; // ecx@208
  int v171; // ecx@212
  int v172; // edi@223
  int v173; // edx@231
  unsigned int v174; // eax@231
  int v175; // edi@231
  int v176; // ebp@231
  int v177; // eax@233
  unsigned int v178; // eax@234
  int _ECX; // ecx@234
  int _EAX; // eax@234
  int _ESI; // esi@235
  int _ESI; // esi@236
  int v183; // esi@237
  int _ECX; // ecx@237
  int v185; // eax@238
  int _EAX; // eax@239
  unsigned int v187; // eax@242
  int v188; // esi@242
  int v189; // eax@244
  unsigned int v190; // eax@245
  int _ECX; // ecx@245
  int _EAX; // eax@245
  int _ESI; // esi@246
  int _ESI; // esi@247
  int v195; // esi@248
  int _ECX; // ecx@248
  int _EAX; // eax@249
  int v198; // edi@251
  int v199; // eax@251
  int v200; // ebp@251
  unsigned int v201; // ecx@255
  unsigned int v202; // eax@255
  unsigned int v203; // ecx@265
  int v204; // esi@265
  char *v205; // eax@265
  signed int v206; // edx@266
  unsigned int v207; // eax@266
  int v208; // ecx@266
  int v209; // edi@266
  int v210; // eax@266
  int v211; // eax@268
  unsigned int v212; // eax@269
  int _ECX; // ecx@269
  int _EAX; // eax@269
  int _ESI; // esi@270
  int _ESI; // esi@271
  int v217; // esi@272
  int _ECX; // ecx@272
  int v219; // eax@273
  int _EAX; // eax@274
  unsigned int v221; // eax@277
  unsigned int v222; // ecx@281
  int v223; // esi@283
  int _EAX; // eax@290
  int _ECX; // ecx@290
  int v226; // ebp@291
  int _EAX; // eax@291
  int _ECX; // ecx@291
  int _EAX; // eax@293
  int v230; // ecx@294
  int _EAX; // eax@295
  int _ECX; // ecx@299
  int _ECX; // ecx@300
  signed int v234; // edx@311
  int v235; // eax@320
  unsigned int v236; // edi@324
  char *v237; // eax@324
  unsigned int v238; // ebp@325
  signed int v239; // edx@327
  unsigned int v240; // eax@327
  int v241; // ebx@327
  int v242; // edi@327
  int v243; // eax@327
  int v244; // eax@329
  unsigned int v245; // eax@330
  int _ECX; // ecx@330
  int _EAX; // eax@330
  int _ESI; // esi@331
  int _ESI; // esi@332
  int v250; // esi@333
  int _ECX; // ecx@333
  int _EAX; // eax@335
  unsigned int v253; // eax@337
  int v254; // ecx@341
  unsigned int v255; // ebp@341
  int v256; // eax@349
  int v257; // esi@349
  int v258; // eax@349
  unsigned int v259; // esi@350
  unsigned int v260; // eax@350
  int v261; // ecx@350
  unsigned int v262; // esi@350
  int v263; // eax@350
  unsigned int v264; // esi@351
  unsigned int v265; // eax@351
  int v266; // ebx@362
  char *v267; // eax@362
  signed int v268; // edi@363
  int v269; // edx@363
  int v270; // esi@363
  int v271; // eax@363
  int v272; // eax@364
  unsigned int v273; // ecx@369
  unsigned int v274; // ecx@369
  int v275; // ebp@373
  int v276; // edi@384
  unsigned int v277; // eax@391
  unsigned int v278; // eax@391
  signed int v279; // edx@395
  unsigned int v280; // esi@396
  unsigned int v281; // ecx@396
  __int64 v282; // qax@396
  int v283; // ebp@397
  signed int v284; // edx@397
  unsigned int v285; // ebx@398
  __int64 v286; // qax@398
  int v287; // ebp@399
  int _EAX; // eax@403
  int _ECX; // ecx@403
  int _EAX; // eax@404
  int v291; // ecx@405
  int _EAX; // eax@406
  int _EAX; // eax@407
  int _ECX; // ecx@407
  signed int _EAX; // eax@408
  int _EAX; // eax@409
  int _EDX; // edx@411
  int _ECX; // ecx@411
  int _ECX; // ecx@412
  int _ECX; // ecx@413
  unsigned int _EDX; // edx@415
  int v302; // ebx@415
  int _ECX; // ecx@415
  int _ECX; // ecx@416
  signed int v305; // ecx@417
  signed int _EDX; // edx@418
  int v307; // eax@421
  int v308; // edi@421
  int v309; // edx@421
  int v310; // eax@424
  int v311; // esi@424
  int v312; // edx@424
  int v313; // edi@427
  int _EDX; // edx@428
  int _EAX; // eax@428
  int _EAX; // eax@429
  int v317; // ecx@430
  int _EAX; // eax@430
  int _ECX; // ecx@430
  int _EAX; // eax@430
  signed int v321; // eax@431
  signed int _ECX; // ecx@432
  int v323; // edi@433
  signed int v324; // edx@433
  int v325; // esi@445
  int v326; // edi@445
  int _EDX; // edx@459
  int _ECX; // ecx@459
  int _EAX; // eax@460
  int _EAX; // eax@461
  int _ECX; // ecx@461
  signed int _EAX; // eax@461
  int _ECX; // ecx@462
  int v334; // edi@463
  signed int v335; // edx@463
  int v336; // edi@475
  int v337; // ebx@475
  __int64 v338; // qax@488
  int v339; // esi@488
  int v340; // ecx@489
  __int64 v341; // qax@491
  int v342; // eax@491
  int v343; // ecx@492
  __int64 v344; // qax@494
  int v345; // eax@498
  bool _SF; // sf@499
  int v347; // eax@501
  char v348; // al@507
  int v349; // eax@509
  int v350; // edx@514
  int v351; // eax@514
  unsigned __int8 v352; // al@514
  int v353; // eax@517
  int v354; // [sp+10h] [bp-94h]@66
  int v355; // [sp+10h] [bp-94h]@74
  unsigned __int8 v356; // [sp+16h] [bp-8Eh]@63
  unsigned __int8 v357; // [sp+17h] [bp-8Dh]@63
  char v358; // [sp+1Fh] [bp-85h]@1
  int v359; // [sp+20h] [bp-84h]@58
  char *v360; // [sp+20h] [bp-84h]@74
  int v361; // [sp+20h] [bp-84h]@110
  int v362; // [sp+20h] [bp-84h]@167
  int v363; // [sp+20h] [bp-84h]@202
  char *v364; // [sp+20h] [bp-84h]@230
  int v365; // [sp+20h] [bp-84h]@266
  int v366; // [sp+20h] [bp-84h]@327
  int v367; // [sp+20h] [bp-84h]@363
  int v368; // [sp+24h] [bp-80h]@56
  int v369; // [sp+24h] [bp-80h]@60
  signed int v370; // [sp+24h] [bp-80h]@66
  int v371; // [sp+28h] [bp-7Ch]@56
  char *v372; // [sp+28h] [bp-7Ch]@74
  char *v373; // [sp+28h] [bp-7Ch]@230
  int v374; // [sp+2Ch] [bp-78h]@266
  __int64 v375; // [sp+2Ch] [bp-78h]@427
  __int64 v376; // [sp+2Ch] [bp-78h]@458
  int v377; // [sp+30h] [bp-74h]@110
  unsigned __int64 v378; // [sp+34h] [bp-70h]@19
  int v379; // [sp+3Ch] [bp-68h]@19
  int v380; // [sp+40h] [bp-64h]@19
  signed int v381; // [sp+48h] [bp-5Ch]@68
  __int64 v382; // [sp+4Ch] [bp-58h]@165
  __int64 v383; // [sp+4Ch] [bp-58h]@324
  __int64 v384; // [sp+4Ch] [bp-58h]@421
  int v385; // [sp+50h] [bp-54h]@132
  int v386; // [sp+58h] [bp-4Ch]@33
  signed int v387; // [sp+5Ch] [bp-48h]@70
  signed int v388; // [sp+60h] [bp-44h]@70
  __int64 v389; // [sp+64h] [bp-40h]@72
  int v390; // [sp+6Ch] [bp-38h]@86
  int v391; // [sp+6Ch] [bp-38h]@242
  unsigned int v392; // [sp+6Ch] [bp-38h]@391
  int v393; // [sp+70h] [bp-34h]@86
  int v394; // [sp+70h] [bp-34h]@242
  int v395; // [sp+74h] [bp-30h]@70
  int v396; // [sp+74h] [bp-30h]@289
  unsigned int v397; // [sp+74h] [bp-30h]@391
  int v398; // [sp+78h] [bp-2Ch]@70
  int v399; // [sp+78h] [bp-2Ch]@289
  int v400; // [sp+78h] [bp-2Ch]@391
  int v401; // [sp+80h] [bp-24h]@1
  __int64 v402; // [sp+84h] [bp-20h]@19
  __int64 v403; // [sp+84h] [bp-20h]@393
  unsigned __int64 v404; // [sp+8Ch] [bp-18h]@19
  int v405; // [sp+8Ch] [bp-18h]@189
  int v406; // [sp+8Ch] [bp-18h]@349
  int v407; // [sp+98h] [bp-Ch]@1
  __int64 v408; // [sp+9Ch] [bp-8h]@72
  __int64 v409; // [sp+9Ch] [bp-8h]@424

  v4 = *(dword_5854F0 + 16) >> 8;
  v5 = 3 * (v4 & 0x7FFFF);
  v6 = byte_5C14FA[2 * v5];
  v5 *= 2;
  v358 = v6;
  *(dword_5854F0 + 223) = byte_5C14FB[v5];
  v407 = *(&word_5C14FC + v5);
  *(dword_5854F0 + 24) = *(dword_5854F0 + 16);
  v7 = dword_5854F0;
  v401 = *(&word_5C14F8 + v5);
  if ( *(dword_5854F0 + 16) & 0x80000000 )
  {
    if ( (286331153
        * (((qword_585498 - ((qword_585498 >> 1) & 0x55555555)) & 0x33333333)
         + ((HIDWORD(qword_585498) - ((HIDWORD(qword_585498) >> 1) & 0x55555555)) & 0x33333333)
         + (((qword_585498 - ((qword_585498 >> 1) & 0x55555555)) >> 2) & 0x33333333)
         + (((HIDWORD(qword_585498) - ((HIDWORD(qword_585498) >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 28) > 1
      || (286331153
        * (((qword_5854D8 - ((qword_5854D8 >> 1) & 0x55555555)) & 0x33333333)
         + ((HIDWORD(qword_5854D8) - ((HIDWORD(qword_5854D8) >> 1) & 0x55555555)) & 0x33333333)
         + (((qword_5854D8 - ((qword_5854D8 >> 1) & 0x55555555)) >> 2) & 0x33333333)
         + (((HIDWORD(qword_5854D8) - ((HIDWORD(qword_5854D8) >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 28) > 1
      || (286331153
        * (((qword_585490 - ((qword_585490 >> 1) & 0x55555555)) & 0x33333333)
         + ((HIDWORD(qword_585490) - ((HIDWORD(qword_585490) >> 1) & 0x55555555)) & 0x33333333)
         + (((qword_585490 - ((qword_585490 >> 1) & 0x55555555)) >> 2) & 0x33333333)
         + (((HIDWORD(qword_585490) - ((HIDWORD(qword_585490) >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 28) > 2
      || sub_401040(qword_5854D0, HIDWORD(qword_5854D0)) > 2
      || sub_401040(qword_585480, HIDWORD(qword_585480)) > 1
      || sub_401040(qword_5854C0, HIDWORD(qword_5854C0)) > 1
      || sub_401040(qword_585488, HIDWORD(qword_585488)) > 1
      || sub_401040(qword_5854C8, HIDWORD(qword_5854C8)) > 1
      || sub_401040(qword_585470, HIDWORD(qword_585470)) > 2
      || sub_401040(qword_5854B0, HIDWORD(qword_5854B0)) > 2 )
    {
      v358 = 0x80u;
      v8 = sub_4082B0();
      *(v7 + 223) = 0;
      v401 = v8;
      if ( qword_585498 | qword_585490 | qword_585480 | qword_585488 | qword_585470 )
        *(dword_5854F0 + 223) |= 2u;
      if ( qword_5854D8 | qword_5854D0 | qword_5854C0 | qword_5854C8 | qword_5854B0 )
        *(dword_5854F0 + 223) |= 1u;
      v407 = 0;
    }
    else
    {
      *(v7 + 16) &= 0x7FFFFFFFu;
    }
    v7 = dword_5854F0;
  }
  *(v7 + 48) = 0;
  *(dword_5854F0 + 52) = 0;
  *(dword_5854F0 + 56) = 0;
  *(dword_5854F0 + 60) = 0;
  v9 = HIDWORD(qword_585468);
  v10 = HIDWORD(qword_5854B8);
  HIDWORD(v12) = v9 & 0xFEFEFE;
  LODWORD(v12) = qword_585468 & 0xFEFEFEFE;
  v11 = v12 >> 25;
  v13 = (qword_585468 & 0xFEFEFEFEu) << 7;
  *(dword_5854F0 + 208) = qword_585468 & 0xFEFEFEFE & (qword_5854B8 >> 7);
  v14 = v13;
  *(dword_5854F0 + 212) = ((v12 >> 25) >> 7) & (v10 >> 7);
  HIDWORD(v12) = HIDWORD(qword_585468) & 0xFFFF7F7F;
  LODWORD(v12) = qword_585468 & 0x7F7F7F7F;
  v15 = (qword_585468 & 0x7F7F7F7F) << 9;
  v16 = v11;
  v17 = dword_5854F0;
  v18 = HIDWORD(qword_5854B8) >> 9;
  *(v17 + 208) |= qword_585468 & 0x7F7F7F7F & (qword_5854B8 >> 9);
  *(v17 + 212) |= ((v12 >> 23) >> 9) & v18;
  *(dword_5854F0 + 32) = v15 | v14;
  LODWORD(v402) = v15 | v14;
  *(dword_5854F0 + 36) = (v12 >> 23) | HIDWORD(v402);
  HIDWORD(v402) |= v12 >> 23;
  v19 = HIDWORD(qword_5854A8) >> 7;
  v19 &= 0xFEFEFEu;
  v20 = (qword_5854A8 >> 7) & 0xFEFEFEFE;
  HIDWORD(v12) = v19 & HIDWORD(qword_585478);
  LODWORD(v12) = v20 & qword_585478;
  *(dword_5854F0 + 200) = __PAIR__(v12 >> 25, (v20 & qword_585478) << 7);
  v21 = v20;
  v22 = v19;
  v23 = (qword_5854A8 >> 9) & 0x7F7F7F7F;
  v24 = dword_5854F0;
  v25 = &byte_7F7F7F & (HIDWORD(qword_5854A8) >> 9);
  v26 = v23 & qword_585478;
  HIDWORD(v12) = v25 & HIDWORD(qword_585478);
  LODWORD(v12) = v23 & qword_585478;
  *(v24 + 204) |= v12 >> 23;
  v27 = v23 | v21;
  v28 = v25 | v22;
  *(v24 + 200) |= v26 << 9;
  *(dword_5854F0 + 40) = v27;
  *(dword_5854F0 + 44) = v28;
  v29 = 2 * byte_5854E8;
  v380 = dword_8FC06C[2 * byte_5854E8];
  v30 = dword_8FC068[2 * byte_5854E9];
  v379 = dword_8FC068[2 * byte_5854E8];
  v31 = dword_8FC06C[2 * byte_5854E9];
  v32 = dword_5854F0;
  *(v32 + 32) |= dword_926678[2 * byte_5854E8];
  *(v32 + 36) |= dword_92667C[v29];
  v33 = byte_5854E9;
  v34 = dword_5854F0;
  *(v34 + 40) |= dword_926678[2 * byte_5854E9];
  *(v34 + 44) |= dword_92667C[2 * v33];
  v404 = __PAIR__(v28, v27);
  v378 = __PAIR__(v31, v30);
  if ( v31 & HIDWORD(qword_585478) | v30 & qword_585478 )
  {
    v35 = byte_5854E9;
    v36 = dword_5854F0;
    *(v36 + 200) |= LODWORD(qword_828A78[byte_5854E9]);
    *(v36 + 204) |= HIDWORD(qword_828A78[v35]);
    v37 = byte_5854E8;
    v38 = dword_5854F0;
    *(v38 + 208) |= LODWORD(qword_828A78[byte_5854E8]);
    *(v38 + 212) |= HIDWORD(qword_828A78[v37]);
  }
  v39 = dword_5854F0;
  v40 = *dword_5854F0 & 0x7FFF;
  v41 = *dword_5854F0 ^ LODWORD(qword_4440C0[v40]);
  v42 = *(dword_5854F0 + 4) ^ HIDWORD(qword_4440C0[v40]);
  v43 = &qword_4440C0[v40];
  if ( !(v42 | v41 & 0xFFFF0000) )
  {
    v44 = *(dword_5854F0 + 227);
    v45 = *v43;
    if ( v44 > 0x32u && (v45 + 24999) <= 0xC34E )
      v45 = v45 * (114 - v44) / 64;
    v46 = v45;
    if ( !byte_5854EA )
      v46 = -v45;
    *(dword_5854F0 + 192) = v46;
    *(dword_5854F0 + 196) = v45 - v401;
    *(dword_5854F0 + 222) = 0;
    if ( a4 && !*(dword_5854F0 - 10) )
    {
      if ( byte_5854EA )
      {
        sub_408730();
        return sub_4087F0();
      }
      sub_408790();
    }
    return sub_4087F0();
  }
  v48 = v407;
  v49 = dword_4840C8 + 32 * (*(dword_5854F0 + 8) & 0xFFFF);
  v386 = dword_4840C8 + 32 * (*(dword_5854F0 + 8) & 0xFFFF);
  if ( (v407 - 5) <= 2 )
  {
    v50 = v401;
    if ( v407 != 6 )
    {
      if ( v407 == 7 )
      {
LABEL_38:
        if ( *v49 == *(v39 + 8) && *(v49 + 4) == *(v39 + 12) )
        {
LABEL_497:
          if ( v48 )
          {
            v345 = (dword_8F2880[v407])(0, v50, v358, v49);
            v39 = dword_5854F0;
            v50 = v345;
          }
          _SF = v50 < 0;
          if ( v50 > 0 )
          {
            if ( *(v39 + 223) & 0x20 )
            {
              v347 = dword_8F2884(0, v50, v358, v49);
              goto LABEL_506;
            }
            _SF = v50 < 0;
          }
          if ( !_SF || !(*(v39 + 223) & 0x40) )
          {
LABEL_507:
            v348 = *(v39 + 223);
            if ( v348 < 0 && byte_5854EA )
            {
              v349 = dword_8F288C(0, v50, v358, v49);
            }
            else
            {
              if ( !(v348 & 0x10) || byte_5854EA )
                goto LABEL_514;
              v349 = dword_8F2890(0, v50, v358, v49);
            }
            v39 = dword_5854F0;
            v50 = v349;
LABEL_514:
            v350 = *(v39 + 4);
            v351 = *v39 & 0x7FFF;
            LODWORD(qword_4440C0[v351]) = *v39 & 0xFFFF0000 | v50;
            HIDWORD(qword_4440C0[v351]) = v350;
            v352 = *(v39 + 227);
            if ( v352 > 0x32u && (v50 + 24999) <= 0xC34E )
              v50 = v50 * (114 - v352) / 64;
            v353 = v50;
            if ( !byte_5854EA )
              v353 = -v50;
            *(v39 + 192) = v353;
            result = dword_5854F0;
            *(dword_5854F0 + 196) = v50 - v401;
            *(dword_5854F0 + 222) = 0;
            if ( a4 && !*(dword_5854F0 - 10) )
            {
              if ( byte_5854EA )
                result = sub_408730();
              else
                result = sub_408790();
            }
            return result;
          }
          v347 = dword_8F2888(0, v50, v358, v49);
LABEL_506:
          v39 = dword_5854F0;
          v50 = v347;
          goto LABEL_507;
        }
        sub_41A1D0(v49);
LABEL_496:
        v39 = dword_5854F0;
        v48 = v407;
        goto LABEL_497;
      }
      sub_4087F0();
      v39 = dword_5854F0;
      v48 = v407;
    }
    if ( v48 != 7 )
      goto LABEL_497;
    goto LABEL_38;
  }
  if ( a3 )
  {
    if ( !v407 )
    {
      v51 = *(dword_5854F0 - 36);
      if ( v51 <= 300 )
      {
        if ( v51 >= -300 )
        {
          v52 = *(dword_5854F0 + 223);
          if ( !(v52 & 0xFC)
            || (!(v52 & 0x20) || v401 < 0)
            && (!(v52 & 0x40) || v401 > 0)
            && (v52 >= 0 || !byte_5854EA)
            && (!(v52 & 0x10) || byte_5854EA) )
          {
            v53 = a4 & 0x3F;
            v54 = dword_931F90[v53 + (byte_585380[v53] << 6)]
                - dword_931F90[(byte_585380[v53] << 6) + ((a4 >> 6) & 0x3F)];
            if ( *(dword_5854F0 + 226) )
              v54 -= dword_931F90[v53 + (*(dword_5854F0 + 226) << 6)];
            v55 = v54 * (32 - *(dword_5854F0 + 24)) + *(dword_5854F0 + 24) * ((v54 < 0) + SHIWORD(v54));
            LODWORD(v55) = ((v55 + (BYTE4(v55) & 0x1F)) >> 5) + *(dword_5854F0 - 36);
            v56 = v55 + v401;
            v371 = v55;
            v368 = v55 + v401;
            if ( !byte_5854EA )
            {
              v56 = -v56;
              v368 = v56;
            }
            v57 = *(dword_5854F0 - 10);
            v359 = 32 * *(dword_5854F0 - 10);
            if ( v56 + v359 + a3 < -a2 )
            {
              *(dword_5854F0 + 222) = v57 + 1;
              *(dword_5854F0 + 192) = v56 + v359;
              *(dword_5854F0 + 196) = v371;
              return sub_4087F0();
            }
            v58 = v368 - v359 - a3;
            v369 = v368 - v359;
            if ( v58 > -a1 )
            {
              *(dword_5854F0 + 222) = v57 + 1;
              *(dword_5854F0 + 192) = v369;
              *(dword_5854F0 + 196) = v371;
              return sub_4087F0();
            }
            v30 = v378;
          }
        }
      }
    }
  }
  v357 = 0;
  v356 = 0;
  if ( *v49 != *(dword_5854F0 + 8) || *(v49 + 4) != *(dword_5854F0 + 12) )
  {
    sub_41A1D0(v49);
    v39 = dword_5854F0;
  }
  v59 = *(v49 + 24) + *(v39 + 20);
  v354 = v59;
  v370 = 65536;
  if ( !(HIDWORD(v402) & HIDWORD(v378) | v402 & v30) )
    v370 = 0;
  v381 = 65536;
  if ( !(v28 & v380 | v27 & v379) )
    v381 = 0;
  v60 = ~v27;
  v61 = ~v28;
  v388 = v61;
  v395 = qword_5854A8 & v60;
  v398 = HIDWORD(qword_5854A8) & v61;
  v387 = v60;
  if ( __PAIR__(v380 & HIDWORD(qword_5854A8) & v61, v379 & qword_5854A8 & v60) )
  {
    v59 += 10;
    v354 = v59;
  }
  v389 = ~v402;
  v408 = qword_585468 & ~v402;
  if ( HIDWORD(v378) & HIDWORD(v408) | v30 & v408 )
    v354 = v59 - 10;
  v62 = HIDWORD(qword_5854E0);
  v63 = (qword_585468 & (qword_5854E0 >> 8)) - (((qword_585468 & (qword_5854E0 >> 8)) >> 1) & 0x55555555);
  v64 = (HIDWORD(qword_585468) & (HIDWORD(qword_5854E0) >> 8))
      - (((HIDWORD(qword_585468) & (HIDWORD(qword_5854E0) >> 8)) >> 1) & 0x55555555);
  v65 = (HIDWORD(qword_5854A8) & (qword_5854E0 >> 24))
      - (((HIDWORD(qword_5854A8) & (qword_5854E0 >> 24)) >> 1) & 0x55555555);
  v355 = 393236
       * ((286331153
         * ((((qword_5854A8 & (qword_5854E0 << 8)) - (((qword_5854A8 & (qword_5854E0 << 8)) >> 1) & 0x55555555)) & 0x33333333)
          + (v65 & 0x33333333)
          + ((((qword_5854A8 & (qword_5854E0 << 8)) - (((qword_5854A8 & (qword_5854E0 << 8)) >> 1) & 0x55555555)) >> 2) & 0x33333333)
          + ((v65 >> 2) & 0x33333333)) >> 28)
        - (286331153 * ((v63 & 0x33333333) + (v64 & 0x33333333) + ((v63 >> 2) & 0x33333333) + ((v64 >> 2) & 0x33333333)) >> 28))
       + v354;
  v372 = &byte_828CB8[64 * byte_5854E9];
  v360 = &byte_585422;
  if ( byte_585422 != -1 )
  {
    do
    {
      v66 = *v360++;
      v67 = dword_8F2378[v66]
          + (((qword_5854E0 & dword_926270[2 * v66]) * dword_438B00[2 * v66] ^ dword_438B04[2 * v66]
                                                                             * (v62 & dword_926274[2 * v66])) >> dword_438F00[v66]);
      v68 = dword_926D00[2 * v67];
      v69 = dword_926D04[2 * v67];
      if ( v372[v66] & 3 )
      {
        if ( v69 & HIDWORD(qword_5854B8) | v68 & qword_5854B8 )
        {
          v70 = dword_5854F0;
          *(v70 + 208) |= LODWORD(qword_828A78[v66]);
          *(v70 + 212) |= HIDWORD(qword_828A78[v66]);
        }
        else
        {
          v71 = dword_8F2378[byte_5854E9]
              + (((qword_5854E0 & dword_926270[2 * byte_5854E9]) * dword_438B00[2 * byte_5854E9] ^ dword_438B04[2 * byte_5854E9]
                                                                                                 * (v62 & dword_926274[2 * byte_5854E9])) >> dword_438F00[byte_5854E9]);
          _ECX = v68 & dword_926D00[2 * v71];
          _EAX = v69 & dword_926D04[2 * v71];
          if ( _EAX | _ECX )
          {
            __asm { bsf     esi, ecx }
            if ( _ZF )
            {
              __asm { bsf     esi, eax }
              _ESI = _ESI + 32;
            }
            v355 += dword_439A38[byte_585380[_ESI]];
            v79 = dword_5854F0;
            *(v79 + 48) |= _ECX;
            *(v79 + 52) |= _EAX;
            __asm { bsf     ecx, ecx }
            if ( _ZF )
            {
              __asm { bsf     eax, eax }
              v81 = _EAX + 32;
            }
            else
            {
              v81 = _ECX;
            }
            *(v81 + dword_5854F0 + 64) = v66;
          }
        }
        v62 = HIDWORD(qword_5854E0);
      }
      v83 = dword_8FBB68[v66]
          + (((qword_5854E0 & dword_829CB8[2 * v66]) * dword_438D00[2 * v66] ^ dword_438D04[2 * v66]
                                                                             * (v62 & dword_829CBC[2 * v66])) >> dword_439000[v66]);
      v84 = dword_829EF8[2 * v83];
      v390 = dword_829EF8[2 * v83];
      v393 = dword_829EFC[2 * v83];
      if ( v372[v66] & 0xC )
      {
        if ( HIDWORD(qword_5854B8) & v393 | qword_5854B8 & v84 )
        {
          v85 = dword_5854F0;
          *(v85 + 208) |= LODWORD(qword_828A78[v66]);
          *(v85 + 212) |= HIDWORD(qword_828A78[v66]);
        }
        else
        {
          v86 = dword_8FBB68[byte_5854E9]
              + (((qword_5854E0 & dword_829CB8[2 * byte_5854E9]) * dword_438D00[2 * byte_5854E9] ^ dword_438D04[2 * byte_5854E9]
                                                                                                 * (v62 & dword_829CBC[2 * byte_5854E9])) >> dword_439000[byte_5854E9]);
          v84 = v390;
          v87 = dword_829EF8[2 * v86];
          _EAX = v393 & dword_829EFC[2 * v86];
          _ECX = v390 & v87;
          if ( _EAX | _ECX )
          {
            __asm { bsf     esi, ecx }
            if ( _ZF )
            {
              __asm { bsf     esi, eax }
              _ESI = _ESI + 32;
            }
            v355 += dword_439AB8[byte_585380[_ESI]];
            v92 = dword_5854F0;
            *(v92 + 48) |= _ECX;
            *(v92 + 52) |= _EAX;
            __asm { bsf     ecx, ecx }
            if ( _ZF )
            {
              __asm { bsf     eax, eax }
              _ECX = _EAX + 32;
            }
            v84 = v390;
            *(_ECX + dword_5854F0 + 64) = v66;
          }
        }
      }
      v95 = v393 | v69;
      v96 = dword_5854F0;
      *(v96 + 36) |= v95;
      v97 = v84 | v68;
      *(v96 + 32) |= v97;
      if ( v95 & HIDWORD(v378) | v97 & v378 )
        v370 += 65576;
      if ( v95 & v380 | v97 & v379 )
        v355 += 655364;
      v98 = (v97 & v387 & ~LODWORD(qword_585460[0])) - (((v97 & v387 & ~LODWORD(qword_585460[0])) >> 1) & 0x55555555);
      v99 = (v95 & v388 & ~HIDWORD(qword_585460[0])) - (((v95 & v388 & ~HIDWORD(qword_585460[0])) >> 1) & 0x55555555);
      v355 += 262148
            * (16843009
             * ((((v98 & 0x33333333)
                + ((v98 >> 2) & 0x33333333)
                + (((v98 & 0x33333333) + ((v98 >> 2) & 0x33333333)) >> 4)) & 0xF0F0F0F)
              + (((v99 & 0x33333333)
                + ((v99 >> 2) & 0x33333333)
                + (((v99 & 0x33333333) + ((v99 >> 2) & 0x33333333)) >> 4)) & 0xF0F0F0F)) >> 24);
      if ( v95 & HIDWORD(qword_5854A0) & v388 | v97 & qword_5854A0 & v387 )
        v355 += 524296;
      if ( HIDWORD(qword_5854A8) & dword_931B94[2 * v66] | qword_5854A8 & dword_931B90[2 * v66] )
      {
        v355 -= 1048600;
        ++v356;
      }
      if ( (v66 & 0xFFFFFFF8) == 48 )
      {
        if ( (HIDWORD(qword_5854B8) | HIDWORD(qword_5854A8)) & 0xFFFF0000 )
        {
          v100 = HIDWORD(qword_585490) & v393;
          v355 += 655410;
          if ( v100 & 0xFF0000 )
          {
            if ( HIDWORD(qword_5854B8) & 0xFF000000 )
              v355 += 1310750;
          }
        }
      }
      v62 = HIDWORD(qword_5854E0);
    }
    while ( *v360 != -1 );
  }
  v101 = &byte_585417;
  if ( byte_585417 != -1 )
  {
    do
    {
      v102 = *v101;
      v361 = (v101 + 1);
      v103 = dword_8FBB68[v102]
           + (((qword_5854E0 & dword_829CB8[2 * v102]) * dword_438D00[2 * v102] ^ dword_438D04[2 * v102]
                                                                                * (v62 & dword_829CBC[2 * v102])) >> dword_439000[v102]);
      v104 = dword_829EFC[2 * v103];
      v105 = dword_829EF8[2 * v103];
      v106 = dword_5854F0;
      *(v106 + 32) |= v105;
      *(v106 + 36) |= v104;
      v377 = v104;
      if ( v372[v102] & 0xC )
      {
        if ( v104 & HIDWORD(qword_5854B8) | v105 & qword_5854B8 )
        {
          v107 = dword_5854F0;
          *(v107 + 208) |= LODWORD(qword_828A78[v102]);
          *(v107 + 212) |= HIDWORD(qword_828A78[v102]);
        }
        else
        {
          v108 = dword_8FBB68[byte_5854E9]
               + (((qword_5854E0 & dword_829CB8[2 * byte_5854E9]) * dword_438D00[2 * byte_5854E9] ^ dword_438D04[2 * byte_5854E9] * (HIDWORD(qword_5854E0) & dword_829CBC[2 * byte_5854E9])) >> dword_439000[byte_5854E9]);
          _ECX = v105 & dword_829EF8[2 * v108];
          _EAX = v104 & dword_829EFC[2 * v108];
          if ( _EAX | _ECX )
          {
            __asm { bsf     esi, ecx }
            if ( _ZF )
            {
              __asm { bsf     esi, eax }
              _ESI = _ESI + 32;
            }
            v355 += dword_4399B8[byte_585380[_ESI]];
            v113 = dword_5854F0;
            *(v113 + 48) |= _ECX;
            *(v113 + 52) |= _EAX;
            __asm { bsf     ecx, ecx }
            if ( _ZF )
            {
              __asm { bsf     eax, eax }
              v115 = _EAX + 32;
            }
            else
            {
              v115 = _ECX;
            }
            *(v115 + dword_5854F0 + 64) = v102;
          }
        }
      }
      v117 = dword_8FBB68[v102]
           + (((qword_5854E0 & dword_829CB8[2 * v102] & ~qword_585498 & ~qword_585490) * dword_438D00[2 * v102] ^ dword_438D04[2 * v102] * (HIDWORD(qword_5854E0) & dword_829CBC[2 * v102] & ~HIDWORD(qword_585498) & ~HIDWORD(qword_585490))) >> dword_439000[v102]);
      if ( HIDWORD(v378) & dword_829EFC[2 * v117] | v378 & dword_829EF8[2 * v117] )
        v370 += 65561;
      if ( v104 & v380 | v105 & v379 )
        v355 += 393218;
      v355 += 262150
            * (286331153
             * ((((v105 & v387 & ~qword_585468) - (((v105 & v387 & ~qword_585468) >> 1) & 0x55555555)) & 0x33333333)
              + (((v104 & v388 & ~HIDWORD(qword_585468)) - (((v104 & v388 & ~HIDWORD(qword_585468)) >> 1) & 0x55555555)) & 0x33333333)
              + ((((v105 & v387 & ~qword_585468) - (((v105 & v387 & ~qword_585468) >> 1) & 0x55555555)) >> 2) & 0x33333333)
              + ((((v104 & v388 & ~HIDWORD(qword_585468)) - (((v104 & v388 & ~HIDWORD(qword_585468)) >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 28);
      if ( v104 & v398 | v105 & v395 )
        v355 += 262150;
      v118 = HIDWORD(qword_5854C0) | HIDWORD(qword_5854C8) | HIDWORD(qword_5854B0);
      v119 = qword_5854C0 | qword_5854C8 | qword_5854B0;
      if ( v104 & v118 & v388 | v105 & v119 & v387 )
        v355 += 524298;
      if ( v104 & HIDWORD(qword_5854D8) | v105 & qword_5854D8 )
      {
        v355 += 655370;
        ++v357;
      }
      if ( HIDWORD(qword_5854A8) & dword_931B94[2 * v102] | qword_5854A8 & dword_931B90[2 * v102] )
      {
        v355 -= 917524;
        ++v356;
      }
      v120 = dword_828678[2 * v102];
      v385 = dword_82867C[2 * v102];
      if ( __PAIR__(HIDWORD(qword_585468) & v385, qword_585468 & dword_828678[2 * v102]) )
      {
        HIDWORD(v131) = HIDWORD(qword_5854B8);
      }
      else
      {
        _EDI = HIDWORD(qword_5854A8) & v385;
        v355 += 393228;
        _EAX = qword_5854A8 & v120;
        if ( HIDWORD(qword_5854A8) & v385 | qword_5854A8 & v120 )
        {
          __asm { bsf     ecx, eax }
          if ( _ZF )
          {
            __asm { bsf     eax, edi }
            _ECX = _EAX + 32;
          }
          v123 = dword_828678[2 * v102];
          v124 = dword_82867C[2 * v102];
          if ( !(HIDWORD(qword_5854A8) & dword_8F247C[2 * _ECX] | qword_5854A8 & dword_8F2478[2 * _ECX]) )
            v355 += 655370;
        }
        else
        {
          v123 = dword_828678[2 * v102];
          v124 = dword_82867C[2 * v102];
          _ECX = v404 & dword_828678[2 * v102] & v119;
          _ESI = HIDWORD(v404) & v385 & v118;
          if ( _ESI | _ECX )
          {
            __asm { bsf     ecx, ecx }
            if ( _ZF )
            {
              __asm { bsf     ecx, esi }
              _ECX = _ECX + 32;
            }
            if ( HIDWORD(qword_585468) & dword_8F267C[2 * _ECX] | qword_585468 & dword_8F2678[2 * _ECX] )
              v355 += 1966090;
            else
              v355 += 1310720;
          }
          else
          {
            v355 += 2621460;
          }
        }
        v131 = qword_5854B8 & v123;
        if ( HIDWORD(qword_5854B8) & v124 | v131 )
          v355 += 1966080;
      }
      if ( HIDWORD(qword_828A78[v102]) & 0x7E7E | qword_828A78[v102] & 0x7E000000 )
      {
        if ( !(HIDWORD(qword_5854A8) & dword_8F247C[2 * v102] | qword_5854A8 & dword_8F2478[2 * v102]) )
        {
          if ( HIDWORD(qword_585468) & HIDWORD(qword_931990[v102]) | qword_585468 & qword_931990[v102] )
          {
            v355 += 131076;
            HIDWORD(v131) = HIDWORD(qword_5854B8);
            if ( v377 & dword_4396BC[2 * (v102 >> 3)] & (HIDWORD(v378) | HIDWORD(qword_5854A0) & v388) | v105 & dword_4396B8[2 * (v102 >> 3)] & (v378 | qword_5854A0 & v387) )
              v355 += 393224;
          }
        }
      }
      v132 = v102 >> 3;
      if ( v132 == 7 )
      {
        if ( HIDWORD(v131) & 0xFF000000 )
          v355 += 655380;
      }
      else
      {
        if ( v132 == 6 )
        {
          if ( (HIDWORD(v131) | HIDWORD(qword_5854A8)) & 0xFFFF0000 )
          {
            v355 += 1310780;
            if ( HIDWORD(v131) & 0xFF000000 )
            {
              v133 = v377 & (HIDWORD(qword_585498) | HIDWORD(qword_585490));
              if ( v133 & 0xFF0000 )
                v355 += 1310760;
            }
          }
        }
        else
        {
          if ( v132 == 5 && (HIDWORD(v131) | HIDWORD(qword_5854A8)) & 0xFFFFFF00 )
            v355 += 655390;
        }
      }
      v101 = v361;
      v62 = HIDWORD(qword_5854E0);
    }
    while ( *v361 != -1 );
  }
  v382 = qword_5854A8 ^ qword_5854A0 | ~(v404 | qword_585460[0]);
  v134 = &byte_58540C;
  if ( byte_58540C != -1 )
  {
    v135 = v355;
    do
    {
      v136 = *v134;
      v362 = (v134 + 1);
      v137 = dword_8F2378[v136]
           + (((dword_926270[2 * v136] & qword_5854E0) * dword_438B00[2 * v136] ^ dword_438B04[2 * v136]
                                                                                * (dword_926274[2 * v136] & v62)) >> dword_438F00[v136]);
      v138 = dword_926D04[2 * v137];
      v139 = dword_926D00[2 * v137];
      v140 = dword_5854F0;
      *(v140 + 32) |= v139;
      *(v140 + 36) |= v138;
      if ( v372[v136] & 3 )
      {
        if ( v138 & HIDWORD(qword_5854B8) | v139 & qword_5854B8 )
        {
          v141 = dword_5854F0;
          *(v141 + 208) |= LODWORD(qword_828A78[v136]);
          *(v141 + 212) |= HIDWORD(qword_828A78[v136]);
        }
        else
        {
          v142 = dword_8F2378[byte_5854E9]
               + (((qword_5854E0 & dword_926270[2 * byte_5854E9]) * dword_438B00[2 * byte_5854E9] ^ dword_438B04[2 * byte_5854E9] * (HIDWORD(qword_5854E0) & dword_926274[2 * byte_5854E9])) >> dword_438F00[byte_5854E9]);
          _ECX = v139 & dword_926D00[2 * v142];
          _EAX = v138 & dword_926D04[2 * v142];
          if ( _EAX | _ECX )
          {
            __asm { bsf     esi, ecx }
            if ( _ZF )
            {
              __asm { bsf     esi, eax }
              _ESI = _ESI + 32;
            }
            v135 = dword_439938[byte_585380[_ESI]] + v355;
            v147 = dword_5854F0;
            *(v147 + 48) |= _ECX;
            *(v147 + 52) |= _EAX;
            __asm { bsf     ecx, ecx }
            v355 = v135;
            if ( _ZF )
            {
              __asm { bsf     eax, eax }
              *(_EAX + 32 + dword_5854F0 + 64) = v136;
            }
            else
            {
              *(_ECX + dword_5854F0 + 64) = v136;
            }
          }
          else
          {
            v135 = v355;
          }
        }
      }
      v150 = dword_8F2378[v136]
           + (((dword_926270[2 * v136] & qword_5854E0 & ~qword_585498) * dword_438B00[2 * v136] ^ dword_438B04[2 * v136]
                                                                                                * (dword_926274[2 * v136] & HIDWORD(qword_5854E0) & ~HIDWORD(qword_585498))) >> dword_438F00[v136]);
      if ( HIDWORD(v378) & dword_926D04[2 * v150] | v378 & dword_926D00[2 * v150] )
        v370 += 65551;
      if ( v138 & v380 | v139 & v379 )
        v355 = v135 + 262146;
      v151 = 2 * (v136 >> 3);
      v152 = 655370
           * (286331153
            * ((((v139 & v382 & dword_8F3120[2 * (v136 >> 3)])
               - (((v139 & v382 & dword_8F3120[2 * (v136 >> 3)]) >> 1) & 0x55555555)) & 0x33333333)
             + (((v138 & HIDWORD(v382) & dword_8F3124[2 * (v136 >> 3)])
               - (((v138 & HIDWORD(v382) & dword_8F3124[2 * (v136 >> 3)]) >> 1) & 0x55555555)) & 0x33333333)
             + ((((v139 & v382 & dword_8F3120[2 * (v136 >> 3)])
                - (((v139 & v382 & dword_8F3120[2 * (v136 >> 3)]) >> 1) & 0x55555555)) >> 2) & 0x33333333)
             + ((((v138 & HIDWORD(v382) & dword_8F3124[2 * (v136 >> 3)])
                - (((v138 & HIDWORD(v382) & dword_8F3124[2 * (v136 >> 3)]) >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 28)
           + v355;
      if ( v138 & v398 | v139 & v395 )
        v152 += 393224;
      if ( v138 & HIDWORD(qword_5854B0) & v388 | v139 & qword_5854B0 & v387 )
        v152 += 655370;
      if ( v138 & (HIDWORD(qword_5854D8) | HIDWORD(qword_5854D0)) | v139 & (qword_5854D8 | qword_5854D0) )
      {
        v152 += 917524;
        ++v357;
      }
      if ( HIDWORD(qword_5854A8) & dword_931B94[2 * v136] | qword_5854A8 & dword_931B90[2 * v136] )
      {
        v152 -= 655374;
        ++v356;
      }
      v153 = LODWORD(qword_828A78[v136]);
      v405 = v153;
      _ZF = (HIDWORD(qword_828A78[v136]) & 0x55AA55AA | v153 & 0x55AA55AA) == 0;
      v154 = dword_8F2CD8[v151];
      v155 = dword_8F2CDC[v151];
      if ( _ZF )
      {
        v161 = (qword_5854A8 & v387 & v154 & 0xAA55AA55)
             - (((qword_5854A8 & v387 & v154 & 0xAA55AA55) >> 1) & 0x55555555);
        v162 = (HIDWORD(qword_5854A8) & v388 & v155 & 0xAA55AA55)
             - (((HIDWORD(qword_5854A8) & v388 & v155 & 0xAA55AA55u) >> 1) & 0x55555555);
        v158 = (v161 & 0x33333333) + (v162 & 0x33333333) + ((v161 >> 2) & 0x33333333) + ((v162 >> 2) & 0x33333333);
        v159 = *(v386 + 11);
        v160 = *(v386 + 10);
      }
      else
      {
        v156 = (qword_5854A8 & v387 & v154 & 0x55AA55AA)
             - (((qword_5854A8 & v387 & v154 & 0x55AA55AA) >> 1) & 0x55555555);
        v157 = (HIDWORD(qword_5854A8) & v388 & v155 & 0x55AA55AA)
             - (((HIDWORD(qword_5854A8) & v388 & v155 & 0x55AA55AAu) >> 1) & 0x55555555);
        v158 = (v156 & 0x33333333) + (v157 & 0x33333333) + ((v156 >> 2) & 0x33333333) + ((v157 >> 2) & 0x33333333);
        v159 = *(v386 + 9);
        v160 = *(v386 + 8);
      }
      v135 = 4 * ((286331153 * v158) >> 28) - 131074 * (v160 + (v159 >> 1)) + v152;
      v355 = v135;
      if ( HIDWORD(qword_828A78[v136]) & 0x7E7E | v405 & 0x7E000000 )
      {
        if ( !(HIDWORD(qword_5854A8) & dword_8F247C[2 * v136] | qword_5854A8 & dword_8F2478[2 * v136]) )
        {
          if ( HIDWORD(qword_585468) & HIDWORD(qword_931990[v136]) | qword_585468 & qword_931990[v136] )
          {
            v135 += 131076;
            v355 = v135;
            if ( v138 & (HIDWORD(v378) | HIDWORD(qword_5854A0) & v388) | v139 & (v378 | qword_5854A0 & v387) )
            {
              v135 += 393224;
              v355 = v135;
            }
          }
        }
      }
      if ( (byte_585380[byte_439B38[v136]] & 7) == 1 )
      {
        v135 -= dword_500050;
        v355 = v135;
        if ( (byte_585380[byte_439BB8[v136]] & 7) == 1 )
        {
          v135 -= dword_500050;
          v355 = v135;
        }
      }
      v134 = v362;
      v62 = HIDWORD(qword_5854E0);
    }
    while ( *v362 != -1 );
  }
  v163 = &byte_585401;
  if ( byte_585401 != -1 )
  {
    do
    {
      v164 = *v163;
      v165 = dword_8F2178[2 * v164];
      v166 = dword_8F217C[2 * v164];
      v363 = (v163 + 1);
      v167 = dword_5854F0;
      *(v167 + 32) |= v165;
      *(v167 + 36) |= v166;
      if ( v166 & HIDWORD(qword_5854B8) | v165 & qword_5854B8 )
      {
        v168 = dword_5854F0;
        *(v168 + 208) |= LODWORD(qword_828A78[v164]);
        *(v168 + 212) |= HIDWORD(qword_828A78[v164]);
      }
      if ( v166 & HIDWORD(v378) | v165 & v378 )
        v370 += 65551;
      if ( v166 & v380 | v165 & v379 )
        v355 += 524292;
      v169 = v382 & dword_8F3120[2 * (v164 >> 3)];
      v170 = (v165 & v169) - (((v165 & v169) >> 1) & 0x55555555);
      v355 += 786448
            * (286331153
             * ((v170 & 0x33333333)
              + (((v166 & HIDWORD(v382) & dword_8F3124[2 * (v164 >> 3)])
                - (((v166 & HIDWORD(v382) & dword_8F3124[2 * (v164 >> 3)]) >> 1) & 0x55555555)) & 0x33333333)
              + ((v170 >> 2) & 0x33333333)
              + ((((v166 & HIDWORD(v382) & dword_8F3124[2 * (v164 >> 3)])
                 - (((v166 & HIDWORD(v382) & dword_8F3124[2 * (v164 >> 3)]) >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 28);
      if ( v166 & v398 | v165 & v395 )
        v355 += 393224;
      if ( v166 & v388 & (HIDWORD(qword_5854C0) | HIDWORD(qword_5854C8)) | v165 & v387 & (qword_5854C0 | qword_5854C8) )
        v355 += 655370;
      v171 = v166 & (HIDWORD(qword_5854D8) | HIDWORD(qword_5854D0));
      if ( v171 | v165 & (qword_5854D8 | qword_5854D0) )
      {
        v355 += 917524;
        ++v357;
        if ( v171 & (__CFADD__(v165 & (qword_5854D8 | qword_5854D0), -1) + v171 - 1) | v165 & (qword_5854D8 | qword_5854D0) & ((v165 & (qword_5854D8 | qword_5854D0)) - 1) )
          ++v357;
      }
      if ( HIDWORD(qword_5854A8) & dword_931B94[2 * v164] | qword_5854A8 & dword_931B90[2 * v164] )
      {
        v355 -= 655374;
        ++v356;
      }
      if ( HIDWORD(qword_828A78[v164]) & 0x7E7E | qword_828A78[v164] & 0x7E000000 )
      {
        if ( !(HIDWORD(qword_5854A8) & dword_8F247C[2 * v164] | qword_5854A8 & dword_8F2478[2 * v164]) )
        {
          v355 += 262150;
          if ( HIDWORD(qword_585468) & HIDWORD(qword_931990[v164]) | qword_585468 & qword_931990[v164] )
          {
            v355 += 262150;
            if ( v166 & (HIDWORD(v378) | HIDWORD(qword_5854A0) & v388) | v165 & (v378 | qword_5854A0 & v387) )
            {
              v355 += 655370;
              if ( v164 >> 3 == 4 )
                v355 += 262148;
              v172 = v164 & 7;
              if ( v172 == 3 || v172 == 4 )
                v355 += 393222;
            }
          }
        }
      }
      v163 = v363;
    }
    while ( *v363 != -1 );
    v62 = HIDWORD(qword_5854E0);
  }
  if ( !byte_5854EA || (result = dword_5854F0, !*(dword_5854F0 + 208)) )
  {
    v373 = &byte_828CB8[64 * byte_5854E8];
    v364 = &byte_58544D;
    if ( byte_58544D != -1 )
    {
      do
      {
        v173 = *v364++;
        v174 = dword_8F2378[v173]
             + (((qword_5854E0 & dword_926270[2 * v173]) * dword_438B00[2 * v173] ^ dword_438B04[2 * v173]
                                                                                  * (v62 & dword_926274[2 * v173])) >> dword_438F00[v173]);
        v175 = dword_926D00[2 * v174];
        v176 = dword_926D04[2 * v174];
        if ( v373[v173] & 3 )
        {
          if ( v176 & HIDWORD(qword_585478) | v175 & qword_585478 )
          {
            v177 = dword_5854F0;
            *(v177 + 200) |= LODWORD(qword_828A78[v173]);
            *(v177 + 204) |= HIDWORD(qword_828A78[v173]);
          }
          else
          {
            v178 = dword_8F2378[byte_5854E8]
                 + (((qword_5854E0 & dword_926270[2 * byte_5854E8]) * dword_438B00[2 * byte_5854E8] ^ dword_438B04[2 * byte_5854E8] * (v62 & dword_926274[2 * byte_5854E8])) >> dword_438F00[byte_5854E8]);
            _ECX = v175 & dword_926D00[2 * v178];
            _EAX = v176 & dword_926D04[2 * v178];
            if ( _EAX | _ECX )
            {
              __asm { bsf     esi, ecx }
              if ( _ZF )
              {
                __asm { bsf     esi, eax }
                _ESI = _ESI + 32;
              }
              v355 -= dword_439A78[byte_585380[_ESI]];
              v183 = dword_5854F0;
              *(v183 + 56) |= _ECX;
              *(v183 + 60) |= _EAX;
              __asm { bsf     ecx, ecx }
              if ( _ZF )
              {
                __asm { bsf     eax, eax }
                v185 = _EAX + 32;
              }
              else
              {
                v185 = _ECX;
              }
              *(v185 + dword_5854F0 + 128) = v173;
            }
          }
          v62 = HIDWORD(qword_5854E0);
        }
        v187 = dword_8FBB68[v173]
             + (((qword_5854E0 & dword_829CB8[2 * v173]) * dword_438D00[2 * v173] ^ dword_438D04[2 * v173]
                                                                                  * (v62 & dword_829CBC[2 * v173])) >> dword_439000[v173]);
        v188 = dword_829EFC[2 * v187];
        v391 = dword_829EF8[2 * v187];
        v394 = dword_829EFC[2 * v187];
        if ( v373[v173] & 0xC )
        {
          if ( HIDWORD(qword_585478) & v188 | qword_585478 & dword_829EF8[2 * v187] )
          {
            v189 = dword_5854F0;
            *(v189 + 200) |= LODWORD(qword_828A78[v173]);
            *(v189 + 204) |= HIDWORD(qword_828A78[v173]);
          }
          else
          {
            v190 = dword_8FBB68[byte_5854E8]
                 + (((qword_5854E0 & dword_829CB8[2 * byte_5854E8]) * dword_438D00[2 * byte_5854E8] ^ dword_438D04[2 * byte_5854E8] * (v62 & dword_829CBC[2 * byte_5854E8])) >> dword_439000[byte_5854E8]);
            v188 = v394;
            _ECX = v391 & dword_829EF8[2 * v190];
            _EAX = v394 & dword_829EFC[2 * v190];
            if ( _EAX | _ECX )
            {
              __asm { bsf     esi, ecx }
              if ( _ZF )
              {
                __asm { bsf     esi, eax }
                _ESI = _ESI + 32;
              }
              v355 -= dword_439AF8[byte_585380[_ESI]];
              v195 = dword_5854F0;
              *(v195 + 56) |= _ECX;
              *(v195 + 60) |= _EAX;
              __asm { bsf     ecx, ecx }
              if ( _ZF )
              {
                __asm { bsf     eax, eax }
                _ECX = _EAX + 32;
              }
              v188 = v394;
              *(_ECX + dword_5854F0 + 128) = v173;
            }
          }
        }
        v198 = v391 | v175;
        v199 = dword_5854F0;
        *(v199 + 40) |= v198;
        v200 = v188 | v176;
        *(v199 + 44) |= v200;
        if ( v200 & v380 | v198 & v379 )
          v381 += 65576;
        if ( v200 & HIDWORD(v378) | v198 & v378 )
          v355 -= 655364;
        v201 = (v198 & v389 & ~qword_5854A0) - (((v198 & v389 & ~qword_5854A0) >> 1) & 0x55555555);
        v202 = (v200 & HIDWORD(v389) & ~HIDWORD(qword_5854A0))
             - (((v200 & (HIDWORD(v389) & ~HIDWORD(qword_5854A0))) >> 1) & 0x55555555);
        v355 += -262148
              * (16843009
               * ((((v201 & 0x33333333)
                  + ((v201 >> 2) & 0x33333333)
                  + (((v201 & 0x33333333) + ((v201 >> 2) & 0x33333333)) >> 4)) & 0xF0F0F0F)
                + (((v202 & 0x33333333)
                  + ((v202 >> 2) & 0x33333333)
                  + (((v202 & 0x33333333) + ((v202 >> 2) & 0x33333333)) >> 4)) & 0xF0F0F0F)) >> 24);
        if ( v200 & HIDWORD(qword_585460[0]) & HIDWORD(v389) | v198 & qword_585460[0] & v389 )
          v355 -= 524296;
        if ( HIDWORD(qword_585468) & HIDWORD(qword_931990[v173]) | qword_585468 & qword_931990[v173] )
        {
          v355 += 1048600;
          ++v357;
        }
        if ( (v173 & 0xFFFFFFF8) == 8 )
        {
          if ( qword_585468 | qword_585478 )
          {
            v355 -= 655410;
            if ( qword_5854D0 & v391 & 0xFF00 )
            {
              if ( qword_585478 )
                v355 -= 1310750;
            }
          }
        }
        v62 = HIDWORD(qword_5854E0);
      }
      while ( *v364 != -1 );
    }
    v203 = HIDWORD(qword_5854B0);
    v204 = qword_5854B0;
    v205 = &byte_585442;
    if ( byte_585442 == -1 )
    {
LABEL_324:
      v236 = HIDWORD(qword_585470);
      v383 = qword_585468 ^ qword_585460[0] | ~(v402 | qword_5854A0);
      v237 = &byte_585437;
      if ( byte_585437 != -1 )
      {
        v238 = v355;
        while ( 1 )
        {
          v239 = *v237;
          v366 = (v237 + 1);
          v240 = dword_8F2378[v239]
               + (((dword_926270[2 * v239] & qword_5854E0) * dword_438B00[2 * v239] ^ dword_438B04[2 * v239]
                                                                                    * (dword_926274[2 * v239] & v62)) >> dword_438F00[v239]);
          v241 = dword_926D04[2 * v240];
          v242 = dword_926D00[2 * v240];
          v243 = dword_5854F0;
          *(v243 + 40) |= v242;
          *(v243 + 44) |= v241;
          if ( v373[v239] & 3 )
          {
            if ( v241 & HIDWORD(qword_585478) | v242 & qword_585478 )
            {
              v244 = dword_5854F0;
              *(v244 + 200) |= LODWORD(qword_828A78[v239]);
              *(v244 + 204) |= HIDWORD(qword_828A78[v239]);
            }
            else
            {
              v245 = dword_8F2378[byte_5854E8]
                   + (((qword_5854E0 & dword_926270[2 * byte_5854E8]) * dword_438B00[2 * byte_5854E8] ^ dword_438B04[2 * byte_5854E8] * (HIDWORD(qword_5854E0) & dword_926274[2 * byte_5854E8])) >> dword_438F00[byte_5854E8]);
              _ECX = v242 & dword_926D00[2 * v245];
              _EAX = v241 & dword_926D04[2 * v245];
              if ( _EAX | _ECX )
              {
                __asm { bsf     esi, ecx }
                if ( _ZF )
                {
                  __asm { bsf     esi, eax }
                  _ESI = _ESI + 32;
                }
                v238 = v355 - dword_439978[byte_585380[_ESI]];
                v250 = dword_5854F0;
                *(v250 + 56) |= _ECX;
                *(v250 + 60) |= _EAX;
                __asm { bsf     ecx, ecx }
                v355 = v238;
                if ( _ZF )
                {
                  __asm { bsf     eax, eax }
                  *(_EAX + 32 + dword_5854F0 + 128) = v239;
                }
                else
                {
                  *(_ECX + dword_5854F0 + 128) = v239;
                }
              }
              else
              {
                v238 = v355;
              }
            }
          }
          v253 = dword_8F2378[v239]
               + (((dword_926270[2 * v239] & qword_5854E0 & ~qword_5854D8) * dword_438B00[2 * v239] ^ dword_438B04[2 * v239] * (dword_926274[2 * v239] & HIDWORD(qword_5854E0) & ~HIDWORD(qword_5854D8))) >> dword_438F00[v239]);
          if ( v380 & dword_926D04[2 * v253] | v379 & dword_926D00[2 * v253] )
            v381 += 65551;
          if ( v241 & HIDWORD(v378) | v242 & v378 )
            v355 = v238 - 262146;
          v254 = 2 * (v239 >> 3);
          v255 = -655370
               * (286331153
                * ((((v242 & v383 & dword_8F2CD8[2 * (v239 >> 3)])
                   - (((v242 & v383 & dword_8F2CD8[2 * (v239 >> 3)]) >> 1) & 0x55555555)) & 0x33333333)
                 + (((v241 & HIDWORD(v383) & dword_8F2CDC[2 * (v239 >> 3)])
                   - (((v241 & HIDWORD(v383) & dword_8F2CDC[2 * (v239 >> 3)]) >> 1) & 0x55555555)) & 0x33333333)
                 + ((((v242 & v383 & dword_8F2CD8[2 * (v239 >> 3)])
                    - (((v242 & v383 & dword_8F2CD8[2 * (v239 >> 3)]) >> 1) & 0x55555555)) >> 2) & 0x33333333)
                 + ((((v241 & HIDWORD(v383) & dword_8F2CDC[2 * (v239 >> 3)])
                    - (((v241 & HIDWORD(v383) & dword_8F2CDC[2 * (v239 >> 3)]) >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 28)
               + v355;
          if ( v241 & HIDWORD(v408) | v242 & v408 )
            v255 -= 393224;
          if ( v241 & HIDWORD(qword_585470) & HIDWORD(v389) | v242 & qword_585470 & v389 )
            v255 -= 655370;
          if ( v241 & (HIDWORD(qword_585498) | HIDWORD(qword_585490)) | v242 & (qword_585498 | qword_585490) )
          {
            v255 -= 917524;
            ++v356;
          }
          if ( HIDWORD(qword_585468) & HIDWORD(qword_931990[v239]) | qword_585468 & qword_931990[v239] )
          {
            v255 += 655374;
            ++v357;
          }
          v256 = LODWORD(qword_828A78[v239]);
          v406 = v256;
          _ZF = (HIDWORD(qword_828A78[v239]) & 0x55AA55AA | v256 & 0x55AA55AA) == 0;
          v257 = dword_8F3120[v254];
          v258 = dword_8F3124[v254];
          if ( _ZF )
          {
            v264 = (qword_585468 & v389 & v257 & 0xAA55AA55)
                 - (((qword_585468 & v389 & v257 & 0xAA55AA55) >> 1) & 0x55555555);
            v265 = (HIDWORD(qword_585468) & HIDWORD(v389) & v258 & 0xAA55AA55)
                 - (((HIDWORD(qword_585468) & HIDWORD(v389) & v258 & 0xAA55AA55u) >> 1) & 0x55555555);
            v261 = (v264 & 0x33333333) + (v265 & 0x33333333) + ((v264 >> 2) & 0x33333333) + ((v265 >> 2) & 0x33333333);
            v262 = *(v386 + 10);
            v263 = *(v386 + 11);
          }
          else
          {
            v259 = (qword_585468 & v389 & v257 & 0x55AA55AA)
                 - (((qword_585468 & v389 & v257 & 0x55AA55AA) >> 1) & 0x55555555);
            v260 = (HIDWORD(qword_585468) & HIDWORD(v389) & v258 & 0x55AA55AA)
                 - (((HIDWORD(qword_585468) & HIDWORD(v389) & v258 & 0x55AA55AAu) >> 1) & 0x55555555);
            v261 = (v259 & 0x33333333) + (v260 & 0x33333333) + ((v259 >> 2) & 0x33333333) + ((v260 >> 2) & 0x33333333);
            v262 = *(v386 + 8);
            v263 = *(v386 + 9);
          }
          v238 = 131074 * (v263 + (v262 >> 1)) - 4 * ((286331153 * v261) >> 28) + v255;
          v355 = v238;
          if ( HIDWORD(qword_828A78[v239]) & 0x7E | v406 & 0x7E7E0000 )
          {
            if ( !(HIDWORD(qword_585468) & dword_8F267C[2 * v239] | qword_585468 & dword_8F2678[2 * v239]) )
            {
              if ( HIDWORD(qword_5854A8) & dword_931B94[2 * v239] | qword_5854A8 & dword_931B90[2 * v239] )
              {
                v238 -= 131076;
                v355 = v238;
                if ( v241 & (v380 | HIDWORD(qword_585460[0]) & HIDWORD(v389)) | v242 & (v379 | qword_585460[0] & v389) )
                {
                  v238 -= 393224;
                  v355 = v238;
                }
              }
            }
          }
          if ( (byte_585380[byte_439B78[v239]] & 7) == 1 )
          {
            v238 += dword_500050;
            v355 = v238;
            if ( (byte_585380[byte_439BB8[v239]] & 7) == 1 )
            {
              v238 += dword_500050;
              v355 = v238;
            }
          }
          v237 = v366;
          if ( *v366 == -1 )
            break;
          v62 = HIDWORD(qword_5854E0);
        }
        v203 = HIDWORD(qword_5854B0);
        v204 = qword_5854B0;
        v236 = HIDWORD(qword_585470);
      }
      v266 = qword_585470;
      v267 = &byte_58542C;
      if ( byte_58542C != -1 )
      {
        do
        {
          v268 = *v267;
          v269 = dword_8F2178[2 * v268];
          v270 = dword_8F217C[2 * v268];
          v367 = (v267 + 1);
          v271 = dword_5854F0;
          *(v271 + 40) |= v269;
          *(v271 + 44) |= v270;
          if ( v270 & HIDWORD(qword_585478) | v269 & qword_585478 )
          {
            v272 = dword_5854F0;
            *(v272 + 200) |= LODWORD(qword_828A78[v268]);
            *(v272 + 204) |= HIDWORD(qword_828A78[v268]);
          }
          if ( v270 & v380 | v269 & v379 )
            v381 += 65551;
          if ( v270 & HIDWORD(v378) | v269 & v378 )
            v355 -= 524292;
          v273 = v383 & dword_8F2CD8[2 * (v268 >> 3)];
          v274 = (v269 & v273) - (((v269 & v273) >> 1) & 0x55555555);
          v355 += -786448
                * (286331153
                 * ((v274 & 0x33333333)
                  + (((v270 & HIDWORD(v383) & dword_8F2CDC[2 * (v268 >> 3)])
                    - (((v270 & HIDWORD(v383) & dword_8F2CDC[2 * (v268 >> 3)]) >> 1) & 0x55555555)) & 0x33333333)
                  + ((v274 >> 2) & 0x33333333)
                  + ((((v270 & HIDWORD(v383) & dword_8F2CDC[2 * (v268 >> 3)])
                     - (((v270 & HIDWORD(v383) & dword_8F2CDC[2 * (v268 >> 3)]) >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 28);
          if ( v270 & HIDWORD(v408) | v269 & v408 )
            v355 -= 393224;
          if ( v270 & HIDWORD(v389) & (HIDWORD(qword_585480) | HIDWORD(qword_585488)) | v269 & v389 & (qword_585480 | qword_585488) )
            v355 -= 655370;
          v275 = v270 & (HIDWORD(qword_585498) | HIDWORD(qword_585490));
          if ( v275 | v269 & (qword_585498 | qword_585490) )
          {
            v355 -= 917524;
            ++v356;
            if ( v275 & (__CFADD__(v269 & (qword_585498 | qword_585490), -1) + v275 - 1) | v269 & (qword_585498 | qword_585490) & ((v269 & (qword_585498 | qword_585490)) - 1) )
              ++v356;
          }
          if ( HIDWORD(qword_585468) & HIDWORD(qword_931990[v268]) | qword_585468 & qword_931990[v268] )
          {
            v355 += 655374;
            ++v357;
          }
          if ( HIDWORD(qword_828A78[v268]) & 0x7E | qword_828A78[v268] & 0x7E7E0000 )
          {
            if ( !(HIDWORD(qword_585468) & dword_8F267C[2 * v268] | qword_585468 & dword_8F2678[2 * v268]) )
            {
              v355 -= 262150;
              if ( HIDWORD(qword_5854A8) & dword_931B94[2 * v268] | qword_5854A8 & dword_931B90[2 * v268] )
              {
                v355 -= 262150;
                if ( v270 & (v380 | HIDWORD(qword_585460[0]) & HIDWORD(v389)) | v269 & (v379 | qword_585460[0] & v389) )
                {
                  v355 -= 655370;
                  if ( v268 >> 3 == 3 )
                    v355 -= 262148;
                  v276 = v268 & 7;
                  if ( v276 == 3 || v276 == 4 )
                    v355 -= 393222;
                }
              }
            }
          }
          v267 = v367;
        }
        while ( *v367 != -1 );
        v203 = HIDWORD(qword_5854B0);
        v204 = qword_5854B0;
        v236 = HIDWORD(qword_585470);
        v266 = qword_585470;
      }
      if ( !byte_5854EA )
      {
        result = *(dword_5854F0 + 204) | *(dword_5854F0 + 200);
        if ( *(dword_5854F0 + 200) )
          return result;
      }
      v277 = *(dword_5854F0 + 40);
      v397 = v277;
      v400 = *(dword_5854F0 + 44);
      v278 = ~v277;
      v392 = v278;
      if ( __PAIR__(v380 & HIDWORD(qword_5854A8) & ~v400, v379 & qword_5854A8 & v278) )
        v355 += 10;
      v403 = *(dword_5854F0 + 32);
      if ( v378 & qword_585468 & ~v403 )
        v355 -= 10;
      v279 = *(v386 + 16) + (dword_439C78[v381 >> 16] * v381 >> 3);
      if ( !qword_5854D8 )
      {
        v280 = (qword_5854D0 | qword_5854C0 | qword_5854C8 | v204)
             - (((qword_5854D0 | qword_5854C0 | qword_5854C8 | v204) >> 1) & 0x55555555);
        v281 = (HIDWORD(qword_5854D0) | HIDWORD(qword_5854C0) | HIDWORD(qword_5854C8) | v203)
             - (((HIDWORD(qword_5854D0) | HIDWORD(qword_5854C0) | HIDWORD(qword_5854C8) | v203) >> 1) & 0x55555555);
        v282 = (v279
              * (286331153
               * ((v280 & 0x33333333) + (v281 & 0x33333333) + ((v280 >> 2) & 0x33333333) + ((v281 >> 2) & 0x33333333)) >> 28));
        v279 = (v282 + (BYTE4(v282) & 7)) >> 3;
      }
      v283 = -131072 * v279 + v355;
      v284 = *(v386 + 20) + (dword_439C78[v370 >> 16] * v370 >> 3);
      if ( !qword_585498 )
      {
        v285 = qword_585490 | qword_585480 | qword_585488 | v266;
        v286 = (v284
              * (286331153
               * (((v285 - ((v285 >> 1) & 0x55555555)) & 0x33333333)
                + (((HIDWORD(qword_585490) | HIDWORD(qword_585480) | HIDWORD(qword_585488) | v236)
                  - (((HIDWORD(qword_585490) | HIDWORD(qword_585480) | HIDWORD(qword_585488) | v236) >> 1) & 0x55555555)) & 0x33333333)
                + (((v285 - ((v285 >> 1) & 0x55555555)) >> 2) & 0x33333333)
                + ((((HIDWORD(qword_585490) | HIDWORD(qword_585480) | HIDWORD(qword_585488) | v236)
                   - (((HIDWORD(qword_585490) | HIDWORD(qword_585480) | HIDWORD(qword_585488) | v236) >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 28));
        v284 = (v286 + (BYTE4(v286) & 7)) >> 3;
      }
      v287 = (v284 << 17) + v283;
      if ( v357 >= 2u )
        v287 += 1966130;
      if ( v356 >= 2u )
        v287 -= 1966130;
      _EAX = qword_585490 & dword_439738[2 * byte_5854E8];
      _ECX = HIDWORD(qword_585490) & dword_43973C[2 * byte_5854E8];
      if ( _ECX | qword_585490 & dword_439738[2 * byte_5854E8] )
      {
        __asm { bsf     eax, eax }
        if ( _ZF )
        {
          __asm { bsf     eax, ecx }
          v291 = _EAX + 32;
        }
        else
        {
          v291 = _EAX;
        }
        _EAX = qword_585468 & dword_828678[2 * v291];
        _ECX = HIDWORD(qword_585468) & dword_82867C[2 * v291];
        if ( _ECX | _EAX )
        {
          __asm { bsf     eax, eax }
          if ( _ZF )
          {
            __asm { bsf     eax, ecx }
            _EAX = _EAX + 32;
          }
          v287 += 1310720 * ((_EAX >> 3) - 6);
        }
      }
      _EDX = qword_5854D0 & dword_439738[2 * byte_5854E9];
      _ECX = HIDWORD(qword_5854D0) & dword_43973C[2 * byte_5854E9];
      if ( __PAIR__(_ECX, qword_5854D0 & dword_439738[2 * byte_5854E9]) )
      {
        __asm { bsr     ecx, ecx }
        if ( _ZF )
          __asm { bsr     ecx, edx }
        else
          _ECX = _ECX + 32;
        _EDX = qword_5854A8 & dword_828878[2 * _ECX];
        v302 = HIDWORD(qword_5854A8);
        _ECX = HIDWORD(qword_5854A8) & dword_82887C[2 * _ECX];
        if ( __PAIR__(_ECX, _EDX) )
        {
          __asm { bsr     ecx, ecx }
          if ( _ZF )
          {
            __asm { bsr     edx, edx }
            v305 = _EDX;
          }
          else
          {
            v305 = _ECX + 32;
          }
          v287 = 1310720 * (v305 >> 3) + v287 - 1310720;
        }
      }
      else
      {
        v302 = HIDWORD(qword_5854A8);
      }
      v307 = byte_5854E9 & 7;
      v308 = dword_439CDC[2 * v307];
      v309 = dword_439CD8[2 * v307];
      LODWORD(v384) = dword_439CD8[2 * v307];
      HIDWORD(v384) = v308;
      if ( v308 & (HIDWORD(qword_585498) | HIDWORD(qword_585490)) | v309 & (qword_585498 | qword_585490) )
      {
        v287 += 10;
        if ( !(v308 & (HIDWORD(qword_585468) | v302) | v309 & (qword_585468 | qword_5854A8)) )
          v287 += 655390;
      }
      v310 = byte_5854E8 & 7;
      v311 = dword_439CDC[2 * (byte_5854E8 & 7)];
      v312 = dword_439CD8[2 * v310];
      LODWORD(v409) = dword_439CD8[2 * v310];
      HIDWORD(v409) = v311;
      if ( v311 & (HIDWORD(qword_5854D8) | HIDWORD(qword_5854D0)) | v312 & (qword_5854D8 | qword_5854D0) )
      {
        v287 -= 10;
        if ( !(v311 & (HIDWORD(qword_585468) | v302) | v312 & (qword_585468 | qword_5854A8)) )
          v287 -= 655390;
      }
      v313 = v386;
      v375 = *(v386 + 12);
      if ( *(v386 + 12) )
      {
        do
        {
          _EDX = v375;
          __asm { bsf     eax, edx }
          if ( _ZF )
          {
            __asm { bsf     eax, dword ptr [esp+0A4h+var_78+4] }
            _EAX = _EAX + 32;
          }
          v317 = dword_4396F8[2 * _EAX];
          _EAX = HIDWORD(qword_585468) & dword_4396FC[2 * _EAX];
          _ECX = qword_585468 & v317;
          __asm { bsr     eax, eax }
          if ( _ZF )
          {
            __asm { bsr     ecx, ecx }
            v321 = _ECX;
          }
          else
          {
            v321 = _EAX + 32;
          }
          v323 = ((v375 - 1) >> 32) - 1;
          LODWORD(v375) = (v375 - 1) & v375;
          v324 = v321 >> 3;
          HIDWORD(v375) &= v323;
          if ( v321 >> 3 > 2 )
          {
            if ( *(dword_5854F0 + 223) & 8 )
            {
              if ( HIDWORD(qword_585490) & dword_82867C[2 * v321] | qword_585490 & dword_828678[2 * v321] )
              {
                if ( v324 == 6 )
                {
                  v287 -= 13107400;
                }
                else
                {
                  if ( v324 == 5 )
                    v287 -= 3276850;
                }
              }
              if ( HIDWORD(qword_585478) & dword_82867C[2 * v321] | qword_585478 & dword_828678[2 * v321]
                && qword_5854D0 & v409 )
                v287 += 2 * (-1 << (v324 - 1));
            }
            if ( !*(&dword_585388 + v321) )
              v287 += dword_439C38[v324];
            v325 = dword_828678[2 * v321];
            v326 = dword_82867C[2 * v321];
            if ( !(v326 & HIDWORD(qword_585460[0]) | v325 & qword_585460[0]) )
              v287 += dword_439BF8[v324];
            if ( !(v326 & HIDWORD(qword_5854A0) | v325 & qword_5854A0) )
              v287 += dword_439C18[v324];
            if ( !(v326 & v400 & (~v403 >> 32) | v325 & v397 & ~v403) )
              v287 += dword_439C58[v324];
            if ( *(dword_5854F0 + 223) & 4 )
            {
              if ( v324 == 6 && HIDWORD(qword_585498) & v326 | qword_585498 & v325 )
                v287 -= 1310740;
              v287 += dword_439CB8[v324];
            }
          }
        }
        while ( v375 );
        v313 = v386;
      }
      v376 = *(v313 + 13);
      if ( *(v313 + 13) )
      {
        do
        {
          _EDX = v376;
          __asm { bsf     ecx, edx }
          if ( _ZF )
          {
            __asm { bsf     eax, dword ptr [esp+0A4h+var_78+4] }
            _ECX = _EAX + 32;
          }
          _EAX = qword_5854A8 & dword_4396F8[2 * _ECX];
          _ECX = HIDWORD(qword_5854A8) & dword_4396FC[2 * _ECX];
          __asm { bsf     eax, eax }
          if ( _ZF )
          {
            __asm { bsf     ecx, ecx }
            _EAX = _ECX + 32;
          }
          v334 = ((v376 - 1) >> 32) - 1;
          LODWORD(v376) = (v376 - 1) & v376;
          v335 = _EAX >> 3;
          HIDWORD(v376) &= v334;
          if ( _EAX >> 3 < 5 )
          {
            if ( *(dword_5854F0 + 223) & 8 )
            {
              if ( HIDWORD(qword_5854D0) & dword_82887C[2 * _EAX] | qword_5854D0 & dword_828878[2 * _EAX] )
              {
                if ( v335 == 1 )
                {
                  v287 += 13107400;
                }
                else
                {
                  if ( v335 == 2 )
                    v287 += 3276850;
                }
              }
              if ( HIDWORD(qword_5854B8) & dword_82887C[2 * _EAX] | qword_5854B8 & dword_828878[2 * _EAX]
                && qword_585490 & v384 )
                v287 += 2 * (1 << (6 - v335));
            }
            if ( !byte_585378[_EAX] )
              v287 -= dword_439C54[-v335];
            v336 = dword_828878[2 * _EAX];
            v337 = dword_82887C[2 * _EAX];
            if ( !(HIDWORD(qword_5854A0) & dword_82887C[2 * _EAX] | qword_5854A0 & dword_828878[2 * _EAX]) )
              v287 -= dword_439C14[-v335];
            if ( !(HIDWORD(qword_585460[0]) & v337 | qword_585460[0] & v336) )
              v287 -= dword_439C34[-v335];
            if ( !(v337 & ~v400 & HIDWORD(v403) | v336 & v392 & v403) )
              v287 -= dword_439C74[-v335];
            if ( *(dword_5854F0 + 223) & 4 )
            {
              if ( v335 == 1 && HIDWORD(qword_5854D8) & v337 | qword_5854D8 & v336 )
                v287 += 1310740;
              v287 -= dword_439CD4[-v335];
            }
          }
        }
        while ( v376 );
        v313 = v386;
      }
      v338 = v358
           * (v401 + (v287 * (32 - *(dword_5854F0 + 24)) + *(dword_5854F0 + 24) * ((v287 < 0) + SHIWORD(v287))) / 32);
      HIDWORD(v338) = BYTE4(v338) & 0x7F;
      v339 = (HIDWORD(v338) + v338) >> 7;
      if ( v339 <= 0 )
      {
        v343 = -v339;
        if ( -v339 > 200 )
          v343 = 200;
        v344 = v343 * *(v313 + 15);
        v342 = ((BYTE4(v344) & 0x3F) + v344) >> 6;
      }
      else
      {
        v340 = (HIDWORD(v338) + v338) >> 7;
        if ( v339 > 200 )
          v340 = 200;
        v341 = v340 * *(v313 + 14);
        v342 = -(((BYTE4(v341) & 0x3F) + v341) >> 6);
      }
      v49 = v386;
      v50 = v342 + v339;
      goto LABEL_496;
    }
    while ( 1 )
    {
      v206 = *v205;
      v365 = (v205 + 1);
      v207 = dword_8FBB68[v206]
           + (((qword_5854E0 & dword_829CB8[2 * v206]) * dword_438D00[2 * v206] ^ dword_438D04[2 * v206]
                                                                                * (v62 & dword_829CBC[2 * v206])) >> dword_439000[v206]);
      v208 = dword_829EF8[2 * v207];
      v209 = dword_829EFC[2 * v207];
      v210 = dword_5854F0;
      *(v210 + 40) |= v208;
      *(v210 + 44) |= v209;
      v374 = v208;
      if ( !(v373[v206] & 0xC) )
        goto LABEL_276;
      if ( v209 & HIDWORD(qword_585478) | v208 & qword_585478 )
        break;
      v62 = HIDWORD(qword_5854E0);
      v212 = dword_8FBB68[byte_5854E8]
           + (((qword_5854E0 & dword_829CB8[2 * byte_5854E8]) * dword_438D00[2 * byte_5854E8] ^ dword_438D04[2 * byte_5854E8]
                                                                                              * (HIDWORD(qword_5854E0) & dword_829CBC[2 * byte_5854E8])) >> dword_439000[byte_5854E8]);
      _ECX = v208 & dword_829EF8[2 * v212];
      _EAX = v209 & dword_829EFC[2 * v212];
      if ( _EAX | _ECX )
      {
        __asm { bsf     esi, ecx }
        if ( _ZF )
        {
          __asm { bsf     esi, eax }
          _ESI = _ESI + 32;
        }
        v355 -= dword_4399F8[byte_585380[_ESI]];
        v217 = dword_5854F0;
        *(v217 + 56) |= _ECX;
        *(v217 + 60) |= _EAX;
        __asm { bsf     ecx, ecx }
        if ( _ZF )
        {
          __asm { bsf     eax, eax }
          v219 = _EAX + 32;
        }
        else
        {
          v219 = _ECX;
        }
        *(v219 + dword_5854F0 + 128) = v206;
        goto LABEL_276;
      }
LABEL_277:
      v221 = dword_8FBB68[v206]
           + (((qword_5854E0 & dword_829CB8[2 * v206] & ~qword_5854D8 & ~qword_5854D0) * dword_438D00[2 * v206] ^ dword_438D04[2 * v206] * (v62 & dword_829CBC[2 * v206] & ~HIDWORD(qword_5854D8) & ~HIDWORD(qword_5854D0))) >> dword_439000[v206]);
      if ( v380 & dword_829EFC[2 * v221] | v379 & dword_829EF8[2 * v221] )
        v381 += 65561;
      if ( v209 & HIDWORD(v378) | v374 & v378 )
        v355 -= 393218;
      v222 = (v374 & v389 & ~qword_5854A8) - (((v374 & v389 & ~qword_5854A8) >> 1) & 0x55555555);
      v355 += -262150
            * (286331153
             * ((v222 & 0x33333333)
              + (((v209 & HIDWORD(v389) & ~HIDWORD(qword_5854A8))
                - (((v209 & (HIDWORD(v389) & ~HIDWORD(qword_5854A8))) >> 1) & 0x55555555)) & 0x33333333)
              + ((v222 >> 2) & 0x33333333)
              + ((((v209 & HIDWORD(v389) & ~HIDWORD(qword_5854A8))
                 - (((v209 & (HIDWORD(v389) & ~HIDWORD(qword_5854A8))) >> 1) & 0x55555555)) >> 2) & 0x33333333)) >> 28);
      if ( v209 & HIDWORD(v408) | v374 & v408 )
        v355 -= 262150;
      v223 = qword_585480 | qword_585488 | qword_585470;
      if ( v209 & (HIDWORD(qword_585480) | HIDWORD(qword_585488) | HIDWORD(qword_585470)) & HIDWORD(v389) | v374 & v223 & v389 )
        v355 -= 524298;
      if ( v209 & HIDWORD(qword_585498) | v374 & qword_585498 )
      {
        v355 -= 655370;
        ++v356;
      }
      if ( HIDWORD(qword_585468) & HIDWORD(qword_931990[v206]) | qword_585468 & qword_931990[v206] )
      {
        v355 += 917524;
        ++v357;
      }
      v399 = dword_82887C[2 * v206];
      v396 = dword_828878[2 * v206];
      if ( !__PAIR__(HIDWORD(qword_5854A8) & v399, qword_5854A8 & dword_828878[2 * v206]) )
      {
        v355 -= 393228;
        _EAX = qword_585468 & dword_828878[2 * v206];
        _ECX = HIDWORD(qword_585468) & v399;
        if ( HIDWORD(qword_585468) & v399 | _EAX )
        {
          __asm { bsr     ecx, ecx }
          if ( _ZF )
            __asm { bsr     ecx, eax }
          else
            _ECX = _ECX + 32;
          v226 = dword_828878[2 * v206];
          if ( !(HIDWORD(qword_585468) & dword_8F267C[2 * _ECX] | qword_585468 & dword_8F2678[2 * _ECX]) )
            v355 -= 655370;
        }
        else
        {
          v226 = dword_828878[2 * v206];
          _EAX = HIDWORD(v402) & (HIDWORD(qword_585480) | HIDWORD(qword_585488) | HIDWORD(qword_585470)) & v399;
          _ECX = v402 & v223 & v396;
          if ( _EAX | v402 & v223 & v396 )
          {
            __asm { bsr     eax, eax }
            if ( _ZF )
            {
              __asm { bsr     eax, ecx }
              v230 = _EAX;
            }
            else
            {
              v230 = _EAX + 32;
            }
            if ( HIDWORD(qword_5854A8) & dword_8F247C[2 * v230] | qword_5854A8 & dword_8F2478[2 * v230] )
              v355 -= 1966090;
            else
              v355 -= 1310720;
          }
          else
          {
            v355 -= 2621460;
          }
        }
        if ( HIDWORD(qword_585478) & v399 | qword_585478 & v226 )
          v355 -= 1966080;
      }
      if ( HIDWORD(qword_828A78[v206]) & 0x7E | qword_828A78[v206] & 0x7E7E0000 )
      {
        if ( !(HIDWORD(qword_585468) & dword_8F267C[2 * v206] | qword_585468 & dword_8F2678[2 * v206]) )
        {
          if ( HIDWORD(qword_5854A8) & dword_931B94[2 * v206] | qword_5854A8 & dword_931B90[2 * v206] )
          {
            v355 -= 131076;
            if ( v209 & dword_4396BC[2 * (v206 >> 3)] & (v380 | HIDWORD(qword_585460[0]) & HIDWORD(v389)) | v374 & dword_4396B8[2 * (v206 >> 3)] & (v379 | qword_585460[0] & v389) )
              v355 -= 393224;
          }
        }
      }
      v234 = v206 >> 3;
      if ( v234 )
      {
        if ( v234 == 1 )
        {
          if ( qword_585468 | qword_585478 )
          {
            v355 -= 1310780;
            if ( qword_585478 )
            {
              if ( v374 & (qword_5854D8 | qword_5854D0) & 0xFF00 )
                v355 -= 1310760;
            }
          }
        }
        else
        {
          if ( v234 == 2 )
          {
            v235 = qword_585468 | qword_585478;
            if ( v235 & 0xFFFFFF )
              v355 -= 655390;
          }
        }
      }
      else
      {
        if ( qword_585478 )
          v355 -= 655380;
      }
      v205 = v365;
      if ( *v365 == -1 )
      {
        v203 = HIDWORD(qword_5854B0);
        v204 = qword_5854B0;
        goto LABEL_324;
      }
    }
    v211 = dword_5854F0;
    *(v211 + 200) |= LODWORD(qword_828A78[v206]);
    *(v211 + 204) |= HIDWORD(qword_828A78[v206]);
LABEL_276:
    v62 = HIDWORD(qword_5854E0);
    goto LABEL_277;
  }
  return result;
}

RobboLito's evaluation (value.c):

Code: Select all

void valuation (int minimum, int maximum, int move)
{
	int ch;
	type_pawn_value *PAWN_VALUE;
	int index, Material_value, value;
	int b, tr, anti_phase, phase;
	int ai, capture, king_white_qu, king_black_qu;
	uint64 U, attak_king_white, attak_king_black, A, AA, AT;
	sint32 colpo_king_white, colpo_king_black;
	uint64 white_buono_minor, black_buono_minor, white_mobility_save,
		black_mobility_save, white_ok_xray, black_ok_xray;
	uint64 T, attak_pawn_black, attak_pawn_white;
	int opening, endgame;
	uint8 attak_buono_black, attak_buono_white;
	uint8 SIGN;
	int v, positional;

	PAWN_VALUE =
		pawn_zobrist + (DYNAMIC->ZobristPawn & (list_pawn_number - 1));
	PREFETCH_PAWN_ZOBRIST;
	index = (DYNAMIC->material_ >> 8) & 0x7ffff;
	SIGN = MATERIAL[index].sign;
	DYNAMIC->flags = MATERIAL[index].flags;
	if (!(DYNAMIC->material_ & 0x80000000))
		Material_value = MATERIAL[index].value;
	else
	{
		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_dark) > 1
			|| POPCNT (bitboard_black_dark) > 1
			|| POPCNT (bitboard_white_knight) > 2
			|| POPCNT (bitboard_black_knight) > 2)
		{
			SIGN = 0x80;
			Material_value = value_material ();
			DYNAMIC->flags = 0;
			if (bitboard_white_queen | bitboard_white_rook |
				bitboard_white_bishop | bitboard_white_knight)
				DYNAMIC->flags |= 2;
			if (bitboard_black_queen | bitboard_black_rook |
				bitboard_black_bishop | bitboard_black_knight)
				DYNAMIC->flags |= 1;
		}
		else
		{
			Material_value = MATERIAL[index].value;
			DYNAMIC->material_ &= 0x7fffffff;
		}
	}

	if (((DYNAMIC->Zobrist ^
		value_zobrist[DYNAMIC->Zobrist & value_zobrist_hide]) & 0xffffffffffff0000) == 0)
	{
		value = (int) ((sint16)(value_zobrist[DYNAMIC->Zobrist & value_zobrist_hide] & 0xffff));
		DYNAMIC->lazy = 0;
		mobility ();
		DYNAMIC->value_positional = ((POSITION.white_en_move) ? value : -value) - Material_value;
		DYNAMIC->value = value;
		if (move && !(DYNAMIC - 1)->lazy)
			POSITION.white_en_move ? trick_white (move) :
			trick_black (move);
		return;
	}

	if ((DYNAMIC->material_ & 0xff) == 0)
		return POSITION.white_en_move ? king_pawn_white (Material_value, SIGN, PAWN_VALUE) : king_pawn_black (Material_value, SIGN, PAWN_VALUE);

#define white_minor_flag (8<<2)
#define black_minor_flag (16<<2)

	if ((DYNAMIC->flags & white_minor_flag || DYNAMIC->flags & black_minor_flag) && PAWN_VALUE->ZobristPawn != DYNAMIC->ZobristPawn)
		valuation_pawn (PAWN_VALUE);

	if ((DYNAMIC->flags & white_minor_flag
		&& PAWN_VALUE->white_pawn_line_count <= 1)
		|| (DYNAMIC->flags & black_minor_flag
		&& PAWN_VALUE->black_pawn_line_count <= 1)
		|| (DYNAMIC->flags & 128));
	else
	{
		if (POSITION.white_en_move)
		{
			positional = (DYNAMIC - 1)->value_positional;
			capture = DYNAMIC->capture;
			ai = AI (move);
			value = static_value[QU[ai]][ai] - static_value[QU[ai]][DI (move)];
			if (capture)
				value -= static_value[capture][ai];
			phase = DYNAMIC->material_ & 0xff;
			endgame = (sint16) (value & 0xffff);
			opening = (endgame < 0) + (sint16) ((value >> 16) & 0xffff);
			anti_phase = 32 - phase;
			value = (endgame * anti_phase + opening * phase) / 32;
			positional += value;
			v = positional + Material_value;
			if (v < -maximum - 16 * (int) (DYNAMIC - 1)->lazy
				|| v > -minimum + 16 * (int) (DYNAMIC - 1)->lazy)
			{
				DYNAMIC->lazy = (DYNAMIC - 1)->lazy + 1;
				DYNAMIC->value = v;
				DYNAMIC->value_positional = positional;
				mobility ();
				return;
			}
		}
		else
		{
			positional = (DYNAMIC - 1)->value_positional;
			capture = DYNAMIC->capture;
			ai = AI (move);
			value = static_value[QU[ai]][ai] - static_value[QU[ai]][DI (move)];
			if (capture)
				value -= static_value[capture][ai];
			phase = DYNAMIC->material_ & 0xff;
			endgame = (sint16) (value & 0xffff);
			opening = (endgame < 0) + (sint16) ((value >> 16) & 0xffff);
			anti_phase = 32 - phase;
			value = (endgame * anti_phase + opening * phase) / 32;
			positional += value;
			v = positional + Material_value;
			if (v < minimum - 16 * (int) (DYNAMIC - 1)->lazy
				|| v > maximum + 16 * (int) (DYNAMIC - 1)->lazy)
			{
				DYNAMIC->lazy = (DYNAMIC - 1)->lazy + 1;
				DYNAMIC->value = -v;
				DYNAMIC->value_positional = positional;
				mobility ();
				return;
			}
		}
	}

	king_white_qu = POSITION.white_king_square;
	king_black_qu = POSITION.black_king_square;
	attak_king_white = attack_king[king_white_qu];
	attak_king_black = attack_king[king_black_qu];
	attak_buono_black = attak_buono_white = 0;
	if (PAWN_VALUE->ZobristPawn != DYNAMIC->ZobristPawn)
		valuation_pawn (PAWN_VALUE);
	value = (DYNAMIC->statik) + (PAWN_VALUE->points);

	DYNAMIC->white_xray = 0;

	A = (bitboard_white_pawn & (~FILEa)) << 7;
	T = A & bitboard_black_king;
	DYNAMIC->black_king_check = (T >> 7);
	attak_pawn_white = A;
	A = (bitboard_white_pawn & (~FILEh)) << 9;
	T = A & bitboard_black_king;
	DYNAMIC->black_king_check |= (T >> 9);
	attak_pawn_white |= A;
	DYNAMIC->attak_white = attak_pawn_white;
	A = (bitboard_black_pawn & (~FILEh)) >> 7;
	T = A & bitboard_white_king;
	DYNAMIC->white_king_check = (T << 7);
	attak_pawn_black = A;
	A = (bitboard_black_pawn & (~FILEa)) >> 9;
	T = A & bitboard_white_king;
	DYNAMIC->white_king_check |= (T << 9);
	attak_pawn_black |= A;
	DYNAMIC->attak_black = attak_pawn_black;

	black_ok_xray = (~bitboard_black_pawn) & ~attak_pawn_white;
	white_ok_xray = (~bitboard_white_pawn) & ~attak_pawn_black;
	white_buono_minor =
		(bitboard_white_knight | bitboard_white_bishop) &
		attak_pawn_white;
	black_buono_minor =
		(bitboard_black_knight | bitboard_black_bishop) & attak_pawn_black;

	if (attak_pawn_white & attak_king_black)
		colpo_king_black = BLOW_pawn;
	else
		colpo_king_black = 0;
	U = (POSITION.occupied_black_white >> 8) & bitboard_white_pawn;
	while (U)
	{
		b = BSF (U);
		value -= pawn_mobility_non;
		bit_FREE (b, U);
	}
	white_mobility_save = ~(attak_pawn_black | bitboard_occupied_white);

	U = bitboard_white_queen;
	while (U)
	{
		b = BSF (U);
		bit_FREE (b, U);
		AA = attack_bishop (b);
		AT = attack_rook (b);
		if (bitboard_black_king & diagonal[b])
		{
			T = attack_bishop (king_black_qu) & AA;
			if (T)
			{
				value += white_queen_diag_xray[QU[BSF (T)]];
				DYNAMIC->white_xray |= T;
				xray_white_list[BSF (T)] = b;
			}
		}
		else if (bitboard_black_king & perpendicular[b])
		{
			T = attack_rook (king_black_qu) & AT;
			if (T)
			{
				value += white_queen_orto_xray[QU[BSF (T)]];
				DYNAMIC->white_xray |= T;
				xray_white_list[BSF (T)] = b;
			}
		}
		A = AA | AT;
		T = A & white_mobility_save;
		DYNAMIC->attak_white |= A;
		if (A & attak_king_black)
			colpo_king_black += BLOW_queen;
		if (A & bitboard_black_king)
			DYNAMIC->black_king_check |= square_fixed[b];
		if (A & attak_king_white)
		{
			value += queen_look;
		}
		value += mobility_queen (T);
		if (A & (~attak_pawn_black) & bitboard_occupied_black)
		{
			value += queen_attak;
		}
		if (bitboard_black_pawn & attack_pawn_black[b])
		{
			value -= pawn_attak_queen;
			attak_buono_black += 1;
		}
		if (RANK (b) == T7)
		{
			if ((bitboard_black_pawn | bitboard_black_king) & RANKS78)
			{
				value += queen_seventh;
				if (bitboard_white_rook & RANK7 & AT
					&& bitboard_black_king & RANK8)
				{
					value += queen_seventh_doppia;
				}
			}
		}
	}

	U = bitboard_white_rook;
	while (U)
	{
		b = BSF (U);
		bit_FREE (b, U);
		A = attack_rook (b);
		DYNAMIC->attak_white |= A;
		if (bitboard_black_king & perpendicular[b])
		{
			T = attack_rook (king_black_qu) & A;
			if (T)
			{
				value += white_rook_xray[QU[BSF (T)]];
				DYNAMIC->white_xray |= T;
				xray_white_list[BSF (T)] = b;
			}
		}
		if (A & attak_king_black)
			colpo_king_black += BLOW_rook;
		if (A & bitboard_black_king)
			DYNAMIC->black_king_check |= square_fixed[b];
		if (A & attak_king_white)
		{
			value += rook_look;
		}
		value += mobility_rook (A & white_ok_xray);

		if (A & (~attak_pawn_black) & bitboard_black_pawn)
		{
			value += rook_attak_pawn;
		}
		if (A &
			((bitboard_black_knight | bitboard_black_bishop) &
			~attak_pawn_black))
		{
			value += rook_attak_minor;
		}
		if (A & bitboard_black_queen)
		{
			value += rook_attak_queen;
			attak_buono_white += 1;
		}
		if (bitboard_black_pawn & attack_pawn_black[b])
		{
			value -= pawn_attak_rook;
			attak_buono_black += 1;
		}

		if ((bitboard_white_pawn & file_open_white[b]) == 0)
		{
			value += rook_open_half;
			if ((bitboard_black_pawn & file_open_white[b]) == 0)
			{
				T = black_buono_minor & file_open_white[b];
				if (!T)
				{
					value += rook_open;
				}
				else
				{
					int t = BSF (T);
					if ((file_isolated[FILE (t)] &
						infront_black[RANK (t)] & bitboard_white_pawn)
						== 0)
					{
						value += rook_open_minor_fixed;
					}
					else
					{
						value += rook_open_minor;
					}
				}
			}
			else
			{
				T = file_open_white[b] & bitboard_black_pawn;
				if (T)
				{
					int t = BSF (T);
					if ((file_isolated[FILE (t)] &
						infront_white[RANK (t)] & bitboard_black_pawn)
						== 0)
					{
						value += rook_half_pawn;
					}
				}
			}
			if (bitboard_black_king & file_open_white[b])
			{
				value += rook_half_king;
			}
		}

		if (square_fixed[b] & outpost_white
			&& (file_isolated[FILE (b)] & infront_white[RANK (b)] &
			bitboard_black_pawn) == 0)
		{
			if (bitboard_white_pawn & attack_pawn_white[b])
			{
				value += outpost_rook;
				if (A &
					(attak_king_black |
					(bitboard_occupied_black & ~attak_pawn_black)) &
					pile_rank[RANK (b)])
					value += outpost_rook_look;
			}
		}

		if (RANK (b) == T8)
		{
			if (bitboard_black_king & RANK8)
			{
				value += rook_eighth_king;
			}
		}
		if (RANK (b) == T7)
		{
			if ((bitboard_black_pawn | bitboard_black_king) & RANKS78)
			{
				value += rook_seventh_king_pawn;
				if (bitboard_black_king & RANK8
					&& (bitboard_white_queen | bitboard_white_rook) &
					RANK7 & A)
				{
					value += rook_seventh_king_pawn_doppia;
				}
			}
		}
		if (RANK (b) == T6
			&& (bitboard_black_pawn | bitboard_black_king) & RANKS678)
		{
			value += rook_sixth_king_pawn;
		}
	}

	white_mobility_save |= bitboard_occupied_black ^ bitboard_black_pawn;

	U = bitboard_white_bishop;
	while (U)
	{
		b = BSF (U);
		bit_FREE (b, U);
		A = attack_bishop (b);
		DYNAMIC->attak_white |= A;
		if (bitboard_black_king & diagonal[b])
		{
			T = attack_bishop (king_black_qu) & A;
			if (T)
			{
				value += white_bishop_xray[QU[BSF (T)]];
				DYNAMIC->white_xray |= T;
				xray_white_list[BSF (T)] = b;
			}
		}
		if (A & attak_king_black)
			colpo_king_black += BLOW_bishop;
		if (A & bitboard_black_king)
			DYNAMIC->black_king_check |= square_fixed[b];
		if (A & attak_king_white)
		{
			value += bishop_look;
		}
		value +=
			mobility_bishop (A & white_mobility_save,
			infront_white[RANK (b)]);

		if (A & (~attak_pawn_black) & bitboard_black_pawn)
		{
			value += bishop_attak_pawn;
		}
		if (A & (~attak_pawn_black) & bitboard_black_knight)
		{
			value += bishop_attak_knight;
		}
		if (A & (bitboard_black_rook | bitboard_black_queen))
		{
			value += bishop_attak_queen_rook;
			attak_buono_white += 1;
		}
		if (bitboard_black_pawn & attack_pawn_black[b])
		{
			value -= pawn_attak_bishop;
			attak_buono_black += 1;
		}

		if (square_fixed[b] & CLEAR)
		{
			value -=
				(PAWN_VALUE->white_pawn_clear +
				PAWN_VALUE->black_pawn_clear / 2) * points (1, 1);
			value +=
				POPCNT (bitboard_black_pawn & CLEAR &
				infront_black[RANK (b)] & ~attak_pawn_black) *
				points (0, 2);
		}
		else
		{
			value -=
				(PAWN_VALUE->white_pawn_dark +
				PAWN_VALUE->black_pawn_dark / 2) * points (1, 1);
			value +=
				POPCNT (bitboard_black_pawn & DARK &
				infront_black[RANK (b)] & ~attak_pawn_black) *
				points (0, 2);
		}

		if (square_fixed[b] & outpost_white
			&& (file_isolated[FILE (b)] & infront_white[RANK (b)] &
			bitboard_black_pawn) == 0)
		{
			if (bitboard_white_pawn & attack_pawn_white[b])
			{
				value += outpost_bishop;
				if (A &
					(attak_king_black |
					(bitboard_occupied_black & ~attak_pawn_black)))
					value += outpost_bishop_look;
			}
		}
		if (QU[bishop_trap_square[b]] == count_pawn_black)
		{
			value -= bishop_trap_value;
			if (QU[buono_trap_bishop_square[b]] == count_pawn_black)
			{
				value -= bishop_trap_look_value;
			}
		}
	}

	U = bitboard_white_knight;
	while (U)
	{
		b = BSF (U);
		bit_FREE (b, U);
		A = attack_knight[b];
		DYNAMIC->attak_white |= A;
		if (A & (attak_king_black | bitboard_black_king))
			colpo_king_black += BLOW_knight;
		if (A & bitboard_black_king)
			DYNAMIC->black_king_check |= square_fixed[b];
		if (A & (attak_king_white | bitboard_white_king))
		{
			value += knight_look;
		}
		value +=
			mobility_knight (A & white_mobility_save,
			infront_white[RANK (b)]);

		if (A & (~attak_pawn_black) & bitboard_black_pawn)
		{
			value += knight_attak_pawn;
		}
		if (A & (~attak_pawn_black) & bitboard_black_bishop)
		{
			value += knight_attak_bishop;
		}
		if (A & (bitboard_black_rook | bitboard_black_queen))
		{
			value += knight_attak_queen_rook;
			attak_buono_white += 1;
		}
		if (bitboard_black_pawn & attack_pawn_black[b])
		{
			value -= pawn_attak_knight;
			attak_buono_black += 1;
		}

		if (square_fixed[b] & outpost_white
			&& (file_isolated[FILE (b)] & infront_white[RANK (b)] &
			bitboard_black_pawn) == 0)
		{
			value += outpost_knight;
			if (bitboard_white_pawn & attack_pawn_white[b])
			{
				value += outpost_knight_pawn;
				if (A &
					(attak_king_black |
					(bitboard_occupied_black & ~attak_pawn_black)))
				{
					value += outpost_knight_look;
					if (RANK (b) == T5)
						value += outpost_knight_quinto;
					if (FILE (b) == CD || FILE (b) == CE)
						value += outpost_knight_DE;
				}
			}
		}
	}

	if (attak_pawn_black & attak_king_white)
		colpo_king_white = BLOW_pawn;
	else
		colpo_king_white = 0;
	U = (POSITION.occupied_black_white << 8) & bitboard_black_pawn;
	DYNAMIC->black_xray = 0;
	while (U)
	{
		b = BSF (U);
		value += pawn_mobility_non;
		bit_FREE (b, U);
	}
	black_mobility_save = ~(attak_pawn_white | bitboard_occupied_black);

	U = bitboard_black_queen;
	while (U)
	{
		b = BSF (U);
		bit_FREE (b, U);
		AA = attack_bishop (b);
		AT = attack_rook (b);
		if (bitboard_white_king & diagonal[b])
		{
			T = attack_bishop (king_white_qu) & AA;
			if (T)
			{
				value -= black_queen_diag_xray[QU[BSF (T)]];
				DYNAMIC->black_xray |= T;
				xray_black_list[BSF (T)] = b;
			}
		}
		else if (bitboard_white_king & perpendicular[b])
		{
			T = attack_rook (king_white_qu) & AT;
			if (T)
			{
				value -= black_queen_orto_xray[QU[BSF (T)]];
				DYNAMIC->black_xray |= T;
				xray_black_list[BSF (T)] = b;
			}
		}
		A = AA | AT;
		T = A & black_mobility_save;
		DYNAMIC->attak_black |= A;
		if (A & attak_king_white)
			colpo_king_white += BLOW_queen;
		if (A & bitboard_white_king)
			DYNAMIC->white_king_check |= square_fixed[b];
		if (A & attak_king_black)
		{
			value -= queen_look;
		}
		value -= mobility_queen (T);

		if (A & (~attak_pawn_white) & bitboard_occupied_white)
		{
			value -= queen_attak;
		}
		if (bitboard_white_pawn & attack_pawn_white[b])
		{
			value += pawn_attak_queen;
			attak_buono_white += 1;
		}

		if (RANK (b) == T2)
		{
			if ((bitboard_white_pawn | bitboard_white_king) & RANKS12)
			{
				value -= queen_seventh;
				if (bitboard_black_rook & RANK2 & AT
					&& bitboard_white_king & RANK1)
				{
					value -= queen_seventh_doppia;
				}
			}
		}
	}

	U = bitboard_black_rook;
	while (U)
	{
		b = BSF (U);
		bit_FREE (b, U);
		A = attack_rook (b);
		DYNAMIC->attak_black |= A;
		if (bitboard_white_king & perpendicular[b])
		{
			T = A & attack_rook (king_white_qu);
			if (T)
			{
				value -= black_rook_xray[QU[BSF (T)]];
				DYNAMIC->black_xray |= T;
				xray_black_list[BSF (T)] = b;
			}
		}
		if (A & attak_king_white)
			colpo_king_white += BLOW_rook;
		if (A & bitboard_white_king)
			DYNAMIC->white_king_check |= square_fixed[b];
		if (A & attak_king_black)
		{
			value -= rook_look;
		}
		value -= mobility_rook (A & black_ok_xray);

		if (A & (~attak_pawn_white) & bitboard_white_pawn)
		{
			value -= rook_attak_pawn;
		}
		if (A & (bitboard_white_knight | bitboard_white_bishop) &
			~attak_pawn_white)
		{
			value -= rook_attak_minor;
		}
		if (A & bitboard_white_queen)
		{
			value -= rook_attak_queen;
			attak_buono_black += 1;
		}
		if (bitboard_white_pawn & attack_pawn_white[b])
		{
			value += pawn_attak_rook;
			attak_buono_white += 1;
		}

		if ((bitboard_black_pawn & file_open_black[b]) == 0)
		{
			value -= rook_open_half;
			if ((bitboard_white_pawn & file_open_black[b]) == 0)
			{
				T = white_buono_minor & file_open_black[b];
				if (!T)
				{
					value -= rook_open;
				}
				else
				{
					int t = BSR (T);
					if ((file_isolated[FILE (t)] &
						infront_white[RANK (t)] & bitboard_black_pawn)
						== 0)
					{
						value -= rook_open_minor_fixed;
					}
					else
					{
						value -= rook_open_minor;
					}
				}
			}
			else
			{
				T = file_open_black[b] & bitboard_white_pawn;
				if (T)
				{
					int t = BSR (T);
					if ((file_isolated[FILE (t)] &
						infront_black[RANK (t)] & bitboard_white_pawn)
						== 0)
					{
						value -= rook_half_pawn;
					}
				}
			}
			if (bitboard_white_king & file_open_black[b])
			{
				value -= rook_half_king;
			}
		}

		if (square_fixed[b] & outpost_black
			&& (file_isolated[FILE (b)] & infront_black[RANK (b)] &
			bitboard_white_pawn) == 0)
		{
			if (bitboard_black_pawn & attack_pawn_black[b])
			{
				value -= outpost_rook;
				if (A &
					(attak_king_white |
					(bitboard_occupied_white & ~attak_pawn_white)) &
					pile_rank[RANK (b)])
					value -= outpost_rook_look;
			}
		}

		if (RANK (b) == T1)
		{
			if (bitboard_white_king & RANK1)
			{
				value -= rook_eighth_king;
			}
		}
		if (RANK (b) == T2)
		{
			if ((bitboard_white_pawn | bitboard_white_king) & RANKS12)
			{
				value -= rook_seventh_king_pawn;
				if (bitboard_white_king & RANK1
					&& (bitboard_black_queen | bitboard_black_rook) & RANK2 &
					A)
				{
					value -= rook_seventh_king_pawn_doppia;
				}
			}
		}
		if (RANK (b) == T3
			&& (bitboard_white_pawn | bitboard_white_king) & RANKS123)
		{
			value -= rook_sixth_king_pawn;
		}
	}

	black_mobility_save |= bitboard_occupied_white ^ bitboard_white_pawn;

	U = bitboard_black_bishop;
	while (U)
	{
		b = BSF (U);
		bit_FREE (b, U);
		A = attack_bishop (b);
		DYNAMIC->attak_black |= A;
		if (bitboard_white_king & diagonal[b])
		{
			T = A & attack_bishop (king_white_qu);
			if (T)
			{
				value -= black_bishop_xray[QU[BSF (T)]];
				DYNAMIC->black_xray |= T;
				xray_black_list[BSF (T)] = b;
			}
		}
		if (A & attak_king_white)
			colpo_king_white += BLOW_bishop;
		if (A & bitboard_white_king)
			DYNAMIC->white_king_check |= square_fixed[b];
		if (A & attak_king_black)
		{
			value -= bishop_look;
		}
		value -=
			mobility_bishop (A & black_mobility_save,
			infront_black[RANK (b)]);

		if (A & (~attak_pawn_white) & bitboard_white_pawn)
		{
			value -= bishop_attak_pawn;
		}
		if (A & (~attak_pawn_white) & bitboard_white_knight)
		{
			value -= bishop_attak_knight;
		}
		if (A & (bitboard_white_rook | bitboard_white_queen))
		{
			value -= bishop_attak_queen_rook;
			attak_buono_black += 1;
		}
		if (bitboard_white_pawn & attack_pawn_white[b])
		{
			value += pawn_attak_bishop;
			attak_buono_white += 1;
		}

		if (square_fixed[b] & CLEAR)
		{
			value +=
				(PAWN_VALUE->black_pawn_clear +
				PAWN_VALUE->white_pawn_clear / 2) * points (1, 1);
			value -=
				POPCNT (bitboard_white_pawn & CLEAR &
				infront_white[RANK (b)] & ~attak_pawn_white) *
				points (0, 2);
		}
		else
		{
			value +=
				(PAWN_VALUE->black_pawn_dark +
				PAWN_VALUE->white_pawn_dark / 2) * points (1, 1);
			value -=
				POPCNT (bitboard_white_pawn & DARK &
				infront_white[RANK (b)] & ~attak_pawn_white) *
				points (0, 2);
		}

		if (square_fixed[b] & outpost_black
			&& (file_isolated[FILE (b)] & infront_black[RANK (b)] &
			bitboard_white_pawn) == 0)
		{
			if (bitboard_black_pawn & attack_pawn_black[b])
			{
				value -= outpost_bishop;
				if (A &
					(attak_king_white |
					(bitboard_occupied_white & ~attak_pawn_white)))
					value -= outpost_bishop_look;
			}
		}

		if (QU[bishop_trap_square[b]] == count_pawn_white)
		{
			value += bishop_trap_value;
			if (QU[buono_trap_bishop_square[b]] == count_pawn_white)
			{
				value += bishop_trap_look_value;
			}
		}
	}

	U = bitboard_black_knight;
	while (U)
	{
		b = BSF (U);
		bit_FREE (b, U);
		A = attack_knight[b];
		DYNAMIC->attak_black |= A;
		if (A & (attak_king_white | bitboard_white_king))
			colpo_king_white += BLOW_knight;
		if (A & bitboard_white_king)
			DYNAMIC->white_king_check |= square_fixed[b];
		if (A & (attak_king_black | bitboard_black_king))
		{
			value -= knight_look;
		}
		value -=
			mobility_knight (A & black_mobility_save,
			infront_black[RANK (b)]);

		if (A & (~attak_pawn_white) & bitboard_white_pawn)
		{
			value -= knight_attak_pawn;
		}
		if (A & (~attak_pawn_white) & bitboard_white_bishop)
		{
			value -= knight_attak_bishop;
		}
		if (A & (bitboard_white_rook | bitboard_white_queen))
		{
			value -= knight_attak_queen_rook;
			attak_buono_black += 1;
		}
		if (bitboard_white_pawn & attack_pawn_white[b])
		{
			value += pawn_attak_knight;
			attak_buono_white += 1;
		}

		if (square_fixed[b] & outpost_black
			&& (file_isolated[FILE (b)] & infront_black[RANK (b)] &
			bitboard_white_pawn) == 0)
		{
			value -= outpost_knight;
			if (bitboard_black_pawn & attack_pawn_black[b])
			{
				value -= outpost_knight_pawn;
				if (A &
					(attak_king_white |
					(bitboard_occupied_white & ~attak_pawn_white)))
				{
					value -= outpost_knight_look;
					if (RANK (b) == T4)
						value -= outpost_knight_quinto;
					if (FILE (b) == CD || FILE (b) == CE)
						value -= outpost_knight_DE;
				}
			}
		}
	}

	DYNAMIC->attak_white |= attak_king_white;
	DYNAMIC->attak_black |= attak_king_black;
	if (attak_king_black & bitboard_white_king)
	{
		DYNAMIC->white_king_check |=
			square_fixed[POSITION.black_king_square];
		DYNAMIC->black_king_check |=
			square_fixed[POSITION.white_king_square];
	}

	if ((~DYNAMIC->attak_black) & attak_king_white & bitboard_black_pawn)
	{
		value += king_attack_nonlook_pawn;
	}

	T = trap_rook[king_white_qu] & bitboard_white_rook;
	if (T)
	{
		int t = BSF (T);
		T = file_open_white[t] & bitboard_white_pawn;
		if (T)
		{
			t = BSF (T);
			t >>= 3;
			value -= points (10 * (6 - t), 0);
		}
	}

	if (attak_king_white & attak_king_black)
		colpo_king_white += BLOW_king;
	ch = (((king_safety_multiplier[colpo_king_white >> 16] *
		(colpo_king_white & 0xffff)) / king_safety_bonus) << 16) +
		PAWN_VALUE->white_king_periglio;
	if (!bitboard_black_queen)
	{
		ch >>= 16;
		ch *=
			POPCNT (bitboard_black_rook | bitboard_black_knight |
			bitboard_black_bishop);
		ch >>= 3;
		ch <<= 16;
	}
	value -= ch;

	if ((~DYNAMIC->attak_white) & attak_king_black & bitboard_white_pawn)
	{
		value -= king_attack_nonlook_pawn;
	}

	T = trap_rook[king_black_qu] & bitboard_black_rook;
	if (T)
	{
		int t = BSR (T);
		T = file_open_black[t] & bitboard_black_pawn;
		if (T)
		{
			t = BSR (T);
			t >>= 3;
			value += points (10 * (t - 1), 0);
		}
	}

	if (attak_king_white & attak_king_black)
		colpo_king_black += BLOW_king;
	ch =
		(((king_safety_multiplier[colpo_king_black >> 16] *
		(colpo_king_black & 0xffff)) / king_safety_bonus) << 16) +
		PAWN_VALUE->black_king_periglio;
	if (!bitboard_white_queen)
	{
		ch >>= 16;
		ch *=
			POPCNT (bitboard_white_rook | bitboard_white_knight |
			bitboard_white_bishop);
		ch >>= 3;
		ch <<= 16;
	}
	value += ch;

	if (attak_buono_white >= 2)
	{
		value += attak_multiple;
	}
	if (attak_buono_black >= 2)
	{
		value -= attak_multiple;
	}

#define END_queen ( (DYNAMIC->flags & 28) == 4)
#define FINAL_rook ( (DYNAMIC->flags & 28) == 8)

	if ((bitboard_white_rook | bitboard_white_queen) &
		cramp_file[FILE (king_black_qu)])
	{
		value += points (0, 5);
		if ((cramp_file[FILE (king_black_qu)] &
			(bitboard_white_pawn | bitboard_black_pawn)) == 0)
			value += points (5, 15);
	}
	if ((bitboard_black_rook | bitboard_black_queen) &
		cramp_file[FILE (king_white_qu)])
	{
		value -= points (0, 5);
		if ((cramp_file[FILE (king_white_qu)] &
			(bitboard_black_pawn | bitboard_white_pawn)) == 0)
			value -= points (5, 15);
	}

	U = PAWN_VALUE->white_pawn_free_line;
	while (U)
	{
		b = BSR (pile_file[BSF (U)] & bitboard_white_pawn);
		bit_FREE (0, U);
		tr = RANK (b);
		if (tr <= T3)
			continue;
		if (FINAL_rook)
		{
			if (bitboard_white_rook & file_open_white[b])
			{
				if (tr == T7)
				{
					value -= endgame_rook_seventh;
				}
				else if (tr == T6)
				{
					value -= endgame_rook_sixth;
				}
			}
			if (file_open_white[b] & bitboard_white_king
				&& cramp_file[FILE (king_white_qu)] & bitboard_black_rook)
				value -= points (0, 1 << (tr - T2));
		}
		if (QU[b + 8] == 0)
		{
			value += pawn_free_mobility[tr];
		}
		if ((file_open_white[b] & bitboard_occupied_white) == 0)
		{
			value += pawn_free_my_ok[tr];
		}
		if ((file_open_white[b] & bitboard_occupied_black) == 0)
		{
			value += pawn_free_your_ok[tr];
		}
		if ((file_open_white[b] & (~DYNAMIC->attak_white) &
			DYNAMIC->attak_black) == 0)
		{
			value += pawn_free_free[tr];
		}
		if (END_queen)
		{
			if (tr == T7 && bitboard_white_queen & file_open_white[b])
			{
				value -= endgame_queen_seventh;
			}
			value += rank_endgame_queen[tr];
		}
	}

	U = PAWN_VALUE->black_pawn_free_line;
	while (U)
		while (U)
		{
			b = BSF (pile_file[BSF (U)] & bitboard_black_pawn);
			bit_FREE (0, U);
			tr = RANK (b);
			if (tr >= T6)
				continue;
			if (FINAL_rook)
			{
				if (bitboard_black_rook & file_open_black[b])
				{
					if (tr == T2)
					{
						value += endgame_rook_seventh;
					}
					else if (tr == T3)
					{
						value += endgame_rook_sixth;
					}
				}
				if (file_open_black[b] & bitboard_black_king
					&& cramp_file[FILE (king_black_qu)] &
					bitboard_white_rook)
					value += points (0, 1 << (T7 - tr));
			}
			if (QU[b - 8] == 0)
			{
				value -= pawn_free_mobility[7 - tr];
			}
			if ((file_open_black[b] & bitboard_occupied_black) == 0)
			{
				value -= pawn_free_my_ok[7 - tr];
			}
			if ((file_open_black[b] & bitboard_occupied_white) == 0)
			{
				value -= pawn_free_your_ok[7 - tr];
			}
			if ((file_open_black[b] & DYNAMIC->
				attak_white & ~DYNAMIC->attak_black) == 0)
			{
				value -= pawn_free_free[7 - tr];
			}
			if (END_queen)
			{
				if (tr == T2 && bitboard_black_queen & file_open_black[b])
				{
					value += endgame_queen_seventh;
				}
				value -= rank_endgame_queen[7 - tr];
			}
		}

		phase = DYNAMIC->material_ & 0xff;
		endgame = (sint16) (value & 0xffff);
		opening = (endgame < 0) + (sint16) ((value >> 16) & 0xffff);
		anti_phase = 32 - phase;
		value = endgame * anti_phase + opening * phase;
		value = value / 32 + Material_value;
		value = (value * SIGN) / 128;

		if (value > 0)
			value -= (PAWN_VALUE->white_fly_number * MINIMUM (value, 100)) / 64;
		else
			value += (PAWN_VALUE->black_fly_number * MINIMUM (-value, 100)) / 64;

#define mate_bishop_knight (DYNAMIC->flags & 128)
#define FAR_(i,j)\
	( MAXIMUM (file_detach (i, j), rank_detach (i, j) ) )
#define NEAR_(i,j)\
	( MINIMUM ( file_detach (i, j), rank_detach (i, j) ) )

		if (mate_bishop_knight)
		{
			if (value > 0)
			{
				if (bitboard_white_clear)
					value -=
					20 * MINIMUM (FAR_ (A8, POSITION.black_king_square),
					FAR_ (H1,
					POSITION.black_king_square)) +
					10 * MINIMUM (NEAR_ (A8, POSITION.black_king_square),
					NEAR_ (H1, POSITION.black_king_square));
				else
					value -=
					20 * MINIMUM (FAR_ (A1, POSITION.black_king_square),
					FAR_ (H8,
					POSITION.black_king_square)) +
					10 * MINIMUM (NEAR_ (A1, POSITION.black_king_square),
					NEAR_ (H8, POSITION.black_king_square));
			}
			else
			{
				if (bitboard_black_clear)
					value +=
					20 * MINIMUM (FAR_ (A8, POSITION.white_king_square),
					FAR_ (H1,
					POSITION.white_king_square)) +
					10 * MINIMUM (NEAR_ (A8, POSITION.white_king_square),
					NEAR_ (H1, POSITION.white_king_square));
				else
					value +=
					20 * MINIMUM (FAR_ (A1, POSITION.white_king_square),
					FAR_ (H8,
					POSITION.white_king_square)) +
					10 * MINIMUM (NEAR_ (A1, POSITION.white_king_square),
					NEAR_ (H8, POSITION.white_king_square));
			}
		}

		if (DYNAMIC->move50 > 50)
		{
			value *= (114 - DYNAMIC->move50);
			value /= 64;
		}

#define WHITE_MINOR (DYNAMIC->flags & 32)
#define WHITE_PIECE (DYNAMIC->flags & 2)
#define BLACK_MINOR (DYNAMIC->flags & 64)
#define BLACK_PIECE (DYNAMIC->flags & 1)

		if (value > 0)
		{
			if (WHITE_MINOR)
			{
				if (bitboard_white_knight)
				{
					if (bitboard_white_pawn == square_fixed[A7]
					&& (bitboard_black_king |
						attack_king[POSITION.black_king_square]) &
						square_fixed[A8])
						value = 0;
					if (bitboard_white_pawn == square_fixed[H7]
					&& (bitboard_black_king |
						attack_king[POSITION.black_king_square]) &
						square_fixed[H8])
						value = 0;
				}
				else if (bitboard_white_clear && !(bitboard_white_pawn & nonH)
					&& (bitboard_black_king |
					attack_king[POSITION.black_king_square]) &
					square_fixed[H8])
				{
					if (bitboard_white_pawn & square_fixed[H5]
					&& bitboard_black_pawn ==
						(square_fixed[G7] | square_fixed[H6]));
					else
						value = 0;
				}
				else if (bitboard_white_dark && !(bitboard_white_pawn & nonA)
					&& (bitboard_black_king |
					attack_king[POSITION.black_king_square]) &
					square_fixed[A8])
				{
					if (bitboard_white_pawn & square_fixed[A5]
					&& bitboard_black_pawn ==
						(square_fixed[B7] | square_fixed[A6]));
					else
						value = 0;
				}
				if (!bitboard_white_pawn)
					value = 0;
			}
		}

		else
		{
			if (BLACK_MINOR)
			{
				if (bitboard_black_knight)
				{
					if (bitboard_black_pawn == square_fixed[A2]
					&& (bitboard_white_king |
						attack_king[POSITION.white_king_square]) &
						square_fixed[A1])
						value = 0;
					if (bitboard_black_pawn == square_fixed[H2]
					&& (bitboard_white_king |
						attack_king[POSITION.white_king_square]) &
						square_fixed[H1])
						value = 0;
				}
				else if (bitboard_black_dark && !(bitboard_black_pawn & nonH)
					&& (bitboard_white_king |
					attack_king[POSITION.white_king_square]) &
					square_fixed[H1])
				{
					if (bitboard_black_pawn & square_fixed[H4]
					&& bitboard_white_pawn ==
						(square_fixed[G2] | square_fixed[H3]));
					else
						value = 0;
				}
				else if (bitboard_black_clear && !(bitboard_black_pawn & nonA)
					&& (bitboard_white_king |
					attack_king[POSITION.white_king_square]) &
					square_fixed[A1])
				{
					if (bitboard_black_pawn & square_fixed[A4]
					&& bitboard_white_pawn ==
						(square_fixed[B2] | square_fixed[A3]));
					else
						value = 0;
				}
				if (!bitboard_black_pawn)
					value = 0;
			}
		}

		DYNAMIC->value = POSITION.white_en_move ? value : -value;
		DYNAMIC->value_positional = value - Material_value;
		DYNAMIC->lazy = 0;
		value_zobrist[DYNAMIC->Zobrist & value_zobrist_hide] =
			(DYNAMIC->Zobrist & 0xffffffffffff0000) | (DYNAMIC->value & 0xffff);
		if (move && !(DYNAMIC - 1)->lazy)
			POSITION.white_en_move ? trick_white (move) : trick_black (move);

}
At this point, any more digging would be a waste of time. In private conversations months back, my advice to Mr. Houdart was "a good name is better than great riches," and it appears he doesn't care about having a good name.
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 » Sun Oct 16, 2011 9:21 pm

hyatt wrote:People did NOT read past the first chapter. Very FEW even read the first chapter.
bob, please realize your analogy doesn't work. What do you do with a book? You read it. What do you do with an engine? You analyze and play games with it.

People analyzed and played games without them thinking what would be analog to "Matt Reilly wrote this thing!", that is, being sure that "Vas just tore the cover off and whited out the title", even people being suspicious had their doubts, very different from reading the first chapter and realizing you're reading another book, word for word.

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 » Sun Oct 16, 2011 9:32 pm

We are talking about looking at SOURCE code. Not about "running the engine." We are talking about how a programmer develops his own, very recognizable, programming style over time. Just as a book author does. Not sure how/why your example fits in to that discussion...

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

Re: Computer Chess Biggest Liar

Post by Uly » Mon Oct 17, 2011 5:25 am

You posted:
hyatt wrote:He might well not understand your example, so here's one everyone can relate to.
And then you gave the example. But not "everyone" relates to reading engine source code, they relate to running the engine.

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 » Mon Oct 17, 2011 2:18 pm

You can relate to whatever you want to, obviously. But the discussion has continued to be centered on copying source code. Or recognizing the author's unique coding style, which was the root of JB's explanation. A few are way too quick to jump on this nonsensical bandwagon that suggests that two different programmers will write the SAME code, or even produce slightly different code with identical semantics. That is about as unlikely as flipping a head 1M times in a row. It COULD happen, but it is not very likely to happen....

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

Re: Computer Chess Biggest Liar

Post by Hood » Sat Oct 22, 2011 4:28 pm

My position is, if sth is stolen take guy to the court and if guilty he will be penalised but do not make a Lynch court and offend him on the forum. Have a dignity concerning ourselves.

Rgds
Hood

I have no idea what you are talking about. We are taking about a bold-face liar.

jb

The discussion shall not be on too low level. If we sent melt we are melted ourselves.
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 » Sun Oct 23, 2011 3:26 am

Hood wrote:My position is, if sth is stolen take guy to the court and if guilty he will be penalised but do not make a Lynch court and offend him on the forum. Have a dignity concerning ourselves.

Rgds
Hood

I have no idea what you are talking about. We are taking about a bold-face liar.

jb

The discussion shall not be on too low level. If we sent melt we are melted ourselves.
I didn't write that, btw. "bald-faced" liar would be correct. ;)

Jeremy

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 » Sun Oct 23, 2011 3:49 am

Jeremy Bernstein wrote:
Hood wrote:My position is, if sth is stolen take guy to the court and if guilty he will be penalised but do not make a Lynch court and offend him on the forum. Have a dignity concerning ourselves.

Rgds
Hood

I have no idea what you are talking about. We are taking about a bold-face liar.

jb

The discussion shall not be on too low level. If we sent melt we are melted ourselves.
I didn't write that, btw. "bald-faced" liar would be correct. ;)

Jeremy
He quoted me and attributed it to you...

As for bald-face liar vs bold-face liar, both are correct.
wiki.answers.com wrote:The original term seems to have been bald-faced (bare-faced) and refers to a face without whiskers. Beards were commonly worn by businessmen in the 18th and 19th century as an attempt to mask facial expressions when making business deals. Thus a bald-faced liar was a very good liar indeed, and was able to lie without the guilt showing on his face.

The more correct term is "bald-faced lie" or "bare-faced lie" (bare is more common in Great Britain). It refers to a "shameless" or "brazen" lie. One where the teller does not attempt to hide his face while telling it.

It's just the last 5 yrs or so that "bold" has come into usage. It refers to typeface. It is used metaphorically in speech. In the same way that a typesetter uses bold face type to highlight specific text and set it apart, a bold face lie stands out in such a way as to not be mistaken for the truth.

More Information

The phrase can either be used as bold-faced lie, as in someone with a bold enough face to lie (bold meaning daring, or brazen) or someone bold enough to lie to your face; it can also be used as bald-faced lie, where the older meaning of bald (meaning uncovered or unconcealed) - the more correct usage with this term is bare-faced lie. Earlier editions of Merriam Webster define bold-faced as someone being bold or forward, with no relation to lies.

Read more: http://wiki.answers.com/Q/Is_the_correc ... z1bZLaXGpJ
PAWN : Knight >> Bishop >> Rook >>Queen

kranium
Posts: 55
Joined: Mon Aug 02, 2010 10:49 pm
Real Name: Norman Schmidt

Re: Computer Chess Biggest Liar

Post by kranium » Sun Oct 23, 2011 2:50 pm

In last versions of Chesslogik Robbolito (e series, g3, and 0.09), which Sentinel and I released open-source under GPL on 12/31/2009 (or earlier)
we implemented (what I consider to be) a very unusual idea:

We linked to a Microsoft library via
#pragma comment(lib,"winmm.lib")
in Robbolito.h

winmm.lib is a 'multimedia' library, with sound routines for wave, midi, mci, etc. programming...quite unusual for a console chess application

Sentinel's idea was to improve time accuracy, and there were 3 very interesting functions we wanted to use:
timeBeginPeriod
timeEndPeriod
timeGetTime

From Microsoft:
"Multimedia timer services allow applications to schedule timer events with the greatest resolution (or accuracy) possible for the hardware platform.
These multimedia timer services allow you to schedule timer events at a higher resolution than other timer services."

So we used 'timeBeginPeriod' at the very beginning and 'timeEndPeriod' at the very end of search() (search.c),
and 'timeGetTime' in our function main_clock() (time.c)

Curiosly enough, when browsing Houdini_w32_1CPU.exe recently with Hex-Rays decompiler, I found that this library is also imported into the executable...
and amazingly, the specific function calls are used in exactly the same places and in the same manner as Robbolito 0.09, etc.!

As far as i know, it's never before been used in a chess program...except now, there are two good examples: our GPL'd Robbolito source code and Houdini.

Norm

Post Reply