// File: /workspace/github_cpp_makefile_star2_O3/NathanWine[P]2048-AI-Solvers/src/Main.cpp
// Function: main
int main(int argc, char** argv) {
    enum ALGORITHMS {MONTECARLO, MINIMAX, EXPECTIMAX};
    std::map<std::string, int> alg_map = {{"montecarlo", MONTECARLO}, {"minimax", MINIMAX}, {"expectimax", EXPECTIMAX}};
    int alg_key = MINIMAX;
    int num_games = 1;
    int num_runs = 25;
    int depth = 1;
    int print_level = 2;

    // Parse command-line arguments
    CmdParser cmd_parser(argc, argv);
    if (cmd_parser.cmdOptionExists("-h") || cmd_parser.cmdOptionExists("--help") 
            || cmd_parser.cmdOptionExists("help") || cmd_parser.cmdOptionExists("usage")) {
        std::string msg = "Usage:\
            \n  AISolver <flag> <flag_val> ...\
            \n  Flag list:\
            \n    -a: Integer/String value; Algorithm to run. 0=montecarlo, 1=minimax, 2=expectimax\
            \n    -n: Integer value; # times to run the algorithm. Stats displayed at program completion\
            \n    -r: Integer value; # runs MonteCarlo completes for each move. Higher=better but slower. Recommend 10-100\
            \n    -d: Integer value; # depth level for Minimax / Expectimax\
            \n    -p: Integer value; Print level. Higher=more display. 0=minimal, 1=medium, 2=high, 3=full\
            \n  Ex: AISolver -a minimax -n 1 -d 1 -p 3";
        std::cout << msg << std::endl;
        return 0;
    }
    if (cmd_parser.cmdOptionExists("-a")) {
        std::string a_arg = cmd_parser.getCmdOption("-a");
        if (isNumber(a_arg)) {
            alg_key = std::stoi(a_arg);
        }
        else {
            lowercase(a_arg);
            alg_key = alg_map[a_arg];
        }
    }
    if (cmd_parser.cmdOptionExists("-n")) {
        std::string n_option = cmd_parser.getCmdOption("-n");
        if (isNumber(n_option)) {
            num_games = std::stoi(n_option);
        }
    }
    if (cmd_parser.cmdOptionExists("-r")) {
        std::string r_option = cmd_parser.getCmdOption("-r");
        if (isNumber(r_option)) {
            num_runs = std::stoi(r_option);
        }
    }
    if (cmd_parser.cmdOptionExists("-d")) {
        std::string d_option = cmd_parser.getCmdOption("-d");
        if (isNumber(d_option)) {
            depth = std::stoi(d_option);
        }
    }
    if (cmd_parser.cmdOptionExists("-p")) {
        std::string p_option = cmd_parser.getCmdOption("-p");
        if (isNumber(p_option)) {
            print_level = std::stoi(p_option);
        }
    }

    // Set up variables for statistics
    int successes = 0;
    std::vector<int> scores;
    std::vector<int> highest_tiles;
    high_resolution_clock::time_point t1 = high_resolution_clock::now();
    switch (alg_key) {          // Run chosen algorithm
        case MONTECARLO:
            successes = monteCarloSolve(num_games, num_runs, print_level, scores, highest_tiles);
            break;
        case MINIMAX:
            successes = minimaxSolve(num_games, depth, print_level, scores, highest_tiles);
            break;
        case EXPECTIMAX:
            successes = expectimaxSolve(num_games, depth, print_level, &scores, &highest_tiles);
    }
    high_resolution_clock::time_point t2 = high_resolution_clock::now();
    duration<double> time_span = duration_cast<duration<double>>(t2 - t1);

    // Display statistics
    if (num_games > 1) {
        std::cout << "Success rate: " << (float) successes / num_games * 100 << "%" << std::endl;
        float average = std::accumulate(scores.begin(), scores.end(), 0.0) / num_games;
        std::cout << "Average score: " << average << std::endl;
        std::cout << "Highest tiles: ";
        for (int i = 0; i < (int) highest_tiles.size(); ++i) {
            std::cout << highest_tiles[i] << ", ";
        }
        std::cout << std::endl;
    }
    else {
        std::cout << (successes > 0 ? "Game won!" : "Game lost.") << std::endl;
        std::cout << "Final score: " << scores[0] << std::endl;
        std::cout << "Highest tile: " << highest_tiles[0] << std::endl;
    }
    std::cout << "Time elapsed: " << time_span.count() << " seconds" << std::endl;

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x158, %rsp            # imm = 0x158
movq %rsi, %rbx
movl %edi, 0xe4(%rsp)
leaq 0x60(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x4ff8(%rip), %rsi      # 0x9184
leaq 0x4ffb(%rip), %rdx      # 0x918e
leaq 0x50(%rsp), %rdi
callq 0x5a1a
leaq 0x88(%rsp), %rax
movl $0x0, -0x18(%rax)
movq %rax, -0x10(%rax)
movl $0x696e696d, (%rax)     # imm = 0x696E696D
movl $0x78616d69, 0x3(%rax)  # imm = 0x78616D69
movq $0x7, -0x8(%rax)
movb $0x0, 0x7(%rax)
movl $0x1, 0x10(%rax)
leaq 0xa0(%rsp), %r14
leaq 0xb0(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x4fac(%rip), %rsi      # 0x9197
leaq 0x4faf(%rip), %rdx      # 0x91a1
movq %r14, %rdi
callq 0x5a1a
leaq 0x50(%rsp), %rsi
movl $0x2, 0x70(%rsi)
leaq 0x128(%rsp), %rdi
leaq 0x10(%rsp), %rcx
leaq 0xe8(%rsp), %r8
movl $0x3, %edx
callq 0x525c
movq $-0x78, %r14
movq -0x10(%r15), %rdi
cmpq %rdi, %r15
je 0x4240
movq (%r15), %rsi
incq %rsi
callq 0x21a0
addq $-0x28, %r15
addq $0x28, %r14
jne 0x422c
leaq 0x38(%rsp), %rdi
leaq 0xe4(%rsp), %rsi
movq %rbx, %rdx
callq 0x52e0
leaq 0x50(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x4f34(%rip), %rsi      # 0x91a2
leaq 0x4f2f(%rip), %rdx      # 0x91a4
callq 0x5a1a
movq 0x38(%rsp), %rdi
movq 0x40(%rsp), %rsi
leaq 0x50(%rsp), %rdx
callq 0x57e5
movb $0x1, %bl
cmpq 0x40(%rsp), %rax
jne 0x43c1
leaq 0x20(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x4efa(%rip), %rsi      # 0x91a5
leaq 0x4ef9(%rip), %rdx      # 0x91ab
leaq 0x10(%rsp), %rdi
callq 0x5a1a
movq 0x38(%rsp), %rdi
movq 0x40(%rsp), %rsi
leaq 0x10(%rsp), %rdx
callq 0x57e5
movb $0x1, %bl
cmpq 0x40(%rsp), %rax
jne 0x43aa
leaq 0xf8(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x4eb7(%rip), %rsi      # 0x91a7
leaq 0x4eb4(%rip), %rdx      # 0x91ab
leaq 0xe8(%rsp), %rdi
callq 0x5a1a
movq 0x38(%rsp), %rdi
movq 0x40(%rsp), %rsi
leaq 0xe8(%rsp), %rdx
callq 0x57e5
movb $0x1, %bl
cmpq 0x40(%rsp), %rax
jne 0x438d
leaq 0x118(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x4e74(%rip), %rsi      # 0x91ac
leaq 0x4e72(%rip), %rdx      # 0x91b1
leaq 0x108(%rsp), %rdi
callq 0x5a1a
movq 0x38(%rsp), %rdi
movq 0x40(%rsp), %rsi
leaq 0x108(%rsp), %rdx
callq 0x57e5
cmpq 0x40(%rsp), %rax
setne %bl
movq 0x108(%rsp), %rdi
cmpq %r12, %rdi
je 0x4388
movq 0x118(%rsp), %rsi
incq %rsi
callq 0x21a0
leaq 0x60(%rsp), %r12
movq 0xe8(%rsp), %rdi
cmpq %r15, %rdi
je 0x43aa
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0x21a0
movq 0x10(%rsp), %rdi
cmpq %r14, %rdi
je 0x43c1
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x21a0
movq 0x50(%rsp), %rdi
cmpq %r12, %rdi
je 0x43d8
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x21a0
leaq 0x50(%rsp), %rdi
testb %bl, %bl
je 0x4452
movq %r12, (%rdi)
leaq 0x4dc7(%rip), %rsi      # 0x91b2
leaq 0x5036(%rip), %rdx      # 0x9428
callq 0x5a1a
movq 0x50(%rsp), %rsi
movq 0x58(%rsp), %rdx
movq 0x8bd0(%rip), %rdi      # 0xcfd8
callq 0x21e0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2110
movq 0x50(%rsp), %rdi
cmpq %r12, %rdi
je 0x4fad
movq 0x60(%rsp), %rsi
incq %rsi
jmp 0x4fa8
movq %r12, (%rdi)
leaq 0x4fcd(%rip), %rsi      # 0x9429
leaq 0x4fc8(%rip), %rdx      # 0x942b
callq 0x5a1a
movq 0x38(%rsp), %rdi
movq 0x40(%rsp), %rsi
leaq 0x50(%rsp), %rdx
callq 0x57e5
movq %rax, %rbx
movq 0x40(%rsp), %r14
movq 0x50(%rsp), %rdi
cmpq %r12, %rdi
je 0x449b
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x21a0
cmpq %r14, %rbx
je 0x458b
leaq 0x20(%rsp), %rbx
movq %rbx, -0x10(%rbx)
leaq 0x4f75(%rip), %rsi      # 0x9429
leaq 0x4f70(%rip), %rdx      # 0x942b
leaq 0x10(%rsp), %rdi
callq 0x5a1a
leaq 0x38(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x53dc
leaq 0x50(%rsp), %rdi
movq %r12, (%rdi)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
callq 0x5984
movq 0x10(%rsp), %rdi
cmpq %rbx, %rdi
je 0x4502
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x21a0
movq 0x50(%rsp), %r14
movq 0x58(%rsp), %rbx
testq %rbx, %rbx
je 0x4528
xorl %eax, %eax
movsbl (%r14,%rax), %ecx
addl $-0x30, %ecx
cmpl $0xa, %ecx
jae 0x4597
incq %rax
cmpq %rax, %rbx
jne 0x4513
callq 0x2050
movq %rax, %r15
movl (%rax), %ebp
movl $0x0, (%rax)
leaq 0x10(%rsp), %r12
movq %r14, %rdi
movq %r12, %rsi
movl $0xa, %edx
callq 0x2210
cmpq %r14, (%r12)
je 0x4fd8
leaq -0x80000000(%rax), %rdx
movabsq $-0x100000000, %rcx     # imm = 0xFFFFFFFF00000000
cmpq %rcx, %rdx
leaq 0x60(%rsp), %r12
jb 0x4fe4
movl (%r15), %ecx
cmpl $0x22, %ecx
je 0x4fe4
testl %ecx, %ecx
jne 0x45c4
movl %ebp, (%r15)
jmp 0x45c4
movl $0x1, %eax
movq %rax, 0x8(%rsp)
jmp 0x45e0
xorl %r15d, %r15d
movzbl (%r14,%r15), %edi
callq 0x2230
movb %al, (%r14,%r15)
incq %r15
cmpq %r15, %rbx
jne 0x459a
leaq 0x128(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x549c
movl (%rax), %eax
movq %rax, 0x8(%rsp)
movq 0x50(%rsp), %rdi
cmpq %r12, %rdi
je 0x45e0
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x21a0
leaq 0x50(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x4e3d(%rip), %rsi      # 0x942c
leaq 0x4e38(%rip), %rdx      # 0x942e
callq 0x5a1a
movq 0x38(%rsp), %rdi
movq 0x40(%rsp), %rsi
leaq 0x50(%rsp), %rdx
callq 0x57e5
movq %rax, %r14
movq 0x40(%rsp), %rbx
movq 0x50(%rsp), %rdi
cmpq %r12, %rdi
je 0x462e
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x21a0
cmpq %rbx, %r14
je 0x4727
leaq 0x20(%rsp), %rbx
movq %rbx, -0x10(%rbx)
leaq 0x4de5(%rip), %rsi      # 0x942c
leaq 0x4de0(%rip), %rdx      # 0x942e
leaq 0x10(%rsp), %rdi
callq 0x5a1a
leaq 0x38(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x53dc
leaq 0x50(%rsp), %rdi
movq %r12, (%rdi)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
callq 0x5984
movq 0x10(%rsp), %rdi
cmpq %rbx, %rdi
je 0x4695
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x21a0
movq 0x50(%rsp), %r15
movq 0x58(%rsp), %rax
testq %rax, %rax
je 0x46bb
xorl %ecx, %ecx
movsbl (%r15,%rcx), %edx
addl $-0x30, %edx
cmpl $0xa, %edx
jae 0x472f
incq %rcx
cmpq %rcx, %rax
jne 0x46a6
callq 0x2050
movq %rax, %r12
movl (%rax), %ebp
movl $0x0, (%rax)
leaq 0x10(%rsp), %r13
movq %r15, %rdi
movq %r13, %rsi
movl $0xa, %edx
callq 0x2210
cmpq %r15, (%r13)
je 0x4ff0
movq %rax, %r14
addq $-0x80000000, %rax      # imm = 0x80000000
movabsq $-0x100000000, %rcx     # imm = 0xFFFFFFFF00000000
cmpq %rcx, %rax
jb 0x4ffc
movl (%r12), %eax
cmpl $0x22, %eax
je 0x4ffc
testl %eax, %eax
jne 0x471b
movl %ebp, (%r12)
movq 0x50(%rsp), %r15
leaq 0x60(%rsp), %r12
jmp 0x4735
movl $0x1, %r14d
jmp 0x474a
movl $0x1, %r14d
cmpq %r12, %r15
je 0x474a
movq 0x60(%rsp), %rsi
incq %rsi
movq %r15, %rdi
callq 0x21a0
leaq 0x50(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x4cd6(%rip), %rsi      # 0x942f
leaq 0x4cd1(%rip), %rdx      # 0x9431
callq 0x5a1a
movq 0x38(%rsp), %rdi
movq 0x40(%rsp), %rsi
leaq 0x50(%rsp), %rdx
callq 0x57e5
movq %rax, %r15
movq 0x40(%rsp), %rbx
movq 0x50(%rsp), %rdi
cmpq %r12, %rdi
je 0x4798
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x21a0
cmpq %rbx, %r15
je 0x489b
leaq 0x20(%rsp), %rbx
movq %rbx, -0x10(%rbx)
leaq 0x4c7e(%rip), %rsi      # 0x942f
leaq 0x4c79(%rip), %rdx      # 0x9431
leaq 0x10(%rsp), %rdi
callq 0x5a1a
leaq 0x38(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x53dc
leaq 0x50(%rsp), %rdi
movq %r12, (%rdi)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
callq 0x5984
movq 0x10(%rsp), %rdi
cmpq %rbx, %rdi
je 0x47ff
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x21a0
movq 0x50(%rsp), %r15
movq 0x58(%rsp), %rax
testq %rax, %rax
je 0x4829
xorl %ecx, %ecx
movsbl (%r15,%rcx), %edx
addl $-0x30, %edx
cmpl $0xa, %edx
jae 0x48aa
incq %rcx
cmpq %rcx, %rax
jne 0x4810
callq 0x2050
movq %rax, %r12
movl (%rax), %ebp
movl $0x0, (%rax)
leaq 0x10(%rsp), %r13
movq %r15, %rdi
movq %r13, %rsi
movl $0xa, %edx
callq 0x2210
cmpq %r15, (%r13)
je 0x5008
leaq -0x80000000(%rax), %rdx
movabsq $-0x100000000, %rcx     # imm = 0xFFFFFFFF00000000
cmpq %rcx, %rdx
jb 0x5014
movl (%r12), %ecx
cmpl $0x22, %ecx
je 0x5014
testl %ecx, %ecx
jne 0x4887
movl %ebp, (%r12)
movq %rax, 0xd8(%rsp)
movq 0x50(%rsp), %r15
leaq 0x60(%rsp), %r12
jmp 0x48b7
movl $0x19, %eax
movq %rax, 0xd8(%rsp)
jmp 0x48cc
movl $0x19, %eax
movq %rax, 0xd8(%rsp)
cmpq %r12, %r15
je 0x48cc
movq 0x60(%rsp), %rsi
incq %rsi
movq %r15, %rdi
callq 0x21a0
leaq 0x50(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x4b57(%rip), %rsi      # 0x9432
leaq 0x4b52(%rip), %rdx      # 0x9434
callq 0x5a1a
movq 0x38(%rsp), %rdi
movq 0x40(%rsp), %rsi
leaq 0x50(%rsp), %rdx
callq 0x57e5
movq %rax, %r15
movq 0x40(%rsp), %rbx
movq 0x50(%rsp), %rdi
cmpq %r12, %rdi
je 0x491a
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x21a0
cmpq %rbx, %r15
je 0x4a13
leaq 0x20(%rsp), %rbx
movq %rbx, -0x10(%rbx)
leaq 0x4aff(%rip), %rsi      # 0x9432
leaq 0x4afa(%rip), %rdx      # 0x9434
leaq 0x10(%rsp), %rdi
callq 0x5a1a
leaq 0x38(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x53dc
leaq 0x50(%rsp), %rdi
movq %r12, (%rdi)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
callq 0x5984
movq 0x10(%rsp), %rdi
cmpq %rbx, %rdi
je 0x4981
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x21a0
movq 0x50(%rsp), %r15
movq 0x58(%rsp), %rax
testq %rax, %rax
je 0x49a7
xorl %ecx, %ecx
movsbl (%r15,%rcx), %edx
addl $-0x30, %edx
cmpl $0xa, %edx
jae 0x4a1b
incq %rcx
cmpq %rcx, %rax
jne 0x4992
callq 0x2050
movq %rax, %r12
movl (%rax), %ebx
movl $0x0, (%rax)
leaq 0x10(%rsp), %rbp
movq %r15, %rdi
movq %rbp, %rsi
movl $0xa, %edx
callq 0x2210
cmpq %r15, (%rbp)
je 0x5020
movq %rax, %r13
addq $-0x80000000, %rax      # imm = 0x80000000
movabsq $-0x100000000, %rcx     # imm = 0xFFFFFFFF00000000
cmpq %rcx, %rax
jb 0x502c
movl (%r12), %eax
cmpl $0x22, %eax
je 0x502c
testl %eax, %eax
jne 0x4a07
movl %ebx, (%r12)
movq 0x50(%rsp), %r15
leaq 0x60(%rsp), %r12
jmp 0x4a21
movl $0x1, %r13d
jmp 0x4a36
movl $0x1, %r13d
cmpq %r12, %r15
je 0x4a36
movq 0x60(%rsp), %rsi
incq %rsi
movq %r15, %rdi
callq 0x21a0
leaq 0x50(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x49f0(%rip), %rsi      # 0x9435
leaq 0x49eb(%rip), %rdx      # 0x9437
callq 0x5a1a
movq 0x38(%rsp), %rdi
movq 0x40(%rsp), %rsi
leaq 0x50(%rsp), %rdx
callq 0x57e5
movq %rax, %r15
movq 0x40(%rsp), %rbx
movq 0x50(%rsp), %rdi
cmpq %r12, %rdi
je 0x4a84
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x21a0
cmpq %rbx, %r15
je 0x4b90
leaq 0x20(%rsp), %rbx
movq %rbx, -0x10(%rbx)
leaq 0x4998(%rip), %rsi      # 0x9435
leaq 0x4993(%rip), %rdx      # 0x9437
leaq 0x10(%rsp), %rdi
callq 0x5a1a
leaq 0x38(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x53dc
leaq 0x50(%rsp), %rdi
movq %r12, (%rdi)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
callq 0x5984
movq 0x10(%rsp), %rdi
cmpq %rbx, %rdi
je 0x4aeb
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x21a0
movq 0x50(%rsp), %r15
movq 0x58(%rsp), %rax
testq %rax, %rax
je 0x4b15
xorl %ecx, %ecx
movsbl (%r15,%rcx), %edx
addl $-0x30, %edx
cmpl $0xa, %edx
jae 0x4b97
incq %rcx
cmpq %rcx, %rax
jne 0x4afc
callq 0x2050
movq %rax, %r12
movl (%rax), %eax
movl %eax, 0xd4(%rsp)
movl $0x0, (%r12)
leaq 0x10(%rsp), %rbx
movq %r15, %rdi
movq %rbx, %rsi
movl $0xa, %edx
callq 0x2210
cmpq %r15, (%rbx)
je 0x5038
movq %rax, %rbp
addq $-0x80000000, %rax      # imm = 0x80000000
movabsq $-0x100000000, %rcx     # imm = 0xFFFFFFFF00000000
cmpq %rcx, %rax
jb 0x5044
movl (%r12), %eax
cmpl $0x22, %eax
je 0x5044
testl %eax, %eax
jne 0x4b84
movl 0xd4(%rsp), %eax
movl %eax, (%r12)
movq 0x50(%rsp), %r15
leaq 0x60(%rsp), %r12
jmp 0x4b9c
movl $0x2, %ebp
jmp 0x4bb1
movl $0x2, %ebp
cmpq %r12, %r15
je 0x4bb1
movq 0x60(%rsp), %rsi
incq %rsi
movq %r15, %rdi
callq 0x21a0
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
xorl %r12d, %r12d
movq %r12, 0x60(%rsp)
movq %r12, 0x20(%rsp)
movaps %xmm0, 0x10(%rsp)
callq 0x2060
movq %rax, %r15
movq 0x8(%rsp), %rax
cmpl $0x2, %eax
je 0x4c1d
cmpl $0x1, %eax
je 0x4c04
testl %eax, %eax
jne 0x4c37
leaq 0x50(%rsp), %rcx
leaq 0x10(%rsp), %r8
movl %r14d, %edi
movq 0xd8(%rsp), %rsi
movl %ebp, %edx
callq 0x2bd6
jmp 0x4c34
leaq 0x50(%rsp), %rcx
leaq 0x10(%rsp), %r8
movl %r14d, %edi
movl %r13d, %esi
movl %ebp, %edx
callq 0x3c70
jmp 0x4c34
leaq 0x50(%rsp), %rcx
leaq 0x10(%rsp), %r8
movl %r14d, %edi
movl %r13d, %esi
movl %ebp, %edx
callq 0x8c15
movl %eax, %r12d
callq 0x2060
movq %rax, %rbx
cmpl $0x2, %r14d
jl 0x4cf0
movq 0x8388(%rip), %rdi      # 0xcfd8
leaq 0x47e1(%rip), %rsi      # 0x9438
movl $0xe, %edx
callq 0x21e0
xorps %xmm0, %xmm0
cvtsi2ss %r12d, %xmm0
cvtsi2ss %r14d, %xmm1
divss %xmm1, %xmm0
mulss 0x4506(%rip), %xmm0     # 0x9180
cvtss2sd %xmm0, %xmm0
movq 0x8353(%rip), %rdi      # 0xcfd8
callq 0x2260
movq %rax, %r12
leaq 0x47b3(%rip), %rsi      # 0x9447
movl $0x1, %edx
movq %rax, %rdi
callq 0x21e0
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %esi
movq %r12, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2110
movq 0x50(%rsp), %rax
movq 0x58(%rsp), %rcx
xorps %xmm1, %xmm1
cmpq %rcx, %rax
je 0x4df7
xorps %xmm0, %xmm0
cvtsi2sdl (%rax), %xmm0
addsd %xmm0, %xmm1
addq $0x4, %rax
jmp 0x4cd6
xorl %edx, %edx
testl %r12d, %r12d
leaq 0x476d(%rip), %rax      # 0x9469
leaq 0x4770(%rip), %rsi      # 0x9473
cmovgq %rax, %rsi
setle %dl
addq $0x9, %rdx
movq 0x82c3(%rip), %r14      # 0xcfd8
movq %r14, %rdi
callq 0x21e0
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %esi
movq 0x829d(%rip), %rdi      # 0xcfd8
callq 0x2030
movq %rax, %rdi
callq 0x2110
movq 0x8289(%rip), %rdi      # 0xcfd8
leaq 0x4728(%rip), %rsi      # 0x947e
movl $0xd, %edx
callq 0x21e0
movq 0x50(%rsp), %rax
movl (%rax), %esi
movq 0x826a(%rip), %rdi      # 0xcfd8
callq 0x22a0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2110
movq 0x8234(%rip), %rdi      # 0xcfd8
leaq 0x46e1(%rip), %rsi      # 0x948c
movl $0xe, %edx
callq 0x21e0
movq 0x10(%rsp), %rax
movl (%rax), %esi
movq 0x8215(%rip), %rdi      # 0xcfd8
callq 0x22a0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2110
jmp 0x4f0a
movsd %xmm1, 0x8(%rsp)
movq 0x81d4(%rip), %rdi      # 0xcfd8
leaq 0x463e(%rip), %rsi      # 0x9449
movl $0xf, %edx
callq 0x21e0
xorps %xmm0, %xmm0
cvtsi2sd %r14d, %xmm0
movsd 0x8(%rsp), %xmm1
divsd %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtsd2ss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
movq 0x819f(%rip), %rdi      # 0xcfd8
callq 0x2260
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2110
movq 0x8169(%rip), %r14      # 0xcfd8
leaq 0x45e3(%rip), %rsi      # 0x9459
movl $0xf, %edx
movq %r14, %rdi
callq 0x21e0
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
subq %rax, %rcx
shrq $0x2, %rcx
testl %ecx, %ecx
jle 0x4edf
xorl %ebp, %ebp
movq 0x8137(%rip), %r12      # 0xcfd8
leaq 0x42c8(%rip), %r13      # 0x9170
movl (%rax,%rbp,4), %esi
movq %r12, %rdi
callq 0x22a0
movl $0x2, %edx
movq %rax, %rdi
movq %r13, %rsi
callq 0x21e0
incq %rbp
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
subq %rax, %rcx
shrq $0x2, %rcx
movslq %ecx, %rcx
cmpq %rcx, %rbp
jl 0x4ea8
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %esi
movq 0x80db(%rip), %rdi      # 0xcfd8
callq 0x2030
movq %rax, %rdi
callq 0x2110
movq 0x80c7(%rip), %rdi      # 0xcfd8
leaq 0x4583(%rip), %rsi      # 0x949b
movl $0xe, %edx
callq 0x21e0
subq %r15, %rbx
xorps %xmm0, %xmm0
cvtsi2sd %rbx, %xmm0
divsd 0x4243(%rip), %xmm0     # 0x9178
movq 0x809c(%rip), %rdi      # 0xcfd8
callq 0x2260
movq %rax, %rbx
leaq 0x455f(%rip), %rsi      # 0x94aa
movl $0x8, %edx
movq %rax, %rdi
callq 0x21e0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2110
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x4f96
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x21a0
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x4fad
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x21a0
leaq 0x38(%rsp), %rdi
callq 0x5518
leaq 0x128(%rsp), %rdi
callq 0x590c
xorl %eax, %eax
addq $0x158, %rsp            # imm = 0x158
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x44d4(%rip), %rdi      # 0x94b3
callq 0x20e0
leaq 0x44c8(%rip), %rdi      # 0x94b3
callq 0x2220
leaq 0x44bc(%rip), %rdi      # 0x94b3
callq 0x20e0
leaq 0x44b0(%rip), %rdi      # 0x94b3
callq 0x2220
leaq 0x44a4(%rip), %rdi      # 0x94b3
callq 0x20e0
leaq 0x4498(%rip), %rdi      # 0x94b3
callq 0x2220
leaq 0x448c(%rip), %rdi      # 0x94b3
callq 0x20e0
leaq 0x4480(%rip), %rdi      # 0x94b3
callq 0x2220
leaq 0x4474(%rip), %rdi      # 0x94b3
callq 0x20e0
leaq 0x4468(%rip), %rdi      # 0x94b3
callq 0x2220
movq %rax, 0x8(%rsp)
movq 0x108(%rsp), %rdi
cmpq %r12, %rdi
je 0x5080
movq 0x118(%rsp), %rsi
incq %rsi
callq 0x21a0
jmp 0x5080
jmp 0x507b
jmp 0x5186
movq %rax, 0x8(%rsp)
movq 0xe8(%rsp), %rdi
cmpq %r15, %rdi
je 0x50c4
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0x21a0
jmp 0x50c4
jmp 0x50bf
jmp 0x519f
jmp 0x519f
jmp 0x519f
jmp 0x519f
jmp 0x519f
jmp 0x5207
movq %rax, 0x8(%rsp)
movq 0x10(%rsp), %rdi
cmpq %r14, %rdi
je 0x518b
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x21a0
jmp 0x518b
jmp 0x5186
movq %rax, 0x8(%rsp)
cmpl $0x0, (%r12)
jne 0x518b
movl 0xd4(%rsp), %eax
movl %eax, (%r12)
jmp 0x518b
movq %rax, 0x8(%rsp)
cmpl $0x0, (%r12)
jne 0x518b
movl %ebx, (%r12)
jmp 0x518b
jmp 0x511d
movq %rax, 0x8(%rsp)
cmpl $0x0, (%r12)
jne 0x518b
movl %ebp, (%r12)
jmp 0x518b
movq %rax, 0x8(%rsp)
cmpl $0x0, (%r15)
jne 0x518b
movl %ebp, (%r15)
jmp 0x518b
jmp 0x51ea
jmp 0x519f
jmp 0x51ea
jmp 0x519f
jmp 0x51ea
jmp 0x519f
jmp 0x51ea
jmp 0x519f
jmp 0x51ea
jmp 0x519f
jmp 0x519f
jmp 0x516c
jmp 0x516c
jmp 0x516c
jmp 0x516c
movq %rax, 0x8(%rsp)
movq 0x10(%rsp), %rdi
cmpq %rbx, %rdi
je 0x523a
movq 0x20(%rsp), %rsi
jmp 0x51fe
movq %rax, 0x8(%rsp)
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
jne 0x51f9
jmp 0x523a
movq %rax, 0x8(%rsp)
jmp 0x523a
movq %rax, 0x8(%rsp)
jmp 0x5244
movq %rax, 0x8(%rsp)
leaq 0xc8(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x2389
jmp 0x5251
movq %rax, 0x8(%rsp)
leaq 0x50(%rsp), %rsi
movq %r14, %rdi
callq 0x2356
jmp 0x5251
movq %rax, 0x8(%rsp)
jmp 0x5251
movq %rax, 0x8(%rsp)
movq 0x50(%rsp), %rdi
cmpq %r12, %rdi
je 0x523a
movq 0x60(%rsp), %rsi
incq %rsi
jmp 0x5235
jmp 0x5207
jmp 0x5207
movq %rax, 0x8(%rsp)
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x5223
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x21a0
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x523a
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x21a0
leaq 0x38(%rsp), %rdi
callq 0x5518
leaq 0x128(%rsp), %rdi
callq 0x590c
movq 0x8(%rsp), %rdi
callq 0x22b0
nop