// File: jswaff[P]prophet3/test/search__test.cpp
// Function: test_draw_50()
void test_draw_50() {
    position pos;
    // minus one rook, to ensure not draw by eval
    set_pos(&pos,"rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/1NBQKBNR w Kkq - 0 1");
    clear_hash_table(&htbl);

    move_line pv; pv.n=0;
    search_stats stats; stats.nodes=0; stats.last_pv.n=0;
    start_timer(10000);

    set_abort_search(false);
    int32 score = search(&pos,&pv,-INF,INF,2,&stats,move_stack,gundos,false);
    assert(score != DRAWSCORE);

    // up to 99 (half) moves ... the extra comes from the root search
    pos.fifty_counter = pos.move_counter= 98;
    start_timer(10000);
    clear_hash_table(&htbl);
    score = search(&pos,&pv,-INF,INF,2,&stats,move_stack,gundos,false);
    assert(score != DRAWSCORE);

    // trigger 50 move rule
    pos.fifty_counter = pos.move_counter = 99;
    start_timer(10000);
    clear_hash_table(&htbl);
    score = search(&pos,&pv,-INF,INF,2,&stats,move_stack,gundos,false);
    assert(score == DRAWSCORE);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb90, %rsp            # imm = 0xB90
leaq -0x1c8(%rbp), %rdi
leaq 0x12fe3(%rip), %rsi     # 0x4343c
callq 0xf3e0
leaq 0xd2c4b(%rip), %rdi     # 0x1030b0
callq 0x88c0
movl $0x0, -0x4f0(%rbp)
movq $0x0, -0xb58(%rbp)
movl $0x0, -0xb48(%rbp)
movl $0x2710, %edi           # imm = 0x2710
callq 0x2f8b0
xorl %edi, %edi
callq 0x10200
leaq -0x1c8(%rbp), %rdi
leaq -0x4f0(%rbp), %rsi
movl $0xfffcf2c0, %edx       # imm = 0xFFFCF2C0
movl $0x30d40, %ecx          # imm = 0x30D40
movl $0x2, %r8d
leaq -0xb70(%rbp), %r9
leaq 0x890aba(%rip), %r10    # 0x8c0f80
leaq 0xa37e3(%rip), %rax     # 0xd3cb0
xorl %r11d, %r11d
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
movl $0x0, 0x10(%rsp)
callq 0x10350
movl %eax, -0xb74(%rbp)
cmpl $0x0, -0xb74(%rbp)
je 0x304f7
jmp 0x30516
leaq 0x12f76(%rip), %rdi     # 0x43474
leaq 0x12ca1(%rip), %rsi     # 0x431a6
movl $0xd2, %edx
leaq 0x12f76(%rip), %rcx     # 0x43487
callq 0x20c0
movl $0x62, -0x84(%rbp)
movl $0x62, -0x80(%rbp)
movl $0x2710, %edi           # imm = 0x2710
callq 0x2f8b0
leaq 0xd2b78(%rip), %rdi     # 0x1030b0
callq 0x88c0
leaq -0x1c8(%rbp), %rdi
leaq -0x4f0(%rbp), %rsi
movl $0xfffcf2c0, %edx       # imm = 0xFFFCF2C0
movl $0x30d40, %ecx          # imm = 0x30D40
movl $0x2, %r8d
leaq -0xb70(%rbp), %r9
leaq 0x890a17(%rip), %r10    # 0x8c0f80
leaq 0xa3740(%rip), %rax     # 0xd3cb0
xorl %r11d, %r11d
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
movl $0x0, 0x10(%rsp)
callq 0x10350
movl %eax, -0xb74(%rbp)
cmpl $0x0, -0xb74(%rbp)
je 0x3059a
jmp 0x305b9
leaq 0x12ed3(%rip), %rdi     # 0x43474
leaq 0x12bfe(%rip), %rsi     # 0x431a6
movl $0xd9, %edx
leaq 0x12ed3(%rip), %rcx     # 0x43487
callq 0x20c0
movl $0x63, -0x84(%rbp)
movl $0x63, -0x80(%rbp)
movl $0x2710, %edi           # imm = 0x2710
callq 0x2f8b0
leaq 0xd2ad5(%rip), %rdi     # 0x1030b0
callq 0x88c0
leaq -0x1c8(%rbp), %rdi
leaq -0x4f0(%rbp), %rsi
movl $0xfffcf2c0, %edx       # imm = 0xFFFCF2C0
movl $0x30d40, %ecx          # imm = 0x30D40
movl $0x2, %r8d
leaq -0xb70(%rbp), %r9
leaq 0x890974(%rip), %r10    # 0x8c0f80
leaq 0xa369d(%rip), %rax     # 0xd3cb0
xorl %r11d, %r11d
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
movl $0x0, 0x10(%rsp)
callq 0x10350
movl %eax, -0xb74(%rbp)
cmpl $0x0, -0xb74(%rbp)
jne 0x3063d
jmp 0x3065c
leaq 0x12e57(%rip), %rdi     # 0x4349b
leaq 0x12b5b(%rip), %rsi     # 0x431a6
movl $0xe0, %edx
leaq 0x12e30(%rip), %rcx     # 0x43487
callq 0x20c0
addq $0xb90, %rsp            # imm = 0xB90
popq %rbp
retq
nopw %cs:(%rax,%rax)