// File: jswaff[P]prophet3/test/pos__test.cpp
// Function: test_remove_castling_availability()
void test_remove_castling_availability() {
    position pos;
    set_pos(&pos,"r3k2r/8/8/8/8/8/8/R3K2R w KQkq - 0 1");
    assert(can_castle_wk(&pos));
    assert(can_castle_wq(&pos));
    assert(can_castle_bk(&pos));
    assert(can_castle_bq(&pos));

    move mv = to_capture(ROOK,A1,A8,ROOK);
    remove_castling_availability(&pos,mv);
    assert(can_castle_wk(&pos));
    assert(!can_castle_wq(&pos));
    assert(can_castle_bk(&pos));
    assert(!can_castle_bq(&pos));

    mv = to_move(KING,E8,E7);
    remove_castling_availability(&pos,mv);
    assert(can_castle_wk(&pos));
    assert(!can_castle_wq(&pos));
    assert(!can_castle_bk(&pos));
    assert(!can_castle_bq(&pos));

    mv = to_move(ROOK,H1,H7);
    remove_castling_availability(&pos,mv);
    assert(pos.castling_rights==0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1d0, %rsp            # imm = 0x1D0
leaq -0x1c8(%rbp), %rdi
leaq 0x14e9e(%rip), %rsi     # 0x42747
callq 0xf3e0
leaq -0x1c8(%rbp), %rdi
callq 0xf1e0
testb $0x1, %al
jne 0x2d8c0
jmp 0x2d8c2
jmp 0x2d8e1
leaq 0x14f51(%rip), %rdi     # 0x4281a
leaq 0x1468d(%rip), %rsi     # 0x41f5d
movl $0xd5, %edx
leaq 0x14e90(%rip), %rcx     # 0x4276c
callq 0x20c0
leaq -0x1c8(%rbp), %rdi
callq 0xf200
testb $0x1, %al
jne 0x2d8f3
jmp 0x2d8f5
jmp 0x2d914
leaq 0x14e9a(%rip), %rdi     # 0x42796
leaq 0x1465a(%rip), %rsi     # 0x41f5d
movl $0xd6, %edx
leaq 0x14e5d(%rip), %rcx     # 0x4276c
callq 0x20c0
leaq -0x1c8(%rbp), %rdi
callq 0xf220
testb $0x1, %al
jne 0x2d926
jmp 0x2d928
jmp 0x2d947
leaq 0x14e91(%rip), %rdi     # 0x427c0
leaq 0x14627(%rip), %rsi     # 0x41f5d
movl $0xd7, %edx
leaq 0x14e2a(%rip), %rcx     # 0x4276c
callq 0x20c0
leaq -0x1c8(%rbp), %rdi
callq 0xf240
testb $0x1, %al
jne 0x2d959
jmp 0x2d95b
jmp 0x2d97a
leaq 0x14e49(%rip), %rdi     # 0x427ab
leaq 0x145f4(%rip), %rsi     # 0x41f5d
movl $0xd8, %edx
leaq 0x14df7(%rip), %rcx     # 0x4276c
callq 0x20c0
movl $0x4, %ecx
movl $0x38, %esi
xorl %edx, %edx
movl %ecx, %edi
callq 0xa890
movq %rax, -0x1d0(%rbp)
movq -0x1d0(%rbp), %rsi
leaq -0x1c8(%rbp), %rdi
callq 0xf2e0
leaq -0x1c8(%rbp), %rdi
callq 0xf1e0
testb $0x1, %al
jne 0x2d9b9
jmp 0x2d9bb
jmp 0x2d9da
leaq 0x14e58(%rip), %rdi     # 0x4281a
leaq 0x14594(%rip), %rsi     # 0x41f5d
movl $0xdc, %edx
leaq 0x14d97(%rip), %rcx     # 0x4276c
callq 0x20c0
leaq -0x1c8(%rbp), %rdi
callq 0xf200
xorb $-0x1, %al
testb $0x1, %al
jne 0x2d9ee
jmp 0x2d9f0
jmp 0x2da0f
leaq 0x14d9e(%rip), %rdi     # 0x42795
leaq 0x1455f(%rip), %rsi     # 0x41f5d
movl $0xdd, %edx
leaq 0x14d62(%rip), %rcx     # 0x4276c
callq 0x20c0
leaq -0x1c8(%rbp), %rdi
callq 0xf220
testb $0x1, %al
jne 0x2da21
jmp 0x2da23
jmp 0x2da42
leaq 0x14d96(%rip), %rdi     # 0x427c0
leaq 0x1452c(%rip), %rsi     # 0x41f5d
movl $0xde, %edx
leaq 0x14d2f(%rip), %rcx     # 0x4276c
callq 0x20c0
leaq -0x1c8(%rbp), %rdi
callq 0xf240
xorb $-0x1, %al
testb $0x1, %al
jne 0x2da56
jmp 0x2da58
jmp 0x2da77
leaq 0x14d4b(%rip), %rdi     # 0x427aa
leaq 0x144f7(%rip), %rsi     # 0x41f5d
movl $0xdf, %edx
leaq 0x14cfa(%rip), %rcx     # 0x4276c
callq 0x20c0
movl $0x6, %edi
movl $0x4, %esi
movl $0xc, %edx
callq 0xa830
movq %rax, -0x1d0(%rbp)
movq -0x1d0(%rbp), %rsi
leaq -0x1c8(%rbp), %rdi
callq 0xf2e0
leaq -0x1c8(%rbp), %rdi
callq 0xf1e0
testb $0x1, %al
jne 0x2dab7
jmp 0x2dab9
jmp 0x2dad8
leaq 0x14d5a(%rip), %rdi     # 0x4281a
leaq 0x14496(%rip), %rsi     # 0x41f5d
movl $0xe3, %edx
leaq 0x14c99(%rip), %rcx     # 0x4276c
callq 0x20c0
leaq -0x1c8(%rbp), %rdi
callq 0xf200
xorb $-0x1, %al
testb $0x1, %al
jne 0x2daec
jmp 0x2daee
jmp 0x2db0d
leaq 0x14ca0(%rip), %rdi     # 0x42795
leaq 0x14461(%rip), %rsi     # 0x41f5d
movl $0xe4, %edx
leaq 0x14c64(%rip), %rcx     # 0x4276c
callq 0x20c0
leaq -0x1c8(%rbp), %rdi
callq 0xf220
xorb $-0x1, %al
testb $0x1, %al
jne 0x2db21
jmp 0x2db23
jmp 0x2db42
leaq 0x14c95(%rip), %rdi     # 0x427bf
leaq 0x1442c(%rip), %rsi     # 0x41f5d
movl $0xe5, %edx
leaq 0x14c2f(%rip), %rcx     # 0x4276c
callq 0x20c0
leaq -0x1c8(%rbp), %rdi
callq 0xf240
xorb $-0x1, %al
testb $0x1, %al
jne 0x2db56
jmp 0x2db58
jmp 0x2db77
leaq 0x14c4b(%rip), %rdi     # 0x427aa
leaq 0x143f7(%rip), %rsi     # 0x41f5d
movl $0xe6, %edx
leaq 0x14bfa(%rip), %rcx     # 0x4276c
callq 0x20c0
movl $0x4, %edi
movl $0x3f, %esi
movl $0xf, %edx
callq 0xa830
movq %rax, -0x1d0(%rbp)
movq -0x1d0(%rbp), %rsi
leaq -0x1c8(%rbp), %rdi
callq 0xf2e0
cmpl $0x0, -0x88(%rbp)
jne 0x2dbb0
jmp 0x2dbcf
leaq 0x14c1d(%rip), %rdi     # 0x427d4
leaq 0x1439f(%rip), %rsi     # 0x41f5d
movl $0xea, %edx
leaq 0x14ba2(%rip), %rcx     # 0x4276c
callq 0x20c0
addq $0x1d0, %rsp            # imm = 0x1D0
popq %rbp
retq
nopl (%rax,%rax)