// File: /workspace/github_cpp_makefile_star2_O2/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
cmpq $0x40, %rax
je 0x98e5
movl (%rdi,%rax,4), %ecx
leaq 0x1(%rax), %r8
cmpl (%rsi,%rax,4), %ecx
movq %r8, %rax
je 0x98cb
jmp 0x9b39
movq 0x158(%rdi), %rax
cmpq 0x158(%rsi), %rax
jne 0x9b3d
movq 0x160(%rdi), %rax
cmpq 0x160(%rsi), %rax
jne 0x9b59
movq 0x168(%rdi), %rax
cmpq 0x168(%rsi), %rax
jne 0x9b75
movq 0x170(%rdi), %rax
cmpq 0x170(%rsi), %rax
jne 0x9b91
movq 0x178(%rdi), %rax
cmpq 0x178(%rsi), %rax
jne 0x9bad
movq 0x180(%rdi), %rax
cmpq 0x180(%rsi), %rax
jne 0x9bc9
movq 0x188(%rdi), %rax
cmpq 0x188(%rsi), %rax
jne 0x9be5
movq 0x190(%rdi), %rax
cmpq 0x190(%rsi), %rax
jne 0x9c01
movq 0x198(%rdi), %rax
cmpq 0x198(%rsi), %rax
jne 0x9c1d
movq 0x1a0(%rdi), %rax
cmpq 0x1a0(%rsi), %rax
jne 0x9c39
movq 0x1a8(%rdi), %rax
cmpq 0x1a8(%rsi), %rax
jne 0x9c55
movq 0x1b0(%rdi), %rax
cmpq 0x1b0(%rsi), %rax
jne 0x9c71
movl 0x120(%rdi), %eax
cmpl 0x120(%rsi), %eax
jne 0x9c8d
movl 0x12c(%rdi), %eax
cmpl 0x12c(%rsi), %eax
jne 0x9ca9
movl 0x124(%rdi), %eax
cmpl 0x124(%rsi), %eax
jne 0x9cc5
movl 0x128(%rdi), %eax
cmpl 0x128(%rsi), %eax
jne 0x9ce1
movl 0x130(%rdi), %eax
cmpl 0x130(%rsi), %eax
jne 0x9cfd
movl 0x104(%rdi), %eax
cmpl 0x104(%rsi), %eax
jne 0x9d16
movl 0x110(%rdi), %eax
cmpl 0x110(%rsi), %eax
jne 0x9d2f
movl 0x108(%rdi), %eax
cmpl 0x108(%rsi), %eax
jne 0x9d48
movl 0x10c(%rdi), %eax
cmpl 0x10c(%rsi), %eax
jne 0x9d61
movl 0x114(%rdi), %eax
cmpl 0x114(%rsi), %eax
jne 0x9d7a
movl 0x138(%rdi), %eax
cmpl 0x138(%rsi), %eax
jne 0x9b39
movl 0x13c(%rdi), %eax
cmpl 0x13c(%rsi), %eax
jne 0x9b39
movl 0x140(%rdi), %eax
cmpl 0x140(%rsi), %eax
jne 0x9b39
movl 0x14c(%rdi), %eax
cmpl 0x14c(%rsi), %eax
jne 0x9b39
movl 0x150(%rdi), %eax
cmpl 0x150(%rsi), %eax
jne 0x9b39
testb %dl, %dl
je 0x9af7
movl 0x144(%rdi), %eax
cmpl 0x144(%rsi), %eax
jne 0x9b39
movl 0x148(%rdi), %eax
cmpl 0x148(%rsi), %eax
jne 0x9b39
movq 0x1b8(%rdi), %rax
cmpq 0x1b8(%rsi), %rax
jne 0x9d97
movq 0x1c0(%rdi), %rcx
movb $0x1, %al
cmpq 0x1c0(%rsi), %rcx
je 0x9b3b
leaq 0x2016a(%rip), %rdi     # 0x29c8e
leaq 0x1fd16(%rip), %rsi     # 0x29841
leaq 0x1fd1b(%rip), %rcx     # 0x2984d
pushq $0x4b
jmp 0x9d91
xorl %eax, %eax
popq %rcx
retq
leaq 0x1fcdc(%rip), %rdi     # 0x29820
leaq 0x1fcf6(%rip), %rsi     # 0x29841
leaq 0x1fcfb(%rip), %rcx     # 0x2984d
pushq $0x20
jmp 0x9d91
leaq 0x1fd1a(%rip), %rdi     # 0x2987a
leaq 0x1fcda(%rip), %rsi     # 0x29841
leaq 0x1fcdf(%rip), %rcx     # 0x2984d
pushq $0x21
jmp 0x9d91
leaq 0x1fd1f(%rip), %rdi     # 0x2989b
leaq 0x1fcbe(%rip), %rsi     # 0x29841
leaq 0x1fcc3(%rip), %rcx     # 0x2984d
pushq $0x23
jmp 0x9d91
leaq 0x1fd28(%rip), %rdi     # 0x298c0
leaq 0x1fca2(%rip), %rsi     # 0x29841
leaq 0x1fca7(%rip), %rcx     # 0x2984d
pushq $0x24
jmp 0x9d91
leaq 0x1fd31(%rip), %rdi     # 0x298e5
leaq 0x1fc86(%rip), %rsi     # 0x29841
leaq 0x1fc8b(%rip), %rcx     # 0x2984d
pushq $0x26
jmp 0x9d91
leaq 0x1fd3a(%rip), %rdi     # 0x2990a
leaq 0x1fc6a(%rip), %rsi     # 0x29841
leaq 0x1fc6f(%rip), %rcx     # 0x2984d
pushq $0x27
jmp 0x9d91
leaq 0x1fd43(%rip), %rdi     # 0x2992f
leaq 0x1fc4e(%rip), %rsi     # 0x29841
leaq 0x1fc53(%rip), %rcx     # 0x2984d
pushq $0x29
jmp 0x9d91
leaq 0x1fd48(%rip), %rdi     # 0x29950
leaq 0x1fc32(%rip), %rsi     # 0x29841
leaq 0x1fc37(%rip), %rcx     # 0x2984d
pushq $0x2a
jmp 0x9d91
leaq 0x1fd4d(%rip), %rdi     # 0x29971
leaq 0x1fc16(%rip), %rsi     # 0x29841
leaq 0x1fc1b(%rip), %rcx     # 0x2984d
pushq $0x2c
jmp 0x9d91
leaq 0x1fd54(%rip), %rdi     # 0x29994
leaq 0x1fbfa(%rip), %rsi     # 0x29841
leaq 0x1fbff(%rip), %rcx     # 0x2984d
pushq $0x2d
jmp 0x9d91
leaq 0x1fd5b(%rip), %rdi     # 0x299b7
leaq 0x1fbde(%rip), %rsi     # 0x29841
leaq 0x1fbe3(%rip), %rcx     # 0x2984d
pushq $0x2f
jmp 0x9d91
leaq 0x1fd62(%rip), %rdi     # 0x299da
leaq 0x1fbc2(%rip), %rsi     # 0x29841
leaq 0x1fbc7(%rip), %rcx     # 0x2984d
pushq $0x30
jmp 0x9d91
leaq 0x1fd69(%rip), %rdi     # 0x299fd
leaq 0x1fba6(%rip), %rsi     # 0x29841
leaq 0x1fbab(%rip), %rcx     # 0x2984d
pushq $0x33
jmp 0x9d91
leaq 0x1fd8a(%rip), %rdi     # 0x29a3a
leaq 0x1fb8a(%rip), %rsi     # 0x29841
leaq 0x1fb8f(%rip), %rcx     # 0x2984d
pushq $0x34
jmp 0x9d91
leaq 0x1fdab(%rip), %rdi     # 0x29a77
leaq 0x1fb6e(%rip), %rsi     # 0x29841
leaq 0x1fb73(%rip), %rcx     # 0x2984d
pushq $0x35
jmp 0x9d91
leaq 0x1fdd0(%rip), %rdi     # 0x29ab8
leaq 0x1fb52(%rip), %rsi     # 0x29841
leaq 0x1fb57(%rip), %rcx     # 0x2984d
pushq $0x36
jmp 0x9d91
leaq 0x1fdf5(%rip), %rdi     # 0x29af9
leaq 0x1fb36(%rip), %rsi     # 0x29841
leaq 0x1fb3b(%rip), %rcx     # 0x2984d
pushq $0x37
jmp 0x9d91
leaq 0x1fe1b(%rip), %rdi     # 0x29b38
leaq 0x1fb1d(%rip), %rsi     # 0x29841
leaq 0x1fb22(%rip), %rcx     # 0x2984d
pushq $0x39
jmp 0x9d91
leaq 0x1fe3f(%rip), %rdi     # 0x29b75
leaq 0x1fb04(%rip), %rsi     # 0x29841
leaq 0x1fb09(%rip), %rcx     # 0x2984d
pushq $0x3a
jmp 0x9d91
leaq 0x1fe63(%rip), %rdi     # 0x29bb2
leaq 0x1faeb(%rip), %rsi     # 0x29841
leaq 0x1faf0(%rip), %rcx     # 0x2984d
pushq $0x3b
jmp 0x9d91
leaq 0x1fe8b(%rip), %rdi     # 0x29bf3
leaq 0x1fad2(%rip), %rsi     # 0x29841
leaq 0x1fad7(%rip), %rcx     # 0x2984d
pushq $0x3c
jmp 0x9d91
leaq 0x1feb3(%rip), %rdi     # 0x29c34
leaq 0x1fab9(%rip), %rsi     # 0x29841
leaq 0x1fabe(%rip), %rcx     # 0x2984d
pushq $0x3d
popq %rdx
callq 0x20c0
leaq 0x1fed5(%rip), %rdi     # 0x29c73
leaq 0x1fa9c(%rip), %rsi     # 0x29841
leaq 0x1faa1(%rip), %rcx     # 0x2984d
pushq $0x4a
jmp 0x9d91