// File: jswaff[P]prophet3/src/main.cpp
// Function: main
int main(int argc,char *argv[]) {
    setbuf(stdin, NULL);
    setbuf(stdout, NULL);
    init_logfile();

    char input[255];
    print_greeting();
    assert_assumptions();
    init();

    process_args(argc,argv);

    if (hash_size==0) hash_size = default_hash_size;
    print("initializing hash table with %d bytes\n",hash_size);
    init_hash_table(&htbl,hash_size);

    if (pawn_hash_size==0) pawn_hash_size = default_hash_size;
    print("initializing pawn hash table with %d bytes\n",pawn_hash_size);
    init_hash_table(&phtbl,pawn_hash_size);

    assert(run_tests());

    if (tsfile != 0) {
        test_suite(tsfile,tstime);
        exit(0);
    }

    if (book_path != 0) {
        int32 num_moves = open_book_db(book_path);
        print("opened book %s with %d moves.\n",book_path,num_moves);
        assert(test_book());
    }

    while (1) {
        int result=scanf("%s",input);
        if (result==EOF) {
            error("EOF\n");
            exit(1);
        }
        parse_command(input);
    }

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x120, %rsp            # imm = 0x120
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq 0x42960(%rip), %rax     # 0x4cfd0
movq (%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x2270
movq 0x42935(%rip), %rax     # 0x4cfb8
movq (%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x2270
callq 0x8c40
callq 0xa3c0
callq 0xa3f0
callq 0x8bf0
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0xa4c0
cmpl $0x0, 0x87d422(%rip)    # 0x887ad8
jne 0xa6c2
movl $0x10000000, 0x87d416(%rip) # imm = 0x10000000
movl 0x87d410(%rip), %esi    # 0x887ad8
leaq 0x2c217(%rip), %rdi     # 0x368e6
movb $0x0, %al
callq 0x8c60
movl 0x87d3fc(%rip), %esi    # 0x887ad8
leaq 0xf89cd(%rip), %rdi     # 0x1030b0
callq 0x87f0
cmpl $0x0, 0x87d3ed(%rip)    # 0x887adc
jne 0xa6fb
movl $0x10000000, 0x87d3e1(%rip) # imm = 0x10000000
movl 0x87d3db(%rip), %esi    # 0x887adc
leaq 0x2c205(%rip), %rdi     # 0x3690d
movb $0x0, %al
callq 0x8c60
movl 0x87d3c7(%rip), %esi    # 0x887adc
leaq 0xf89c4(%rip), %rdi     # 0x1030e0
callq 0x87f0
callq 0xa400
testb $0x1, %al
jne 0xa72c
jmp 0xa72e
jmp 0xa74d
leaq 0x2c204(%rip), %rdi     # 0x36939
leaq 0x2c209(%rip), %rsi     # 0x36945
movl $0x73, %edx
leaq 0x2c20a(%rip), %rcx     # 0x36952
callq 0x20c0
cmpq $0x0, 0x87d37b(%rip)    # 0x887ad0
je 0xa770
movq 0x87d372(%rip), %rdi    # 0x887ad0
movl 0x42a3c(%rip), %esi     # 0x4d1a0
callq 0x12a30
xorl %edi, %edi
callq 0x21f0
cmpq $0x0, 0x87d350(%rip)    # 0x887ac8
je 0xa7d5
movq 0x87d347(%rip), %rdi    # 0x887ac8
callq 0x59a0
movl %eax, -0x114(%rbp)
movq 0x87d335(%rip), %rsi    # 0x887ac8
movl -0x114(%rbp), %edx
leaq 0x2c1c9(%rip), %rdi     # 0x36969
movb $0x0, %al
callq 0x8c60
callq 0x18d70
testb $0x1, %al
jne 0xa7b2
jmp 0xa7b4
jmp 0xa7d3
leaq 0x2c1cd(%rip), %rdi     # 0x36988
leaq 0x2c183(%rip), %rsi     # 0x36945
movl $0x7d, %edx
leaq 0x2c184(%rip), %rcx     # 0x36952
callq 0x20c0
jmp 0xa7d5
jmp 0xa7d7
leaq -0x110(%rbp), %rsi
leaq 0x2de22(%rip), %rdi     # 0x38607
movb $0x0, %al
callq 0x2190
movl %eax, -0x118(%rbp)
cmpl $-0x1, -0x118(%rbp)
jne 0xa813
leaq 0x2c192(%rip), %rdi     # 0x36994
movb $0x0, %al
callq 0x8f00
movl $0x1, %edi
callq 0x21f0
leaq -0x110(%rbp), %rdi
callq 0x15dc0
jmp 0xa7d7
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)