// File: /workspace/github_cpp_makefile_star2_O3/jswaff[P]prophet3/test/pos__test.cpp
// Function: test_set_pos()
void test_set_pos() {
    position pos1;
    reset_pos(&pos1);

    position pos2;
    assert(set_pos(&pos2,"rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"));
    assert(equal_pos(&pos1,&pos2,true));

    /////
    assert(set_pos(&pos2,"8/7p/5k2/5p2/p1p2P2/Pr1pPK2/1P1R3P/8 b - - 12 47"));
    for (int32 sq=A8;sq<=G7;sq++) {
        assert(pos2.piece[sq]==NO_PIECE);
    }
    assert(pos2.piece[H7]==-PAWN);
    for (int32 sq=A6;sq<=E6;sq++) {
        assert(pos2.piece[sq]==NO_PIECE);
    }
    assert(pos2.piece[F6]==-KING);
    assert(pos2.black_king==F6);
    for (int32 sq=G6;sq<=E5;sq++) {
        assert(pos2.piece[sq]==NO_PIECE);
    }
    assert(pos2.piece[F5]==-PAWN);
    assert(pos2.piece[G5]==NO_PIECE);
    assert(pos2.piece[H5]==NO_PIECE);
    assert(pos2.piece[A4]==-PAWN);
    assert(pos2.piece[B4]==NO_PIECE);
    assert(pos2.piece[C4]==-PAWN);
    assert(pos2.piece[D4]==NO_PIECE);
    assert(pos2.piece[E4]==NO_PIECE);
    assert(pos2.piece[F4]==PAWN);
    assert(pos2.piece[G4]==NO_PIECE);
    assert(pos2.piece[H4]==NO_PIECE);
    assert(pos2.piece[A3]==PAWN);
    assert(pos2.piece[B3]==-ROOK);
    assert(pos2.piece[C3]==NO_PIECE);
    assert(pos2.piece[D3]==-PAWN);
    assert(pos2.piece[E3]==PAWN);
    assert(pos2.piece[F3]==KING);
    assert(pos2.white_king==F3);
    assert(pos2.piece[G3]==NO_PIECE);
    assert(pos2.piece[H3]==NO_PIECE);
    assert(pos2.piece[A2]==NO_PIECE);
    assert(pos2.piece[B2]==PAWN);
    assert(pos2.piece[C2]==NO_PIECE);
    assert(pos2.piece[D2]==ROOK);
    assert(pos2.piece[E2]==NO_PIECE);
    assert(pos2.piece[F2]==NO_PIECE);
    assert(pos2.piece[G2]==NO_PIECE);
    assert(pos2.piece[H2]==PAWN);
    for (int32 sq=A1;sq<=H1;sq++) {
        assert(pos2.piece[sq]==NO_PIECE);
    }
    assert(pos2.player==BLACK);
    assert(pos2.ep_sq==NO_SQUARE);
    assert(pos2.castling_rights==0);
    assert(pos2.fifty_counter==12);
    assert(pos2.move_counter==93);

    //////
    assert(set_pos(&pos2,"rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq e3 0 1"));
    assert(pos2.player==BLACK);
    assert(can_castle_wk(&pos2));
    assert(can_castle_wq(&pos2));
    assert(can_castle_bk(&pos2));
    assert(can_castle_bq(&pos2));
    assert(pos2.ep_sq==E3);
    assert(pos2.fifty_counter==0);
    assert(pos2.move_counter==1);
}

// Assembly:
subq $0x398, %rsp            # imm = 0x398
leaq 0x1d0(%rsp), %rdi
callq 0xaa51
leaq 0x908d(%rip), %rsi      # 0x2b144
leaq 0x8(%rsp), %rdi
callq 0xaa82
testb %al, %al
je 0x2246e
leaq 0x1d0(%rsp), %rdi
leaq 0x8(%rsp), %rsi
movl $0x1, %edx
callq 0xa0b8
testb %al, %al
je 0x2248d
leaq 0x13962(%rip), %rsi     # 0x35a51
leaq 0x8(%rsp), %rdi
callq 0xaa82
testb %al, %al
je 0x224ac
xorl %eax, %eax
cmpl $0x0, 0x8(%rsp,%rax,4)
jne 0x223f2
incq %rax
cmpq $0xf, %rax
jne 0x22103
cmpl $-0x1, 0x44(%rsp)
jne 0x224cb
movl $0x10, %eax
cmpl $0x0, 0x8(%rsp,%rax,4)
jne 0x22411
incq %rax
cmpq $0x15, %rax
jne 0x22127
cmpl $-0x6, 0x5c(%rsp)
jne 0x224ea
cmpl $0x15, 0x158(%rsp)
jne 0x22509
movl $0x16, %eax
cmpl $0x0, 0x8(%rsp,%rax,4)
jne 0x22430
incq %rax
cmpq $0x1d, %rax
jne 0x22159
cmpl $-0x1, 0x7c(%rsp)
jne 0x22528
cmpl $0x0, 0x80(%rsp)
jne 0x22547
cmpl $0x0, 0x84(%rsp)
jne 0x22566
cmpl $-0x1, 0x88(%rsp)
jne 0x22585
cmpl $0x0, 0x8c(%rsp)
jne 0x225a4
cmpl $-0x1, 0x90(%rsp)
jne 0x225c3
cmpl $0x0, 0x94(%rsp)
jne 0x225e2
cmpl $0x0, 0x98(%rsp)
jne 0x22601
cmpl $0x1, 0x9c(%rsp)
jne 0x22620
cmpl $0x0, 0xa0(%rsp)
jne 0x2263f
cmpl $0x0, 0xa4(%rsp)
jne 0x2265e
cmpl $0x1, 0xa8(%rsp)
jne 0x2267d
cmpl $-0x4, 0xac(%rsp)
jne 0x2269c
cmpl $0x0, 0xb0(%rsp)
jne 0x226bb
cmpl $-0x1, 0xb4(%rsp)
jne 0x226da
cmpl $0x1, 0xb8(%rsp)
jne 0x226f9
cmpl $0x6, 0xbc(%rsp)
jne 0x22718
cmpl $0x2d, 0x154(%rsp)
jne 0x22737
cmpl $0x0, 0xc0(%rsp)
jne 0x22756
cmpl $0x0, 0xc4(%rsp)
jne 0x22775
cmpl $0x0, 0xc8(%rsp)
jne 0x22794
cmpl $0x1, 0xcc(%rsp)
jne 0x227b3
cmpl $0x0, 0xd0(%rsp)
jne 0x227d2
cmpl $0x4, 0xd4(%rsp)
jne 0x227f1
cmpl $0x0, 0xd8(%rsp)
jne 0x22810
cmpl $0x0, 0xdc(%rsp)
jne 0x2282f
cmpl $0x0, 0xe0(%rsp)
jne 0x2284e
cmpl $0x1, 0xe4(%rsp)
jne 0x2286d
movl $0x38, %eax
cmpl $0x0, 0x8(%rsp,%rax,4)
jne 0x2244f
incq %rax
cmpq $0x40, %rax
jne 0x222f7
cmpl $0x0, 0x140(%rsp)
jne 0x2288c
cmpl $0x40, 0x144(%rsp)
jne 0x228ab
cmpl $0x0, 0x148(%rsp)
jne 0x228ca
cmpl $0xc, 0x150(%rsp)
jne 0x228e9
cmpl $0x5d, 0x14c(%rsp)
jne 0x22908
leaq 0xb19b(%rip), %rsi      # 0x2d4f3
leaq 0x8(%rsp), %rdi
callq 0xaa82
testb %al, %al
je 0x22927
cmpl $0x0, 0x140(%rsp)
jne 0x22946
leaq 0x8(%rsp), %rdi
callq 0xa921
testb %al, %al
je 0x22965
leaq 0x8(%rsp), %rdi
callq 0xa92a
testb %al, %al
je 0x22984
leaq 0x8(%rsp), %rdi
callq 0xa935
testb %al, %al
je 0x229a3
leaq 0x8(%rsp), %rdi
callq 0xa941
testb %al, %al
je 0x229c2
cmpl $0x2c, 0x144(%rsp)
jne 0x229e1
cmpl $0x0, 0x150(%rsp)
jne 0x22a00
cmpl $0x1, 0x14c(%rsp)
jne 0x22a1f
addq $0x398, %rsp            # imm = 0x398
retq
leaq 0x136cb(%rip), %rdi     # 0x35ac4
leaq 0x13308(%rip), %rsi     # 0x35708
leaq 0x13636(%rip), %rcx     # 0x35a3d
movl $0x96, %edx
callq 0x20d0
leaq 0x136ac(%rip), %rdi     # 0x35ac4
leaq 0x132e9(%rip), %rsi     # 0x35708
leaq 0x13617(%rip), %rcx     # 0x35a3d
movl $0x9a, %edx
callq 0x20d0
leaq 0x1368d(%rip), %rdi     # 0x35ac4
leaq 0x132ca(%rip), %rsi     # 0x35708
leaq 0x135f8(%rip), %rcx     # 0x35a3d
movl $0x9f, %edx
callq 0x20d0
leaq 0x1366e(%rip), %rdi     # 0x35ac4
leaq 0x132ab(%rip), %rsi     # 0x35708
leaq 0x135d9(%rip), %rcx     # 0x35a3d
movl $0xbe, %edx
callq 0x20d0
leaq 0x1357e(%rip), %rdi     # 0x359f3
leaq 0x1328c(%rip), %rsi     # 0x35708
leaq 0x135ba(%rip), %rcx     # 0x35a3d
movl $0x90, %edx
callq 0x20d0
leaq 0x13543(%rip), %rdi     # 0x359d7
leaq 0x1326d(%rip), %rsi     # 0x35708
leaq 0x1359b(%rip), %rcx     # 0x35a3d
movl $0x91, %edx
callq 0x20d0
leaq 0x135cf(%rip), %rdi     # 0x35a82
leaq 0x1324e(%rip), %rsi     # 0x35708
leaq 0x1357c(%rip), %rcx     # 0x35a3d
movl $0x94, %edx
callq 0x20d0
leaq 0x1360b(%rip), %rdi     # 0x35add
leaq 0x1322f(%rip), %rsi     # 0x35708
leaq 0x1355d(%rip), %rcx     # 0x35a3d
movl $0x98, %edx
callq 0x20d0
leaq 0x13602(%rip), %rdi     # 0x35af3
leaq 0x13210(%rip), %rsi     # 0x35708
leaq 0x1353e(%rip), %rcx     # 0x35a3d
movl $0x9c, %edx
callq 0x20d0
leaq 0x135f9(%rip), %rdi     # 0x35b09
leaq 0x131f1(%rip), %rsi     # 0x35708
leaq 0x1351f(%rip), %rcx     # 0x35a3d
movl $0x9d, %edx
callq 0x20d0
leaq 0x135ee(%rip), %rdi     # 0x35b1d
leaq 0x131d2(%rip), %rsi     # 0x35708
leaq 0x13500(%rip), %rcx     # 0x35a3d
movl $0xa1, %edx
callq 0x20d0
leaq 0x135e5(%rip), %rdi     # 0x35b33
leaq 0x131b3(%rip), %rsi     # 0x35708
leaq 0x134e1(%rip), %rcx     # 0x35a3d
movl $0xa2, %edx
callq 0x20d0
leaq 0x135df(%rip), %rdi     # 0x35b4c
leaq 0x13194(%rip), %rsi     # 0x35708
leaq 0x134c2(%rip), %rcx     # 0x35a3d
movl $0xa3, %edx
callq 0x20d0
leaq 0x135d9(%rip), %rdi     # 0x35b65
leaq 0x13175(%rip), %rsi     # 0x35708
leaq 0x134a3(%rip), %rcx     # 0x35a3d
movl $0xa4, %edx
callq 0x20d0
leaq 0x135d0(%rip), %rdi     # 0x35b7b
leaq 0x13156(%rip), %rsi     # 0x35708
leaq 0x13484(%rip), %rcx     # 0x35a3d
movl $0xa5, %edx
callq 0x20d0
leaq 0x135ca(%rip), %rdi     # 0x35b94
leaq 0x13137(%rip), %rsi     # 0x35708
leaq 0x13465(%rip), %rcx     # 0x35a3d
movl $0xa6, %edx
callq 0x20d0
leaq 0x135c1(%rip), %rdi     # 0x35baa
leaq 0x13118(%rip), %rsi     # 0x35708
leaq 0x13446(%rip), %rcx     # 0x35a3d
movl $0xa7, %edx
callq 0x20d0
leaq 0x135bb(%rip), %rdi     # 0x35bc3
leaq 0x130f9(%rip), %rsi     # 0x35708
leaq 0x13427(%rip), %rcx     # 0x35a3d
movl $0xa8, %edx
callq 0x20d0
leaq 0x135b5(%rip), %rdi     # 0x35bdc
leaq 0x130da(%rip), %rsi     # 0x35708
leaq 0x13408(%rip), %rcx     # 0x35a3d
movl $0xa9, %edx
callq 0x20d0
leaq 0x135ab(%rip), %rdi     # 0x35bf1
leaq 0x130bb(%rip), %rsi     # 0x35708
leaq 0x133e9(%rip), %rcx     # 0x35a3d
movl $0xaa, %edx
callq 0x20d0
leaq 0x135a5(%rip), %rdi     # 0x35c0a
leaq 0x1309c(%rip), %rsi     # 0x35708
leaq 0x133ca(%rip), %rcx     # 0x35a3d
movl $0xab, %edx
callq 0x20d0
leaq 0x1359f(%rip), %rdi     # 0x35c23
leaq 0x1307d(%rip), %rsi     # 0x35708
leaq 0x133ab(%rip), %rcx     # 0x35a3d
movl $0xac, %edx
callq 0x20d0
leaq 0x13595(%rip), %rdi     # 0x35c38
leaq 0x1305e(%rip), %rsi     # 0x35708
leaq 0x1338c(%rip), %rcx     # 0x35a3d
movl $0xad, %edx
callq 0x20d0
leaq 0x1358c(%rip), %rdi     # 0x35c4e
leaq 0x1303f(%rip), %rsi     # 0x35708
leaq 0x1336d(%rip), %rcx     # 0x35a3d
movl $0xae, %edx
callq 0x20d0
leaq 0x13586(%rip), %rdi     # 0x35c67
leaq 0x13020(%rip), %rsi     # 0x35708
leaq 0x1334e(%rip), %rcx     # 0x35a3d
movl $0xaf, %edx
callq 0x20d0
leaq 0x1357d(%rip), %rdi     # 0x35c7d
leaq 0x13001(%rip), %rsi     # 0x35708
leaq 0x1332f(%rip), %rcx     # 0x35a3d
movl $0xb0, %edx
callq 0x20d0
leaq 0x13573(%rip), %rdi     # 0x35c92
leaq 0x12fe2(%rip), %rsi     # 0x35708
leaq 0x13310(%rip), %rcx     # 0x35a3d
movl $0xb1, %edx
callq 0x20d0
leaq 0x13569(%rip), %rdi     # 0x35ca7
leaq 0x12fc3(%rip), %rsi     # 0x35708
leaq 0x132f1(%rip), %rcx     # 0x35a3d
movl $0xb2, %edx
callq 0x20d0
leaq 0x1355e(%rip), %rdi     # 0x35cbb
leaq 0x12fa4(%rip), %rsi     # 0x35708
leaq 0x132d2(%rip), %rcx     # 0x35a3d
movl $0xb3, %edx
callq 0x20d0
leaq 0x13558(%rip), %rdi     # 0x35cd4
leaq 0x12f85(%rip), %rsi     # 0x35708
leaq 0x132b3(%rip), %rcx     # 0x35a3d
movl $0xb4, %edx
callq 0x20d0
leaq 0x13552(%rip), %rdi     # 0x35ced
leaq 0x12f66(%rip), %rsi     # 0x35708
leaq 0x13294(%rip), %rcx     # 0x35a3d
movl $0xb5, %edx
callq 0x20d0
leaq 0x1354c(%rip), %rdi     # 0x35d06
leaq 0x12f47(%rip), %rsi     # 0x35708
leaq 0x13275(%rip), %rcx     # 0x35a3d
movl $0xb6, %edx
callq 0x20d0
leaq 0x13542(%rip), %rdi     # 0x35d1b
leaq 0x12f28(%rip), %rsi     # 0x35708
leaq 0x13256(%rip), %rcx     # 0x35a3d
movl $0xb7, %edx
callq 0x20d0
leaq 0x1353c(%rip), %rdi     # 0x35d34
leaq 0x12f09(%rip), %rsi     # 0x35708
leaq 0x13237(%rip), %rcx     # 0x35a3d
movl $0xb8, %edx
callq 0x20d0
leaq 0x13532(%rip), %rdi     # 0x35d49
leaq 0x12eea(%rip), %rsi     # 0x35708
leaq 0x13218(%rip), %rcx     # 0x35a3d
movl $0xb9, %edx
callq 0x20d0
leaq 0x1352c(%rip), %rdi     # 0x35d62
leaq 0x12ecb(%rip), %rsi     # 0x35708
leaq 0x131f9(%rip), %rcx     # 0x35a3d
movl $0xba, %edx
callq 0x20d0
leaq 0x13526(%rip), %rdi     # 0x35d7b
leaq 0x12eac(%rip), %rsi     # 0x35708
leaq 0x131da(%rip), %rcx     # 0x35a3d
movl $0xbb, %edx
callq 0x20d0
leaq 0x13520(%rip), %rdi     # 0x35d94
leaq 0x12e8d(%rip), %rsi     # 0x35708
leaq 0x131bb(%rip), %rcx     # 0x35a3d
movl $0xbc, %edx
callq 0x20d0
leaq 0x13516(%rip), %rdi     # 0x35da9
leaq 0x12e6e(%rip), %rsi     # 0x35708
leaq 0x1319c(%rip), %rcx     # 0x35a3d
movl $0xc0, %edx
callq 0x20d0
leaq 0x1350a(%rip), %rdi     # 0x35dbc
leaq 0x12e4f(%rip), %rsi     # 0x35708
leaq 0x1317d(%rip), %rcx     # 0x35a3d
movl $0xc1, %edx
callq 0x20d0
leaq 0x13501(%rip), %rdi     # 0x35dd2
leaq 0x12e30(%rip), %rsi     # 0x35708
leaq 0x1315e(%rip), %rcx     # 0x35a3d
movl $0xc2, %edx
callq 0x20d0
leaq 0x134fa(%rip), %rdi     # 0x35dea
leaq 0x12e11(%rip), %rsi     # 0x35708
leaq 0x1313f(%rip), %rcx     # 0x35a3d
movl $0xc3, %edx
callq 0x20d0
leaq 0x134f2(%rip), %rdi     # 0x35e01
leaq 0x12df2(%rip), %rsi     # 0x35708
leaq 0x13120(%rip), %rcx     # 0x35a3d
movl $0xc4, %edx
callq 0x20d0
leaq 0x134e9(%rip), %rdi     # 0x35e17
leaq 0x12dd3(%rip), %rsi     # 0x35708
leaq 0x13101(%rip), %rcx     # 0x35a3d
movl $0xc7, %edx
callq 0x20d0
leaq 0x1345c(%rip), %rdi     # 0x35da9
leaq 0x12db4(%rip), %rsi     # 0x35708
leaq 0x130e2(%rip), %rcx     # 0x35a3d
movl $0xc8, %edx
callq 0x20d0
leaq 0x134f8(%rip), %rdi     # 0x35e64
leaq 0x12d95(%rip), %rsi     # 0x35708
leaq 0x130c3(%rip), %rcx     # 0x35a3d
movl $0xc9, %edx
callq 0x20d0
leaq 0x134ee(%rip), %rdi     # 0x35e79
leaq 0x12d76(%rip), %rsi     # 0x35708
leaq 0x130a4(%rip), %rcx     # 0x35a3d
movl $0xca, %edx
callq 0x20d0
leaq 0x134e4(%rip), %rdi     # 0x35e8e
leaq 0x12d57(%rip), %rsi     # 0x35708
leaq 0x13085(%rip), %rcx     # 0x35a3d
movl $0xcb, %edx
callq 0x20d0
leaq 0x134da(%rip), %rdi     # 0x35ea3
leaq 0x12d38(%rip), %rsi     # 0x35708
leaq 0x13066(%rip), %rcx     # 0x35a3d
movl $0xcc, %edx
callq 0x20d0
leaq 0x134d0(%rip), %rdi     # 0x35eb8
leaq 0x12d19(%rip), %rsi     # 0x35708
leaq 0x13047(%rip), %rcx     # 0x35a3d
movl $0xcd, %edx
callq 0x20d0
leaq 0x134c0(%rip), %rdi     # 0x35ec7
leaq 0x12cfa(%rip), %rsi     # 0x35708
leaq 0x13028(%rip), %rcx     # 0x35a3d
movl $0xce, %edx
callq 0x20d0
leaq 0x134b7(%rip), %rdi     # 0x35edd
leaq 0x12cdb(%rip), %rsi     # 0x35708
leaq 0x13009(%rip), %rcx     # 0x35a3d
movl $0xcf, %edx
callq 0x20d0