// File: /workspace/github_cpp_makefile_star2_O2/jeffreyan11[P]go-engine/gtp.cpp
// Function: main
int main(int argc, char **argv) {
    // Parse command line arguments and flags with little error checking...
    if (argc == 2) {
        if (argv[1][0] == '-') {
            debugOutput = true;
        }
        else {
            playouts = stoi(string(argv[1]));
        }
    }
    else if (argc == 3) {
        debugOutput = true;

        if (argv[1][0] != '-') {
            playouts = stoi(string(argv[1]));
        }
        else {
            playouts = stoi(string(argv[2]));
        }
    }

    // Do necessary initializations
    initZobristTable();

    string input;

    while (true) {
        getline(cin, input);
        // TODO tab can also be a delimiter
        vector<string> inputVector = split(input, ' ');
        cin.clear();

        // The command is the first word in the string
        string command = inputVector.at(0);


        // Gameplay commands
        if (command == "play") {
            Player p = stringToColor(inputVector.at(1));

            if (p != EMPTY) {
                string moveString = inputVector.at(2);

                // We don't do anything to the board for passes
                if (moveString != "pass" && moveString != "PASS") {
                    char fileChar = moveString[0];
                    int file = 0;
                    if (fileChar >= 'A' && fileChar <= 'Z') {
                        // Board coordinates are 1-indexed
                        file = fileChar - 'A' + 1;
                        // The I character is skipped
                        if (fileChar > 'I')
                            file--;
                    }
                    else {
                        file = fileChar - 'a' + 1;
                        if (fileChar > 'i')
                            file--;
                    }

                    int rank = stoi(moveString.substr(1));
                    Move inputMove = coordToMove(file, rank);
                    lastMove = inputMove;

                    keyStack[keyStackSize] = game.getZobristKey();
                    keyStackSize++;
                    game.doMove(p, inputMove);

                    if (debugOutput) {
                        cerr << endl << "   ";
                        for (int i = 1; i <= boardSize; i++)
                            cerr << COLUMNS[i] << " ";
                        cerr << endl;

                        game.errorPrint();

                        cerr << "   ";
                        for (int i = 1; i <= boardSize; i++)
                            cerr << COLUMNS[i] << " ";
                        cerr << endl;
                    }
                }
                else
                    lastMove = MOVE_PASS;

                cout << "= " << endl << endl;
            }
            else
                cout << "? invalid color" << endl << endl;
        }

        else if (command == "genmove") {
            Player p = stringToColor(inputVector.at(1));

            if (p != EMPTY) {
                auto startTime = std::chrono::high_resolution_clock::now();
                Move m = generateMove(p, lastMove);
                if (debugOutput) {
                    auto endTime = std::chrono::high_resolution_clock::now();
                    std::chrono::duration<double> timeSpan =
                            std::chrono::duration_cast<std::chrono::duration<double>>(
                            endTime-startTime);
                    cerr << "genmove took: " << timeSpan.count() << " sec" << endl;
                }

                lastMove = m;
                if (m == MOVE_PASS)
                    cout << "= pass" << endl << endl;
                else {
                    keyStack[keyStackSize] = game.getZobristKey();
                    keyStackSize++;
                    game.doMove(p, m);

                    if (debugOutput) {
                        cerr << endl << "   ";
                        for (int i = 1; i <= boardSize; i++)
                            cerr << COLUMNS[i] << " ";
                        cerr << endl;

                        game.errorPrint();

                        cerr << "   ";
                        for (int i = 1; i <= boardSize; i++)
                            cerr << COLUMNS[i] << " ";
                        cerr << endl;
                    }

                    cout << "= " << COLUMNS[getX(m)] << getY(m) << endl << endl;
                }
            }
            else
                cout << "? invalid color" << endl << endl;
        }

        else if (command == "fixed_handicap") {
            int numStones = stoi(inputVector.at(1));
            int maxHandicap = (boardSize % 2) == 1 ? 9 : 4;
            if (numStones < 2 || numStones > maxHandicap)
                cout << "? invalid number of stones" << endl << endl;
            else if (!game.isEmpty())
                cout << "? board is not empty" << endl << endl;
            else if (boardSize < 7)
                cout << "? board size too small" << endl << endl;
            else {
                int hLine = (boardSize < 13) ? 3 : 4;
                int low = hLine;
                int mid = (boardSize + 1) / 2;
                int high = boardSize - hLine + 1;
                cout << "? ";
                switch (numStones) {
                    case 9:
                        game.doMove(BLACK, coordToMove(mid, mid));
                        cout << COLUMNS[mid] << mid << " ";
                    case 8:
                        game.doMove(BLACK, coordToMove(mid, high));
                        cout << COLUMNS[mid] << high << " ";
                    case 7:
                        game.doMove(BLACK, coordToMove(mid, low));
                        cout << COLUMNS[mid] << low << " ";
                    case 6:
                        game.doMove(BLACK, coordToMove(high, mid));
                        cout << COLUMNS[high] << mid << " ";
                    case 5:
                        game.doMove(BLACK, coordToMove(low, mid));
                        cout << COLUMNS[low] << mid << " ";
                    case 4:
                        game.doMove(BLACK, coordToMove(high, low));
                        cout << COLUMNS[high] << low << " ";
                    case 3:
                        game.doMove(BLACK, coordToMove(low, high));
                        cout << COLUMNS[low] << high << " ";
                    case 2:
                        game.doMove(BLACK, coordToMove(low, low));
                        game.doMove(BLACK, coordToMove(high, high));
                        cout << COLUMNS[low] << low << " " << COLUMNS[high] << high;
                    default:
                        break;
                }
                cout << endl << endl;
            }
        }


        // Game setup commands
        else if (command == "boardsize") {
            int inputSize = stoi(inputVector.at(1));
            if (inputSize < 3 || inputSize > 21)
                cout << "? unacceptable size" << endl << endl;
            else {
                boardSize = inputSize;
                arraySize = inputSize + 2;
                game.reset();
                resetSearchState();
                cout << "= " << endl << endl;
            }
        }

        else if (command == "clear_board") {
            lastMove = MOVE_PASS;
            game.reset();
            resetSearchState();
            cout << "= " << endl << endl;
        }

        else if (command == "komi") {
            float inputKomi = stof(inputVector.at(1));
            komi = inputKomi;
            cout << "= " << endl << endl;
        }


        // Protocol / information commands
        else if (command == "protocol_version")
            cout << "= 2" << endl << endl;
        else if (command == "name")
            cout << "= " << ENGINE_NAME << endl << endl;
        else if (command == "version")
            cout << "= " << VERSION << endl << endl;
        else if (command == "known_command") {
            bool isKnown = false;
            for (int i = 0; i < NUM_KNOWN_COMMANDS; i++) {
                if (KNOWN_COMMANDS[i] == inputVector.at(1)) {
                    isKnown = true;
                    break;
                }
            }

            if (isKnown)
                cout << "= true" << endl << endl;
            else
                cout << "= false" << endl << endl;
        }
        else if (command == "list_commands") {
            cout << "= " << endl;
            for (int i = 0; i < NUM_KNOWN_COMMANDS; i++) {
                cout << KNOWN_COMMANDS[i] << endl;
            }
            cout << endl;
        }


        // Debugging commands
        else if (command == "showboard") {
            cout << "= " << endl;
            cout << "   ";
            for (int i = 1; i <= boardSize; i++)
                cout << COLUMNS[i] << " ";
            cout << endl;

            game.prettyPrint();

            cout << "   ";
            for (int i = 1; i <= boardSize; i++)
                cout << COLUMNS[i] << " ";
            cout << endl << endl;
        }

        else if (command == "selfplay") {
            Player p = BLACK;
            Move last = 0;
            Move m = MOVE_PASS;

            while (last != MOVE_PASS || m != MOVE_PASS) {
                last = m;
                auto startTime = std::chrono::high_resolution_clock::now();
                m = generateMove(p, last);
                if (debugOutput) {
                    auto endTime = std::chrono::high_resolution_clock::now();
                    std::chrono::duration<double> timeSpan =
                            std::chrono::duration_cast<std::chrono::duration<double>>(
                            endTime-startTime);
                    cerr << "genmove took: " << timeSpan.count() << " sec" << endl;
                }

                if (m != MOVE_PASS) {
                    keyStack[keyStackSize] = game.getZobristKey();
                    keyStackSize++;
                    game.doMove(p, m);
                }

                p = otherPlayer(p);
            }

            cout << "= " << endl << endl;
        }


        else if (command == "quit") {
            cout << "= " << endl << endl;
            break;
        }


        // Otherwise, give an error message indicating an unknown command
        else {
            cout << "? unknown command" << endl << endl;
        }
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
cmpl $0x3, %edi
je 0x64f8
cmpl $0x2, %edi
jne 0x6580
movq 0x8(%rsi), %rsi
cmpb $0x2d, (%rsi)
jne 0x652c
movb $0x1, 0x111bd(%rip)     # 0x176b0
jmp 0x6580
movb $0x1, 0x111b1(%rip)     # 0x176b0
movq 0x8(%rsi), %rax
cmpb $0x2d, (%rax)
jne 0x654c
movq 0x10(%rsi), %rsi
leaq 0x10(%rsp), %rdi
leaq 0x40(%rsp), %rdx
callq 0x762c
leaq 0x10(%rsp), %rdi
pushq $0xa
popq %rdx
xorl %esi, %esi
callq 0x7667
jmp 0x656d
leaq 0x10(%rsp), %rdi
leaq 0x40(%rsp), %rdx
callq 0x762c
leaq 0x10(%rsp), %rdi
pushq $0xa
popq %rdx
xorl %esi, %esi
callq 0x7667
jmp 0x656d
leaq 0x10(%rsp), %rdi
leaq 0x40(%rsp), %rdx
movq %rax, %rsi
callq 0x762c
leaq 0x10(%rsp), %rdi
pushq $0xa
popq %rdx
xorl %esi, %esi
callq 0x7667
leaq 0x4c10(%rip), %rcx      # 0xb184
movl %eax, (%rcx)
leaq 0x10(%rsp), %rdi
callq 0x22c8
callq 0x2a5c
leaq 0x20(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq 0x4a3b(%rip), %rbx      # 0xafd8
leaq 0x10(%rsp), %r14
leaq 0x60(%rsp), %r15
leaq 0x40(%rsp), %r12
movq 0x4a3d(%rip), %rbp      # 0xaff0
leaq 0x4bb6(%rip), %r13      # 0xb170
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2060
movq %r15, %rdi
movq %r14, %rsi
pushq $0x20
popq %rdx
callq 0x74ea
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
xorl %esi, %esi
callq 0x2270
movq %r15, %rdi
xorl %esi, %esi
callq 0x7684
movq %r12, %rdi
movq %rax, %rsi
callq 0x21f0
movq %r12, %rdi
leaq 0x1ae5(%rip), %rsi      # 0x80e8
callq 0x76a5
testb %al, %al
je 0x67a6
movq %r15, %rdi
pushq $0x1
popq %rsi
callq 0x7684
leaq 0xd8(%rsp), %rdi
movq %rax, %rsi
callq 0x21f0
leaq 0xd8(%rsp), %rbx
movq %rbx, %rdi
callq 0x75a6
movl %eax, %r14d
movq %rbx, %rdi
callq 0x22c8
testl %r14d, %r14d
je 0x6975
leaq 0x60(%rsp), %rdi
pushq $0x2
popq %rsi
callq 0x7684
leaq 0x78(%rsp), %r12
movq %r12, %rdi
movq %rax, %rsi
callq 0x21f0
movq %r12, %rdi
leaq 0x1ade(%rip), %rsi      # 0x8154
callq 0x76b2
testb %al, %al
je 0x693c
movq %r12, %rdi
leaq 0x1a95(%rip), %rsi      # 0x8122
callq 0x76b2
testb %al, %al
je 0x693c
movq 0x78(%rsp), %rax
movsbl (%rax), %r15d
cmpl $0x4a, %r15d
movl $0x0, %eax
adcl $-0x41, %eax
leal -0x41(%r15), %ecx
movq %r12, %rsi
xorl %r12d, %r12d
cmpl $0x6a, %r15d
setl %r12b
addl $-0x61, %r12d
cmpb $0x1a, %cl
cmovbl %eax, %r12d
leaq 0xb8(%rsp), %rbx
movq %rbx, %rdi
pushq $0x1
popq %rdx
pushq $-0x1
popq %rcx
callq 0x21c0
movq %rbx, %rdi
xorl %esi, %esi
pushq $0xa
popq %rdx
callq 0x7667
movq %rbx, %rdi
movl %eax, %ebx
addl %r15d, %r12d
callq 0x22c8
shll $0x8, %r12d
orl %r12d, %ebx
movw %bx, 0x4a7e(%rip)       # 0xb188
leaq 0x71c7(%rip), %rdi      # 0xd8d8
callq 0x4e7a
leaq 0x78(%rsp), %r12
leaq 0x101ee(%rip), %rdx     # 0x16910
movslq (%rdx), %rcx
leaq 0x81e4(%rip), %rsi      # 0xe910
movq %rax, (%rsi,%rcx,8)
leal 0x1(%rcx), %eax
movl %eax, (%rdx)
movzwl %bx, %edx
leaq 0x7199(%rip), %rdi      # 0xd8d8
movl %r14d, %esi
callq 0x2cc2
cmpb $0x1, 0x10f62(%rip)     # 0x176b0
jne 0x6945
movq %rbp, %rdi
callq 0x20d0
movq %rax, %rdi
leaq 0x19c1(%rip), %rsi      # 0x8127
callq 0x2190
leaq 0x10c1e(%rip), %rbx     # 0x17390
pushq $0x1
popq %r14
movslq (%r13), %rax
cmpq %rax, %r14
jg 0x6b76
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x2170
movq %rax, %rdi
leaq 0x1991(%rip), %rsi      # 0x8129
callq 0x2190
incq %r14
addq $0x20, %rbx
jmp 0x6776
movq %r12, %rdi
leaq 0x18c6(%rip), %rsi      # 0x8076
callq 0x76a5
testb %al, %al
je 0x688e
movq %r15, %rdi
pushq $0x1
popq %rsi
callq 0x7684
leaq 0x98(%rsp), %rdi
movq %rax, %rsi
callq 0x21f0
leaq 0x98(%rsp), %r14
movq %r14, %rdi
callq 0x75a6
movl %eax, %ebx
movq %r14, %rdi
callq 0x22c8
testl %ebx, %ebx
je 0x6a24
callq 0x2050
movq %rax, %r12
movzwl 0x497f(%rip), %esi      # 0xb188
movl %ebx, %edi
callq 0x5664
movl %eax, %r14d
cmpb $0x1, 0x10e96(%rip)     # 0x176b0
jne 0x6862
callq 0x2050
movq %rax, %r15
movq %rbp, %rdi
leaq 0x1910(%rip), %rsi      # 0x813e
callq 0x2190
subq %r12, %r15
cvtsi2sd %r15, %xmm0
divsd 0x17fd(%rip), %xmm0     # 0x8040
movq %rax, %rdi
callq 0x2250
movq %rax, %rdi
leaq 0x18f8(%rip), %rsi      # 0x814d
callq 0x2190
movq %rax, %rdi
callq 0x20d0
movw %r14w, 0x491e(%rip)     # 0xb188
cmpw $0x8000, %r14w          # imm = 0x8000
jne 0x6a4c
movq 0x473b(%rip), %rdi      # 0xafb8
leaq 0x18ce(%rip), %rsi      # 0x8152
callq 0x2190
jmp 0x6c15
movq %r12, %rdi
leaq 0x1801(%rip), %rsi      # 0x8099
callq 0x76a5
testb %al, %al
je 0x699d
movq %r15, %rdi
pushq $0x1
popq %rsi
callq 0x7684
movq %rax, %rdi
xorl %esi, %esi
pushq $0xa
popq %rdx
callq 0x7667
movl %eax, %ebx
leaq 0x1893(%rip), %rsi      # 0x8159
cmpl $0x2, %eax
jl 0x691b
movl (%r13), %eax
movl $0x80000001, %ecx       # imm = 0x80000001
andl %ecx, %eax
xorl %ecx, %ecx
cmpl $0x1, %eax
sete %cl
leal (%rcx,%rcx,4), %eax
addl $0x4, %eax
leaq 0x186e(%rip), %rsi      # 0x8159
cmpl %eax, %ebx
ja 0x691b
leaq 0x6fe2(%rip), %rdi      # 0xd8d8
callq 0x4e6e
leaq 0x1872(%rip), %rsi      # 0x8174
testb %al, %al
je 0x691b
movl (%r13), %r15d
leaq 0x1878(%rip), %rsi      # 0x8189
cmpl $0x6, %r15d
jg 0x6d2b
movq 0x4696(%rip), %rdi      # 0xafb8
callq 0x2190
movq %rax, %rdi
callq 0x20d0
movq %rax, %rdi
callq 0x20d0
jmp 0x6cc5
movw $0x8000, 0x4843(%rip)   # imm = 0x8000
movq 0x466c(%rip), %rdi      # 0xafb8
leaq 0x17d8(%rip), %rsi      # 0x812b
callq 0x2190
movq %rax, %rdi
callq 0x20d0
movq %rax, %rdi
callq 0x20d0
movq %r12, %rdi
callq 0x22c8
jmp 0x6cc5
movq 0x463c(%rip), %rdi      # 0xafb8
leaq 0x17ab(%rip), %rsi      # 0x812e
callq 0x2190
movq %rax, %rdi
callq 0x20d0
movq %rax, %rdi
callq 0x20d0
jmp 0x6cc5
movq %r12, %rdi
leaq 0x16d7(%rip), %rsi      # 0x807e
callq 0x76a5
testb %al, %al
je 0x6adf
movq %r15, %rdi
pushq $0x1
popq %rsi
callq 0x7684
movq %rax, %rdi
xorl %esi, %esi
pushq $0xa
popq %rdx
callq 0x7667
leal -0x16(%rax), %ecx
leaq 0x17cd(%rip), %rsi      # 0x81a3
cmpl $-0x13, %ecx
jb 0x6a03
movl %eax, (%r13)
addl $0x2, %eax
leaq 0x478b(%rip), %rcx      # 0xb174
movl %eax, (%rcx)
leaq 0x6ee6(%rip), %rdi      # 0xd8d8
callq 0x4e80
callq 0x62ab
leaq 0x1728(%rip), %rsi      # 0x812b
movq 0x45ae(%rip), %rdi      # 0xafb8
callq 0x2190
movq %rax, %rdi
callq 0x20d0
movq %rax, %rdi
callq 0x20d0
jmp 0x6cc5
movq 0x458d(%rip), %rdi      # 0xafb8
leaq 0x16fc(%rip), %rsi      # 0x812e
callq 0x2190
movq %rax, %rdi
callq 0x20d0
movq %rax, %rdi
callq 0x20d0
jmp 0x6cc5
leaq 0x6e85(%rip), %rdi      # 0xd8d8
callq 0x4e7a
leaq 0xfeb1(%rip), %rdx      # 0x16910
movslq (%rdx), %rcx
leaq 0x7ea7(%rip), %rsi      # 0xe910
movq %rax, (%rsi,%rcx,8)
leal 0x1(%rcx), %eax
movl %eax, (%rdx)
movzwl %r14w, %edx
leaq 0x6e5b(%rip), %rdi      # 0xd8d8
movl %ebx, %esi
callq 0x2cc2
cmpb $0x1, 0x10c25(%rip)     # 0x176b0
jne 0x6bd8
movq %rbp, %rdi
callq 0x20d0
movq %rax, %rdi
leaq 0x1684(%rip), %rsi      # 0x8127
callq 0x2190
leaq 0x108e1(%rip), %rbx     # 0x17390
pushq $0x1
popq %r15
movslq (%r13), %rax
cmpq %rax, %r15
jg 0x6b1c
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x2170
movq %rax, %rdi
leaq 0x1658(%rip), %rsi      # 0x8129
callq 0x2190
incq %r15
addq $0x20, %rbx
jmp 0x6ab3
movq %r12, %rdi
leaq 0x159f(%rip), %rsi      # 0x8088
callq 0x76a5
testb %al, %al
je 0x6c37
movw $0x8000, 0x4689(%rip)   # imm = 0x8000
leaq 0x6dd2(%rip), %rdi      # 0xd8d8
callq 0x4e80
callq 0x62ab
leaq 0x1614(%rip), %rsi      # 0x812b
jmp 0x6ca9
movq %rbp, %rdi
callq 0x20d0
leaq 0x6dad(%rip), %rdi      # 0xd8d8
callq 0x4f8c
movq %rbp, %rdi
leaq 0x15ed(%rip), %rsi      # 0x8127
callq 0x2190
leaq 0x1084a(%rip), %rbx     # 0x17390
pushq $0x1
popq %r15
movslq (%r13), %rax
cmpq %rax, %r15
jg 0x6bd0
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x2170
movq %rax, %rdi
leaq 0x15c1(%rip), %rsi      # 0x8129
callq 0x2190
incq %r15
addq $0x20, %rbx
jmp 0x6b4a
movq %rbp, %rdi
callq 0x20d0
leaq 0x6d53(%rip), %rdi      # 0xd8d8
callq 0x4f8c
movq %rbp, %rdi
leaq 0x1593(%rip), %rsi      # 0x8127
callq 0x2190
leaq 0x107f0(%rip), %rbx     # 0x17390
pushq $0x1
popq %r14
movslq (%r13), %rax
cmpq %rax, %r14
jg 0x6c2a
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x2170
movq %rax, %rdi
leaq 0x1567(%rip), %rsi      # 0x8129
callq 0x2190
incq %r14
addq $0x20, %rbx
jmp 0x6ba4
movq %rbp, %rdi
callq 0x20d0
movq 0x43d9(%rip), %rdi      # 0xafb8
leaq 0x1545(%rip), %rsi      # 0x812b
callq 0x2190
movl %r14d, %esi
shrl $0x3, %esi
andl $0x1fe0, %esi           # imm = 0x1FE0
leaq 0x10772(%rip), %rcx     # 0x17370
addq %rcx, %rsi
movq %rax, %rdi
callq 0x2170
movzbl %r14b, %esi
movq %rax, %rdi
callq 0x2280
movq %rax, %rdi
callq 0x20d0
movq %rax, %rdi
callq 0x20d0
jmp 0x6cc5
movq %rbp, %rdi
callq 0x20d0
jmp 0x6945
movq %r12, %rdi
leaq 0x1453(%rip), %rsi      # 0x8094
callq 0x76a5
testb %al, %al
je 0x6c8f
movq %r15, %rdi
pushq $0x1
popq %rsi
callq 0x7684
movq %rax, %rdi
xorl %esi, %esi
callq 0x76bc
leaq 0x451a(%rip), %rax      # 0xb180
movss %xmm0, (%rax)
movq 0x4347(%rip), %rdi      # 0xafb8
leaq 0x14b3(%rip), %rsi      # 0x812b
callq 0x2190
movq %rax, %rdi
callq 0x20d0
movq %rax, %rdi
callq 0x20d0
jmp 0x6cc5
movq %r12, %rdi
leaq 0x140f(%rip), %rsi      # 0x80a8
callq 0x76a5
leaq 0x1512(%rip), %rsi      # 0x81b7
testb %al, %al
je 0x6cf0
movq 0x4308(%rip), %rdi      # 0xafb8
callq 0x2190
movq %rax, %rdi
callq 0x20d0
movq %rax, %rdi
callq 0x20d0
leaq 0x40(%rsp), %r12
movq %r12, %rdi
callq 0x22c8
leaq 0x60(%rsp), %r15
movq %r15, %rdi
callq 0x76fe
movq 0x42f2(%rip), %rbx      # 0xafd8
leaq 0x10(%rsp), %r14
jmp 0x65ba
leaq 0x40(%rsp), %rbx
movq %rbx, %rdi
leaq 0x13ba(%rip), %rsi      # 0x80b9
callq 0x76a5
testb %al, %al
je 0x6d93
movq 0x42a5(%rip), %rdi      # 0xafb8
leaq 0x1411(%rip), %rsi      # 0x812b
callq 0x2190
leaq 0x10442(%rip), %rsi     # 0x17168
jmp 0x6dc0
cmpl $0xd, %r15d
pushq $0x4
popq %r12
sbbl $0x0, %r12d
movq 0x427a(%rip), %rdi      # 0xafb8
leaq 0x145b(%rip), %rsi      # 0x81a0
callq 0x2190
movq %r15, %rdx
incq %rdx
shrq %rdx
subl %r12d, %r15d
incl %r15d
addl $-0x2, %ebx
leaq 0x12e5(%rip), %rcx      # 0x8048
movslq (%rcx,%rbx,4), %rax
addq %rcx, %rax
movq %rdx, 0x8(%rsp)
movl %edx, %r14d
movl %r15d, %ecx
movq %rcx, 0x30(%rsp)
movl %r12d, %ecx
movq %rcx, 0x38(%rsp)
jmpq *%rax
movq 0x8(%rsp), %rax
movl %eax, %ebx
shll $0x8, %ebx
jmp 0x6f46
movq %rbx, %rdi
leaq 0x1314(%rip), %rsi      # 0x80b1
callq 0x76a5
testb %al, %al
je 0x6dcd
movq 0x420b(%rip), %rdi      # 0xafb8
leaq 0x1377(%rip), %rsi      # 0x812b
callq 0x2190
leaq 0x103c8(%rip), %rsi     # 0x17188
movq %rax, %rdi
callq 0x2170
jmp 0x6cb5
movq %rbx, %rdi
leaq 0x12e7(%rip), %rsi      # 0x80be
callq 0x76a5
testb %al, %al
je 0x6e2b
xorl %ebx, %ebx
leaq 0x60(%rsp), %r15
leaq 0x20(%rbx), %r14
cmpq $0x1e0, %r14            # imm = 0x1E0
je 0x7194
movq %r15, %rdi
pushq $0x1
popq %rsi
callq 0x7684
leaq 0x103a6(%rip), %rcx     # 0x171b0
addq %rcx, %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x76d5
movq %r14, %rbx
testb %al, %al
je 0x6de7
leaq 0x1395(%rip), %rsi      # 0x81bb
jmp 0x719b
movq %rbx, %rdi
leaq 0x1297(%rip), %rsi      # 0x80cc
callq 0x76a5
testb %al, %al
je 0x71bc
movq 0x416f(%rip), %rdi      # 0xafb8
leaq 0x12db(%rip), %rsi      # 0x812b
callq 0x2190
movq %rax, %rdi
callq 0x20d0
xorl %ebx, %ebx
cmpq $0x1c0, %rbx            # imm = 0x1C0
je 0x723c
leaq 0x1033d(%rip), %rax     # 0x171b0
leaq (%rax,%rbx), %rsi
movq 0x413a(%rip), %rdi      # 0xafb8
callq 0x2170
movq %rax, %rdi
callq 0x20d0
addq $0x20, %rbx
jmp 0x6e5f
movq 0x8(%rsp), %rcx
movl %ecx, %ebx
shll $0x8, %ebx
movl %ebx, %eax
orl %ecx, %eax
movzwl %ax, %edx
leaq 0x6a2f(%rip), %rdi      # 0xd8d8
pushq $0x1
popq %rsi
callq 0x2cc2
movq 0x8(%rsp), %rsi
shlq $0x5, %rsi
leaq 0x104af(%rip), %rax     # 0x17370
addq %rax, %rsi
movq 0x40ed(%rip), %rdi      # 0xafb8
callq 0x2170
movq %rax, %rdi
movq 0x8(%rsp), %rsi
callq 0x2280
movq %rax, %rdi
leaq 0x1242(%rip), %rsi      # 0x8129
callq 0x2190
jmp 0x6ef8
movq 0x8(%rsp), %rax
movl %eax, %ebx
shll $0x8, %ebx
movl %r15d, %eax
orl %ebx, %eax
movzwl %ax, %edx
leaq 0x69d1(%rip), %rdi      # 0xd8d8
pushq $0x1
popq %rsi
callq 0x2cc2
movq %r14, %rsi
shlq $0x5, %rsi
leaq 0x10453(%rip), %rax     # 0x17370
addq %rax, %rsi
movq 0x4091(%rip), %rdi      # 0xafb8
callq 0x2170
movq %rax, %rdi
movl %r15d, %esi
callq 0x2280
movq %rax, %rdi
leaq 0x11e8(%rip), %rsi      # 0x8129
callq 0x2190
orl %r12d, %ebx
movzwl %bx, %edx
leaq 0x6985(%rip), %rdi      # 0xd8d8
pushq $0x1
popq %rsi
callq 0x2cc2
shlq $0x5, %r14
leaq 0x1040a(%rip), %rax     # 0x17370
addq %rax, %r14
movq 0x4048(%rip), %rdi      # 0xafb8
movq %r14, %rsi
callq 0x2170
movq %rax, %rdi
movl %r12d, %esi
callq 0x2280
movq %rax, %rdi
leaq 0x119c(%rip), %rsi      # 0x8129
callq 0x2190
movl %r15d, %eax
shll $0x8, %eax
orl 0x8(%rsp), %eax
movzwl %ax, %edx
leaq 0x6932(%rip), %rdi      # 0xd8d8
pushq $0x1
popq %rsi
callq 0x2cc2
movq 0x30(%rsp), %rsi
shlq $0x5, %rsi
leaq 0x103b2(%rip), %rax     # 0x17370
addq %rax, %rsi
movq 0x3ff0(%rip), %rdi      # 0xafb8
callq 0x2170
movq %rax, %rdi
movq 0x8(%rsp), %rsi
callq 0x2280
movq %rax, %rdi
leaq 0x1145(%rip), %rsi      # 0x8129
callq 0x2190
movl %r12d, %eax
shll $0x8, %eax
orl 0x8(%rsp), %eax
movzwl %ax, %edx
leaq 0x68db(%rip), %rdi      # 0xd8d8
pushq $0x1
popq %rsi
callq 0x2cc2
movq 0x38(%rsp), %rsi
shlq $0x5, %rsi
leaq 0x1035b(%rip), %rax     # 0x17370
addq %rax, %rsi
movq 0x3f99(%rip), %rdi      # 0xafb8
callq 0x2170
movq %rax, %rdi
movq 0x8(%rsp), %rsi
callq 0x2280
movq %rax, %rdi
leaq 0x10ee(%rip), %rsi      # 0x8129
callq 0x2190
movl %r15d, %eax
shll $0x8, %eax
orl %r12d, %eax
movzwl %ax, %edx
leaq 0x6885(%rip), %rdi      # 0xd8d8
pushq $0x1
popq %rsi
callq 0x2cc2
movq 0x30(%rsp), %rsi
shlq $0x5, %rsi
leaq 0x10305(%rip), %rax     # 0x17370
addq %rax, %rsi
movq 0x3f43(%rip), %rdi      # 0xafb8
callq 0x2170
movq %rax, %rdi
movl %r12d, %esi
callq 0x2280
movq %rax, %rdi
leaq 0x109a(%rip), %rsi      # 0x8129
callq 0x2190
movl %r12d, %eax
shll $0x8, %eax
orl %r15d, %eax
movzwl %ax, %edx
leaq 0x6831(%rip), %rdi      # 0xd8d8
pushq $0x1
popq %rsi
callq 0x2cc2
movq 0x38(%rsp), %rsi
shlq $0x5, %rsi
leaq 0x102b1(%rip), %rax     # 0x17370
addq %rax, %rsi
movq 0x3eef(%rip), %rdi      # 0xafb8
callq 0x2170
movq %rax, %rdi
movl %r15d, %esi
callq 0x2280
movq %rax, %rdi
leaq 0x1046(%rip), %rsi      # 0x8129
callq 0x2190
imull $0x101, %r12d, %eax     # imm = 0x101
movzwl %ax, %edx
leaq 0x67df(%rip), %rdi      # 0xd8d8
pushq $0x1
popq %rsi
callq 0x2cc2
movl %r15d, %eax
shll $0x8, %eax
orl %r15d, %eax
movzwl %ax, %edx
leaq 0x67c4(%rip), %rdi      # 0xd8d8
pushq $0x1
popq %rsi
callq 0x2cc2
movq 0x38(%rsp), %rsi
shlq $0x5, %rsi
leaq 0x10244(%rip), %rax     # 0x17370
addq %rax, %rsi
movq 0x3e82(%rip), %rdi      # 0xafb8
callq 0x2170
movq %rax, %rdi
movl %r12d, %esi
callq 0x2280
movq %rax, %rdi
leaq 0xfd9(%rip), %rsi       # 0x8129
callq 0x2190
movq 0x30(%rsp), %rsi
shlq $0x5, %rsi
leaq 0x1020b(%rip), %rcx     # 0x17370
addq %rcx, %rsi
movq %rax, %rdi
callq 0x2170
movq %rax, %rdi
movl %r15d, %esi
callq 0x2280
movq 0x3e36(%rip), %rdi      # 0xafb8
callq 0x20d0
movq %rax, %rdi
callq 0x20d0
jmp 0x6cc5
leaq 0x1027(%rip), %rsi      # 0x81c2
movq 0x3e16(%rip), %rdi      # 0xafb8
callq 0x2190
movq %rax, %rdi
callq 0x20d0
movq %rax, %rdi
callq 0x20d0
jmp 0x6cc5
movq %rbx, %rdi
leaq 0xf14(%rip), %rsi       # 0x80da
callq 0x76a5
testb %al, %al
je 0x7248
movq 0x3de2(%rip), %rdi      # 0xafb8
leaq 0xf4e(%rip), %rsi       # 0x812b
callq 0x2190
movq %rax, %rdi
callq 0x20d0
movq 0x3dc7(%rip), %rdi      # 0xafb8
leaq 0xf2f(%rip), %rsi       # 0x8127
callq 0x2190
leaq 0x1018c(%rip), %rbx     # 0x17390
pushq $0x1
popq %r14
movslq (%r13), %rax
cmpq %rax, %r14
jg 0x733f
movq 0x3d9c(%rip), %rdi      # 0xafb8
movq %rbx, %rsi
callq 0x2170
movq %rax, %rdi
leaq 0xefb(%rip), %rsi       # 0x8129
callq 0x2190
incq %r14
addq $0x20, %rbx
jmp 0x7208
movq 0x3d75(%rip), %rax      # 0xafb8
jmp 0x6cbd
movq %rbx, %rdi
leaq 0xe92(%rip), %rsi       # 0x80e4
callq 0x76a5
testb %al, %al
je 0x73b1
movw $0x8000, %r15w          # imm = 0x8000
xorl %eax, %eax
pushq $0x1
popq %r12
movl $0x8000, %edx           # imm = 0x8000
xorl %edx, %eax
movl %r15d, %ecx
xorl %edx, %ecx
orw %ax, %cx
je 0x73d1
callq 0x2050
movq %rax, %r14
movzwl %r15w, %esi
movl %r12d, %edi
callq 0x5664
movl %eax, %ebx
movl %r12d, 0x8(%rsp)
cmpb $0x1, 0x1040f(%rip)     # 0x176b0
jne 0x72e9
callq 0x2050
movq %rax, %r12
movq %rbp, %rdi
leaq 0xe89(%rip), %rsi       # 0x813e
callq 0x2190
subq %r14, %r12
cvtsi2sd %r12, %xmm0
divsd 0xd76(%rip), %xmm0      # 0x8040
movq %rax, %rdi
callq 0x2250
movq %rax, %rdi
leaq 0xe71(%rip), %rsi       # 0x814d
callq 0x2190
movq %rax, %rdi
callq 0x20d0
movl %ebx, %eax
negw %ax
movl 0x8(%rsp), %r14d
jo 0x732d
leaq 0x65dc(%rip), %rdi      # 0xd8d8
callq 0x4e7a
leaq 0xf608(%rip), %rdx      # 0x16910
movslq (%rdx), %rcx
leaq 0x75fe(%rip), %rsi      # 0xe910
movq %rax, (%rsi,%rcx,8)
leal 0x1(%rcx), %eax
movl %eax, (%rdx)
movzwl %bx, %edx
leaq 0x65b3(%rip), %rdi      # 0xd8d8
movl %r14d, %esi
callq 0x2cc2
pushq $0x3
popq %r12
subl %r14d, %r12d
movl %r15d, %eax
movl %ebx, %r15d
jmp 0x726a
movq 0x3c72(%rip), %rdi      # 0xafb8
callq 0x20d0
leaq 0x6586(%rip), %rdi      # 0xd8d8
callq 0x4e92
movq 0x3c5a(%rip), %rdi      # 0xafb8
leaq 0xdc2(%rip), %rsi       # 0x8127
callq 0x2190
leaq 0x1001f(%rip), %rbx     # 0x17390
pushq $0x1
popq %r14
movslq (%r13), %rax
cmpq %rax, %r14
jg 0x73a5
movq 0x3c33(%rip), %rdi      # 0xafb8
movq %rbx, %rsi
callq 0x2170
movq %rax, %rdi
leaq 0xd92(%rip), %rsi       # 0x8129
callq 0x2190
incq %r14
addq $0x20, %rbx
jmp 0x7375
movq 0x3c0c(%rip), %rax      # 0xafb8
jmp 0x6cb5
movq %rbx, %rdi
leaq 0xd32(%rip), %rsi       # 0x80ed
callq 0x76a5
leaq 0xe03(%rip), %rsi       # 0x81ca
testb %al, %al
je 0x6ca9
jmp 0x73f9
movq 0x3be0(%rip), %rdi      # 0xafb8
leaq 0xd4c(%rip), %rsi       # 0x812b
callq 0x2190
movq %rax, %rdi
callq 0x20d0
movq %rax, %rdi
callq 0x20d0
jmp 0x6cc5
movq 0x3bb8(%rip), %rdi      # 0xafb8
leaq 0xd24(%rip), %rsi       # 0x812b
callq 0x2190
movq %rax, %rdi
callq 0x20d0
movq %rax, %rdi
callq 0x20d0
leaq 0x40(%rsp), %rdi
callq 0x22c8
leaq 0x60(%rsp), %rdi
callq 0x76fe
leaq 0x10(%rsp), %rdi
callq 0x22c8
xorl %eax, %eax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x74a0
jmp 0x7458
jmp 0x74a0
jmp 0x7458
jmp 0x74a0
movq %rax, %rbx
jmp 0x74e2
jmp 0x74c1
jmp 0x74c1
jmp 0x74c1
jmp 0x74c1
jmp 0x74c1
jmp 0x74c1
jmp 0x74c1
jmp 0x74c1
jmp 0x74c1
movq %rax, %rbx
leaq 0xb8(%rsp), %rdi
callq 0x22c8
jmp 0x74b5
jmp 0x74b2
jmp 0x74c1
jmp 0x74c1
jmp 0x74c1
jmp 0x74c1
jmp 0x74c1
jmp 0x74c1
jmp 0x74c1
jmp 0x74b2
jmp 0x74c1
jmp 0x74c1
jmp 0x74b2
jmp 0x74a9
jmp 0x74a0
movq %rax, %rbx
jmp 0x74d8
jmp 0x74c1
jmp 0x74c1
movq %rax, %rbx
jmp 0x74ce
jmp 0x74b2
jmp 0x74c1
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
callq 0x22c8
jmp 0x74c4
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x22c8
leaq 0x60(%rsp), %rdi
callq 0x76fe
leaq 0x10(%rsp), %rdi
callq 0x22c8
movq %rbx, %rdi
callq 0x2290