// File: /workspace/github_cpp_makefile_star2_O2/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 0xa187
leaq 0x906c(%rip), %rsi      # 0x290f4
leaq 0x8(%rsp), %rdi
callq 0xa1b8
testb %al, %al
je 0x2042b
leaq 0x1d0(%rsp), %rdi
leaq 0x8(%rsp), %rsi
pushq $0x1
popq %rdx
callq 0x98c8
testb %al, %al
je 0x2044a
leaq 0x13a57(%rip), %rsi     # 0x33b15
leaq 0x8(%rsp), %rdi
callq 0xa1b8
testb %al, %al
je 0x20469
xorl %eax, %eax
cmpq $0xf, %rax
je 0x20102
cmpl $0x0, 0x8(%rsp,%rax,4)
leaq 0x1(%rax), %rax
je 0x200d2
leaq 0x13a9e(%rip), %rdi     # 0x33b88
leaq 0x136db(%rip), %rsi     # 0x337cc
leaq 0x13a09(%rip), %rcx     # 0x33b01
movl $0x96, %edx
callq 0x20c0
cmpl $-0x1, 0x44(%rsp)
jne 0x20488
pushq $0x10
popq %rax
cmpq $0x15, %rax
je 0x20140
cmpl $0x0, 0x8(%rsp,%rax,4)
leaq 0x1(%rax), %rax
je 0x20110
leaq 0x13a60(%rip), %rdi     # 0x33b88
leaq 0x1369d(%rip), %rsi     # 0x337cc
leaq 0x139cb(%rip), %rcx     # 0x33b01
movl $0x9a, %edx
callq 0x20c0
cmpl $-0x6, 0x5c(%rsp)
jne 0x204a7
cmpl $0x15, 0x158(%rsp)
jne 0x204c6
pushq $0x16
popq %rax
cmpq $0x1d, %rax
je 0x2018c
cmpl $0x0, 0x8(%rsp,%rax,4)
leaq 0x1(%rax), %rax
je 0x2015c
leaq 0x13a14(%rip), %rdi     # 0x33b88
leaq 0x13651(%rip), %rsi     # 0x337cc
leaq 0x1397f(%rip), %rcx     # 0x33b01
movl $0x9f, %edx
callq 0x20c0
cmpl $-0x1, 0x7c(%rsp)
jne 0x204e5
cmpl $0x0, 0x80(%rsp)
jne 0x20504
cmpl $0x0, 0x84(%rsp)
jne 0x20523
cmpl $-0x1, 0x88(%rsp)
jne 0x20542
cmpl $0x0, 0x8c(%rsp)
jne 0x20561
cmpl $-0x1, 0x90(%rsp)
jne 0x20580
cmpl $0x0, 0x94(%rsp)
jne 0x2059f
cmpl $0x0, 0x98(%rsp)
jne 0x205be
cmpl $0x1, 0x9c(%rsp)
jne 0x205dd
cmpl $0x0, 0xa0(%rsp)
jne 0x205fc
cmpl $0x0, 0xa4(%rsp)
jne 0x2061b
cmpl $0x1, 0xa8(%rsp)
jne 0x2063a
cmpl $-0x4, 0xac(%rsp)
jne 0x20659
cmpl $0x0, 0xb0(%rsp)
jne 0x20678
cmpl $-0x1, 0xb4(%rsp)
jne 0x20697
cmpl $0x1, 0xb8(%rsp)
jne 0x206b6
cmpl $0x6, 0xbc(%rsp)
jne 0x206d5
cmpl $0x2d, 0x154(%rsp)
jne 0x206f4
cmpl $0x0, 0xc0(%rsp)
jne 0x20713
cmpl $0x0, 0xc4(%rsp)
jne 0x20732
cmpl $0x0, 0xc8(%rsp)
jne 0x20751
cmpl $0x1, 0xcc(%rsp)
jne 0x20770
cmpl $0x0, 0xd0(%rsp)
jne 0x2078f
cmpl $0x4, 0xd4(%rsp)
jne 0x207ae
cmpl $0x0, 0xd8(%rsp)
jne 0x207cd
cmpl $0x0, 0xdc(%rsp)
jne 0x207ec
cmpl $0x0, 0xe0(%rsp)
jne 0x2080b
cmpl $0x1, 0xe4(%rsp)
jne 0x2082a
pushq $0x38
popq %rax
cmpq $0x40, %rax
je 0x20344
cmpl $0x0, 0x8(%rsp,%rax,4)
leaq 0x1(%rax), %rax
je 0x20314
leaq 0x1385c(%rip), %rdi     # 0x33b88
leaq 0x13499(%rip), %rsi     # 0x337cc
leaq 0x137c7(%rip), %rcx     # 0x33b01
movl $0xbe, %edx
callq 0x20c0
cmpl $0x0, 0x140(%rsp)
jne 0x20849
cmpl $0x40, 0x144(%rsp)
jne 0x20868
cmpl $0x0, 0x148(%rsp)
jne 0x20887
cmpl $0xc, 0x150(%rsp)
jne 0x208a6
cmpl $0x5d, 0x14c(%rsp)
jne 0x208c5
leaq 0xb112(%rip), %rsi      # 0x2b4a3
leaq 0x8(%rsp), %rdi
callq 0xa1b8
testb %al, %al
je 0x208e4
cmpl $0x0, 0x140(%rsp)
jne 0x20903
leaq 0x8(%rsp), %rdi
callq 0xa0ba
testb %al, %al
je 0x20922
leaq 0x8(%rsp), %rdi
callq 0xa0c3
testb %al, %al
je 0x20941
leaq 0x8(%rsp), %rdi
callq 0xa0ce
testb %al, %al
je 0x20960
leaq 0x8(%rsp), %rdi
callq 0xa0da
testb %al, %al
je 0x2097f
cmpl $0x2c, 0x144(%rsp)
jne 0x2099e
cmpl $0x0, 0x150(%rsp)
jne 0x209bd
cmpl $0x1, 0x14c(%rsp)
jne 0x209dc
addq $0x398, %rsp            # imm = 0x398
retq
leaq 0x13685(%rip), %rdi     # 0x33ab7
leaq 0x13393(%rip), %rsi     # 0x337cc
leaq 0x136c1(%rip), %rcx     # 0x33b01
movl $0x90, %edx
callq 0x20c0
leaq 0x1364a(%rip), %rdi     # 0x33a9b
leaq 0x13374(%rip), %rsi     # 0x337cc
leaq 0x136a2(%rip), %rcx     # 0x33b01
movl $0x91, %edx
callq 0x20c0
leaq 0x136d6(%rip), %rdi     # 0x33b46
leaq 0x13355(%rip), %rsi     # 0x337cc
leaq 0x13683(%rip), %rcx     # 0x33b01
movl $0x94, %edx
callq 0x20c0
leaq 0x13712(%rip), %rdi     # 0x33ba1
leaq 0x13336(%rip), %rsi     # 0x337cc
leaq 0x13664(%rip), %rcx     # 0x33b01
movl $0x98, %edx
callq 0x20c0
leaq 0x13709(%rip), %rdi     # 0x33bb7
leaq 0x13317(%rip), %rsi     # 0x337cc
leaq 0x13645(%rip), %rcx     # 0x33b01
movl $0x9c, %edx
callq 0x20c0
leaq 0x13700(%rip), %rdi     # 0x33bcd
leaq 0x132f8(%rip), %rsi     # 0x337cc
leaq 0x13626(%rip), %rcx     # 0x33b01
movl $0x9d, %edx
callq 0x20c0
leaq 0x136f5(%rip), %rdi     # 0x33be1
leaq 0x132d9(%rip), %rsi     # 0x337cc
leaq 0x13607(%rip), %rcx     # 0x33b01
movl $0xa1, %edx
callq 0x20c0
leaq 0x136ec(%rip), %rdi     # 0x33bf7
leaq 0x132ba(%rip), %rsi     # 0x337cc
leaq 0x135e8(%rip), %rcx     # 0x33b01
movl $0xa2, %edx
callq 0x20c0
leaq 0x136e6(%rip), %rdi     # 0x33c10
leaq 0x1329b(%rip), %rsi     # 0x337cc
leaq 0x135c9(%rip), %rcx     # 0x33b01
movl $0xa3, %edx
callq 0x20c0
leaq 0x136e0(%rip), %rdi     # 0x33c29
leaq 0x1327c(%rip), %rsi     # 0x337cc
leaq 0x135aa(%rip), %rcx     # 0x33b01
movl $0xa4, %edx
callq 0x20c0
leaq 0x136d7(%rip), %rdi     # 0x33c3f
leaq 0x1325d(%rip), %rsi     # 0x337cc
leaq 0x1358b(%rip), %rcx     # 0x33b01
movl $0xa5, %edx
callq 0x20c0
leaq 0x136d1(%rip), %rdi     # 0x33c58
leaq 0x1323e(%rip), %rsi     # 0x337cc
leaq 0x1356c(%rip), %rcx     # 0x33b01
movl $0xa6, %edx
callq 0x20c0
leaq 0x136c8(%rip), %rdi     # 0x33c6e
leaq 0x1321f(%rip), %rsi     # 0x337cc
leaq 0x1354d(%rip), %rcx     # 0x33b01
movl $0xa7, %edx
callq 0x20c0
leaq 0x136c2(%rip), %rdi     # 0x33c87
leaq 0x13200(%rip), %rsi     # 0x337cc
leaq 0x1352e(%rip), %rcx     # 0x33b01
movl $0xa8, %edx
callq 0x20c0
leaq 0x136bc(%rip), %rdi     # 0x33ca0
leaq 0x131e1(%rip), %rsi     # 0x337cc
leaq 0x1350f(%rip), %rcx     # 0x33b01
movl $0xa9, %edx
callq 0x20c0
leaq 0x136b2(%rip), %rdi     # 0x33cb5
leaq 0x131c2(%rip), %rsi     # 0x337cc
leaq 0x134f0(%rip), %rcx     # 0x33b01
movl $0xaa, %edx
callq 0x20c0
leaq 0x136ac(%rip), %rdi     # 0x33cce
leaq 0x131a3(%rip), %rsi     # 0x337cc
leaq 0x134d1(%rip), %rcx     # 0x33b01
movl $0xab, %edx
callq 0x20c0
leaq 0x136a6(%rip), %rdi     # 0x33ce7
leaq 0x13184(%rip), %rsi     # 0x337cc
leaq 0x134b2(%rip), %rcx     # 0x33b01
movl $0xac, %edx
callq 0x20c0
leaq 0x1369c(%rip), %rdi     # 0x33cfc
leaq 0x13165(%rip), %rsi     # 0x337cc
leaq 0x13493(%rip), %rcx     # 0x33b01
movl $0xad, %edx
callq 0x20c0
leaq 0x13693(%rip), %rdi     # 0x33d12
leaq 0x13146(%rip), %rsi     # 0x337cc
leaq 0x13474(%rip), %rcx     # 0x33b01
movl $0xae, %edx
callq 0x20c0
leaq 0x1368d(%rip), %rdi     # 0x33d2b
leaq 0x13127(%rip), %rsi     # 0x337cc
leaq 0x13455(%rip), %rcx     # 0x33b01
movl $0xaf, %edx
callq 0x20c0
leaq 0x13684(%rip), %rdi     # 0x33d41
leaq 0x13108(%rip), %rsi     # 0x337cc
leaq 0x13436(%rip), %rcx     # 0x33b01
movl $0xb0, %edx
callq 0x20c0
leaq 0x1367a(%rip), %rdi     # 0x33d56
leaq 0x130e9(%rip), %rsi     # 0x337cc
leaq 0x13417(%rip), %rcx     # 0x33b01
movl $0xb1, %edx
callq 0x20c0
leaq 0x13670(%rip), %rdi     # 0x33d6b
leaq 0x130ca(%rip), %rsi     # 0x337cc
leaq 0x133f8(%rip), %rcx     # 0x33b01
movl $0xb2, %edx
callq 0x20c0
leaq 0x13665(%rip), %rdi     # 0x33d7f
leaq 0x130ab(%rip), %rsi     # 0x337cc
leaq 0x133d9(%rip), %rcx     # 0x33b01
movl $0xb3, %edx
callq 0x20c0
leaq 0x1365f(%rip), %rdi     # 0x33d98
leaq 0x1308c(%rip), %rsi     # 0x337cc
leaq 0x133ba(%rip), %rcx     # 0x33b01
movl $0xb4, %edx
callq 0x20c0
leaq 0x13659(%rip), %rdi     # 0x33db1
leaq 0x1306d(%rip), %rsi     # 0x337cc
leaq 0x1339b(%rip), %rcx     # 0x33b01
movl $0xb5, %edx
callq 0x20c0
leaq 0x13653(%rip), %rdi     # 0x33dca
leaq 0x1304e(%rip), %rsi     # 0x337cc
leaq 0x1337c(%rip), %rcx     # 0x33b01
movl $0xb6, %edx
callq 0x20c0
leaq 0x13649(%rip), %rdi     # 0x33ddf
leaq 0x1302f(%rip), %rsi     # 0x337cc
leaq 0x1335d(%rip), %rcx     # 0x33b01
movl $0xb7, %edx
callq 0x20c0
leaq 0x13643(%rip), %rdi     # 0x33df8
leaq 0x13010(%rip), %rsi     # 0x337cc
leaq 0x1333e(%rip), %rcx     # 0x33b01
movl $0xb8, %edx
callq 0x20c0
leaq 0x13639(%rip), %rdi     # 0x33e0d
leaq 0x12ff1(%rip), %rsi     # 0x337cc
leaq 0x1331f(%rip), %rcx     # 0x33b01
movl $0xb9, %edx
callq 0x20c0
leaq 0x13633(%rip), %rdi     # 0x33e26
leaq 0x12fd2(%rip), %rsi     # 0x337cc
leaq 0x13300(%rip), %rcx     # 0x33b01
movl $0xba, %edx
callq 0x20c0
leaq 0x1362d(%rip), %rdi     # 0x33e3f
leaq 0x12fb3(%rip), %rsi     # 0x337cc
leaq 0x132e1(%rip), %rcx     # 0x33b01
movl $0xbb, %edx
callq 0x20c0
leaq 0x13627(%rip), %rdi     # 0x33e58
leaq 0x12f94(%rip), %rsi     # 0x337cc
leaq 0x132c2(%rip), %rcx     # 0x33b01
movl $0xbc, %edx
callq 0x20c0
leaq 0x1361d(%rip), %rdi     # 0x33e6d
leaq 0x12f75(%rip), %rsi     # 0x337cc
leaq 0x132a3(%rip), %rcx     # 0x33b01
movl $0xc0, %edx
callq 0x20c0
leaq 0x13611(%rip), %rdi     # 0x33e80
leaq 0x12f56(%rip), %rsi     # 0x337cc
leaq 0x13284(%rip), %rcx     # 0x33b01
movl $0xc1, %edx
callq 0x20c0
leaq 0x13608(%rip), %rdi     # 0x33e96
leaq 0x12f37(%rip), %rsi     # 0x337cc
leaq 0x13265(%rip), %rcx     # 0x33b01
movl $0xc2, %edx
callq 0x20c0
leaq 0x13601(%rip), %rdi     # 0x33eae
leaq 0x12f18(%rip), %rsi     # 0x337cc
leaq 0x13246(%rip), %rcx     # 0x33b01
movl $0xc3, %edx
callq 0x20c0
leaq 0x135f9(%rip), %rdi     # 0x33ec5
leaq 0x12ef9(%rip), %rsi     # 0x337cc
leaq 0x13227(%rip), %rcx     # 0x33b01
movl $0xc4, %edx
callq 0x20c0
leaq 0x135f0(%rip), %rdi     # 0x33edb
leaq 0x12eda(%rip), %rsi     # 0x337cc
leaq 0x13208(%rip), %rcx     # 0x33b01
movl $0xc7, %edx
callq 0x20c0
leaq 0x13563(%rip), %rdi     # 0x33e6d
leaq 0x12ebb(%rip), %rsi     # 0x337cc
leaq 0x131e9(%rip), %rcx     # 0x33b01
movl $0xc8, %edx
callq 0x20c0
leaq 0x135ff(%rip), %rdi     # 0x33f28
leaq 0x12e9c(%rip), %rsi     # 0x337cc
leaq 0x131ca(%rip), %rcx     # 0x33b01
movl $0xc9, %edx
callq 0x20c0
leaq 0x135f5(%rip), %rdi     # 0x33f3d
leaq 0x12e7d(%rip), %rsi     # 0x337cc
leaq 0x131ab(%rip), %rcx     # 0x33b01
movl $0xca, %edx
callq 0x20c0
leaq 0x135eb(%rip), %rdi     # 0x33f52
leaq 0x12e5e(%rip), %rsi     # 0x337cc
leaq 0x1318c(%rip), %rcx     # 0x33b01
movl $0xcb, %edx
callq 0x20c0
leaq 0x135e1(%rip), %rdi     # 0x33f67
leaq 0x12e3f(%rip), %rsi     # 0x337cc
leaq 0x1316d(%rip), %rcx     # 0x33b01
movl $0xcc, %edx
callq 0x20c0
leaq 0x135d7(%rip), %rdi     # 0x33f7c
leaq 0x12e20(%rip), %rsi     # 0x337cc
leaq 0x1314e(%rip), %rcx     # 0x33b01
movl $0xcd, %edx
callq 0x20c0
leaq 0x135c7(%rip), %rdi     # 0x33f8b
leaq 0x12e01(%rip), %rsi     # 0x337cc
leaq 0x1312f(%rip), %rcx     # 0x33b01
movl $0xce, %edx
callq 0x20c0
leaq 0x135be(%rip), %rdi     # 0x33fa1
leaq 0x12de2(%rip), %rsi     # 0x337cc
leaq 0x13110(%rip), %rcx     # 0x33b01
movl $0xcf, %edx
callq 0x20c0