// File: /workspace/github_cpp_makefile_star2_O3/jswaff[P]prophet3/src/pos.cpp
// Function: equal_pos(position*, position*, bool)
bool equal_pos(position* p1,position* p2,bool strict) {
    for (int32 sq=0;sq<64;sq++) {
        if (p1->piece[sq] != p2->piece[sq]) {
            return false;
        }
    }
    assert(p1->white_pawns==p2->white_pawns);
    assert(p1->black_pawns==p2->black_pawns);

    assert(p1->white_knights==p2->white_knights);
    assert(p1->black_knights==p2->black_knights);

    assert(p1->white_bishops==p2->white_bishops);
    assert(p1->black_bishops==p2->black_bishops);

    assert(p1->white_rooks==p2->white_rooks);
    assert(p1->black_rooks==p2->black_rooks);

    assert(p1->white_queens==p2->white_queens);
    assert(p1->black_queens==p2->black_queens);

    assert(p1->white_pieces==p2->white_pieces);
    assert(p1->black_pieces==p2->black_pieces);

    // if that's true then piece counts should be equal
    assert(p1->piece_counts[WHITE][PAWN]==p2->piece_counts[WHITE][PAWN]);
    assert(p1->piece_counts[WHITE][ROOK]==p2->piece_counts[WHITE][ROOK]);
    assert(p1->piece_counts[WHITE][KNIGHT]==p2->piece_counts[WHITE][KNIGHT]);
    assert(p1->piece_counts[WHITE][BISHOP]==p2->piece_counts[WHITE][BISHOP]);
    assert(p1->piece_counts[WHITE][QUEEN]==p2->piece_counts[WHITE][QUEEN]);

    assert(p1->piece_counts[BLACK][PAWN]==p2->piece_counts[BLACK][PAWN]);
    assert(p1->piece_counts[BLACK][ROOK]==p2->piece_counts[BLACK][ROOK]);
    assert(p1->piece_counts[BLACK][KNIGHT]==p2->piece_counts[BLACK][KNIGHT]);
    assert(p1->piece_counts[BLACK][BISHOP]==p2->piece_counts[BLACK][BISHOP]);
    assert(p1->piece_counts[BLACK][QUEEN]==p2->piece_counts[BLACK][QUEEN]);

    if (p1->player != p2->player) return false;
    if (p1->ep_sq != p2->ep_sq) return false;
    if (p1->castling_rights != p2->castling_rights) return false;
    if (p1->white_king != p2->white_king) return false;
    if (p1->black_king != p2->black_king) return false;
    if (strict) {
        if (p1->move_counter != p2->move_counter) return false;
        if (p1->fifty_counter != p2->fifty_counter) return false;
    }

    // if all that is equal the hash keys should be too
    assert(p1->hash_key==p2->hash_key);
    assert(p1->pawn_key==p2->pawn_key);

    return true;
}

// Assembly:
pushq %rax
xorl %eax, %eax
movl (%rdi,%rax,4), %ecx
cmpl (%rsi,%rax,4), %ecx
jne 0xa32b
incq %rax
cmpq $0x40, %rax
jne 0xa0bb
movq 0x158(%rdi), %rax
cmpq 0x158(%rsi), %rax
jne 0xa32f
movq 0x160(%rdi), %rax
cmpq 0x160(%rsi), %rax
jne 0xa34e
movq 0x168(%rdi), %rax
cmpq 0x168(%rsi), %rax
jne 0xa36d
movq 0x170(%rdi), %rax
cmpq 0x170(%rsi), %rax
jne 0xa38c
movq 0x178(%rdi), %rax
cmpq 0x178(%rsi), %rax
jne 0xa3ab
movq 0x180(%rdi), %rax
cmpq 0x180(%rsi), %rax
jne 0xa3ca
movq 0x188(%rdi), %rax
cmpq 0x188(%rsi), %rax
jne 0xa3e9
movq 0x190(%rdi), %rax
cmpq 0x190(%rsi), %rax
jne 0xa408
movq 0x198(%rdi), %rax
cmpq 0x198(%rsi), %rax
jne 0xa427
movq 0x1a0(%rdi), %rax
cmpq 0x1a0(%rsi), %rax
jne 0xa446
movq 0x1a8(%rdi), %rax
cmpq 0x1a8(%rsi), %rax
jne 0xa465
movq 0x1b0(%rdi), %rax
cmpq 0x1b0(%rsi), %rax
jne 0xa484
movl 0x120(%rdi), %eax
cmpl 0x120(%rsi), %eax
jne 0xa4a3
movl 0x12c(%rdi), %eax
cmpl 0x12c(%rsi), %eax
jne 0xa4c2
movl 0x124(%rdi), %eax
cmpl 0x124(%rsi), %eax
jne 0xa4e1
movl 0x128(%rdi), %eax
cmpl 0x128(%rsi), %eax
jne 0xa500
movl 0x130(%rdi), %eax
cmpl 0x130(%rsi), %eax
jne 0xa51f
movl 0x104(%rdi), %eax
cmpl 0x104(%rsi), %eax
jne 0xa53e
movl 0x110(%rdi), %eax
cmpl 0x110(%rsi), %eax
jne 0xa55d
movl 0x108(%rdi), %eax
cmpl 0x108(%rsi), %eax
jne 0xa57c
movl 0x10c(%rdi), %eax
cmpl 0x10c(%rsi), %eax
jne 0xa59b
movl 0x114(%rdi), %eax
cmpl 0x114(%rsi), %eax
jne 0xa5ba
movl 0x138(%rdi), %eax
cmpl 0x138(%rsi), %eax
jne 0xa32b
movl 0x13c(%rdi), %eax
cmpl 0x13c(%rsi), %eax
jne 0xa32b
movl 0x140(%rdi), %eax
cmpl 0x140(%rsi), %eax
jne 0xa32b
movl 0x14c(%rdi), %eax
cmpl 0x14c(%rsi), %eax
jne 0xa32b
movl 0x150(%rdi), %eax
cmpl 0x150(%rsi), %eax
jne 0xa32b
testb %dl, %dl
je 0xa2e6
movl 0x144(%rdi), %eax
cmpl 0x144(%rsi), %eax
jne 0xa32b
movl 0x148(%rdi), %eax
cmpl 0x148(%rsi), %eax
jne 0xa32b
movq 0x1b8(%rdi), %rax
cmpq 0x1b8(%rsi), %rax
jne 0xa5d9
movq 0x1c0(%rdi), %rcx
movb $0x1, %al
cmpq 0x1c0(%rsi), %rcx
je 0xa32d
leaq 0x219cb(%rip), %rdi     # 0x2bcde
leaq 0x21577(%rip), %rsi     # 0x2b891
leaq 0x2157c(%rip), %rcx     # 0x2b89d
movl $0x4b, %edx
callq 0x20d0
xorl %eax, %eax
popq %rcx
retq
leaq 0x2153a(%rip), %rdi     # 0x2b870
leaq 0x21554(%rip), %rsi     # 0x2b891
leaq 0x21559(%rip), %rcx     # 0x2b89d
movl $0x20, %edx
callq 0x20d0
leaq 0x21575(%rip), %rdi     # 0x2b8ca
leaq 0x21535(%rip), %rsi     # 0x2b891
leaq 0x2153a(%rip), %rcx     # 0x2b89d
movl $0x21, %edx
callq 0x20d0
leaq 0x21577(%rip), %rdi     # 0x2b8eb
leaq 0x21516(%rip), %rsi     # 0x2b891
leaq 0x2151b(%rip), %rcx     # 0x2b89d
movl $0x23, %edx
callq 0x20d0
leaq 0x2157d(%rip), %rdi     # 0x2b910
leaq 0x214f7(%rip), %rsi     # 0x2b891
leaq 0x214fc(%rip), %rcx     # 0x2b89d
movl $0x24, %edx
callq 0x20d0
leaq 0x21583(%rip), %rdi     # 0x2b935
leaq 0x214d8(%rip), %rsi     # 0x2b891
leaq 0x214dd(%rip), %rcx     # 0x2b89d
movl $0x26, %edx
callq 0x20d0
leaq 0x21589(%rip), %rdi     # 0x2b95a
leaq 0x214b9(%rip), %rsi     # 0x2b891
leaq 0x214be(%rip), %rcx     # 0x2b89d
movl $0x27, %edx
callq 0x20d0
leaq 0x2158f(%rip), %rdi     # 0x2b97f
leaq 0x2149a(%rip), %rsi     # 0x2b891
leaq 0x2149f(%rip), %rcx     # 0x2b89d
movl $0x29, %edx
callq 0x20d0
leaq 0x21591(%rip), %rdi     # 0x2b9a0
leaq 0x2147b(%rip), %rsi     # 0x2b891
leaq 0x21480(%rip), %rcx     # 0x2b89d
movl $0x2a, %edx
callq 0x20d0
leaq 0x21593(%rip), %rdi     # 0x2b9c1
leaq 0x2145c(%rip), %rsi     # 0x2b891
leaq 0x21461(%rip), %rcx     # 0x2b89d
movl $0x2c, %edx
callq 0x20d0
leaq 0x21597(%rip), %rdi     # 0x2b9e4
leaq 0x2143d(%rip), %rsi     # 0x2b891
leaq 0x21442(%rip), %rcx     # 0x2b89d
movl $0x2d, %edx
callq 0x20d0
leaq 0x2159b(%rip), %rdi     # 0x2ba07
leaq 0x2141e(%rip), %rsi     # 0x2b891
leaq 0x21423(%rip), %rcx     # 0x2b89d
movl $0x2f, %edx
callq 0x20d0
leaq 0x2159f(%rip), %rdi     # 0x2ba2a
leaq 0x213ff(%rip), %rsi     # 0x2b891
leaq 0x21404(%rip), %rcx     # 0x2b89d
movl $0x30, %edx
callq 0x20d0
leaq 0x215a3(%rip), %rdi     # 0x2ba4d
leaq 0x213e0(%rip), %rsi     # 0x2b891
leaq 0x213e5(%rip), %rcx     # 0x2b89d
movl $0x33, %edx
callq 0x20d0
leaq 0x215c1(%rip), %rdi     # 0x2ba8a
leaq 0x213c1(%rip), %rsi     # 0x2b891
leaq 0x213c6(%rip), %rcx     # 0x2b89d
movl $0x34, %edx
callq 0x20d0
leaq 0x215df(%rip), %rdi     # 0x2bac7
leaq 0x213a2(%rip), %rsi     # 0x2b891
leaq 0x213a7(%rip), %rcx     # 0x2b89d
movl $0x35, %edx
callq 0x20d0
leaq 0x21601(%rip), %rdi     # 0x2bb08
leaq 0x21383(%rip), %rsi     # 0x2b891
leaq 0x21388(%rip), %rcx     # 0x2b89d
movl $0x36, %edx
callq 0x20d0
leaq 0x21623(%rip), %rdi     # 0x2bb49
leaq 0x21364(%rip), %rsi     # 0x2b891
leaq 0x21369(%rip), %rcx     # 0x2b89d
movl $0x37, %edx
callq 0x20d0
leaq 0x21643(%rip), %rdi     # 0x2bb88
leaq 0x21345(%rip), %rsi     # 0x2b891
leaq 0x2134a(%rip), %rcx     # 0x2b89d
movl $0x39, %edx
callq 0x20d0
leaq 0x21661(%rip), %rdi     # 0x2bbc5
leaq 0x21326(%rip), %rsi     # 0x2b891
leaq 0x2132b(%rip), %rcx     # 0x2b89d
movl $0x3a, %edx
callq 0x20d0
leaq 0x2167f(%rip), %rdi     # 0x2bc02
leaq 0x21307(%rip), %rsi     # 0x2b891
leaq 0x2130c(%rip), %rcx     # 0x2b89d
movl $0x3b, %edx
callq 0x20d0
leaq 0x216a1(%rip), %rdi     # 0x2bc43
leaq 0x212e8(%rip), %rsi     # 0x2b891
leaq 0x212ed(%rip), %rcx     # 0x2b89d
movl $0x3c, %edx
callq 0x20d0
leaq 0x216c3(%rip), %rdi     # 0x2bc84
leaq 0x212c9(%rip), %rsi     # 0x2b891
leaq 0x212ce(%rip), %rcx     # 0x2b89d
movl $0x3d, %edx
callq 0x20d0
leaq 0x216e3(%rip), %rdi     # 0x2bcc3
leaq 0x212aa(%rip), %rsi     # 0x2b891
leaq 0x212af(%rip), %rcx     # 0x2b89d
movl $0x4a, %edx
callq 0x20d0