// File: /workspace/github_cpp_makefile_star2_O2/jswaff[P]prophet3/test/eval__test.cpp
// Function: test_eval_rook()
void test_eval_rook() {
    position pos;

    set_pos(&pos,"6k1/3R4/8/8/8/8/8/3K4 w - - 0 1");
    int32 score = eval(&pos,false);
    assert(score==rook_val + rook_on_7th + rook_open_file);

    set_pos(&pos,"6k1/3RR3/8/8/8/8/8/3K4 w - - 0 1");
    score = eval(&pos,false);
    assert(score==rook_val*2 + rook_on_7th*2 + connected_majors_on_7th + rook_open_file*2);

    set_pos(&pos,"6k1/3RRr2/8/8/8/8/8/3K4 w - - 0 1");
    score = eval(&pos,false);
    // white has two rooks on open files and black one, so net 1 for white
    assert(score==rook_val + rook_on_7th*2 + connected_majors_on_7th + rook_open_file);

    set_pos(&pos,"6k1/3RRr2/8/8/8/8/r7/3K4 w - - 0 1");
    score = eval(&pos,false);
    assert(score==rook_on_7th + connected_majors_on_7th);

    set_pos(&pos,"6k1/3RRr2/8/8/8/r7/8/3K4 w - - 0 1");
    score = eval(&pos,false);
    // deduct for black for rook on A file
    assert(score==rook_on_7th*2 + connected_majors_on_7th - rook_pst[fliprank[A3]]);

    set_pos(&pos,"6k1/8/8/8/8/8/qr6/7K b - - 0 1");
    score = eval(&pos,false);
    assert(score==queen_val + rook_val + rook_on_7th*2 + connected_majors_on_7th
            + rook_open_file
            + queen_pst[A2]
            - eval_scale(king_safety_pawn_far_away*2+king_safety_pawn_far_away/2,queen_val+rook_val));
}

// Assembly:
pushq %rbx
subq $0x1d0, %rsp            # imm = 0x1D0
leaq 0x1bfca(%rip), %rsi     # 0x2d37d
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0xa1b8
movq %rbx, %rdi
xorl %esi, %esi
callq 0x547b
cmpl $0x23f, %eax            # imm = 0x23F
jne 0x114be
leaq 0x1c006(%rip), %rsi     # 0x2d3e2
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0xa1b8
movq %rbx, %rdi
xorl %esi, %esi
callq 0x547b
cmpl $0x4ce, %eax            # imm = 0x4CE
jne 0x114d7
leaq 0x1c04d(%rip), %rsi     # 0x2d452
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0xa1b8
movq %rbx, %rdi
xorl %esi, %esi
callq 0x547b
cmpl $0x2c1, %eax            # imm = 0x2C1
jne 0x114f0
leaq 0x1c091(%rip), %rsi     # 0x2d4bf
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0xa1b8
movq %rbx, %rdi
xorl %esi, %esi
callq 0x547b
cmpl $0x82, %eax
jne 0x11509
leaq 0x1c0b8(%rip), %rsi     # 0x2d50f
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0xa1b8
movq %rbx, %rdi
xorl %esi, %esi
callq 0x547b
cmpl $0xb9, %eax
jne 0x11522
leaq 0x1c0fa(%rip), %rsi     # 0x2d57a
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0xa1b8
movq %rbx, %rdi
xorl %esi, %esi
callq 0x547b
movl %eax, %ebx
pushq $-0x4b
popq %rdi
movl $0x578, %esi            # imm = 0x578
callq 0x5162
movl $0x644, %ecx            # imm = 0x644
subl %eax, %ecx
cmpl %ecx, %ebx
jne 0x1153b
addq $0x1d0, %rsp            # imm = 0x1D0
popq %rbx
retq
leaq 0x1bed8(%rip), %rdi     # 0x2d39d
leaq 0x1bbed(%rip), %rsi     # 0x2d0b9
leaq 0x1bef9(%rip), %rcx     # 0x2d3cc
pushq $0x35
jmp 0x11552
leaq 0x1bf25(%rip), %rdi     # 0x2d403
leaq 0x1bbd4(%rip), %rsi     # 0x2d0b9
leaq 0x1bee0(%rip), %rcx     # 0x2d3cc
pushq $0x39
jmp 0x11552
leaq 0x1bf7d(%rip), %rdi     # 0x2d474
leaq 0x1bbbb(%rip), %rsi     # 0x2d0b9
leaq 0x1bec7(%rip), %rcx     # 0x2d3cc
pushq $0x3e
jmp 0x11552
leaq 0x1bfd2(%rip), %rdi     # 0x2d4e2
leaq 0x1bba2(%rip), %rsi     # 0x2d0b9
leaq 0x1beae(%rip), %rcx     # 0x2d3cc
pushq $0x42
jmp 0x11552
leaq 0x1c009(%rip), %rdi     # 0x2d532
leaq 0x1bb89(%rip), %rsi     # 0x2d0b9
leaq 0x1be95(%rip), %rcx     # 0x2d3cc
pushq $0x47
jmp 0x11552
leaq 0x1c057(%rip), %rdi     # 0x2d599
leaq 0x1bb70(%rip), %rsi     # 0x2d0b9
leaq 0x1be7c(%rip), %rcx     # 0x2d3cc
pushq $0x4e
popq %rdx
callq 0x20c0