// File: /workspace/github_cpp_makefile_star2_O1/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 0xaa43
leaq 0x8e8d(%rip), %rsi      # 0x2b0c4
leaq 0x8(%rsp), %rdi
callq 0xaa74
testb %al, %al
je 0x225ee
leaq 0x1d0(%rsp), %rdi
leaq 0x8(%rsp), %rsi
movl $0x1, %edx
callq 0xa0e0
testb %al, %al
je 0x2260d
leaq 0x13762(%rip), %rsi     # 0x359d1
leaq 0x8(%rsp), %rdi
callq 0xaa74
testb %al, %al
je 0x2262c
xorl %eax, %eax
cmpl $0x0, 0x8(%rsp,%rax,4)
jne 0x22572
incq %rax
cmpq $0xf, %rax
jne 0x22283
cmpl $-0x1, 0x44(%rsp)
jne 0x2264b
movl $0x10, %eax
cmpl $0x0, 0x8(%rsp,%rax,4)
jne 0x22591
incq %rax
cmpq $0x15, %rax
jne 0x222a7
cmpl $-0x6, 0x5c(%rsp)
jne 0x2266a
cmpl $0x15, 0x158(%rsp)
jne 0x22689
movl $0x16, %eax
cmpl $0x0, 0x8(%rsp,%rax,4)
jne 0x225b0
incq %rax
cmpq $0x1d, %rax
jne 0x222d9
cmpl $-0x1, 0x7c(%rsp)
jne 0x226a8
cmpl $0x0, 0x80(%rsp)
jne 0x226c7
cmpl $0x0, 0x84(%rsp)
jne 0x226e6
cmpl $-0x1, 0x88(%rsp)
jne 0x22705
cmpl $0x0, 0x8c(%rsp)
jne 0x22724
cmpl $-0x1, 0x90(%rsp)
jne 0x22743
cmpl $0x0, 0x94(%rsp)
jne 0x22762
cmpl $0x0, 0x98(%rsp)
jne 0x22781
cmpl $0x1, 0x9c(%rsp)
jne 0x227a0
cmpl $0x0, 0xa0(%rsp)
jne 0x227bf
cmpl $0x0, 0xa4(%rsp)
jne 0x227de
cmpl $0x1, 0xa8(%rsp)
jne 0x227fd
cmpl $-0x4, 0xac(%rsp)
jne 0x2281c
cmpl $0x0, 0xb0(%rsp)
jne 0x2283b
cmpl $-0x1, 0xb4(%rsp)
jne 0x2285a
cmpl $0x1, 0xb8(%rsp)
jne 0x22879
cmpl $0x6, 0xbc(%rsp)
jne 0x22898
cmpl $0x2d, 0x154(%rsp)
jne 0x228b7
cmpl $0x0, 0xc0(%rsp)
jne 0x228d6
cmpl $0x0, 0xc4(%rsp)
jne 0x228f5
cmpl $0x0, 0xc8(%rsp)
jne 0x22914
cmpl $0x1, 0xcc(%rsp)
jne 0x22933
cmpl $0x0, 0xd0(%rsp)
jne 0x22952
cmpl $0x4, 0xd4(%rsp)
jne 0x22971
cmpl $0x0, 0xd8(%rsp)
jne 0x22990
cmpl $0x0, 0xdc(%rsp)
jne 0x229af
cmpl $0x0, 0xe0(%rsp)
jne 0x229ce
cmpl $0x1, 0xe4(%rsp)
jne 0x229ed
movl $0x38, %eax
cmpl $0x0, 0x8(%rsp,%rax,4)
jne 0x225cf
incq %rax
cmpq $0x40, %rax
jne 0x22477
cmpl $0x0, 0x140(%rsp)
jne 0x22a0c
cmpl $0x40, 0x144(%rsp)
jne 0x22a2b
cmpl $0x0, 0x148(%rsp)
jne 0x22a4a
cmpl $0xc, 0x150(%rsp)
jne 0x22a69
cmpl $0x5d, 0x14c(%rsp)
jne 0x22a88
leaq 0xaf9b(%rip), %rsi      # 0x2d473
leaq 0x8(%rsp), %rdi
callq 0xaa74
testb %al, %al
je 0x22aa7
cmpl $0x0, 0x140(%rsp)
jne 0x22ac6
leaq 0x8(%rsp), %rdi
callq 0xa966
testb %al, %al
je 0x22ae5
leaq 0x8(%rsp), %rdi
callq 0xa96f
testb %al, %al
je 0x22b04
leaq 0x8(%rsp), %rdi
callq 0xa97a
testb %al, %al
je 0x22b23
leaq 0x8(%rsp), %rdi
callq 0xa986
testb %al, %al
je 0x22b42
cmpl $0x2c, 0x144(%rsp)
jne 0x22b61
cmpl $0x0, 0x150(%rsp)
jne 0x22b80
cmpl $0x1, 0x14c(%rsp)
jne 0x22b9f
addq $0x398, %rsp            # imm = 0x398
retq
leaq 0x134cb(%rip), %rdi     # 0x35a44
leaq 0x13108(%rip), %rsi     # 0x35688
leaq 0x13436(%rip), %rcx     # 0x359bd
movl $0x96, %edx
callq 0x20d0
leaq 0x134ac(%rip), %rdi     # 0x35a44
leaq 0x130e9(%rip), %rsi     # 0x35688
leaq 0x13417(%rip), %rcx     # 0x359bd
movl $0x9a, %edx
callq 0x20d0
leaq 0x1348d(%rip), %rdi     # 0x35a44
leaq 0x130ca(%rip), %rsi     # 0x35688
leaq 0x133f8(%rip), %rcx     # 0x359bd
movl $0x9f, %edx
callq 0x20d0
leaq 0x1346e(%rip), %rdi     # 0x35a44
leaq 0x130ab(%rip), %rsi     # 0x35688
leaq 0x133d9(%rip), %rcx     # 0x359bd
movl $0xbe, %edx
callq 0x20d0
leaq 0x1337e(%rip), %rdi     # 0x35973
leaq 0x1308c(%rip), %rsi     # 0x35688
leaq 0x133ba(%rip), %rcx     # 0x359bd
movl $0x90, %edx
callq 0x20d0
leaq 0x13343(%rip), %rdi     # 0x35957
leaq 0x1306d(%rip), %rsi     # 0x35688
leaq 0x1339b(%rip), %rcx     # 0x359bd
movl $0x91, %edx
callq 0x20d0
leaq 0x133cf(%rip), %rdi     # 0x35a02
leaq 0x1304e(%rip), %rsi     # 0x35688
leaq 0x1337c(%rip), %rcx     # 0x359bd
movl $0x94, %edx
callq 0x20d0
leaq 0x1340b(%rip), %rdi     # 0x35a5d
leaq 0x1302f(%rip), %rsi     # 0x35688
leaq 0x1335d(%rip), %rcx     # 0x359bd
movl $0x98, %edx
callq 0x20d0
leaq 0x13402(%rip), %rdi     # 0x35a73
leaq 0x13010(%rip), %rsi     # 0x35688
leaq 0x1333e(%rip), %rcx     # 0x359bd
movl $0x9c, %edx
callq 0x20d0
leaq 0x133f9(%rip), %rdi     # 0x35a89
leaq 0x12ff1(%rip), %rsi     # 0x35688
leaq 0x1331f(%rip), %rcx     # 0x359bd
movl $0x9d, %edx
callq 0x20d0
leaq 0x133ee(%rip), %rdi     # 0x35a9d
leaq 0x12fd2(%rip), %rsi     # 0x35688
leaq 0x13300(%rip), %rcx     # 0x359bd
movl $0xa1, %edx
callq 0x20d0
leaq 0x133e5(%rip), %rdi     # 0x35ab3
leaq 0x12fb3(%rip), %rsi     # 0x35688
leaq 0x132e1(%rip), %rcx     # 0x359bd
movl $0xa2, %edx
callq 0x20d0
leaq 0x133df(%rip), %rdi     # 0x35acc
leaq 0x12f94(%rip), %rsi     # 0x35688
leaq 0x132c2(%rip), %rcx     # 0x359bd
movl $0xa3, %edx
callq 0x20d0
leaq 0x133d9(%rip), %rdi     # 0x35ae5
leaq 0x12f75(%rip), %rsi     # 0x35688
leaq 0x132a3(%rip), %rcx     # 0x359bd
movl $0xa4, %edx
callq 0x20d0
leaq 0x133d0(%rip), %rdi     # 0x35afb
leaq 0x12f56(%rip), %rsi     # 0x35688
leaq 0x13284(%rip), %rcx     # 0x359bd
movl $0xa5, %edx
callq 0x20d0
leaq 0x133ca(%rip), %rdi     # 0x35b14
leaq 0x12f37(%rip), %rsi     # 0x35688
leaq 0x13265(%rip), %rcx     # 0x359bd
movl $0xa6, %edx
callq 0x20d0
leaq 0x133c1(%rip), %rdi     # 0x35b2a
leaq 0x12f18(%rip), %rsi     # 0x35688
leaq 0x13246(%rip), %rcx     # 0x359bd
movl $0xa7, %edx
callq 0x20d0
leaq 0x133bb(%rip), %rdi     # 0x35b43
leaq 0x12ef9(%rip), %rsi     # 0x35688
leaq 0x13227(%rip), %rcx     # 0x359bd
movl $0xa8, %edx
callq 0x20d0
leaq 0x133b5(%rip), %rdi     # 0x35b5c
leaq 0x12eda(%rip), %rsi     # 0x35688
leaq 0x13208(%rip), %rcx     # 0x359bd
movl $0xa9, %edx
callq 0x20d0
leaq 0x133ab(%rip), %rdi     # 0x35b71
leaq 0x12ebb(%rip), %rsi     # 0x35688
leaq 0x131e9(%rip), %rcx     # 0x359bd
movl $0xaa, %edx
callq 0x20d0
leaq 0x133a5(%rip), %rdi     # 0x35b8a
leaq 0x12e9c(%rip), %rsi     # 0x35688
leaq 0x131ca(%rip), %rcx     # 0x359bd
movl $0xab, %edx
callq 0x20d0
leaq 0x1339f(%rip), %rdi     # 0x35ba3
leaq 0x12e7d(%rip), %rsi     # 0x35688
leaq 0x131ab(%rip), %rcx     # 0x359bd
movl $0xac, %edx
callq 0x20d0
leaq 0x13395(%rip), %rdi     # 0x35bb8
leaq 0x12e5e(%rip), %rsi     # 0x35688
leaq 0x1318c(%rip), %rcx     # 0x359bd
movl $0xad, %edx
callq 0x20d0
leaq 0x1338c(%rip), %rdi     # 0x35bce
leaq 0x12e3f(%rip), %rsi     # 0x35688
leaq 0x1316d(%rip), %rcx     # 0x359bd
movl $0xae, %edx
callq 0x20d0
leaq 0x13386(%rip), %rdi     # 0x35be7
leaq 0x12e20(%rip), %rsi     # 0x35688
leaq 0x1314e(%rip), %rcx     # 0x359bd
movl $0xaf, %edx
callq 0x20d0
leaq 0x1337d(%rip), %rdi     # 0x35bfd
leaq 0x12e01(%rip), %rsi     # 0x35688
leaq 0x1312f(%rip), %rcx     # 0x359bd
movl $0xb0, %edx
callq 0x20d0
leaq 0x13373(%rip), %rdi     # 0x35c12
leaq 0x12de2(%rip), %rsi     # 0x35688
leaq 0x13110(%rip), %rcx     # 0x359bd
movl $0xb1, %edx
callq 0x20d0
leaq 0x13369(%rip), %rdi     # 0x35c27
leaq 0x12dc3(%rip), %rsi     # 0x35688
leaq 0x130f1(%rip), %rcx     # 0x359bd
movl $0xb2, %edx
callq 0x20d0
leaq 0x1335e(%rip), %rdi     # 0x35c3b
leaq 0x12da4(%rip), %rsi     # 0x35688
leaq 0x130d2(%rip), %rcx     # 0x359bd
movl $0xb3, %edx
callq 0x20d0
leaq 0x13358(%rip), %rdi     # 0x35c54
leaq 0x12d85(%rip), %rsi     # 0x35688
leaq 0x130b3(%rip), %rcx     # 0x359bd
movl $0xb4, %edx
callq 0x20d0
leaq 0x13352(%rip), %rdi     # 0x35c6d
leaq 0x12d66(%rip), %rsi     # 0x35688
leaq 0x13094(%rip), %rcx     # 0x359bd
movl $0xb5, %edx
callq 0x20d0
leaq 0x1334c(%rip), %rdi     # 0x35c86
leaq 0x12d47(%rip), %rsi     # 0x35688
leaq 0x13075(%rip), %rcx     # 0x359bd
movl $0xb6, %edx
callq 0x20d0
leaq 0x13342(%rip), %rdi     # 0x35c9b
leaq 0x12d28(%rip), %rsi     # 0x35688
leaq 0x13056(%rip), %rcx     # 0x359bd
movl $0xb7, %edx
callq 0x20d0
leaq 0x1333c(%rip), %rdi     # 0x35cb4
leaq 0x12d09(%rip), %rsi     # 0x35688
leaq 0x13037(%rip), %rcx     # 0x359bd
movl $0xb8, %edx
callq 0x20d0
leaq 0x13332(%rip), %rdi     # 0x35cc9
leaq 0x12cea(%rip), %rsi     # 0x35688
leaq 0x13018(%rip), %rcx     # 0x359bd
movl $0xb9, %edx
callq 0x20d0
leaq 0x1332c(%rip), %rdi     # 0x35ce2
leaq 0x12ccb(%rip), %rsi     # 0x35688
leaq 0x12ff9(%rip), %rcx     # 0x359bd
movl $0xba, %edx
callq 0x20d0
leaq 0x13326(%rip), %rdi     # 0x35cfb
leaq 0x12cac(%rip), %rsi     # 0x35688
leaq 0x12fda(%rip), %rcx     # 0x359bd
movl $0xbb, %edx
callq 0x20d0
leaq 0x13320(%rip), %rdi     # 0x35d14
leaq 0x12c8d(%rip), %rsi     # 0x35688
leaq 0x12fbb(%rip), %rcx     # 0x359bd
movl $0xbc, %edx
callq 0x20d0
leaq 0x13316(%rip), %rdi     # 0x35d29
leaq 0x12c6e(%rip), %rsi     # 0x35688
leaq 0x12f9c(%rip), %rcx     # 0x359bd
movl $0xc0, %edx
callq 0x20d0
leaq 0x1330a(%rip), %rdi     # 0x35d3c
leaq 0x12c4f(%rip), %rsi     # 0x35688
leaq 0x12f7d(%rip), %rcx     # 0x359bd
movl $0xc1, %edx
callq 0x20d0
leaq 0x13301(%rip), %rdi     # 0x35d52
leaq 0x12c30(%rip), %rsi     # 0x35688
leaq 0x12f5e(%rip), %rcx     # 0x359bd
movl $0xc2, %edx
callq 0x20d0
leaq 0x132fa(%rip), %rdi     # 0x35d6a
leaq 0x12c11(%rip), %rsi     # 0x35688
leaq 0x12f3f(%rip), %rcx     # 0x359bd
movl $0xc3, %edx
callq 0x20d0
leaq 0x132f2(%rip), %rdi     # 0x35d81
leaq 0x12bf2(%rip), %rsi     # 0x35688
leaq 0x12f20(%rip), %rcx     # 0x359bd
movl $0xc4, %edx
callq 0x20d0
leaq 0x132e9(%rip), %rdi     # 0x35d97
leaq 0x12bd3(%rip), %rsi     # 0x35688
leaq 0x12f01(%rip), %rcx     # 0x359bd
movl $0xc7, %edx
callq 0x20d0
leaq 0x1325c(%rip), %rdi     # 0x35d29
leaq 0x12bb4(%rip), %rsi     # 0x35688
leaq 0x12ee2(%rip), %rcx     # 0x359bd
movl $0xc8, %edx
callq 0x20d0
leaq 0x132f8(%rip), %rdi     # 0x35de4
leaq 0x12b95(%rip), %rsi     # 0x35688
leaq 0x12ec3(%rip), %rcx     # 0x359bd
movl $0xc9, %edx
callq 0x20d0
leaq 0x132ee(%rip), %rdi     # 0x35df9
leaq 0x12b76(%rip), %rsi     # 0x35688
leaq 0x12ea4(%rip), %rcx     # 0x359bd
movl $0xca, %edx
callq 0x20d0
leaq 0x132e4(%rip), %rdi     # 0x35e0e
leaq 0x12b57(%rip), %rsi     # 0x35688
leaq 0x12e85(%rip), %rcx     # 0x359bd
movl $0xcb, %edx
callq 0x20d0
leaq 0x132da(%rip), %rdi     # 0x35e23
leaq 0x12b38(%rip), %rsi     # 0x35688
leaq 0x12e66(%rip), %rcx     # 0x359bd
movl $0xcc, %edx
callq 0x20d0
leaq 0x132d0(%rip), %rdi     # 0x35e38
leaq 0x12b19(%rip), %rsi     # 0x35688
leaq 0x12e47(%rip), %rcx     # 0x359bd
movl $0xcd, %edx
callq 0x20d0
leaq 0x132c0(%rip), %rdi     # 0x35e47
leaq 0x12afa(%rip), %rsi     # 0x35688
leaq 0x12e28(%rip), %rcx     # 0x359bd
movl $0xce, %edx
callq 0x20d0
leaq 0x132b7(%rip), %rdi     # 0x35e5d
leaq 0x12adb(%rip), %rsi     # 0x35688
leaq 0x12e09(%rip), %rcx     # 0x359bd
movl $0xcf, %edx
callq 0x20d0