// File: /workspace/github_cpp_makefile_star2_O1/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 $0x168, %rsp            # imm = 0x168
movq %rsi, %rbx
movl %edi, 0xcc(%rsp)
leaq 0x60(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x5f26(%rip), %rsi      # 0xa154
leaq 0x5f29(%rip), %rdx      # 0xa15e
leaq 0x50(%rsp), %r15
movq %r15, %rdi
callq 0x5bfc
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), %r12
movq %r12, -0x10(%r12)
leaq 0x5ed6(%rip), %rsi      # 0xa167
leaq 0x5ed9(%rip), %rdx      # 0xa171
movq %r14, %rdi
callq 0x5bfc
leaq 0x50(%rsp), %rsi
movl $0x2, 0x70(%rsi)
leaq 0x138(%rsp), %rdi
leaq 0xf8(%rsp), %rcx
leaq 0xd8(%rsp), %r8
movl $0x3, %edx
callq 0x5440
movq $-0x78, %r14
movq -0x10(%r12), %rdi
cmpq %rdi, %r12
je 0x42eb
movq (%r12), %rsi
incq %rsi
callq 0x21a0
addq $-0x28, %r12
addq $0x28, %r14
jne 0x42d5
leaq 0x38(%rsp), %rdi
leaq 0xcc(%rsp), %rsi
movq %rbx, %rdx
callq 0x54c4
leaq 0x50(%rsp), %rdi
movq %r13, (%rdi)
leaq 0x5e59(%rip), %rsi      # 0xa172
leaq 0x5e54(%rip), %rdx      # 0xa174
callq 0x5bfc
movq 0x38(%rsp), %rdi
movq 0x40(%rsp), %rsi
leaq 0x50(%rsp), %rdx
callq 0x59bf
movq %rax, %rbx
movq 0x40(%rsp), %r14
movb $0x1, %bpl
cmpq %r14, %rax
jne 0x4392
leaq 0x108(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x5e19(%rip), %rsi      # 0xa175
leaq 0x5e18(%rip), %rdx      # 0xa17b
leaq 0xf8(%rsp), %rdi
callq 0x5bfc
movq 0x38(%rsp), %rdi
movq 0x40(%rsp), %rsi
leaq 0xf8(%rsp), %rdx
callq 0x59bf
cmpq 0x40(%rsp), %rax
je 0x4cce
xorl %r15d, %r15d
xorl %eax, %eax
testb %al, %al
je 0x43bc
leaq 0x128(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x43bc
movq 0x128(%rsp), %rsi
incq %rsi
callq 0x21a0
testb %r15b, %r15b
je 0x43e2
leaq 0xe8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x43e2
movq 0xe8(%rsp), %rsi
incq %rsi
callq 0x21a0
cmpq %r14, %rbx
jne 0x4408
leaq 0x108(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4408
movq 0x108(%rsp), %rsi
incq %rsi
callq 0x21a0
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x4424
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x21a0
leaq 0x50(%rsp), %rdi
testb %bpl, %bpl
je 0x44a4
leaq 0x60(%rsp), %r14
movq %r14, (%rdi)
leaq 0x5d45(%rip), %rsi      # 0xa182
leaq 0x5fb4(%rip), %rdx      # 0xa3f8
callq 0x5bfc
movq 0x50(%rsp), %rsi
movq 0x58(%rsp), %rdx
movq 0x9b7e(%rip), %rdi      # 0xdfd8
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 %r14, %rdi
je 0x50d5
movq 0x60(%rsp), %rsi
incq %rsi
jmp 0x50d0
leaq 0x60(%rsp), %r12
movq %r12, (%rdi)
leaq 0x5f46(%rip), %rsi      # 0xa3f9
leaq 0x5f41(%rip), %rdx      # 0xa3fb
callq 0x5bfc
movq 0x38(%rsp), %rdi
movq 0x40(%rsp), %rsi
leaq 0x50(%rsp), %rdx
callq 0x59bf
movq %rax, %rbx
movq 0x40(%rsp), %r14
movq 0x50(%rsp), %rdi
cmpq %r12, %rdi
je 0x44f2
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x21a0
cmpq %r14, %rbx
je 0x4600
leaq 0x20(%rsp), %rbx
movq %rbx, -0x10(%rbx)
leaq 0x5eee(%rip), %rsi      # 0xa3f9
leaq 0x5ee9(%rip), %rdx      # 0xa3fb
leaq 0x10(%rsp), %rdi
callq 0x5bfc
leaq 0x38(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x55c0
leaq 0x50(%rsp), %rdi
movq %r12, (%rdi)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
callq 0x5b6c
movq 0x10(%rsp), %rdi
cmpq %rbx, %rdi
je 0x4559
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x21a0
movq 0x50(%rsp), %r14
movq 0x58(%rsp), %rbx
testq %rbx, %rbx
sete %al
je 0x4594
movsbl (%r14), %ecx
addl $-0x30, %ecx
cmpl $0x9, %ecx
ja 0x4594
movl $0x1, %ecx
cmpq %rcx, %rbx
sete %al
je 0x4594
movsbl (%r14,%rcx), %edx
addl $-0x30, %edx
incq %rcx
cmpl $0xa, %edx
jb 0x457c
testb %al, %al
je 0x460c
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 0x5151
leaq -0x80000000(%rax), %rdx
movabsq $-0x100000000, %rcx     # imm = 0xFFFFFFFF00000000
cmpq %rcx, %rdx
jb 0x515d
movl (%r15), %ecx
cmpl $0x22, %ecx
je 0x515d
testl %ecx, %ecx
jne 0x45f4
movl %ebp, (%r15)
movq %rax, 0x8(%rsp)
leaq 0x60(%rsp), %r12
jmp 0x4643
movl $0x1, %eax
movq %rax, 0x8(%rsp)
jmp 0x465a
testq %rbx, %rbx
je 0x462a
xorl %r15d, %r15d
movzbl (%r14,%r15), %edi
callq 0x2230
movb %al, (%r14,%r15)
incq %r15
cmpq %r15, %rbx
jne 0x4614
leaq 0x138(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x5680
movl (%rax), %eax
movq %rax, 0x8(%rsp)
movq 0x50(%rsp), %rdi
cmpq %r12, %rdi
je 0x465a
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x21a0
leaq 0x50(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x5d93(%rip), %rsi      # 0xa3fc
leaq 0x5d8e(%rip), %rdx      # 0xa3fe
callq 0x5bfc
movq 0x38(%rsp), %rdi
movq 0x40(%rsp), %rsi
leaq 0x50(%rsp), %rdx
callq 0x59bf
movq %rax, %r14
movq 0x40(%rsp), %rbx
movq 0x50(%rsp), %rdi
cmpq %r12, %rdi
je 0x46a8
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x21a0
cmpq %rbx, %r14
je 0x47d2
leaq 0x20(%rsp), %rbx
movq %rbx, -0x10(%rbx)
leaq 0x5d3b(%rip), %rsi      # 0xa3fc
leaq 0x5d36(%rip), %rdx      # 0xa3fe
leaq 0x10(%rsp), %rdi
callq 0x5bfc
leaq 0x38(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x55c0
leaq 0x50(%rsp), %rdi
movq %r12, (%rdi)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
callq 0x5b6c
movq 0x10(%rsp), %rdi
cmpq %rbx, %rdi
je 0x470f
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x21a0
movq 0x50(%rsp), %r15
movq 0x58(%rsp), %rcx
testq %rcx, %rcx
sete %al
je 0x474a
movsbl (%r15), %edx
addl $-0x30, %edx
cmpl $0x9, %edx
ja 0x474a
movl $0x1, %edx
cmpq %rdx, %rcx
sete %al
je 0x474a
movsbl (%r15,%rdx), %esi
addl $-0x30, %esi
incq %rdx
cmpl $0xa, %esi
jb 0x4732
movl $0x1, %r14d
testb %al, %al
je 0x47b9
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 0x5169
movq %rax, %r14
addq $-0x80000000, %rax      # imm = 0x80000000
movabsq $-0x100000000, %rcx     # imm = 0xFFFFFFFF00000000
cmpq %rcx, %rax
jb 0x5175
movl (%r12), %eax
cmpl $0x22, %eax
je 0x5175
testl %eax, %eax
jne 0x47b4
movl %ebp, (%r12)
leaq 0x60(%rsp), %r12
movq 0x50(%rsp), %rdi
cmpq %r12, %rdi
je 0x47d8
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x21a0
jmp 0x47d8
movl $0x1, %r14d
leaq 0x50(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x5c18(%rip), %rsi      # 0xa3ff
leaq 0x5c13(%rip), %rdx      # 0xa401
callq 0x5bfc
movq 0x38(%rsp), %rdi
movq 0x40(%rsp), %rsi
leaq 0x50(%rsp), %rdx
callq 0x59bf
movq %rax, %r15
movq 0x40(%rsp), %rbx
movq 0x50(%rsp), %rdi
cmpq %r12, %rdi
je 0x4826
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x21a0
cmpq %rbx, %r15
je 0x4958
leaq 0x20(%rsp), %rbx
movq %rbx, -0x10(%rbx)
leaq 0x5bc0(%rip), %rsi      # 0xa3ff
leaq 0x5bbb(%rip), %rdx      # 0xa401
leaq 0x10(%rsp), %rdi
callq 0x5bfc
leaq 0x38(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x55c0
leaq 0x50(%rsp), %rdi
movq %r12, (%rdi)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
callq 0x5b6c
movq 0x10(%rsp), %rdi
cmpq %rbx, %rdi
je 0x488d
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x21a0
movq 0x50(%rsp), %r15
movq 0x58(%rsp), %rcx
testq %rcx, %rcx
sete %dil
je 0x48ca
movsbl (%r15), %edx
addl $-0x30, %edx
cmpl $0x9, %edx
ja 0x48ca
movl $0x1, %edx
cmpq %rdx, %rcx
sete %dil
je 0x48ca
movsbl (%r15,%rdx), %esi
addl $-0x30, %esi
incq %rdx
cmpl $0xa, %esi
jb 0x48b1
movl $0x19, %eax
testb %dil, %dil
je 0x4937
callq 0x2050
movq %rax, %r13
movl (%rax), %ebp
movl $0x0, (%rax)
leaq 0x10(%rsp), %r12
movq %r15, %rdi
movq %r12, %rsi
movl $0xa, %edx
callq 0x2210
cmpq %r15, (%r12)
je 0x5181
leaq -0x80000000(%rax), %rdx
movabsq $-0x100000000, %rcx     # imm = 0xFFFFFFFF00000000
cmpq %rcx, %rdx
jb 0x518d
movl (%r13), %ecx
cmpl $0x22, %ecx
je 0x518d
testl %ecx, %ecx
jne 0x4932
movl %ebp, (%r13)
leaq 0x60(%rsp), %r12
movq %rax, 0xd0(%rsp)
movq 0x50(%rsp), %rdi
cmpq %r12, %rdi
je 0x4965
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x21a0
jmp 0x4965
movl $0x19, %eax
movq %rax, 0xd0(%rsp)
leaq 0x50(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x5a8e(%rip), %rsi      # 0xa402
leaq 0x5a89(%rip), %rdx      # 0xa404
callq 0x5bfc
movq 0x38(%rsp), %rdi
movq 0x40(%rsp), %rsi
leaq 0x50(%rsp), %rdx
callq 0x59bf
movq %rax, %r15
movq 0x40(%rsp), %rbx
movq 0x50(%rsp), %rdi
cmpq %r12, %rdi
je 0x49b3
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x21a0
cmpq %rbx, %r15
je 0x4adb
leaq 0x20(%rsp), %rbx
movq %rbx, -0x10(%rbx)
leaq 0x5a36(%rip), %rsi      # 0xa402
leaq 0x5a31(%rip), %rdx      # 0xa404
leaq 0x10(%rsp), %rdi
callq 0x5bfc
leaq 0x38(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x55c0
leaq 0x50(%rsp), %rdi
movq %r12, (%rdi)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
callq 0x5b6c
movq 0x10(%rsp), %rdi
cmpq %rbx, %rdi
je 0x4a1a
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x21a0
movq 0x50(%rsp), %r15
movq 0x58(%rsp), %rcx
testq %rcx, %rcx
sete %al
je 0x4a55
movsbl (%r15), %edx
addl $-0x30, %edx
cmpl $0x9, %edx
ja 0x4a55
movl $0x1, %edx
cmpq %rdx, %rcx
sete %al
je 0x4a55
movsbl (%r15,%rdx), %esi
addl $-0x30, %esi
incq %rdx
cmpl $0xa, %esi
jb 0x4a3d
movl $0x1, %r13d
testb %al, %al
je 0x4ac2
callq 0x2050
movq %rax, %rbp
movl (%rax), %ebx
movl $0x0, (%rax)
leaq 0x10(%rsp), %r12
movq %r15, %rdi
movq %r12, %rsi
movl $0xa, %edx
callq 0x2210
cmpq %r15, (%r12)
je 0x5199
movq %rax, %r13
addq $-0x80000000, %rax      # imm = 0x80000000
movabsq $-0x100000000, %rcx     # imm = 0xFFFFFFFF00000000
cmpq %rcx, %rax
jb 0x51a5
movl (%rbp), %eax
cmpl $0x22, %eax
je 0x51a5
testl %eax, %eax
jne 0x4abd
movl %ebx, (%rbp)
leaq 0x60(%rsp), %r12
movq 0x50(%rsp), %rdi
cmpq %r12, %rdi
je 0x4ae1
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x21a0
jmp 0x4ae1
movl $0x1, %r13d
leaq 0x50(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x5915(%rip), %rsi      # 0xa405
leaq 0x5910(%rip), %rdx      # 0xa407
callq 0x5bfc
movq 0x38(%rsp), %rdi
movq 0x40(%rsp), %rsi
leaq 0x50(%rsp), %rdx
callq 0x59bf
movq %rax, %r15
movq 0x40(%rsp), %rbx
movq 0x50(%rsp), %rdi
cmpq %r12, %rdi
je 0x4b2f
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x21a0
cmpq %rbx, %r15
je 0x4c67
leaq 0x20(%rsp), %rbx
movq %rbx, -0x10(%rbx)
leaq 0x58bd(%rip), %rsi      # 0xa405
leaq 0x58b8(%rip), %rdx      # 0xa407
leaq 0x10(%rsp), %rdi
callq 0x5bfc
leaq 0x38(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x55c0
leaq 0x50(%rsp), %rdi
movq %r12, (%rdi)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
callq 0x5b6c
movq 0x10(%rsp), %rdi
cmpq %rbx, %rdi
je 0x4b96
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x21a0
movq 0x50(%rsp), %r15
movq 0x58(%rsp), %rcx
testq %rcx, %rcx
sete %al
je 0x4bd1
movsbl (%r15), %edx
addl $-0x30, %edx
cmpl $0x9, %edx
ja 0x4bd1
movl $0x1, %edx
cmpq %rdx, %rcx
sete %al
je 0x4bd1
movsbl (%r15,%rdx), %esi
addl $-0x30, %esi
incq %rdx
cmpl $0xa, %esi
jb 0x4bb9
movl $0x2, %ebp
testb %al, %al
je 0x4c49
callq 0x2050
movq %rax, %r12
movl (%rax), %eax
movl %eax, 0xc8(%rsp)
movl $0x0, (%r12)
leaq 0x10(%rsp), %rbx
movq %r15, %rdi
movq %rbx, %rsi
movl $0xa, %edx
callq 0x2210
cmpq %r15, (%rbx)
je 0x51b1
movq %rax, %rbp
addq $-0x80000000, %rax      # imm = 0x80000000
movabsq $-0x100000000, %rcx     # imm = 0xFFFFFFFF00000000
cmpq %rcx, %rax
jb 0x51bd
movl (%r12), %eax
cmpl $0x22, %eax
je 0x51bd
testl %eax, %eax
jne 0x4c49
movl 0xc8(%rsp), %eax
movl %eax, (%r12)
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x4c6c
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x21a0
jmp 0x4c6c
movl $0x2, %ebp
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
xorl %r15d, %r15d
movq %r15, 0x60(%rsp)
movq %r15, 0x20(%rsp)
movaps %xmm0, 0x10(%rsp)
callq 0x2060
movq %rax, %r12
movq 0x8(%rsp), %rax
cmpl $0x2, %eax
je 0x4d3e
cmpl $0x1, %eax
je 0x4d25
testl %eax, %eax
jne 0x4d58
leaq 0x50(%rsp), %rcx
leaq 0x10(%rsp), %r8
movl %r14d, %edi
movq 0xd0(%rsp), %rsi
movl %ebp, %edx
callq 0x2c4d
jmp 0x4d55
leaq 0xe8(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x5495(%rip), %rsi      # 0xa177
leaq 0x5492(%rip), %rdx      # 0xa17b
leaq 0xd8(%rsp), %rdi
callq 0x5bfc
movq 0x38(%rsp), %rdi
movq 0x40(%rsp), %rsi
leaq 0xd8(%rsp), %rdx
callq 0x59bf
cmpq 0x40(%rsp), %rax
je 0x5100
movb $0x1, %r15b
xorl %eax, %eax
movb $0x1, %bpl
jmp 0x4397
leaq 0x50(%rsp), %rcx
leaq 0x10(%rsp), %r8
movl %r14d, %edi
movl %r13d, %esi
movl %ebp, %edx
callq 0x3d1b
jmp 0x4d55
leaq 0x50(%rsp), %rcx
leaq 0x10(%rsp), %r8
movl %r14d, %edi
movl %r13d, %esi
movl %ebp, %edx
callq 0x8d7e
movl %eax, %r15d
callq 0x2060
movq %rax, %rbx
cmpl $0x2, %r14d
jl 0x4e10
movq 0x9267(%rip), %rdi      # 0xdfd8
leaq 0x5690(%rip), %rsi      # 0xa408
movl $0xe, %edx
callq 0x21e0
xorps %xmm0, %xmm0
cvtsi2ss %r15d, %xmm0
cvtsi2ss %r14d, %xmm1
divss %xmm1, %xmm0
mulss 0x53b5(%rip), %xmm0     # 0xa150
cvtss2sd %xmm0, %xmm0
movq 0x9232(%rip), %rdi      # 0xdfd8
callq 0x2260
movq %rax, %r15
leaq 0x5662(%rip), %rsi      # 0xa417
movl $0x1, %edx
movq %rax, %rdi
callq 0x21e0
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %esi
movq %r15, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2110
movq 0x50(%rsp), %rax
movq 0x58(%rsp), %rcx
xorps %xmm1, %xmm1
cmpq %rcx, %rax
je 0x4f17
xorps %xmm0, %xmm0
cvtsi2sdl (%rax), %xmm0
addsd %xmm0, %xmm1
addq $0x4, %rax
jmp 0x4df6
xorl %edx, %edx
testl %r15d, %r15d
leaq 0x561d(%rip), %rax      # 0xa439
leaq 0x5620(%rip), %rsi      # 0xa443
cmovgq %rax, %rsi
setle %dl
addq $0x9, %rdx
movq 0x91a3(%rip), %r14      # 0xdfd8
movq %r14, %rdi
callq 0x21e0
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %esi
movq 0x917d(%rip), %rdi      # 0xdfd8
callq 0x2030
movq %rax, %rdi
callq 0x2110
movq 0x9169(%rip), %rdi      # 0xdfd8
leaq 0x55d8(%rip), %rsi      # 0xa44e
movl $0xd, %edx
callq 0x21e0
movq 0x50(%rsp), %rax
movl (%rax), %esi
movq 0x914a(%rip), %rdi      # 0xdfd8
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 0x9114(%rip), %rdi      # 0xdfd8
leaq 0x5591(%rip), %rsi      # 0xa45c
movl $0xe, %edx
callq 0x21e0
movq 0x10(%rsp), %rax
movl (%rax), %esi
movq 0x90f5(%rip), %rdi      # 0xdfd8
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 0x5032
movsd %xmm1, 0x8(%rsp)
movq 0x90b4(%rip), %rdi      # 0xdfd8
leaq 0x54ee(%rip), %rsi      # 0xa419
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 0x907f(%rip), %rdi      # 0xdfd8
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 0x9049(%rip), %r14      # 0xdfd8
leaq 0x5493(%rip), %rsi      # 0xa429
movl $0xf, %edx
movq %r14, %rdi
callq 0x21e0
movq %r12, %rbp
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
subq %rax, %rcx
shrq $0x2, %rcx
testl %ecx, %ecx
jle 0x5004
xorl %r13d, %r13d
movq 0x9013(%rip), %r15      # 0xdfd8
leaq 0x5174(%rip), %r12      # 0xa140
movl (%rax,%r13,4), %esi
movq %r15, %rdi
callq 0x22a0
movl $0x2, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x21e0
incq %r13
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
subq %rax, %rcx
shrq $0x2, %rcx
movslq %ecx, %rcx
cmpq %rcx, %r13
jl 0x4fcc
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x2180
movq %rbp, %r12
movsbl %al, %esi
movq 0x8fb3(%rip), %rdi      # 0xdfd8
callq 0x2030
movq %rax, %rdi
callq 0x2110
movq 0x8f9f(%rip), %rdi      # 0xdfd8
leaq 0x542b(%rip), %rsi      # 0xa46b
movl $0xe, %edx
callq 0x21e0
subq %r12, %rbx
xorps %xmm0, %xmm0
cvtsi2sd %rbx, %xmm0
divsd 0x50eb(%rip), %xmm0     # 0xa148
movq 0x8f74(%rip), %rdi      # 0xdfd8
callq 0x2260
movq %rax, %rbx
leaq 0x5407(%rip), %rsi      # 0xa47a
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 0x50be
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x21a0
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x50d5
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x21a0
leaq 0x38(%rsp), %rdi
callq 0x56fc
leaq 0x138(%rsp), %rdi
callq 0x5af4
xorl %eax, %eax
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x128(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x5069(%rip), %rsi      # 0xa17c
leaq 0x5067(%rip), %rdx      # 0xa181
leaq 0x118(%rsp), %rdi
callq 0x5bfc
movq 0x38(%rsp), %rdi
movq 0x40(%rsp), %rsi
leaq 0x118(%rsp), %rdx
callq 0x59bf
cmpq 0x40(%rsp), %rax
setne %bpl
movb $0x1, %r15b
movb $0x1, %al
jmp 0x4397
leaq 0x532b(%rip), %rdi      # 0xa483
callq 0x20e0
leaq 0x531f(%rip), %rdi      # 0xa483
callq 0x2220
leaq 0x5313(%rip), %rdi      # 0xa483
callq 0x20e0
leaq 0x5307(%rip), %rdi      # 0xa483
callq 0x2220
leaq 0x52fb(%rip), %rdi      # 0xa483
callq 0x20e0
leaq 0x52ef(%rip), %rdi      # 0xa483
callq 0x2220
leaq 0x52e3(%rip), %rdi      # 0xa483
callq 0x20e0
leaq 0x52d7(%rip), %rdi      # 0xa483
callq 0x2220
leaq 0x52cb(%rip), %rdi      # 0xa483
callq 0x20e0
leaq 0x52bf(%rip), %rdi      # 0xa483
callq 0x2220
movq %rax, 0x8(%rsp)
movq 0x118(%rsp), %rdi
cmpq %r13, %rdi
je 0x51f4
movq 0x128(%rsp), %rsi
incq %rsi
callq 0x21a0
jmp 0x51f4
jmp 0x51ef
movq %rax, 0x8(%rsp)
movq 0xd8(%rsp), %rdi
cmpq %r12, %rdi
je 0x52c7
movq 0xe8(%rsp), %rsi
incq %rsi
callq 0x21a0
jmp 0x52c7
jmp 0x52c2
jmp 0x5339
movq %rax, 0x8(%rsp)
cmpl $0x0, (%r12)
jne 0x533e
movl 0xc8(%rsp), %eax
movl %eax, (%r12)
jmp 0x533e
jmp 0x5356
movq %rax, 0x8(%rsp)
cmpl $0x0, (%rbp)
jne 0x533e
movl %ebx, (%rbp)
jmp 0x533e
jmp 0x5356
movq %rax, 0x8(%rsp)
cmpl $0x0, (%r13)
jne 0x533e
movl %ebp, (%r13)
jmp 0x533e
jmp 0x5356
movq %rax, 0x8(%rsp)
cmpl $0x0, (%r12)
jne 0x533e
movl %ebp, (%r12)
jmp 0x533e
jmp 0x5356
movq %rax, 0x8(%rsp)
cmpl $0x0, (%r15)
jne 0x533e
movl %ebp, (%r15)
jmp 0x533e
jmp 0x5356
jmp 0x53eb
movq %rax, 0x8(%rsp)
movq 0xf8(%rsp), %rdi
cmpq %r15, %rdi
je 0x533e
movq 0x108(%rsp), %rsi
incq %rsi
callq 0x21a0
jmp 0x533e
jmp 0x5339
jmp 0x52f8
jmp 0x5356
jmp 0x52f8
jmp 0x5356
jmp 0x52f8
jmp 0x5356
jmp 0x52f8
jmp 0x5356
movq %rax, 0x8(%rsp)
movq 0x50(%rsp), %rdi
cmpq %r12, %rdi
jne 0x53dd
jmp 0x541e
jmp 0x5356
jmp 0x5356
jmp 0x531c
jmp 0x531c
jmp 0x531c
jmp 0x531c
movq %rax, 0x8(%rsp)
movq 0x10(%rsp), %rdi
cmpq %rbx, %rdi
je 0x541e
movq 0x20(%rsp), %rsi
jmp 0x53e2
movq %rax, 0x8(%rsp)
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
jne 0x53dd
jmp 0x541e
movq %rax, 0x8(%rsp)
jmp 0x541e
movq %rax, 0x8(%rsp)
jmp 0x5428
movq %rax, 0x8(%rsp)
leaq 0xc8(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x23b6
movb $0x1, %al
jmp 0x5398
movq %rax, 0x8(%rsp)
xorl %eax, %eax
jmp 0x5398
movq %rax, 0x8(%rsp)
xorl %eax, %eax
movq %r15, %r14
cmpq %r14, %r15
sete %cl
orb %al, %cl
jne 0x5435
leaq 0x50(%rsp), %rbx
movq -0x28(%r14), %rdi
leaq -0x18(%r14), %rax
cmpq %rdi, %rax
je 0x53c3
movq (%rax), %rsi
incq %rsi
callq 0x21a0
addq $-0x28, %r14
cmpq %rbx, %r14
jne 0x53ab
jmp 0x5435
movq %rax, 0x8(%rsp)
movq 0x50(%rsp), %rdi
cmpq %r14, %rdi
je 0x541e
movq 0x60(%rsp), %rsi
incq %rsi
jmp 0x5419
jmp 0x53eb
jmp 0x53eb
movq %rax, 0x8(%rsp)
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x5407
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x21a0
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x541e
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x21a0
leaq 0x38(%rsp), %rdi
callq 0x56fc
leaq 0x138(%rsp), %rdi
callq 0x5af4
movq 0x8(%rsp), %rdi
callq 0x22b0
nop